@pisell/pisellos 2.3.29 → 2.3.31

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.
Files changed (48) hide show
  1. package/dist/modules/Order/index.d.ts +27 -8
  2. package/dist/modules/Order/index.js +736 -473
  3. package/dist/modules/Order/payment-utils.d.ts +23 -0
  4. package/dist/modules/Order/payment-utils.js +203 -0
  5. package/dist/modules/Order/types.d.ts +33 -1
  6. package/dist/modules/Order/utils.js +4 -4
  7. package/dist/modules/Payment/index.d.ts +2 -0
  8. package/dist/modules/Payment/index.js +78 -49
  9. package/dist/modules/Payment/types.d.ts +26 -24
  10. package/dist/modules/Payment/types.js +2 -0
  11. package/dist/server/index.d.ts +14 -0
  12. package/dist/server/index.js +1850 -1024
  13. package/dist/server/modules/order/index.d.ts +40 -3
  14. package/dist/server/modules/order/index.js +1200 -501
  15. package/dist/server/modules/order/types.d.ts +11 -3
  16. package/dist/server/modules/order/types.js +1 -1
  17. package/dist/solution/BaseSales/index.d.ts +33 -3
  18. package/dist/solution/BaseSales/index.js +609 -322
  19. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  20. package/dist/solution/BookingByStep/index.d.ts +1 -1
  21. package/dist/solution/BookingTicket/index.d.ts +1 -1
  22. package/dist/solution/BookingTicket/index.js +2 -1
  23. package/dist/utils/payment-number.d.ts +9 -0
  24. package/dist/utils/payment-number.js +69 -0
  25. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  26. package/lib/modules/Order/index.d.ts +27 -8
  27. package/lib/modules/Order/index.js +180 -60
  28. package/lib/modules/Order/payment-utils.d.ts +23 -0
  29. package/lib/modules/Order/payment-utils.js +193 -0
  30. package/lib/modules/Order/types.d.ts +33 -1
  31. package/lib/modules/Order/utils.js +2 -3
  32. package/lib/modules/Payment/index.d.ts +2 -0
  33. package/lib/modules/Payment/index.js +33 -12
  34. package/lib/modules/Payment/types.d.ts +26 -24
  35. package/lib/server/index.d.ts +14 -0
  36. package/lib/server/index.js +604 -8
  37. package/lib/server/modules/order/index.d.ts +40 -3
  38. package/lib/server/modules/order/index.js +434 -31
  39. package/lib/server/modules/order/types.d.ts +11 -3
  40. package/lib/solution/BaseSales/index.d.ts +33 -3
  41. package/lib/solution/BaseSales/index.js +167 -7
  42. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  43. package/lib/solution/BookingByStep/index.d.ts +1 -1
  44. package/lib/solution/BookingTicket/index.d.ts +1 -1
  45. package/lib/solution/BookingTicket/index.js +2 -1
  46. package/lib/utils/payment-number.d.ts +9 -0
  47. package/lib/utils/payment-number.js +64 -0
  48. package/package.json +1 -1
@@ -37,6 +37,8 @@ import Decimal from 'decimal.js';
37
37
  import { cloneDeep, mergeWith } from 'lodash-es';
38
38
  import { createModule } from "../BookingByStep/types";
39
39
  import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, resolveIsFormSubject, sumOptionUnitPrice } from "../../modules/Order/utils";
40
+ import { ensureOrderPaymentNumber, mergeOrderPaymentListsByIdentity, resolveOrderPaymentIdentity } from "../../modules/Order/payment-utils";
41
+ import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
40
42
  import { applyOrderCollectionUidRemaps, getOrderCollectionPersistentId, getOrderCollectionReferenceUid, getOrderCollectionUid, isSameOrderCollectionItem, mergeOrderCollectionItems, normalizeOrderCollection, normalizeOrderCollections, setOrderCollectionUid } from "../../modules/Order/utils/orderCollectionIdentity";
41
43
  import dayjs from 'dayjs';
42
44
  export * from "./types";
