@pisell/pisellos 2.3.187 → 2.3.189

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 (40) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/BookingContext/utils/productExtend.d.ts +9 -1
  3. package/dist/modules/BookingContext/utils/productExtend.js +47 -13
  4. package/dist/modules/Order/index.d.ts +15 -5
  5. package/dist/modules/Order/index.js +1161 -921
  6. package/dist/modules/Order/types.d.ts +16 -4
  7. package/dist/modules/Order/utils.d.ts +1 -3
  8. package/dist/modules/Order/utils.js +2 -5
  9. package/dist/modules/ResourcePlanner/planner.js +29 -2
  10. package/dist/modules/ResourcePlanner/types.d.ts +6 -0
  11. package/dist/modules/Rules/index.js +19 -30
  12. package/dist/solution/BaseSales/index.d.ts +4 -0
  13. package/dist/solution/BaseSales/index.js +204 -176
  14. package/dist/solution/BaseSales/types.d.ts +1 -0
  15. package/dist/solution/BaseSales/types.js +1 -0
  16. package/dist/solution/BookingByStep/index.d.ts +1 -1
  17. package/dist/solution/BookingTicket/index.js +52 -31
  18. package/dist/solution/UnifiedBookingSales/index.d.ts +3 -0
  19. package/dist/solution/UnifiedBookingSales/index.js +279 -204
  20. package/dist/solution/UnifiedBookingSales/types.d.ts +6 -1
  21. package/lib/modules/BookingContext/utils/productExtend.d.ts +9 -1
  22. package/lib/modules/BookingContext/utils/productExtend.js +38 -5
  23. package/lib/modules/Order/index.d.ts +15 -5
  24. package/lib/modules/Order/index.js +167 -21
  25. package/lib/modules/Order/types.d.ts +16 -4
  26. package/lib/modules/Order/utils.d.ts +1 -3
  27. package/lib/modules/Order/utils.js +2 -5
  28. package/lib/modules/ResourcePlanner/planner.js +25 -1
  29. package/lib/modules/ResourcePlanner/types.d.ts +6 -0
  30. package/lib/modules/Rules/index.js +9 -19
  31. package/lib/solution/BaseSales/index.d.ts +4 -0
  32. package/lib/solution/BaseSales/index.js +14 -0
  33. package/lib/solution/BaseSales/types.d.ts +1 -0
  34. package/lib/solution/BaseSales/types.js +1 -0
  35. package/lib/solution/BookingByStep/index.d.ts +1 -1
  36. package/lib/solution/BookingTicket/index.js +8 -2
  37. package/lib/solution/UnifiedBookingSales/index.d.ts +3 -0
  38. package/lib/solution/UnifiedBookingSales/index.js +80 -15
  39. package/lib/solution/UnifiedBookingSales/types.d.ts +6 -1
  40. package/package.json +1 -1
@@ -629,6 +629,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
629
629
  _defineProperty(_assertThisInitialized(_this), "salesDetailHydrateQueue", Promise.resolve());
630
630
  _defineProperty(_assertThisInitialized(_this), "serverOrderChangeUnsubscribe", null);
631
631
  _defineProperty(_assertThisInitialized(_this), "paymentMethodsChangedUnsubscribe", null);
632
+ _defineProperty(_assertThisInitialized(_this), "orderSessionChangedUnsubscribe", null);
632
633
  _defineProperty(_assertThisInitialized(_this), "serverOrderChangeHydrateInFlight", null);
633
634
  _defineProperty(_assertThisInitialized(_this), "queuedServerOrderChanges", []);
634
635
  _defineProperty(_assertThisInitialized(_this), "serverOrderChangeSyncEnabled", false);
@@ -1021,11 +1022,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1021
1022
  };
1022
1023
  }());
1023
1024
  }
