@pisell/pisellos 2.3.164 → 2.3.166

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 (77) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +89 -104
  2. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
  3. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +28 -4
  4. package/dist/modules/Holder/utils.d.ts +2 -0
  5. package/dist/modules/Holder/utils.js +32 -2
  6. package/dist/modules/OpenData/contactInfo.d.ts +20 -0
  7. package/dist/modules/OpenData/contactInfo.js +70 -0
  8. package/dist/modules/OpenData/index.d.ts +1 -0
  9. package/dist/modules/OpenData/index.js +1 -0
  10. package/dist/modules/OpenData/types.d.ts +9 -0
  11. package/dist/modules/Order/holderRelations.d.ts +14 -0
  12. package/dist/modules/Order/holderRelations.js +154 -0
  13. package/dist/modules/Order/index.d.ts +1 -1
  14. package/dist/modules/Order/index.js +89 -44
  15. package/dist/modules/Order/types.d.ts +19 -1
  16. package/dist/modules/Order/types.js +2 -0
  17. package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
  18. package/dist/modules/Order/utils/discountProductLineIdentity.js +142 -7
  19. package/dist/modules/Order/utils/orderCollectionIdentity.js +24 -10
  20. package/dist/modules/Order/utils.d.ts +1 -1
  21. package/dist/modules/Order/utils.js +35 -9
  22. package/dist/modules/Rules/index.js +62 -61
  23. package/dist/server/index.js +18 -12
  24. package/dist/server/modules/order/index.d.ts +4 -0
  25. package/dist/server/modules/order/index.js +255 -190
  26. package/dist/server/modules/order/types.d.ts +3 -0
  27. package/dist/server/modules/products/index.js +3 -2
  28. package/dist/shared/receipt/small-ticket.js +17 -6
  29. package/dist/shared/sales/loadSalesOrderSnapshot.js +1 -1
  30. package/dist/solution/BaseSales/index.d.ts +4 -0
  31. package/dist/solution/BaseSales/index.js +1116 -935
  32. package/dist/solution/BaseSales/types.d.ts +2 -1
  33. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
  34. package/dist/solution/BaseSales/utils/parseSalesResponse.js +7 -3
  35. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -4
  36. package/dist/solution/BookingTicket/index.d.ts +15 -1
  37. package/dist/solution/BookingTicket/index.js +784 -501
  38. package/dist/solution/UnifiedBookingSales/index.js +1 -1
  39. package/lib/model/strategy/adapter/promotion/evaluator.js +9 -14
  40. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
  41. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +17 -1
  42. package/lib/modules/Holder/utils.d.ts +2 -0
  43. package/lib/modules/Holder/utils.js +27 -1
  44. package/lib/modules/OpenData/contactInfo.d.ts +20 -0
  45. package/lib/modules/OpenData/contactInfo.js +56 -0
  46. package/lib/modules/OpenData/index.d.ts +1 -0
  47. package/lib/modules/OpenData/index.js +12 -0
  48. package/lib/modules/OpenData/types.d.ts +9 -0
  49. package/lib/modules/Order/holderRelations.d.ts +14 -0
  50. package/lib/modules/Order/holderRelations.js +98 -0
  51. package/lib/modules/Order/index.d.ts +1 -1
  52. package/lib/modules/Order/index.js +44 -12
  53. package/lib/modules/Order/types.d.ts +19 -1
  54. package/lib/modules/Order/types.js +1 -0
  55. package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
  56. package/lib/modules/Order/utils/discountProductLineIdentity.js +51 -2
  57. package/lib/modules/Order/utils/orderCollectionIdentity.js +5 -0
  58. package/lib/modules/Order/utils.d.ts +1 -1
  59. package/lib/modules/Order/utils.js +27 -6
  60. package/lib/modules/Rules/index.js +2 -1
  61. package/lib/server/index.js +6 -0
  62. package/lib/server/modules/order/index.d.ts +4 -0
  63. package/lib/server/modules/order/index.js +46 -4
  64. package/lib/server/modules/order/types.d.ts +3 -0
  65. package/lib/server/modules/products/index.js +2 -1
  66. package/lib/shared/receipt/small-ticket.js +15 -7
  67. package/lib/shared/sales/loadSalesOrderSnapshot.js +1 -1
  68. package/lib/solution/BaseSales/index.d.ts +4 -0
  69. package/lib/solution/BaseSales/index.js +68 -2
  70. package/lib/solution/BaseSales/types.d.ts +2 -1
  71. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
  72. package/lib/solution/BaseSales/utils/parseSalesResponse.js +4 -0
  73. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -8
  74. package/lib/solution/BookingTicket/index.d.ts +15 -1
  75. package/lib/solution/BookingTicket/index.js +132 -3
  76. package/lib/solution/UnifiedBookingSales/index.js +1 -1
  77. package/package.json +1 -1
@@ -40,6 +40,8 @@ import { OrderModule } from "../../modules/Order";
40
40
  import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
41
41
  import { PickupTimingController } from "./pickupTiming";
42
42
  import { FulfillmentItemRulesController } from "./fulfillmentItemRules";
43
+ import { getProductHolderRelations, hasProductBooking } from "../../modules/Order/holderRelations";
44
+ import { resolveContactInfoConfig, getMissingContactInfoFields, ContactInfoRequiredError } from "../../modules/OpenData/contactInfo";
43
45
  import Decimal from 'decimal.js';
44
46
  import { cloneDeep, isEqual, mergeWith } from 'lodash-es';
45
47
  import { createModule } from "../BookingByStep/types";
@@ -400,6 +402,67 @@ function areBaseSalesNotesEquivalent(currentValue, loadedValue, options) {
400
402
  var loadedNotes = normalizeBaseSalesNotesForComparison(loadedValue);
401
403
  return currentNotes !== null && loadedNotes !== null && isEqual(currentNotes, loadedNotes);
402
404
  }
