@pisell/pisellos 0.10.16 → 0.10.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/OpenData/index.d.ts +5 -2
- package/dist/modules/OpenData/index.js +27 -12
- package/dist/modules/OpenData/types.d.ts +42 -0
- package/dist/modules/OpenData/types.js +7 -1
- package/dist/modules/OpenData/utils.d.ts +15 -1
- package/dist/modules/OpenData/utils.js +85 -0
- package/dist/modules/Order/index.d.ts +3 -1
- package/dist/modules/Order/index.js +68 -44
- package/dist/modules/Order/types.d.ts +3 -0
- package/dist/modules/Order/types.js +1 -0
- package/dist/modules/ProductList/index.js +96 -74
- package/dist/modules/Rules/index.js +11 -8
- package/dist/modules/SalesSummary/index.js +6 -4
- package/dist/server/index.d.ts +11 -0
- package/dist/server/index.js +852 -484
- package/dist/server/modules/order/index.d.ts +8 -0
- package/dist/server/modules/order/index.js +251 -215
- package/dist/server/utils/small-ticket.d.ts +9 -1
- package/dist/server/utils/small-ticket.js +117 -43
- package/dist/solution/BaseSales/index.d.ts +7 -0
- package/dist/solution/BaseSales/index.js +251 -144
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +14 -19
- package/dist/solution/BookingTicket/index.js +545 -429
- package/dist/solution/Sales/index.d.ts +20 -4
- package/dist/solution/Sales/index.js +348 -75
- package/dist/solution/Sales/types.d.ts +10 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/dist/solution/UnifiedBookingSales/index.js +495 -422
- package/dist/solution/UnifiedBookingSales/types.d.ts +7 -1
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/OpenData/index.d.ts +5 -2
- package/lib/modules/OpenData/index.js +50 -3
- package/lib/modules/OpenData/types.d.ts +42 -0
- package/lib/modules/OpenData/types.js +9 -1
- package/lib/modules/OpenData/utils.d.ts +15 -1
- package/lib/modules/OpenData/utils.js +85 -0
- package/lib/modules/Order/index.d.ts +3 -1
- package/lib/modules/Order/index.js +41 -21
- package/lib/modules/Order/types.d.ts +3 -0
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/ProductList/index.js +9 -6
- package/lib/modules/Rules/index.js +8 -6
- package/lib/modules/SalesSummary/index.js +3 -1
- package/lib/server/index.d.ts +11 -0
- package/lib/server/index.js +399 -96
- package/lib/server/modules/order/index.d.ts +8 -0
- package/lib/server/modules/order/index.js +23 -0
- package/lib/server/utils/small-ticket.d.ts +9 -1
- package/lib/server/utils/small-ticket.js +107 -35
- package/lib/solution/BaseSales/index.d.ts +7 -0
- package/lib/solution/BaseSales/index.js +125 -28
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +14 -19
- package/lib/solution/BookingTicket/index.js +70 -17
- package/lib/solution/Sales/index.d.ts +20 -4
- package/lib/solution/Sales/index.js +183 -15
- package/lib/solution/Sales/types.d.ts +10 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/lib/solution/UnifiedBookingSales/index.js +41 -15
- package/lib/solution/UnifiedBookingSales/types.d.ts +7 -1
- package/package.json +1 -1
|
@@ -47,6 +47,9 @@ import { QuotationModule } from "../../modules/Quotation";
|
|
|
47
47
|
import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
|
|
48
48
|
import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
|
|
49
49
|
var SERVER_ORDER_CHANGED_EVENT = 'order:onOrdersChanged';
|
|
50
|
+
var OS_FULFILLMENT_REF_MODE_FIELD = '_os_fulfillment_ref_mode';
|
|
51
|
+
var OS_INVOICE_LAYOUT_CONFIG_FIELD = '_os_invoice_layout_config';
|
|
52
|
+
var OS_INVOICE_TEMPLATE_SETTINGS_FIELD = '_os_invoice_template_settings';
|
|
50
53
|
var WALLET_PAYMENT_CODE_BY_TAG = {
|
|
51
54
|
product_voucher: 'PRODUCTVOUCHER',
|
|
52
55
|
gift_card: 'GIFTCARD',
|
|
@@ -1202,6 +1205,88 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1202
1205
|
return (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.channel;
|
|
1203
1206
|
}
|
|
1204
1207
|
|
|
1208
|
+
/** Subclasses with target-scoped OpenData override this guard before reusing the cache. */
|
|
1209
|
+
}, {
|
|
1210
|
+
key: "isInvoiceOpenDataCacheCurrent",
|
|
1211
|
+
value: function isInvoiceOpenDataCacheCurrent() {
|
|
1212
|
+
return true;
|
|
1213
|
+
}
|
|
1214
|
+
}, {
|
|
1215
|
+
key: "getFulfillmentRefModeConfigs",
|
|
1216
|
+
value: function getFulfillmentRefModeConfigs() {
|
|
1217
|
+
var _this$otherParams9, _this$otherParams10, _this$store, _this$store$getOpenDa;
|
|
1218
|
+
var candidates = [(_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.openData, (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.dineInConfig, (_this$store = this.store) === null || _this$store === void 0 || (_this$store = _this$store.openData) === null || _this$store === void 0 || (_this$store$getOpenDa = _this$store.getOpenData) === null || _this$store$getOpenDa === void 0 ? void 0 : _this$store$getOpenDa.call(_this$store)];
|
|
1219
|
+
return candidates.filter(function (candidate) {
|
|
1220
|
+
return candidate && _typeof(candidate) === 'object' && !Array.isArray(candidate);
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
}, {
|
|
1224
|
+
key: "getFulfillmentRefMode",
|
|
1225
|
+
value: function getFulfillmentRefMode() {
|
|
1226
|
+
var _iterator2 = _createForOfIteratorHelper(this.getFulfillmentRefModeConfigs()),
|
|
1227
|
+
_step2;
|
|
1228
|
+
try {
|
|
1229
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1230
|
+
var config = _step2.value;
|
|
1231
|
+
var mode = config['fulfillment.fulfillment_ref_mode'];
|
|
1232
|
+
if (mode === undefined || mode === null) continue;
|
|
1233
|
+
var normalized = String(mode).trim();
|
|
1234
|
+
if (normalized) return normalized;
|
|
1235
|
+
}
|
|
1236
|
+
} catch (err) {
|
|
1237
|
+
_iterator2.e(err);
|
|
1238
|
+
} finally {
|
|
1239
|
+
_iterator2.f();
|
|
1240
|
+
}
|
|
1241
|
+
return undefined;
|
|
1242
|
+
}
|
|
1243
|
+
}, {
|
|
1244
|
+
key: "getCachedInvoiceLayoutConfig",
|
|
1245
|
+
value: function getCachedInvoiceLayoutConfig() {
|
|
1246
|
+
var _this$store2;
|
|
1247
|
+
var openDataModule = (_this$store2 = this.store) === null || _this$store2 === void 0 ? void 0 : _this$store2.openData;
|
|
1248
|
+
if (typeof (openDataModule === null || openDataModule === void 0 ? void 0 : openDataModule.getInvoiceLayoutConfig) !== 'function') return undefined;
|
|
1249
|
+
if (!this.isInvoiceOpenDataCacheCurrent()) return undefined;
|
|
1250
|
+
try {
|
|
1251
|
+
return openDataModule.getInvoiceLayoutConfig();
|
|
1252
|
+
} catch (error) {
|
|
1253
|
+
this.logWarning('读取 Invoice OpenData 布局失败,提交时不注入布局配置', {
|
|
1254
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1255
|
+
});
|
|
1256
|
+
return undefined;
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
}, {
|
|
1260
|
+
key: "getCachedInvoiceTemplateSettings",
|
|
1261
|
+
value: function getCachedInvoiceTemplateSettings() {
|
|
1262
|
+
var _this$store3;
|
|
1263
|
+
var openDataModule = (_this$store3 = this.store) === null || _this$store3 === void 0 ? void 0 : _this$store3.openData;
|
|
1264
|
+
if (typeof (openDataModule === null || openDataModule === void 0 ? void 0 : openDataModule.getInvoiceTemplateSettings) !== 'function') return undefined;
|
|
1265
|
+
if (!this.isInvoiceOpenDataCacheCurrent()) return undefined;
|
|
1266
|
+
try {
|
|
1267
|
+
return openDataModule.getInvoiceTemplateSettings();
|
|
1268
|
+
} catch (error) {
|
|
1269
|
+
this.logWarning('读取 Invoice OpenData 模板配置失败,提交时不注入模板配置', {
|
|
1270
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1271
|
+
});
|
|
1272
|
+
return undefined;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}, {
|
|
1276
|
+
key: "buildSubmitPayloadEnhancerWithOpenDataConfig",
|
|
1277
|
+
value: function buildSubmitPayloadEnhancerWithOpenDataConfig(enhancePayload) {
|
|
1278
|
+
var fulfillmentRefMode = this.getFulfillmentRefMode();
|
|
1279
|
+
var invoiceLayoutConfig = this.getCachedInvoiceLayoutConfig();
|
|
1280
|
+
var invoiceTemplateSettings = this.getCachedInvoiceTemplateSettings();
|
|
1281
|
+
if (!fulfillmentRefMode && !invoiceLayoutConfig && !invoiceTemplateSettings) {
|
|
1282
|
+
return enhancePayload;
|
|
1283
|
+
}
|
|
1284
|
+
return function (payload, ctx) {
|
|
1285
|
+
var enhancedPayload = enhancePayload ? enhancePayload(payload, ctx) : payload;
|
|
1286
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, enhancedPayload), fulfillmentRefMode ? _defineProperty({}, OS_FULFILLMENT_REF_MODE_FIELD, fulfillmentRefMode) : {}), invoiceLayoutConfig ? _defineProperty({}, OS_INVOICE_LAYOUT_CONFIG_FIELD, cloneDeep(invoiceLayoutConfig)) : {}), invoiceTemplateSettings ? _defineProperty({}, OS_INVOICE_TEMPLATE_SETTINGS_FIELD, cloneDeep(invoiceTemplateSettings)) : {});
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1205
1290
|
/**
|
|
1206
1291
|
* 工厂入口:根据子模块名实例化对应模块。
|
|
1207
1292
|
* 默认使用 BookingByStep 公共 `createModule`。子类若需引入额外类型(如 customer),
|
|
@@ -1268,22 +1353,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1268
1353
|
value: (function () {
|
|
1269
1354
|
var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(changedParams) {
|
|
1270
1355
|
var _this6 = this;
|
|
1271
|
-
var
|
|
1272
|
-
|
|
1356
|
+
var _ref26,
|
|
1357
|
+
_ref26$cover,
|
|
1273
1358
|
cover,
|
|
1274
1359
|
_args11 = arguments;
|
|
1275
1360
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1276
1361
|
while (1) switch (_context11.prev = _context11.next) {
|
|
1277
1362
|
case 0:
|
|
1278
|
-
|
|
1363
|
+
_ref26 = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {}, _ref26$cover = _ref26.cover, cover = _ref26$cover === void 0 ? false : _ref26$cover;
|
|
1279
1364
|
_context11.next = 3;
|
|
1280
1365
|
return Promise.all(Object.entries(this.store).map( /*#__PURE__*/function () {
|
|
1281
|
-
var
|
|
1282
|
-
var
|
|
1366
|
+
var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref27) {
|
|
1367
|
+
var _ref29, moduleName, subModule, targetModule, nextSubModuleOtherParams;
|
|
1283
1368
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1284
1369
|
while (1) switch (_context10.prev = _context10.next) {
|
|
1285
1370
|
case 0:
|
|
1286
|
-
|
|
1371
|
+
_ref29 = _slicedToArray(_ref27, 2), moduleName = _ref29[0], subModule = _ref29[1];
|
|
1287
1372
|
if (!_this6.reusedSharedSubModuleNames.has(moduleName)) {
|
|
1288
1373
|
_context10.next = 3;
|
|
1289
1374
|
break;
|
|
@@ -1310,7 +1395,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1310
1395
|
}, _callee10);
|
|
1311
1396
|
}));
|
|
1312
1397
|
return function (_x11) {
|
|
1313
|
-
return
|
|
1398
|
+
return _ref28.apply(this, arguments);
|
|
1314
1399
|
};
|
|
1315
1400
|
}()));
|
|
1316
1401
|
case 3:
|
|
@@ -1390,8 +1475,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1390
1475
|
}, {
|
|
1391
1476
|
key: "isMultiCurrencySettlementEnabled",
|
|
1392
1477
|
value: function isMultiCurrencySettlementEnabled() {
|
|
1393
|
-
var _this$
|
|
1394
|
-
return ((_this$
|
|
1478
|
+
var _this$otherParams11;
|
|
1479
|
+
return ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.enableMultiCurrencySettlement) === true;
|
|
1395
1480
|
}
|
|
1396
1481
|
}, {
|
|
1397
1482
|
key: "isActiveVirtualSettlementOrder",
|
|
@@ -1432,10 +1517,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1432
1517
|
}
|
|
1433
1518
|
tempOrder.metadata = tempOrder.metadata || {};
|
|
1434
1519
|
if (shouldManageLegalCurrencySnapshot) {
|
|
1435
|
-
var
|
|
1520
|
+
var _ref30, _ref31, _tempOrder$metadata$l, _ref32, _ref33, _tempOrder$metadata$l2, _tempOrder$metadata$l3;
|
|
1436
1521
|
var legalCurrencySnapshot = {
|
|
1437
|
-
currency_code: String((
|
|
1438
|
-
currency_symbol: String((
|
|
1522
|
+
currency_code: String((_ref30 = (_ref31 = currencyCode !== null && currencyCode !== void 0 ? currencyCode : (_tempOrder$metadata$l = tempOrder.metadata.legal_currency_snapshot) === null || _tempOrder$metadata$l === void 0 ? void 0 : _tempOrder$metadata$l.currency_code) !== null && _ref31 !== void 0 ? _ref31 : tempOrder.currency_code) !== null && _ref30 !== void 0 ? _ref30 : ''),
|
|
1523
|
+
currency_symbol: String((_ref32 = (_ref33 = currencySymbol !== null && currencySymbol !== void 0 ? currencySymbol : (_tempOrder$metadata$l2 = tempOrder.metadata.legal_currency_snapshot) === null || _tempOrder$metadata$l2 === void 0 ? void 0 : _tempOrder$metadata$l2.currency_symbol) !== null && _ref33 !== void 0 ? _ref33 : tempOrder.currency_symbol) !== null && _ref32 !== void 0 ? _ref32 : ''),
|
|
1439
1524
|
currency_format: String(((_tempOrder$metadata$l3 = tempOrder.metadata.legal_currency_snapshot) === null || _tempOrder$metadata$l3 === void 0 ? void 0 : _tempOrder$metadata$l3.currency_format) || (isVirtualSettlement ? 'symbol_first' : tempOrder.currency_format) || 'symbol_first')
|
|
1440
1525
|
};
|
|
1441
1526
|
if (JSON.stringify(tempOrder.metadata.legal_currency_snapshot || {}) !== JSON.stringify(legalCurrencySnapshot)) {
|
|
@@ -1463,11 +1548,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1463
1548
|
key: "initialize",
|
|
1464
1549
|
value: function () {
|
|
1465
1550
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(core) {
|
|
1466
|
-
var _this$
|
|
1551
|
+
var _this$otherParams12,
|
|
1467
1552
|
_this$appPlugin2,
|
|
1468
1553
|
_this$appPlugin2$getA,
|
|
1469
1554
|
_this9 = this,
|
|
1470
|
-
_this$
|
|
1555
|
+
_this$otherParams13;
|
|
1471
1556
|
var options,
|
|
1472
1557
|
app,
|
|
1473
1558
|
targetCacheData,
|
|
@@ -1482,7 +1567,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1482
1567
|
this.paymentNumberDevicePrefix = null;
|
|
1483
1568
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
1484
1569
|
this.otherParams = options.otherParams || {};
|
|
1485
|
-
this.cacheId = (_this$
|
|
1570
|
+
this.cacheId = (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.cacheId;
|
|
1486
1571
|
this.reusedSharedSubModuleNames.clear();
|
|
1487
1572
|
this.window = core.getPlugin('window');
|
|
1488
1573
|
this.request = core.getPlugin('request');
|
|
@@ -1524,7 +1609,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1524
1609
|
_context12.next = 19;
|
|
1525
1610
|
return this.store.schedule.loadAllSchedule();
|
|
1526
1611
|
case 19:
|
|
1527
|
-
if (this.store.order && typeof ((_this$
|
|
1612
|
+
if (this.store.order && typeof ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.enableTempOrderPersist) === 'boolean') {
|
|
1528
1613
|
this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
|
|
1529
1614
|
}
|
|
1530
1615
|
_context12.next = 22;
|
|
@@ -1596,7 +1681,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1596
1681
|
key: "loadSalesDetail",
|
|
1597
1682
|
value: (function () {
|
|
1598
1683
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(orderIdOrParams) {
|
|
1599
|
-
var loadSequence,
|
|
1684
|
+
var loadSequence, _ref34, _ref35, _ref36, _ref37, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, mergeSourceRecord, currentTempOrder, mergedRecord, record;
|
|
1600
1685
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1601
1686
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1602
1687
|
case 0:
|
|
@@ -1614,7 +1699,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1614
1699
|
};
|
|
1615
1700
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
1616
1701
|
preloadedSalesDetail = params.preloadedSalesDetail;
|
|
1617
|
-
lookup = (
|
|
1702
|
+
lookup = (_ref34 = (_ref35 = (_ref36 = (_ref37 = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : externalSaleNumber) !== null && _ref37 !== void 0 ? _ref37 : params.orderNumber) !== null && _ref36 !== void 0 ? _ref36 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_id) !== null && _ref35 !== void 0 ? _ref35 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.external_sale_number) !== null && _ref34 !== void 0 ? _ref34 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_number;
|
|
1618
1703
|
if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
|
|
1619
1704
|
_context14.next = 11;
|
|
1620
1705
|
break;
|
|
@@ -2232,12 +2317,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2232
2317
|
return !_this12.isPersistedOrderProduct(product);
|
|
2233
2318
|
});
|
|
2234
2319
|
if (hasDraftProduct) return false;
|
|
2235
|
-
|
|
2236
|
-
|
|
2320
|
+
|
|
2321
|
+
// 编辑详情 hydrate 时,商品行上的历史券卡会被还原为 isEditMode=true、
|
|
2322
|
+
// isSelected=true 的只读记录。它们表示“该折扣已在原订单结算”,不是用户在
|
|
2323
|
+
// 当前编辑会话中新做的选择,不能据此放行刚从 prepare/config 拉回来的折扣。
|
|
2324
|
+
// 否则后续 Rules.calcDiscount 会把没有 isManualSelect 标记的可用 runtime 卡
|
|
2325
|
+
// 当作自动候选,再次写入 tempOrder。这里只识别非 isEditMode 的 runtime 状态;
|
|
2326
|
+
// 新建单、编辑态新增商品以及用户本次明确选择/取消折扣的原有流程保持不变。
|
|
2327
|
+
var hasRuntimeDiscountSelection = params.currentDiscountList.some(function (discount) {
|
|
2328
|
+
return !discount.isEditMode && (discount.isSelected || discount.isManualSelect);
|
|
2237
2329
|
});
|
|
2238
|
-
if (
|
|
2330
|
+
if (hasRuntimeDiscountSelection) return false;
|
|
2331
|
+
|
|
2332
|
+
// nextDiscountList 已经合并了历史只读折扣与本次获取的 runtime 折扣,
|
|
2333
|
+
// 因此这里同样必须排除 isEditMode;只有 runtime 条目已有明确选择状态时,
|
|
2334
|
+
// 才允许继续进入折扣重算。
|
|
2239
2335
|
return !params.nextDiscountList.some(function (discount) {
|
|
2240
|
-
return discount.
|
|
2336
|
+
return !discount.isEditMode && (discount.isSelected || discount.isManualSelect);
|
|
2241
2337
|
});
|
|
2242
2338
|
}
|
|
2243
2339
|
}, {
|
|
@@ -2271,7 +2367,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2271
2367
|
value: function () {
|
|
2272
2368
|
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2273
2369
|
var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
|
|
2274
|
-
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, _discountModule$setOr2, _discountModule$setDi, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _orderStore$summary, orderTotalAmount, result,
|
|
2370
|
+
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, _discountModule$setOr2, _discountModule$setDi, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _orderStore$summary, orderTotalAmount, result, _iterator3, _step3, _product$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
|
|
2275
2371
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2276
2372
|
while (1) switch (_context22.prev = _context22.next) {
|
|
2277
2373
|
case 0:
|
|
@@ -2407,15 +2503,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2407
2503
|
if (result.productList) {
|
|
2408
2504
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2409
2505
|
}
|
|
2410
|
-
|
|
2506
|
+
_iterator3 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2411
2507
|
_context22.prev = 53;
|
|
2412
|
-
|
|
2508
|
+
_iterator3.s();
|
|
2413
2509
|
case 55:
|
|
2414
|
-
if ((
|
|
2510
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
2415
2511
|
_context22.next = 70;
|
|
2416
2512
|
break;
|
|
2417
2513
|
}
|
|
2418
|
-
product =
|
|
2514
|
+
product = _step3.value;
|
|
2419
2515
|
productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
|
|
2420
2516
|
runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
|
|
2421
2517
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
@@ -2448,10 +2544,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2448
2544
|
case 72:
|
|
2449
2545
|
_context22.prev = 72;
|
|
2450
2546
|
_context22.t0 = _context22["catch"](53);
|
|
2451
|
-
|
|
2547
|
+
_iterator3.e(_context22.t0);
|
|
2452
2548
|
case 75:
|
|
2453
2549
|
_context22.prev = 75;
|
|
2454
|
-
|
|
2550
|
+
_iterator3.f();
|
|
2455
2551
|
return _context22.finish(75);
|
|
2456
2552
|
case 78:
|
|
2457
2553
|
if (!result.discountList) {
|
|
@@ -2743,7 +2839,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2743
2839
|
key: "setDiscountSelected",
|
|
2744
2840
|
value: function () {
|
|
2745
2841
|
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2746
|
-
var currentOrder, _store3, _store3$setDiscountLi, list, updated, tempOrder, orderStore, discountModule, rulesModule, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds,
|
|
2842
|
+
var currentOrder, _store3, _store3$setDiscountLi, list, updated, tempOrder, orderStore, discountModule, rulesModule, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator4, _step4, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator5, _step5, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
2747
2843
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2748
2844
|
while (1) switch (_context26.prev = _context26.next) {
|
|
2749
2845
|
case 0:
|
|
@@ -2816,10 +2912,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2816
2912
|
}).map(function (d) {
|
|
2817
2913
|
return d.id;
|
|
2818
2914
|
}));
|
|
2819
|
-
|
|
2915
|
+
_iterator4 = _createForOfIteratorHelper(nextDiscountList);
|
|
2820
2916
|
try {
|
|
2821
|
-
for (
|
|
2822
|
-
d =
|
|
2917
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
2918
|
+
d = _step4.value;
|
|
2823
2919
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
2824
2920
|
d.isSelected = false;
|
|
2825
2921
|
d.isManualSelect = true;
|
|
@@ -2827,9 +2923,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2827
2923
|
}
|
|
2828
2924
|
}
|
|
2829
2925
|
} catch (err) {
|
|
2830
|
-
|
|
2926
|
+
_iterator4.e(err);
|
|
2831
2927
|
} finally {
|
|
2832
|
-
|
|
2928
|
+
_iterator4.f();
|
|
2833
2929
|
}
|
|
2834
2930
|
}
|
|
2835
2931
|
}
|
|
@@ -2846,15 +2942,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2846
2942
|
return rid != null && selectedResourceIds.has(rid);
|
|
2847
2943
|
});
|
|
2848
2944
|
};
|
|
2849
|
-
|
|
2945
|
+
_iterator5 = _createForOfIteratorHelper(tempOrder.products);
|
|
2850
2946
|
_context26.prev = 27;
|
|
2851
|
-
|
|
2947
|
+
_iterator5.s();
|
|
2852
2948
|
case 29:
|
|
2853
|
-
if ((
|
|
2949
|
+
if ((_step5 = _iterator5.n()).done) {
|
|
2854
2950
|
_context26.next = 46;
|
|
2855
2951
|
break;
|
|
2856
2952
|
}
|
|
2857
|
-
product =
|
|
2953
|
+
product = _step5.value;
|
|
2858
2954
|
productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
|
|
2859
2955
|
runtimeOrigin = productUid ? (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[productUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin : undefined;
|
|
2860
2956
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
@@ -2866,10 +2962,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2866
2962
|
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
2867
2963
|
if (Array.isArray(product.product_bundle)) {
|
|
2868
2964
|
product.product_bundle = product.product_bundle.map(function (bundle) {
|
|
2869
|
-
var
|
|
2965
|
+
var _ref38, _bundle$original_pric;
|
|
2870
2966
|
var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
|
|
2871
2967
|
var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
|
|
2872
|
-
var restoredBundlePrice = (
|
|
2968
|
+
var restoredBundlePrice = (_ref38 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref38 !== void 0 ? _ref38 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
|
|
2873
2969
|
return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
|
|
2874
2970
|
price: restoredBundlePrice,
|
|
2875
2971
|
bundle_selling_price: restoredBundlePrice
|
|
@@ -2905,10 +3001,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2905
3001
|
case 48:
|
|
2906
3002
|
_context26.prev = 48;
|
|
2907
3003
|
_context26.t0 = _context26["catch"](27);
|
|
2908
|
-
|
|
3004
|
+
_iterator5.e(_context26.t0);
|
|
2909
3005
|
case 51:
|
|
2910
3006
|
_context26.prev = 51;
|
|
2911
|
-
|
|
3007
|
+
_iterator5.f();
|
|
2912
3008
|
return _context26.finish(51);
|
|
2913
3009
|
case 54:
|
|
2914
3010
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
@@ -3202,8 +3298,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3202
3298
|
key: "submitSalesOrder",
|
|
3203
3299
|
value: (function () {
|
|
3204
3300
|
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
3205
|
-
var _params$smallTicketDa, _this$
|
|
3206
|
-
var virtualSettlement, inferredPaymentStatus, smallTicketDataFlag, submitParams;
|
|
3301
|
+
var _params$smallTicketDa, _this$otherParams14, _this$otherParams15, _this$otherParams16, _this$otherParams17;
|
|
3302
|
+
var virtualSettlement, inferredPaymentStatus, smallTicketDataFlag, virtualSettlementEnhancePayload, enhancePayload, submitParams;
|
|
3207
3303
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3208
3304
|
while (1) switch (_context30.prev = _context30.next) {
|
|
3209
3305
|
case 0:
|
|
@@ -3220,12 +3316,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3220
3316
|
// this.store.order.persistTempOrder();
|
|
3221
3317
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
3222
3318
|
smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
3319
|
+
virtualSettlementEnhancePayload = virtualSettlement ? function (payload, ctx) {
|
|
3320
|
+
var _callerPayload$metada, _currencySettlementCo;
|
|
3321
|
+
var callerPayload = params !== null && params !== void 0 && params.enhancePayload ? params.enhancePayload(payload, ctx) : payload;
|
|
3322
|
+
var currencySettlementConfig = ((_callerPayload$metada = callerPayload.metadata) === null || _callerPayload$metada === void 0 ? void 0 : _callerPayload$metada.currency_settlement_config) || {};
|
|
3323
|
+
return _objectSpread(_objectSpread({}, callerPayload), {}, {
|
|
3324
|
+
metadata: _objectSpread(_objectSpread({}, callerPayload.metadata || {}), {}, {
|
|
3325
|
+
currency_settlement_config: _objectSpread(_objectSpread({}, currencySettlementConfig), {}, {
|
|
3326
|
+
settlement_type: 'virtual_currency',
|
|
3327
|
+
settlement_ids: [virtualSettlement.currencyProductId],
|
|
3328
|
+
currency_display_snapshot: cloneDeep((_currencySettlementCo = currencySettlementConfig.currency_display_snapshot) !== null && _currencySettlementCo !== void 0 ? _currencySettlementCo : buildCurrencyDisplaySnapshot(virtualSettlement.snapshot))
|
|
3329
|
+
})
|
|
3330
|
+
}),
|
|
3331
|
+
currency_code: virtualSettlement.currencyCode,
|
|
3332
|
+
currency_symbol: virtualSettlement.currencySymbol,
|
|
3333
|
+
currency_format: virtualSettlement.currencyFormat
|
|
3334
|
+
});
|
|
3335
|
+
} : params === null || params === void 0 ? void 0 : params.enhancePayload;
|
|
3336
|
+
enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(virtualSettlementEnhancePayload);
|
|
3223
3337
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
3224
3338
|
cacheId: this.cacheId,
|
|
3225
|
-
platform: (_this$
|
|
3226
|
-
businessCode: ((_this$
|
|
3339
|
+
platform: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform,
|
|
3340
|
+
businessCode: ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.businessCode) || ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.business_code),
|
|
3227
3341
|
channel: this.getSubmitOrderSalesChannel(),
|
|
3228
|
-
type: (_this$
|
|
3342
|
+
type: (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.type,
|
|
3229
3343
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
3230
3344
|
}, virtualSettlement ? {
|
|
3231
3345
|
payments: virtualSettlement.payments
|
|
@@ -3239,29 +3353,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3239
3353
|
confirmPendingVoucherPayments: false
|
|
3240
3354
|
} : (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
3241
3355
|
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
3242
|
-
} : {}),
|
|
3243
|
-
enhancePayload:
|
|
3244
|
-
var _callerPayload$metada, _currencySettlementCo;
|
|
3245
|
-
var callerPayload = params !== null && params !== void 0 && params.enhancePayload ? params.enhancePayload(payload, ctx) : payload;
|
|
3246
|
-
var currencySettlementConfig = ((_callerPayload$metada = callerPayload.metadata) === null || _callerPayload$metada === void 0 ? void 0 : _callerPayload$metada.currency_settlement_config) || {};
|
|
3247
|
-
return _objectSpread(_objectSpread({}, callerPayload), {}, {
|
|
3248
|
-
metadata: _objectSpread(_objectSpread({}, callerPayload.metadata || {}), {}, {
|
|
3249
|
-
currency_settlement_config: _objectSpread(_objectSpread({}, currencySettlementConfig), {}, {
|
|
3250
|
-
settlement_type: 'virtual_currency',
|
|
3251
|
-
settlement_ids: [virtualSettlement.currencyProductId],
|
|
3252
|
-
currency_display_snapshot: cloneDeep((_currencySettlementCo = currencySettlementConfig.currency_display_snapshot) !== null && _currencySettlementCo !== void 0 ? _currencySettlementCo : buildCurrencyDisplaySnapshot(virtualSettlement.snapshot))
|
|
3253
|
-
})
|
|
3254
|
-
}),
|
|
3255
|
-
currency_code: virtualSettlement.currencyCode,
|
|
3256
|
-
currency_symbol: virtualSettlement.currencySymbol,
|
|
3257
|
-
currency_format: virtualSettlement.currencyFormat
|
|
3258
|
-
});
|
|
3259
|
-
}
|
|
3260
|
-
} : (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
3261
|
-
enhancePayload: params.enhancePayload
|
|
3356
|
+
} : {}), enhancePayload !== undefined ? {
|
|
3357
|
+
enhancePayload: enhancePayload
|
|
3262
3358
|
} : {});
|
|
3263
3359
|
return _context30.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
|
|
3264
|
-
case
|
|
3360
|
+
case 11:
|
|
3265
3361
|
case "end":
|
|
3266
3362
|
return _context30.stop();
|
|
3267
3363
|
}
|
|
@@ -3276,7 +3372,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3276
3372
|
key: "saveSalesOrderDraft",
|
|
3277
3373
|
value: function () {
|
|
3278
3374
|
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3279
|
-
var _params$platform, _this$
|
|
3375
|
+
var _params$platform, _this$otherParams18, _this$otherParams19, _this$otherParams20, _params$channel, _params$type, _this$otherParams21;
|
|
3280
3376
|
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3281
3377
|
while (1) switch (_context31.prev = _context31.next) {
|
|
3282
3378
|
case 0:
|
|
@@ -3288,10 +3384,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3288
3384
|
case 2:
|
|
3289
3385
|
return _context31.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
|
|
3290
3386
|
cacheId: this.cacheId,
|
|
3291
|
-
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$
|
|
3292
|
-
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$
|
|
3387
|
+
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform,
|
|
3388
|
+
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.businessCode) || ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.business_code),
|
|
3293
3389
|
channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
|
|
3294
|
-
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$
|
|
3390
|
+
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.type
|
|
3295
3391
|
}, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
3296
3392
|
enhancePayload: params.enhancePayload
|
|
3297
3393
|
} : {})));
|
|
@@ -3310,8 +3406,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3310
3406
|
key: "submitTempOrderAsync",
|
|
3311
3407
|
value: function () {
|
|
3312
3408
|
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3313
|
-
var _params$smallTicketDa2, _this$
|
|
3314
|
-
var inferredPaymentStatus, smallTicketDataFlag, submitParams;
|
|
3409
|
+
var _params$smallTicketDa2, _this$otherParams22, _this$otherParams23, _this$otherParams24, _this$otherParams25;
|
|
3410
|
+
var inferredPaymentStatus, smallTicketDataFlag, enhancePayload, submitParams;
|
|
3315
3411
|
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3316
3412
|
while (1) switch (_context32.prev = _context32.next) {
|
|
3317
3413
|
case 0:
|
|
@@ -3323,12 +3419,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3323
3419
|
case 2:
|
|
3324
3420
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
3325
3421
|
smallTicketDataFlag = (_params$smallTicketDa2 = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa2 !== void 0 ? _params$smallTicketDa2 : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
3422
|
+
enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params === null || params === void 0 ? void 0 : params.enhancePayload);
|
|
3326
3423
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
3327
3424
|
cacheId: this.cacheId,
|
|
3328
|
-
platform: (_this$
|
|
3329
|
-
businessCode: ((_this$
|
|
3425
|
+
platform: (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.platform,
|
|
3426
|
+
businessCode: ((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.businessCode) || ((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.business_code),
|
|
3330
3427
|
channel: this.getSubmitOrderSalesChannel(),
|
|
3331
|
-
type: (_this$
|
|
3428
|
+
type: (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.type,
|
|
3332
3429
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
3333
3430
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
3334
3431
|
payments: params.payments
|
|
@@ -3338,11 +3435,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3338
3435
|
smallTicketDataFlag: smallTicketDataFlag
|
|
3339
3436
|
} : {}), (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
3340
3437
|
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
3341
|
-
} : {}),
|
|
3342
|
-
enhancePayload:
|
|
3438
|
+
} : {}), enhancePayload !== undefined ? {
|
|
3439
|
+
enhancePayload: enhancePayload
|
|
3343
3440
|
} : {});
|
|
3344
3441
|
return _context32.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
|
|
3345
|
-
case
|
|
3442
|
+
case 7:
|
|
3346
3443
|
case "end":
|
|
3347
3444
|
return _context32.stop();
|
|
3348
3445
|
}
|
|
@@ -3360,8 +3457,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3360
3457
|
}, {
|
|
3361
3458
|
key: "shouldUseCheckoutSyncTask",
|
|
3362
3459
|
value: function shouldUseCheckoutSyncTask() {
|
|
3363
|
-
var _this$
|
|
3364
|
-
var configured = (_this$
|
|
3460
|
+
var _this$otherParams26;
|
|
3461
|
+
var configured = (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.checkoutSyncTaskEnabled;
|
|
3365
3462
|
return typeof configured === 'boolean' ? configured : true;
|
|
3366
3463
|
}
|
|
3367
3464
|
|
|
@@ -3375,8 +3472,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3375
3472
|
key: "printLocalOrderReceipt",
|
|
3376
3473
|
value: function () {
|
|
3377
3474
|
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(lookup) {
|
|
3378
|
-
var _this$
|
|
3379
|
-
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order6, _data;
|
|
3475
|
+
var _this$otherParams27, _this$otherParams28, _this$otherParams29, _this$otherParams30;
|
|
3476
|
+
var hasLookup, lookupPayload, context, payload, invoiceLayoutConfig, invoiceTemplateSettings, printPayload, response, _this$store$order$app, _this$store$order6, _data;
|
|
3380
3477
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3381
3478
|
while (1) switch (_context33.prev = _context33.next) {
|
|
3382
3479
|
case 0:
|
|
@@ -3393,10 +3490,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3393
3490
|
external_sale_number: lookup
|
|
3394
3491
|
};
|
|
3395
3492
|
context = {
|
|
3396
|
-
platform: (_this$
|
|
3397
|
-
businessCode: ((_this$
|
|
3493
|
+
platform: (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform,
|
|
3494
|
+
businessCode: ((_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.businessCode) || ((_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.business_code),
|
|
3398
3495
|
channel: this.getSubmitOrderSalesChannel(),
|
|
3399
|
-
type: (_this$
|
|
3496
|
+
type: (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.type
|
|
3400
3497
|
};
|
|
3401
3498
|
payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
|
|
3402
3499
|
lookup_order_from_db: 1,
|
|
@@ -3412,22 +3509,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3412
3509
|
channel: context.channel,
|
|
3413
3510
|
type: context.type
|
|
3414
3511
|
});
|
|
3415
|
-
|
|
3416
|
-
|
|
3512
|
+
invoiceLayoutConfig = this.getCachedInvoiceLayoutConfig();
|
|
3513
|
+
invoiceTemplateSettings = this.getCachedInvoiceTemplateSettings();
|
|
3514
|
+
printPayload = _objectSpread(_objectSpread(_objectSpread({}, payload), invoiceLayoutConfig ? {
|
|
3515
|
+
invoice: cloneDeep(invoiceLayoutConfig)
|
|
3516
|
+
} : {}), invoiceTemplateSettings ? {
|
|
3517
|
+
template_settings: cloneDeep(invoiceTemplateSettings)
|
|
3518
|
+
} : {});
|
|
3519
|
+
_context33.next = 11;
|
|
3520
|
+
return this.request.post('/local/print-order', printPayload, {
|
|
3417
3521
|
osServer: true,
|
|
3418
3522
|
customToast: function customToast() {}
|
|
3419
3523
|
});
|
|
3420
|
-
case
|
|
3524
|
+
case 11:
|
|
3421
3525
|
response = _context33.sent;
|
|
3422
3526
|
if (hasLookup) {
|
|
3423
|
-
_context33.next =
|
|
3527
|
+
_context33.next = 15;
|
|
3424
3528
|
break;
|
|
3425
3529
|
}
|
|
3426
|
-
_context33.next =
|
|
3530
|
+
_context33.next = 15;
|
|
3427
3531
|
return (_this$store$order$app = (_this$store$order6 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order6, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
|
|
3428
|
-
case
|
|
3532
|
+
case 15:
|
|
3429
3533
|
return _context33.abrupt("return", response);
|
|
3430
|
-
case
|
|
3534
|
+
case 16:
|
|
3431
3535
|
case "end":
|
|
3432
3536
|
return _context33.stop();
|
|
3433
3537
|
}
|
|
@@ -3455,8 +3559,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3455
3559
|
key: "syncPaymentsToOrder",
|
|
3456
3560
|
value: function () {
|
|
3457
3561
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
3458
|
-
var
|
|
3459
|
-
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
3562
|
+
var _ref39, _params$businessCode, _this$otherParams31, _this$otherParams32, _params$channel2;
|
|
3563
|
+
var businessCode, channel, enhancePayload, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
3460
3564
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3461
3565
|
while (1) switch (_context34.prev = _context34.next) {
|
|
3462
3566
|
case 0:
|
|
@@ -3466,36 +3570,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3466
3570
|
}
|
|
3467
3571
|
throw new Error('order 模块未初始化');
|
|
3468
3572
|
case 2:
|
|
3469
|
-
businessCode = (
|
|
3573
|
+
businessCode = (_ref39 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.businessCode) !== null && _ref39 !== void 0 ? _ref39 : (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.business_code;
|
|
3470
3574
|
channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
|
|
3471
|
-
|
|
3575
|
+
enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params.enhancePayload);
|
|
3576
|
+
syncParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, params), {}, {
|
|
3472
3577
|
checkoutSyncTaskEnabled: this.shouldUseCheckoutSyncTask()
|
|
3473
3578
|
}, businessCode !== undefined ? {
|
|
3474
3579
|
businessCode: businessCode
|
|
3475
3580
|
} : {}), channel !== undefined ? {
|
|
3476
3581
|
channel: channel
|
|
3582
|
+
} : {}), enhancePayload !== undefined ? {
|
|
3583
|
+
enhancePayload: enhancePayload
|
|
3477
3584
|
} : {});
|
|
3478
3585
|
syncState = this.store.order.getOrderSyncState();
|
|
3479
3586
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
3480
|
-
_context34.next =
|
|
3587
|
+
_context34.next = 10;
|
|
3481
3588
|
break;
|
|
3482
3589
|
}
|
|
3483
3590
|
this.queueLatestAutoPaymentSync();
|
|
3484
3591
|
return _context34.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
3485
|
-
case
|
|
3592
|
+
case 10:
|
|
3486
3593
|
payments = params.payments || [];
|
|
3487
|
-
_context34.next =
|
|
3594
|
+
_context34.next = 13;
|
|
3488
3595
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
3489
3596
|
payments: payments,
|
|
3490
3597
|
params: syncParams,
|
|
3491
3598
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
3492
3599
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
3493
3600
|
});
|
|
3494
|
-
case
|
|
3495
|
-
_context34.prev =
|
|
3496
|
-
_context34.next =
|
|
3601
|
+
case 13:
|
|
3602
|
+
_context34.prev = 13;
|
|
3603
|
+
_context34.next = 16;
|
|
3497
3604
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
3498
|
-
case
|
|
3605
|
+
case 16:
|
|
3499
3606
|
syncResult = _context34.sent;
|
|
3500
3607
|
latestPayments = this.store.order.getOrderPayments();
|
|
3501
3608
|
amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
@@ -3514,22 +3621,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3514
3621
|
depositAmount: syncResult.depositAmount,
|
|
3515
3622
|
orderExpectedAmount: syncResult.orderExpectedAmount
|
|
3516
3623
|
};
|
|
3517
|
-
_context34.next =
|
|
3624
|
+
_context34.next = 23;
|
|
3518
3625
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
|
|
3519
|
-
case
|
|
3626
|
+
case 23:
|
|
3520
3627
|
if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
|
|
3521
|
-
_context34.next =
|
|
3628
|
+
_context34.next = 26;
|
|
3522
3629
|
break;
|
|
3523
3630
|
}
|
|
3524
|
-
_context34.next =
|
|
3631
|
+
_context34.next = 26;
|
|
3525
3632
|
return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
|
|
3526
|
-
case
|
|
3633
|
+
case 26:
|
|
3527
3634
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
3528
3635
|
return _context34.abrupt("return", syncResult);
|
|
3529
|
-
case
|
|
3530
|
-
_context34.prev =
|
|
3531
|
-
_context34.t0 = _context34["catch"](
|
|
3532
|
-
_context34.next =
|
|
3636
|
+
case 30:
|
|
3637
|
+
_context34.prev = 30;
|
|
3638
|
+
_context34.t0 = _context34["catch"](13);
|
|
3639
|
+
_context34.next = 34;
|
|
3533
3640
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
3534
3641
|
ok: false,
|
|
3535
3642
|
error: _context34.t0,
|
|
@@ -3538,14 +3645,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3538
3645
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
3539
3646
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
3540
3647
|
});
|
|
3541
|
-
case
|
|
3648
|
+
case 34:
|
|
3542
3649
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
3543
3650
|
throw _context34.t0;
|
|
3544
|
-
case
|
|
3651
|
+
case 36:
|
|
3545
3652
|
case "end":
|
|
3546
3653
|
return _context34.stop();
|
|
3547
3654
|
}
|
|
3548
|
-
}, _callee34, this, [[
|
|
3655
|
+
}, _callee34, this, [[13, 30]]);
|
|
3549
3656
|
}));
|
|
3550
3657
|
function syncPaymentsToOrder(_x28) {
|
|
3551
3658
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
@@ -3725,10 +3832,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3725
3832
|
}, {
|
|
3726
3833
|
key: "addOrderPaymentWithDevicePrefix",
|
|
3727
3834
|
value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
|
|
3728
|
-
var _this$
|
|
3835
|
+
var _this$otherParams33,
|
|
3729
3836
|
_paymentRecord$paymen,
|
|
3730
3837
|
_paymentRecord$create,
|
|
3731
|
-
|
|
3838
|
+
_ref40,
|
|
3732
3839
|
_paymentRecord$origin,
|
|
3733
3840
|
_this14 = this;
|
|
3734
3841
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
@@ -3741,7 +3848,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3741
3848
|
return this.store.order.getOrderPayments();
|
|
3742
3849
|
}
|
|
3743
3850
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
3744
|
-
var shopWalletPassId = (_this$
|
|
3851
|
+
var shopWalletPassId = (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.shop_wallet_pass_id;
|
|
3745
3852
|
if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
|
|
3746
3853
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
3747
3854
|
}
|
|
@@ -3750,7 +3857,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3750
3857
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
3751
3858
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
3752
3859
|
var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
|
|
3753
|
-
var calculatedServiceFee = serviceCharge ? new Decimal((
|
|
3860
|
+
var calculatedServiceFee = serviceCharge ? new Decimal((_ref40 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref40 !== void 0 ? _ref40 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
|
|
3754
3861
|
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, normalizedPaymentRecord), calculatedServiceFee !== undefined ? {
|
|
3755
3862
|
service_fee: calculatedServiceFee
|
|
3756
3863
|
} : {}), {}, {
|
|
@@ -4031,7 +4138,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4031
4138
|
}, {
|
|
4032
4139
|
key: "buildWalletInitBusinessData",
|
|
4033
4140
|
value: function buildWalletInitBusinessData(params) {
|
|
4034
|
-
var _this$store$order9, _params$order_wait_pa,
|
|
4141
|
+
var _this$store$order9, _params$order_wait_pa, _ref41, _tempOrder$is_price_i;
|
|
4035
4142
|
var snapshot = (_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 ? void 0 : _this$store$order9.getOrderSnapshot();
|
|
4036
4143
|
var tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
4037
4144
|
var amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
@@ -4047,7 +4154,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4047
4154
|
},
|
|
4048
4155
|
products: this.getWalletProductList(),
|
|
4049
4156
|
order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
|
|
4050
|
-
is_price_include_tax: (
|
|
4157
|
+
is_price_include_tax: (_ref41 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref41 !== void 0 ? _ref41 : 1
|
|
4051
4158
|
}, snapshot.identity.orderId ? {
|
|
4052
4159
|
payment_order_id: String(snapshot.identity.orderId)
|
|
4053
4160
|
} : {});
|
|
@@ -4137,9 +4244,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4137
4244
|
var walletPassName = fundRecord.wallet_pass_name;
|
|
4138
4245
|
var title = walletPassName && _typeof(walletPassName) === 'object' ? walletPassName.default || Object.values(walletPassName)[0] : walletPassName;
|
|
4139
4246
|
var code = String((payment === null || payment === void 0 ? void 0 : payment.code) || '').toUpperCase();
|
|
4140
|
-
var tag = ((_Object$entries$find = Object.entries(WALLET_PAYMENT_CODE_BY_TAG).find(function (
|
|
4141
|
-
var
|
|
4142
|
-
paymentCode =
|
|
4247
|
+
var tag = ((_Object$entries$find = Object.entries(WALLET_PAYMENT_CODE_BY_TAG).find(function (_ref42) {
|
|
4248
|
+
var _ref43 = _slicedToArray(_ref42, 2),
|
|
4249
|
+
paymentCode = _ref43[1];
|
|
4143
4250
|
return paymentCode === code;
|
|
4144
4251
|
})) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[0]) || fundRecord.tag;
|
|
4145
4252
|
return {
|
|
@@ -4640,7 +4747,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4640
4747
|
key: "getCashPaymentConfig",
|
|
4641
4748
|
value: (function () {
|
|
4642
4749
|
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49() {
|
|
4643
|
-
var _this$store$order12, _this$store$order12$g, _this$store$order13, _this$store$order13$g, _this$
|
|
4750
|
+
var _this$store$order12, _this$store$order12$g, _this$store$order13, _this$store$order13$g, _this$otherParams34;
|
|
4644
4751
|
var paymentMethods, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, currency, recommendedAmounts;
|
|
4645
4752
|
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4646
4753
|
while (1) switch (_context49.prev = _context49.next) {
|
|
@@ -4666,7 +4773,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4666
4773
|
amountSnapshot = (_this$store$order12 = this.store.order) === null || _this$store$order12 === void 0 || (_this$store$order12$g = _this$store$order12.getOrderAmountSnapshot) === null || _this$store$order12$g === void 0 ? void 0 : _this$store$order12$g.call(_this$store$order12);
|
|
4667
4774
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
4668
4775
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
|
|
4669
|
-
currency = ((_this$store$order13 = this.store.order) === null || _this$store$order13 === void 0 || (_this$store$order13$g = _this$store$order13.getTempOrder) === null || _this$store$order13$g === void 0 || (_this$store$order13$g = _this$store$order13$g.call(_this$store$order13)) === null || _this$store$order13$g === void 0 ? void 0 : _this$store$order13$g.currency_code) || ((_this$
|
|
4776
|
+
currency = ((_this$store$order13 = this.store.order) === null || _this$store$order13 === void 0 || (_this$store$order13$g = _this$store$order13.getTempOrder) === null || _this$store$order13$g === void 0 || (_this$store$order13$g = _this$store$order13$g.call(_this$store$order13)) === null || _this$store$order13$g === void 0 ? void 0 : _this$store$order13$g.currency_code) || ((_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.currency) || 'USD';
|
|
4670
4777
|
recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
|
|
4671
4778
|
return _context49.abrupt("return", {
|
|
4672
4779
|
available: Boolean(paymentMethod && amountDue > 0),
|
|
@@ -4801,7 +4908,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4801
4908
|
key: "payCash",
|
|
4802
4909
|
value: (function () {
|
|
4803
4910
|
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
|
|
4804
|
-
var _this$store$order$get6, _params$actualPaidAmo, _this$
|
|
4911
|
+
var _this$store$order$get6, _params$actualPaidAmo, _this$otherParams35, _this$window, _this$window$postMess;
|
|
4805
4912
|
var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
4806
4913
|
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
4807
4914
|
while (1) switch (_context51.prev = _context51.next) {
|
|
@@ -4850,7 +4957,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4850
4957
|
paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
4851
4958
|
actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
|
|
4852
4959
|
changeAmount = Number(params.changeAmount || 0);
|
|
4853
|
-
shopWalletPassId = (_this$
|
|
4960
|
+
shopWalletPassId = (_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.shop_wallet_pass_id;
|
|
4854
4961
|
if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
|
|
4855
4962
|
_context51.next = 26;
|
|
4856
4963
|
break;
|
|
@@ -5165,7 +5272,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5165
5272
|
key: "sendCustomerPayLink",
|
|
5166
5273
|
value: (function () {
|
|
5167
5274
|
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(params) {
|
|
5168
|
-
var orderIds,
|
|
5275
|
+
var orderIds, _ref44, _ref45, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
5169
5276
|
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5170
5277
|
while (1) switch (_context54.prev = _context54.next) {
|
|
5171
5278
|
case 0:
|
|
@@ -5186,7 +5293,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5186
5293
|
});
|
|
5187
5294
|
case 6:
|
|
5188
5295
|
submitResult = _context54.sent;
|
|
5189
|
-
orderId = (
|
|
5296
|
+
orderId = (_ref44 = (_ref45 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref45 !== void 0 ? _ref45 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref44 !== void 0 ? _ref44 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
5190
5297
|
if (orderId) {
|
|
5191
5298
|
_context54.next = 10;
|
|
5192
5299
|
break;
|
|
@@ -5378,12 +5485,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5378
5485
|
});
|
|
5379
5486
|
_context57.next = 11;
|
|
5380
5487
|
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
5381
|
-
var
|
|
5382
|
-
var
|
|
5488
|
+
var _ref47 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(_ref46) {
|
|
5489
|
+
var _ref48, groupKey, group, productsById;
|
|
5383
5490
|
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
5384
5491
|
while (1) switch (_context56.prev = _context56.next) {
|
|
5385
5492
|
case 0:
|
|
5386
|
-
|
|
5493
|
+
_ref48 = _slicedToArray(_ref46, 2), groupKey = _ref48[0], group = _ref48[1];
|
|
5387
5494
|
_context56.next = 3;
|
|
5388
5495
|
return _this16.loadProductsForPriceQuery({
|
|
5389
5496
|
ids: Array.from(group.ids),
|
|
@@ -5401,7 +5508,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5401
5508
|
}, _callee56);
|
|
5402
5509
|
}));
|
|
5403
5510
|
return function (_x48) {
|
|
5404
|
-
return
|
|
5511
|
+
return _ref47.apply(this, arguments);
|
|
5405
5512
|
};
|
|
5406
5513
|
}()));
|
|
5407
5514
|
case 11:
|
|
@@ -5785,13 +5892,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5785
5892
|
key: "getProductList",
|
|
5786
5893
|
value: function () {
|
|
5787
5894
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66() {
|
|
5788
|
-
var _this$
|
|
5895
|
+
var _this$otherParams36;
|
|
5789
5896
|
var menu_list_ids, _this$store$products, res;
|
|
5790
5897
|
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
|
5791
5898
|
while (1) switch (_context66.prev = _context66.next) {
|
|
5792
5899
|
case 0:
|
|
5793
5900
|
// 可以直接通过配置里的 menu 读取
|
|
5794
|
-
menu_list_ids = ((_this$
|
|
5901
|
+
menu_list_ids = ((_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 || (_this$otherParams36 = _this$otherParams36.dineInConfig) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36['menu.associated_menus'].map(function (n) {
|
|
5795
5902
|
return Number(n.value);
|
|
5796
5903
|
})) || [];
|
|
5797
5904
|
_context66.prev = 1;
|
|
@@ -5829,21 +5936,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5829
5936
|
key: "setOtherParams",
|
|
5830
5937
|
value: function () {
|
|
5831
5938
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(params) {
|
|
5832
|
-
var _this$
|
|
5833
|
-
var
|
|
5834
|
-
|
|
5939
|
+
var _this$otherParams37;
|
|
5940
|
+
var _ref49,
|
|
5941
|
+
_ref49$cover,
|
|
5835
5942
|
cover,
|
|
5836
5943
|
_args67 = arguments;
|
|
5837
5944
|
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
|
5838
5945
|
while (1) switch (_context67.prev = _context67.next) {
|
|
5839
5946
|
case 0:
|
|
5840
|
-
|
|
5947
|
+
_ref49 = _args67.length > 1 && _args67[1] !== undefined ? _args67[1] : {}, _ref49$cover = _ref49.cover, cover = _ref49$cover === void 0 ? false : _ref49$cover;
|
|
5841
5948
|
if (cover) {
|
|
5842
5949
|
this.otherParams = _objectSpread({}, params);
|
|
5843
5950
|
} else {
|
|
5844
5951
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
5845
5952
|
}
|
|
5846
|
-
this.cacheId = (_this$
|
|
5953
|
+
this.cacheId = (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.cacheId;
|
|
5847
5954
|
_context67.next = 5;
|
|
5848
5955
|
return this.syncOtherParamsToSubModules(params, {
|
|
5849
5956
|
cover: cover
|