@@ -72,6 +74,10 @@ function preserveManualProductDiscountProducts(previousProducts, nextProducts) {
72
74
  function isBaseSalesHistoricalDiscountEntry(discount) {
73
75
  return Boolean((discount === null || discount === void 0 ? void 0 : discount.isEditMode) || (discount === null || discount === void 0 ? void 0 : discount.isDisabled) || (discount === null || discount === void 0 ? void 0 : discount.order_discount_id) != null);
74
76
  }
77
+ function getBaseSalesUniqueArrayMetadataKey(key) {
78
+ if (key === 'products' || key === 'bookings') return 'unique_identification_number';
79
+ return null;
80
+ }
75
81
  var BASE_SALES_PERSISTENT_ID_FIELD_BY_KIND = {
76
82
  product: 'order_detail_id',
77
83
  booking: 'schedule_event_id',
@@ -189,6 +195,34 @@ function normalizeBaseSalesRecordCollections(sourceRecord, options) {
189
195
  }
190
196
  return normalizedRecord;
191
197
  }
198
+ function getBaseSalesMetadataUid(item, metadataKey) {
199
+ var _item$metadata$metada, _item$metadata;
200
+ var uid = (_item$metadata$metada = item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata[metadataKey]) !== null && _item$metadata$metada !== void 0 ? _item$metadata$metada : item === null || item === void 0 ? void 0 : item[metadataKey];
201
+ if (uid === undefined || uid === null || uid === '') return null;
202
+ return String(uid);
203
+ }
204
+ function mergeBaseSalesUniqueArray(currentValue, loadedValue, metadataKey) {
205
+ var result = [];
206
+ var indexByUid = new Map();
207
+ var appendOrReplaceByUid = function appendOrReplaceByUid(item) {
208
+ var clonedItem = cloneDeep(item);
209
+ var uid = getBaseSalesMetadataUid(clonedItem, metadataKey);
210
+ if (!uid) {
211
+ result.push(clonedItem);
212
+ return;
213
+ }
214
+ var existingIndex = indexByUid.get(uid);
215
+ if (existingIndex !== undefined) {
216
+ result[existingIndex] = clonedItem;
217
+ return;
218
+ }
219
+ indexByUid.set(uid, result.length);
220
+ result.push(clonedItem);
221
+ };
222
+ currentValue.forEach(appendOrReplaceByUid);
223
+ loadedValue.forEach(appendOrReplaceByUid);
224
+ return result;
225
+ }
192
226
  function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, strategy) {
193
227
  var normalizedLoadedRecord = normalizeBaseSalesRecordCollections(loadedRecord || {}, {
194
228
  ensureUid: false
@@ -206,6 +240,15 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
206
240
  return mergeBaseSalesOrderCollection(collectionKind, Array.isArray(currentValue) ? currentValue : [], loadedValue, strategy, uidRemaps);
207
241
  }
208
242
  if (Array.isArray(currentValue) && Array.isArray(loadedValue)) {
243
+ if (key === 'payments' || key === 'payment') {
244
+ return mergeOrderPaymentListsByIdentity(currentValue, loadedValue, {
245
+ preserveUnmatchedExisting: true
246
+ });
247
+ }
248
+ var metadataKey = getBaseSalesUniqueArrayMetadataKey(key);
249
+ if (metadataKey) {
250
+ return mergeBaseSalesUniqueArray(currentValue, loadedValue, metadataKey);
251
+ }
209
252
  return [].concat(_toConsumableArray(cloneDeep(currentValue)), _toConsumableArray(cloneDeep(loadedValue)));
210
253
  }
211
254
  if (Array.isArray(loadedValue)) return cloneDeep(loadedValue);
@@ -1080,6 +1123,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1080
1123
  var coreData = app === null || app === void 0 || (_app$models = app.models) === null || _app$models === void 0 || (_app$models$getStore = _app$models.getStore) === null || _app$models$getStore === void 0 || (_app$models$getStore$ = (_app$models$getStore$2 = _app$models$getStore.call(_app$models)).getDataByModel) === null || _app$models$getStore$ === void 0 ? void 0 : _app$models$getStore$.call(_app$models$getStore$2, 'core', 'core');
1081
1124
  return coreData === null || coreData === void 0 ? void 0 : coreData[key];
1082
1125
  }
1126
+ }, {
1127
+ key: "getPaymentNumberDevicePrefixSync",
1128
+ value: function getPaymentNumberDevicePrefixSync() {
1129
+ var _this7 = this;
1130
+ if (!this.appPlugin) return 'LOCAL';
1131
+ return resolvePaymentNumberDevicePrefixFromDeviceId(function (key) {
1132
+ return _this7.getAppData(key);
1133
+ });
1134
+ }
1135
+ }, {
1136
+ key: "getPaymentNumberDevicePrefixAsync",
1137
+ value: function getPaymentNumberDevicePrefixAsync() {
1138
+ var _this8 = this;
1139
+ if (!this.appPlugin) return Promise.resolve('LOCAL');
1140
+ return resolvePaymentNumberDevicePrefix(function (key) {
1141
+ return _this8.getAppData(key);
1142
+ });
1143
+ }
1083
1144
  }, {
1084
1145
  key: "syncAppDataToTempOrder",
1085
1146
  value: function syncAppDataToTempOrder(tempOrder) {
@@ -1123,7 +1184,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1123
1184
  value: function () {
1124
1185
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(core) {
1125
1186
  var _this$otherParams4,
1126
- _this7 = this,
1187
+ _this9 = this,
1127
1188
  _this$otherParams5;
1128
1189
  var options,
1129
1190
  app,
@@ -1156,24 +1217,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1156
1217
  targetCacheData = this.readSessionCacheData();
1157
1218
  moduleNames = this.getRegisteredModuleNames();
1158
1219
  moduleNames.forEach(function (step) {
1159
- var reusedModule = _this7.getReusableSharedSubModule(step);
1220
+ var reusedModule = _this9.getReusableSharedSubModule(step);
1160
1221
  if (reusedModule) {
1161
- _this7.store[step] = reusedModule;
1162
- _this7.reusedSharedSubModuleNames.add(step);
1222
+ _this9.store[step] = reusedModule;
1223
+ _this9.reusedSharedSubModuleNames.add(step);
1163
1224
  return;
1164
1225
  }
1165
- var targetModule = _this7.createSubModule(step);
1226
+ var targetModule = _this9.createSubModule(step);
1166
1227
  if (!targetModule) {
1167
1228
  throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
1168
1229
  }
1169
- var hooks = _this7.getSubModuleHooks(step);
1170
- _this7.store[step] = targetModule;
1171
- _this7.core.registerModule(targetModule, _objectSpread(_objectSpread({
1230
+ var hooks = _this9.getSubModuleHooks(step);
1231
+ _this9.store[step] = targetModule;
1232
+ _this9.core.registerModule(targetModule, _objectSpread(_objectSpread({
1172
1233
  initialState: (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {}
1173
1234
  }, hooks ? {
1174
1235
  hooks: hooks
1175
1236
  } : {}), {}, {
1176
- otherParams: _this7.buildSubModuleOtherParams()
1237
+ otherParams: _this9.buildSubModuleOtherParams()
1177
1238
  }));
1178
1239
  });
1179
1240
  if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
@@ -1207,15 +1268,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1207
1268
  value: function () {
1208
1269
  var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1209
1270
  var _this$serverOrderChan2,
1210
- _this8 = this;
1271
+ _this10 = this;
1211
1272
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1212
1273
  while (1) switch (_context12.prev = _context12.next) {
1213
1274
  case 0:
1214
1275
  (_this$serverOrderChan2 = this.serverOrderChangeUnsubscribe) === null || _this$serverOrderChan2 === void 0 || _this$serverOrderChan2.call(this);
1215
1276
  this.serverOrderChangeUnsubscribe = null;
1216
1277
  Object.keys(this.store).forEach(function (key) {
1217
- if (_this8.reusedSharedSubModuleNames.has(key)) return;
1218
- var sub = _this8.store[key];
1278
+ if (_this10.reusedSharedSubModuleNames.has(key)) return;
1279
+ var sub = _this10.store[key];
1219
1280
  if (sub && typeof sub.destroy === 'function') {
1220
1281
  try {
1221
1282
  sub.destroy();
@@ -1762,10 +1823,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1762
1823
  }, {
1763
1824
  key: "getHistoricalProductDiscountList",
1764
1825
  value: function getHistoricalProductDiscountList(products) {
1765
- var _this9 = this;
1826
+ var _this11 = this;
1766
1827
  var historyDiscountList = [];
1767
1828
  products.forEach(function (item) {
1768
- if (!_this9.isPersistedOrderProduct(item)) return;
1829
+ if (!_this11.isPersistedOrderProduct(item)) return;
1769
1830
  (item.discount_list || []).forEach(function (discount) {
1770
1831
  var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
1771
1832
  var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
@@ -1825,11 +1886,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1825
1886
  }, {
1826
1887
  key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
1827
1888
  value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
1828
- var _this10 = this;
1889
+ var _this12 = this;
1829
1890
  if (params.discountAction !== 'edit') return false;
1830
1891
  if (!params.products.length) return false;
1831
1892
  var hasDraftProduct = params.products.some(function (product) {
1832
- return !_this10.isPersistedOrderProduct(product);
1893
+ return !_this12.isPersistedOrderProduct(product);
1833
1894
  });
1834
1895
  if (hasDraftProduct) return false;
1835
1896
  var hasSelectedDiscount = params.currentDiscountList.some(function (discount) {
@@ -2632,11 +2693,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2632
2693
  return submitSalesOrder;
2633
2694
  }())
2634
2695
  }, {
2635
- key: "submitTempOrderAsync",
2696
+ key: "saveSalesOrderDraft",
2636
2697
  value: function () {
2637
- var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
2638
- var _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13;
2639
- var inferredPaymentStatus, submitParams;
2698
+ var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
2699
+ var _params$platform, _this$otherParams10, _ref22, _params$businessCode, _this$otherParams11, _this$otherParams12, _params$channel, _params$type, _this$otherParams13;
2640
2700
  return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2641
2701
  while (1) switch (_context28.prev = _context28.next) {
2642
2702
  case 0:
@@ -2645,14 +2705,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2645
2705
  break;
2646
2706
  }
2647
2707
  throw new Error('BaseSales 解决方案需要 order 模块支持');
2708
+ case 2:
2709
+ return _context28.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
2710
+ cacheId: this.cacheId,
2711
+ platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform,
2712
+ businessCode: (_ref22 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.businessCode) !== null && _ref22 !== void 0 ? _ref22 : (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.business_code,
2713
+ channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
2714
+ type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.type
2715
+ }, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
2716
+ enhancePayload: params.enhancePayload
2717
+ } : {})));
2718
+ case 3:
2719
+ case "end":
2720
+ return _context28.stop();
2721
+ }
2722
+ }, _callee28, this);
2723
+ }));
2724
+ function saveSalesOrderDraft(_x22) {
2725
+ return _saveSalesOrderDraft.apply(this, arguments);
2726
+ }
2727
+ return saveSalesOrderDraft;
2728
+ }()
2729
+ }, {
2730
+ key: "submitTempOrderAsync",
2731
+ value: function () {
2732
+ var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
2733
+ var _this$otherParams14, _this$otherParams15, _this$otherParams16, _this$otherParams17;
2734
+ var inferredPaymentStatus, submitParams;
2735
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2736
+ while (1) switch (_context29.prev = _context29.next) {
2737
+ case 0:
2738
+ if (this.store.order) {
2739
+ _context29.next = 2;
2740
+ break;
2741
+ }
2742
+ throw new Error('BaseSales 解决方案需要 order 模块支持');
2648
2743
  case 2:
2649
2744
  inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
2650
2745
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
2651
2746
  cacheId: this.cacheId,
2652
- platform: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform,
2653
- businessCode: ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.businessCode) || ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.business_code),
2747
+ platform: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform,
2748
+ 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),
2654
2749
  channel: this.getSubmitOrderSalesChannel(),
2655
- type: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.type
2750
+ type: (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.type
2656
2751
  }, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
2657
2752
  payments: params.payments
2658
2753
  } : {}), inferredPaymentStatus !== undefined ? {
@@ -2664,14 +2759,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2664
2759
  } : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
2665
2760
  enhancePayload: params.enhancePayload
2666
2761
  } : {});
2667
- return _context28.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
2762
+ return _context29.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
2668
2763
  case 5:
2669
2764
  case "end":
2670
- return _context28.stop();
2765
+ return _context29.stop();
2671
2766
  }
2672
- }, _callee28, this);
2767
+ }, _callee29, this);
2673
2768
  }));
2674
- function submitTempOrderAsync(_x22) {
2769
+ function submitTempOrderAsync(_x23) {
2675
2770
  return _submitTempOrderAsync.apply(this, arguments);
2676
2771
  }
2677
2772
  return submitTempOrderAsync;
@@ -2679,14 +2774,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2679
2774
  }, {
2680
2775
  key: "printLocalOrderReceipt",
2681
2776
  value: function () {
2682
- var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(lookup) {
2683
- var _this$otherParams14, _this$otherParams15, _this$otherParams16, _this$otherParams17;
2777
+ var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(lookup) {
2778
+ var _this$otherParams18, _this$otherParams19, _this$otherParams20, _this$otherParams21;
2684
2779
  var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order5, _data;
2685
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2686
- while (1) switch (_context29.prev = _context29.next) {
2780
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2781
+ while (1) switch (_context30.prev = _context30.next) {
2687
2782
  case 0:
2688
2783
  if (this.store.order) {
2689
- _context29.next = 2;
2784
+ _context30.next = 2;
2690
2785
  break;
2691
2786
  }
2692
2787
  throw new Error('BaseSales 解决方案需要 order 模块支持');
@@ -2698,10 +2793,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2698
2793
  external_sale_number: lookup
2699
2794
  };
2700
2795
  context = {
2701
- platform: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform,
2702
- 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),
2796
+ platform: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform,
2797
+ 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),
2703
2798
  channel: this.getSubmitOrderSalesChannel(),
2704
- type: (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.type
2799
+ type: (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.type
2705
2800
  };
2706
2801
  payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
2707
2802
  lookup_order_from_db: 1,
@@ -2717,28 +2812,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2717
2812
  channel: context.channel,
2718
2813
  type: context.type
2719
2814
  });
2720
- _context29.next = 8;
2815
+ _context30.next = 8;
2721
2816
  return this.request.post('/local/print-order', payload, {
2722
2817
  osServer: true,
2723
2818
  customToast: function customToast() {}
2724
2819
  });
2725
2820
  case 8:
2726
- response = _context29.sent;
2821
+ response = _context30.sent;
2727
2822
  if (hasLookup) {
2728
- _context29.next = 12;
2823
+ _context30.next = 12;
2729
2824
  break;
2730
2825
  }
2731
- _context29.next = 12;
2826
+ _context30.next = 12;
2732
2827
  return (_this$store$order$app = (_this$store$order5 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order5, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
2733
2828
  case 12:
2734
- return _context29.abrupt("return", response);
2829
+ return _context30.abrupt("return", response);
2735
2830
  case 13:
2736
2831
  case "end":
2737
- return _context29.stop();
2832
+ return _context30.stop();
2738
2833
  }
2739
- }, _callee29, this);
2834
+ }, _callee30, this);
2740
2835
  }));