405
+ function mergeBaseSalesHolderRelations(currentRecord, incomingRecord, strategy) {
406
+ if (!Array.isArray(incomingRecord.holder_relations)) {
407
+ return cloneDeep(currentRecord.holder_relations);
408
+ }
409
+
410
+ // 仅保留商品集合合并实际留下的本地行关系;匹配的行沿用 incoming 快照。
411
+ // 未提供 products 的稀疏包不能据此判断哪些行已被删除或被本地保留。
412
+ var retainedProductUids = new Set();
413
+ if (Array.isArray(incomingRecord.products)) {
414
+ var _iterator2 = _createForOfIteratorHelper(currentRecord.products || []),
415
+ _step2;
416
+ try {
417
+ var _loop = function _loop() {
418
+ var product = _step2.value;
419
+ var retained = !incomingRecord.products.some(function (incomingProduct) {
420
+ return isSameOrderCollectionItem('product', product, incomingProduct);
421
+ }) && (strategy === 'preserve-local' || !getOrderCollectionPersistentId('product', product));
422
+ var uid = getOrderCollectionReferenceUid('product', product);
423
+ if (retained && uid) retainedProductUids.add(uid);
424
+ };
425
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
426
+ _loop();
427
+ }
428
+ } catch (err) {
429
+ _iterator2.e(err);
430
+ } finally {
431
+ _iterator2.f();
432
+ }
433
+ }
434
+ var belongsToRetainedProduct = function belongsToRetainedProduct(relation) {
435
+ return (relation === null || relation === void 0 ? void 0 : relation.relation_model) === 'order_detail' && retainedProductUids.has(String(relation.relation_uuid));
436
+ };
437
+ var selectedRelations = [].concat(_toConsumableArray(incomingRecord.holder_relations.filter(function (relation) {
438
+ return !belongsToRetainedProduct(relation);
439
+ })), _toConsumableArray(Array.isArray(currentRecord.holder_relations) ? currentRecord.holder_relations.filter(belongsToRetainedProduct) : []));
440
+ var result = [];
441
+ var indexByIdentity = new Map();
442
+ var _iterator3 = _createForOfIteratorHelper(selectedRelations),
443
+ _step3;
444
+ try {
445
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
446
+ var relation = _step3.value;
447
+ var identityParts = [relation === null || relation === void 0 ? void 0 : relation.relation_model, relation === null || relation === void 0 ? void 0 : relation.relation_uuid, relation === null || relation === void 0 ? void 0 : relation.holder_type, relation === null || relation === void 0 ? void 0 : relation.holder_id];
448
+ var identity = identityParts.every(function (value) {
449
+ return value !== undefined && value !== null;
450
+ }) ? JSON.stringify(identityParts) : null;
451
+ var existingIndex = identity === null ? undefined : indexByIdentity.get(identity);
452
+ if (existingIndex !== undefined) {
453
+ result[existingIndex] = cloneDeep(relation);
454
+ } else {
455
+ if (identity !== null) indexByIdentity.set(identity, result.length);
456
+ result.push(cloneDeep(relation));
457
+ }
458
+ }
459
+ } catch (err) {
460
+ _iterator3.e(err);
461
+ } finally {
462
+ _iterator3.f();
463
+ }
464
+ return result;
465
+ }
403
466
  function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, strategy) {
404
467
  var _currentTempOrder$_ex, _normalizedLoadedReco;
405
468
  var loadedHasOrderMetaList = Object.prototype.hasOwnProperty.call(loadedRecord || {}, 'order_meta_list');
@@ -419,8 +482,12 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
419
482
  var normalizedCurrentTempOrder = normalizeBaseSalesRecordCollections(currentTempOrder, {
420
483
  ensureUid: false
421
484
  });
485
+ var mergedHolderRelations = mergeBaseSalesHolderRelations(normalizedCurrentTempOrder, normalizedLoadedRecord, strategy);
422
486
  var uidRemaps = [];
423
- var mergedRecord = mergeWith(normalizedCurrentTempOrder, normalizedLoadedRecord, function (currentValue, loadedValue, key) {
487
+ var mergedRecord = mergeWith(normalizedCurrentTempOrder, normalizedLoadedRecord, function (currentValue, loadedValue, key, object) {
488
+ if (key === 'holder_relations' && object === normalizedCurrentTempOrder) {
489
+ return cloneDeep(mergedHolderRelations);
490
+ }
424
491
  // order_meta_list 是服务端/本地订单携带的完整业务快照。若 incoming
425
492
  // 明确提供它,必须整体替换;若省略,则保留当前值,避免 snapshot
426
493
  // 数组递归拼接后出现同 ID 的旧数据。
@@ -1853,20 +1920,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1853
1920
  }, {
1854
1921
  key: "getFulfillmentRefMode",
1855
1922
  value: function getFulfillmentRefMode() {
1856
- var _iterator2 = _createForOfIteratorHelper(this.getFulfillmentRefModeConfigs()),
1857
- _step2;
1923
+ var _iterator4 = _createForOfIteratorHelper(this.getFulfillmentRefModeConfigs()),
1924
+ _step4;
1858
1925
  try {
1859
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1860
- var config = _step2.value;
1926
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1927
+ var config = _step4.value;
1861
1928
  var mode = config['fulfillment.fulfillment_ref_mode'];
1862
1929
  if (mode === undefined || mode === null) continue;
1863
1930
  var normalized = String(mode).trim();
1864
1931
  if (normalized) return normalized;
1865
1932
  }
1866
1933
  } catch (err) {
1867
- _iterator2.e(err);
1934
+ _iterator4.e(err);
1868
1935
  } finally {
1869
- _iterator2.f();
1936
+ _iterator4.f();
1870
1937
  }
1871
1938
  return undefined;
1872
1939
  }
@@ -2797,8 +2864,103 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2797
2864
  if (!this.store.order) throw new Error('order 模块未初始化');
2798
2865
  return this.store.order.updateTempOrderContactsInfo(contactsInfo);
2799
2866
  }
2800
-
2801
- /** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
2867
+ }, {
2868
+ key: "loadContactInfoOpenData",
2869
+ value: function () {
2870
+ var _loadContactInfoOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2871
+ var _this$otherParams$ope2, _this$otherParams20;
2872
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2873
+ while (1) switch (_context23.prev = _context23.next) {
2874
+ case 0:
2875
+ return _context23.abrupt("return", (_this$otherParams$ope2 = (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.openData) !== null && _this$otherParams$ope2 !== void 0 ? _this$otherParams$ope2 : null);
2876
+ case 1:
2877
+ case "end":
2878
+ return _context23.stop();
2879
+ }
2880
+ }, _callee23, this);
2881
+ }));
2882
+ function loadContactInfoOpenData() {
2883
+ return _loadContactInfoOpenData.apply(this, arguments);
2884
+ }
2885
+ return loadContactInfoOpenData;
2886
+ }()
2887
+ }, {
2888
+ key: "getContactInfoConfig",
2889
+ value: function () {
2890
+ var _getContactInfoConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2891
+ var scope, data;
2892
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2893
+ while (1) switch (_context24.prev = _context24.next) {
2894
+ case 0:
2895
+ scope = this.getPickupTimingScope();
2896
+ _context24.next = 3;
2897
+ return this.loadContactInfoOpenData();
2898
+ case 3:
2899
+ data = _context24.sent;
2900
+ if (!(scope !== this.getPickupTimingScope())) {
2901
+ _context24.next = 6;
2902
+ break;
2903
+ }
2904
+ throw new Error('Store settings changed. Please try again.');
2905
+ case 6:
2906
+ return _context24.abrupt("return", resolveContactInfoConfig(data));
2907
+ case 7:
2908
+ case "end":
2909
+ return _context24.stop();
2910
+ }
2911
+ }, _callee24, this);
2912
+ }));
2913
+ function getContactInfoConfig() {
2914
+ return _getContactInfoConfig.apply(this, arguments);
2915
+ }
2916
+ return getContactInfoConfig;
2917
+ }()
2918
+ }, {
2919
+ key: "validateContactInfo",
2920
+ value: function () {
2921
+ var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2922
+ var _order$_extend, _current$_extend;
2923
+ var order, customerId, identity, config, current, missing;
2924
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2925
+ while (1) switch (_context25.prev = _context25.next) {
2926
+ case 0:
2927
+ order = this.getTempOrder();
2928
+ customerId = order === null || order === void 0 ? void 0 : order.customer_id; // Missing customer IDs and the reserved Walk-In IDs do not require contact info.
2929
+ if (!(!Number.isFinite(Number(customerId)) || Number(customerId) <= 1)) {
2930
+ _context25.next = 4;
2931
+ break;
2932
+ }
2933
+ return _context25.abrupt("return");
2934
+ case 4:
2935
+ identity = (order === null || order === void 0 || (_order$_extend = order._extend) === null || _order$_extend === void 0 ? void 0 : _order$_extend.localId) || (order === null || order === void 0 ? void 0 : order.external_sale_number) || (order === null || order === void 0 ? void 0 : order.order_id) || order;
2936
+ _context25.next = 7;
2937
+ return this.getContactInfoConfig();
2938
+ case 7:
2939
+ config = _context25.sent;
2940
+ current = this.getTempOrder();
2941
+ if (!(identity !== ((current === null || current === void 0 || (_current$_extend = current._extend) === null || _current$_extend === void 0 ? void 0 : _current$_extend.localId) || (current === null || current === void 0 ? void 0 : current.external_sale_number) || (current === null || current === void 0 ? void 0 : current.order_id) || current) || customerId !== (current === null || current === void 0 ? void 0 : current.customer_id))) {
2942
+ _context25.next = 11;
2943
+ break;
2944
+ }
2945
+ throw new Error('The order changed. Please try again.');
2946
+ case 11:
2947
+ missing = getMissingContactInfoFields(config, current === null || current === void 0 ? void 0 : current.contacts_info);
2948
+ if (!missing.length) {
2949
+ _context25.next = 14;
2950
+ break;
2951
+ }
2952
+ throw new ContactInfoRequiredError(missing);
2953
+ case 14:
2954
+ case "end":
2955
+ return _context25.stop();
2956
+ }
2957
+ }, _callee25, this);
2958
+ }));
2959
+ function validateContactInfo() {
2960
+ return _validateContactInfo.apply(this, arguments);
2961
+ }
2962
+ return validateContactInfo;
2963
+ }() /** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
2802
2964
  }, {
2803
2965
  key: "setEnableTempOrderPersist",
2804
2966
  value: function setEnableTempOrderPersist(enabled) {
@@ -2824,40 +2986,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2824
2986
  }, {
2825
2987
  key: "addNewOrder",
2826
2988
  value: function () {
2827
- var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2989
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2828
2990
  var tempOrder;
2829
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2830
- while (1) switch (_context23.prev = _context23.next) {
2991
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2992
+ while (1) switch (_context26.prev = _context26.next) {
2831
2993
  case 0:
2832
- _context23.prev = 0;
2994
+ _context26.prev = 0;
2833
2995
  if (this.store.order) {
2834
- _context23.next = 3;
2996
+ _context26.next = 3;
2835
2997
  break;
2836
2998
  }
2837
2999
  throw new Error('order 模块未初始化');
2838
3000
  case 3:
2839
- _context23.next = 5;
3001
+ _context26.next = 5;
2840
3002
  return this.store.order.addNewOrder();
2841
3003
  case 5:
2842
- tempOrder = _context23.sent;
3004
+ tempOrder = _context26.sent;
2843
3005
  if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
2844
- _context23.next = 10;
3006
+ _context26.next = 10;
2845
3007
  break;
2846
3008
  }
2847
3009
  this.store.order.persistTempOrder();
2848
- _context23.next = 10;
3010
+ _context26.next = 10;
2849
3011
  return this.store.order.saveDraft();
2850
3012
  case 10:
2851
- return _context23.abrupt("return", tempOrder);
3013
+ return _context26.abrupt("return", tempOrder);
2852
3014
  case 13:
2853
- _context23.prev = 13;
2854
- _context23.t0 = _context23["catch"](0);
2855
- throw _context23.t0;
3015
+ _context26.prev = 13;
3016
+ _context26.t0 = _context26["catch"](0);
3017
+ throw _context26.t0;
2856
3018
  case 16:
2857
3019
  case "end":
2858
- return _context23.stop();
3020
+ return _context26.stop();
2859
3021
  }
2860
- }, _callee23, this, [[0, 13]]);
3022
+ }, _callee26, this, [[0, 13]]);
2861
3023
  }));
2862
3024
  function addNewOrder() {
2863
3025
  return _addNewOrder.apply(this, arguments);
@@ -2867,22 +3029,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2867
3029
  }, {
2868
3030
  key: "saveDraft",
2869
3031
  value: function () {
2870
- var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2871
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2872
- while (1) switch (_context24.prev = _context24.next) {
3032
+ var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
3033
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3034
+ while (1) switch (_context27.prev = _context27.next) {
2873
3035
  case 0:
2874
3036
  if (this.store.order) {
2875
- _context24.next = 2;
3037
+ _context27.next = 2;
2876
3038
  break;
2877
3039
  }
2878
3040
  throw new Error('order 模块未初始化');
2879
3041
  case 2:
2880
- return _context24.abrupt("return", this.store.order.saveDraft());
3042
+ return _context27.abrupt("return", this.store.order.saveDraft());
2881
3043
  case 3:
2882
3044
  case "end":
2883
- return _context24.stop();
3045
+ return _context27.stop();
2884
3046
  }
2885
- }, _callee24, this);
3047
+ }, _callee27, this);
2886
3048
  }));
2887
3049
  function saveDraft() {
2888
3050
  return _saveDraft.apply(this, arguments);
@@ -2893,14 +3055,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2893
3055
  }, {
2894
3056
  key: "restoreOrder",
2895
3057
  value: function () {
2896
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
3058
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2897
3059
  var _this$store$payment, tempOrder, appDataChanged, wallet;
2898
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2899
- while (1) switch (_context25.prev = _context25.next) {
3060
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3061
+ while (1) switch (_context28.prev = _context28.next) {
2900
3062
  case 0:
2901
- _context25.prev = 0;
3063
+ _context28.prev = 0;
2902
3064
  if (this.store.order) {
2903
- _context25.next = 3;
3065
+ _context28.next = 3;
2904
3066
  break;
2905
3067
  }
2906
3068
  throw new Error('scanOrder 解决方案需要 order 模块支持');
@@ -2913,37 +3075,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2913
3075
  this.hasManualDiscountSelection = false;
2914
3076
  wallet = (_this$store$payment = this.store.payment) === null || _this$store$payment === void 0 ? void 0 : _this$store$payment.wallet;
2915
3077
  if (!wallet) {
2916
- _context25.next = 14;
3078
+ _context28.next = 14;
2917
3079
  break;
2918
3080
  }
2919
3081
  this.walletAssetsRefreshSequence += 1;
2920
3082
  wallet.clearAllCache();
2921
- _context25.next = 14;
3083
+ _context28.next = 14;
2922
3084
  return this.publishWalletAssetsState(wallet.getWalletAssetsState());
2923
3085
  case 14:
2924
- _context25.next = 16;
3086
+ _context28.next = 16;
2925
3087
  return this.effectsEmit('onTempOrderReplaced', {
2926
3088
  tempOrder: tempOrder
2927
3089
  });
2928
3090
  case 16:
2929
3091
  if (!(appDataChanged && this.isTempOrderPersistEnabled())) {
2930
- _context25.next = 20;
3092
+ _context28.next = 20;
2931
3093
  break;
2932
3094
  }
2933
3095
  this.store.order.persistTempOrder();
2934
- _context25.next = 20;
3096
+ _context28.next = 20;
2935
3097
  return this.store.order.saveDraft();
2936
3098
  case 20:
2937
- return _context25.abrupt("return", tempOrder);
3099
+ return _context28.abrupt("return", tempOrder);
2938
3100
  case 23:
2939
- _context25.prev = 23;
2940
- _context25.t0 = _context25["catch"](0);
2941
- throw _context25.t0;
3101
+ _context28.prev = 23;
3102
+ _context28.t0 = _context28["catch"](0);
3103
+ throw _context28.t0;
2942
3104
  case 26:
2943
3105
  case "end":
2944
- return _context25.stop();
3106
+ return _context28.stop();
2945
3107
  }
2946
- }, _callee25, this, [[0, 23]]);
3108
+ }, _callee28, this, [[0, 23]]);
2947
3109
  }));
2948
3110
  function restoreOrder() {
2949
3111
  return _restoreOrder.apply(this, arguments);
@@ -2957,23 +3119,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2957
3119
  }, {
2958
3120
  key: "clearOrderCartLines",
2959
3121
  value: (function () {
2960
- var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
3122
+ var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2961
3123
  var _this$fulfillmentItem2, tempOrder;
2962
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2963
- while (1) switch (_context26.prev = _context26.next) {
3124
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3125
+ while (1) switch (_context29.prev = _context29.next) {
2964
3126
  case 0:
2965
- _context26.prev = 0;
3127
+ _context29.prev = 0;
2966
3128
  if (this.store.order) {
2967
- _context26.next = 3;
3129
+ _context29.next = 3;
2968
3130
  break;
2969
3131
  }
2970
3132
  throw new Error('order 模块未初始化');
2971
3133
  case 3:
2972
3134
  (_this$fulfillmentItem2 = this.fulfillmentItemRulesController) === null || _this$fulfillmentItem2 === void 0 || _this$fulfillmentItem2.invalidate();
2973
- _context26.next = 6;
3135
+ _context29.next = 6;
2974
3136
  return this.store.order.clearOrderCartLines();
2975
3137
  case 6:
2976
- tempOrder = _context26.sent;
3138
+ tempOrder = _context29.sent;
2977
3139
  if (this.currentSalesDetail) {
2978
3140
  this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
2979
3141
  products: [],
@@ -2983,29 +3145,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2983
3145
  discount_list: []
2984
3146
  });
2985
3147
  }
2986
- _context26.next = 10;
3148
+ _context29.next = 10;
2987
3149
  return this.effectsEmit('onTempOrderReplaced', {
2988
3150
  tempOrder: tempOrder
2989
3151
  });
2990
3152
  case 10:
2991
3153
  if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
2992
- _context26.next = 14;
3154
+ _context29.next = 14;
2993
3155
  break;
2994
3156
  }
2995
3157
  this.store.order.persistTempOrder();
2996
- _context26.next = 14;
3158
+ _context29.next = 14;
2997
3159
  return this.store.order.saveDraft();
2998
3160
  case 14:
2999
- return _context26.abrupt("return", tempOrder);
3161
+ return _context29.abrupt("return", tempOrder);
3000
3162
  case 17:
3001
- _context26.prev = 17;
3002
- _context26.t0 = _context26["catch"](0);
3003
- throw _context26.t0;
3163
+ _context29.prev = 17;
3164
+ _context29.t0 = _context29["catch"](0);
3165
+ throw _context29.t0;
3004
3166
  case 20:
3005
3167
  case "end":
3006
- return _context26.stop();
3168
+ return _context29.stop();
3007
3169
  }
3008
- }, _callee26, this, [[0, 17]]);
3170
+ }, _callee29, this, [[0, 17]]);
3009
3171
  }));
3010
3172
  function clearOrderCartLines() {
3011
3173
  return _clearOrderCartLines.apply(this, arguments);
@@ -3015,23 +3177,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3015
3177
  }, {
3016
3178
  key: "clearOrderForSettlementSwitch",
3017
3179
  value: (function () {
3018
- var _clearOrderForSettlementSwitch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
3180
+ var _clearOrderForSettlementSwitch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
3019
3181
  var _this$fulfillmentItem3;
3020
3182
  var tempOrder;
3021
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3022
- while (1) switch (_context27.prev = _context27.next) {
3183
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3184
+ while (1) switch (_context30.prev = _context30.next) {
3023
3185
  case 0:
3024
3186
  if (this.store.order) {
3025
- _context27.next = 2;
3187
+ _context30.next = 2;
3026
3188
  break;
3027
3189
  }
3028
3190
  throw new Error('order 模块未初始化');
3029
3191
  case 2:
3030
3192
  (_this$fulfillmentItem3 = this.fulfillmentItemRulesController) === null || _this$fulfillmentItem3 === void 0 || _this$fulfillmentItem3.invalidate();
3031
- _context27.next = 5;
3193
+ _context30.next = 5;
3032
3194
  return this.store.order.clearOrderForSettlementSwitch();
3033
3195
  case 5:
3034
- tempOrder = _context27.sent;
3196
+ tempOrder = _context30.sent;
3035
3197
  if (this.currentSalesDetail) {
3036
3198
  this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
3037
3199
  products: [],
@@ -3042,12 +3204,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3042
3204
  payments: []
3043
3205
  });
3044
3206
  }
3045
- return _context27.abrupt("return", tempOrder);
3207
+ return _context30.abrupt("return", tempOrder);
3046
3208
  case 8:
3047
3209
  case "end":
3048
- return _context27.stop();
3210
+ return _context30.stop();
3049
3211
  }
3050
- }, _callee27, this);
3212
+ }, _callee30, this);
3051
3213
  }));
3052
3214
  function clearOrderForSettlementSwitch() {
3053
3215
  return _clearOrderForSettlementSwitch.apply(this, arguments);
@@ -3064,32 +3226,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3064
3226
  }, {
3065
3227
  key: "getSummary",
3066
3228
  value: function () {
3067
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
3229
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
3068
3230
  var summary;
3069
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3070
- while (1) switch (_context28.prev = _context28.next) {
3231
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3232
+ while (1) switch (_context31.prev = _context31.next) {
3071
3233
  case 0:
3072
- _context28.prev = 0;
3234
+ _context31.prev = 0;
3073
3235
  if (this.store.order) {
3074
- _context28.next = 3;
3236
+ _context31.next = 3;
3075
3237
  break;
3076
3238
  }
3077
3239
  throw new Error('order 模块未初始化');
3078
3240
  case 3:
3079
- _context28.next = 5;
3241
+ _context31.next = 5;
3080
3242
  return this.store.order.getOrderSummary();
3081
3243
  case 5:
3082
- summary = _context28.sent;
3083
- return _context28.abrupt("return", summary);
3244
+ summary = _context31.sent;
3245
+ return _context31.abrupt("return", summary);
3084
3246
  case 9:
3085
- _context28.prev = 9;
3086
- _context28.t0 = _context28["catch"](0);
3087
- throw _context28.t0;
3247
+ _context31.prev = 9;
3248
+ _context31.t0 = _context31["catch"](0);
3249
+ throw _context31.t0;
3088
3250
  case 12:
3089
3251
  case "end":
3090
- return _context28.stop();
3252
+ return _context31.stop();
3091
3253
  }
3092
- }, _callee28, this, [[0, 9]]);
3254
+ }, _callee31, this, [[0, 9]]);
3093
3255
  }));
3094
3256
  function getSummary() {
3095
3257
  return _getSummary.apply(this, arguments);
@@ -3235,7 +3397,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3235
3397
  }, {
3236
3398
  key: "loadDiscountConfig",
3237
3399
  value: function () {
3238
- var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3400
+ var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3239
3401
  var _this$store$order$get2,
3240
3402
  _this$store$order10,
3241
3403
  _tempOrder$customer2,
@@ -3247,12 +3409,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3247
3409
  _this$store$order11,
3248
3410
  _this18 = this,
3249
3411
  _discountModule$getDi3;
3250
- var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, requestOrderIdentityKey, discountConfigCacheKey, requestEpoch, isCurrentRequest, getCurrentResult, searchedDiscountList, searchedDiscountIds, preparedDiscountList, _this$store$order$get4, _this$store$order12, _discountModule$setOr, prepareConfigPromise, _discountModule$setOr2, _discountModule$setDi, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _orderStore$summary, orderTotalAmount, result, _iterator3, _step3, _product$metadata5, _tempOrder$_extend6, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
3251
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3252
- while (1) switch (_context29.prev = _context29.next) {
3412
+ var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, requestOrderIdentityKey, discountConfigCacheKey, requestEpoch, isCurrentRequest, getCurrentResult, searchedDiscountList, searchedDiscountIds, preparedDiscountList, _this$store$order$get4, _this$store$order12, _discountModule$setOr, prepareConfigPromise, _discountModule$setOr2, _discountModule$setDi, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _orderStore$summary, orderTotalAmount, result, _iterator5, _step5, _product$metadata5, _tempOrder$_extend6, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
3413
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3414
+ while (1) switch (_context32.prev = _context32.next) {
3253
3415
  case 0:
3254
3416
  if (this.store.order) {
3255
- _context29.next = 2;
3417
+ _context32.next = 2;
3256
3418
  break;
3257
3419
  }
3258
3420
  throw new Error('order 模块未初始化');
@@ -3298,15 +3460,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3298
3460
  return !searchedDiscountIds.has(String(discount.id));
3299
3461
  })));
3300
3462
  if (!(customerId && customerId !== 1)) {
3301
- _context29.next = 37;
3463
+ _context32.next = 37;
3302
3464
  break;
3303
3465
  }
3304
3466
  if (!(!(params !== null && params !== void 0 && params.force) && this.discountConfigCacheKey === discountConfigCacheKey)) {
3305
- _context29.next = 25;
3467
+ _context32.next = 25;
3306
3468
  break;
3307
3469
  }
3308
3470
  preparedDiscountList = originalDiscountList;
3309
- _context29.next = 37;
3471
+ _context32.next = 37;
3310
3472
  break;
3311
3473
  case 25:
3312
3474
  prepareConfigPromise = this.store.order.loadDiscountConfig({
@@ -3316,58 +3478,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3316
3478
  apply: false
3317
3479
  }); // OrderModule increments this epoch synchronously before its first await.
3318
3480
  requestEpoch = (_this$store$order$get4 = (_this$store$order12 = this.store.order).getCustomerWalletPrepareConfigEpoch) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order12);
3319
- _context29.next = 29;
3481
+ _context32.next = 29;
3320
3482
  return prepareConfigPromise;
3321
3483
  case 29:
3322
- preparedDiscountList = _context29.sent;
3484
+ preparedDiscountList = _context32.sent;
3323
3485
  if (isCurrentRequest()) {
3324
- _context29.next = 32;
3486
+ _context32.next = 32;
3325
3487
  break;
3326
3488
  }
3327
- return _context29.abrupt("return", getCurrentResult());
3489
+ return _context32.abrupt("return", getCurrentResult());
3328
3490
  case 32:
3329
- _context29.next = 34;
3491
+ _context32.next = 34;
3330
3492
  return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
3331
3493
  case 34:
3332
3494
  if (isCurrentRequest()) {
3333
- _context29.next = 36;
3495
+ _context32.next = 36;
3334
3496
  break;
3335
3497
  }
3336
- return _context29.abrupt("return", getCurrentResult());
3498
+ return _context32.abrupt("return", getCurrentResult());
3337
3499
  case 36:
3338
3500
  this.discountConfigCacheKey = discountConfigCacheKey;
3339
3501
  case 37:
3340
3502
  if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
3341
- _context29.next = 51;
3503
+ _context32.next = 51;
3342
3504
  break;
3343
3505
  }
3344
3506
  if (isCurrentRequest()) {
3345
- _context29.next = 40;
3507
+ _context32.next = 40;
3346
3508
  break;
3347
3509
  }
3348
- return _context29.abrupt("return", getCurrentResult());
3510
+ return _context32.abrupt("return", getCurrentResult());
3349
3511
  case 40:
3350
- _context29.next = 42;
3512
+ _context32.next = 42;
3351
3513
  return discountModule === null || discountModule === void 0 || (_discountModule$setOr2 = discountModule.setOriginalDiscountList) === null || _discountModule$setOr2 === void 0 ? void 0 : _discountModule$setOr2.call(discountModule, []);
3352
3514
  case 42:
3353
3515
  if (isCurrentRequest()) {
3354
- _context29.next = 44;
3516
+ _context32.next = 44;
3355
3517
  break;
3356
3518
  }
3357
- return _context29.abrupt("return", getCurrentResult());
3519
+ return _context32.abrupt("return", getCurrentResult());
3358
3520
  case 44:
3359
- _context29.next = 46;
3521
+ _context32.next = 46;
3360
3522
  return discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []);
3361
3523
  case 46:
3362
3524
  if (isCurrentRequest()) {
3363
- _context29.next = 48;
3525
+ _context32.next = 48;
3364
3526
  break;
3365
3527
  }
3366
- return _context29.abrupt("return", getCurrentResult());
3528
+ return _context32.abrupt("return", getCurrentResult());
3367
3529
  case 48:
3368
3530
  tempOrder.discount_list = [];
3369
3531
  tempOrder.shop_discount = '0.00';
3370
- return _context29.abrupt("return", {
3532
+ return _context32.abrupt("return", {
3371
3533
  productList: tempOrder.products || [],
3372
3534
  discountList: [],
3373
3535
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3375,10 +3537,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3375
3537
  });
3376
3538
  case 51:
3377
3539
  if (!(hasManualDiscountSelection && currentDiscountList.length)) {
3378
- _context29.next = 53;
3540
+ _context32.next = 53;
3379
3541
  break;
3380
3542
  }
3381
- return _context29.abrupt("return", {
3543
+ return _context32.abrupt("return", {
3382
3544
  productList: tempOrder.products || [],
3383
3545
  discountList: currentDiscountList,
3384
3546
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3388,19 +3550,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3388
3550
  nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi3 = discountModule.getDiscountList) === null || _discountModule$getDi3 === void 0 ? void 0 : _discountModule$getDi3.call(discountModule)) || [], tempOrder.products || []);
3389
3551
  nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
3390
3552
  if (isCurrentRequest()) {
3391
- _context29.next = 57;
3553
+ _context32.next = 57;
3392
3554
  break;
3393
3555
  }
3394
- return _context29.abrupt("return", getCurrentResult());
3556
+ return _context32.abrupt("return", getCurrentResult());
3395
3557
  case 57:
3396
- _context29.next = 59;
3558
+ _context32.next = 59;
3397
3559
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3398
3560
  case 59:
3399
3561
  if (isCurrentRequest()) {
3400
- _context29.next = 61;
3562
+ _context32.next = 61;
3401
3563
  break;
3402
3564
  }
3403
- return _context29.abrupt("return", getCurrentResult());
3565
+ return _context32.abrupt("return", getCurrentResult());
3404
3566
  case 61:
3405
3567
  shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
3406
3568
  discountAction: discountAction,
@@ -3409,28 +3571,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3409
3571
  nextDiscountList: nextDiscountList
3410
3572
  });
3411
3573
  if (!shouldSkipAutoApplyFetchedDiscounts) {
3412
- _context29.next = 75;
3574
+ _context32.next = 75;
3413
3575
  break;
3414
3576
  }
3415
- _context29.next = 65;
3577
+ _context32.next = 65;
3416
3578
  return this.store.order.recalculateSummary({
3417
3579
  createIfMissing: true
3418
3580
  });
3419
3581
  case 65:
3420
3582
  if (isCurrentRequest()) {
3421
- _context29.next = 67;
3583
+ _context32.next = 67;
3422
3584
  break;
3423
3585
  }
3424
- return _context29.abrupt("return", getCurrentResult());
3586
+ return _context32.abrupt("return", getCurrentResult());
3425
3587
  case 67:
3426
3588
  this.store.order.persistTempOrder();
3427
3589
  if (isCurrentRequest()) {
3428
- _context29.next = 70;
3590
+ _context32.next = 70;
3429
3591
  break;
3430
3592
  }
3431
- return _context29.abrupt("return", getCurrentResult());
3593
+ return _context32.abrupt("return", getCurrentResult());
3432
3594
  case 70:
3433
- _context29.next = 72;
3595
+ _context32.next = 72;
3434
3596
  return this.effectsEmit('onDiscountApplied', {
3435
3597
  productList: tempOrder.products || [],
3436
3598
  discountList: nextDiscountList,
@@ -3439,12 +3601,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3439
3601
  });
3440
3602
  case 72:
3441
3603
  if (isCurrentRequest()) {
3442
- _context29.next = 74;
3604
+ _context32.next = 74;
3443
3605
  break;
3444
3606
  }
3445
- return _context29.abrupt("return", getCurrentResult());
3607
+ return _context32.abrupt("return", getCurrentResult());
3446
3608
  case 74:
3447
- return _context29.abrupt("return", {
3609
+ return _context32.abrupt("return", {
3448
3610
  productList: tempOrder.products || [],
3449
3611
  discountList: nextDiscountList,
3450
3612
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3452,14 +3614,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3452
3614
  });
3453
3615
  case 75:
3454
3616
  if (!rulesModule) {
3455
- _context29.next = 117;
3617
+ _context32.next = 117;
3456
3618
  break;
3457
3619
  }
3458
3620
  if (isCurrentRequest()) {
3459
- _context29.next = 78;
3621
+ _context32.next = 78;
3460
3622
  break;
3461
3623
  }
3462
- return _context29.abrupt("return", getCurrentResult());
3624
+ return _context32.abrupt("return", getCurrentResult());
3463
3625
  case 78:
3464
3626
  orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
3465
3627
  result = rulesModule.calcDiscount({
@@ -3477,22 +3639,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3477
3639
  if (result.productList) {
3478
3640
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
3479
3641
  }
3480
- _iterator3 = _createForOfIteratorHelper(tempOrder.products || []);
3481
- _context29.prev = 82;
3482
- _iterator3.s();
3642
+ _iterator5 = _createForOfIteratorHelper(tempOrder.products || []);
3643
+ _context32.prev = 82;
3644
+ _iterator5.s();
3483
3645
  case 84:
3484
- if ((_step3 = _iterator3.n()).done) {
3485
- _context29.next = 99;
3646
+ if ((_step5 = _iterator5.n()).done) {
3647
+ _context32.next = 99;
3486
3648
  break;
3487
3649
  }
3488
- product = _step3.value;
3650
+ product = _step5.value;
3489
3651
  productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
3490
3652
  runtimeOrigin = productUid ? (_tempOrder$_extend6 = tempOrder._extend) === null || _tempOrder$_extend6 === void 0 || (_tempOrder$_extend6 = _tempOrder$_extend6.productsByUid) === null || _tempOrder$_extend6 === void 0 || (_tempOrder$_extend6 = _tempOrder$_extend6[productUid]) === null || _tempOrder$_extend6 === void 0 ? void 0 : _tempOrder$_extend6.origin : undefined;
3491
3653
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
3492
- _context29.next = 90;
3654
+ _context32.next = 90;
3493
3655
  break;
3494
3656
  }
3495
- return _context29.abrupt("continue", 97);
3657
+ return _context32.abrupt("continue", 97);
3496
3658
  case 90:
3497
3659
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
3498
3660
  return sum + Number(pd.amount || 0);
@@ -3510,70 +3672,70 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3510
3672
  bundle: product.product_bundle
3511
3673
  });
3512
3674
  case 97:
3513
- _context29.next = 84;
3675
+ _context32.next = 84;
3514
3676
  break;
3515
3677
  case 99:
3516
- _context29.next = 104;
3678
+ _context32.next = 104;
3517
3679
  break;
3518
3680
  case 101:
3519
- _context29.prev = 101;
3520
- _context29.t0 = _context29["catch"](82);
3521
- _iterator3.e(_context29.t0);
3681
+ _context32.prev = 101;
3682
+ _context32.t0 = _context32["catch"](82);
3683
+ _iterator5.e(_context32.t0);
3522
3684
  case 104:
3523
- _context29.prev = 104;
3524
- _iterator3.f();
3525
- return _context29.finish(104);
3685
+ _context32.prev = 104;
3686
+ _iterator5.f();
3687
+ return _context32.finish(104);
3526
3688
  case 107:
3527
3689
  if (!result.discountList) {
3528
- _context29.next = 117;
3690
+ _context32.next = 117;
3529
3691
  break;
3530
3692
  }
3531
3693
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
3532
3694
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
3533
3695
  if (isCurrentRequest()) {
3534
- _context29.next = 112;
3696
+ _context32.next = 112;
3535
3697
  break;
3536
3698
  }
3537
- return _context29.abrupt("return", getCurrentResult());
3699
+ return _context32.abrupt("return", getCurrentResult());
3538
3700
  case 112:
3539
- _context29.next = 114;
3701
+ _context32.next = 114;
3540
3702
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3541
3703
  case 114:
3542
3704
  if (isCurrentRequest()) {
3543
- _context29.next = 116;
3705
+ _context32.next = 116;
3544
3706
  break;
3545
3707
  }
3546
- return _context29.abrupt("return", getCurrentResult());
3708
+ return _context32.abrupt("return", getCurrentResult());
3547
3709
  case 116:
3548
3710
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
3549
3711
  return discount.isSelected;
3550
3712
  });
3551
3713
  case 117:
3552
3714
  if (isCurrentRequest()) {
3553
- _context29.next = 119;
3715
+ _context32.next = 119;
3554
3716
  break;
3555
3717
  }
3556
- return _context29.abrupt("return", getCurrentResult());
3718
+ return _context32.abrupt("return", getCurrentResult());
3557
3719
  case 119:
3558
- _context29.next = 121;
3720
+ _context32.next = 121;
3559
3721
  return this.store.order.recalculateSummary({
3560
3722
  createIfMissing: true
3561
3723
  });
3562
3724
  case 121:
3563
3725
  if (isCurrentRequest()) {
3564
- _context29.next = 123;
3726
+ _context32.next = 123;
3565
3727
  break;
3566
3728
  }
3567
- return _context29.abrupt("return", getCurrentResult());
3729
+ return _context32.abrupt("return", getCurrentResult());
3568
3730
  case 123:
3569
3731
  this.store.order.persistTempOrder();
3570
3732
  if (isCurrentRequest()) {
3571
- _context29.next = 126;
3733
+ _context32.next = 126;
3572
3734
  break;
3573
3735
  }
3574
- return _context29.abrupt("return", getCurrentResult());
3736
+ return _context32.abrupt("return", getCurrentResult());
3575
3737
  case 126:
3576
- _context29.next = 128;
3738
+ _context32.next = 128;
3577
3739
  return this.effectsEmit('onDiscountApplied', {
3578
3740
  productList: tempOrder.products || [],
3579
3741
  discountList: nextDiscountList,
@@ -3582,12 +3744,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3582
3744
  });
3583
3745
  case 128:
3584
3746
  if (isCurrentRequest()) {
3585
- _context29.next = 130;
3747
+ _context32.next = 130;
3586
3748
  break;
3587
3749
  }
3588
- return _context29.abrupt("return", getCurrentResult());
3750
+ return _context32.abrupt("return", getCurrentResult());
3589
3751
  case 130:
3590
- return _context29.abrupt("return", {
3752
+ return _context32.abrupt("return", {
3591
3753
  productList: tempOrder.products || [],
3592
3754
  discountList: nextDiscountList,
3593
3755
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3595,9 +3757,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3595
3757
  });
3596
3758
  case 131:
3597
3759
  case "end":
3598
- return _context29.stop();
3760
+ return _context32.stop();
3599
3761
  }
3600
- }, _callee29, this, [[82, 101, 104, 107]]);
3762
+ }, _callee32, this, [[82, 101, 104, 107]]);
3601
3763
  }));
3602
3764
  function loadDiscountConfig(_x20) {
3603
3765
  return _loadDiscountConfig.apply(this, arguments);
@@ -3621,21 +3783,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3621
3783
  }, {
3622
3784
  key: "bestDiscount",
3623
3785
  value: function () {
3624
- var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(cb) {
3786
+ var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(cb) {
3625
3787
  var _discountModule$getOr2, _discountModule$getDi4;
3626
3788
  var tempOrder, _result2, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _orderStore$summary2, orderTotalAmount;
3627
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3628
- while (1) switch (_context30.prev = _context30.next) {
3789
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3790
+ while (1) switch (_context33.prev = _context33.next) {
3629
3791
  case 0:
3630
3792
  if (this.store.order) {
3631
- _context30.next = 2;
3793
+ _context33.next = 2;
3632
3794
  break;
3633
3795
  }
3634
3796
  throw new Error('order 模块未初始化');
3635
3797
  case 2:
3636
3798
  tempOrder = this.store.order.ensureTempOrder();
3637
3799
  if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
3638
- _context30.next = 7;
3800
+ _context33.next = 7;
3639
3801
  break;
3640
3802
  }
3641
3803
  _result2 = {
@@ -3643,7 +3805,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3643
3805
  discountList: []
3644
3806
  };
3645
3807
  cb === null || cb === void 0 || cb(_result2);
3646
- return _context30.abrupt("return", _result2);
3808
+ return _context33.abrupt("return", _result2);
3647
3809
  case 7:
3648
3810
  orderStore = this.store.order.store || {};
3649
3811
  discountModule = orderStore.discount;
@@ -3655,11 +3817,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3655
3817
  productList: tempOrder.products || [],
3656
3818
  discountList: nextDiscountList
3657
3819
  };
3658
- _context30.next = 16;
3820
+ _context33.next = 16;
3659
3821
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3660
3822
  case 16:
3661
3823
  if (!rulesModule) {
3662
- _context30.next = 27;
3824
+ _context33.next = 27;
3663
3825
  break;
3664
3826
  }
3665
3827
  orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
@@ -3678,12 +3840,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3678
3840
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
3679
3841
  }
3680
3842
  if (!result.discountList) {
3681
- _context30.next = 27;
3843
+ _context33.next = 27;
3682
3844
  break;
3683
3845
  }
3684
3846
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
3685
3847
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
3686
- _context30.next = 25;
3848
+ _context33.next = 25;
3687
3849
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3688
3850
  case 25:
3689
3851
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
@@ -3694,13 +3856,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3694
3856
  discountList: nextDiscountList
3695
3857
  };
3696
3858
  case 27:
3697
- _context30.next = 29;
3859
+ _context33.next = 29;
3698
3860
  return this.store.order.recalculateSummary({
3699
3861
  createIfMissing: true
3700
3862
  });
3701
3863
  case 29:
3702
3864
  this.store.order.persistTempOrder();
3703
- _context30.next = 32;
3865
+ _context33.next = 32;
3704
3866
  return this.effectsEmit('onDiscountApplied', {
3705
3867
  productList: tempOrder.products || [],
3706
3868
  discountList: nextDiscountList,
@@ -3709,12 +3871,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3709
3871
  });
3710
3872
  case 32:
3711
3873
  cb === null || cb === void 0 || cb(result);
3712
- return _context30.abrupt("return", result);
3874
+ return _context33.abrupt("return", result);
3713
3875
  case 34:
3714
3876
  case "end":
3715
- return _context30.stop();
3877
+ return _context33.stop();
3716
3878
  }
3717
- }, _callee30, this);
3879
+ }, _callee33, this);
3718
3880
  }));
3719
3881
  function bestDiscount(_x21) {
3720
3882
  return _bestDiscount.apply(this, arguments);
@@ -3745,39 +3907,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3745
3907
  }, {
3746
3908
  key: "replaceDiscountStoreLists",
3747
3909
  value: (function () {
3748
- var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3910
+ var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
3749
3911
  var _store2;
3750
3912
  var discountModule;
3751
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3752
- while (1) switch (_context31.prev = _context31.next) {
3913
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3914
+ while (1) switch (_context34.prev = _context34.next) {
3753
3915
  case 0:
3754
3916
  if (this.store.order) {
3755
- _context31.next = 2;
3917
+ _context34.next = 2;
3756
3918
  break;
3757
3919
  }
3758
3920
  throw new Error('order 模块未初始化');
3759
3921
  case 2:
3760
3922
  discountModule = (_store2 = this.store.order.store) === null || _store2 === void 0 ? void 0 : _store2.discount;
3761
3923
  if (discountModule) {
3762
- _context31.next = 5;
3924
+ _context34.next = 5;
3763
3925
  break;
3764
3926
  }
3765
- return _context31.abrupt("return");
3927
+ return _context34.abrupt("return");
3766
3928
  case 5:
3767
3929
  if (!params.originalDiscountList) {
3768
- _context31.next = 8;
3930
+ _context34.next = 8;
3769
3931
  break;
3770
3932
  }
3771
- _context31.next = 8;
3933
+ _context34.next = 8;
3772
3934
  return discountModule.setOriginalDiscountList(params.originalDiscountList);
3773
3935
  case 8:
3774
- _context31.next = 10;
3936
+ _context34.next = 10;
3775
3937
  return discountModule.setDiscountList(params.discountList);
3776
3938
  case 10:
3777
3939
  case "end":
3778
- return _context31.stop();
3940
+ return _context34.stop();
3779
3941
  }
3780
- }, _callee31, this);
3942
+ }, _callee34, this);
3781
3943
  }));
3782
3944
  function replaceDiscountStoreLists(_x22) {
3783
3945
  return _replaceDiscountStoreLists.apply(this, arguments);
@@ -3787,34 +3949,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3787
3949
  }, {
3788
3950
  key: "scanPromotionCode",
3789
3951
  value: function () {
3790
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(code, customerId) {
3952
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(code, customerId) {
3791
3953
  var raw, tempOrder;
3792
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3793
- while (1) switch (_context32.prev = _context32.next) {
3954
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3955
+ while (1) switch (_context35.prev = _context35.next) {
3794
3956
  case 0:
3795
- _context32.prev = 0;
3957
+ _context35.prev = 0;
3796
3958
  if (this.store.order) {
3797
- _context32.next = 3;
3959
+ _context35.next = 3;
3798
3960
  break;
3799
3961
  }
3800
3962
  throw new Error('order 模块未初始化');
3801
3963
  case 3:
3802
- _context32.next = 5;
3964
+ _context35.next = 5;
3803
3965
  return this.store.order.scanCode(code, customerId);
3804
3966
  case 5:
3805
- raw = _context32.sent;
3967
+ raw = _context35.sent;
3806
3968
  if (!raw.isAvailable) {
3807
- _context32.next = 13;
3969
+ _context35.next = 13;
3808
3970
  break;
3809
3971
  }
3810
- _context32.next = 9;
3972
+ _context35.next = 9;
3811
3973
  return this.store.order.recalculateSummary({
3812
3974
  createIfMissing: true
3813
3975
  });
3814
3976
  case 9:
3815
3977
  this.store.order.persistTempOrder();
3816
3978
  tempOrder = this.store.order.ensureTempOrder();
3817
- _context32.next = 13;
3979
+ _context35.next = 13;
3818
3980
  return this.effectsEmit('onDiscountApplied', {
3819
3981
  productList: tempOrder.products || [],
3820
3982
  discountList: this.store.order.getDiscountList(),
@@ -3822,7 +3984,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3822
3984
  tempOrder: tempOrder
3823
3985
  });
3824
3986
  case 13:
3825
- return _context32.abrupt("return", _objectSpread(_objectSpread({
3987
+ return _context35.abrupt("return", _objectSpread(_objectSpread({
3826
3988
  isAvailable: raw.isAvailable
3827
3989
  }, raw.isAccepted !== undefined ? {
3828
3990
  isAccepted: raw.isAccepted
@@ -3832,14 +3994,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3832
3994
  scannedDiscountList: raw.scannedDiscountList
3833
3995
  }));
3834
3996
  case 16:
3835
- _context32.prev = 16;
3836
- _context32.t0 = _context32["catch"](0);
3837
- throw _context32.t0;
3997
+ _context35.prev = 16;
3998
+ _context35.t0 = _context35["catch"](0);
3999
+ throw _context35.t0;
3838
4000
  case 19:
3839
4001
  case "end":
3840
- return _context32.stop();
4002
+ return _context35.stop();
3841
4003
  }
3842
- }, _callee32, this, [[0, 16]]);
4004
+ }, _callee35, this, [[0, 16]]);
3843
4005
  }));
3844
4006
  function scanPromotionCode(_x23, _x24) {
3845
4007
  return _scanPromotionCode.apply(this, arguments);
@@ -3849,35 +4011,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3849
4011
  }, {
3850
4012
  key: "setDiscountSelected",
3851
4013
  value: function () {
3852
- var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3853
- 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$_extend7, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
3854
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3855
- while (1) switch (_context33.prev = _context33.next) {
4014
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
4015
+ var currentOrder, _store3, _store3$setDiscountLi, list, updated, tempOrder, orderStore, _discountModule, rulesModule, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator6, _step6, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator7, _step7, _product$metadata8, _tempOrder$_extend7, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
4016
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4017
+ while (1) switch (_context36.prev = _context36.next) {
3856
4018
  case 0:
3857
- _context33.prev = 0;
4019
+ _context36.prev = 0;
3858
4020
  if (this.store.order) {
3859
- _context33.next = 3;
4021
+ _context36.next = 3;
3860
4022
  break;
3861
4023
  }
3862
4024
  throw new Error('order 模块未初始化');
3863
4025
  case 3:
3864
4026
  currentOrder = this.store.order.ensureTempOrder();
3865
4027
  if (!this.isActiveVirtualSettlementOrder(currentOrder)) {
3866
- _context33.next = 13;
4028
+ _context36.next = 13;
3867
4029
  break;
3868
4030
  }
3869
4031
  currentOrder.discount_list = [];
3870
4032
  currentOrder.shop_discount = '0.00';
3871
- _context33.next = 9;
4033
+ _context36.next = 9;
3872
4034
  return (_store3 = this.store.order.store) === null || _store3 === void 0 || (_store3 = _store3.discount) === null || _store3 === void 0 || (_store3$setDiscountLi = _store3.setDiscountList) === null || _store3$setDiscountLi === void 0 ? void 0 : _store3$setDiscountLi.call(_store3, []);
3873
4035
  case 9:
3874
- _context33.next = 11;
4036
+ _context36.next = 11;
3875
4037
  return this.store.order.recalculateSummary({
3876
4038
  createIfMissing: true
3877
4039
  });
3878
4040
  case 11:
3879
4041
  this.store.order.persistTempOrder();
3880
- return _context33.abrupt("return");
4042
+ return _context36.abrupt("return");
3881
4043
  case 13:
3882
4044
  list = this.store.order.getDiscountList();
3883
4045
  updated = list.map(function (d) {
@@ -3892,7 +4054,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3892
4054
  _discountModule = orderStore.discount;
3893
4055
  rulesModule = orderStore.rules;
3894
4056
  nextDiscountList = updated;
3895
- _context33.next = 23;
4057
+ _context36.next = 23;
3896
4058
  return _discountModule === null || _discountModule === void 0 ? void 0 : _discountModule.setDiscountList(updated);
3897
4059
  case 23:
3898
4060
  if (rulesModule) {
@@ -3923,10 +4085,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3923
4085
  }).map(function (d) {
3924
4086
  return d.id;
3925
4087
  }));
3926
- _iterator4 = _createForOfIteratorHelper(nextDiscountList);
4088
+ _iterator6 = _createForOfIteratorHelper(nextDiscountList);
3927
4089
  try {
3928
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
3929
- d = _step4.value;
4090
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
4091
+ d = _step6.value;
3930
4092
  if (d.isSelected && !beforeSelectedIds.has(d.id)) {
3931
4093
  d.isSelected = false;
3932
4094
  d.isManualSelect = true;
@@ -3934,9 +4096,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3934
4096
  }
3935
4097
  }
3936
4098
  } catch (err) {
3937
- _iterator4.e(err);
4099
+ _iterator6.e(err);
3938
4100
  } finally {
3939
- _iterator4.f();
4101
+ _iterator6.f();
3940
4102
  }
3941
4103
  }
3942
4104
  }
@@ -3953,22 +4115,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3953
4115
  return rid != null && selectedResourceIds.has(rid);
3954
4116
  });
3955
4117
  };
3956
- _iterator5 = _createForOfIteratorHelper(tempOrder.products);
3957
- _context33.prev = 27;
3958
- _iterator5.s();
4118
+ _iterator7 = _createForOfIteratorHelper(tempOrder.products);
4119
+ _context36.prev = 27;
4120
+ _iterator7.s();
3959
4121
  case 29:
3960
- if ((_step5 = _iterator5.n()).done) {
3961
- _context33.next = 46;
4122
+ if ((_step7 = _iterator7.n()).done) {
4123
+ _context36.next = 46;
3962
4124
  break;
3963
4125
  }
3964
- product = _step5.value;
4126
+ product = _step7.value;
3965
4127
  productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
3966
4128
  runtimeOrigin = productUid ? (_tempOrder$_extend7 = tempOrder._extend) === null || _tempOrder$_extend7 === void 0 || (_tempOrder$_extend7 = _tempOrder$_extend7.productsByUid) === null || _tempOrder$_extend7 === void 0 || (_tempOrder$_extend7 = _tempOrder$_extend7[productUid]) === null || _tempOrder$_extend7 === void 0 ? void 0 : _tempOrder$_extend7.origin : undefined;
3967
4129
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
3968
- _context33.next = 35;
4130
+ _context36.next = 35;
3969
4131
  break;
3970
4132
  }
3971
- return _context33.abrupt("continue", 44);
4133
+ return _context36.abrupt("continue", 44);
3972
4134
  case 35:
3973
4135
  product.discount_list = filterSelectedDiscountDetails(product.discount_list);
3974
4136
  if (Array.isArray(product.product_bundle)) {
@@ -4004,28 +4166,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4004
4166
  bundle: product.product_bundle
4005
4167
  });
4006
4168
  case 44:
4007
- _context33.next = 29;
4169
+ _context36.next = 29;
4008
4170
  break;
4009
4171
  case 46:
4010
- _context33.next = 51;
4172
+ _context36.next = 51;
4011
4173
  break;
4012
4174
  case 48:
4013
- _context33.prev = 48;
4014
- _context33.t0 = _context33["catch"](27);
4015
- _iterator5.e(_context33.t0);
4175
+ _context36.prev = 48;
4176
+ _context36.t0 = _context36["catch"](27);
4177
+ _iterator7.e(_context36.t0);
4016
4178
  case 51:
4017
- _context33.prev = 51;
4018
- _iterator5.f();
4019
- return _context33.finish(51);
4179
+ _context36.prev = 51;
4180
+ _iterator7.f();
4181
+ return _context36.finish(51);
4020
4182
  case 54:
4021
4183
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
4022
- _context33.next = 57;
4184
+ _context36.next = 57;
4023
4185
  return _discountModule === null || _discountModule === void 0 ? void 0 : _discountModule.setDiscountList(nextDiscountList);
4024
4186
  case 57:
4025
4187
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
4026
4188
  return d.isSelected;
4027
4189
  });
4028
- _context33.next = 60;
4190
+ _context36.next = 60;
4029
4191
  return this.store.order.recalculateSummary({
4030
4192
  createIfMissing: true
4031
4193
  });
@@ -4037,17 +4199,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4037
4199
  selectedDiscountList: tempOrder.discount_list,
4038
4200
  tempOrder: tempOrder
4039
4201
  });
4040
- _context33.next = 67;
4202
+ _context36.next = 67;
4041
4203
  break;
4042
4204
  case 64:
4043
- _context33.prev = 64;
4044
- _context33.t1 = _context33["catch"](0);
4045
- throw _context33.t1;
4205
+ _context36.prev = 64;
4206
+ _context36.t1 = _context36["catch"](0);
4207
+ throw _context36.t1;
4046
4208
  case 67:
4047
4209
  case "end":
4048
- return _context33.stop();
4210
+ return _context36.stop();
4049
4211
  }
4050
- }, _callee33, this, [[0, 64], [27, 48, 51, 54]]);
4212
+ }, _callee36, this, [[0, 64], [27, 48, 51, 54]]);
4051
4213
  }));
4052
4214
  function setDiscountSelected(_x25) {
4053
4215
  return _setDiscountSelected.apply(this, arguments);
@@ -4057,23 +4219,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4057
4219
  }, {
4058
4220
  key: "applyDiscountCalculationResult",
4059
4221
  value: function () {
4060
- var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(result) {
4222
+ var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(result) {
4061
4223
  var tempOrder, orderStore, _discountModule2;
4062
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4063
- while (1) switch (_context34.prev = _context34.next) {
4224
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4225
+ while (1) switch (_context37.prev = _context37.next) {
4064
4226
  case 0:
4065
- _context34.prev = 0;
4227
+ _context37.prev = 0;
4066
4228
  if (this.store.order) {
4067
- _context34.next = 3;
4229
+ _context37.next = 3;
4068
4230
  break;
4069
4231
  }
4070
4232
  throw new Error('order 模块未初始化');
4071
4233
  case 3:
4072
4234
  if (result) {
4073
- _context34.next = 5;
4235
+ _context37.next = 5;
4074
4236
  break;
4075
4237
  }
4076
- return _context34.abrupt("return");
4238
+ return _context37.abrupt("return");
4077
4239
  case 5:
4078
4240
  tempOrder = this.store.order.ensureTempOrder();
4079
4241
  orderStore = this.store.order.store || {};
@@ -4082,24 +4244,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4082
4244
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
4083
4245
  }
4084
4246
  if (!result.discountList) {
4085
- _context34.next = 14;
4247
+ _context37.next = 14;
4086
4248
  break;
4087
4249
  }
4088
4250
  OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
4089
- _context34.next = 13;
4251
+ _context37.next = 13;
4090
4252
  return _discountModule2 === null || _discountModule2 === void 0 ? void 0 : _discountModule2.setDiscountList(result.discountList);
4091
4253
  case 13:
4092
4254
  tempOrder.discount_list = result.discountList.filter(function (discount) {
4093
4255
  return discount.isSelected;
4094
4256
  });
4095
4257
  case 14:
4096
- _context34.next = 16;
4258
+ _context37.next = 16;
4097
4259
  return this.store.order.recalculateSummary({
4098
4260
  createIfMissing: true
4099
4261
  });
4100
4262
  case 16:
4101
4263
  this.store.order.persistTempOrder();
4102
- _context34.next = 19;
4264
+ _context37.next = 19;
4103
4265
  return this.effectsEmit('onDiscountApplied', {
4104
4266
  productList: tempOrder.products || [],
4105
4267
  discountList: result.discountList || [],
@@ -4107,17 +4269,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4107
4269
  tempOrder: tempOrder
4108
4270
  });
4109
4271
  case 19:
4110
- _context34.next = 24;
4272
+ _context37.next = 24;
4111
4273
  break;
4112
4274
  case 21:
4113
- _context34.prev = 21;
4114
- _context34.t0 = _context34["catch"](0);
4115
- throw _context34.t0;
4275
+ _context37.prev = 21;
4276
+ _context37.t0 = _context37["catch"](0);
4277
+ throw _context37.t0;
4116
4278
  case 24:
4117
4279
  case "end":
4118
- return _context34.stop();
4280
+ return _context37.stop();
4119
4281
  }
4120
- }, _callee34, this, [[0, 21]]);
4282
+ }, _callee37, this, [[0, 21]]);
4121
4283
  }));
4122
4284
  function applyDiscountCalculationResult(_x26) {
4123
4285
  return _applyDiscountCalculationResult.apply(this, arguments);
@@ -4127,16 +4289,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4127
4289
  }, {
4128
4290
  key: "submitScanOrder",
4129
4291
  value: function () {
4130
- var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4131
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4132
- while (1) switch (_context35.prev = _context35.next) {
4292
+ var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4293
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4294
+ while (1) switch (_context38.prev = _context38.next) {
4133
4295
  case 0:
4134
- return _context35.abrupt("return", this.submitSalesOrder(params));
4296
+ return _context38.abrupt("return", this.submitSalesOrder(params));
4135
4297
  case 1:
4136
4298
  case "end":
4137
- return _context35.stop();
4299
+ return _context38.stop();
4138
4300
  }
4139
- }, _callee35, this);
4301
+ }, _callee38, this);
4140
4302
  }));
4141
4303
  function submitScanOrder(_x27) {
4142
4304
  return _submitScanOrder.apply(this, arguments);
@@ -4166,33 +4328,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4166
4328
  }, {
4167
4329
  key: "buildVirtualSettlementSubmitData",
4168
4330
  value: function () {
4169
- var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
4331
+ var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
4170
4332
  var settlement, tempOrder, currencyProductId, summary, amount, customerId, asset, balance, amountText, paymentNumber, payment, _paymentMethod$custom, paymentMethods, paymentMethod;
4171
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4172
- while (1) switch (_context36.prev = _context36.next) {
4333
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4334
+ while (1) switch (_context39.prev = _context39.next) {
4173
4335
  case 0:
4174
4336
  settlement = this.buildVirtualSettlementOrderData();
4175
4337
  if (!(!settlement || !this.store.order)) {
4176
- _context36.next = 3;
4338
+ _context39.next = 3;
4177
4339
  break;
4178
4340
  }
4179
- return _context36.abrupt("return", null);
4341
+ return _context39.abrupt("return", null);
4180
4342
  case 3:
4181
4343
  tempOrder = this.store.order.getTempOrder();
4182
4344
  currencyProductId = settlement.currencyProductId;
4183
- _context36.next = 7;
4345
+ _context39.next = 7;
4184
4346
  return this.store.order.recalculateSummary({
4185
4347
  createIfMissing: true
4186
4348
  });
4187
4349
  case 7:
4188
- summary = _context36.sent;
4350
+ summary = _context39.sent;
4189
4351
  amount = new Decimal((summary === null || summary === void 0 ? void 0 : summary.total_amount) || 0).toDecimalPlaces(2);
4190
4352
  customerId = Number((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id) || 0);
4191
4353
  if (!(amount.gt(0) && customerId > 0 && customerId !== 1)) {
4192
- _context36.next = 13;
4354
+ _context39.next = 13;
4193
4355
  break;
4194
4356
  }
4195
- _context36.next = 13;
4357
+ _context39.next = 13;
4196
4358
  return this.store.order.loadDiscountConfig({
4197
4359
  customerId: customerId,
4198
4360
  action: tempOrder !== null && tempOrder !== void 0 && tempOrder.order_id ? 'edit' : 'create',
@@ -4204,22 +4366,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4204
4366
  return Number(item === null || item === void 0 ? void 0 : item.product_id) === currencyProductId;
4205
4367
  });
4206
4368
  if (!amount.lte(0)) {
4207
- _context36.next = 16;
4369
+ _context39.next = 16;
4208
4370
  break;
4209
4371
  }
4210
- return _context36.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4372
+ return _context39.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4211
4373
  payments: []
4212
4374
  }));
4213
4375
  case 16:
4214
4376
  if (asset) {
4215
- _context36.next = 18;
4377
+ _context39.next = 18;
4216
4378
  break;
4217
4379
  }
4218
4380
  throw new Error('No matching virtual currency card is available.');
4219
4381
  case 18:
4220
4382
  balance = new Decimal(asset.balance || 0);
4221
4383
  if (!balance.lt(amount)) {
4222
- _context36.next = 21;
4384
+ _context39.next = 21;
4223
4385
  break;
4224
4386
  }
4225
4387
  throw new Error('Insufficient virtual currency balance.');
@@ -4227,7 +4389,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4227
4389
  amountText = amount.toFixed(2);
4228
4390
  paymentNumber = "LOCAL_".concat(createUuidV4());
4229
4391
  if (!this.store.order.isOnlineStorePlatform()) {
4230
- _context36.next = 27;
4392
+ _context39.next = 27;
4231
4393
  break;
4232
4394
  }
4233
4395
  payment = {
@@ -4244,18 +4406,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4244
4406
  },
4245
4407
  wallet_pass_use_value: amountText
4246
4408
  };
4247
- _context36.next = 34;
4409
+ _context39.next = 34;
4248
4410
  break;
4249
4411
  case 27:
4250
- _context36.next = 29;
4412
+ _context39.next = 29;
4251
4413
  return this.getPaymentMethodsAsync();
4252
4414
  case 29:
4253
- paymentMethods = _context36.sent;
4415
+ paymentMethods = _context39.sent;
4254
4416
  paymentMethod = paymentMethods.find(function (method) {
4255
4417
  return String(method.code || '').toUpperCase() === 'PRODUCTVOUCHER';
4256
4418
  });
4257
4419
  if (paymentMethod) {
4258
- _context36.next = 33;
4420
+ _context39.next = 33;
4259
4421
  break;
4260
4422
  }
4261
4423
  throw new Error('PRODUCTVOUCHER payment method is unavailable.');
@@ -4279,14 +4441,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4279
4441
  metadata: {}
4280
4442
  };
4281
4443
  case 34:
4282
- return _context36.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4444
+ return _context39.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4283
4445
  payments: [payment]
4284
4446
  }));
4285
4447
  case 35:
4286
4448
  case "end":
4287
- return _context36.stop();
4449
+ return _context39.stop();
4288
4450
  }
4289
- }, _callee36, this);
4451
+ }, _callee39, this);
4290
4452
  }));
4291
4453
  function buildVirtualSettlementSubmitData() {
4292
4454
  return _buildVirtualSettlementSubmitData.apply(this, arguments);
@@ -4302,42 +4464,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4302
4464
  }, {
4303
4465
  key: "submitSalesOrder",
4304
4466
  value: (function () {
4305
- var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
4306
- var _params$smallTicketDa, _this$otherParams20, _this$otherParams21, _this$otherParams22, _this$otherParams23;
4467
+ var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
4468
+ var _params$smallTicketDa, _this$otherParams21, _this$otherParams22, _this$otherParams23, _this$otherParams24;
4307
4469
  var isDeferredPayment, virtualPaymentSettlement, virtualSettlement, inferredPaymentStatus, smallTicketDataFlag, virtualSettlementEnhancePayload, configuredEnhancePayload, _enhancePayload, submitParams;
4308
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4309
- while (1) switch (_context37.prev = _context37.next) {
4470
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4471
+ while (1) switch (_context40.prev = _context40.next) {
4310
4472
  case 0:
4311
4473
  if (this.store.order) {
4312
- _context37.next = 2;
4474
+ _context40.next = 2;
4313
4475
  break;
4314
4476
  }
4315
4477
  throw new Error('BaseSales 解决方案需要 order 模块支持');
4316
4478
  case 2:
4479
+ _context40.next = 4;
4480
+ return this.validateContactInfo();
4481
+ case 4:
4317
4482
  if (!this.isPickupTimingEnabled()) {
4318
- _context37.next = 5;
4483
+ _context40.next = 7;
4319
4484
  break;
4320
4485
  }
4321
- _context37.next = 5;
4486
+ _context40.next = 7;
4322
4487
  return this.preparePickupTimingForCheckout({
4323
4488
  freeze: true
4324
4489
  });
4325
- case 5:
4490
+ case 7:
4326
4491
  isDeferredPayment = (params === null || params === void 0 ? void 0 : params.paymentExecution) === 'deferred';
4327
4492
  if (!isDeferredPayment) {
4328
- _context37.next = 10;
4493
+ _context40.next = 12;
4329
4494
  break;
4330
4495
  }
4331
- _context37.t0 = null;
4332
- _context37.next = 13;
4496
+ _context40.t0 = null;
4497
+ _context40.next = 15;
4333
4498
  break;
4334
- case 10:
4335
- _context37.next = 12;
4336
- return this.buildVirtualSettlementSubmitData();
4337
4499
  case 12:
4338
- _context37.t0 = _context37.sent;
4339
- case 13:
4340
- virtualPaymentSettlement = _context37.t0;
4500
+ _context40.next = 14;
4501
+ return this.buildVirtualSettlementSubmitData();
4502
+ case 14:
4503
+ _context40.t0 = _context40.sent;
4504
+ case 15:
4505
+ virtualPaymentSettlement = _context40.t0;
4341
4506
  virtualSettlement = isDeferredPayment ? this.buildVirtualSettlementOrderData() : virtualPaymentSettlement; // this.store.order.persistTempOrder();
4342
4507
  inferredPaymentStatus = isDeferredPayment ? undefined : this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
4343
4508
  smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
@@ -4370,10 +4535,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4370
4535
  } : configuredEnhancePayload;
4371
4536
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
4372
4537
  cacheId: this.cacheId,
4373
- platform: (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.platform,
4374
- businessCode: ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.businessCode) || ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.business_code),
4538
+ platform: (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.platform,
4539
+ businessCode: ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.businessCode) || ((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.business_code),
4375
4540
  channel: this.getSubmitOrderSalesChannel(),
4376
- type: (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.type,
4541
+ type: (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.type,
4377
4542
  request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
4378
4543
  }, isDeferredPayment ? {
4379
4544
  payments: []
@@ -4410,12 +4575,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4410
4575
  } : _enhancePayload !== undefined ? {
4411
4576
  enhancePayload: _enhancePayload
4412
4577
  } : {});
4413
- return _context37.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
4414
- case 22:
4578
+ return _context40.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
4579
+ case 24:
4415
4580
  case "end":
4416
- return _context37.stop();
4581
+ return _context40.stop();
4417
4582
  }
4418
- }, _callee37, this);
4583
+ }, _callee40, this);
4419
4584
  }));
4420
4585
  function submitSalesOrder(_x28) {
4421
4586
  return _submitSalesOrder.apply(this, arguments);
@@ -4425,15 +4590,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4425
4590
  }, {
4426
4591
  key: "finalizeLocalEftposPayment",
4427
4592
  value: function () {
4428
- var _finalizeLocalEftposPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4593
+ var _finalizeLocalEftposPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
4429
4594
  var _response$data2;
4430
4595
  var key, response, _response$data3, order, payment, temp, isCurrentOrder, _temp$payments, currentTemp, _this$store$order15, refreshed;
4431
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4432
- while (1) switch (_context38.prev = _context38.next) {
4596
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4597
+ while (1) switch (_context41.prev = _context41.next) {
4433
4598
  case 0:
4434
4599
  key = "".concat(params.saleId, ":").concat(params.paymentNumber); // If SQLite rejects the write, retry this known result before another payment can start.
4435
4600
  this.pendingLocalEftposFinalizations.set(key, params);
4436
- _context38.next = 4;
4601
+ _context41.next = 4;
4437
4602
  return this.request.post('/local/finalizeLocalEftposPayment', {
4438
4603
  sale_id: params.saleId,
4439
4604
  payment_number: params.paymentNumber,
@@ -4444,9 +4609,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4444
4609
  customToast: function customToast() {}
4445
4610
  });
4446
4611
  case 4:
4447
- response = _context38.sent;
4612
+ response = _context41.sent;
4448
4613
  if (!((response === null || response === void 0 ? void 0 : response.code) !== 200 || !(response !== null && response !== void 0 && (_response$data2 = response.data) !== null && _response$data2 !== void 0 && _response$data2.order))) {
4449
- _context38.next = 7;
4614
+ _context41.next = 7;
4450
4615
  break;
4451
4616
  }
4452
4617
  throw new Error((response === null || response === void 0 ? void 0 : response.message) || '本地支付收尾失败,请刷新订单后重试');
@@ -4456,69 +4621,69 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4456
4621
  temp = this.getTempOrder();
4457
4622
  isCurrentOrder = String((temp === null || temp === void 0 ? void 0 : temp.external_sale_number) || (temp === null || temp === void 0 ? void 0 : temp.order_id)) === String(params.saleId) || (temp === null || temp === void 0 ? void 0 : temp.order_id) && String(temp.order_id) === String(order.order_id);
4458
4623
  if (!isCurrentOrder) {
4459
- _context38.next = 28;
4624
+ _context41.next = 28;
4460
4625
  break;
4461
4626
  }
4462
4627
  if (!(temp !== null && temp !== void 0 && (_temp$payments = temp.payments) !== null && _temp$payments !== void 0 && _temp$payments.some(function (item) {
4463
4628
  return String(item.payment_number) === params.paymentNumber;
4464
4629
  }))) {
4465
- _context38.next = 15;
4630
+ _context41.next = 15;
4466
4631
  break;
4467
4632
  }
4468
- _context38.next = 15;
4633
+ _context41.next = 15;
4469
4634
  return this.updateOrderPayment(params.paymentNumber, payment, {
4470
4635
  persistDraft: false,
4471
4636
  submitWhenPaid: false
4472
4637
  });
4473
4638
  case 15:
4474
4639
  if (!requiresLocalPaymentRefresh(order)) {
4475
- _context38.next = 26;
4640
+ _context41.next = 26;
4476
4641
  break;
4477
4642
  }
4478
4643
  // Set the in-memory gate before the GET so a failed refresh also blocks this page.
4479
4644
  currentTemp = this.getTempOrder();
4480
4645
  if (currentTemp) currentTemp.metadata = _objectSpread(_objectSpread({}, currentTemp.metadata), order.metadata);
4481
- _context38.prev = 18;
4482
- _context38.next = 21;
4646
+ _context41.prev = 18;
4647
+ _context41.next = 21;
4483
4648
  return this.loadSalesDetail({
4484
4649
  orderId: order.order_id,
4485
4650
  forceRemote: true,
4486
4651
  merge: false
4487
4652
  });
4488
4653
  case 21:
4489
- _context38.next = 26;
4654
+ _context41.next = 26;
4490
4655
  break;
4491
4656
  case 23:
4492
- _context38.prev = 23;
4493
- _context38.t0 = _context38["catch"](18);
4657
+ _context41.prev = 23;
4658
+ _context41.t0 = _context41["catch"](18);
4494
4659
  throw new Error(PAYMENT_REFRESH_MESSAGE);
4495
4660
  case 26:
4496
- _context38.next = 34;
4661
+ _context41.next = 34;
4497
4662
  break;
4498
4663
  case 28:
4499
4664
  if (!requiresLocalPaymentRefresh(order)) {
4500
- _context38.next = 34;
4665
+ _context41.next = 34;
4501
4666
  break;
4502
4667
  }
4503
- _context38.next = 31;
4668
+ _context41.next = 31;
4504
4669
  return (_this$store$order15 = this.store.order) === null || _this$store$order15 === void 0 ? void 0 : _this$store$order15.getSalesOrderByLookup({
4505
4670
  lookup: order.order_id,
4506
4671
  forceRemote: true
4507
4672
  });
4508
4673
  case 31:
4509
- refreshed = _context38.sent;
4674
+ refreshed = _context41.sent;
4510
4675
  if (!((refreshed === null || refreshed === void 0 ? void 0 : refreshed.code) !== 200)) {
4511
- _context38.next = 34;
4676
+ _context41.next = 34;
4512
4677
  break;
4513
4678
  }
4514
4679
  throw new Error(PAYMENT_REFRESH_MESSAGE);
4515
4680
  case 34:
4516
- return _context38.abrupt("return", response.data);
4681
+ return _context41.abrupt("return", response.data);
4517
4682
  case 35:
4518
4683
  case "end":
4519
- return _context38.stop();
4684
+ return _context41.stop();
4520
4685
  }
4521
- }, _callee38, this, [[18, 23]]);
4686
+ }, _callee41, this, [[18, 23]]);
4522
4687
  }));
4523
4688
  function finalizeLocalEftposPayment(_x29) {
4524
4689
  return _finalizeLocalEftposPayment.apply(this, arguments);
@@ -4528,105 +4693,108 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4528
4693
  }, {
4529
4694
  key: "ensureSalesOrderReadyForPayment",
4530
4695
  value: (function () {
4531
- var _ensureSalesOrderReadyForPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
4696
+ var _ensureSalesOrderReadyForPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
4532
4697
  var _this$core6, _this$core6$hasRoute, _localOrder;
4533
- var temp, unfinished, _iterator6, _step6, params, lookup, localOrder, response, orderId;
4534
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4535
- while (1) switch (_context39.prev = _context39.next) {
4698
+ var temp, unfinished, _iterator8, _step8, params, lookup, localOrder, response, orderId;
4699
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4700
+ while (1) switch (_context42.prev = _context42.next) {
4536
4701
  case 0:
4537
4702
  temp = this.getTempOrder();
4538
4703
  unfinished = _toConsumableArray(this.pendingLocalEftposFinalizations.values()).filter(function (params) {
4539
4704
  return String(params.saleId) === String(temp === null || temp === void 0 ? void 0 : temp.external_sale_number) || String(params.saleId) === String(temp === null || temp === void 0 ? void 0 : temp.order_id);
4540
4705
  });
4541
4706
  if (!(unfinished.length > 0)) {
4542
- _context39.next = 21;
4707
+ _context42.next = 21;
4543
4708
  break;
4544
4709
  }
4545
- _iterator6 = _createForOfIteratorHelper(unfinished);
4546
- _context39.prev = 4;
4547
- _iterator6.s();
4710
+ _iterator8 = _createForOfIteratorHelper(unfinished);
4711
+ _context42.prev = 4;
4712
+ _iterator8.s();
4548
4713
  case 6:
4549
- if ((_step6 = _iterator6.n()).done) {
4550
- _context39.next = 12;
4714
+ if ((_step8 = _iterator8.n()).done) {
4715
+ _context42.next = 12;
4551
4716
  break;
4552
4717
  }
4553
- params = _step6.value;
4554
- _context39.next = 10;
4718
+ params = _step8.value;
4719
+ _context42.next = 10;
4555
4720
  return this.finalizeLocalEftposPayment(params);
4556
4721
  case 10:
4557
- _context39.next = 6;
4722
+ _context42.next = 6;
4558
4723
  break;
4559
4724
  case 12:
4560
- _context39.next = 17;
4725
+ _context42.next = 17;
4561
4726
  break;
4562
4727
  case 14:
4563
- _context39.prev = 14;
4564
- _context39.t0 = _context39["catch"](4);
4565
- _iterator6.e(_context39.t0);
4728
+ _context42.prev = 14;
4729
+ _context42.t0 = _context42["catch"](4);
4730
+ _iterator8.e(_context42.t0);
4566
4731
  case 17:
4567
- _context39.prev = 17;
4568
- _iterator6.f();
4569
- return _context39.finish(17);
4732
+ _context42.prev = 17;
4733
+ _iterator8.f();
4734
+ return _context42.finish(17);
4570
4735
  case 20:
4571
4736
  throw new Error('订单已更新,请确认商品和金额后重新付款');
4572
4737
  case 21:
4738
+ _context42.next = 23;
4739
+ return this.validateContactInfo();
4740
+ case 23:
4573
4741
  lookup = (temp === null || temp === void 0 ? void 0 : temp.order_id) || (temp === null || temp === void 0 ? void 0 : temp.external_sale_number);
4574
4742
  localOrder = null;
4575
4743
  if (!(lookup && (_this$core6 = this.core) !== null && _this$core6 !== void 0 && (_this$core6 = _this$core6.server) !== null && _this$core6 !== void 0 && (_this$core6$hasRoute = _this$core6.hasRoute) !== null && _this$core6$hasRoute !== void 0 && _this$core6$hasRoute.call(_this$core6, 'post', '/shop/local/orderPaymentReadiness'))) {
4576
- _context39.next = 30;
4744
+ _context42.next = 32;
4577
4745
  break;
4578
4746
  }
4579
- _context39.next = 26;
4747
+ _context42.next = 28;
4580
4748
  return this.request.post('/local/orderPaymentReadiness', {
4581
4749
  sale_id: lookup
4582
4750
  }, {
4583
4751
  osServer: true,
4584
4752
  customToast: function customToast() {}
4585
4753
  });
4586
- case 26:
4587
- response = _context39.sent;
4754
+ case 28:
4755
+ response = _context42.sent;
4588
4756
  if (!((response === null || response === void 0 ? void 0 : response.code) !== 200)) {
4589
- _context39.next = 29;
4757
+ _context42.next = 31;
4590
4758
  break;
4591
4759
  }
4592
4760
  throw new Error(PAYMENT_REFRESH_MESSAGE);
4593
- case 29:
4761
+ case 31:
4594
4762
  localOrder = response.data;
4595
- case 30:
4763
+ case 32:
4596
4764
  if (!(!requiresLocalPaymentRefresh(temp) && !requiresLocalPaymentRefresh(localOrder))) {
4597
- _context39.next = 32;
4765
+ _context42.next = 34;
4598
4766
  break;
4599
4767
  }
4600
- return _context39.abrupt("return");
4601
- case 32:
4768
+ return _context42.abrupt("return");
4769
+ case 34:
4602
4770
  orderId = ((_localOrder = localOrder) === null || _localOrder === void 0 ? void 0 : _localOrder.order_id) || (temp === null || temp === void 0 ? void 0 : temp.order_id);
4603
4771
  if (!(!orderId || String(orderId) === String(temp === null || temp === void 0 ? void 0 : temp.external_sale_number))) {
4604
- _context39.next = 35;
4772
+ _context42.next = 37;
4605
4773
  break;
4606
4774
  }
4607
4775
  throw new Error(PAYMENT_REFRESH_MESSAGE);
4608
- case 35:
4609
- _context39.prev = 35;
4610
- _context39.next = 38;
4776
+ case 37:
4777
+ _context42.prev = 37;
4778
+ _context42.next = 40;
4611
4779
  return this.loadSalesDetail({
4612
4780
  orderId: orderId,
4613
4781
  forceRemote: true,
4614
4782
  merge: false
4615
4783
  });
4616
- case 38:
4617
- _context39.next = 43;
4618
- break;
4619
4784
  case 40:
4620
- _context39.prev = 40;
4621
- _context39.t1 = _context39["catch"](35);
4785
+ _context42.next = 45;
4786
+ break;
4787
+ case 42:
4788
+ _context42.prev = 42;
4789
+ _context42.t1 = _context42["catch"](37);
4622
4790
  throw new Error(PAYMENT_REFRESH_MESSAGE);
4623
- case 43:
4791
+ case 45:
4624
4792
  throw new Error('订单已刷新,请确认商品和金额后重新付款');
4625
- case 44:
4793
+ case 46:
4626
4794
  case "end":
4627
- return _context39.stop();
4795
+ return _context42.stop();
4628
4796
  }
4629
- }, _callee39, this, [[4, 14, 17, 20], [35, 40]]);
4797
+ }, _callee42, this, [[4, 14, 17, 20], [37, 42]]);
4630
4798
  }));
4631
4799
  function ensureSalesOrderReadyForPayment() {
4632
4800
  return _ensureSalesOrderReadyForPayment.apply(this, arguments);
@@ -4636,40 +4804,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4636
4804
  }, {
4637
4805
  key: "saveSalesOrderDraft",
4638
4806
  value: function () {
4639
- var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
4640
- var _params$platform, _this$otherParams24, _this$otherParams25, _this$otherParams26, _params$channel, _params$type, _this$otherParams27;
4641
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4642
- while (1) switch (_context40.prev = _context40.next) {
4807
+ var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
4808
+ var _params$platform, _this$otherParams25, _this$otherParams26, _this$otherParams27, _params$channel, _params$type, _this$otherParams28;
4809
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4810
+ while (1) switch (_context43.prev = _context43.next) {
4643
4811
  case 0:
4644
4812
  if (this.store.order) {
4645
- _context40.next = 2;
4813
+ _context43.next = 2;
4646
4814
  break;
4647
4815
  }
4648
4816
  throw new Error('BaseSales 解决方案需要 order 模块支持');
4649
4817
  case 2:
4650
4818
  if (!this.isPickupTimingEnabled()) {
4651
- _context40.next = 5;
4819
+ _context43.next = 5;
4652
4820
  break;
4653
4821
  }
4654
- _context40.next = 5;
4822
+ _context43.next = 5;
4655
4823
  return this.preparePickupTimingForCheckout({
4656
4824
  freeze: false
4657
4825
  });
4658
4826
  case 5:
4659
- return _context40.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
4827
+ return _context43.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
4660
4828
  cacheId: this.cacheId,
4661
- platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.platform,
4662
- businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.businessCode) || ((_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.business_code),
4829
+ platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.platform,
4830
+ businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.businessCode) || ((_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.business_code),
4663
4831
  channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
4664
- type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.type
4832
+ type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.type
4665
4833
  }, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
4666
4834
  enhancePayload: params.enhancePayload
4667
4835
  } : {})));
4668
4836
  case 6:
4669
4837
  case "end":
4670
- return _context40.stop();
4838
+ return _context43.stop();
4671
4839
  }
4672
- }, _callee40, this);
4840
+ }, _callee43, this);
4673
4841
  }));
4674
4842
  function saveSalesOrderDraft(_x30) {
4675
4843
  return _saveSalesOrderDraft.apply(this, arguments);
@@ -4679,36 +4847,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4679
4847
  }, {
4680
4848
  key: "submitTempOrderAsync",
4681
4849
  value: function () {
4682
- var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
4683
- var _params$smallTicketDa2, _this$otherParams28, _this$otherParams29, _this$otherParams30, _this$otherParams31;
4850
+ var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
4851
+ var _params$smallTicketDa2, _this$otherParams29, _this$otherParams30, _this$otherParams31, _this$otherParams32;
4684
4852
  var inferredPaymentStatus, smallTicketDataFlag, enhancePayload, submitParams;
4685
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4686
- while (1) switch (_context41.prev = _context41.next) {
4853
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4854
+ while (1) switch (_context44.prev = _context44.next) {
4687
4855
  case 0:
4688
4856
  if (this.store.order) {
4689
- _context41.next = 2;
4857
+ _context44.next = 2;
4690
4858
  break;
4691
4859
  }
4692
4860
  throw new Error('BaseSales 解决方案需要 order 模块支持');
4693
4861
  case 2:
4862
+ _context44.next = 4;
4863
+ return this.validateContactInfo();
4864
+ case 4:
4694
4865
  if (!this.isPickupTimingEnabled()) {
4695
- _context41.next = 5;
4866
+ _context44.next = 7;
4696
4867
  break;
4697
4868
  }
4698
- _context41.next = 5;
4869
+ _context44.next = 7;
4699
4870
  return this.preparePickupTimingForCheckout({
4700
4871
  freeze: true
4701
4872
  });
4702
- case 5:
4873
+ case 7:
4703
4874
  inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
4704
4875
  smallTicketDataFlag = (_params$smallTicketDa2 = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa2 !== void 0 ? _params$smallTicketDa2 : this.getDefaultCheckoutSmallTicketDataFlag();
4705
4876
  enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params === null || params === void 0 ? void 0 : params.enhancePayload);
4706
4877
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
4707
4878
  cacheId: this.cacheId,
4708
- platform: (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.platform,
4709
- businessCode: ((_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.businessCode) || ((_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.business_code),
4879
+ platform: (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.platform,
4880
+ businessCode: ((_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.businessCode) || ((_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.business_code),
4710
4881
  channel: this.getSubmitOrderSalesChannel(),
4711
- type: (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.type,
4882
+ type: (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.type,
4712
4883
  request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
4713
4884
  }, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
4714
4885
  payments: params.payments
@@ -4721,12 +4892,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4721
4892
  } : {}), enhancePayload !== undefined ? {
4722
4893
  enhancePayload: enhancePayload
4723
4894
  } : {});
4724
- return _context41.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
4725
- case 10:
4895
+ return _context44.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
4896
+ case 12:
4726
4897
  case "end":
4727
- return _context41.stop();
4898
+ return _context44.stop();
4728
4899
  }
4729
- }, _callee41, this);
4900
+ }, _callee44, this);
4730
4901
  }));
4731
4902
  function submitTempOrderAsync(_x31) {
4732
4903
  return _submitTempOrderAsync.apply(this, arguments);
@@ -4740,8 +4911,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4740
4911
  }, {
4741
4912
  key: "shouldUseCheckoutSyncTask",
4742
4913
  value: function shouldUseCheckoutSyncTask() {
4743
- var _this$otherParams32;
4744
- var configured = (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.checkoutSyncTaskEnabled;
4914
+ var _this$otherParams33;
4915
+ var configured = (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.checkoutSyncTaskEnabled;
4745
4916
  return typeof configured === 'boolean' ? configured : true;
4746
4917
  }
4747
4918
 
@@ -4754,14 +4925,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4754
4925
  }, {
4755
4926
  key: "printLocalOrderReceipt",
4756
4927
  value: function () {
4757
- var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(lookup) {
4758
- var _this$otherParams33, _this$otherParams34, _this$otherParams35, _this$otherParams36;
4928
+ var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(lookup) {
4929
+ var _this$otherParams34, _this$otherParams35, _this$otherParams36, _this$otherParams37;
4759
4930
  var hasLookup, lookupPayload, context, payload, invoiceLayoutConfig, invoiceTemplateSettings, printPayload, response, _this$store$order$app, _this$store$order16, _data;
4760
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4761
- while (1) switch (_context42.prev = _context42.next) {
4931
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4932
+ while (1) switch (_context45.prev = _context45.next) {
4762
4933
  case 0:
4763
4934
  if (this.store.order) {
4764
- _context42.next = 2;
4935
+ _context45.next = 2;
4765
4936
  break;
4766
4937
  }
4767
4938
  throw new Error('BaseSales 解决方案需要 order 模块支持');
@@ -4773,10 +4944,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4773
4944
  external_sale_number: lookup
4774
4945
  };
4775
4946
  context = {
4776
- platform: (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.platform,
4777
- businessCode: ((_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.businessCode) || ((_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.business_code),
4947
+ platform: (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.platform,
4948
+ businessCode: ((_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.businessCode) || ((_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.business_code),
4778
4949
  channel: this.getSubmitOrderSalesChannel(),
4779
- type: (_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.type
4950
+ type: (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.type
4780
4951
  };
4781
4952
  payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
4782
4953
  lookup_order_from_db: 1,
@@ -4799,26 +4970,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4799
4970
  } : {}), invoiceTemplateSettings ? {
4800
4971
  template_settings: cloneDeep(invoiceTemplateSettings)
4801
4972
  } : {});
4802
- _context42.next = 11;
4973
+ _context45.next = 11;
4803
4974
  return this.request.post('/local/print-order', printPayload, {
4804
4975
  osServer: true,
4805
4976
  customToast: function customToast() {}
4806
4977
  });
4807
4978
  case 11:
4808
- response = _context42.sent;
4979
+ response = _context45.sent;
4809
4980
  if (hasLookup) {
4810
- _context42.next = 15;
4981
+ _context45.next = 15;
4811
4982
  break;
4812
4983
  }
4813
- _context42.next = 15;
4984
+ _context45.next = 15;
4814
4985
  return (_this$store$order$app = (_this$store$order16 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order16, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
4815
4986
  case 15:
4816
- return _context42.abrupt("return", response);
4987
+ return _context45.abrupt("return", response);
4817
4988
  case 16:
4818
4989
  case "end":
4819
- return _context42.stop();
4990
+ return _context45.stop();
4820
4991
  }
4821
- }, _callee42, this);
4992
+ }, _callee45, this);
4822
4993
  }));
4823
4994
  function printLocalOrderReceipt(_x32) {
4824
4995
  return _printLocalOrderReceipt.apply(this, arguments);
@@ -4841,19 +5012,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4841
5012
  }, {
4842
5013
  key: "syncPaymentsToOrder",
4843
5014
  value: function () {
4844
- var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
4845
- var _ref48, _params$businessCode, _this$otherParams37, _this$otherParams38, _params$channel2;
5015
+ var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
5016
+ var _ref48, _params$businessCode, _this$otherParams38, _this$otherParams39, _params$channel2;
4846
5017
  var businessCode, channel, enhancePayload, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
4847
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4848
- while (1) switch (_context43.prev = _context43.next) {
5018
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5019
+ while (1) switch (_context46.prev = _context46.next) {
4849
5020
  case 0:
4850
5021
  if (this.store.order) {
4851
- _context43.next = 2;
5022
+ _context46.next = 2;
4852
5023
  break;
4853
5024
  }
4854
5025
  throw new Error('order 模块未初始化');
4855
5026
  case 2:
4856
- businessCode = (_ref48 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.businessCode) !== null && _ref48 !== void 0 ? _ref48 : (_this$otherParams38 = this.otherParams) === null || _this$otherParams38 === void 0 ? void 0 : _this$otherParams38.business_code;
5027
+ businessCode = (_ref48 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams38 = this.otherParams) === null || _this$otherParams38 === void 0 ? void 0 : _this$otherParams38.businessCode) !== null && _ref48 !== void 0 ? _ref48 : (_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.business_code;
4857
5028
  channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
4858
5029
  enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params.enhancePayload);
4859
5030
  syncParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, params), {}, {
@@ -4867,14 +5038,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4867
5038
  } : {});
4868
5039
  syncState = this.store.order.getOrderSyncState();
4869
5040
  if (!(params.submitWhenPaid && syncState === 'submitting')) {
4870
- _context43.next = 10;
5041
+ _context46.next = 10;
4871
5042
  break;
4872
5043
  }
4873
5044
  this.queueLatestAutoPaymentSync();
4874
- return _context43.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
5045
+ return _context46.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
4875
5046
  case 10:
4876
5047
  payments = params.payments || [];
4877
- _context43.next = 13;
5048
+ _context46.next = 13;
4878
5049
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
4879
5050
  payments: payments,
4880
5051
  params: syncParams,
@@ -4882,11 +5053,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4882
5053
  orderSnapshot: this.store.order.getOrderSnapshot()
4883
5054
  });
4884
5055
  case 13:
4885
- _context43.prev = 13;
4886
- _context43.next = 16;
5056
+ _context46.prev = 13;
5057
+ _context46.next = 16;
4887
5058
  return this.store.order.syncPaymentsToOrder(syncParams);
4888
5059
  case 16:
4889
- syncResult = _context43.sent;
5060
+ syncResult = _context46.sent;
4890
5061
  latestPayments = this.store.order.getOrderPayments();
4891
5062
  amountSnapshot = this.store.order.getOrderAmountSnapshot();
4892
5063
  orderSnapshot = this.store.order.getOrderSnapshot();
@@ -4904,25 +5075,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4904
5075
  depositAmount: syncResult.depositAmount,
4905
5076
  orderExpectedAmount: syncResult.orderExpectedAmount
4906
5077
  };
4907
- _context43.next = 23;
5078
+ _context46.next = 23;
4908
5079
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
4909
5080
  case 23:
4910
5081
  if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
4911
- _context43.next = 26;
5082
+ _context46.next = 26;
4912
5083
  break;
4913
5084
  }
4914
- _context43.next = 26;
5085
+ _context46.next = 26;
4915
5086
  return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
4916
5087
  case 26:
4917
5088
  this.scheduleQueuedAutoPaymentSyncFlush(0);
4918
- return _context43.abrupt("return", syncResult);
5089
+ return _context46.abrupt("return", syncResult);
4919
5090
  case 30:
4920
- _context43.prev = 30;
4921
- _context43.t0 = _context43["catch"](13);
4922
- _context43.next = 34;
5091
+ _context46.prev = 30;
5092
+ _context46.t0 = _context46["catch"](13);
5093
+ _context46.next = 34;
4923
5094
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
4924
5095
  ok: false,
4925
- error: _context43.t0,
5096
+ error: _context46.t0,
4926
5097
  payments: this.store.order.getOrderPayments(),
4927
5098
  params: syncParams,
4928
5099
  amountSnapshot: this.store.order.getOrderAmountSnapshot(),
@@ -4930,12 +5101,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4930
5101
  });
4931
5102
  case 34:
4932
5103
  this.scheduleQueuedAutoPaymentSyncFlush(0);
4933
- throw _context43.t0;
5104
+ throw _context46.t0;
4934
5105
  case 36:
4935
5106
  case "end":
4936
- return _context43.stop();
5107
+ return _context46.stop();
4937
5108
  }
4938
- }, _callee43, this, [[13, 30]]);
5109
+ }, _callee46, this, [[13, 30]]);
4939
5110
  }));
4940
5111
  function syncPaymentsToOrder(_x33) {
4941
5112
  return _syncPaymentsToOrder.apply(this, arguments);
@@ -4986,46 +5157,46 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4986
5157
  }, {
4987
5158
  key: "flushQueuedAutoPaymentSync",
4988
5159
  value: function () {
4989
- var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
5160
+ var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
4990
5161
  var payments;
4991
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4992
- while (1) switch (_context44.prev = _context44.next) {
5162
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5163
+ while (1) switch (_context47.prev = _context47.next) {
4993
5164
  case 0:
4994
5165
  if (this.store.order) {
4995
- _context44.next = 2;
5166
+ _context47.next = 2;
4996
5167
  break;
4997
5168
  }
4998
- return _context44.abrupt("return");
5169
+ return _context47.abrupt("return");
4999
5170
  case 2:
5000
5171
  if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
5001
- _context44.next = 4;
5172
+ _context47.next = 4;
5002
5173
  break;
5003
5174
  }
5004
- return _context44.abrupt("return");
5175
+ return _context47.abrupt("return");
5005
5176
  case 4:
5006
5177
  if (!(this.store.order.getOrderSyncState() === 'submitting')) {
5007
- _context44.next = 7;
5178
+ _context47.next = 7;
5008
5179
  break;
5009
5180
  }
5010
5181
  this.scheduleQueuedAutoPaymentSyncFlush();
5011
- return _context44.abrupt("return");
5182
+ return _context47.abrupt("return");
5012
5183
  case 7:
5013
5184
  this.autoPaymentSyncFlushing = true;
5014
- _context44.prev = 8;
5185
+ _context47.prev = 8;
5015
5186
  case 9:
5016
5187
  if (!this.queuedAutoPaymentSync) {
5017
- _context44.next = 18;
5188
+ _context47.next = 18;
5018
5189
  break;
5019
5190
  }
5020
5191
  this.queuedAutoPaymentSync = false;
5021
5192
  payments = this.store.order.getOrderPayments();
5022
5193
  if (payments.length) {
5023
- _context44.next = 14;
5194
+ _context47.next = 14;
5024
5195
  break;
5025
5196
  }
5026
- return _context44.abrupt("continue", 9);
5197
+ return _context47.abrupt("continue", 9);
5027
5198
  case 14:
5028
- _context44.next = 16;
5199
+ _context47.next = 16;
5029
5200
  return this.syncPaymentsToOrder({
5030
5201
  payments: payments,
5031
5202
  paymentStatus: this.getPaymentStatusForSync(payments),
@@ -5033,29 +5204,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5033
5204
  smallTicketDataFlag: 1
5034
5205
  });
5035
5206
  case 16:
5036
- _context44.next = 9;
5207
+ _context47.next = 9;
5037
5208
  break;
5038
5209
  case 18:
5039
- _context44.next = 23;
5210
+ _context47.next = 23;
5040
5211
  break;
5041
5212
  case 20:
5042
- _context44.prev = 20;
5043
- _context44.t0 = _context44["catch"](8);
5213
+ _context47.prev = 20;
5214
+ _context47.t0 = _context47["catch"](8);
5044
5215
  this.logError('queued auto sync payments failed', {
5045
- error: _context44.t0 instanceof Error ? _context44.t0.message : String(_context44.t0)
5216
+ error: _context47.t0 instanceof Error ? _context47.t0.message : String(_context47.t0)
5046
5217
  });
5047
5218
  case 23:
5048
- _context44.prev = 23;
5219
+ _context47.prev = 23;
5049
5220
  this.autoPaymentSyncFlushing = false;
5050
5221
  if (this.queuedAutoPaymentSync) {
5051
5222
  this.scheduleQueuedAutoPaymentSyncFlush(0);
5052
5223
  }
5053
- return _context44.finish(23);
5224
+ return _context47.finish(23);
5054
5225
  case 27:
5055
5226
  case "end":
5056
- return _context44.stop();
5227
+ return _context47.stop();
5057
5228
  }
5058
- }, _callee44, this, [[8, 20, 23, 27]]);
5229
+ }, _callee47, this, [[8, 20, 23, 27]]);
5059
5230
  }));
5060
5231
  function flushQueuedAutoPaymentSync() {
5061
5232
  return _flushQueuedAutoPaymentSync.apply(this, arguments);
@@ -5079,33 +5250,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5079
5250
  }, {
5080
5251
  key: "addOrderPaymentAsync",
5081
5252
  value: (function () {
5082
- var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(payment) {
5253
+ var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(payment) {
5083
5254
  var paymentRecord, hasPaymentNumber, devicePrefix;
5084
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5085
- while (1) switch (_context45.prev = _context45.next) {
5255
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5256
+ while (1) switch (_context48.prev = _context48.next) {
5086
5257
  case 0:
5087
5258
  paymentRecord = payment;
5088
5259
  hasPaymentNumber = String(paymentRecord.payment_number || '').trim() !== '';
5089
5260
  if (!hasPaymentNumber) {
5090
- _context45.next = 6;
5261
+ _context48.next = 6;
5091
5262
  break;
5092
5263
  }
5093
- _context45.t0 = 'LOCAL';
5094
- _context45.next = 9;
5264
+ _context48.t0 = 'LOCAL';
5265
+ _context48.next = 9;
5095
5266
  break;
5096
5267
  case 6:
5097
- _context45.next = 8;
5268
+ _context48.next = 8;
5098
5269
  return this.getPaymentNumberDevicePrefixAsync();
5099
5270
  case 8:
5100
- _context45.t0 = _context45.sent;
5271
+ _context48.t0 = _context48.sent;
5101
5272
  case 9:
5102
- devicePrefix = _context45.t0;
5103
- return _context45.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
5273
+ devicePrefix = _context48.t0;
5274
+ return _context48.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
5104
5275
  case 11:
5105
5276
  case "end":
5106
- return _context45.stop();
5277
+ return _context48.stop();
5107
5278
  }
5108
- }, _callee45, this);
5279
+ }, _callee48, this);
5109
5280
  }));
5110
5281
  function addOrderPaymentAsync(_x34) {
5111
5282
  return _addOrderPaymentAsync.apply(this, arguments);
@@ -5115,7 +5286,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5115
5286
  }, {
5116
5287
  key: "addOrderPaymentWithDevicePrefix",
5117
5288
  value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
5118
- var _this$otherParams39,
5289
+ var _this$otherParams40,
5119
5290
  _paymentRecord$paymen,
5120
5291
  _paymentRecord$create,
5121
5292
  _ref49,
@@ -5131,7 +5302,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5131
5302
  return this.store.order.getOrderPayments();
5132
5303
  }
5133
5304
  var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
5134
- var shopWalletPassId = (_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.shop_wallet_pass_id;
5305
+ var shopWalletPassId = (_this$otherParams40 = this.otherParams) === null || _this$otherParams40 === void 0 ? void 0 : _this$otherParams40.shop_wallet_pass_id;
5135
5306
  if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
5136
5307
  metadata.shop_wallet_pass_id = shopWalletPassId;
5137
5308
  }
@@ -5176,7 +5347,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5176
5347
  }, {
5177
5348
  key: "updateOrderPayment",
5178
5349
  value: (function () {
5179
- var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(paymentIdentity, updates) {
5350
+ var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(paymentIdentity, updates) {
5180
5351
  var _result$payment, _result$payment2;
5181
5352
  var options,
5182
5353
  matchMode,
@@ -5193,13 +5364,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5193
5364
  shouldSubmit,
5194
5365
  syncResult,
5195
5366
  _options$smallTicketD2,
5196
- _args46 = arguments;
5197
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5198
- while (1) switch (_context46.prev = _context46.next) {
5367
+ _args49 = arguments;
5368
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5369
+ while (1) switch (_context49.prev = _context49.next) {
5199
5370
  case 0:
5200
- options = _args46.length > 2 && _args46[2] !== undefined ? _args46[2] : {};
5371
+ options = _args49.length > 2 && _args49[2] !== undefined ? _args49[2] : {};
5201
5372
  if (this.store.order) {
5202
- _context46.next = 3;
5373
+ _context49.next = 3;
5203
5374
  break;
5204
5375
  }
5205
5376
  throw new Error('order 模块未初始化');
@@ -5208,15 +5379,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5208
5379
  previousMatch = resolveOrderPaymentIdentity(this.store.order.getOrderPayments(), paymentIdentity, matchMode);
5209
5380
  previousPayment = previousMatch === null || previousMatch === void 0 ? void 0 : previousMatch.payment;
5210
5381
  if (!((previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) === 'paid' && !options.applyUpdatesWhenPaid)) {
5211
- _context46.next = 13;
5382
+ _context49.next = 13;
5212
5383
  break;
5213
5384
  }
5214
5385
  currentPayments = this.store.order.getOrderPayments();
5215
5386
  if (!(options.submitWhenPaid && options.forceSubmitIfPaid)) {
5216
- _context46.next = 12;
5387
+ _context49.next = 12;
5217
5388
  break;
5218
5389
  }
5219
- _context46.next = 11;
5390
+ _context49.next = 11;
5220
5391
  return this.syncPaymentsToOrder({
5221
5392
  payments: currentPayments,
5222
5393
  paymentStatus: this.getPaymentStatusForSync(currentPayments),
@@ -5224,9 +5395,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5224
5395
  smallTicketDataFlag: (_options$smallTicketD = options.smallTicketDataFlag) !== null && _options$smallTicketD !== void 0 ? _options$smallTicketD : 1
5225
5396
  });
5226
5397
  case 11:
5227
- _syncResult = _context46.sent;
5398
+ _syncResult = _context49.sent;
5228
5399
  case 12:
5229
- return _context46.abrupt("return", _objectSpread({
5400
+ return _context49.abrupt("return", _objectSpread({
5230
5401
  updated: false,
5231
5402
  payment: previousPayment,
5232
5403
  payments: currentPayments,
@@ -5235,44 +5406,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5235
5406
  syncResult: _syncResult
5236
5407
  } : {}));
5237
5408
  case 13:
5238
- _context46.next = 15;
5409
+ _context49.next = 15;
5239
5410
  return this.store.order.updateOrderPayment(paymentIdentity, updates, {
5240
5411
  matchBy: matchMode
5241
5412
  });
5242
5413
  case 15:
5243
- result = _context46.sent;
5414
+ result = _context49.sent;
5244
5415
  if (!(options.persistDraft !== false)) {
5245
- _context46.next = 29;
5416
+ _context49.next = 29;
5246
5417
  break;
5247
5418
  }
5248
- _context46.prev = 17;
5249
- _context46.next = 20;
5419
+ _context49.prev = 17;
5420
+ _context49.next = 20;
5250
5421
  return this.saveSalesOrderDraft();
5251
5422
  case 20:
5252
- draftResult = _context46.sent;
5253
- _context46.next = 29;
5423
+ draftResult = _context49.sent;
5424
+ _context49.next = 29;
5254
5425
  break;
5255
5426
  case 23:
5256
- _context46.prev = 23;
5257
- _context46.t0 = _context46["catch"](17);
5258
- draftError = _context46.t0;
5427
+ _context49.prev = 23;
5428
+ _context49.t0 = _context49["catch"](17);
5429
+ draftError = _context49.t0;
5259
5430
  this.logError('updateOrderPayment: 保存支付草稿失败', {
5260
5431
  paymentIdentity: paymentIdentity,
5261
- error: _context46.t0 instanceof Error ? _context46.t0.message : String(_context46.t0)
5432
+ error: _context49.t0 instanceof Error ? _context49.t0.message : String(_context49.t0)
5262
5433
  });
5263
5434
  if (options.submitWhenPaid) {
5264
- _context46.next = 29;
5435
+ _context49.next = 29;
5265
5436
  break;
5266
5437
  }
5267
- throw _context46.t0;
5438
+ throw _context49.t0;
5268
5439
  case 29:
5269
5440
  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';
5270
5441
  shouldSubmit = Boolean(options.submitWhenPaid && ((_result$payment2 = result.payment) === null || _result$payment2 === void 0 ? void 0 : _result$payment2.status) === 'paid' && (becamePaid || options.forceSubmitIfPaid));
5271
5442
  if (!shouldSubmit) {
5272
- _context46.next = 35;
5443
+ _context49.next = 35;
5273
5444
  break;
5274
5445
  }
5275
- _context46.next = 34;
5446
+ _context49.next = 34;
5276
5447
  return this.syncPaymentsToOrder({
5277
5448
  payments: result.payments,
5278
5449
  paymentStatus: this.getPaymentStatusForSync(result.payments),
@@ -5280,9 +5451,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5280
5451
  smallTicketDataFlag: (_options$smallTicketD2 = options.smallTicketDataFlag) !== null && _options$smallTicketD2 !== void 0 ? _options$smallTicketD2 : 1
5281
5452
  });
5282
5453
  case 34:
5283
- syncResult = _context46.sent;
5454
+ syncResult = _context49.sent;
5284
5455
  case 35:
5285
- return _context46.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
5456
+ return _context49.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
5286
5457
  draftResult: draftResult
5287
5458
  } : {}), draftError !== undefined ? {
5288
5459
  draftError: draftError
@@ -5291,9 +5462,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5291
5462
  } : {}));
5292
5463
  case 36:
5293
5464
  case "end":
5294
- return _context46.stop();
5465
+ return _context49.stop();
5295
5466
  }
5296
- }, _callee46, this, [[17, 23]]);
5467
+ }, _callee49, this, [[17, 23]]);
5297
5468
  }));
5298
5469
  function updateOrderPayment(_x35, _x36) {
5299
5470
  return _updateOrderPayment.apply(this, arguments);
@@ -5317,22 +5488,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5317
5488
  }, {
5318
5489
  key: "updateVoucherOrderPaymentsAsync",
5319
5490
  value: function () {
5320
- var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(payments, options) {
5321
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5322
- while (1) switch (_context47.prev = _context47.next) {
5491
+ var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(payments, options) {
5492
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5493
+ while (1) switch (_context50.prev = _context50.next) {
5323
5494
  case 0:
5324
5495
  if (this.store.order) {
5325
- _context47.next = 2;
5496
+ _context50.next = 2;
5326
5497
  break;
5327
5498
  }
5328
5499
  throw new Error('order 模块未初始化');
5329
5500
  case 2:
5330
- return _context47.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
5501
+ return _context50.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
5331
5502
  case 3:
5332
5503
  case "end":
5333
- return _context47.stop();
5504
+ return _context50.stop();
5334
5505
  }
5335
- }, _callee47, this);
5506
+ }, _callee50, this);
5336
5507
  }));
5337
5508
  function updateVoucherOrderPaymentsAsync(_x37, _x38) {
5338
5509
  return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
@@ -5370,7 +5541,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5370
5541
  var walletProducts = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products.map(function (product) {
5371
5542
  var _product$holder_id, _product$product_vari3, _product$is_charge_ta, _metadata$main_produc, _metadata$main_produc2;
5372
5543
  var metadata = product.metadata || {};
5373
- var rawHolderId = (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id;
5544
+ var rawHolderId = hasProductBooking(product) ? (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id : getProductHolderRelations(tempOrder, product).filter(function (relation) {
5545
+ return relation.holder_type === 'form';
5546
+ }).map(function (relation) {
5547
+ return relation.holder_id;
5548
+ });
5374
5549
  var holderIdValue = Array.isArray(rawHolderId) ? rawHolderId[0] : rawHolderId;
5375
5550
  var holder_id = Number.isInteger(Number(holderIdValue)) ? Number(holderIdValue) : undefined;
5376
5551
  return {
@@ -5445,20 +5620,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5445
5620
  }, {
5446
5621
  key: "initWalletData",
5447
5622
  value: function () {
5448
- var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
5623
+ var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
5449
5624
  var _this$store$order$mer, _this$store$order20, _snapshot$identity;
5450
5625
  var snapshot, walletBusinessData, result;
5451
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5452
- while (1) switch (_context48.prev = _context48.next) {
5626
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5627
+ while (1) switch (_context51.prev = _context51.next) {
5453
5628
  case 0:
5454
5629
  if (this.store.order) {
5455
- _context48.next = 2;
5630
+ _context51.next = 2;
5456
5631
  break;
5457
5632
  }
5458
5633
  throw new Error('order 模块未初始化');
5459
5634
  case 2:
5460
5635
  if (this.store.payment) {
5461
- _context48.next = 4;
5636
+ _context51.next = 4;
5462
5637
  break;
5463
5638
  }
5464
5639
  throw new Error('payment 模块未初始化');
@@ -5466,10 +5641,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5466
5641
  snapshot = this.store.order.getOrderSnapshot();
5467
5642
  walletBusinessData = this.buildWalletInitBusinessData(params);
5468
5643
  if (walletBusinessData) {
5469
- _context48.next = 8;
5644
+ _context51.next = 8;
5470
5645
  break;
5471
5646
  }
5472
- return _context48.abrupt("return", {
5647
+ return _context51.abrupt("return", {
5473
5648
  walletRecommendList: [],
5474
5649
  userIdentificationCodes: [],
5475
5650
  transformList: [],
@@ -5477,15 +5652,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5477
5652
  products: []
5478
5653
  });
5479
5654
  case 8:
5480
- _context48.next = 10;
5655
+ _context51.next = 10;
5481
5656
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
5482
5657
  case 10:
5483
- result = _context48.sent;
5658
+ result = _context51.sent;
5484
5659
  (_this$store$order$mer = (_this$store$order20 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer === void 0 || _this$store$order$mer.call(_this$store$order20, result.userIdentificationCodes, {
5485
5660
  customerId: walletBusinessData.customer_id,
5486
5661
  orderIdentity: snapshot === null || snapshot === void 0 ? void 0 : snapshot.identity
5487
5662
  });
5488
- _context48.next = 14;
5663
+ _context51.next = 14;
5489
5664
  return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
5490
5665
  orderId: snapshot === null || snapshot === void 0 || (_snapshot$identity = snapshot.identity) === null || _snapshot$identity === void 0 ? void 0 : _snapshot$identity.orderId,
5491
5666
  customerId: walletBusinessData.customer_id,
@@ -5497,12 +5672,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5497
5672
  timestamp: Date.now()
5498
5673
  });
5499
5674
  case 14:
5500
- return _context48.abrupt("return", result);
5675
+ return _context51.abrupt("return", result);
5501
5676
  case 15:
5502
5677
  case "end":
5503
- return _context48.stop();
5678
+ return _context51.stop();
5504
5679
  }
5505
- }, _callee48, this);
5680
+ }, _callee51, this);
5506
5681
  }));
5507
5682
  function initWalletData(_x39) {
5508
5683
  return _initWalletData.apply(this, arguments);
@@ -5555,25 +5730,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5555
5730
  }, {
5556
5731
  key: "publishWalletAssetsState",
5557
5732
  value: function () {
5558
- var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(state) {
5733
+ var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(state) {
5559
5734
  var changeSource,
5560
- _args49 = arguments;
5561
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5562
- while (1) switch (_context49.prev = _context49.next) {
5735
+ _args52 = arguments;
5736
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5737
+ while (1) switch (_context52.prev = _context52.next) {
5563
5738
  case 0:
5564
- changeSource = _args49.length > 1 && _args49[1] !== undefined ? _args49[1] : 'derived';
5565
- _context49.next = 3;
5739
+ changeSource = _args52.length > 1 && _args52[1] !== undefined ? _args52[1] : 'derived';
5740
+ _context52.next = 3;
5566
5741
  return this.effectsEmit(BaseSalesHookNames.onWalletAssetsStateChanged, {
5567
5742
  state: state,
5568
5743
  changeSource: changeSource
5569
5744
  });
5570
5745
  case 3:
5571
- return _context49.abrupt("return", state);
5746
+ return _context52.abrupt("return", state);
5572
5747
  case 4:
5573
5748
  case "end":
5574
- return _context49.stop();
5749
+ return _context52.stop();
5575
5750
  }
5576
- }, _callee49, this);
5751
+ }, _callee52, this);
5577
5752
  }));
5578
5753
  function publishWalletAssetsState(_x40) {
5579
5754
  return _publishWalletAssetsState.apply(this, arguments);
@@ -5583,26 +5758,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5583
5758
  }, {
5584
5759
  key: "syncSelectedWalletAssets",
5585
5760
  value: function () {
5586
- var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(state) {
5761
+ var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(state) {
5587
5762
  var paymentMethods, methodByCode, preparePayments, selectedAssetById, voucherPayments, payments;
5588
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5589
- while (1) switch (_context50.prev = _context50.next) {
5763
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5764
+ while (1) switch (_context53.prev = _context53.next) {
5590
5765
  case 0:
5591
5766
  if (!(!this.store.order || !this.store.payment)) {
5592
- _context50.next = 2;
5767
+ _context53.next = 2;
5593
5768
  break;
5594
5769
  }
5595
5770
  throw new Error('订单或支付模块未初始化');
5596
5771
  case 2:
5597
5772
  paymentMethods = this.getPaymentMethods();
5598
5773
  if (!(!paymentMethods.length && state.selectedItems.length)) {
5599
- _context50.next = 7;
5774
+ _context53.next = 7;
5600
5775
  break;
5601
5776
  }
5602
- _context50.next = 6;
5777
+ _context53.next = 6;
5603
5778
  return this.getPaymentMethodsAsync();
5604
5779
  case 6:
5605
- paymentMethods = _context50.sent;
5780
+ paymentMethods = _context53.sent;
5606
5781
  case 7:
5607
5782
  methodByCode = new Map(paymentMethods.map(function (method) {
5608
5783
  return [String(method.code || '').toUpperCase(), method];
@@ -5644,17 +5819,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5644
5819
  payments = this.updateVoucherOrderPayments(voucherPayments, {
5645
5820
  status: 'payment_pending'
5646
5821
  });
5647
- _context50.next = 14;
5822
+ _context53.next = 14;
5648
5823
  return this.store.order.recalculateSummary({
5649
5824
  createIfMissing: true
5650
5825
  });
5651
5826
  case 14:
5652
- return _context50.abrupt("return", payments);
5827
+ return _context53.abrupt("return", payments);
5653
5828
  case 15:
5654
5829
  case "end":
5655
- return _context50.stop();
5830
+ return _context53.stop();
5656
5831
  }
5657
- }, _callee50, this);
5832
+ }, _callee53, this);
5658
5833
  }));
5659
5834
  function syncSelectedWalletAssets(_x41) {
5660
5835
  return _syncSelectedWalletAssets.apply(this, arguments);
@@ -5690,29 +5865,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5690
5865
  }, {
5691
5866
  key: "importWalletAssetsSnapshot",
5692
5867
  value: (function () {
5693
- var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(snapshot) {
5868
+ var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(snapshot) {
5694
5869
  var _this$store$order22, _this$store$order22$m;
5695
5870
  var state;
5696
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5697
- while (1) switch (_context51.prev = _context51.next) {
5871
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5872
+ while (1) switch (_context54.prev = _context54.next) {
5698
5873
  case 0:
5699
5874
  if (this.store.payment) {
5700
- _context51.next = 2;
5875
+ _context54.next = 2;
5701
5876
  break;
5702
5877
  }
5703
5878
  throw new Error('payment 模块未初始化');
5704
5879
  case 2:
5705
5880
  state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
5706
5881
  (_this$store$order22 = this.store.order) === null || _this$store$order22 === void 0 || (_this$store$order22$m = _this$store$order22.mergePointCardSnapshotCodes) === null || _this$store$order22$m === void 0 || _this$store$order22$m.call(_this$store$order22, state.items);
5707
- _context51.next = 6;
5882
+ _context54.next = 6;
5708
5883
  return this.syncSelectedWalletAssets(state);
5709
5884
  case 6:
5710
- return _context51.abrupt("return", this.publishWalletAssetsState(state));
5885
+ return _context54.abrupt("return", this.publishWalletAssetsState(state));
5711
5886
  case 7:
5712
5887
  case "end":
5713
- return _context51.stop();
5888
+ return _context54.stop();
5714
5889
  }
5715
- }, _callee51, this);
5890
+ }, _callee54, this);
5716
5891
  }));
5717
5892
  function importWalletAssetsSnapshot(_x42) {
5718
5893
  return _importWalletAssetsSnapshot.apply(this, arguments);
@@ -5726,20 +5901,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5726
5901
  }, {
5727
5902
  key: "refreshWalletAssets",
5728
5903
  value: (function () {
5729
- var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
5904
+ var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
5730
5905
  var _this$store$order$get6, _previousState$custom, _businessData$custome;
5731
5906
  var refreshSequence, wallet, businessData, emptyState, pointCardSnapshotMergeContext, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, _this$store$order$mer2, _this$store$order23, _wallet$getUserIdenti, committed;
5732
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5733
- while (1) switch (_context52.prev = _context52.next) {
5907
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5908
+ while (1) switch (_context55.prev = _context55.next) {
5734
5909
  case 0:
5735
5910
  if (this.store.order) {
5736
- _context52.next = 2;
5911
+ _context55.next = 2;
5737
5912
  break;
5738
5913
  }
5739
5914
  throw new Error('order 模块未初始化');
5740
5915
  case 2:
5741
5916
  if (this.store.payment) {
5742
- _context52.next = 4;
5917
+ _context55.next = 4;
5743
5918
  break;
5744
5919
  }
5745
5920
  throw new Error('payment 模块未初始化');
@@ -5748,7 +5923,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5748
5923
  wallet = this.store.payment.wallet;
5749
5924
  businessData = this.buildWalletInitBusinessData(params);
5750
5925
  if (businessData) {
5751
- _context52.next = 12;
5926
+ _context55.next = 12;
5752
5927
  break;
5753
5928
  }
5754
5929
  wallet.clearAllCache();
@@ -5756,7 +5931,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5756
5931
  this.updateVoucherOrderPayments([], {
5757
5932
  status: 'payment_pending'
5758
5933
  });
5759
- return _context52.abrupt("return", this.publishWalletAssetsState(emptyState));
5934
+ return _context55.abrupt("return", this.publishWalletAssetsState(emptyState));
5760
5935
  case 12:
5761
5936
  pointCardSnapshotMergeContext = {
5762
5937
  customerId: businessData.customer_id,
@@ -5766,47 +5941,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5766
5941
  hasPreviousWalletContext = previousState.status !== 'idle' || previousState.items.length > 0 || previousState.selectedIds.length > 0 || previousState.customerId !== undefined;
5767
5942
  customerChanged = hasPreviousWalletContext && String((_previousState$custom = previousState.customerId) !== null && _previousState$custom !== void 0 ? _previousState$custom : '') !== String((_businessData$custome = businessData.customer_id) !== null && _businessData$custome !== void 0 ? _businessData$custome : '');
5768
5943
  if (!customerChanged) {
5769
- _context52.next = 21;
5944
+ _context55.next = 21;
5770
5945
  break;
5771
5946
  }
5772
5947
  clearedState = wallet.clearWalletAssetSelection();
5773
5948
  this.updateVoucherOrderPayments([], {
5774
5949
  status: 'payment_pending'
5775
5950
  });
5776
- _context52.next = 21;
5951
+ _context55.next = 21;
5777
5952
  return this.publishWalletAssetsState(clearedState);
5778
5953
  case 21:
5779
5954
  refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
5780
5955
  preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged,
5781
5956
  retainSearchResultCodes: params === null || params === void 0 ? void 0 : params.retainSearchResultCodes
5782
5957
  });
5783
- _context52.next = 24;
5958
+ _context55.next = 24;
5784
5959
  return this.publishWalletAssetsState(wallet.getWalletAssetsState());
5785
5960
  case 24:
5786
- _context52.next = 26;
5961
+ _context55.next = 26;
5787
5962
  return refreshTask;
5788
5963
  case 26:
5789
- state = _context52.sent;
5964
+ state = _context55.sent;
5790
5965
  if (!(refreshSequence !== this.walletAssetsRefreshSequence)) {
5791
- _context52.next = 29;
5966
+ _context55.next = 29;
5792
5967
  break;
5793
5968
  }
5794
- return _context52.abrupt("return", wallet.getWalletAssetsState());
5969
+ return _context55.abrupt("return", wallet.getWalletAssetsState());
5795
5970
  case 29:
5796
5971
  if (state.status !== 'error') {
5797
5972
  committed = this.getCommittedWalletAssets();
5798
5973
  state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5799
5974
  (_this$store$order$mer2 = (_this$store$order23 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer2 === void 0 || _this$store$order$mer2.call(_this$store$order23, ((_wallet$getUserIdenti = wallet.getUserIdentificationCodes) === null || _wallet$getUserIdenti === void 0 ? void 0 : _wallet$getUserIdenti.call(wallet)) || [], pointCardSnapshotMergeContext);
5800
5975
  }
5801
- _context52.next = 32;
5976
+ _context55.next = 32;
5802
5977
  return this.syncSelectedWalletAssets(state);
5803
5978
  case 32:
5804
- return _context52.abrupt("return", this.publishWalletAssetsState(state));
5979
+ return _context55.abrupt("return", this.publishWalletAssetsState(state));
5805
5980
  case 33:
5806
5981
  case "end":
5807
- return _context52.stop();
5982
+ return _context55.stop();
5808
5983
  }
5809
- }, _callee52, this);
5984
+ }, _callee55, this);
5810
5985
  }));
5811
5986
  function refreshWalletAssets(_x43) {
5812
5987
  return _refreshWalletAssets.apply(this, arguments);
@@ -5816,13 +5991,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5816
5991
  }, {
5817
5992
  key: "selectWalletAsset",
5818
5993
  value: (function () {
5819
- var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(params) {
5994
+ var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
5820
5995
  var state;
5821
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5822
- while (1) switch (_context53.prev = _context53.next) {
5996
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5997
+ while (1) switch (_context56.prev = _context56.next) {
5823
5998
  case 0:
5824
5999
  if (this.store.payment) {
5825
- _context53.next = 2;
6000
+ _context56.next = 2;
5826
6001
  break;
5827
6002
  }
5828
6003
  throw new Error('payment 模块未初始化');
@@ -5831,15 +6006,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5831
6006
  selected: params.selected,
5832
6007
  source: params.source
5833
6008
  });
5834
- _context53.next = 5;
6009
+ _context56.next = 5;
5835
6010
  return this.syncSelectedWalletAssets(state);
5836
6011
  case 5:
5837
- return _context53.abrupt("return", this.publishWalletAssetsState(state, 'local'));
6012
+ return _context56.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5838
6013
  case 6:
5839
6014
  case "end":
5840
- return _context53.stop();
6015
+ return _context56.stop();
5841
6016
  }
5842
- }, _callee53, this);
6017
+ }, _callee56, this);
5843
6018
  }));
5844
6019
  function selectWalletAsset(_x44) {
5845
6020
  return _selectWalletAsset.apply(this, arguments);
@@ -5849,27 +6024,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5849
6024
  }, {
5850
6025
  key: "updateWalletAssetAmount",
5851
6026
  value: (function () {
5852
- var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(params) {
6027
+ var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
5853
6028
  var state;
5854
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5855
- while (1) switch (_context54.prev = _context54.next) {
6029
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6030
+ while (1) switch (_context57.prev = _context57.next) {
5856
6031
  case 0:
5857
6032
  if (this.store.payment) {
5858
- _context54.next = 2;
6033
+ _context57.next = 2;
5859
6034
  break;
5860
6035
  }
5861
6036
  throw new Error('payment 模块未初始化');
5862
6037
  case 2:
5863
6038
  state = this.store.payment.wallet.updateWalletAssetAmount(params.assetId, params.amount);
5864
- _context54.next = 5;
6039
+ _context57.next = 5;
5865
6040
  return this.syncSelectedWalletAssets(state);
5866
6041
  case 5:
5867
- return _context54.abrupt("return", this.publishWalletAssetsState(state, 'local'));
6042
+ return _context57.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5868
6043
  case 6:
5869
6044
  case "end":
5870
- return _context54.stop();
6045
+ return _context57.stop();
5871
6046
  }
5872
- }, _callee54, this);
6047
+ }, _callee57, this);
5873
6048
  }));
5874
6049
  function updateWalletAssetAmount(_x45) {
5875
6050
  return _updateWalletAssetAmount.apply(this, arguments);
@@ -5879,13 +6054,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5879
6054
  }, {
5880
6055
  key: "scanWalletAsset",
5881
6056
  value: (function () {
5882
- var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(code) {
6057
+ var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(code) {
5883
6058
  var wallet, businessData, result;
5884
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5885
- while (1) switch (_context55.prev = _context55.next) {
6059
+ return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6060
+ while (1) switch (_context58.prev = _context58.next) {
5886
6061
  case 0:
5887
6062
  if (this.store.payment) {
5888
- _context55.next = 2;
6063
+ _context58.next = 2;
5889
6064
  break;
5890
6065
  }
5891
6066
  throw new Error('payment 模块未初始化');
@@ -5895,26 +6070,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5895
6070
  if (businessData) {
5896
6071
  wallet.generateWalletParams(businessData);
5897
6072
  }
5898
- _context55.next = 7;
6073
+ _context58.next = 7;
5899
6074
  return wallet.scanWalletAssetAsync(code);
5900
6075
  case 7:
5901
- result = _context55.sent;
6076
+ result = _context58.sent;
5902
6077
  if (!(result.type === 'normalCode')) {
5903
- _context55.next = 13;
6078
+ _context58.next = 13;
5904
6079
  break;
5905
6080
  }
5906
- _context55.next = 11;
6081
+ _context58.next = 11;
5907
6082
  return this.syncSelectedWalletAssets(result.state);
5908
6083
  case 11:
5909
- _context55.next = 13;
6084
+ _context58.next = 13;
5910
6085
  return this.publishWalletAssetsState(result.state, 'local');
5911
6086
  case 13:
5912
- return _context55.abrupt("return", result);
6087
+ return _context58.abrupt("return", result);
5913
6088
  case 14:
5914
6089
  case "end":
5915
- return _context55.stop();
6090
+ return _context58.stop();
5916
6091
  }
5917
- }, _callee55, this);
6092
+ }, _callee58, this);
5918
6093
  }));
5919
6094
  function scanWalletAsset(_x46) {
5920
6095
  return _scanWalletAsset.apply(this, arguments);
@@ -5924,27 +6099,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5924
6099
  }, {
5925
6100
  key: "clearWalletAssetSelection",
5926
6101
  value: (function () {
5927
- var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56() {
6102
+ var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59() {
5928
6103
  var state;
5929
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5930
- while (1) switch (_context56.prev = _context56.next) {
6104
+ return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6105
+ while (1) switch (_context59.prev = _context59.next) {
5931
6106
  case 0:
5932
6107
  if (this.store.payment) {
5933
- _context56.next = 2;
6108
+ _context59.next = 2;
5934
6109
  break;
5935
6110
  }
5936
6111
  throw new Error('payment 模块未初始化');
5937
6112
  case 2:
5938
6113
  state = this.store.payment.wallet.clearWalletAssetSelection();
5939
- _context56.next = 5;
6114
+ _context59.next = 5;
5940
6115
  return this.syncSelectedWalletAssets(state);
5941
6116
  case 5:
5942
- return _context56.abrupt("return", this.publishWalletAssetsState(state, 'local'));
6117
+ return _context59.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5943
6118
  case 6:
5944
6119
  case "end":
5945
- return _context56.stop();
6120
+ return _context59.stop();
5946
6121
  }
5947
- }, _callee56, this);
6122
+ }, _callee59, this);
5948
6123
  }));
5949
6124
  function clearWalletAssetSelection() {
5950
6125
  return _clearWalletAssetSelection.apply(this, arguments);
@@ -5981,35 +6156,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5981
6156
  }, {
5982
6157
  key: "getPaymentMethodsAsync",
5983
6158
  value: (function () {
5984
- var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57() {
6159
+ var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60() {
5985
6160
  var response, paymentMethods;
5986
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5987
- while (1) switch (_context57.prev = _context57.next) {
6161
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6162
+ while (1) switch (_context60.prev = _context60.next) {
5988
6163
  case 0:
5989
- _context57.prev = 0;
5990
- _context57.next = 3;
6164
+ _context60.prev = 0;
6165
+ _context60.next = 3;
5991
6166
  return this.request.get('/pay/custom-payment/all', {
5992
6167
  filterPaymentMethods: true
5993
6168
  }, {
5994
6169
  osServer: true
5995
6170
  });
5996
6171
  case 3:
5997
- response = _context57.sent;
6172
+ response = _context60.sent;
5998
6173
  paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
5999
6174
  this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
6000
- return _context57.abrupt("return", this.getPaymentMethods());
6175
+ return _context60.abrupt("return", this.getPaymentMethods());
6001
6176
  case 9:
6002
- _context57.prev = 9;
6003
- _context57.t0 = _context57["catch"](0);
6177
+ _context60.prev = 9;
6178
+ _context60.t0 = _context60["catch"](0);
6004
6179
  this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
6005
- error: _context57.t0 instanceof Error ? _context57.t0.message : String(_context57.t0)
6180
+ error: _context60.t0 instanceof Error ? _context60.t0.message : String(_context60.t0)
6006
6181
  });
6007
- return _context57.abrupt("return", this.getPaymentMethods());
6182
+ return _context60.abrupt("return", this.getPaymentMethods());
6008
6183
  case 13:
6009
6184
  case "end":
6010
- return _context57.stop();
6185
+ return _context60.stop();
6011
6186
  }
6012
- }, _callee57, this, [[0, 9]]);
6187
+ }, _callee60, this, [[0, 9]]);
6013
6188
  }));
6014
6189
  function getPaymentMethodsAsync() {
6015
6190
  return _getPaymentMethodsAsync.apply(this, arguments);
@@ -6058,8 +6233,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6058
6233
  }, {
6059
6234
  key: "getCashPaymentConfig",
6060
6235
  value: (function () {
6061
- var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58() {
6062
- var _this$store$order27, _this$store$order27$g, _this$store$order28, _this$store$order28$g, _this$otherParams40;
6236
+ var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61() {
6237
+ var _this$store$order27, _this$store$order27$g, _this$store$order28, _this$store$order28$g, _this$otherParams41;
6063
6238
  var options,
6064
6239
  paymentMethods,
6065
6240
  paymentMethod,
@@ -6068,13 +6243,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6068
6243
  amountDue,
6069
6244
  currency,
6070
6245
  recommendedAmounts,
6071
- _args58 = arguments;
6072
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6073
- while (1) switch (_context58.prev = _context58.next) {
6246
+ _args61 = arguments;
6247
+ return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6248
+ while (1) switch (_context61.prev = _context61.next) {
6074
6249
  case 0:
6075
- options = _args58.length > 0 && _args58[0] !== undefined ? _args58[0] : {};
6250
+ options = _args61.length > 0 && _args61[0] !== undefined ? _args61[0] : {};
6076
6251
  if (this.store.payment) {
6077
- _context58.next = 3;
6252
+ _context61.next = 3;
6078
6253
  break;
6079
6254
  }
6080
6255
  throw new Error('payment 模块未初始化');
@@ -6082,17 +6257,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6082
6257
  paymentMethods = this.getPaymentMethods();
6083
6258
  paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
6084
6259
  if (paymentMethod) {
6085
- _context58.next = 10;
6260
+ _context61.next = 10;
6086
6261
  break;
6087
6262
  }
6088
- _context58.next = 8;
6263
+ _context61.next = 8;
6089
6264
  return this.getPaymentMethodsAsync();
6090
6265
  case 8:
6091
- paymentMethods = _context58.sent;
6266
+ paymentMethods = _context61.sent;
6092
6267
  paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
6093
6268
  case 10:
6094
6269
  if (!(!paymentMethod && options.paymentMethodId !== undefined)) {
6095
- _context58.next = 12;
6270
+ _context61.next = 12;
6096
6271
  break;
6097
6272
  }
6098
6273
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u73B0\u91D1\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(options.paymentMethodId));
@@ -6100,9 +6275,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6100
6275
  amountSnapshot = (_this$store$order27 = this.store.order) === null || _this$store$order27 === void 0 || (_this$store$order27$g = _this$store$order27.getOrderAmountSnapshot) === null || _this$store$order27$g === void 0 ? void 0 : _this$store$order27$g.call(_this$store$order27);
6101
6276
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
6102
6277
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
6103
- currency = ((_this$store$order28 = this.store.order) === null || _this$store$order28 === void 0 || (_this$store$order28$g = _this$store$order28.getTempOrder) === null || _this$store$order28$g === void 0 || (_this$store$order28$g = _this$store$order28$g.call(_this$store$order28)) === null || _this$store$order28$g === void 0 ? void 0 : _this$store$order28$g.currency_code) || ((_this$otherParams40 = this.otherParams) === null || _this$otherParams40 === void 0 ? void 0 : _this$otherParams40.currency) || 'USD';
6278
+ currency = ((_this$store$order28 = this.store.order) === null || _this$store$order28 === void 0 || (_this$store$order28$g = _this$store$order28.getTempOrder) === null || _this$store$order28$g === void 0 || (_this$store$order28$g = _this$store$order28$g.call(_this$store$order28)) === null || _this$store$order28$g === void 0 ? void 0 : _this$store$order28$g.currency_code) || ((_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41.currency) || 'USD';
6104
6279
  recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
6105
- return _context58.abrupt("return", {
6280
+ return _context61.abrupt("return", {
6106
6281
  available: Boolean(paymentMethod && amountDue > 0),
6107
6282
  paymentMethod: paymentMethod,
6108
6283
  amountDue: amountDue,
@@ -6110,9 +6285,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6110
6285
  });
6111
6286
  case 18:
6112
6287
  case "end":
6113
- return _context58.stop();
6288
+ return _context61.stop();
6114
6289
  }
6115
- }, _callee58, this);
6290
+ }, _callee61, this);
6116
6291
  }));
6117
6292
  function getCashPaymentConfig() {
6118
6293
  return _getCashPaymentConfig.apply(this, arguments);
@@ -6129,117 +6304,120 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6129
6304
  }, {
6130
6305
  key: "confirmWalletPayment",
6131
6306
  value: (function () {
6132
- var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59() {
6307
+ var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62() {
6133
6308
  var _this$store$order$get9, _this$store$order29, _this$store$order$get11, _this$store$order$get12, _this$store$order31;
6134
6309
  var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get10, _this$store$order30, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
6135
- return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6136
- while (1) switch (_context59.prev = _context59.next) {
6310
+ return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6311
+ while (1) switch (_context62.prev = _context62.next) {
6137
6312
  case 0:
6138
6313
  if (this.store.order) {
6139
- _context59.next = 2;
6314
+ _context62.next = 2;
6140
6315
  break;
6141
6316
  }
6142
6317
  throw new Error('order 模块未初始化');
6143
6318
  case 2:
6319
+ _context62.next = 4;
6320
+ return this.validateContactInfo();
6321
+ case 4:
6144
6322
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
6145
6323
  pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
6146
6324
  amountSnapshot = (_this$store$order$get9 = (_this$store$order29 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.call(_this$store$order29);
6147
6325
  if (!pendingWalletAmount.lte(0)) {
6148
- _context59.next = 14;
6326
+ _context62.next = 16;
6149
6327
  break;
6150
6328
  }
6151
6329
  this.logWarning('confirmWalletPayment: 未发现待确认 Wallet 支付,跳过 Wallet 确认并按普通订单提交', {
6152
6330
  amountGap: amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap
6153
6331
  });
6154
- _context59.next = 9;
6332
+ _context62.next = 11;
6155
6333
  return this.submitSalesOrder({
6156
6334
  smallTicketDataFlag: 1
6157
6335
  });
6158
- case 9:
6159
- _submitResult = _context59.sent;
6336
+ case 11:
6337
+ _submitResult = _context62.sent;
6160
6338
  if (!isRejectedSalesSubmitResult(_submitResult)) {
6161
- _context59.next = 12;
6339
+ _context62.next = 14;
6162
6340
  break;
6163
6341
  }
6164
6342
  throw new Error(getSalesSubmitErrorMessage(_submitResult, '订单提交失败'));
6165
- case 12:
6343
+ case 14:
6166
6344
  _latestAmountSnapshot = (_this$store$order$get10 = (_this$store$order30 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get10 === void 0 ? void 0 : _this$store$order$get10.call(_this$store$order30);
6167
- return _context59.abrupt("return", {
6345
+ return _context62.abrupt("return", {
6168
6346
  submitResult: _submitResult,
6169
6347
  payments: this.store.order.getOrderPayments(),
6170
6348
  isOrderFullyPaid: new Decimal((_latestAmountSnapshot === null || _latestAmountSnapshot === void 0 ? void 0 : _latestAmountSnapshot.amountGap) || 0).lte(0)
6171
6349
  });
6172
- case 14:
6350
+ case 16:
6173
6351
  effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
6174
6352
  if (!effectiveAmountDue.gt(0.01)) {
6175
- _context59.next = 17;
6353
+ _context62.next = 19;
6176
6354
  break;
6177
6355
  }
6178
6356
  throw new Error('Wallet 支付尚未覆盖全部待支付金额');
6179
- case 17:
6357
+ case 19:
6180
6358
  beforePaymentStatus = (_this$store$order$get11 = this.store.order.getTempOrder()) === null || _this$store$order$get11 === void 0 ? void 0 : _this$store$order$get11.payment_status;
6181
- _context59.prev = 18;
6182
- _context59.next = 21;
6359
+ _context62.prev = 20;
6360
+ _context62.next = 23;
6183
6361
  return this.submitSalesOrder({
6184
6362
  smallTicketDataFlag: 1,
6185
6363
  confirmPendingVoucherPayments: true
6186
6364
  });
6187
- case 21:
6188
- submitResult = _context59.sent;
6365
+ case 23:
6366
+ submitResult = _context62.sent;
6189
6367
  if (!isRejectedSalesSubmitResult(submitResult)) {
6190
- _context59.next = 24;
6368
+ _context62.next = 26;
6191
6369
  break;
6192
6370
  }
6193
6371
  throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
6194
- case 24:
6195
- _context59.next = 34;
6196
- break;
6197
6372
  case 26:
6198
- _context59.prev = 26;
6199
- _context59.t0 = _context59["catch"](18);
6373
+ _context62.next = 36;
6374
+ break;
6375
+ case 28:
6376
+ _context62.prev = 28;
6377
+ _context62.t0 = _context62["catch"](20);
6200
6378
  this.store.order.setOrderPayments(beforePayments);
6201
6379
  restoredTempOrder = this.store.order.getTempOrder();
6202
6380
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
6203
6381
  restoredTempOrder.payment_status = beforePaymentStatus;
6204
6382
  this.store.order.persistTempOrder();
6205
6383
  }
6206
- _context59.next = 33;
6384
+ _context62.next = 35;
6207
6385
  return this.store.order.recalculateSummary({
6208
6386
  createIfMissing: true
6209
6387
  });
6210
- case 33:
6211
- throw _context59.t0;
6212
- case 34:
6388
+ case 35:
6389
+ throw _context62.t0;
6390
+ case 36:
6213
6391
  if (!this.store.payment) {
6214
- _context59.next = 45;
6392
+ _context62.next = 47;
6215
6393
  break;
6216
6394
  }
6217
- _context59.prev = 35;
6395
+ _context62.prev = 37;
6218
6396
  committed = this.getCommittedWalletAssets();
6219
6397
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
6220
- _context59.next = 40;
6398
+ _context62.next = 42;
6221
6399
  return this.publishWalletAssetsState(walletState, 'local');
6222
- case 40:
6223
- _context59.next = 45;
6224
- break;
6225
6400
  case 42:
6226
- _context59.prev = 42;
6227
- _context59.t1 = _context59["catch"](35);
6401
+ _context62.next = 47;
6402
+ break;
6403
+ case 44:
6404
+ _context62.prev = 44;
6405
+ _context62.t1 = _context62["catch"](37);
6228
6406
  this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
6229
- error: _context59.t1 instanceof Error ? _context59.t1.message : String(_context59.t1)
6407
+ error: _context62.t1 instanceof Error ? _context62.t1.message : String(_context62.t1)
6230
6408
  });
6231
- case 45:
6409
+ case 47:
6232
6410
  latestAmountSnapshot = (_this$store$order$get12 = (_this$store$order31 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get12 === void 0 ? void 0 : _this$store$order$get12.call(_this$store$order31);
6233
- return _context59.abrupt("return", {
6411
+ return _context62.abrupt("return", {
6234
6412
  submitResult: submitResult,
6235
6413
  payments: this.store.order.getOrderPayments(),
6236
6414
  isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
6237
6415
  });
6238
- case 47:
6416
+ case 49:
6239
6417
  case "end":
6240
- return _context59.stop();
6418
+ return _context62.stop();
6241
6419
  }
6242
- }, _callee59, this, [[18, 26], [35, 42]]);
6420
+ }, _callee62, this, [[20, 28], [37, 44]]);
6243
6421
  }));
6244
6422
  function confirmWalletPayment() {
6245
6423
  return _confirmWalletPayment.apply(this, arguments);
@@ -6254,87 +6432,90 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6254
6432
  }, {
6255
6433
  key: "payCash",
6256
6434
  value: (function () {
6257
- var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
6258
- var _this$store$order$get13, _params$actualPaidAmo, _this$otherParams41, _this$window, _this$window$postMess;
6435
+ var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
6436
+ var _this$store$order$get13, _params$actualPaidAmo, _this$otherParams42, _this$window, _this$window$postMess;
6259
6437
  var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
6260
- return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6261
- while (1) switch (_context60.prev = _context60.next) {
6438
+ return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6439
+ while (1) switch (_context63.prev = _context63.next) {
6262
6440
  case 0:
6263
6441
  if (this.store.order) {
6264
- _context60.next = 2;
6442
+ _context63.next = 2;
6265
6443
  break;
6266
6444
  }
6267
6445
  throw new Error('order 模块未初始化');
6268
6446
  case 2:
6447
+ _context63.next = 4;
6448
+ return this.validateContactInfo();
6449
+ case 4:
6269
6450
  amount = Number(params.amount || 0);
6270
6451
  if (!(!Number.isFinite(amount) || amount <= 0)) {
6271
- _context60.next = 5;
6452
+ _context63.next = 7;
6272
6453
  break;
6273
6454
  }
6274
6455
  throw new Error('现金支付金额必须大于 0');
6275
- case 5:
6456
+ case 7:
6276
6457
  if (!(params.paymentMethodId === undefined)) {
6277
- _context60.next = 11;
6458
+ _context63.next = 13;
6278
6459
  break;
6279
6460
  }
6280
- _context60.next = 8;
6461
+ _context63.next = 10;
6281
6462
  return this.getCashPaymentConfig();
6282
- case 8:
6283
- _context60.t0 = _context60.sent;
6284
- _context60.next = 14;
6463
+ case 10:
6464
+ _context63.t0 = _context63.sent;
6465
+ _context63.next = 16;
6285
6466
  break;
6286
- case 11:
6287
- _context60.next = 13;
6467
+ case 13:
6468
+ _context63.next = 15;
6288
6469
  return this.getCashPaymentConfig({
6289
6470
  paymentMethodId: params.paymentMethodId
6290
6471
  });
6291
- case 13:
6292
- _context60.t0 = _context60.sent;
6293
- case 14:
6294
- config = _context60.t0;
6472
+ case 15:
6473
+ _context63.t0 = _context63.sent;
6474
+ case 16:
6475
+ config = _context63.t0;
6295
6476
  paymentMethod = config.paymentMethod;
6296
6477
  if (paymentMethod) {
6297
- _context60.next = 18;
6478
+ _context63.next = 20;
6298
6479
  break;
6299
6480
  }
6300
6481
  throw new Error('未找到可用的 CASHMANUAL 支付方式');
6301
- case 18:
6482
+ case 20:
6302
6483
  if (!(config.amountDue <= 0)) {
6303
- _context60.next = 20;
6484
+ _context63.next = 22;
6304
6485
  break;
6305
6486
  }
6306
6487
  throw new Error('当前订单没有待支付金额');
6307
- case 20:
6488
+ case 22:
6308
6489
  roundingAmount = Number(params.roundingAmount || 0);
6309
6490
  effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
6310
6491
  if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
6311
- _context60.next = 24;
6492
+ _context63.next = 26;
6312
6493
  break;
6313
6494
  }
6314
6495
  throw new Error('现金支付金额超过当前待支付金额');
6315
- case 24:
6496
+ case 26:
6316
6497
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
6317
6498
  beforePaymentStatus = (_this$store$order$get13 = this.store.order.getTempOrder()) === null || _this$store$order$get13 === void 0 ? void 0 : _this$store$order$get13.payment_status;
6318
6499
  uniquePaymentNumber = createUuidV4();
6319
6500
  paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
6320
6501
  actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
6321
6502
  changeAmount = Number(params.changeAmount || 0);
6322
- shopWalletPassId = (_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41.shop_wallet_pass_id;
6503
+ shopWalletPassId = (_this$otherParams42 = this.otherParams) === null || _this$otherParams42 === void 0 ? void 0 : _this$otherParams42.shop_wallet_pass_id;
6323
6504
  if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
6324
- _context60.next = 33;
6505
+ _context63.next = 35;
6325
6506
  break;
6326
6507
  }
6327
6508
  throw new Error('顾客实收现金不能小于支付金额');
6328
- case 33:
6509
+ case 35:
6329
6510
  if (!this.isPickupTimingEnabled()) {
6330
- _context60.next = 36;
6511
+ _context63.next = 38;
6331
6512
  break;
6332
6513
  }
6333
- _context60.next = 36;
6514
+ _context63.next = 38;
6334
6515
  return this.preparePickupTimingForCheckout({
6335
6516
  freeze: true
6336
6517
  });
6337
- case 36:
6518
+ case 38:
6338
6519
  (_this$window = this.window) === null || _this$window === void 0 || (_this$window = _this$window.interaction) === null || _this$window === void 0 || (_this$window = _this$window.utils) === null || _this$window === void 0 || (_this$window$postMess = _this$window.postMessageToApp) === null || _this$window$postMess === void 0 || _this$window$postMess.call(_this$window, {
6339
6520
  module: 'till',
6340
6521
  key: 'open_till',
@@ -6365,57 +6546,57 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6365
6546
  var _item$metadata2;
6366
6547
  return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
6367
6548
  });
6368
- _context60.prev = 39;
6369
- _context60.next = 42;
6549
+ _context63.prev = 41;
6550
+ _context63.next = 44;
6370
6551
  return this.syncPaymentsToOrder({
6371
6552
  payments: payments,
6372
6553
  submitWhenPaid: true,
6373
6554
  smallTicketDataFlag: 1,
6374
6555
  confirmPendingVoucherPayments: true
6375
6556
  });
6376
- case 42:
6377
- syncResult = _context60.sent;
6557
+ case 44:
6558
+ syncResult = _context63.sent;
6378
6559
  if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
6379
- _context60.next = 45;
6560
+ _context63.next = 47;
6380
6561
  break;
6381
6562
  }
6382
6563
  throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
6383
- case 45:
6564
+ case 47:
6384
6565
  if (!this.store.payment) {
6385
- _context60.next = 50;
6566
+ _context63.next = 52;
6386
6567
  break;
6387
6568
  }
6388
6569
  committed = this.getCommittedWalletAssets();
6389
6570
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
6390
- _context60.next = 50;
6571
+ _context63.next = 52;
6391
6572
  return this.publishWalletAssetsState(walletState, 'local');
6392
- case 50:
6393
- return _context60.abrupt("return", {
6573
+ case 52:
6574
+ return _context63.abrupt("return", {
6394
6575
  payment: payment || {},
6395
6576
  payments: this.store.order.getOrderPayments(),
6396
6577
  syncResult: syncResult,
6397
6578
  isOrderFullyPaid: syncResult.isOrderFullyPaid
6398
6579
  });
6399
- case 53:
6400
- _context60.prev = 53;
6401
- _context60.t1 = _context60["catch"](39);
6580
+ case 55:
6581
+ _context63.prev = 55;
6582
+ _context63.t1 = _context63["catch"](41);
6402
6583
  this.store.order.setOrderPayments(beforePayments);
6403
6584
  restoredTempOrder = this.store.order.getTempOrder();
6404
6585
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
6405
6586
  restoredTempOrder.payment_status = beforePaymentStatus;
6406
6587
  this.store.order.persistTempOrder();
6407
6588
  }
6408
- _context60.next = 60;
6589
+ _context63.next = 62;
6409
6590
  return this.store.order.recalculateSummary({
6410
6591
  createIfMissing: true
6411
6592
  });
6412
- case 60:
6413
- throw _context60.t1;
6414
- case 61:
6593
+ case 62:
6594
+ throw _context63.t1;
6595
+ case 63:
6415
6596
  case "end":
6416
- return _context60.stop();
6597
+ return _context63.stop();
6417
6598
  }
6418
- }, _callee60, this, [[39, 53]]);
6599
+ }, _callee63, this, [[41, 55]]);
6419
6600
  }));
6420
6601
  function payCash(_x47) {
6421
6602
  return _payCash.apply(this, arguments);
@@ -6433,21 +6614,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6433
6614
  }, {
6434
6615
  key: "commitPaymentMethodPayment",
6435
6616
  value: (function () {
6436
- var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(params) {
6617
+ var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(params) {
6437
6618
  var _this$store$order$get14, _this$store$order32, _this$store$order$get15, _params$metadata, _params$originAmount;
6438
6619
  var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
6439
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6440
- while (1) switch (_context61.prev = _context61.next) {
6620
+ return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6621
+ while (1) switch (_context64.prev = _context64.next) {
6441
6622
  case 0:
6442
6623
  if (this.store.order) {
6443
- _context61.next = 2;
6624
+ _context64.next = 2;
6444
6625
  break;
6445
6626
  }
6446
6627
  throw new Error('order 模块未初始化');
6447
6628
  case 2:
6448
6629
  amount = Number(params.amount || 0);
6449
6630
  if (!(!Number.isFinite(amount) || amount <= 0)) {
6450
- _context61.next = 5;
6631
+ _context64.next = 5;
6451
6632
  break;
6452
6633
  }
6453
6634
  throw new Error('支付金额必须大于 0');
@@ -6463,17 +6644,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6463
6644
  };
6464
6645
  paymentMethod = findPaymentMethod();
6465
6646
  if (paymentMethod) {
6466
- _context61.next = 13;
6647
+ _context64.next = 13;
6467
6648
  break;
6468
6649
  }
6469
- _context61.next = 11;
6650
+ _context64.next = 11;
6470
6651
  return this.getPaymentMethodsAsync();
6471
6652
  case 11:
6472
- paymentMethods = _context61.sent;
6653
+ paymentMethods = _context64.sent;
6473
6654
  paymentMethod = findPaymentMethod();
6474
6655
  case 13:
6475
6656
  if (paymentMethod) {
6476
- _context61.next = 15;
6657
+ _context64.next = 15;
6477
6658
  break;
6478
6659
  }
6479
6660
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
@@ -6482,13 +6663,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6482
6663
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
6483
6664
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
6484
6665
  if (!amountDue.lte(0)) {
6485
- _context61.next = 20;
6666
+ _context64.next = 20;
6486
6667
  break;
6487
6668
  }
6488
6669
  throw new Error('当前订单没有待支付金额');
6489
6670
  case 20:
6490
6671
  if (!new Decimal(amount).gt(amountDue.plus(0.01))) {
6491
- _context61.next = 22;
6672
+ _context64.next = 22;
6492
6673
  break;
6493
6674
  }
6494
6675
  throw new Error('支付金额超过当前待支付金额');
@@ -6527,8 +6708,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6527
6708
  var _item$metadata3;
6528
6709
  return (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.unique_payment_number) === metadata.unique_payment_number;
6529
6710
  });
6530
- _context61.prev = 30;
6531
- _context61.next = 33;
6711
+ _context64.prev = 30;
6712
+ _context64.next = 33;
6532
6713
  return this.syncPaymentsToOrder({
6533
6714
  payments: payments,
6534
6715
  submitWhenPaid: true,
@@ -6536,48 +6717,48 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6536
6717
  confirmPendingVoucherPayments: true
6537
6718
  });
6538
6719
  case 33:
6539
- syncResult = _context61.sent;
6720
+ syncResult = _context64.sent;
6540
6721
  if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
6541
- _context61.next = 36;
6722
+ _context64.next = 36;
6542
6723
  break;
6543
6724
  }
6544
6725
  throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
6545
6726
  case 36:
6546
6727
  if (!this.store.payment) {
6547
- _context61.next = 41;
6728
+ _context64.next = 41;
6548
6729
  break;
6549
6730
  }
6550
6731
  committed = this.getCommittedWalletAssets();
6551
6732
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
6552
- _context61.next = 41;
6733
+ _context64.next = 41;
6553
6734
  return this.publishWalletAssetsState(walletState, 'local');
6554
6735
  case 41:
6555
- return _context61.abrupt("return", {
6736
+ return _context64.abrupt("return", {
6556
6737
  payment: payment || {},
6557
6738
  payments: this.store.order.getOrderPayments(),
6558
6739
  syncResult: syncResult,
6559
6740
  isOrderFullyPaid: syncResult.isOrderFullyPaid
6560
6741
  });
6561
6742
  case 44:
6562
- _context61.prev = 44;
6563
- _context61.t0 = _context61["catch"](30);
6743
+ _context64.prev = 44;
6744
+ _context64.t0 = _context64["catch"](30);
6564
6745
  this.store.order.setOrderPayments(beforePayments);
6565
6746
  restoredTempOrder = this.store.order.getTempOrder();
6566
6747
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
6567
6748
  restoredTempOrder.payment_status = beforePaymentStatus;
6568
6749
  this.store.order.persistTempOrder();
6569
6750
  }
6570
- _context61.next = 51;
6751
+ _context64.next = 51;
6571
6752
  return this.store.order.recalculateSummary({
6572
6753
  createIfMissing: true
6573
6754
  });
6574
6755
  case 51:
6575
- throw _context61.t0;
6756
+ throw _context64.t0;
6576
6757
  case 52:
6577
6758
  case "end":
6578
- return _context61.stop();
6759
+ return _context64.stop();
6579
6760
  }
6580
- }, _callee61, this, [[30, 44]]);
6761
+ }, _callee64, this, [[30, 44]]);
6581
6762
  }));
6582
6763
  function commitPaymentMethodPayment(_x48) {
6583
6764
  return _commitPaymentMethodPayment.apply(this, arguments);
@@ -6594,38 +6775,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6594
6775
  }, {
6595
6776
  key: "roundAmount",
6596
6777
  value: (function () {
6597
- var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(params) {
6778
+ var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(params) {
6598
6779
  var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
6599
6780
  var amount, cashManualPayment;
6600
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6601
- while (1) switch (_context62.prev = _context62.next) {
6781
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6782
+ while (1) switch (_context65.prev = _context65.next) {
6602
6783
  case 0:
6603
6784
  amount = params.amount;
6604
6785
  cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
6605
6786
  return paymentMethod.code === 'CASHMANUAL';
6606
6787
  });
6607
6788
  if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
6608
- _context62.next = 4;
6789
+ _context65.next = 4;
6609
6790
  break;
6610
6791
  }
6611
- return _context62.abrupt("return", {
6792
+ return _context65.abrupt("return", {
6612
6793
  originalAmount: amount.toString(),
6613
6794
  roundedAmount: amount.toString(),
6614
6795
  roundingDifference: '0.00'
6615
6796
  });
6616
6797
  case 4:
6617
6798
  if (this.payment) {
6618
- _context62.next = 6;
6799
+ _context65.next = 6;
6619
6800
  break;
6620
6801
  }
6621
6802
  throw new Error('payment 模块未初始化');
6622
6803
  case 6:
6623
- return _context62.abrupt("return", this.payment.roundAmountAsync(amount, (_this$otherParams$ord2 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord2 === void 0 ? void 0 : _this$otherParams$ord2.interval, (_this$otherParams$ord3 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord3 === void 0 ? void 0 : _this$otherParams$ord3.type));
6804
+ return _context65.abrupt("return", this.payment.roundAmountAsync(amount, (_this$otherParams$ord2 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord2 === void 0 ? void 0 : _this$otherParams$ord2.interval, (_this$otherParams$ord3 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord3 === void 0 ? void 0 : _this$otherParams$ord3.type));
6624
6805
  case 7:
6625
6806
  case "end":
6626
- return _context62.stop();
6807
+ return _context65.stop();
6627
6808
  }
6628
- }, _callee62, this);
6809
+ }, _callee65, this);
6629
6810
  }));
6630
6811
  function roundAmount(_x49) {
6631
6812
  return _roundAmount.apply(this, arguments);
@@ -6642,47 +6823,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6642
6823
  }, {
6643
6824
  key: "sendCustomerPayLink",
6644
6825
  value: (function () {
6645
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
6826
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(params) {
6646
6827
  var orderIds, _ref53, _ref54, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
6647
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6648
- while (1) switch (_context63.prev = _context63.next) {
6828
+ return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6829
+ while (1) switch (_context66.prev = _context66.next) {
6649
6830
  case 0:
6650
6831
  if (this.store.order) {
6651
- _context63.next = 2;
6832
+ _context66.next = 2;
6652
6833
  break;
6653
6834
  }
6654
6835
  throw new Error('order 模块未初始化');
6655
6836
  case 2:
6656
6837
  orderIds = params.order_ids || params.orderIds || [];
6657
6838
  if (!(!orderIds.length || params.submitBeforeSend)) {
6658
- _context63.next = 11;
6839
+ _context66.next = 11;
6659
6840
  break;
6660
6841
  }
6661
- _context63.next = 6;
6842
+ _context66.next = 6;
6662
6843
  return this.submitSalesOrder({
6663
6844
  smallTicketDataFlag: 1
6664
6845
  });
6665
6846
  case 6:
6666
- submitResult = _context63.sent;
6847
+ submitResult = _context66.sent;
6667
6848
  orderId = (_ref53 = (_ref54 = (_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 && _ref54 !== void 0 ? _ref54 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref53 !== void 0 ? _ref53 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
6668
6849
  if (orderId) {
6669
- _context63.next = 10;
6850
+ _context66.next = 10;
6670
6851
  break;
6671
6852
  }
6672
6853
  throw new Error('本地订单提交云端失败,无法发送支付链接');
6673
6854
  case 10:
6674
6855
  orderIds = [orderId];
6675
6856
  case 11:
6676
- return _context63.abrupt("return", this.store.order.sendCustomerPayLink({
6857
+ return _context66.abrupt("return", this.store.order.sendCustomerPayLink({
6677
6858
  emails: params.emails,
6678
6859
  notify_action: params.notify_action,
6679
6860
  order_ids: orderIds
6680
6861
  }));
6681
6862
  case 12:
6682
6863
  case "end":
6683
- return _context63.stop();
6864
+ return _context66.stop();
6684
6865
  }
6685
- }, _callee63, this);
6866
+ }, _callee66, this);
6686
6867
  }));
6687
6868
  function sendCustomerPayLink(_x50) {
6688
6869
  return _sendCustomerPayLink.apply(this, arguments);
@@ -6697,20 +6878,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6697
6878
  }, {
6698
6879
  key: "calculateProductBookingPrice",
6699
6880
  value: function () {
6700
- var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(params) {
6881
+ var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(params) {
6701
6882
  var _params$customer_id;
6702
6883
  var useCustomerUserPricing, quotation, customerId, channel, _yield$this$resolvePr, _yield$this$resolvePr2, authoritativeProduct, product;
6703
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6704
- while (1) switch (_context64.prev = _context64.next) {
6884
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6885
+ while (1) switch (_context67.prev = _context67.next) {
6705
6886
  case 0:
6706
6887
  useCustomerUserPricing = this.isCustomerUserPriceQuery();
6707
6888
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
6708
6889
  customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
6709
- _context64.next = 5;
6890
+ _context67.next = 5;
6710
6891
  return this.prepareProductPriceQueryContext(customerId);
6711
6892
  case 5:
6712
6893
  channel = this.getPriceQueryChannel(params.channel);
6713
- _context64.next = 8;
6894
+ _context67.next = 8;
6714
6895
  return this.resolveProductsForPriceQuery({
6715
6896
  priceQueries: [params],
6716
6897
  schedule: this.getPriceQuerySchedule(params),
@@ -6718,22 +6899,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6718
6899
  channel: channel
6719
6900
  });
6720
6901
  case 8:
6721
- _yield$this$resolvePr = _context64.sent;
6902
+ _yield$this$resolvePr = _context67.sent;
6722
6903
  _yield$this$resolvePr2 = _slicedToArray(_yield$this$resolvePr, 1);
6723
6904
  authoritativeProduct = _yield$this$resolvePr2[0];
6724
6905
  product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
6725
6906
  if (useCustomerUserPricing) {
6726
- _context64.next = 15;
6907
+ _context67.next = 15;
6727
6908
  break;
6728
6909
  }
6729
- _context64.next = 15;
6910
+ _context67.next = 15;
6730
6911
  return this.loadQuotationForPriceQuery({
6731
6912
  quotation: quotation,
6732
6913
  customer_id: customerId,
6733
6914
  channel: channel
6734
6915
  });
6735
6916
  case 15:
6736
- return _context64.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
6917
+ return _context67.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
6737
6918
  channel: channel,
6738
6919
  product: product,
6739
6920
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
@@ -6742,9 +6923,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6742
6923
  })));
6743
6924
  case 16:
6744
6925
  case "end":
6745
- return _context64.stop();
6926
+ return _context67.stop();
6746
6927
  }
6747
- }, _callee64, this);
6928
+ }, _callee67, this);
6748
6929
  }));
6749
6930
  function calculateProductBookingPrice(_x51) {
6750
6931
  return _calculateProductBookingPrice.apply(this, arguments);
@@ -6830,17 +7011,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6830
7011
  }, {
6831
7012
  key: "calculateProductBookingPrices",
6832
7013
  value: function () {
6833
- var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(paramsList) {
7014
+ var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(paramsList) {
6834
7015
  var _this22 = this;
6835
7016
  var useCustomerUserPricing, quotation, currentOrderCustomerId, resolvedChannels, authoritativeProducts, groups, quotationContexts;
6836
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6837
- while (1) switch (_context66.prev = _context66.next) {
7017
+ return _regeneratorRuntime().wrap(function _callee69$(_context69) {
7018
+ while (1) switch (_context69.prev = _context69.next) {
6838
7019
  case 0:
6839
7020
  if (paramsList.length) {
6840
- _context66.next = 2;
7021
+ _context69.next = 2;
6841
7022
  break;
6842
7023
  }
6843
- return _context66.abrupt("return", []);
7024
+ return _context69.abrupt("return", []);
6844
7025
  case 2:
6845
7026
  useCustomerUserPricing = this.isCustomerUserPriceQuery();
6846
7027
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
@@ -6867,20 +7048,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6867
7048
  group.indices.push(index);
6868
7049
  groups.set(groupKey, group);
6869
7050
  });
6870
- _context66.next = 11;
7051
+ _context69.next = 11;
6871
7052
  return Promise.all(Array.from(groups.values()).map( /*#__PURE__*/function () {
6872
- var _ref55 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(group) {
7053
+ var _ref55 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(group) {
6873
7054
  var priceQueries, resolvedProducts;
6874
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6875
- while (1) switch (_context65.prev = _context65.next) {
7055
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
7056
+ while (1) switch (_context68.prev = _context68.next) {
6876
7057
  case 0:
6877
- _context65.next = 2;
7058
+ _context68.next = 2;
6878
7059
  return _this22.prepareProductPriceQueryContext(group.customerId);
6879
7060
  case 2:
6880
7061
  priceQueries = group.indices.map(function (index) {
6881
7062
  return paramsList[index];
6882
7063
  });
6883
- _context65.next = 5;
7064
+ _context68.next = 5;
6884
7065
  return _this22.resolveProductsForPriceQuery({
6885
7066
  priceQueries: priceQueries,
6886
7067
  schedule: group.schedule,
@@ -6888,15 +7069,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6888
7069
  channel: group.channel
6889
7070
  });
6890
7071
  case 5:
6891
- resolvedProducts = _context65.sent;
7072
+ resolvedProducts = _context68.sent;
6892
7073
  group.indices.forEach(function (originalIndex, groupIndex) {
6893
7074
  authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
6894
7075
  });
6895
7076
  case 7:
6896
7077
  case "end":
6897
- return _context65.stop();
7078
+ return _context68.stop();
6898
7079
  }
6899
- }, _callee65);
7080
+ }, _callee68);
6900
7081
  }));