1025
+ }, {
1026
+ key: "registerOrderSessionChangeSync",
1027
+ value: function registerOrderSessionChangeSync() {
1028
+ var _this$orderSessionCha,
1029
+ _this$store$order4,
1030
+ _this$store$order4$ef,
1031
+ _this6 = this;
1032
+ (_this$orderSessionCha = this.orderSessionChangedUnsubscribe) === null || _this$orderSessionCha === void 0 || _this$orderSessionCha.call(this);
1033
+ this.orderSessionChangedUnsubscribe = ((_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || (_this$store$order4$ef = _this$store$order4.effectsOn) === null || _this$store$order4$ef === void 0 ? void 0 : _this$store$order4$ef.call(_this$store$order4, 'onOrderSessionChanged', function (payload) {
1034
+ return _this6.effectsEmit(BaseSalesHookNames.onOrderSessionChanged, payload);
1035
+ })) || null;
1036
+ }
1024
1037
  }, {
1025
1038
  key: "hydrateLatestLoadedSalesDetail",
1026
1039
  value: function () {
1027
1040
  var _hydrateLatestLoadedSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(record, loadSequence, options) {
1028
- var _this6 = this;
1041
+ var _this7 = this;
1029
1042
  var hydratedSales, skippedBeforeHydrate, hydrateTask, queuedTask;
1030
1043
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1031
1044
  while (1) switch (_context8.prev = _context8.next) {
@@ -1038,14 +1051,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1038
1051
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1039
1052
  while (1) switch (_context7.prev = _context7.next) {
1040
1053
  case 0:
1041
- if (!(loadSequence !== _this6.salesDetailLoadSequence)) {
1054
+ if (!(loadSequence !== _this7.salesDetailLoadSequence)) {
1042
1055
  _context7.next = 3;
1043
1056
  break;
1044
1057
  }
1045
1058
  skippedBeforeHydrate = true;
1046
1059
  return _context7.abrupt("return");
1047
1060
  case 3:
1048
- if (_this6.store.order) {
1061
+ if (_this7.store.order) {
1049
1062
  _context7.next = 5;
1050
1063
  break;
1051
1064
  }
@@ -1066,21 +1079,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1066
1079
  };
1067
1080
  }
1068
1081
  _context7.next = 9;
1069
- return _this6.store.order.hydrateTempOrderFromRecord(record, hydrateOptions);
1082
+ return _this7.store.order.hydrateTempOrderFromRecord(record, hydrateOptions);
1070
1083
  case 9:
1071
1084
  sales = _context7.sent;
1072
1085
  hydratedSales = sales;
1073
1086
 
1074
1087
  // hydrate 期间可能又发起了更新请求;后续任务已串行排队,将负责最终状态。
1075
- if (!(loadSequence !== _this6.salesDetailLoadSequence)) {
1088
+ if (!(loadSequence !== _this7.salesDetailLoadSequence)) {
1076
1089
  _context7.next = 13;
1077
1090
  break;
1078
1091
  }
1079
1092
  return _context7.abrupt("return");
1080
1093
  case 13:
1081
- _this6.currentSalesDetail = sales;
1094
+ _this7.currentSalesDetail = sales;
1082
1095
  _context7.next = 16;
1083
- return _this6.core.effects.emit("".concat(_this6.name, ":onSalesOrderLoaded"), {
1096
+ return _this7.core.effects.emit("".concat(_this7.name, ":onSalesOrderLoaded"), {
1084
1097
  sales: sales
1085
1098
  });
1086
1099
  case 16:
@@ -1157,8 +1170,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1157
1170
  }, {
1158
1171
  key: "getCurrentOrderCustomerId",
1159
1172
  value: function getCurrentOrderCustomerId() {
1160
- var _this$store$order4, _this$store$order4$ge;
1161
- var tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || (_this$store$order4$ge = _this$store$order4.getTempOrder) === null || _this$store$order4$ge === void 0 ? void 0 : _this$store$order4$ge.call(_this$store$order4);
1173
+ var _this$store$order5, _this$store$order5$ge;
1174
+ var tempOrder = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || (_this$store$order5$ge = _this$store$order5.getTempOrder) === null || _this$store$order5$ge === void 0 ? void 0 : _this$store$order5$ge.call(_this$store$order5);
1162
1175
  var customerId = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
1163
1176
  if (customerId === null || customerId === undefined) return undefined;
1164
1177
  return customerId;
@@ -1420,7 +1433,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1420
1433
  key: "prepareRawProductForPriceQuery",
1421
1434
  value: function prepareRawProductForPriceQuery(rawProduct, selectedProduct) {
1422
1435
  var _product$product_id2,
1423
- _this7 = this;
1436
+ _this8 = this;
1424
1437
  var product = cloneDeep(rawProduct);
1425
1438
  var rawProductId = this.getPriceQueryProductId(product);
1426
1439
  var selectedProductId = this.getPriceQueryProductId(selectedProduct);
@@ -1451,7 +1464,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1451
1464
  var rawBundleItems = this.getAuthoritativeBundleItems(product);
1452
1465
  var allSelectedBundlesExist = selectedBundles.every(function (bundle) {
1453
1466
  var _ref19, _bundle$bundle_varian, _ref20, _authoritativeBundle$;
1454
- var authoritativeBundle = _this7.findAuthoritativeBundleItem(bundle, rawBundleItems);
1467
+ var authoritativeBundle = _this8.findAuthoritativeBundleItem(bundle, rawBundleItems);
1455
1468
  if (!authoritativeBundle) return false;
1456
1469
  var selectedBundleVariantId = Number((_ref19 = (_bundle$bundle_varian = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle === null || bundle === void 0 ? void 0 : bundle.variant_id) !== null && _ref19 !== void 0 ? _ref19 : 0);
1457
1470
  var authoritativeBundleVariantId = Number((_ref20 = (_authoritativeBundle$ = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.bundle_variant_id) !== null && _authoritativeBundle$ !== void 0 ? _authoritativeBundle$ : authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.variant_id) !== null && _ref20 !== void 0 ? _ref20 : 0);
@@ -1574,7 +1587,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1574
1587
  key: "resolveProductsForPriceQuery",
1575
1588
  value: function () {
1576
1589
  var _resolveProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
1577
- var _this8 = this;
1590
+ var _this9 = this;
1578
1591
  var selectedProducts, productIds, ids, handledByOsServer, canUseLocalFastPath, productsById, shouldAlignSelectedVariantPrice, queryPayload, cachedRawProducts, authoritativeProducts, missingIds, remoteRawProducts;
1579
1592
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1580
1593
  while (1) switch (_context12.prev = _context12.next) {
@@ -1583,7 +1596,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1583
1596
  return item.product || {};
1584
1597
  });
1585
1598
  productIds = selectedProducts.map(function (product) {
1586
- return _this8.getPriceQueryProductId(product);
1599
+ return _this9.getPriceQueryProductId(product);
1587
1600
  });
1588
1601
  ids = Array.from(new Set(productIds.filter(function (id) {
1589
1602
  return id !== null;
@@ -1621,15 +1634,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1621
1634
  productsById = _context12.sent;
1622
1635
  shouldAlignSelectedVariantPrice = handledByOsServer && this.preferAuthoritativeProductQueryPrice();
1623
1636
  return _context12.abrupt("return", productIds.map(function (productId, index) {
1624
- var _this8$otherParams, _authoritativeProduct;
1637
+ var _this9$otherParams, _authoritativeProduct;
1625
1638
  var authoritativeProduct = productId === null ? null : productsById.get(productId) || null;
1626
- if (authoritativeProduct && normalizeRuntimePlatform((_this8$otherParams = _this8.otherParams) === null || _this8$otherParams === void 0 ? void 0 : _this8$otherParams.platform) === 'pos' && (params.strictDurationPricing || usesPosDurationPricing(authoritativeProduct) || hasAppliedPosDurationPricing(selectedProducts[index]))) {
1639
+ if (authoritativeProduct && normalizeRuntimePlatform((_this9$otherParams = _this9.otherParams) === null || _this9$otherParams === void 0 ? void 0 : _this9$otherParams.platform) === 'pos' && (params.strictDurationPricing || usesPosDurationPricing(authoritativeProduct) || hasAppliedPosDurationPricing(selectedProducts[index]))) {
1627
1640
  return resolveDurationPricingProduct(authoritativeProduct, selectedProducts[index]);
1628
1641
  }
1629
1642
  if (!shouldAlignSelectedVariantPrice || !authoritativeProduct) return authoritativeProduct;
1630
1643
  var selectedProduct = selectedProducts[index];
1631
- var selectedVariantId = _this8.getSelectedProductVariantId(selectedProduct);
1632
- if (!selectedVariantId || _this8.getSelectedProductVariantId(authoritativeProduct) === selectedVariantId) {
1644
+ var selectedVariantId = _this9.getSelectedProductVariantId(selectedProduct);
1645
+ if (!selectedVariantId || _this9.getSelectedProductVariantId(authoritativeProduct) === selectedVariantId) {
1633
1646
  return authoritativeProduct;
1634
1647
  }
1635
1648
 
@@ -1662,7 +1675,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1662
1675
  cachedRawProducts = this.getRawProductPriceSources(ids);
1663
1676
  authoritativeProducts = selectedProducts.map(function (selectedProduct, index) {
1664
1677
  var productId = productIds[index];
1665
- return productId === null ? null : _this8.resolveLocalProductForPriceQuery({
1678
+ return productId === null ? null : _this9.resolveLocalProductForPriceQuery({
1666
1679
  selectedProduct: selectedProduct,
1667
1680
  rawProduct: cachedRawProducts.get(productId),
1668
1681
  queryPayload: queryPayload
@@ -1697,7 +1710,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1697
1710
  var productId = productIds[index];
1698
1711
  if (productId === null) return;
1699
1712
  var rawProduct = remoteRawProducts.get(productId);
1700
- var locallyResolved = _this8.resolveLocalProductForPriceQuery({
1713
+ var locallyResolved = _this9.resolveLocalProductForPriceQuery({
1701
1714
  selectedProduct: selectedProducts[index],
1702
1715
  rawProduct: rawProduct,
1703
1716
  queryPayload: queryPayload
@@ -1709,7 +1722,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1709
1722
 
1710
1723
  // 严格客户端能力仍不可用时,真实请求已经是最后的权威降级。
1711
1724
  // 尽量应用所选 SKU 基线;关系不完整时保持旧的远端商品语义。
1712
- authoritativeProducts[index] = rawProduct ? _this8.prepareRawProductForPriceQuery(rawProduct, selectedProducts[index]) || rawProduct : null;
1725
+ authoritativeProducts[index] = rawProduct ? _this9.prepareRawProductForPriceQuery(rawProduct, selectedProducts[index]) || rawProduct : null;
1713
1726
  });
1714
1727
  return _context12.abrupt("return", authoritativeProducts);
1715
1728
  case 28:
@@ -1771,7 +1784,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1771
1784
  }, {
1772
1785
  key: "mergeProductForPriceQuery",
1773
1786
  value: function mergeProductForPriceQuery(product, authoritativeProduct) {
1774
- var _this9 = this,
1787
+ var _this10 = this,
1775
1788
  _product$id,
1776
1789
  _ref25,
1777
1790
  _product$product_id3,
@@ -1787,8 +1800,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1787
1800
  var authoritativeBundles = this.getAuthoritativeBundleItems(authoritativeProduct);
1788
1801
  var productBundle = selectedBundles.map(function (bundle) {
1789
1802
  var _authoritativeBundle$2, _authoritativeBundle$3;
1790
- var authoritativeBundle = _this9.findAuthoritativeBundleItem(bundle, authoritativeBundles);
1791
- var unitPrice = authoritativeBundle ? _this9.getAuthoritativeBundleUnitPrice(authoritativeBundle) : undefined;
1803
+ var authoritativeBundle = _this10.findAuthoritativeBundleItem(bundle, authoritativeBundles);
1804
+ var unitPrice = authoritativeBundle ? _this10.getAuthoritativeBundleUnitPrice(authoritativeBundle) : undefined;
1792
1805
  if (unitPrice === undefined || unitPrice === null || unitPrice === '') return bundle;
1793
1806
  return _objectSpread(_objectSpread({}, bundle), {}, {
1794
1807
  price: unitPrice,
@@ -1869,27 +1882,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1869
1882
  }, {
1870
1883
  key: "getFulfillmentItemRulesController",
1871
1884
  value: function getFulfillmentItemRulesController() {
1872
- var _this10 = this;
1885
+ var _this11 = this;
1873
1886
  if (!this.fulfillmentItemRulesController) {
1874
1887
  this.fulfillmentItemRulesController = new FulfillmentItemRulesController({
1875
1888
  getOrder: function getOrder() {
1876
- if (!_this10.store.order) throw new Error('order 模块未初始化');
1877
- return _this10.store.order;
1889
+ if (!_this11.store.order) throw new Error('order 模块未初始化');
1890
+ return _this11.store.order;
1878
1891
  },
1879
1892
  getProducts: function getProducts() {
1880
- return _this10.store.products;
1893
+ return _this11.store.products;
1881
1894
  },
1882
1895
  loadOpenData: function loadOpenData() {
1883
- return _this10.loadFulfillmentItemRuleOpenData();
1896
+ return _this11.loadFulfillmentItemRuleOpenData();
1884
1897
  },
1885
1898
  getScope: function getScope() {
1886
- return _this10.getPickupTimingScope();
1899
+ return _this11.getPickupTimingScope();
1887
1900
  },
1888
1901
  getOtherParams: function getOtherParams() {
1889
- return _this10.otherParams;
1902
+ return _this11.otherParams;
1890
1903
  },
1891
1904
  fetchStrategyModels: function fetchStrategyModels(ids) {
1892
- return _this10.request.get('/promotion', {
1905
+ return _this11.request.get('/promotion', {
1893
1906
  skip: 1,
1894
1907
  num: 99,
1895
1908
  status: 'active',
@@ -1897,7 +1910,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1897
1910
  });
1898
1911
  },
1899
1912
  reportError: function reportError(error) {
1900
- return _this10.logWarning('履约费用策略执行失败,保留服务类型设置', {
1913
+ return _this11.logWarning('履约费用策略执行失败,保留服务类型设置', {
1901
1914
  error: error instanceof Error ? error.message : String(error)
1902
1915
  });
1903
1916
  }
@@ -1941,32 +1954,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1941
1954
  }, {
1942
1955
  key: "getPickupTimingController",
1943
1956
  value: function getPickupTimingController() {
1944
- var _this11 = this;
1957
+ var _this12 = this;
1945
1958
  if (!this.pickupTimingController) {
1946
1959
  this.pickupTimingController = new PickupTimingController({
1947
1960
  getOrder: function getOrder() {
1948
- if (!_this11.store.order) throw new Error('order 模块未初始化');
1949
- return _this11.store.order;
1961
+ if (!_this12.store.order) throw new Error('order 模块未初始化');
1962
+ return _this12.store.order;
1950
1963
  },
1951
1964
  setServiceType: function setServiceType(serviceType) {
1952
- return _this11.setServiceType(serviceType);
1965
+ return _this12.setServiceType(serviceType);
1953
1966
  },
1954
1967
  getSchedule: function getSchedule() {
1955
- return _this11.store.schedule;
1968
+ return _this12.store.schedule;
1956
1969
  },
1957
1970
  loadOpenData: function loadOpenData(force) {
1958
- return _this11.loadPickupTimingOpenData(force);
1971
+ return _this12.loadPickupTimingOpenData(force);
1959
1972
  },
1960
1973
  getTimezone: function getTimezone() {
1961
- var _this11$getPickupTimi;
1962
- return String((_this11$getPickupTimi = _this11.getPickupTimingContextData('timezone')) !== null && _this11$getPickupTimi !== void 0 ? _this11$getPickupTimi : '');
1974
+ var _this12$getPickupTimi;
1975
+ return String((_this12$getPickupTimi = _this12.getPickupTimingContextData('timezone')) !== null && _this12$getPickupTimi !== void 0 ? _this12$getPickupTimi : '');
1963
1976
  },
1964
1977
  getScope: function getScope() {
1965
- return _this11.getPickupTimingScope();
1978
+ return _this12.getPickupTimingScope();
1966
1979
  },
1967
1980
  isPos: function isPos() {
1968
- var _this11$otherParams;
1969
- return normalizeRuntimePlatform((_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams.platform) === 'pos';
1981
+ var _this12$otherParams;
1982
+ return normalizeRuntimePlatform((_this12$otherParams = _this12.otherParams) === null || _this12$otherParams === void 0 ? void 0 : _this12$otherParams.platform) === 'pos';
1970
1983
  }
1971
1984
  });
1972
1985
  }
@@ -2103,7 +2116,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2103
2116
  }, {
2104
2117
  key: "getSubModuleHooks",
2105
2118
  value: function getSubModuleHooks(moduleName) {
2106
- var _this12 = this,
2119
+ var _this13 = this,
2107
2120
  _this$otherParams$mod;
2108
2121
  var optionHooks = this.initializeOptions.hooks || {};
2109
2122
  var otherHooks = this.otherParams.hooks || {};
@@ -2129,7 +2142,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2129
2142
  _context15.next = 2;
2130
2143
  return hooks === null || hooks === void 0 || (_hooks$onBeforeCartCo = hooks.onBeforeCartCommit) === null || _hooks$onBeforeCartCo === void 0 ? void 0 : _hooks$onBeforeCartCo.call(hooks, context);
2131
2144
  case 2:
2132
- if (!(inventory !== _this12.getInventory())) {
2145
+ if (!(inventory !== _this13.getInventory())) {
2133
2146
  _context15.next = 4;
2134
2147
  break;
2135
2148
  }
@@ -2196,7 +2209,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2196
2209
  key: "syncOtherParamsToSubModules",
2197
2210
  value: (function () {
2198
2211
  var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(changedParams) {
2199
- var _this13 = this;
2212
+ var _this14 = this;
2200
2213
  var _ref32,
2201
2214
  _ref32$cover,
2202
2215
  cover,
@@ -2213,7 +2226,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2213
2226
  while (1) switch (_context16.prev = _context16.next) {
2214
2227
  case 0:
2215
2228
  _ref35 = _slicedToArray(_ref33, 2), moduleName = _ref35[0], subModule = _ref35[1];
2216
- if (!_this13.reusedSharedSubModuleNames.has(moduleName)) {
2229
+ if (!_this14.reusedSharedSubModuleNames.has(moduleName)) {
2217
2230
  _context16.next = 3;
2218
2231
  break;
2219
2232
  }
@@ -2226,13 +2239,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2226
2239
  }
2227
2240
  return _context16.abrupt("return");
2228
2241
  case 6:
2229
- nextSubModuleOtherParams = _this13.buildSubModuleOtherParams(moduleName);
2242
+ nextSubModuleOtherParams = _this14.buildSubModuleOtherParams(moduleName);
2230
2243
  _context16.next = 9;
2231
2244
  return targetModule.updateOtherParams(nextSubModuleOtherParams, _objectSpread({
2232
2245
  changedParams: changedParams,
2233
2246
  cover: cover
2234
2247
  }, moduleName === 'order' ? {
2235
- hooks: _this13.getSubModuleHooks(moduleName)
2248
+ hooks: _this14.getSubModuleHooks(moduleName)
2236
2249
  } : {}));
2237
2250
  case 9:
2238
2251
  case "end":
@@ -2300,22 +2313,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2300
2313
  }, {
2301
2314
  key: "getPaymentNumberDevicePrefixSync",
2302
2315
  value: function getPaymentNumberDevicePrefixSync() {
2303
- var _this14 = this;
2316
+ var _this15 = this;
2304
2317
  if (!this.appPlugin) return 'LOCAL';
2305
2318
  return resolvePaymentNumberDevicePrefixFromDeviceId(function (key) {
2306
- return _this14.getAppData(key);
2319
+ return _this15.getAppData(key);
2307
2320
  });
2308
2321
  }
2309
2322
  }, {
2310
2323
  key: "getPaymentNumberDevicePrefixAsync",
2311
2324
  value: function getPaymentNumberDevicePrefixAsync() {
2312
- var _this15 = this;
2325
+ var _this16 = this;
2313
2326
  if (!this.appPlugin) return Promise.resolve('LOCAL');
2314
2327
  if (this.paymentNumberDevicePrefix) {
2315
2328
  return Promise.resolve(this.paymentNumberDevicePrefix);
2316
2329
  }
2317
2330
  return resolvePaymentNumberDevicePrefix(function (key) {
2318
- return _this15.getAppData(key);
2331
+ return _this16.getAppData(key);
2319
2332
  });
2320
2333
  }
2321
2334
  }, {
@@ -2399,8 +2412,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2399
2412
  }
2400
2413
  }
2401
2414
  try {
2402
- var _this$store$order5, _this$store$order5$ge, _this$logger, _this$logger$addLog, _orderIdentity$orderI, _orderIdentity$extern, _orderIdentity$shopOr;
2403
- var orderIdentity = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || (_this$store$order5$ge = _this$store$order5.getOrderIdentity) === null || _this$store$order5$ge === void 0 ? void 0 : _this$store$order5$ge.call(_this$store$order5);
2415
+ var _this$store$order6, _this$store$order6$ge, _this$logger, _this$logger$addLog, _orderIdentity$orderI, _orderIdentity$extern, _orderIdentity$shopOr;
2416
+ var orderIdentity = (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$ge = _this$store$order6.getOrderIdentity) === null || _this$store$order6$ge === void 0 ? void 0 : _this$store$order6$ge.call(_this$store$order6);
2404
2417
  (_this$logger = this.logger) === null || _this$logger === void 0 || (_this$logger$addLog = _this$logger.addLog) === null || _this$logger$addLog === void 0 || _this$logger$addLog.call(_this$logger, {
2405
2418
  type: 'info',
2406
2419
  title: 'syncAppDataToTempOrder',
@@ -2449,7 +2462,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2449
2462
  var _this$otherParams18,
2450
2463
  _this$appPlugin2,
2451
2464
  _this$appPlugin2$getA,
2452
- _this16 = this,
2465
+ _this17 = this,
2453
2466
  _this$otherParams19;
2454
2467
  var options,
2455
2468
  app,
@@ -2481,24 +2494,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2481
2494
  targetCacheData = this.readSessionCacheData();
2482
2495
  moduleNames = this.getRegisteredModuleNames();
2483
2496
  moduleNames.forEach(function (step) {
2484
- var reusedModule = _this16.getReusableSharedSubModule(step);
2497
+ var reusedModule = _this17.getReusableSharedSubModule(step);
2485
2498
  if (reusedModule) {
2486
- _this16.store[step] = reusedModule;
2487
- _this16.reusedSharedSubModuleNames.add(step);
2499
+ _this17.store[step] = reusedModule;
2500
+ _this17.reusedSharedSubModuleNames.add(step);
2488
2501
  return;
2489
2502
  }
2490
- var targetModule = _this16.createSubModule(step);
2503
+ var targetModule = _this17.createSubModule(step);
2491
2504
  if (!targetModule) {
2492
2505
  throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
2493
2506
  }
2494
- var hooks = _this16.getSubModuleHooks(step);
2495
- _this16.store[step] = targetModule;
2496
- _this16.core.registerModule(targetModule, _objectSpread(_objectSpread({
2497
- initialState: _this16.shouldUseSessionStorageForSubModule(step) ? (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {} : {}
2507
+ var hooks = _this17.getSubModuleHooks(step);
2508
+ _this17.store[step] = targetModule;
2509
+ _this17.core.registerModule(targetModule, _objectSpread(_objectSpread({
2510
+ initialState: _this17.shouldUseSessionStorageForSubModule(step) ? (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {} : {}
2498
2511
  }, hooks ? {
2499
2512
  hooks: hooks
2500
2513
  } : {}), {}, {
2501
- otherParams: _this16.buildSubModuleOtherParams(step)
2514
+ otherParams: _this17.buildSubModuleOtherParams(step)
2502
2515
  }));
2503
2516
  });
2504
2517
  if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
@@ -2516,8 +2529,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2516
2529
  case 23:
2517
2530
  this.registerPaymentMethodsChangeSync();
2518
2531
  this.registerServerOrderChangeSync();
2532
+ this.registerOrderSessionChangeSync();
2519
2533
  this.core.effects.emit("".concat(this.name, ":onInited"), {});
2520
- case 26:
2534
+ case 27:
2521
2535
  case "end":
2522
2536
  return _context18.stop();
2523
2537
  }
@@ -2532,7 +2546,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2532
2546
  key: "destroy",
2533
2547
  value: function () {
2534
2548
  var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2535
- var _this$fulfillmentItem, _this$serverOrderChan2, _this$paymentMethodsC2;
2549
+ var _this$fulfillmentItem, _this$serverOrderChan2, _this$paymentMethodsC2, _this$orderSessionCha2;
2536
2550
  var _i, _Object$keys, key, sub;
2537
2551
  return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2538
2552
  while (1) switch (_context19.prev = _context19.next) {
@@ -2543,53 +2557,55 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2543
2557
  this.serverOrderChangeUnsubscribe = null;
2544
2558
  (_this$paymentMethodsC2 = this.paymentMethodsChangedUnsubscribe) === null || _this$paymentMethodsC2 === void 0 || _this$paymentMethodsC2.call(this);
2545
2559
  this.paymentMethodsChangedUnsubscribe = null;
2560
+ (_this$orderSessionCha2 = this.orderSessionChangedUnsubscribe) === null || _this$orderSessionCha2 === void 0 || _this$orderSessionCha2.call(this);
2561
+ this.orderSessionChangedUnsubscribe = null;
2546
2562
  _i = 0, _Object$keys = Object.keys(this.store);
2547
- case 7:
2563
+ case 9:
2548
2564
  if (!(_i < _Object$keys.length)) {
2549
- _context19.next = 24;
2565
+ _context19.next = 26;
2550
2566
  break;
2551
2567
  }
2552
2568
  key = _Object$keys[_i];
2553
2569
  if (!this.reusedSharedSubModuleNames.has(key)) {
2554
- _context19.next = 11;
2570
+ _context19.next = 13;
2555
2571
  break;
2556
2572
  }
2557
- return _context19.abrupt("continue", 21);
2558
- case 11:
2573
+ return _context19.abrupt("continue", 23);
2574
+ case 13:
2559
2575
  sub = this.store[key];
2560
2576
  if (!(sub && typeof sub.destroy === 'function')) {
2561
- _context19.next = 21;
2577
+ _context19.next = 23;
2562
2578
  break;
2563
2579
  }
2564
- _context19.prev = 13;
2565
- _context19.next = 16;
2580
+ _context19.prev = 15;
2581
+ _context19.next = 18;
2566
2582
  return sub.destroy();
2567
- case 16:
2568
- _context19.next = 21;
2569
- break;
2570
2583
  case 18:
2571
- _context19.prev = 18;
2572
- _context19.t0 = _context19["catch"](13);
2584
+ _context19.next = 23;
2585
+ break;
2586
+ case 20:
2587
+ _context19.prev = 20;
2588
+ _context19.t0 = _context19["catch"](15);
2573
2589
  console.warn("[BaseSales] \u5B50\u6A21\u5757 ".concat(key, " \u9500\u6BC1\u5931\u8D25"), _context19.t0);
2574
- case 21:
2590
+ case 23:
2575
2591
  _i++;
2576
- _context19.next = 7;
2592
+ _context19.next = 9;
2577
2593
  break;
2578
- case 24:
2594
+ case 26:
2579
2595
  this.currentSalesDetail = null;
2580
2596
  this.paymentNumberDevicePrefix = null;
2581
2597
  this.queuedServerOrderChanges = [];
2582
2598
  this.salesDetailLoadSequence += 1;
2583
2599
  this.walletAssetsRefreshSequence += 1;
2584
- _context19.next = 31;
2600
+ _context19.next = 33;
2585
2601
  return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
2586
- case 31:
2602
+ case 33:
2587
2603
  _get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
2588
- case 32:
2604
+ case 34:
2589
2605
  case "end":
2590
2606
  return _context19.stop();
2591
2607
  }
2592
- }, _callee19, this, [[13, 18]]);
2608
+ }, _callee19, this, [[15, 20]]);
2593
2609
  }));
2594
2610
  function destroy() {
2595
2611
  return _destroy.apply(this, arguments);
@@ -2773,10 +2789,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2773
2789
  }, {
2774
2790
  key: "getTempOrder",
2775
2791
  value: function getTempOrder() {
2776
- var _this$store$order6;
2777
- var result = ((_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getTempOrder()) || null;
2792
+ var _this$store$order7;
2793
+ var result = ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getTempOrder()) || null;
2778
2794
  return result;
2779
2795
  }
2796
+ }, {
2797
+ key: "getOrderSessionId",
2798
+ value: function getOrderSessionId() {
2799
+ var _this$store$order8, _this$store$order8$ge;
2800
+ return ((_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || (_this$store$order8$ge = _this$store$order8.getOrderSessionId) === null || _this$store$order8$ge === void 0 ? void 0 : _this$store$order8$ge.call(_this$store$order8)) || null;
2801
+ }
2802
+ }, {
2803
+ key: "isOrderSessionCurrent",
2804
+ value: function isOrderSessionCurrent(sessionId) {
2805
+ var _this$store$order9, _this$store$order9$is;
2806
+ return ((_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 || (_this$store$order9$is = _this$store$order9.isOrderSessionCurrent) === null || _this$store$order9$is === void 0 ? void 0 : _this$store$order9$is.call(_this$store$order9, sessionId)) || false;
2807
+ }
2780
2808
  }, {
2781
2809
  key: "replaceTempOrder",
2782
2810
  value: function () {
@@ -3025,8 +3053,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3025
3053
  }, {
3026
3054
  key: "getPickupTimingBooking",
3027
3055
  value: function getPickupTimingBooking() {
3028
- var _this$store$order7;
3029
- return ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getPickupTimingBooking()) || null;
3056
+ var _this$store$order10;
3057
+ return ((_this$store$order10 = this.store.order) === null || _this$store$order10 === void 0 ? void 0 : _this$store$order10.getPickupTimingBooking()) || null;
3030
3058
  }
3031
3059
  }, {
3032
3060
  key: "setPickupTimingBooking",
@@ -3037,8 +3065,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3037
3065
  }, {
3038
3066
  key: "clearPickupTimingBooking",
3039
3067
  value: function clearPickupTimingBooking() {
3040
- var _this$store$order8;
3041
- (_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || _this$store$order8.clearPickupTimingBooking();
3068
+ var _this$store$order11;
3069
+ (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || _this$store$order11.clearPickupTimingBooking();
3042
3070
  }
3043
3071
  }, {
3044
3072
  key: "updateTempOrderContactsInfo",
@@ -3443,10 +3471,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3443
3471
  }, {
3444
3472
  key: "getHistoricalProductDiscountList",
3445
3473
  value: function getHistoricalProductDiscountList(products) {
3446
- var _this17 = this;
3474
+ var _this18 = this;
3447
3475
  var historyDiscountList = [];
3448
3476
  products.forEach(function (item) {
3449
- if (!_this17.isPersistedOrderProduct(item)) return;
3477
+ if (!_this18.isPersistedOrderProduct(item)) return;
3450
3478
  (item.discount_list || []).forEach(function (discount) {
3451
3479
  var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
3452
3480
  var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
@@ -3506,11 +3534,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3506
3534
  }, {
3507
3535
  key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
3508
3536
  value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
3509
- var _this18 = this;
3537
+ var _this19 = this;
3510
3538
  if (params.discountAction !== 'edit') return false;
3511
3539
  if (!params.products.length) return false;
3512
3540
  var hasDraftProduct = params.products.some(function (product) {
3513
- return !_this18.isPersistedOrderProduct(product);
3541
+ return !_this19.isPersistedOrderProduct(product);
3514
3542
  });
3515
3543
  if (hasDraftProduct) return false;
3516
3544
 
@@ -3579,8 +3607,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3579
3607
  }, {
3580
3608
  key: "getDiscountConfigOrderIdentityKey",
3581
3609
  value: function getDiscountConfigOrderIdentityKey(tempOrder) {
3582
- var _this$store$order9, _this$store$order9$ge, _ref44, _identity$orderId, _tempOrder$request_un, _ref45, _identity$externalSal, _ref46, _ref47, _identity$localId, _tempOrder$_extend3;
3583
- var identity = (_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 || (_this$store$order9$ge = _this$store$order9.getOrderIdentity) === null || _this$store$order9$ge === void 0 ? void 0 : _this$store$order9$ge.call(_this$store$order9);
3610
+ var _this$store$order12, _this$store$order12$g, _ref44, _identity$orderId, _tempOrder$request_un, _ref45, _identity$externalSal, _ref46, _ref47, _identity$localId, _tempOrder$_extend3;
3611
+ var identity = (_this$store$order12 = this.store.order) === null || _this$store$order12 === void 0 || (_this$store$order12$g = _this$store$order12.getOrderIdentity) === null || _this$store$order12$g === void 0 ? void 0 : _this$store$order12$g.call(_this$store$order12);
3584
3612
  return JSON.stringify([(_ref44 = (_identity$orderId = identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _identity$orderId !== void 0 ? _identity$orderId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _ref44 !== void 0 ? _ref44 : '', (_tempOrder$request_un = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.request_unique_idempotency_token) !== null && _tempOrder$request_un !== void 0 ? _tempOrder$request_un : '', (_ref45 = (_identity$externalSal = identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) !== null && _identity$externalSal !== void 0 ? _identity$externalSal : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) !== null && _ref45 !== void 0 ? _ref45 : '', (_ref46 = (_ref47 = (_identity$localId = identity === null || identity === void 0 ? void 0 : identity.localId) !== null && _identity$localId !== void 0 ? _identity$localId : tempOrder === null || tempOrder === void 0 || (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.localId) !== null && _ref47 !== void 0 ? _ref47 : this.cacheId) !== null && _ref46 !== void 0 ? _ref46 : '']);
3585
3613
  }
3586
3614
  }, {
@@ -3588,17 +3616,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3588
3616
  value: function () {
3589
3617
  var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
3590
3618
  var _this$store$order$get2,
3591
- _this$store$order10,
3619
+ _this$store$order13,
3592
3620
  _tempOrder$customer2,
3593
3621
  _tempOrder$_extend4,
3594
3622
  _tempOrder$_extend5,
3595
3623
  _discountModule$getDi,
3596
3624
  _discountModule$getOr,
3597
3625
  _this$store$order$get3,
3598
- _this$store$order11,
3599
- _this19 = this,
3626
+ _this$store$order14,
3627
+ _this20 = this,
3600
3628
  _discountModule$getDi3;
3601
- var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, requestOrderIdentityKey, discountConfigCacheKey, requestEpoch, isCurrentRequest, getCurrentResult, searchedDiscountList, searchedDiscountIds, preparedDiscountList, inFlight, _this$store$order$get4, _this$store$order12, prepareConfigPromise, prepareTask, _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;
3629
+ var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, requestOrderIdentityKey, discountConfigCacheKey, requestEpoch, isCurrentRequest, getCurrentResult, searchedDiscountList, searchedDiscountIds, preparedDiscountList, inFlight, _this$store$order$get4, _this$store$order15, prepareConfigPromise, prepareTask, _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;
3602
3630
  return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3603
3631
  while (1) switch (_context36.prev = _context36.next) {
3604
3632
  case 0:
@@ -3612,7 +3640,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3612
3640
  orderStore = this.store.order.store || {};
3613
3641
  discountModule = orderStore.discount;
3614
3642
  rulesModule = orderStore.rules;
3615
- orderId = tempOrder.order_id || ((_this$store$order$get2 = (_this$store$order10 = this.store.order).getOrderIdentity) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.call(_this$store$order10)) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2.orderId);
3643
+ orderId = tempOrder.order_id || ((_this$store$order$get2 = (_this$store$order13 = this.store.order).getOrderIdentity) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.call(_this$store$order13)) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2.orderId);
3616
3644
  customerId = Number((params === null || params === void 0 ? void 0 : params.customerId) || tempOrder.customer_id || ((_tempOrder$customer2 = tempOrder.customer) === null || _tempOrder$customer2 === void 0 ? void 0 : _tempOrder$customer2.id) || ((_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.customerSnapshot) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.id) || ((_tempOrder$_extend5 = tempOrder._extend) === null || _tempOrder$_extend5 === void 0 || (_tempOrder$_extend5 = _tempOrder$_extend5.customerSnapshot) === null || _tempOrder$_extend5 === void 0 ? void 0 : _tempOrder$_extend5.customer_id) || 0);
3617
3645
  currentDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [];
3618
3646
  originalDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || [];
@@ -3622,20 +3650,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3622
3650
  discountAction = (params === null || params === void 0 ? void 0 : params.action) || (orderId ? 'edit' : 'create');
3623
3651
  requestOrderIdentityKey = this.getDiscountConfigOrderIdentityKey(tempOrder);
3624
3652
  discountConfigCacheKey = JSON.stringify([customerId, discountAction, Number(orderId) || 0, requestOrderIdentityKey]);
3625
- requestEpoch = (_this$store$order$get3 = (_this$store$order11 = this.store.order).getCustomerWalletPrepareConfigEpoch) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order11);
3653
+ requestEpoch = (_this$store$order$get3 = (_this$store$order14 = this.store.order).getCustomerWalletPrepareConfigEpoch) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order14);
3626
3654
  isCurrentRequest = function isCurrentRequest() {
3627
- var _this19$store$order, _this19$store$order$g, _this19$store$order2, _this19$store$order2$;
3628
- var currentTempOrder = (_this19$store$order = _this19.store.order) === null || _this19$store$order === void 0 || (_this19$store$order$g = _this19$store$order.getTempOrder) === null || _this19$store$order$g === void 0 ? void 0 : _this19$store$order$g.call(_this19$store$order);
3629
- return Boolean(currentTempOrder && (requestEpoch === undefined || ((_this19$store$order2 = _this19.store.order) === null || _this19$store$order2 === void 0 || (_this19$store$order2$ = _this19$store$order2.getCustomerWalletPrepareConfigEpoch) === null || _this19$store$order2$ === void 0 ? void 0 : _this19$store$order2$.call(_this19$store$order2)) === requestEpoch) && _this19.resolveDiscountConfigCustomerId(currentTempOrder) === customerId && _this19.getDiscountConfigOrderIdentityKey(currentTempOrder) === requestOrderIdentityKey);
3655
+ var _this20$store$order, _this20$store$order$g, _this20$store$order2, _this20$store$order2$;
3656
+ var currentTempOrder = (_this20$store$order = _this20.store.order) === null || _this20$store$order === void 0 || (_this20$store$order$g = _this20$store$order.getTempOrder) === null || _this20$store$order$g === void 0 ? void 0 : _this20$store$order$g.call(_this20$store$order);
3657
+ return Boolean(currentTempOrder && (requestEpoch === undefined || ((_this20$store$order2 = _this20.store.order) === null || _this20$store$order2 === void 0 || (_this20$store$order2$ = _this20$store$order2.getCustomerWalletPrepareConfigEpoch) === null || _this20$store$order2$ === void 0 ? void 0 : _this20$store$order2$.call(_this20$store$order2)) === requestEpoch) && _this20.resolveDiscountConfigCustomerId(currentTempOrder) === customerId && _this20.getDiscountConfigOrderIdentityKey(currentTempOrder) === requestOrderIdentityKey);
3630
3658
  };
3631
3659
  getCurrentResult = function getCurrentResult() {
3632
- var _this19$store$order3, _this19$store$order3$, _discountModule$getDi2;
3633
- var currentTempOrder = (_this19$store$order3 = _this19.store.order) === null || _this19$store$order3 === void 0 || (_this19$store$order3$ = _this19$store$order3.getTempOrder) === null || _this19$store$order3$ === void 0 ? void 0 : _this19$store$order3$.call(_this19$store$order3);
3660
+ var _this20$store$order3, _this20$store$order3$, _discountModule$getDi2;
3661
+ var currentTempOrder = (_this20$store$order3 = _this20.store.order) === null || _this20$store$order3 === void 0 || (_this20$store$order3$ = _this20$store$order3.getTempOrder) === null || _this20$store$order3$ === void 0 ? void 0 : _this20$store$order3$.call(_this20$store$order3);
3634
3662
  return {
3635
3663
  productList: (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.products) || [],
3636
3664
  discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi2 = discountModule.getDiscountList) === null || _discountModule$getDi2 === void 0 ? void 0 : _discountModule$getDi2.call(discountModule)) || [],
3637
- availableWalletIds: _this19.getAvailableWalletIds(),
3638
- virtualCurrencyList: _this19.getVirtualCurrencyList()
3665
+ availableWalletIds: _this20.getAvailableWalletIds(),
3666
+ virtualCurrencyList: _this20.getVirtualCurrencyList()
3639
3667
  };
3640
3668
  }; // Walk-In 不请求 prepare config;当前搜索/扫码券必须继续参与本次重算。
3641
3669
  // current 优先于 original,保留搜索后的最新选择与可用状态。
@@ -3686,7 +3714,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3686
3714
  orderId: Number(orderId) || undefined,
3687
3715
  apply: false
3688
3716
  }); // OrderModule increments this epoch synchronously before its first await.
3689
- 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);
3717
+ requestEpoch = (_this$store$order$get4 = (_this$store$order15 = this.store.order).getCustomerWalletPrepareConfigEpoch) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order15);
3690
3718
  prepareTask = {
3691
3719
  key: discountConfigCacheKey,
3692
3720
  epoch: requestEpoch,
@@ -3706,7 +3734,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3706
3734
  return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, discountList);
3707
3735
  case 4:
3708
3736
  if (isCurrentRequest()) {
3709
- _this19.discountConfigCacheKey = discountConfigCacheKey;
3737
+ _this20.discountConfigCacheKey = discountConfigCacheKey;
3710
3738
  }
3711
3739
  return _context35.abrupt("return", discountList);
3712
3740
  case 6:
@@ -4010,15 +4038,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4010
4038
  }, {
4011
4039
  key: "getAvailableWalletIds",
4012
4040
  value: function getAvailableWalletIds() {
4013
- var _this$store$order13;
4014
- if (!((_this$store$order13 = this.store.order) !== null && _this$store$order13 !== void 0 && _this$store$order13.getAvailableWalletIds)) return [];
4041
+ var _this$store$order16;
4042
+ if (!((_this$store$order16 = this.store.order) !== null && _this$store$order16 !== void 0 && _this$store$order16.getAvailableWalletIds)) return [];
4015
4043
  return this.store.order.getAvailableWalletIds();
4016
4044
  }
4017
4045
  }, {
4018
4046
  key: "getVirtualCurrencyList",
4019
4047
  value: function getVirtualCurrencyList() {
4020
- var _this$store$order14;
4021
- if (!((_this$store$order14 = this.store.order) !== null && _this$store$order14 !== void 0 && _this$store$order14.getVirtualCurrencyList)) return [];
4048
+ var _this$store$order17;
4049
+ if (!((_this$store$order17 = this.store.order) !== null && _this$store$order17 !== void 0 && _this$store$order17.getVirtualCurrencyList)) return [];
4022
4050
  return this.store.order.getVirtualCurrencyList();
4023
4051
  }
4024
4052
  }, {
@@ -4845,7 +4873,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4845
4873
  value: function () {
4846
4874
  var _finalizeLocalEftposPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
4847
4875
  var _response$data2;
4848
- var key, response, _response$data3, order, payment, temp, isCurrentOrder, _temp$payments, currentTemp, _this$store$order15, refreshed;
4876
+ var key, response, _response$data3, order, payment, temp, isCurrentOrder, _temp$payments, currentTemp, _this$store$order18, refreshed;
4849
4877
  return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4850
4878
  while (1) switch (_context45.prev = _context45.next) {
4851
4879
  case 0:
@@ -4919,7 +4947,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4919
4947
  break;
4920
4948
  }
4921
4949
  _context45.next = 31;
4922
- return (_this$store$order15 = this.store.order) === null || _this$store$order15 === void 0 ? void 0 : _this$store$order15.getSalesOrderByLookup({
4950
+ return (_this$store$order18 = this.store.order) === null || _this$store$order18 === void 0 ? void 0 : _this$store$order18.getSalesOrderByLookup({
4923
4951
  lookup: order.order_id,
4924
4952
  forceRemote: true
4925
4953
  });
@@ -5180,7 +5208,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5180
5208
  value: function () {
5181
5209
  var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(lookup) {
5182
5210
  var _this$otherParams34, _this$otherParams35, _this$otherParams36, _this$otherParams37;
5183
- var hasLookup, lookupPayload, context, payload, invoiceLayoutConfig, invoiceTemplateSettings, printPayload, response, _this$store$order$app, _this$store$order16, _data;
5211
+ var hasLookup, lookupPayload, context, payload, invoiceLayoutConfig, invoiceTemplateSettings, printPayload, response, _this$store$order$app, _this$store$order19, _data;
5184
5212
  return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5185
5213
  while (1) switch (_context49.prev = _context49.next) {
5186
5214
  case 0:
@@ -5235,7 +5263,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5235
5263
  break;
5236
5264
  }
5237
5265
  _context49.next = 15;
5238
- 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);
5266
+ return (_this$store$order$app = (_this$store$order19 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order19, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
5239
5267
  case 15:
5240
5268
  return _context49.abrupt("return", response);
5241
5269
  case 16:
@@ -5252,9 +5280,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5252
5280
  }, {
5253
5281
  key: "getSubmitPaymentStatus",
5254
5282
  value: function getSubmitPaymentStatus(paymentStatus) {
5255
- var _this$store$order17, _this$store$order17$g;
5283
+ var _this$store$order20, _this$store$order20$g;
5256
5284
  if (paymentStatus !== undefined) return paymentStatus;
5257
- var amountSnapshot = (_this$store$order17 = this.store.order) === null || _this$store$order17 === void 0 || (_this$store$order17$g = _this$store$order17.getOrderAmountSnapshot) === null || _this$store$order17$g === void 0 ? void 0 : _this$store$order17$g.call(_this$store$order17);
5285
+ var amountSnapshot = (_this$store$order20 = this.store.order) === null || _this$store$order20 === void 0 || (_this$store$order20$g = _this$store$order20.getOrderAmountSnapshot) === null || _this$store$order20$g === void 0 ? void 0 : _this$store$order20$g.call(_this$store$order20);
5258
5286
  if (!amountSnapshot) return undefined;
5259
5287
  try {
5260
5288
  return new Decimal(amountSnapshot.amountGap || 0).lte(0) ? 'paid' : undefined;
@@ -5398,13 +5426,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5398
5426
  }, {
5399
5427
  key: "scheduleQueuedAutoPaymentSyncFlush",
5400
5428
  value: function scheduleQueuedAutoPaymentSyncFlush() {
5401
- var _this20 = this;
5429
+ var _this21 = this;
5402
5430
  var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
5403
5431
  if (!this.queuedAutoPaymentSync) return;
5404
5432
  if (this.autoPaymentSyncTimer) return;
5405
5433
  this.autoPaymentSyncTimer = setTimeout(function () {
5406
- _this20.autoPaymentSyncTimer = null;
5407
- void _this20.flushQueuedAutoPaymentSync();
5434
+ _this21.autoPaymentSyncTimer = null;
5435
+ void _this21.flushQueuedAutoPaymentSync();
5408
5436
  }, delay);
5409
5437
  }
5410
5438
  }, {
@@ -5544,7 +5572,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5544
5572
  _paymentRecord$create,
5545
5573
  _ref51,
5546
5574
  _paymentRecord$origin,
5547
- _this21 = this;
5575
+ _this22 = this;
5548
5576
  if (!this.store.order) throw new Error('order 模块未初始化');
5549
5577
  var paymentRecord = payment;
5550
5578
  var paymentAmount = new Decimal(paymentRecord.amount || 0);
@@ -5588,7 +5616,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5588
5616
  submitWhenPaid: true,
5589
5617
  smallTicketDataFlag: 1
5590
5618
  }).catch(function (error) {
5591
- _this21.logError('auto sync payments failed', {
5619
+ _this22.logError('auto sync payments failed', {
5592
5620
  error: error instanceof Error ? error.message : String(error)
5593
5621
  });
5594
5622
  });
@@ -5784,8 +5812,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5784
5812
  }, {
5785
5813
  key: "getWalletProductList",
5786
5814
  value: function getWalletProductList() {
5787
- var _this$store$order18, _tempOrder$products;
5788
- var tempOrder = (_this$store$order18 = this.store.order) === null || _this$store$order18 === void 0 ? void 0 : _this$store$order18.getTempOrder();
5815
+ var _this$store$order21, _tempOrder$products;
5816
+ var tempOrder = (_this$store$order21 = this.store.order) === null || _this$store$order21 === void 0 ? void 0 : _this$store$order21.getTempOrder();
5789
5817
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
5790
5818
  // 过滤出有 product_id的商品来,如果没有代表他是自定义商品,不需要参与 wallet
5791
5819
  // debugger
@@ -5849,8 +5877,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5849
5877
  }, {
5850
5878
  key: "buildWalletInitBusinessData",
5851
5879
  value: function buildWalletInitBusinessData(params) {
5852
- var _this$store$order19, _params$order_wait_pa, _ref52, _tempOrder$is_price_i;
5853
- var snapshot = (_this$store$order19 = this.store.order) === null || _this$store$order19 === void 0 ? void 0 : _this$store$order19.getOrderSnapshot();
5880
+ var _this$store$order22, _params$order_wait_pa, _ref52, _tempOrder$is_price_i;
5881
+ var snapshot = (_this$store$order22 = this.store.order) === null || _this$store$order22 === void 0 ? void 0 : _this$store$order22.getOrderSnapshot();
5854
5882
  var tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
5855
5883
  var amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
5856
5884
  if (!tempOrder || !amount) return null;
@@ -5874,7 +5902,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5874
5902
  key: "initWalletData",
5875
5903
  value: function () {
5876
5904
  var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
5877
- var _this$store$order$mer, _this$store$order20, _snapshot$identity;
5905
+ var _this$store$order$mer, _this$store$order23, _snapshot$identity;
5878
5906
  var snapshot, walletBusinessData, result;
5879
5907
  return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5880
5908
  while (1) switch (_context55.prev = _context55.next) {
@@ -5909,7 +5937,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5909
5937
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
5910
5938
  case 10:
5911
5939
  result = _context55.sent;
5912
- (_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, {
5940
+ (_this$store$order$mer = (_this$store$order23 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer === void 0 || _this$store$order$mer.call(_this$store$order23, result.userIdentificationCodes, {
5913
5941
  customerId: walletBusinessData.customer_id,
5914
5942
  orderIdentity: snapshot === null || snapshot === void 0 ? void 0 : snapshot.identity
5915
5943
  });
@@ -5940,8 +5968,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5940
5968
  }, {
5941
5969
  key: "getCommittedWalletAssets",
5942
5970
  value: function getCommittedWalletAssets() {
5943
- var _this$store$order21, _this$store$order21$g;
5944
- var payments = ((_this$store$order21 = this.store.order) === null || _this$store$order21 === void 0 || (_this$store$order21$g = _this$store$order21.getOrderPayments) === null || _this$store$order21$g === void 0 ? void 0 : _this$store$order21$g.call(_this$store$order21)) || [];
5971
+ var _this$store$order24, _this$store$order24$g;
5972
+ var payments = ((_this$store$order24 = this.store.order) === null || _this$store$order24 === void 0 || (_this$store$order24$g = _this$store$order24.getOrderPayments) === null || _this$store$order24$g === void 0 ? void 0 : _this$store$order24$g.call(_this$store$order24)) || [];
5945
5973
  var committed = payments.filter(function (payment) {
5946
5974
  var voucherId = payment === null || payment === void 0 ? void 0 : payment.voucher_id;
5947
5975
  if (voucherId === undefined || voucherId === null || voucherId === 0) {
@@ -6119,7 +6147,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6119
6147
  key: "importWalletAssetsSnapshot",
6120
6148
  value: (function () {
6121
6149
  var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(snapshot) {
6122
- var _this$store$order22, _this$store$order22$m;
6150
+ var _this$store$order25, _this$store$order25$m;
6123
6151
  var state;
6124
6152
  return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6125
6153
  while (1) switch (_context58.prev = _context58.next) {
@@ -6131,7 +6159,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6131
6159
  throw new Error('payment 模块未初始化');
6132
6160
  case 2:
6133
6161
  state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
6134
- (_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);
6162
+ (_this$store$order25 = this.store.order) === null || _this$store$order25 === void 0 || (_this$store$order25$m = _this$store$order25.mergePointCardSnapshotCodes) === null || _this$store$order25$m === void 0 || _this$store$order25$m.call(_this$store$order25, state.items);
6135
6163
  _context58.next = 6;
6136
6164
  return this.syncSelectedWalletAssets(state);
6137
6165
  case 6:
@@ -6156,7 +6184,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6156
6184
  value: (function () {
6157
6185
  var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(params) {
6158
6186
  var _this$store$order$get6, _previousState$custom, _businessData$custome;
6159
- var refreshSequence, wallet, businessData, emptyState, pointCardSnapshotMergeContext, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, _this$store$order$mer2, _this$store$order23, _wallet$getUserIdenti, committed;
6187
+ var refreshSequence, wallet, businessData, emptyState, pointCardSnapshotMergeContext, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, _this$store$order$mer2, _this$store$order26, _wallet$getUserIdenti, committed;
6160
6188
  return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6161
6189
  while (1) switch (_context59.prev = _context59.next) {
6162
6190
  case 0:
@@ -6224,7 +6252,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6224
6252
  if (state.status !== 'error') {
6225
6253
  committed = this.getCommittedWalletAssets();
6226
6254
  state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
6227
- (_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);
6255
+ (_this$store$order$mer2 = (_this$store$order26 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer2 === void 0 || _this$store$order$mer2.call(_this$store$order26, ((_wallet$getUserIdenti = wallet.getUserIdentificationCodes) === null || _wallet$getUserIdenti === void 0 ? void 0 : _wallet$getUserIdenti.call(wallet)) || [], pointCardSnapshotMergeContext);
6228
6256
  }
6229
6257
  _context59.next = 32;
6230
6258
  return this.syncSelectedWalletAssets(state);
@@ -6389,11 +6417,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6389
6417
  }, {
6390
6418
  key: "updateOrderCustomer",
6391
6419
  value: function updateOrderCustomer(customer) {
6392
- var _this$store$order$get7, _this$store$order24, _this$store$order$get8, _this$store$order25;
6420
+ var _this$store$order$get7, _this$store$order27, _this$store$order$get8, _this$store$order28;
6393
6421
  if (!this.store.order) throw new Error('order 模块未初始化');
6394
- var previousCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get7 = (_this$store$order24 = this.store.order).getTempOrder) === null || _this$store$order$get7 === void 0 ? void 0 : _this$store$order$get7.call(_this$store$order24));
6422
+ var previousCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get7 = (_this$store$order27 = this.store.order).getTempOrder) === null || _this$store$order$get7 === void 0 ? void 0 : _this$store$order$get7.call(_this$store$order27));
6395
6423
  var result = this.store.order.updateTempOrderCustomer(customer);
6396
- var nextCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get8 = (_this$store$order25 = this.store.order).getTempOrder) === null || _this$store$order$get8 === void 0 ? void 0 : _this$store$order$get8.call(_this$store$order25));
6424
+ var nextCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get8 = (_this$store$order28 = this.store.order).getTempOrder) === null || _this$store$order$get8 === void 0 ? void 0 : _this$store$order$get8.call(_this$store$order28));
6397
6425
  if (String(previousCustomerId) !== String(nextCustomerId)) {
6398
6426
  this.discountConfigCacheKey = null;
6399
6427
  this.hasManualDiscountSelection = false;
@@ -6468,8 +6496,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6468
6496
  }, {
6469
6497
  key: "getPendingWalletPaymentAmount",
6470
6498
  value: function getPendingWalletPaymentAmount() {
6471
- var _this$store$order26, _this$store$order26$g;
6472
- var payments = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ((_this$store$order26 = this.store.order) === null || _this$store$order26 === void 0 || (_this$store$order26$g = _this$store$order26.getOrderPayments) === null || _this$store$order26$g === void 0 ? void 0 : _this$store$order26$g.call(_this$store$order26)) || [];
6499
+ var _this$store$order29, _this$store$order29$g;
6500
+ var payments = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ((_this$store$order29 = this.store.order) === null || _this$store$order29 === void 0 || (_this$store$order29$g = _this$store$order29.getOrderPayments) === null || _this$store$order29$g === void 0 ? void 0 : _this$store$order29$g.call(_this$store$order29)) || [];
6473
6501
  return payments.reduce(function (total, payment) {
6474
6502
  if ((payment === null || payment === void 0 ? void 0 : payment.status) !== 'payment_pending' || (payment === null || payment === void 0 ? void 0 : payment.voucher_id) === undefined || Number(payment.voucher_id) === 0) {
6475
6503
  return total;
@@ -6487,7 +6515,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6487
6515
  key: "getCashPaymentConfig",
6488
6516
  value: (function () {
6489
6517
  var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65() {
6490
- var _this$store$order27, _this$store$order27$g, _this$store$order28, _this$store$order28$g, _this$otherParams41;
6518
+ var _this$store$order30, _this$store$order30$g, _this$store$order31, _this$store$order31$g, _this$otherParams41;
6491
6519
  var options,
6492
6520
  paymentMethods,
6493
6521
  paymentMethod,
@@ -6525,10 +6553,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6525
6553
  }
6526
6554
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u73B0\u91D1\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(options.paymentMethodId));
6527
6555
  case 12:
6528
- 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);
6556
+ amountSnapshot = (_this$store$order30 = this.store.order) === null || _this$store$order30 === void 0 || (_this$store$order30$g = _this$store$order30.getOrderAmountSnapshot) === null || _this$store$order30$g === void 0 ? void 0 : _this$store$order30$g.call(_this$store$order30);
6529
6557
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
6530
6558
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
6531
- 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';
6559
+ currency = ((_this$store$order31 = this.store.order) === null || _this$store$order31 === void 0 || (_this$store$order31$g = _this$store$order31.getTempOrder) === null || _this$store$order31$g === void 0 || (_this$store$order31$g = _this$store$order31$g.call(_this$store$order31)) === null || _this$store$order31$g === void 0 ? void 0 : _this$store$order31$g.currency_code) || ((_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41.currency) || 'USD';
6532
6560
  recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
6533
6561
  return _context65.abrupt("return", {
6534
6562
  available: Boolean(paymentMethod && amountDue > 0),
@@ -6558,8 +6586,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6558
6586
  key: "confirmWalletPayment",
6559
6587
  value: (function () {
6560
6588
  var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66() {
6561
- var _this$store$order$get9, _this$store$order29, _this$store$order$get11, _this$store$order$get12, _this$store$order31;
6562
- var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get10, _this$store$order30, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
6589
+ var _this$store$order$get9, _this$store$order32, _this$store$order$get11, _this$store$order$get12, _this$store$order34;
6590
+ var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get10, _this$store$order33, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
6563
6591
  return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6564
6592
  while (1) switch (_context66.prev = _context66.next) {
6565
6593
  case 0:
@@ -6574,7 +6602,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6574
6602
  case 4:
6575
6603
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
6576
6604
  pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
6577
- 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);
6605
+ amountSnapshot = (_this$store$order$get9 = (_this$store$order32 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.call(_this$store$order32);
6578
6606
  if (!pendingWalletAmount.lte(0)) {
6579
6607
  _context66.next = 16;
6580
6608
  break;
@@ -6594,7 +6622,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6594
6622
  }
6595
6623
  throw new Error(getSalesSubmitErrorMessage(_submitResult, '订单提交失败'));
6596
6624
  case 14:
6597
- _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);
6625
+ _latestAmountSnapshot = (_this$store$order$get10 = (_this$store$order33 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get10 === void 0 ? void 0 : _this$store$order$get10.call(_this$store$order33);
6598
6626
  return _context66.abrupt("return", {
6599
6627
  submitResult: _submitResult,
6600
6628
  payments: this.store.order.getOrderPayments(),
@@ -6660,7 +6688,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6660
6688
  error: _context66.t1 instanceof Error ? _context66.t1.message : String(_context66.t1)
6661
6689
  });
6662
6690
  case 47:
6663
- 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);
6691
+ latestAmountSnapshot = (_this$store$order$get12 = (_this$store$order34 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get12 === void 0 ? void 0 : _this$store$order$get12.call(_this$store$order34);
6664
6692
  return _context66.abrupt("return", {
6665
6693
  submitResult: submitResult,
6666
6694
  payments: this.store.order.getOrderPayments(),
@@ -6868,7 +6896,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6868
6896
  key: "commitPaymentMethodPayment",
6869
6897
  value: (function () {
6870
6898
  var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(params) {
6871
- var _this$store$order$get14, _this$store$order32, _this$store$order$get15, _params$metadata, _params$originAmount;
6899
+ var _this$store$order$get14, _this$store$order35, _this$store$order$get15, _params$metadata, _params$originAmount;
6872
6900
  var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
6873
6901
  return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6874
6902
  while (1) switch (_context68.prev = _context68.next) {
@@ -6912,7 +6940,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6912
6940
  }
6913
6941
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
6914
6942
  case 15:
6915
- amountSnapshot = (_this$store$order$get14 = (_this$store$order32 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get14 === void 0 ? void 0 : _this$store$order$get14.call(_this$store$order32);
6943
+ amountSnapshot = (_this$store$order$get14 = (_this$store$order35 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get14 === void 0 ? void 0 : _this$store$order$get14.call(_this$store$order35);
6916
6944
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
6917
6945
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
6918
6946
  if (!amountDue.lte(0)) {
@@ -7157,7 +7185,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7157
7185
  }, {
7158
7186
  key: "getQuotationCustomerScopeInfo",
7159
7187
  value: function getQuotationCustomerScopeInfo() {
7160
- var _this22 = this;
7188
+ var _this23 = this;
7161
7189
  var quotation = this.store.quotation;
7162
7190
  if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
7163
7191
  return quotation.getQuotationCustomerScopeInfo();
@@ -7169,7 +7197,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7169
7197
  }).map(function (item) {
7170
7198
  var localSeen = new Set();
7171
7199
  var customers = item.customer.filter(function (customer) {
7172
- var customerId = _this22.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
7200
+ var customerId = _this23.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
7173
7201
  if (!customerId || localSeen.has(customerId)) return false;
7174
7202
  localSeen.add(customerId);
7175
7203
  if (!customerById.has(customerId)) customerById.set(customerId, customer);
@@ -7234,7 +7262,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7234
7262
  key: "resolveProductBookingPriceGroups",
7235
7263
  value: function () {
7236
7264
  var _resolveProductBookingPriceGroups = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(paramsList, currentOrderCustomerId) {
7237
- var _this23 = this,
7265
+ var _this24 = this,
7238
7266
  _this$otherParams43;
7239
7267
  var strictDurationPricing,
7240
7268
  resolvedChannels,
@@ -7246,7 +7274,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7246
7274
  case 0:
7247
7275
  strictDurationPricing = _args73.length > 2 && _args73[2] !== undefined ? _args73[2] : false;
7248
7276
  resolvedChannels = paramsList.map(function (params) {
7249
- return _this23.getPriceQueryChannel(params.channel);
7277
+ return _this24.getPriceQueryChannel(params.channel);
7250
7278
  });
7251
7279
  authoritativeProducts = paramsList.map(function () {
7252
7280
  return null;
@@ -7254,10 +7282,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7254
7282
  groups = new Map();
7255
7283
  paramsList.forEach(function (params, index) {
7256
7284
  var _params$customer_id;
7257
- var schedule = _this23.getPriceQuerySchedule(params);
7285
+ var schedule = _this24.getPriceQuerySchedule(params);
7258
7286
  var channel = resolvedChannels[index];
7259
7287
  var customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : currentOrderCustomerId;
7260
- var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || '', _this23.normalizePriceContextCustomerId(customerId) || ''].join('|');
7288
+ var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || '', _this24.normalizePriceContextCustomerId(customerId) || ''].join('|');
7261
7289
  var group = groups.get(groupKey) || {
7262
7290
  indices: [],
7263
7291
  schedule: schedule,
@@ -7275,13 +7303,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7275
7303
  while (1) switch (_context72.prev = _context72.next) {
7276
7304
  case 0:
7277
7305
  _context72.next = 2;
7278
- return _this23.prepareProductPriceQueryContext(group.customerId);
7306
+ return _this24.prepareProductPriceQueryContext(group.customerId);
7279
7307
  case 2:
7280
7308
  priceQueries = group.indices.map(function (index) {
7281
7309
  return paramsList[index];
7282
7310
  });
7283
7311
  _context72.next = 5;
7284
- return _this23.resolveProductsForPriceQuery({
7312
+ return _this24.resolveProductsForPriceQuery({
7285
7313
  priceQueries: priceQueries,
7286
7314
  schedule: group.schedule,
7287
7315
  customerId: group.customerId,
@@ -7321,7 +7349,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7321
7349
  value: function () {
7322
7350
  var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(paramsList) {
7323
7351
  var _this$otherParams44,
7324
- _this24 = this;
7352
+ _this25 = this;
7325
7353
  var useCustomerUserPricing, isPos, quotation, currentOrderCustomerId, resolvedChannels, authoritativeProducts, plans, segmentQueries, segmentQueryIndices, segmentProducts, quotationContexts;
7326
7354
  return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7327
7355
  while (1) switch (_context74.prev = _context74.next) {
@@ -7337,7 +7365,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7337
7365
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
7338
7366
  currentOrderCustomerId = this.getCurrentOrderCustomerId();
7339
7367
  resolvedChannels = paramsList.map(function (params) {
7340
- return _this24.getPriceQueryChannel(params.channel);
7368
+ return _this25.getPriceQueryChannel(params.channel);
7341
7369
  });
7342
7370
  _context74.next = 9;
7343
7371
  return this.resolveProductBookingPriceGroups(paramsList, currentOrderCustomerId);
@@ -7402,7 +7430,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7402
7430
  });
7403
7431
  _context74.next = 23;
7404
7432
  return Promise.all(Array.from(quotationContexts.values()).map(function (context) {
7405
- return _this24.loadQuotationForPriceQuery(_objectSpread({
7433
+ return _this25.loadQuotationForPriceQuery(_objectSpread({
7406
7434
  quotation: quotation
7407
7435
  }, context));
7408
7436
  }));
@@ -7411,7 +7439,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7411
7439
  var _params$customer_id3, _authoritativeProduct2, _params$duration;
7412
7440
  var productInput = params.product || {};
7413
7441
  var authoritativeProduct = authoritativeProducts[index];
7414
- var product = _this24.mergeProductForPriceQuery(productInput, authoritativeProduct);
7442
+ var product = _this25.mergeProductForPriceQuery(productInput, authoritativeProduct);
7415
7443
  var customerId = (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId;
7416
7444
  var channel = resolvedChannels[index];
7417
7445
  var plan = plans[index];
@@ -7422,7 +7450,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7422
7450
  var prices = unitProducts.map(function (unitProduct, unitIndex) {
7423
7451
  return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
7424
7452
  channel: channel,
7425
- product: _this24.mergeProductForPriceQuery(unitIndex === 0 ? productInput : _objectSpread(_objectSpread({}, productInput), {}, {
7453
+ product: _this25.mergeProductForPriceQuery(unitIndex === 0 ? productInput : _objectSpread(_objectSpread({}, productInput), {}, {
7426
7454
  product_bundle: undefined
7427
7455
  }), unitProduct),
7428
7456
  booking: _objectSpread(_objectSpread({}, params.booking), {}, {
@@ -7448,7 +7476,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7448
7476
  product: product,
7449
7477
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
7450
7478
  customer_id: customerId,
7451
- quotation: authoritativeProduct && _this24.preferAuthoritativeProductQueryPrice() ? undefined : quotation
7479
+ quotation: authoritativeProduct && _this25.preferAuthoritativeProductQueryPrice() ? undefined : quotation
7452
7480
  }));
7453
7481
  return changedToFixed ? _objectSpread(_objectSpread({}, result), {}, {
7454
7482
  pricing_method: {
@@ -7477,8 +7505,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7477
7505
  }, {
7478
7506
  key: "validateProductVoucherSelection",
7479
7507
  value: function validateProductVoucherSelection() {
7480
- var _this$store$order33;
7481
- (_this$store$order33 = this.store.order) === null || _this$store$order33 === void 0 || _this$store$order33.validateProductVoucherSelection();
7508
+ var _this$store$order36;
7509
+ (_this$store$order36 = this.store.order) === null || _this$store$order36 === void 0 || _this$store$order36.validateProductVoucherSelection();
7482
7510
  }
7483
7511
  }, {
7484
7512
  key: "addProductToOrder",
@@ -7834,16 +7862,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7834
7862
  }, {
7835
7863
  key: "getUnfulfilledPromotions",
7836
7864
  value: function getUnfulfilledPromotions() {
7837
- var _this$store$order34;
7838
- return ((_this$store$order34 = this.store.order) === null || _this$store$order34 === void 0 ? void 0 : _this$store$order34.getUnfulfilledPromotions()) || [];
7865
+ var _this$store$order37;
7866
+ return ((_this$store$order37 = this.store.order) === null || _this$store$order37 === void 0 ? void 0 : _this$store$order37.getUnfulfilledPromotions()) || [];
7839
7867
  }
7840
7868
 
7841
7869
  /** 最近一次促销计算输出的赠品操作 diff。 */
7842
7870
  }, {
7843
7871
  key: "getLastGiftActions",
7844
7872
  value: function getLastGiftActions() {
7845
- var _this$store$order35;
7846
- return ((_this$store$order35 = this.store.order) === null || _this$store$order35 === void 0 ? void 0 : _this$store$order35.getLastGiftActions()) || null;
7873
+ var _this$store$order38;
7874
+ return ((_this$store$order38 = this.store.order) === null || _this$store$order38 === void 0 ? void 0 : _this$store$order38.getLastGiftActions()) || null;
7847
7875
  }
7848
7876
 
7849
7877
  // 获取商品列表