2741
- function printLocalOrderReceipt(_x23) {
2836
+ function printLocalOrderReceipt(_x24) {
2742
2837
  return _printLocalOrderReceipt.apply(this, arguments);
2743
2838
  }
2744
2839
  return printLocalOrderReceipt;
@@ -2759,20 +2854,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2759
2854
  }, {
2760
2855
  key: "syncPaymentsToOrder",
2761
2856
  value: function () {
2762
- var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
2763
- var _ref22, _params$businessCode, _this$otherParams18, _this$otherParams19, _params$channel;
2857
+ var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
2858
+ var _ref23, _params$businessCode2, _this$otherParams22, _this$otherParams23, _params$channel2;
2764
2859
  var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
2765
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2766
- while (1) switch (_context30.prev = _context30.next) {
2860
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2861
+ while (1) switch (_context31.prev = _context31.next) {
2767
2862
  case 0:
2768
2863
  if (this.store.order) {
2769
- _context30.next = 2;
2864
+ _context31.next = 2;
2770
2865
  break;
2771
2866
  }
2772
2867
  throw new Error('order 模块未初始化');
2773
2868
  case 2:
2774
- businessCode = (_ref22 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) !== null && _ref22 !== void 0 ? _ref22 : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code;
2775
- channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
2869
+ businessCode = (_ref23 = (_params$businessCode2 = params.businessCode) !== null && _params$businessCode2 !== void 0 ? _params$businessCode2 : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.businessCode) !== null && _ref23 !== void 0 ? _ref23 : (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.business_code;
2870
+ channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
2776
2871
  syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
2777
2872
  businessCode: businessCode
2778
2873
  } : {}), channel !== undefined ? {
@@ -2780,14 +2875,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2780
2875
  } : {});
2781
2876
  syncState = this.store.order.getOrderSyncState();
2782
2877
  if (!(params.submitWhenPaid && syncState === 'submitting')) {
2783
- _context30.next = 9;
2878
+ _context31.next = 9;
2784
2879
  break;
2785
2880
  }
2786
2881
  this.queueLatestAutoPaymentSync();
2787
- return _context30.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
2882
+ return _context31.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
2788
2883
  case 9:
2789
2884
  payments = params.payments || [];
2790
- _context30.next = 12;
2885
+ _context31.next = 12;
2791
2886
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
2792
2887
  payments: payments,
2793
2888
  params: syncParams,
@@ -2795,11 +2890,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2795
2890
  orderSnapshot: this.store.order.getOrderSnapshot()
2796
2891
  });
2797
2892
  case 12:
2798
- _context30.prev = 12;
2799
- _context30.next = 15;
2893
+ _context31.prev = 12;
2894
+ _context31.next = 15;
2800
2895
  return this.store.order.syncPaymentsToOrder(syncParams);
2801
2896
  case 15:
2802
- syncResult = _context30.sent;
2897
+ syncResult = _context31.sent;
2803
2898
  latestPayments = this.store.order.getOrderPayments();
2804
2899
  amountSnapshot = this.store.order.getOrderAmountSnapshot();
2805
2900
  orderSnapshot = this.store.order.getOrderSnapshot();
@@ -2817,25 +2912,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2817
2912
  depositAmount: syncResult.depositAmount,
2818
2913
  orderExpectedAmount: syncResult.orderExpectedAmount
2819
2914
  };
2820
- _context30.next = 22;
2915
+ _context31.next = 22;
2821
2916
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
2822
2917
  case 22:
2823
2918
  if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
2824
- _context30.next = 25;
2919
+ _context31.next = 25;
2825
2920
  break;
2826
2921
  }
2827
- _context30.next = 25;
2922
+ _context31.next = 25;
2828
2923
  return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
2829
2924
  case 25:
2830
2925
  this.scheduleQueuedAutoPaymentSyncFlush(0);
2831
- return _context30.abrupt("return", syncResult);
2926
+ return _context31.abrupt("return", syncResult);
2832
2927
  case 29:
2833
- _context30.prev = 29;
2834
- _context30.t0 = _context30["catch"](12);
2835
- _context30.next = 33;
2928
+ _context31.prev = 29;
2929
+ _context31.t0 = _context31["catch"](12);
2930
+ _context31.next = 33;
2836
2931
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
2837
2932
  ok: false,
2838
- error: _context30.t0,
2933
+ error: _context31.t0,
2839
2934
  payments: this.store.order.getOrderPayments(),
2840
2935
  params: syncParams,
2841
2936
  amountSnapshot: this.store.order.getOrderAmountSnapshot(),
@@ -2843,14 +2938,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2843
2938
  });
2844
2939
  case 33:
2845
2940
  this.scheduleQueuedAutoPaymentSyncFlush(0);
2846
- throw _context30.t0;
2941
+ throw _context31.t0;
2847
2942
  case 35:
2848
2943
  case "end":
2849
- return _context30.stop();
2944
+ return _context31.stop();
2850
2945
  }
2851
- }, _callee30, this, [[12, 29]]);
2946
+ }, _callee31, this, [[12, 29]]);
2852
2947
  }));
2853
- function syncPaymentsToOrder(_x24) {
2948
+ function syncPaymentsToOrder(_x25) {
2854
2949
  return _syncPaymentsToOrder.apply(this, arguments);
2855
2950
  }
2856
2951
  return syncPaymentsToOrder;
@@ -2887,58 +2982,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2887
2982
  }, {
2888
2983
  key: "scheduleQueuedAutoPaymentSyncFlush",
2889
2984
  value: function scheduleQueuedAutoPaymentSyncFlush() {
2890
- var _this11 = this;
2985
+ var _this13 = this;
2891
2986
  var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
2892
2987
  if (!this.queuedAutoPaymentSync) return;
2893
2988
  if (this.autoPaymentSyncTimer) return;
2894
2989
  this.autoPaymentSyncTimer = setTimeout(function () {
2895
- _this11.autoPaymentSyncTimer = null;
2896
- void _this11.flushQueuedAutoPaymentSync();
2990
+ _this13.autoPaymentSyncTimer = null;
2991
+ void _this13.flushQueuedAutoPaymentSync();
2897
2992
  }, delay);
2898
2993
  }
2899
2994
  }, {
2900
2995
  key: "flushQueuedAutoPaymentSync",
2901
2996
  value: function () {
2902
- var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2997
+ var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2903
2998
  var payments;
2904
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2905
- while (1) switch (_context31.prev = _context31.next) {
2999
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3000
+ while (1) switch (_context32.prev = _context32.next) {
2906
3001
  case 0:
2907
3002
  if (this.store.order) {
2908
- _context31.next = 2;
3003
+ _context32.next = 2;
2909
3004
  break;
2910
3005
  }
2911
- return _context31.abrupt("return");
3006
+ return _context32.abrupt("return");
2912
3007
  case 2:
2913
3008
  if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
2914
- _context31.next = 4;
3009
+ _context32.next = 4;
2915
3010
  break;
2916
3011
  }
2917
- return _context31.abrupt("return");
3012
+ return _context32.abrupt("return");
2918
3013
  case 4:
2919
3014
  if (!(this.store.order.getOrderSyncState() === 'submitting')) {
2920
- _context31.next = 7;
3015
+ _context32.next = 7;
2921
3016
  break;
2922
3017
  }
2923
3018
  this.scheduleQueuedAutoPaymentSyncFlush();
2924
- return _context31.abrupt("return");
3019
+ return _context32.abrupt("return");
2925
3020
  case 7:
2926
3021
  this.autoPaymentSyncFlushing = true;
2927
- _context31.prev = 8;
3022
+ _context32.prev = 8;
2928
3023
  case 9:
2929
3024
  if (!this.queuedAutoPaymentSync) {
2930
- _context31.next = 18;
3025
+ _context32.next = 18;
2931
3026
  break;
2932
3027
  }
2933
3028
  this.queuedAutoPaymentSync = false;
2934
3029
  payments = this.store.order.getOrderPayments();
2935
3030
  if (payments.length) {
2936
- _context31.next = 14;
3031
+ _context32.next = 14;
2937
3032
  break;
2938
3033
  }
2939
- return _context31.abrupt("continue", 9);
3034
+ return _context32.abrupt("continue", 9);
2940
3035
  case 14:
2941
- _context31.next = 16;
3036
+ _context32.next = 16;
2942
3037
  return this.syncPaymentsToOrder({
2943
3038
  payments: payments,
2944
3039
  paymentStatus: this.getPaymentStatusForSync(payments),
@@ -2946,44 +3041,91 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2946
3041
  smallTicketDataFlag: 1
2947
3042
  });
2948
3043
  case 16:
2949
- _context31.next = 9;
3044
+ _context32.next = 9;
2950
3045
  break;
2951
3046
  case 18:
2952
- _context31.next = 23;
3047
+ _context32.next = 23;
2953
3048
  break;
2954
3049
  case 20:
2955
- _context31.prev = 20;
2956
- _context31.t0 = _context31["catch"](8);
3050
+ _context32.prev = 20;
3051
+ _context32.t0 = _context32["catch"](8);
2957
3052
  this.logError('queued auto sync payments failed', {
2958
- error: _context31.t0 instanceof Error ? _context31.t0.message : String(_context31.t0)
3053
+ error: _context32.t0 instanceof Error ? _context32.t0.message : String(_context32.t0)
2959
3054
  });
2960
3055
  case 23:
2961
- _context31.prev = 23;
3056
+ _context32.prev = 23;
2962
3057
  this.autoPaymentSyncFlushing = false;
2963
3058
  if (this.queuedAutoPaymentSync) {
2964
3059
  this.scheduleQueuedAutoPaymentSyncFlush(0);
2965
3060
  }
2966
- return _context31.finish(23);
3061
+ return _context32.finish(23);
2967
3062
  case 27:
2968
3063
  case "end":
2969
- return _context31.stop();
3064
+ return _context32.stop();
2970
3065
  }
2971
- }, _callee31, this, [[8, 20, 23, 27]]);
3066
+ }, _callee32, this, [[8, 20, 23, 27]]);
2972
3067
  }));