6901
7082
  return function (_x53) {
6902
7083
  return _ref55.apply(this, arguments);
@@ -6904,7 +7085,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6904
7085
  }()));
6905
7086
  case 11:
6906
7087
  if (useCustomerUserPricing) {
6907
- _context66.next = 16;
7088
+ _context69.next = 16;
6908
7089
  break;
6909
7090
  }
6910
7091
  quotationContexts = new Map();
@@ -6918,14 +7099,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6918
7099
  customer_id: (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId
6919
7100
  });
6920
7101
  });
6921
- _context66.next = 16;
7102
+ _context69.next = 16;
6922
7103
  return Promise.all(Array.from(quotationContexts.values()).map(function (context) {
6923
7104
  return _this22.loadQuotationForPriceQuery(_objectSpread({
6924
7105
  quotation: quotation
6925
7106
  }, context));
6926
7107
  }));
6927
7108
  case 16:
6928
- return _context66.abrupt("return", paramsList.map(function (params, index) {
7109
+ return _context69.abrupt("return", paramsList.map(function (params, index) {
6929
7110
  var _params$customer_id4;
6930
7111
  var productInput = params.product || {};
6931
7112
  var authoritativeProduct = authoritativeProducts[index];
@@ -6942,9 +7123,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6942
7123
  }));
6943
7124
  case 17:
6944
7125
  case "end":
6945
- return _context66.stop();
7126
+ return _context69.stop();
6946
7127
  }
6947
- }, _callee66, this);
7128
+ }, _callee69, this);
6948
7129
  }));
6949
7130
  function calculateProductBookingPrices(_x52) {
6950
7131
  return _calculateProductBookingPrices.apply(this, arguments);
@@ -6954,45 +7135,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6954
7135
  }, {
6955
7136
  key: "addProductToOrder",
6956
7137
  value: function () {
6957
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(product, booking, options) {
7138
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(product, booking, options) {
6958
7139
  var products;
6959
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6960
- while (1) switch (_context67.prev = _context67.next) {
7140
+ return _regeneratorRuntime().wrap(function _callee70$(_context70) {
7141
+ while (1) switch (_context70.prev = _context70.next) {
6961
7142
  case 0:
6962
- _context67.prev = 0;
7143
+ _context70.prev = 0;
6963
7144
  if (this.store.order) {
6964
- _context67.next = 3;
7145
+ _context70.next = 3;
6965
7146
  break;
6966
7147
  }
6967
7148
  throw new Error('order 模块未初始化');
6968
7149
  case 3:
6969
7150
  if (!(options === undefined)) {
6970
- _context67.next = 9;
7151
+ _context70.next = 9;
6971
7152
  break;
6972
7153
  }
6973
- _context67.next = 6;
7154
+ _context70.next = 6;
6974
7155
  return this.store.order.addProductToOrder(product, booking);
6975
7156
  case 6:
6976
- _context67.t0 = _context67.sent;
6977
- _context67.next = 12;
7157
+ _context70.t0 = _context70.sent;
7158
+ _context70.next = 12;
6978
7159
  break;
6979
7160
  case 9:
6980
- _context67.next = 11;
7161
+ _context70.next = 11;
6981
7162
  return this.store.order.addProductToOrder(product, booking, options);
6982
7163
  case 11:
6983
- _context67.t0 = _context67.sent;
7164
+ _context70.t0 = _context70.sent;
6984
7165
  case 12:
6985
- products = _context67.t0;
6986
- return _context67.abrupt("return", products);
7166
+ products = _context70.t0;
7167
+ return _context70.abrupt("return", products);
6987
7168
  case 16:
6988
- _context67.prev = 16;
6989
- _context67.t1 = _context67["catch"](0);
6990
- throw _context67.t1;
7169
+ _context70.prev = 16;
7170
+ _context70.t1 = _context70["catch"](0);
7171
+ throw _context70.t1;
6991
7172
  case 19:
6992
7173
  case "end":
6993
- return _context67.stop();
7174
+ return _context70.stop();
6994
7175
  }
6995
- }, _callee67, this, [[0, 16]]);
7176
+ }, _callee70, this, [[0, 16]]);
6996
7177
  }));