2973
3068
  function flushQueuedAutoPaymentSync() {
2974
3069
  return _flushQueuedAutoPaymentSync.apply(this, arguments);
2975
3070
  }
2976
3071
  return flushQueuedAutoPaymentSync;
2977
- }() /** 追加单个支付项到当前订单。 */
3072
+ }()
3073
+ /**
3074
+ * 同步兼容入口。无法等待 IoT 短号时,按调用当下的 device_id 或 LOCAL 生成。
3075
+ */
2978
3076
  }, {
2979
3077
  key: "addOrderPayment",
2980
3078
  value: function addOrderPayment(payment) {
2981
- var _this$otherParams20,
3079
+ var hasPaymentNumber = String(payment.payment_number || '').trim() !== '';
3080
+ return this.addOrderPaymentWithDevicePrefix(payment, hasPaymentNumber ? 'LOCAL' : this.getPaymentNumberDevicePrefixSync());
3081
+ }
3082
+
3083
+ /** 创建新支付项时读取最新设备短号,不缓存运行时设备信息。 */
3084
+ }, {
3085
+ key: "addOrderPaymentAsync",
3086
+ value: (function () {
3087
+ var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(payment) {
3088
+ var paymentRecord, hasPaymentNumber, devicePrefix;
3089
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3090
+ while (1) switch (_context33.prev = _context33.next) {
3091
+ case 0:
3092
+ paymentRecord = payment;
3093
+ hasPaymentNumber = String(paymentRecord.payment_number || '').trim() !== '';
3094
+ if (!hasPaymentNumber) {
3095
+ _context33.next = 6;
3096
+ break;
3097
+ }
3098
+ _context33.t0 = 'LOCAL';
3099
+ _context33.next = 9;
3100
+ break;
3101
+ case 6:
3102
+ _context33.next = 8;
3103
+ return this.getPaymentNumberDevicePrefixAsync();
3104
+ case 8:
3105
+ _context33.t0 = _context33.sent;
3106
+ case 9:
3107
+ devicePrefix = _context33.t0;
3108
+ return _context33.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
3109
+ case 11:
3110
+ case "end":
3111
+ return _context33.stop();
3112
+ }
3113
+ }, _callee33, this);
3114
+ }));
3115
+ function addOrderPaymentAsync(_x26) {
3116
+ return _addOrderPaymentAsync.apply(this, arguments);
3117
+ }
3118
+ return addOrderPaymentAsync;
3119
+ }())
3120
+ }, {
3121
+ key: "addOrderPaymentWithDevicePrefix",
3122
+ value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
3123
+ var _this$otherParams24,
2982
3124
  _paymentRecord$paymen,
2983
3125
  _paymentRecord$create,
2984
- _ref23,
3126
+ _ref24,
2985
3127
  _paymentRecord$origin,
2986
- _this12 = this;
3128
+ _this14 = this;
2987
3129
  if (!this.store.order) throw new Error('order 模块未初始化');
2988
3130
  var paymentRecord = payment;
2989
3131
  var paymentAmount = new Decimal(paymentRecord.amount || 0);
@@ -2994,25 +3136,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2994
3136
  return this.store.order.getOrderPayments();
2995
3137
  }
2996
3138
  var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
2997
- var shopWalletPassId = (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.shop_wallet_pass_id;
3139
+ var shopWalletPassId = (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.shop_wallet_pass_id;
2998
3140
  if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
2999
3141
  metadata.shop_wallet_pass_id = shopWalletPassId;
3000
3142
  }
3001
- if (!metadata.unique_payment_number) {
3002
- metadata.unique_payment_number = createUuidV4();
3003
- }
3143
+ var normalizedPaymentRecord = ensureOrderPaymentNumber(paymentRecord, devicePrefix, createUuidV4);
3004
3144
  var paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
3005
3145
  var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
3006
3146
  var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
3007
3147
  var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
3008
- var calculatedServiceFee = serviceCharge ? new Decimal((_ref23 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref23 !== void 0 ? _ref23 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
3009
- var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, paymentRecord), calculatedServiceFee !== undefined ? {
3148
+ var calculatedServiceFee = serviceCharge ? new Decimal((_ref24 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref24 !== void 0 ? _ref24 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
3149
+ var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, normalizedPaymentRecord), calculatedServiceFee !== undefined ? {
3010
3150
  service_fee: calculatedServiceFee
3011
3151
  } : {}), {}, {
3012
3152
  metadata: metadata,
3013
3153
  payment_time: paymentTime,
3014
3154
  created_at: createdAt
3015
3155
  }));
3156
+ if (paymentRecord.status === 'payment_pending') {
3157
+ return payments;
3158
+ }
3016
3159
  var amountSnapshot = this.store.order.getOrderAmountSnapshot();
3017
3160
  var syncState = this.store.order.getOrderSyncState();
3018
3161
  if (amountSnapshot) {
@@ -3026,7 +3169,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3026
3169
  submitWhenPaid: true,
3027
3170
  smallTicketDataFlag: 1
3028
3171
  }).catch(function (error) {
3029
- _this12.logError('auto sync payments failed', {
3172
+ _this14.logError('auto sync payments failed', {
3030
3173
  error: error instanceof Error ? error.message : String(error)
3031
3174
  });
3032
3175
  });
@@ -3037,12 +3180,131 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3037
3180
  /** 更新当前订单中的指定支付项。 */
3038
3181
  }, {
3039
3182
  key: "updateOrderPayment",
3040
- value: function updateOrderPayment(paymentIdentity, updates) {
3041
- if (!this.store.order) throw new Error('order 模块未初始化');
3042
- return this.store.order.updateOrderPayment(paymentIdentity, updates);
3043
- }
3044
-
3045
- /** 删除当前订单中的指定支付项。 */
3183
+ value: (function () {
3184
+ var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(paymentIdentity, updates) {
3185
+ var _result$payment, _result$payment2;
3186
+ var options,
3187
+ matchMode,
3188
+ previousMatch,
3189
+ previousPayment,
3190
+ _this$store$order$get2,
3191
+ currentPayments,
3192
+ _syncResult,
3193
+ _options$smallTicketD,
3194
+ result,
3195
+ draftResult,
3196
+ draftError,
3197
+ becamePaid,
3198
+ shouldSubmit,
3199
+ syncResult,
3200
+ _options$smallTicketD2,
3201
+ _args34 = arguments;
3202
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3203
+ while (1) switch (_context34.prev = _context34.next) {
3204
+ case 0:
3205
+ options = _args34.length > 2 && _args34[2] !== undefined ? _args34[2] : {};
3206
+ if (this.store.order) {
3207
+ _context34.next = 3;
3208
+ break;
3209
+ }
3210
+ throw new Error('order 模块未初始化');
3211
+ case 3:
3212
+ matchMode = options.matchBy === 'compat' || options.matchBy === 'legacy' ? 'compat' : 'payment_number';
3213
+ previousMatch = resolveOrderPaymentIdentity(this.store.order.getOrderPayments(), paymentIdentity, matchMode);
3214
+ previousPayment = previousMatch === null || previousMatch === void 0 ? void 0 : previousMatch.payment;
3215
+ if (!((previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) === 'paid' && !options.applyUpdatesWhenPaid)) {
3216
+ _context34.next = 13;
3217
+ break;
3218
+ }
3219
+ currentPayments = this.store.order.getOrderPayments();
3220
+ if (!(options.submitWhenPaid && options.forceSubmitIfPaid)) {
3221
+ _context34.next = 12;
3222
+ break;
3223
+ }
3224
+ _context34.next = 11;
3225
+ return this.syncPaymentsToOrder({
3226
+ payments: currentPayments,
3227
+ paymentStatus: this.getPaymentStatusForSync(currentPayments),
3228
+ submitWhenPaid: true,
3229
+ smallTicketDataFlag: (_options$smallTicketD = options.smallTicketDataFlag) !== null && _options$smallTicketD !== void 0 ? _options$smallTicketD : 1
3230
+ });
3231
+ case 11:
3232
+ _syncResult = _context34.sent;
3233
+ case 12:
3234
+ return _context34.abrupt("return", _objectSpread({
3235
+ updated: false,
3236
+ payment: previousPayment,
3237
+ payments: currentPayments,
3238
+ summary: ((_this$store$order$get2 = this.store.order.getOrderAmountSnapshot()) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2.summary) || null
3239
+ }, _syncResult !== undefined ? {
3240
+ syncResult: _syncResult
3241
+ } : {}));
3242
+ case 13:
3243
+ _context34.next = 15;
3244
+ return this.store.order.updateOrderPayment(paymentIdentity, updates, {
3245
+ matchBy: matchMode
3246
+ });
3247
+ case 15:
3248
+ result = _context34.sent;
3249
+ if (!(options.persistDraft !== false)) {
3250
+ _context34.next = 29;
3251
+ break;
3252
+ }
3253
+ _context34.prev = 17;
3254
+ _context34.next = 20;
3255
+ return this.saveSalesOrderDraft();
3256
+ case 20:
3257
+ draftResult = _context34.sent;
3258
+ _context34.next = 29;
3259
+ break;
3260
+ case 23:
3261
+ _context34.prev = 23;
3262
+ _context34.t0 = _context34["catch"](17);
3263
+ draftError = _context34.t0;
3264
+ this.logError('updateOrderPayment: 保存支付草稿失败', {
3265
+ paymentIdentity: paymentIdentity,
3266
+ error: _context34.t0 instanceof Error ? _context34.t0.message : String(_context34.t0)
3267
+ });
3268
+ if (options.submitWhenPaid) {
3269
+ _context34.next = 29;
3270
+ break;
3271
+ }
3272
+ throw _context34.t0;
3273
+ case 29:
3274
+ becamePaid = (previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) !== 'paid' && ((_result$payment = result.payment) === null || _result$payment === void 0 ? void 0 : _result$payment.status) === 'paid';
3275
+ shouldSubmit = Boolean(options.submitWhenPaid && ((_result$payment2 = result.payment) === null || _result$payment2 === void 0 ? void 0 : _result$payment2.status) === 'paid' && (becamePaid || options.forceSubmitIfPaid));
3276
+ if (!shouldSubmit) {
3277
+ _context34.next = 35;
3278
+ break;
3279
+ }
3280
+ _context34.next = 34;
3281
+ return this.syncPaymentsToOrder({
3282
+ payments: result.payments,
3283
+ paymentStatus: this.getPaymentStatusForSync(result.payments),
3284
+ submitWhenPaid: true,
3285
+ smallTicketDataFlag: (_options$smallTicketD2 = options.smallTicketDataFlag) !== null && _options$smallTicketD2 !== void 0 ? _options$smallTicketD2 : 1
3286
+ });
3287
+ case 34:
3288
+ syncResult = _context34.sent;
3289
+ case 35:
3290
+ return _context34.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
3291
+ draftResult: draftResult
3292
+ } : {}), draftError !== undefined ? {
3293
+ draftError: draftError
3294
+ } : {}), syncResult !== undefined ? {
3295
+ syncResult: syncResult
3296
+ } : {}));
3297
+ case 36:
3298
+ case "end":
3299
+ return _context34.stop();
3300
+ }
3301
+ }, _callee34, this, [[17, 23]]);
3302
+ }));
3303
+ function updateOrderPayment(_x27, _x28) {
3304
+ return _updateOrderPayment.apply(this, arguments);
3305
+ }
3306
+ return updateOrderPayment;
3307
+ }() /** 删除当前订单中的指定支付项。 */)
3046
3308
  }, {
3047
3309
  key: "deleteOrderPayment",
3048
3310
  value: function deleteOrderPayment(paymentIdentity) {
@@ -3057,6 +3319,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3057
3319
  if (!this.store.order) throw new Error('order 模块未初始化');
3058
3320
  return this.store.order.updateVoucherOrderPayments(payments, options);
3059
3321
  }
3322
+ }, {
3323
+ key: "updateVoucherOrderPaymentsAsync",
3324
+ value: function () {
3325
+ var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(payments, options) {
3326
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3327
+ while (1) switch (_context35.prev = _context35.next) {
3328
+ case 0:
3329
+ if (this.store.order) {
3330
+ _context35.next = 2;
3331
+ break;
3332
+ }
3333
+ throw new Error('order 模块未初始化');
3334
+ case 2:
3335
+ return _context35.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
3336
+ case 3:
3337
+ case "end":
3338
+ return _context35.stop();
3339
+ }
3340
+ }, _callee35, this);
3341
+ }));
3342
+ function updateVoucherOrderPaymentsAsync(_x29, _x30) {
3343
+ return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
3344
+ }
3345
+ return updateVoucherOrderPaymentsAsync;
3346
+ }()
3060
3347
  }, {
3061
3348
  key: "confirmPendingVoucherPayments",
3062
3349
  value: function confirmPendingVoucherPayments() {
@@ -3133,20 +3420,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3133
3420
  }, {
3134
3421
  key: "initWalletData",
3135
3422
  value: function () {
3136
- var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3137
- var _params$order_wait_pa, _ref24, _tempOrder$is_price_i;
3423
+ var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
3424
+ var _params$order_wait_pa, _ref25, _tempOrder$is_price_i;
3138
3425
  var snapshot, tempOrder, amount, walletBusinessData, result;
3139
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3140
- while (1) switch (_context32.prev = _context32.next) {
3426
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3427
+ while (1) switch (_context36.prev = _context36.next) {
3141
3428
  case 0:
3142
3429
  if (this.store.order) {
3143
- _context32.next = 2;
3430
+ _context36.next = 2;
3144
3431
  break;
3145
3432
  }
3146
3433
  throw new Error('order 模块未初始化');
3147
3434
  case 2:
3148
3435
  if (this.store.payment) {
3149
- _context32.next = 4;
3436
+ _context36.next = 4;
3150
3437
  break;
3151
3438
  }
3152
3439
  throw new Error('payment 模块未初始化');
@@ -3155,10 +3442,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3155
3442
  tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
3156
3443
  amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
3157
3444
  if (!(!tempOrder || !amount)) {
3158
- _context32.next = 9;
3445
+ _context36.next = 9;
3159
3446
  break;
3160
3447
  }
3161
- return _context32.abrupt("return", {
3448
+ return _context36.abrupt("return", {
3162
3449
  walletRecommendList: [],
3163
3450
  userIdentificationCodes: [],
3164
3451
  transformList: [],
@@ -3177,15 +3464,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3177
3464
  },
3178
3465
  products: this.getWalletProductList(),
3179
3466
  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),
3180
- is_price_include_tax: (_ref24 = (_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 && _ref24 !== void 0 ? _ref24 : 1
3467
+ is_price_include_tax: (_ref25 = (_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 && _ref25 !== void 0 ? _ref25 : 1
3181
3468
  }, snapshot.identity.orderId ? {
3182
3469
  payment_order_id: String(snapshot.identity.orderId)
3183
3470
  } : {});
3184
- _context32.next = 12;
3471
+ _context36.next = 12;
3185
3472
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
3186
3473
  case 12:
3187
- result = _context32.sent;
3188
- _context32.next = 15;
3474
+ result = _context36.sent;
3475
+ _context36.next = 15;
3189
3476
  return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
3190
3477
  orderId: snapshot.identity.orderId,
3191
3478
  customerId: walletBusinessData.customer_id,
@@ -3197,14 +3484,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3197
3484
  timestamp: Date.now()
3198
3485
  });
3199
3486
  case 15:
3200
- return _context32.abrupt("return", result);
3487
+ return _context36.abrupt("return", result);
3201
3488
  case 16:
3202
3489
  case "end":
3203
- return _context32.stop();
3490
+ return _context36.stop();
3204
3491
  }
3205
- }, _callee32, this);
3492
+ }, _callee36, this);
3206
3493
  }));
3207
- function initWalletData(_x25) {
3494
+ function initWalletData(_x31) {
3208
3495
  return _initWalletData.apply(this, arguments);
3209
3496
  }
3210
3497
  return initWalletData;
@@ -3231,35 +3518,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3231
3518
  }, {
3232
3519
  key: "getPaymentMethodsAsync",
3233
3520
  value: (function () {
3234
- var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
3521
+ var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3235
3522
  var response, paymentMethods;
3236
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3237
- while (1) switch (_context33.prev = _context33.next) {
3523
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3524
+ while (1) switch (_context37.prev = _context37.next) {
3238
3525
  case 0:
3239
- _context33.prev = 0;
3240
- _context33.next = 3;
3526
+ _context37.prev = 0;
3527
+ _context37.next = 3;
3241
3528
  return this.request.get('/pay/custom-payment/all', {
3242
3529
  filterPaymentMethods: true
3243
3530
  }, {
3244
3531
  osServer: true
3245
3532
  });
3246
3533
  case 3:
3247
- response = _context33.sent;
3534
+ response = _context37.sent;
3248
3535
  paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
3249
3536
  this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
3250
- return _context33.abrupt("return", this.getPaymentMethods());
3537
+ return _context37.abrupt("return", this.getPaymentMethods());
3251
3538
  case 9:
3252
- _context33.prev = 9;
3253
- _context33.t0 = _context33["catch"](0);
3539
+ _context37.prev = 9;
3540
+ _context37.t0 = _context37["catch"](0);
3254
3541
  this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
3255
- error: _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0)
3542
+ error: _context37.t0 instanceof Error ? _context37.t0.message : String(_context37.t0)
3256
3543
  });
3257
- return _context33.abrupt("return", this.getPaymentMethods());
3544
+ return _context37.abrupt("return", this.getPaymentMethods());
3258
3545
  case 13:
3259
3546
  case "end":
3260
- return _context33.stop();
3547
+ return _context37.stop();
3261
3548
  }
3262
- }, _callee33, this, [[0, 9]]);
3549
+ }, _callee37, this, [[0, 9]]);
3263
3550
  }));