6997
7178
  function addProductToOrder(_x54, _x55, _x56) {
6998
7179
  return _addProductToOrder.apply(this, arguments);
@@ -7002,32 +7183,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7002
7183
  }, {
7003
7184
  key: "updateOrderProduct",
7004
7185
  value: function () {
7005
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(params) {
7186
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(params) {
7006
7187
  var products;
7007
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
7008
- while (1) switch (_context68.prev = _context68.next) {
7188
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
7189
+ while (1) switch (_context71.prev = _context71.next) {
7009
7190
  case 0:
7010
- _context68.prev = 0;
7191
+ _context71.prev = 0;
7011
7192
  if (this.store.order) {
7012
- _context68.next = 3;
7193
+ _context71.next = 3;
7013
7194
  break;
7014
7195
  }
7015
7196
  throw new Error('order 模块未初始化');
7016
7197
  case 3:
7017
- _context68.next = 5;
7198
+ _context71.next = 5;
7018
7199
  return this.store.order.updateOrderProduct(params);
7019
7200
  case 5:
7020
- products = _context68.sent;
7021
- return _context68.abrupt("return", products);
7201
+ products = _context71.sent;
7202
+ return _context71.abrupt("return", products);
7022
7203
  case 9:
7023
- _context68.prev = 9;
7024
- _context68.t0 = _context68["catch"](0);
7025
- throw _context68.t0;
7204
+ _context71.prev = 9;
7205
+ _context71.t0 = _context71["catch"](0);
7206
+ throw _context71.t0;
7026
7207
  case 12:
7027
7208
  case "end":
7028
- return _context68.stop();
7209
+ return _context71.stop();
7029
7210
  }
7030
- }, _callee68, this, [[0, 9]]);
7211
+ }, _callee71, this, [[0, 9]]);
7031
7212
  }));