3264
3551
  function getPaymentMethodsAsync() {
3265
3552
  return _getPaymentMethodsAsync.apply(this, arguments);
@@ -3307,49 +3594,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3307
3594
  }, {
3308
3595
  key: "sendCustomerPayLink",
3309
3596
  value: (function () {
3310
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
3311
- var orderIds, _ref25, _ref26, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
3312
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3313
- while (1) switch (_context34.prev = _context34.next) {
3597
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
3598
+ var orderIds, _ref26, _ref27, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
3599
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3600
+ while (1) switch (_context38.prev = _context38.next) {
3314
3601
  case 0:
3315
3602
  if (this.store.order) {
3316
- _context34.next = 2;
3603
+ _context38.next = 2;
3317
3604
  break;
3318
3605
  }
3319
3606
  throw new Error('order 模块未初始化');
3320
3607
  case 2:
3321
3608
  orderIds = params.order_ids || params.orderIds || [];
3322
3609
  if (!(!orderIds.length || params.submitBeforeSend)) {
3323
- _context34.next = 11;
3610
+ _context38.next = 11;
3324
3611
  break;
3325
3612
  }
3326
- _context34.next = 6;
3613
+ _context38.next = 6;
3327
3614
  return this.submitSalesOrder({
3328
3615
  smallTicketDataFlag: 1
3329
3616
  });
3330
3617
  case 6:
3331
- submitResult = _context34.sent;
3332
- orderId = (_ref25 = (_ref26 = (_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 && _ref26 !== void 0 ? _ref26 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref25 !== void 0 ? _ref25 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
3618
+ submitResult = _context38.sent;
3619
+ orderId = (_ref26 = (_ref27 = (_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 && _ref27 !== void 0 ? _ref27 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref26 !== void 0 ? _ref26 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
3333
3620
  if (orderId) {
3334
- _context34.next = 10;
3621
+ _context38.next = 10;
3335
3622
  break;
3336
3623
  }
3337
3624
  throw new Error('本地订单提交云端失败,无法发送支付链接');
3338
3625
  case 10:
3339
3626
  orderIds = [orderId];
3340
3627
  case 11:
3341
- return _context34.abrupt("return", this.store.order.sendCustomerPayLink({
3628
+ return _context38.abrupt("return", this.store.order.sendCustomerPayLink({
3342
3629
  emails: params.emails,
3343
3630
  notify_action: params.notify_action,
3344
3631
  order_ids: orderIds
3345
3632
  }));
3346
3633
  case 12:
3347
3634
  case "end":
3348
- return _context34.stop();
3635
+ return _context38.stop();
3349
3636
  }
3350
- }, _callee34, this);
3637
+ }, _callee38, this);
3351
3638
  }));
3352
- function sendCustomerPayLink(_x26) {
3639
+ function sendCustomerPayLink(_x32) {
3353
3640
  return _sendCustomerPayLink.apply(this, arguments);
3354
3641
  }
3355
3642
  return sendCustomerPayLink;
@@ -3362,27 +3649,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3362
3649
  }, {
3363
3650
  key: "calculateProductBookingPrice",
3364
3651
  value: function () {
3365
- var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
3652
+ var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
3366
3653
  var _params$customer_id;
3367
3654
  var quotation, customerId, authoritativeProduct, product;
3368
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3369
- while (1) switch (_context35.prev = _context35.next) {
3655
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3656
+ while (1) switch (_context39.prev = _context39.next) {
3370
3657
  case 0:
3371
3658
  quotation = this.store.quotation;
3372
3659
  customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
3373
- _context35.next = 4;
3660
+ _context39.next = 4;
3374
3661
  return this.loadProductForPriceQuery(params, customerId);
3375
3662
  case 4:
3376
- authoritativeProduct = _context35.sent;
3663
+ authoritativeProduct = _context39.sent;
3377
3664
  product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
3378
- _context35.next = 8;
3665
+ _context39.next = 8;
3379
3666
  return this.loadQuotationForPriceQuery({
3380
3667
  quotation: quotation,
3381
3668
  customer_id: customerId,
3382
3669
  channel: params.channel
3383
3670
  });
3384
3671
  case 8:
3385
- return _context35.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
3672
+ return _context39.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
3386
3673
  product: product,
3387
3674
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
3388
3675
  customer_id: customerId,
@@ -3390,11 +3677,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3390
3677
  })));
3391
3678
  case 9:
3392
3679
  case "end":
3393
- return _context35.stop();
3680
+ return _context39.stop();
3394
3681
  }
3395
- }, _callee35, this);
3682
+ }, _callee39, this);
3396
3683
  }));
3397
- function calculateProductBookingPrice(_x27) {
3684
+ function calculateProductBookingPrice(_x33) {
3398
3685
  return _calculateProductBookingPrice.apply(this, arguments);
3399
3686
  }
3400
3687
  return calculateProductBookingPrice;
@@ -3402,7 +3689,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3402
3689
  }, {
3403
3690
  key: "getQuotationCustomerScopeInfo",
3404
3691
  value: function getQuotationCustomerScopeInfo() {
3405
- var _this13 = this;
3692
+ var _this15 = this;
3406
3693
  var quotation = this.store.quotation;
3407
3694
  if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
3408
3695
  return quotation.getQuotationCustomerScopeInfo();
@@ -3414,7 +3701,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3414
3701
  }).map(function (item) {
3415
3702
  var localSeen = new Set();
3416
3703
  var customers = item.customer.filter(function (customer) {
3417
- var customerId = _this13.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
3704
+ var customerId = _this15.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
3418
3705
  if (!customerId || localSeen.has(customerId)) return false;
3419
3706
  localSeen.add(customerId);
3420
3707
  if (!customerById.has(customerId)) customerById.set(customerId, customer);
@@ -3464,32 +3751,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3464
3751
  }, {
3465
3752
  key: "calculateProductBookingPrices",
3466
3753
  value: function () {
3467
- var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(paramsList) {
3754
+ var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(paramsList) {
3468
3755
  var _paramsList$0$custome,
3469
3756
  _paramsList$,
3470
- _this14 = this,
3757
+ _this16 = this,
3471
3758
  _paramsList$2;
3472
3759
  var quotation, customerId, productMapsByGroup, groups;
3473
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3474
- while (1) switch (_context37.prev = _context37.next) {
3760
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3761
+ while (1) switch (_context41.prev = _context41.next) {
3475
3762
  case 0:
3476
3763
  if (paramsList.length) {
3477
- _context37.next = 2;
3764
+ _context41.next = 2;
3478
3765
  break;
3479
3766
  }
3480
- return _context37.abrupt("return", []);
3767
+ return _context41.abrupt("return", []);
3481
3768
  case 2:
3482
3769
  quotation = this.store.quotation;
3483
3770
  customerId = (_paramsList$0$custome = (_paramsList$ = paramsList[0]) === null || _paramsList$ === void 0 ? void 0 : _paramsList$.customer_id) !== null && _paramsList$0$custome !== void 0 ? _paramsList$0$custome : this.getCurrentOrderCustomerId();
3484
3771
  productMapsByGroup = new Map();
3485
3772
  groups = new Map();
3486
3773
  paramsList.forEach(function (params) {
3487
- var _this14$otherParams;
3774
+ var _this16$otherParams;
3488
3775
  var product = params.product || {};
3489
- var productId = _this14.getPriceQueryProductId(product);
3776
+ var productId = _this16.getPriceQueryProductId(product);
3490
3777
  if (productId === null) return;
3491
- var schedule = _this14.getPriceQuerySchedule(params);
3492
- var channel = params.channel || ((_this14$otherParams = _this14.otherParams) === null || _this14$otherParams === void 0 ? void 0 : _this14$otherParams.channel);
3778
+ var schedule = _this16.getPriceQuerySchedule(params);
3779
+ var channel = params.channel || ((_this16$otherParams = _this16.otherParams) === null || _this16$otherParams === void 0 ? void 0 : _this16$otherParams.channel);
3493
3780
  var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
3494
3781
  var group = groups.get(groupKey) || {
3495
3782
  ids: new Set(),
@@ -3499,51 +3786,51 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3499
3786
  group.ids.add(productId);
3500
3787
  groups.set(groupKey, group);
3501
3788
  });
3502
- _context37.next = 9;
3789
+ _context41.next = 9;
3503
3790
  return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
3504
- var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(_ref27) {
3505
- var _ref29, groupKey, group, productsById;
3506
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3507
- while (1) switch (_context36.prev = _context36.next) {
3791
+ var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(_ref28) {
3792
+ var _ref30, groupKey, group, productsById;
3793
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3794
+ while (1) switch (_context40.prev = _context40.next) {
3508
3795
  case 0:
3509
- _ref29 = _slicedToArray(_ref27, 2), groupKey = _ref29[0], group = _ref29[1];
3510
- _context36.next = 3;
3511
- return _this14.loadProductsForPriceQuery({
3796
+ _ref30 = _slicedToArray(_ref28, 2), groupKey = _ref30[0], group = _ref30[1];
3797
+ _context40.next = 3;
3798
+ return _this16.loadProductsForPriceQuery({
3512
3799
  ids: Array.from(group.ids),
3513
3800
  schedule: group.schedule,
3514
3801
  customerId: customerId,
3515
3802
  channel: group.channel
3516
3803
  });
3517
3804
  case 3:
3518
- productsById = _context36.sent;
3805
+ productsById = _context40.sent;
3519
3806
  productMapsByGroup.set(groupKey, productsById);
3520
3807
  case 5:
3521
3808
  case "end":
3522
- return _context36.stop();
3809
+ return _context40.stop();
3523
3810
  }
3524
- }, _callee36);
3811
+ }, _callee40);
3525
3812
  }));
3526
- return function (_x29) {
3527
- return _ref28.apply(this, arguments);
3813
+ return function (_x35) {
3814
+ return _ref29.apply(this, arguments);
3528
3815
  };
3529
3816
  }()));
3530
3817
  case 9:
3531
- _context37.next = 11;
3818
+ _context41.next = 11;
3532
3819
  return this.loadQuotationForPriceQuery({
3533
3820
  quotation: quotation,
3534
3821
  customer_id: customerId,
3535
3822
  channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
3536
3823
  });
3537
3824
  case 11:
3538
- return _context37.abrupt("return", paramsList.map(function (params) {
3539
- var _this14$otherParams2, _productMapsByGroup$g;
3825
+ return _context41.abrupt("return", paramsList.map(function (params) {
3826
+ var _this16$otherParams2, _productMapsByGroup$g;
3540
3827
  var productInput = params.product || {};
3541
- var productId = _this14.getPriceQueryProductId(productInput);
3542
- var schedule = _this14.getPriceQuerySchedule(params);
3543
- var channel = params.channel || ((_this14$otherParams2 = _this14.otherParams) === null || _this14$otherParams2 === void 0 ? void 0 : _this14$otherParams2.channel);
3828
+ var productId = _this16.getPriceQueryProductId(productInput);
3829
+ var schedule = _this16.getPriceQuerySchedule(params);
3830
+ var channel = params.channel || ((_this16$otherParams2 = _this16.otherParams) === null || _this16$otherParams2 === void 0 ? void 0 : _this16$otherParams2.channel);
3544
3831
  var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
3545
3832
  var authoritativeProduct = productId === null ? null : ((_productMapsByGroup$g = productMapsByGroup.get(groupKey)) === null || _productMapsByGroup$g === void 0 ? void 0 : _productMapsByGroup$g.get(productId)) || null;
3546
- var product = _this14.mergeProductForPriceQuery(productInput, authoritativeProduct);
3833
+ var product = _this16.mergeProductForPriceQuery(productInput, authoritativeProduct);
3547
3834
  return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
3548
3835
  product: product,
3549
3836
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
@@ -3553,11 +3840,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3553
3840
  }));
3554
3841
  case 12:
3555
3842
  case "end":
3556
- return _context37.stop();
3843
+ return _context41.stop();
3557
3844
  }
3558
- }, _callee37, this);
3845
+ }, _callee41, this);
3559
3846
  }));
3560
- function calculateProductBookingPrices(_x28) {
3847
+ function calculateProductBookingPrices(_x34) {
3561
3848
  return _calculateProductBookingPrices.apply(this, arguments);
3562
3849
  }
3563
3850
  return calculateProductBookingPrices;
@@ -3565,34 +3852,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3565
3852
  }, {
3566
3853
  key: "addProductToOrder",
3567
3854
  value: function () {
3568
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(product, booking) {
3855
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(product, booking) {
3569
3856
  var products;
3570
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3571
- while (1) switch (_context38.prev = _context38.next) {
3857
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3858
+ while (1) switch (_context42.prev = _context42.next) {
3572
3859
  case 0:
3573
- _context38.prev = 0;
3860
+ _context42.prev = 0;
3574
3861
  if (this.store.order) {
3575
- _context38.next = 3;
3862
+ _context42.next = 3;
3576
3863
  break;
3577
3864
  }
3578
3865
  throw new Error('order 模块未初始化');
3579
3866
  case 3:
3580
- _context38.next = 5;
3867
+ _context42.next = 5;
3581
3868
  return this.store.order.addProductToOrder(product, booking);
3582
3869
  case 5:
3583
- products = _context38.sent;
3584
- return _context38.abrupt("return", products);
3870
+ products = _context42.sent;
3871
+ return _context42.abrupt("return", products);
3585
3872
  case 9:
3586
- _context38.prev = 9;
3587
- _context38.t0 = _context38["catch"](0);
3588
- throw _context38.t0;
3873
+ _context42.prev = 9;
3874
+ _context42.t0 = _context42["catch"](0);
3875
+ throw _context42.t0;
3589
3876
  case 12:
3590
3877
  case "end":
3591
- return _context38.stop();
3878
+ return _context42.stop();
3592
3879
  }
3593
- }, _callee38, this, [[0, 9]]);
3880
+ }, _callee42, this, [[0, 9]]);
3594
3881
  }));
3595
- function addProductToOrder(_x30, _x31) {
3882
+ function addProductToOrder(_x36, _x37) {
3596
3883
  return _addProductToOrder.apply(this, arguments);
3597
3884
  }
3598
3885
  return addProductToOrder;
@@ -3600,34 +3887,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3600
3887
  }, {
3601
3888
  key: "updateOrderProduct",
3602
3889
  value: function () {
3603
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
3890
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
3604
3891
  var products;
3605
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3606
- while (1) switch (_context39.prev = _context39.next) {
3892
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3893
+ while (1) switch (_context43.prev = _context43.next) {
3607
3894
  case 0:
3608
- _context39.prev = 0;
3895
+ _context43.prev = 0;
3609
3896
  if (this.store.order) {
3610
- _context39.next = 3;
3897
+ _context43.next = 3;
3611
3898
  break;
3612
3899
  }
3613
3900
  throw new Error('order 模块未初始化');
3614
3901
  case 3:
3615
- _context39.next = 5;
3902
+ _context43.next = 5;
3616
3903
  return this.store.order.updateOrderProduct(params);
3617
3904
  case 5:
3618
- products = _context39.sent;
3619
- return _context39.abrupt("return", products);
3905
+ products = _context43.sent;
3906
+ return _context43.abrupt("return", products);
3620
3907
  case 9:
3621
- _context39.prev = 9;
3622
- _context39.t0 = _context39["catch"](0);
3623
- throw _context39.t0;
3908
+ _context43.prev = 9;
3909
+ _context43.t0 = _context43["catch"](0);
3910
+ throw _context43.t0;
3624
3911
  case 12:
3625
3912
  case "end":
3626
- return _context39.stop();
3913
+ return _context43.stop();
3627
3914
  }
3628
- }, _callee39, this, [[0, 9]]);
3915
+ }, _callee43, this, [[0, 9]]);
3629
3916
  }));
3630
- function updateOrderProduct(_x32) {
3917
+ function updateOrderProduct(_x38) {
3631
3918
  return _updateOrderProduct.apply(this, arguments);
3632
3919
  }
3633
3920
  return updateOrderProduct;
@@ -3635,34 +3922,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3635
3922
  }, {
3636
3923
  key: "updateOrderProducts",
3637
3924
  value: function () {
3638
- var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(paramsList) {
3925
+ var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(paramsList) {
3639
3926
  var products;
3640
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3641
- while (1) switch (_context40.prev = _context40.next) {
3927
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3928
+ while (1) switch (_context44.prev = _context44.next) {
3642
3929
  case 0:
3643
- _context40.prev = 0;
3930
+ _context44.prev = 0;
3644
3931
  if (this.store.order) {
3645
- _context40.next = 3;
3932
+ _context44.next = 3;
3646
3933
  break;
3647
3934
  }
3648
3935
  throw new Error('order 模块未初始化');
3649
3936
  case 3:
3650
- _context40.next = 5;
3937
+ _context44.next = 5;
3651
3938
  return this.store.order.updateOrderProducts(paramsList);
3652
3939
  case 5:
3653
- products = _context40.sent;
3654
- return _context40.abrupt("return", products);
3940
+ products = _context44.sent;
3941
+ return _context44.abrupt("return", products);
3655
3942
  case 9:
3656
- _context40.prev = 9;
3657
- _context40.t0 = _context40["catch"](0);
3658
- throw _context40.t0;
3943
+ _context44.prev = 9;
3944
+ _context44.t0 = _context44["catch"](0);
3945
+ throw _context44.t0;
3659
3946
  case 12:
3660
3947
  case "end":
3661
- return _context40.stop();
3948
+ return _context44.stop();
3662
3949
  }
3663
- }, _callee40, this, [[0, 9]]);
3950
+ }, _callee44, this, [[0, 9]]);
3664
3951
  }));
3665
- function updateOrderProducts(_x33) {
3952
+ function updateOrderProducts(_x39) {
3666
3953
  return _updateOrderProducts.apply(this, arguments);
3667
3954
  }
3668
3955
  return updateOrderProducts;
@@ -3670,34 +3957,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3670
3957
  }, {
3671
3958
  key: "updateOrderProductQuantity",
3672
3959
  value: function () {
3673
- var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
3960
+ var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
3674
3961
  var products;
3675
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3676
- while (1) switch (_context41.prev = _context41.next) {
3962
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3963
+ while (1) switch (_context45.prev = _context45.next) {
3677
3964
  case 0:
3678
- _context41.prev = 0;
3965
+ _context45.prev = 0;
3679
3966
  if (this.store.order) {
3680
- _context41.next = 3;
3967
+ _context45.next = 3;
3681
3968
  break;
3682
3969
  }
3683
3970
  throw new Error('order 模块未初始化');
3684
3971
  case 3:
3685
- _context41.next = 5;
3972
+ _context45.next = 5;
3686
3973
  return this.store.order.updateOrderProductQuantity(params);
3687
3974
  case 5:
3688
- products = _context41.sent;
3689
- return _context41.abrupt("return", products);
3975
+ products = _context45.sent;
3976
+ return _context45.abrupt("return", products);
3690
3977
  case 9:
3691
- _context41.prev = 9;
3692
- _context41.t0 = _context41["catch"](0);
3693
- throw _context41.t0;
3978
+ _context45.prev = 9;
3979
+ _context45.t0 = _context45["catch"](0);
3980
+ throw _context45.t0;
3694
3981
  case 12:
3695
3982
  case "end":
3696
- return _context41.stop();
3983
+ return _context45.stop();
3697
3984
  }
3698
- }, _callee41, this, [[0, 9]]);
3985
+ }, _callee45, this, [[0, 9]]);
3699
3986
  }));