7032
7213
  function updateOrderProduct(_x57) {
7033
7214
  return _updateOrderProduct.apply(this, arguments);
@@ -7037,32 +7218,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7037
7218
  }, {
7038
7219
  key: "updateOrderProducts",
7039
7220
  value: function () {
7040
- var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(paramsList) {
7221
+ var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(paramsList) {
7041
7222
  var products;
7042
- return _regeneratorRuntime().wrap(function _callee69$(_context69) {
7043
- while (1) switch (_context69.prev = _context69.next) {
7223
+ return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7224
+ while (1) switch (_context72.prev = _context72.next) {
7044
7225
  case 0:
7045
- _context69.prev = 0;
7226
+ _context72.prev = 0;
7046
7227
  if (this.store.order) {
7047
- _context69.next = 3;
7228
+ _context72.next = 3;
7048
7229
  break;
7049
7230
  }
7050
7231
  throw new Error('order 模块未初始化');
7051
7232
  case 3:
7052
- _context69.next = 5;
7233
+ _context72.next = 5;
7053
7234
  return this.store.order.updateOrderProducts(paramsList);
7054
7235
  case 5:
7055
- products = _context69.sent;
7056
- return _context69.abrupt("return", products);
7236
+ products = _context72.sent;
7237
+ return _context72.abrupt("return", products);
7057
7238
  case 9:
7058
- _context69.prev = 9;
7059
- _context69.t0 = _context69["catch"](0);
7060
- throw _context69.t0;
7239
+ _context72.prev = 9;
7240
+ _context72.t0 = _context72["catch"](0);
7241
+ throw _context72.t0;
7061
7242
  case 12:
7062
7243
  case "end":
7063
- return _context69.stop();
7244
+ return _context72.stop();
7064
7245
  }
7065
- }, _callee69, this, [[0, 9]]);
7246
+ }, _callee72, this, [[0, 9]]);
7066
7247
  }));