3700
- function updateOrderProductQuantity(_x34) {
3987
+ function updateOrderProductQuantity(_x40) {
3701
3988
  return _updateOrderProductQuantity.apply(this, arguments);
3702
3989
  }
3703
3990
  return updateOrderProductQuantity;
@@ -3720,12 +4007,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3720
4007
  }, {
3721
4008
  key: "setOrderProductLineNote",
3722
4009
  value: (function () {
3723
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(identity, note) {
4010
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(identity, note) {
3724
4011
  var params, products;
3725
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3726
- while (1) switch (_context42.prev = _context42.next) {
4012
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
4013
+ while (1) switch (_context46.prev = _context46.next) {
3727
4014
  case 0:
3728
- _context42.prev = 0;
4015
+ _context46.prev = 0;
3729
4016
  params = {
3730
4017
  product_id: identity.product_id,
3731
4018
  product_variant_id: identity.product_variant_id,
@@ -3740,22 +4027,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3740
4027
  params.product_sku = identity.product_sku;
3741
4028
  }
3742
4029
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
3743
- _context42.next = 7;
4030
+ _context46.next = 7;
3744
4031
  return this.updateOrderProduct(params);
3745
4032
  case 7:
3746
- products = _context42.sent;
3747
- return _context42.abrupt("return", products);
4033
+ products = _context46.sent;
4034
+ return _context46.abrupt("return", products);
3748
4035
  case 11:
3749
- _context42.prev = 11;
3750
- _context42.t0 = _context42["catch"](0);
3751
- throw _context42.t0;
4036
+ _context46.prev = 11;
4037
+ _context46.t0 = _context46["catch"](0);
4038
+ throw _context46.t0;
3752
4039
  case 14:
3753
4040
  case "end":
3754
- return _context42.stop();
4041
+ return _context46.stop();
3755
4042
  }
3756
- }, _callee42, this, [[0, 11]]);
4043
+ }, _callee46, this, [[0, 11]]);
3757
4044
  }));
3758
- function setOrderProductLineNote(_x35, _x36) {
4045
+ function setOrderProductLineNote(_x41, _x42) {
3759
4046
  return _setOrderProductLineNote.apply(this, arguments);
3760
4047
  }
3761
4048
  return setOrderProductLineNote;
@@ -3770,32 +4057,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3770
4057
  }, {
3771
4058
  key: "removeProductsFromOrder",
3772
4059
  value: (function () {
3773
- var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(identities) {
3774
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3775
- while (1) switch (_context43.prev = _context43.next) {
4060
+ var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(identities) {
4061
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
4062
+ while (1) switch (_context47.prev = _context47.next) {
3776
4063
  case 0:
3777
- _context43.prev = 0;
4064
+ _context47.prev = 0;
3778
4065
  if (this.store.order) {
3779
- _context43.next = 3;
4066
+ _context47.next = 3;
3780
4067
  break;
3781
4068
  }
3782
4069
  throw new Error('order 模块未初始化');
3783
4070
  case 3:
3784
- _context43.next = 5;
4071
+ _context47.next = 5;
3785
4072
  return this.store.order.removeProductsFromOrder(identities);
3786
4073
  case 5:
3787
- return _context43.abrupt("return", _context43.sent);
4074
+ return _context47.abrupt("return", _context47.sent);
3788
4075
  case 8:
3789
- _context43.prev = 8;
3790
- _context43.t0 = _context43["catch"](0);
3791
- throw _context43.t0;
4076
+ _context47.prev = 8;
4077
+ _context47.t0 = _context47["catch"](0);
4078
+ throw _context47.t0;
3792
4079
  case 11:
3793
4080
  case "end":
3794
- return _context43.stop();
4081
+ return _context47.stop();
3795
4082
  }
3796
- }, _callee43, this, [[0, 8]]);
4083
+ }, _callee47, this, [[0, 8]]);
3797
4084
  }));
3798
- function removeProductsFromOrder(_x37) {
4085
+ function removeProductsFromOrder(_x43) {
3799
4086
  return _removeProductsFromOrder.apply(this, arguments);
3800
4087
  }
3801
4088
  return removeProductsFromOrder;
@@ -3803,18 +4090,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3803
4090
  }, {
3804
4091
  key: "removeProductFromOrder",
3805
4092
  value: function () {
3806
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(identity) {
3807
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3808
- while (1) switch (_context44.prev = _context44.next) {
4093
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(identity) {
4094
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
4095
+ while (1) switch (_context48.prev = _context48.next) {
3809
4096
  case 0:
3810
- return _context44.abrupt("return", this.removeProductsFromOrder([identity]));
4097
+ return _context48.abrupt("return", this.removeProductsFromOrder([identity]));
3811
4098
  case 1:
3812
4099
  case "end":
3813
- return _context44.stop();
4100
+ return _context48.stop();
3814
4101
  }
3815
- }, _callee44, this);
4102
+ }, _callee48, this);
3816
4103
  }));
3817
- function removeProductFromOrder(_x38) {
4104
+ function removeProductFromOrder(_x44) {
3818
4105
  return _removeProductFromOrder.apply(this, arguments);
3819
4106
  }
3820
4107
  return removeProductFromOrder;
@@ -3864,23 +4151,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3864
4151
  }, {
3865
4152
  key: "applyPromotion",
3866
4153
  value: (function () {
3867
- var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
3868
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3869
- while (1) switch (_context45.prev = _context45.next) {
4154
+ var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49() {
4155
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
4156
+ while (1) switch (_context49.prev = _context49.next) {
3870
4157
  case 0:
3871
4158
  if (this.store.order) {
3872
- _context45.next = 2;
4159
+ _context49.next = 2;
3873
4160
  break;
3874
4161
  }
3875
4162
  throw new Error('order 模块未初始化');
3876
4163
  case 2:
3877
- _context45.next = 4;
4164
+ _context49.next = 4;
3878
4165
  return this.store.order.applyPromotion();
3879
4166
  case 4:
3880
4167
  case "end":
3881
- return _context45.stop();
4168
+ return _context49.stop();
3882
4169
  }
3883
- }, _callee45, this);
4170
+ }, _callee49, this);
3884
4171
  }));
3885
4172
  function applyPromotion() {
3886
4173
  return _applyPromotion.apply(this, arguments);
@@ -3907,18 +4194,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3907
4194
  }, {
3908
4195
  key: "getProductList",
3909
4196
  value: function () {
3910
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
3911
- var _this$otherParams21;
4197
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50() {
4198
+ var _this$otherParams25;
3912
4199
  var menu_list_ids, _this$store$products, res;
3913
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
3914
- while (1) switch (_context46.prev = _context46.next) {
4200
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4201
+ while (1) switch (_context50.prev = _context50.next) {
3915
4202
  case 0:
3916
4203
  // 可以直接通过配置里的 menu 读取
3917
- menu_list_ids = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 || (_this$otherParams21 = _this$otherParams21.dineInConfig) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21['menu.associated_menus'].map(function (n) {
4204
+ menu_list_ids = ((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 || (_this$otherParams25 = _this$otherParams25.dineInConfig) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25['menu.associated_menus'].map(function (n) {
3918
4205
  return Number(n.value);
3919
4206
  })) || [];
3920
- _context46.prev = 1;
3921
- _context46.next = 4;
4207
+ _context50.prev = 1;
4208
+ _context50.next = 4;
3922
4209
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
3923
4210
  menu_list_ids: menu_list_ids,
3924
4211
  cacheId: this.cacheId,
@@ -3926,17 +4213,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3926
4213
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
3927
4214
  });
3928
4215
  case 4:
3929
- res = _context46.sent;
3930
- return _context46.abrupt("return", res);
4216
+ res = _context50.sent;
4217
+ return _context50.abrupt("return", res);
3931
4218
  case 8:
3932
- _context46.prev = 8;
3933
- _context46.t0 = _context46["catch"](1);
3934
- throw _context46.t0;
4219
+ _context50.prev = 8;
4220
+ _context50.t0 = _context50["catch"](1);
4221
+ throw _context50.t0;
3935
4222
  case 11:
3936
4223
  case "end":
3937
- return _context46.stop();
4224
+ return _context50.stop();
3938
4225
  }
3939
- }, _callee46, this, [[1, 8]]);
4226
+ }, _callee50, this, [[1, 8]]);
3940
4227
  }));
3941
4228
  function getProductList() {
3942
4229
  return _getProductList.apply(this, arguments);
@@ -3951,33 +4238,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3951
4238
  }, {
3952
4239
  key: "setOtherParams",
3953
4240
  value: function () {
3954
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
3955
- var _this$otherParams22;
3956
- var _ref30,
3957
- _ref30$cover,
4241
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
4242
+ var _this$otherParams26;
4243
+ var _ref31,
4244
+ _ref31$cover,
3958
4245
  cover,
3959
- _args47 = arguments;
3960
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
3961
- while (1) switch (_context47.prev = _context47.next) {
4246
+ _args51 = arguments;
4247
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4248
+ while (1) switch (_context51.prev = _context51.next) {
3962
4249
  case 0:
3963
- _ref30 = _args47.length > 1 && _args47[1] !== undefined ? _args47[1] : {}, _ref30$cover = _ref30.cover, cover = _ref30$cover === void 0 ? false : _ref30$cover;
4250
+ _ref31 = _args51.length > 1 && _args51[1] !== undefined ? _args51[1] : {}, _ref31$cover = _ref31.cover, cover = _ref31$cover === void 0 ? false : _ref31$cover;
3964
4251
  if (cover) {
3965
4252
  this.otherParams = _objectSpread({}, params);
3966
4253
  } else {
3967
4254
  this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
3968
4255
  }
3969
- this.cacheId = (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.cacheId;
3970
- _context47.next = 5;
4256
+ this.cacheId = (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.cacheId;
4257
+ _context51.next = 5;
3971
4258
  return this.syncOtherParamsToSubModules(params, {
3972
4259
  cover: cover
3973
4260
  });
3974
4261
  case 5:
3975
4262
  case "end":
3976
- return _context47.stop();
4263
+ return _context51.stop();
3977
4264
  }
3978
- }, _callee47, this);
4265
+ }, _callee51, this);
3979
4266
  }));
3980
- function setOtherParams(_x39) {
4267
+ function setOtherParams(_x45) {
3981
4268
  return _setOtherParams.apply(this, arguments);
3982
4269
  }
3983
4270
  return setOtherParams;