7067
7248
  function updateOrderProducts(_x58) {
7068
7249
  return _updateOrderProducts.apply(this, arguments);
@@ -7072,32 +7253,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7072
7253
  }, {
7073
7254
  key: "updateOrderProductQuantity",
7074
7255
  value: function () {
7075
- var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(params) {
7256
+ var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(params) {
7076
7257
  var products;
7077
- return _regeneratorRuntime().wrap(function _callee70$(_context70) {
7078
- while (1) switch (_context70.prev = _context70.next) {
7258
+ return _regeneratorRuntime().wrap(function _callee73$(_context73) {
7259
+ while (1) switch (_context73.prev = _context73.next) {
7079
7260
  case 0:
7080
- _context70.prev = 0;
7261
+ _context73.prev = 0;
7081
7262
  if (this.store.order) {
7082
- _context70.next = 3;
7263
+ _context73.next = 3;
7083
7264
  break;
7084
7265
  }
7085
7266
  throw new Error('order 模块未初始化');
7086
7267
  case 3:
7087
- _context70.next = 5;
7268
+ _context73.next = 5;
7088
7269
  return this.store.order.updateOrderProductQuantity(params);
7089
7270
  case 5:
7090
- products = _context70.sent;
7091
- return _context70.abrupt("return", products);
7271
+ products = _context73.sent;
7272
+ return _context73.abrupt("return", products);
7092
7273
  case 9:
7093
- _context70.prev = 9;
7094
- _context70.t0 = _context70["catch"](0);
7095
- throw _context70.t0;
7274
+ _context73.prev = 9;
7275
+ _context73.t0 = _context73["catch"](0);
7276
+ throw _context73.t0;
7096
7277
  case 12:
7097
7278
  case "end":
7098
- return _context70.stop();
7279
+ return _context73.stop();
7099
7280
  }
7100
- }, _callee70, this, [[0, 9]]);
7281
+ }, _callee73, this, [[0, 9]]);
7101
7282
  }));
7102
7283
  function updateOrderProductQuantity(_x59) {
7103
7284
  return _updateOrderProductQuantity.apply(this, arguments);
@@ -7122,12 +7303,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7122
7303
  }, {
7123
7304
  key: "setOrderProductLineNote",
7124
7305
  value: (function () {
7125
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(identity, note) {
7306
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(identity, note) {
7126
7307
  var params, products;
7127
- return _regeneratorRuntime().wrap(function _callee71$(_context71) {
7128
- while (1) switch (_context71.prev = _context71.next) {
7308
+ return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7309
+ while (1) switch (_context74.prev = _context74.next) {
7129
7310
  case 0:
7130
- _context71.prev = 0;
7311
+ _context74.prev = 0;
7131
7312
  params = {
7132
7313
  product_id: identity.product_id,
7133
7314
  product_variant_id: identity.product_variant_id,
@@ -7142,20 +7323,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7142
7323
  params.product_sku = identity.product_sku;
7143
7324
  }
7144
7325
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
7145
- _context71.next = 7;
7326
+ _context74.next = 7;
7146
7327
  return this.updateOrderProduct(params);
7147
7328
  case 7:
7148
- products = _context71.sent;
7149
- return _context71.abrupt("return", products);
7329
+ products = _context74.sent;
7330
+ return _context74.abrupt("return", products);
7150
7331
  case 11:
7151
- _context71.prev = 11;
7152
- _context71.t0 = _context71["catch"](0);
7153
- throw _context71.t0;
7332
+ _context74.prev = 11;
7333
+ _context74.t0 = _context74["catch"](0);
7334
+ throw _context74.t0;
7154
7335
  case 14:
7155
7336
  case "end":
7156
- return _context71.stop();
7337
+ return _context74.stop();
7157
7338
  }
7158
- }, _callee71, this, [[0, 11]]);
7339
+ }, _callee74, this, [[0, 11]]);
7159
7340
  }));
7160
7341
  function setOrderProductLineNote(_x60, _x61) {
7161
7342
  return _setOrderProductLineNote.apply(this, arguments);
@@ -7172,43 +7353,43 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7172
7353
  }, {
7173
7354
  key: "removeProductsFromOrder",
7174
7355
  value: (function () {
7175
- var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(identities, options) {
7176
- return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7177
- while (1) switch (_context72.prev = _context72.next) {
7356
+ var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(identities, options) {
7357
+ return _regeneratorRuntime().wrap(function _callee75$(_context75) {
7358
+ while (1) switch (_context75.prev = _context75.next) {
7178
7359
  case 0:
7179
- _context72.prev = 0;
7360
+ _context75.prev = 0;
7180
7361
  if (this.store.order) {
7181
- _context72.next = 3;
7362
+ _context75.next = 3;
7182
7363
  break;
7183
7364
  }
7184
7365
  throw new Error('order 模块未初始化');
7185
7366
  case 3:
7186
7367
  if (!(options === undefined)) {
7187
- _context72.next = 9;
7368
+ _context75.next = 9;
7188
7369
  break;
7189
7370
  }
7190
- _context72.next = 6;
7371
+ _context75.next = 6;
7191
7372
  return this.store.order.removeProductsFromOrder(identities);
7192
7373
  case 6:
7193
- _context72.t0 = _context72.sent;
7194
- _context72.next = 12;
7374
+ _context75.t0 = _context75.sent;
7375
+ _context75.next = 12;
7195
7376
  break;
7196
7377
  case 9:
7197
- _context72.next = 11;
7378
+ _context75.next = 11;
7198
7379
  return this.store.order.removeProductsFromOrder(identities, options);
7199
7380
  case 11:
7200
- _context72.t0 = _context72.sent;
7381
+ _context75.t0 = _context75.sent;
7201
7382
  case 12:
7202
- return _context72.abrupt("return", _context72.t0);
7383
+ return _context75.abrupt("return", _context75.t0);
7203
7384
  case 15:
7204
- _context72.prev = 15;
7205
- _context72.t1 = _context72["catch"](0);
7206
- throw _context72.t1;
7385
+ _context75.prev = 15;
7386
+ _context75.t1 = _context75["catch"](0);
7387
+ throw _context75.t1;
7207
7388
  case 18:
7208
7389
  case "end":
7209
- return _context72.stop();
7390
+ return _context75.stop();
7210
7391
  }
7211
- }, _callee72, this, [[0, 15]]);
7392
+ }, _callee75, this, [[0, 15]]);
7212
7393
  }));
7213
7394
  function removeProductsFromOrder(_x62, _x63) {
7214
7395
  return _removeProductsFromOrder.apply(this, arguments);
@@ -7218,16 +7399,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7218
7399
  }, {
7219
7400
  key: "removeProductFromOrder",
7220
7401
  value: function () {
7221
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(identity, options) {
7222
- return _regeneratorRuntime().wrap(function _callee73$(_context73) {
7223
- while (1) switch (_context73.prev = _context73.next) {
7402
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(identity, options) {
7403
+ return _regeneratorRuntime().wrap(function _callee76$(_context76) {
7404
+ while (1) switch (_context76.prev = _context76.next) {
7224
7405
  case 0:
7225
- return _context73.abrupt("return", this.removeProductsFromOrder([identity], options));
7406
+ return _context76.abrupt("return", this.removeProductsFromOrder([identity], options));
7226
7407
  case 1:
7227
7408
  case "end":
7228
- return _context73.stop();
7409
+ return _context76.stop();
7229
7410
  }
7230
- }, _callee73, this);
7411
+ }, _callee76, this);
7231
7412
  }));
7232
7413
  function removeProductFromOrder(_x64, _x65) {
7233
7414
  return _removeProductFromOrder.apply(this, arguments);
@@ -7279,23 +7460,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7279
7460
  }, {
7280
7461
  key: "applyPromotion",
7281
7462
  value: (function () {
7282
- var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74() {
7283
- return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7284
- while (1) switch (_context74.prev = _context74.next) {
7463
+ var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77() {
7464
+ return _regeneratorRuntime().wrap(function _callee77$(_context77) {
7465
+ while (1) switch (_context77.prev = _context77.next) {
7285
7466
  case 0:
7286
7467
  if (this.store.order) {
7287
- _context74.next = 2;
7468
+ _context77.next = 2;
7288
7469
  break;
7289
7470
  }
7290
7471
  throw new Error('order 模块未初始化');
7291
7472
  case 2:
7292
- _context74.next = 4;
7473
+ _context77.next = 4;
7293
7474
  return this.store.order.applyPromotion();
7294
7475
  case 4:
7295
7476
  case "end":
7296
- return _context74.stop();
7477
+ return _context77.stop();
7297
7478
  }
7298
- }, _callee74, this);
7479
+ }, _callee77, this);
7299
7480
  }));
7300
7481
  function applyPromotion() {
7301
7482
  return _applyPromotion.apply(this, arguments);
@@ -7322,18 +7503,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7322
7503
  }, {
7323
7504
  key: "getProductList",
7324
7505
  value: function () {
7325
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75() {
7326
- var _this$otherParams42;
7506
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78() {
7507
+ var _this$otherParams43;
7327
7508
  var menu_list_ids, _this$store$products, res;
7328
- return _regeneratorRuntime().wrap(function _callee75$(_context75) {
7329
- while (1) switch (_context75.prev = _context75.next) {
7509
+ return _regeneratorRuntime().wrap(function _callee78$(_context78) {
7510
+ while (1) switch (_context78.prev = _context78.next) {
7330
7511
  case 0:
7331
7512
  // 可以直接通过配置里的 menu 读取
7332
- menu_list_ids = ((_this$otherParams42 = this.otherParams) === null || _this$otherParams42 === void 0 || (_this$otherParams42 = _this$otherParams42.dineInConfig) === null || _this$otherParams42 === void 0 ? void 0 : _this$otherParams42['menu.associated_menus'].map(function (n) {
7513
+ menu_list_ids = ((_this$otherParams43 = this.otherParams) === null || _this$otherParams43 === void 0 || (_this$otherParams43 = _this$otherParams43.dineInConfig) === null || _this$otherParams43 === void 0 ? void 0 : _this$otherParams43['menu.associated_menus'].map(function (n) {
7333
7514
  return Number(n.value);
7334
7515
  })) || [];
7335
- _context75.prev = 1;
7336
- _context75.next = 4;
7516
+ _context78.prev = 1;
7517
+ _context78.next = 4;
7337
7518
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
7338
7519
  menu_list_ids: menu_list_ids,
7339
7520
  cacheId: this.cacheId,
@@ -7341,17 +7522,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7341
7522
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
7342
7523
  });
7343
7524
  case 4:
7344
- res = _context75.sent;
7345
- return _context75.abrupt("return", res);
7525
+ res = _context78.sent;
7526
+ return _context78.abrupt("return", res);
7346
7527
  case 8:
7347
- _context75.prev = 8;
7348
- _context75.t0 = _context75["catch"](1);
7349
- throw _context75.t0;
7528
+ _context78.prev = 8;
7529
+ _context78.t0 = _context78["catch"](1);
7530
+ throw _context78.t0;
7350
7531
  case 11:
7351
7532
  case "end":
7352
- return _context75.stop();
7533
+ return _context78.stop();
7353
7534
  }
7354
- }, _callee75, this, [[1, 8]]);
7535
+ }, _callee78, this, [[1, 8]]);
7355
7536
  }));
7356
7537
  function getProductList() {
7357
7538
  return _getProductList.apply(this, arguments);
@@ -7366,34 +7547,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7366
7547
  }, {
7367
7548
  key: "setOtherParams",
7368
7549
  value: function () {
7369
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(params) {
7370
- var _this$otherParams43;
7550
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(params) {
7551
+ var _this$otherParams44;
7371
7552
  var _ref56,
7372
7553
  _ref56$cover,
7373
7554
  cover,
7374
7555
  previousPickupTimingScope,
7375
- _args76 = arguments;
7376
- return _regeneratorRuntime().wrap(function _callee76$(_context76) {
7377
- while (1) switch (_context76.prev = _context76.next) {
7556
+ _args79 = arguments;
7557
+ return _regeneratorRuntime().wrap(function _callee79$(_context79) {
7558
+ while (1) switch (_context79.prev = _context79.next) {
7378
7559
  case 0:
7379
- _ref56 = _args76.length > 1 && _args76[1] !== undefined ? _args76[1] : {}, _ref56$cover = _ref56.cover, cover = _ref56$cover === void 0 ? false : _ref56$cover;
7560
+ _ref56 = _args79.length > 1 && _args79[1] !== undefined ? _args79[1] : {}, _ref56$cover = _ref56.cover, cover = _ref56$cover === void 0 ? false : _ref56$cover;
7380
7561
  previousPickupTimingScope = this.getPickupTimingScope();
7381
7562
  if (cover) {
7382
7563
  this.otherParams = _objectSpread({}, params);
7383
7564
  } else {
7384
7565
  this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
7385
7566
  }
7386
- this.cacheId = (_this$otherParams43 = this.otherParams) === null || _this$otherParams43 === void 0 ? void 0 : _this$otherParams43.cacheId;
7567
+ this.cacheId = (_this$otherParams44 = this.otherParams) === null || _this$otherParams44 === void 0 ? void 0 : _this$otherParams44.cacheId;
7387
7568
  if (previousPickupTimingScope !== this.getPickupTimingScope()) this.resetPickupTimingCache();
7388
- _context76.next = 7;
7569
+ _context79.next = 7;
7389
7570
  return this.syncOtherParamsToSubModules(params, {
7390
7571
  cover: cover
7391
7572
  });
7392
7573
  case 7:
7393
7574
  case "end":
7394
- return _context76.stop();
7575
+ return _context79.stop();
7395
7576
  }
7396
- }, _callee76, this);
7577
+ }, _callee79, this);
7397
7578
  }));
7398
7579
  function setOtherParams(_x66) {
7399
7580
  return _setOtherParams.apply(this, arguments);