@pisell/pisellos 2.3.150 → 2.3.151

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 (43) hide show
  1. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
  2. package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
  3. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
  4. package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
  5. package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
  6. package/dist/model/strategy/adapter/itemRule/type.js +10 -0
  7. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  8. package/dist/modules/OpenData/types.d.ts +2 -0
  9. package/dist/modules/Order/index.d.ts +4 -2
  10. package/dist/modules/Order/index.js +115 -67
  11. package/dist/modules/Order/types.d.ts +7 -1
  12. package/dist/modules/Product/index.d.ts +1 -1
  13. package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
  14. package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
  15. package/dist/solution/BaseSales/index.d.ts +5 -1
  16. package/dist/solution/BaseSales/index.js +1116 -1021
  17. package/dist/solution/BaseSales/pickupTiming.d.ts +2 -0
  18. package/dist/solution/BaseSales/pickupTiming.js +16 -5
  19. package/dist/solution/BookingByStep/index.d.ts +2 -2
  20. package/dist/solution/BookingTicket/index.d.ts +1 -0
  21. package/dist/solution/BookingTicket/index.js +444 -425
  22. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
  23. package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
  24. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
  25. package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
  26. package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
  27. package/lib/model/strategy/adapter/itemRule/type.js +10 -0
  28. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  29. package/lib/modules/OpenData/types.d.ts +2 -0
  30. package/lib/modules/Order/index.d.ts +4 -2
  31. package/lib/modules/Order/index.js +33 -14
  32. package/lib/modules/Order/types.d.ts +7 -1
  33. package/lib/modules/Product/index.d.ts +1 -1
  34. package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
  35. package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
  36. package/lib/solution/BaseSales/index.d.ts +5 -1
  37. package/lib/solution/BaseSales/index.js +38 -2
  38. package/lib/solution/BaseSales/pickupTiming.d.ts +2 -0
  39. package/lib/solution/BaseSales/pickupTiming.js +5 -1
  40. package/lib/solution/BookingByStep/index.d.ts +2 -2
  41. package/lib/solution/BookingTicket/index.d.ts +1 -0
  42. package/lib/solution/BookingTicket/index.js +3 -0
  43. package/package.json +1 -1
@@ -38,6 +38,7 @@ import { BaseSalesHookNames } from "./types";
38
38
  import { OrderModule } from "../../modules/Order";
39
39
  import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
40
40
  import { PickupTimingController } from "./pickupTiming";
41
+ import { FulfillmentItemRulesController } from "./fulfillmentItemRules";
41
42
  import Decimal from 'decimal.js';
42
43
  import { cloneDeep, isEqual, mergeWith } from 'lodash-es';
43
44
  import { createModule } from "../BookingByStep/types";
@@ -561,6 +562,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
561
562
  _defineProperty(_assertThisInitialized(_this), "serverOrderChangeSyncEnabled", false);
562
563
  _defineProperty(_assertThisInitialized(_this), "pickupTimingEnabled", false);
563
564
  _defineProperty(_assertThisInitialized(_this), "pickupTimingController", void 0);
565
+ _defineProperty(_assertThisInitialized(_this), "fulfillmentItemRulesController", void 0);
564
566
  return _this;
565
567
  }
566
568
 
@@ -1634,11 +1636,72 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1634
1636
  }
1635
1637
  return loadPickupTimingOpenData;
1636
1638
  }())
1639
+ }, {
1640
+ key: "loadFulfillmentItemRuleOpenData",
1641
+ value: function () {
1642
+ var _loadFulfillmentItemRuleOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1643
+ var _this$otherParams$ope, _this$otherParams9, _this$otherParams10;
1644
+ var openData;
1645
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1646
+ while (1) switch (_context12.prev = _context12.next) {
1647
+ case 0:
1648
+ openData = (_this$otherParams$ope = (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.openData) !== null && _this$otherParams$ope !== void 0 ? _this$otherParams$ope : (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.dineInConfig;
1649
+ return _context12.abrupt("return", openData && _typeof(openData) === 'object' && !Array.isArray(openData) ? openData : null);
1650
+ case 2:
1651
+ case "end":
1652
+ return _context12.stop();
1653
+ }
1654
+ }, _callee12, this);
1655
+ }));
1656
+ function loadFulfillmentItemRuleOpenData() {
1657
+ return _loadFulfillmentItemRuleOpenData.apply(this, arguments);
1658
+ }
1659
+ return loadFulfillmentItemRuleOpenData;
1660
+ }()
1661
+ }, {
1662
+ key: "getFulfillmentItemRulesController",
1663
+ value: function getFulfillmentItemRulesController() {
1664
+ var _this9 = this;
1665
+ if (!this.fulfillmentItemRulesController) {
1666
+ this.fulfillmentItemRulesController = new FulfillmentItemRulesController({
1667
+ getOrder: function getOrder() {
1668
+ if (!_this9.store.order) throw new Error('order 模块未初始化');
1669
+ return _this9.store.order;
1670
+ },
1671
+ getProducts: function getProducts() {
1672
+ return _this9.store.products;
1673
+ },
1674
+ loadOpenData: function loadOpenData() {
1675
+ return _this9.loadFulfillmentItemRuleOpenData();
1676
+ },
1677
+ getScope: function getScope() {
1678
+ return _this9.getPickupTimingScope();
1679
+ },
1680
+ getOtherParams: function getOtherParams() {
1681
+ return _this9.otherParams;
1682
+ },
1683
+ fetchStrategyModels: function fetchStrategyModels(ids) {
1684
+ return _this9.request.get('/promotion', {
1685
+ skip: 1,
1686
+ num: 99,
1687
+ status: 'active',
1688
+ ids: ids
1689
+ });
1690
+ },
1691
+ reportError: function reportError(error) {
1692
+ return _this9.logWarning('履约费用策略执行失败,保留服务类型设置', {
1693
+ error: error instanceof Error ? error.message : String(error)
1694
+ });
1695
+ }
1696
+ });
1697
+ }
1698
+ return this.fulfillmentItemRulesController;
1699
+ }
1637
1700
  }, {
1638
1701
  key: "isPickupTimingEnabled",
1639
1702
  value: function isPickupTimingEnabled() {
1640
- var _this$otherParams9;
1641
- return this.pickupTimingEnabled && ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.enablePickupTiming) !== false;
1703
+ var _this$otherParams11;
1704
+ return this.pickupTimingEnabled && ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.enablePickupTiming) !== false;
1642
1705
  }
1643
1706
  }, {
1644
1707
  key: "getPickupTimingContextData",
@@ -1651,13 +1714,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1651
1714
  }, {
1652
1715
  key: "getPickupTimingScope",
1653
1716
  value: function getPickupTimingScope() {
1654
- var _this$otherParams$bus, _this$otherParams10, _this$otherParams11, _this$otherParams12;
1717
+ var _this$otherParams$bus, _this$otherParams12, _this$otherParams13, _this$otherParams14;
1655
1718
  return JSON.stringify({
1656
1719
  shop: this.getPickupTimingContextData('shop_id'),
1657
- businessCode: (_this$otherParams$bus = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.business_code,
1720
+ businessCode: (_this$otherParams$bus = (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.business_code,
1658
1721
  channel: this.getSubmitOrderSalesChannel(),
1659
1722
  timezone: this.getPickupTimingContextData('timezone'),
1660
- platform: normalizeRuntimePlatform((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.platform),
1723
+ platform: normalizeRuntimePlatform((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform),
1661
1724
  cacheId: this.cacheId
1662
1725
  });
1663
1726
  }
@@ -1670,29 +1733,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1670
1733
  }, {
1671
1734
  key: "getPickupTimingController",
1672
1735
  value: function getPickupTimingController() {
1673
- var _this9 = this;
1736
+ var _this10 = this;
1674
1737
  if (!this.pickupTimingController) {
1675
1738
  this.pickupTimingController = new PickupTimingController({
1676
1739
  getOrder: function getOrder() {
1677
- if (!_this9.store.order) throw new Error('order 模块未初始化');
1678
- return _this9.store.order;
1740
+ if (!_this10.store.order) throw new Error('order 模块未初始化');
1741
+ return _this10.store.order;
1742
+ },
1743
+ setServiceType: function setServiceType(serviceType) {
1744
+ return _this10.setServiceType(serviceType);
1679
1745
  },
1680
1746
  getSchedule: function getSchedule() {
1681
- return _this9.store.schedule;
1747
+ return _this10.store.schedule;
1682
1748
  },
1683
1749
  loadOpenData: function loadOpenData(force) {
1684
- return _this9.loadPickupTimingOpenData(force);
1750
+ return _this10.loadPickupTimingOpenData(force);
1685
1751
  },
1686
1752
  getTimezone: function getTimezone() {
1687
- var _this9$getPickupTimin;
1688
- return String((_this9$getPickupTimin = _this9.getPickupTimingContextData('timezone')) !== null && _this9$getPickupTimin !== void 0 ? _this9$getPickupTimin : '');
1753
+ var _this10$getPickupTimi;
1754
+ return String((_this10$getPickupTimi = _this10.getPickupTimingContextData('timezone')) !== null && _this10$getPickupTimi !== void 0 ? _this10$getPickupTimi : '');
1689
1755
  },
1690
1756
  getScope: function getScope() {
1691
- return _this9.getPickupTimingScope();
1757
+ return _this10.getPickupTimingScope();
1692
1758
  },
1693
1759
  isPos: function isPos() {
1694
- var _this9$otherParams;
1695
- return normalizeRuntimePlatform((_this9$otherParams = _this9.otherParams) === null || _this9$otherParams === void 0 ? void 0 : _this9$otherParams.platform) === 'pos';
1760
+ var _this10$otherParams;
1761
+ return normalizeRuntimePlatform((_this10$otherParams = _this10.otherParams) === null || _this10$otherParams === void 0 ? void 0 : _this10$otherParams.platform) === 'pos';
1696
1762
  }
1697
1763
  });
1698
1764
  }
@@ -1740,8 +1806,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1740
1806
  }, {
1741
1807
  key: "getFulfillmentRefModeConfigs",
1742
1808
  value: function getFulfillmentRefModeConfigs() {
1743
- var _this$otherParams13, _this$otherParams14, _this$store, _this$store$getOpenDa;
1744
- var candidates = [(_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.openData, (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.dineInConfig, (_this$store = this.store) === null || _this$store === void 0 || (_this$store = _this$store.openData) === null || _this$store === void 0 || (_this$store$getOpenDa = _this$store.getOpenData) === null || _this$store$getOpenDa === void 0 ? void 0 : _this$store$getOpenDa.call(_this$store)];
1809
+ var _this$otherParams15, _this$otherParams16, _this$store, _this$store$getOpenDa;
1810
+ var candidates = [(_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.openData, (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.dineInConfig, (_this$store = this.store) === null || _this$store === void 0 || (_this$store = _this$store.openData) === null || _this$store === void 0 || (_this$store$getOpenDa = _this$store.getOpenData) === null || _this$store$getOpenDa === void 0 ? void 0 : _this$store$getOpenDa.call(_this$store)];
1745
1811
  return candidates.filter(function (candidate) {
1746
1812
  return candidate && _typeof(candidate) === 'object' && !Array.isArray(candidate);
1747
1813
  });
@@ -1877,48 +1943,48 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1877
1943
  }, {
1878
1944
  key: "syncOtherParamsToSubModules",
1879
1945
  value: (function () {
1880
- var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(changedParams) {
1881
- var _this10 = this;
1946
+ var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(changedParams) {
1947
+ var _this11 = this;
1882
1948
  var _ref31,
1883
1949
  _ref31$cover,
1884
1950
  cover,
1885
- _args13 = arguments;
1886
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1887
- while (1) switch (_context13.prev = _context13.next) {
1951
+ _args14 = arguments;
1952
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1953
+ while (1) switch (_context14.prev = _context14.next) {
1888
1954
  case 0:
1889
- _ref31 = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : {}, _ref31$cover = _ref31.cover, cover = _ref31$cover === void 0 ? false : _ref31$cover;
1890
- _context13.next = 3;
1955
+ _ref31 = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {}, _ref31$cover = _ref31.cover, cover = _ref31$cover === void 0 ? false : _ref31$cover;
1956
+ _context14.next = 3;
1891
1957
  return Promise.all(Object.entries(this.store).map( /*#__PURE__*/function () {
1892
- var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref32) {
1958
+ var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref32) {
1893
1959
  var _ref34, moduleName, subModule, targetModule, nextSubModuleOtherParams;
1894
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1895
- while (1) switch (_context12.prev = _context12.next) {
1960
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1961
+ while (1) switch (_context13.prev = _context13.next) {
1896
1962
  case 0:
1897
1963
  _ref34 = _slicedToArray(_ref32, 2), moduleName = _ref34[0], subModule = _ref34[1];
1898
- if (!_this10.reusedSharedSubModuleNames.has(moduleName)) {
1899
- _context12.next = 3;
1964
+ if (!_this11.reusedSharedSubModuleNames.has(moduleName)) {
1965
+ _context13.next = 3;
1900
1966
  break;
1901
1967
  }
1902
- return _context12.abrupt("return");
1968
+ return _context13.abrupt("return");
1903
1969
  case 3:
1904
1970
  targetModule = subModule;
1905
1971
  if (!(!targetModule || typeof targetModule.updateOtherParams !== 'function')) {
1906
- _context12.next = 6;
1972
+ _context13.next = 6;
1907
1973
  break;
1908
1974
  }
1909
- return _context12.abrupt("return");
1975
+ return _context13.abrupt("return");
1910
1976
  case 6:
1911
- nextSubModuleOtherParams = _this10.buildSubModuleOtherParams(moduleName);
1912
- _context12.next = 9;
1977
+ nextSubModuleOtherParams = _this11.buildSubModuleOtherParams(moduleName);
1978
+ _context13.next = 9;
1913
1979
  return targetModule.updateOtherParams(nextSubModuleOtherParams, {
1914
1980
  changedParams: changedParams,
1915
1981
  cover: cover
1916
1982
  });
1917
1983
  case 9:
1918
1984
  case "end":
1919
- return _context12.stop();
1985
+ return _context13.stop();
1920
1986
  }
1921
- }, _callee12);
1987
+ }, _callee13);
1922
1988
  }));
1923
1989
  return function (_x12) {
1924
1990
  return _ref33.apply(this, arguments);
@@ -1926,9 +1992,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1926
1992
  }()));
1927
1993
  case 3:
1928
1994
  case "end":
1929
- return _context13.stop();
1995
+ return _context14.stop();
1930
1996
  }
1931
- }, _callee13, this);
1997
+ }, _callee14, this);
1932
1998
  }));
1933
1999
  function syncOtherParamsToSubModules(_x11) {
1934
2000
  return _syncOtherParamsToSubModules.apply(this, arguments);
@@ -1980,29 +2046,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1980
2046
  }, {
1981
2047
  key: "getPaymentNumberDevicePrefixSync",
1982
2048
  value: function getPaymentNumberDevicePrefixSync() {
1983
- var _this11 = this;
2049
+ var _this12 = this;
1984
2050
  if (!this.appPlugin) return 'LOCAL';
1985
2051
  return resolvePaymentNumberDevicePrefixFromDeviceId(function (key) {
1986
- return _this11.getAppData(key);
2052
+ return _this12.getAppData(key);
1987
2053
  });
1988
2054
  }
1989
2055
  }, {
1990
2056
  key: "getPaymentNumberDevicePrefixAsync",
1991
2057
  value: function getPaymentNumberDevicePrefixAsync() {
1992
- var _this12 = this;
2058
+ var _this13 = this;
1993
2059
  if (!this.appPlugin) return Promise.resolve('LOCAL');
1994
2060
  if (this.paymentNumberDevicePrefix) {
1995
2061
  return Promise.resolve(this.paymentNumberDevicePrefix);
1996
2062
  }
1997
2063
  return resolvePaymentNumberDevicePrefix(function (key) {
1998
- return _this12.getAppData(key);
2064
+ return _this13.getAppData(key);
1999
2065
  });
2000
2066
  }
2001
2067
  }, {
2002
2068
  key: "isMultiCurrencySettlementEnabled",
2003
2069
  value: function isMultiCurrencySettlementEnabled() {
2004
- var _this$otherParams15;
2005
- return ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.enableMultiCurrencySettlement) === true;
2070
+ var _this$otherParams17;
2071
+ return ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.enableMultiCurrencySettlement) === true;
2006
2072
  }
2007
2073
  }, {
2008
2074
  key: "isActiveVirtualSettlementOrder",
@@ -2112,28 +2178,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2112
2178
  }, {
2113
2179
  key: "initialize",
2114
2180
  value: function () {
2115
- var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(core) {
2116
- var _this$otherParams16,
2181
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(core) {
2182
+ var _this$otherParams18,
2117
2183
  _this$appPlugin2,
2118
2184
  _this$appPlugin2$getA,
2119
- _this13 = this,
2120
- _this$otherParams17;
2185
+ _this14 = this,
2186
+ _this$otherParams19;
2121
2187
  var options,
2122
2188
  app,
2123
2189
  targetCacheData,
2124
2190
  moduleNames,
2125
- _args14 = arguments;
2126
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2127
- while (1) switch (_context14.prev = _context14.next) {
2191
+ _args15 = arguments;
2192
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2193
+ while (1) switch (_context15.prev = _context15.next) {
2128
2194
  case 0:
2129
- options = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {};
2195
+ options = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : {};
2130
2196
  this.resetPickupTimingCache();
2131
2197
  this.core = core;
2132
2198
  this.initializeOptions = options || {};
2133
2199
  this.paymentNumberDevicePrefix = null;
2134
2200
  // this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
2135
2201
  this.otherParams = options.otherParams || {};
2136
- this.cacheId = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.cacheId;
2202
+ this.cacheId = (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.cacheId;
2137
2203
  this.reusedSharedSubModuleNames.clear();
2138
2204
  this.window = core.getPlugin('window');
2139
2205
  this.request = core.getPlugin('request');
@@ -2148,37 +2214,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2148
2214
  targetCacheData = this.readSessionCacheData();
2149
2215
  moduleNames = this.getRegisteredModuleNames();
2150
2216
  moduleNames.forEach(function (step) {
2151
- var reusedModule = _this13.getReusableSharedSubModule(step);
2217
+ var reusedModule = _this14.getReusableSharedSubModule(step);
2152
2218
  if (reusedModule) {
2153
- _this13.store[step] = reusedModule;
2154
- _this13.reusedSharedSubModuleNames.add(step);
2219
+ _this14.store[step] = reusedModule;
2220
+ _this14.reusedSharedSubModuleNames.add(step);
2155
2221
  return;
2156
2222
  }
2157
- var targetModule = _this13.createSubModule(step);
2223
+ var targetModule = _this14.createSubModule(step);
2158
2224
  if (!targetModule) {
2159
2225
  throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
2160
2226
  }
2161
- var hooks = _this13.getSubModuleHooks(step);
2162
- _this13.store[step] = targetModule;
2163
- _this13.core.registerModule(targetModule, _objectSpread(_objectSpread({
2164
- initialState: _this13.shouldUseSessionStorageForSubModule(step) ? (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {} : {}
2227
+ var hooks = _this14.getSubModuleHooks(step);
2228
+ _this14.store[step] = targetModule;
2229
+ _this14.core.registerModule(targetModule, _objectSpread(_objectSpread({
2230
+ initialState: _this14.shouldUseSessionStorageForSubModule(step) ? (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {} : {}
2165
2231
  }, hooks ? {
2166
2232
  hooks: hooks
2167
2233
  } : {}), {}, {
2168
- otherParams: _this13.buildSubModuleOtherParams(step)
2234
+ otherParams: _this14.buildSubModuleOtherParams(step)
2169
2235
  }));
2170
2236
  });
2171
2237
  if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
2172
- _context14.next = 20;
2238
+ _context15.next = 20;
2173
2239
  break;
2174
2240
  }
2175
- _context14.next = 20;
2241
+ _context15.next = 20;
2176
2242
  return this.store.schedule.loadAllSchedule();
2177
2243
  case 20:
2178
- if (this.store.order && typeof ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.enableTempOrderPersist) === 'boolean') {
2244
+ if (this.store.order && typeof ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.enableTempOrderPersist) === 'boolean') {
2179
2245
  this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
2180
2246
  }
2181
- _context14.next = 23;
2247
+ _context15.next = 23;
2182
2248
  return this.getPaymentMethodsAsync();
2183
2249
  case 23:
2184
2250
  this.registerPaymentMethodsChangeSync();
@@ -2186,9 +2252,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2186
2252
  this.core.effects.emit("".concat(this.name, ":onInited"), {});
2187
2253
  case 26:
2188
2254
  case "end":
2189
- return _context14.stop();
2255
+ return _context15.stop();
2190
2256
  }
2191
- }, _callee14, this);
2257
+ }, _callee15, this);
2192
2258
  }));
2193
2259
  function initialize(_x13) {
2194
2260
  return _initialize.apply(this, arguments);
@@ -2198,21 +2264,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2198
2264
  }, {
2199
2265
  key: "destroy",
2200
2266
  value: function () {
2201
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
2202
- var _this$serverOrderChan2,
2267
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
2268
+ var _this$fulfillmentItem,
2269
+ _this$serverOrderChan2,
2203
2270
  _this$paymentMethodsC2,
2204
- _this14 = this;
2205
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2206
- while (1) switch (_context15.prev = _context15.next) {
2271
+ _this15 = this;
2272
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2273
+ while (1) switch (_context16.prev = _context16.next) {
2207
2274
  case 0:
2208
2275
  this.resetPickupTimingCache();
2276
+ (_this$fulfillmentItem = this.fulfillmentItemRulesController) === null || _this$fulfillmentItem === void 0 || _this$fulfillmentItem.invalidate();
2209
2277
  (_this$serverOrderChan2 = this.serverOrderChangeUnsubscribe) === null || _this$serverOrderChan2 === void 0 || _this$serverOrderChan2.call(this);
2210
2278
  this.serverOrderChangeUnsubscribe = null;
2211
2279
  (_this$paymentMethodsC2 = this.paymentMethodsChangedUnsubscribe) === null || _this$paymentMethodsC2 === void 0 || _this$paymentMethodsC2.call(this);
2212
2280
  this.paymentMethodsChangedUnsubscribe = null;
2213
2281
  Object.keys(this.store).forEach(function (key) {
2214
- if (_this14.reusedSharedSubModuleNames.has(key)) return;
2215
- var sub = _this14.store[key];
2282
+ if (_this15.reusedSharedSubModuleNames.has(key)) return;
2283
+ var sub = _this15.store[key];
2216
2284
  if (sub && typeof sub.destroy === 'function') {
2217
2285
  try {
2218
2286
  sub.destroy();
@@ -2226,15 +2294,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2226
2294
  this.queuedServerOrderChanges = [];
2227
2295
  this.salesDetailLoadSequence += 1;
2228
2296
  this.walletAssetsRefreshSequence += 1;
2229
- _context15.next = 13;
2297
+ _context16.next = 14;
2230
2298
  return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
2231
- case 13:
2232
- _get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
2233
2299
  case 14:
2300
+ _get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
2301
+ case 15:
2234
2302
  case "end":
2235
- return _context15.stop();
2303
+ return _context16.stop();
2236
2304
  }
2237
- }, _callee15, this);
2305
+ }, _callee16, this);
2238
2306
  }));
2239
2307
  function destroy() {
2240
2308
  return _destroy.apply(this, arguments);
@@ -2251,20 +2319,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2251
2319
  }, {
2252
2320
  key: "loadSalesDetail",
2253
2321
  value: (function () {
2254
- var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(orderIdOrParams) {
2322
+ var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(orderIdOrParams) {
2255
2323
  var loadSequence, _ref39, _ref40, _ref41, _ref42, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, mergeSourceRecord, currentTempOrder, mergedRecord, record;
2256
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2257
- while (1) switch (_context16.prev = _context16.next) {
2324
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2325
+ while (1) switch (_context17.prev = _context17.next) {
2258
2326
  case 0:
2259
2327
  if (this.store.order) {
2260
- _context16.next = 2;
2328
+ _context17.next = 2;
2261
2329
  break;
2262
2330
  }
2263
2331
  throw new Error('order 模块未初始化');
2264
2332
  case 2:
2265
2333
  loadSequence = ++this.salesDetailLoadSequence;
2266
2334
  this.salesDetailLoadInFlightCount += 1;
2267
- _context16.prev = 4;
2335
+ _context17.prev = 4;
2268
2336
  params = _typeof(orderIdOrParams) === 'object' ? orderIdOrParams : {
2269
2337
  orderId: orderIdOrParams
2270
2338
  };
@@ -2272,30 +2340,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2272
2340
  preloadedSalesDetail = params.preloadedSalesDetail;
2273
2341
  lookup = (_ref39 = (_ref40 = (_ref41 = (_ref42 = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : externalSaleNumber) !== null && _ref42 !== void 0 ? _ref42 : params.orderNumber) !== null && _ref41 !== void 0 ? _ref41 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_id) !== null && _ref40 !== void 0 ? _ref40 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.external_sale_number) !== null && _ref39 !== void 0 ? _ref39 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_number;
2274
2342
  if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
2275
- _context16.next = 11;
2343
+ _context17.next = 11;
2276
2344
  break;
2277
2345
  }
2278
2346
  throw new Error('加载销售详情需要 orderId、externalSaleNumber 或 orderNumber');
2279
2347
  case 11:
2280
2348
  if (!(preloadedSalesDetail !== null && preloadedSalesDetail !== void 0)) {
2281
- _context16.next = 15;
2349
+ _context17.next = 15;
2282
2350
  break;
2283
2351
  }
2284
- _context16.t0 = preloadedSalesDetail;
2285
- _context16.next = 18;
2352
+ _context17.t0 = preloadedSalesDetail;
2353
+ _context17.next = 18;
2286
2354
  break;
2287
2355
  case 15:
2288
- _context16.next = 17;
2356
+ _context17.next = 17;
2289
2357
  return this.store.order.getSalesOrderByLookup({
2290
2358
  lookup: lookup,
2291
2359
  forceRemote: params.forceRemote
2292
2360
  });
2293
2361
  case 17:
2294
- _context16.t0 = _context16.sent;
2362
+ _context17.t0 = _context17.sent;
2295
2363
  case 18:
2296
- loadedRecord = _context16.t0;
2364
+ loadedRecord = _context17.t0;
2297
2365
  if (!(!preloadedSalesDetail && (!loadedRecord || loadedRecord.code !== 200))) {
2298
- _context16.next = 22;
2366
+ _context17.next = 22;
2299
2367
  break;
2300
2368
  }
2301
2369
  message = loadedRecord && (loadedRecord.message || loadedRecord.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(lookup);
@@ -2308,39 +2376,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2308
2376
  currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
2309
2377
  mergedRecord = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, mergeSourceRecord, 'preserve-local') : mergeSourceRecord;
2310
2378
  record = shouldFilterPendingPayments ? filterPendingPaymentsFromLoadedSalesDetail(mergedRecord) : mergedRecord;
2311
- _context16.next = 31;
2379
+ _context17.next = 31;
2312
2380
  return this.hydrateLatestLoadedSalesDetail(record, loadSequence, {
2313
2381
  hydrateSource: params.hydrateSource,
2314
2382
  merge: params.merge
2315
2383
  });
2316
2384
  case 31:
2317
- return _context16.abrupt("return", _context16.sent);
2385
+ return _context17.abrupt("return", _context17.sent);
2318
2386
  case 32:
2319
- _context16.prev = 32;
2387
+ _context17.prev = 32;
2320
2388
  this.salesDetailLoadInFlightCount = Math.max(0, this.salesDetailLoadInFlightCount - 1);
2321
2389
  if (!(this.salesDetailLoadInFlightCount === 0)) {
2322
- _context16.next = 43;
2390
+ _context17.next = 43;
2323
2391
  break;
2324
2392
  }
2325
- _context16.prev = 35;
2326
- _context16.next = 38;
2393
+ _context17.prev = 35;
2394
+ _context17.next = 38;
2327
2395
  return this.drainQueuedServerOrderChanges();
2328
2396
  case 38:
2329
- _context16.next = 43;
2397
+ _context17.next = 43;
2330
2398
  break;
2331
2399
  case 40:
2332
- _context16.prev = 40;
2333
- _context16.t1 = _context16["catch"](35);
2400
+ _context17.prev = 40;
2401
+ _context17.t1 = _context17["catch"](35);
2334
2402
  this.logError('drain queued server order changes failed', {
2335
- error: _context16.t1 instanceof Error ? _context16.t1.message : String(_context16.t1)
2403
+ error: _context17.t1 instanceof Error ? _context17.t1.message : String(_context17.t1)
2336
2404
  });
2337
2405
  case 43:
2338
- return _context16.finish(32);
2406
+ return _context17.finish(32);
2339
2407
  case 44:
2340
2408
  case "end":
2341
- return _context16.stop();
2409
+ return _context17.stop();
2342
2410
  }
2343
- }, _callee16, this, [[4,, 32, 44], [35, 40]]);
2411
+ }, _callee17, this, [[4,, 32, 44], [35, 40]]);
2344
2412
  }));
2345
2413
  function loadSalesDetail(_x14) {
2346
2414
  return _loadSalesDetail.apply(this, arguments);
@@ -2425,32 +2493,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2425
2493
  }, {
2426
2494
  key: "replaceTempOrder",
2427
2495
  value: function () {
2428
- var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(tempOrder, options) {
2496
+ var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(tempOrder, options) {
2429
2497
  var nextTempOrder;
2430
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2431
- while (1) switch (_context17.prev = _context17.next) {
2498
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2499
+ while (1) switch (_context18.prev = _context18.next) {
2432
2500
  case 0:
2433
2501
  if (this.store.order) {
2434
- _context17.next = 2;
2502
+ _context18.next = 2;
2435
2503
  break;
2436
2504
  }
2437
2505
  throw new Error('order 模块未初始化');
2438
2506
  case 2:
2439
- _context17.next = 4;
2507
+ _context18.next = 4;
2440
2508
  return this.store.order.replaceTempOrder(tempOrder, options);
2441
2509
  case 4:
2442
- nextTempOrder = _context17.sent;
2443
- _context17.next = 7;
2510
+ nextTempOrder = _context18.sent;
2511
+ _context18.next = 7;
2444
2512
  return this.effectsEmit('onTempOrderReplaced', {
2445
2513
  tempOrder: nextTempOrder
2446
2514
  });
2447
2515
  case 7:
2448
- return _context17.abrupt("return", nextTempOrder);
2516
+ return _context18.abrupt("return", nextTempOrder);
2449
2517
  case 8:
2450
2518
  case "end":
2451
- return _context17.stop();
2519
+ return _context18.stop();
2452
2520
  }
2453
- }, _callee17, this);
2521
+ }, _callee18, this);
2454
2522
  }));
2455
2523
  function replaceTempOrder(_x15, _x16) {
2456
2524
  return _replaceTempOrder.apply(this, arguments);
@@ -2508,22 +2576,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2508
2576
  }, {
2509
2577
  key: "setSalesNote",
2510
2578
  value: function () {
2511
- var _setSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(input) {
2512
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2513
- while (1) switch (_context18.prev = _context18.next) {
2579
+ var _setSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(input) {
2580
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2581
+ while (1) switch (_context19.prev = _context19.next) {
2514
2582
  case 0:
2515
2583
  if (this.store.order) {
2516
- _context18.next = 2;
2584
+ _context19.next = 2;
2517
2585
  break;
2518
2586
  }
2519
2587
  throw new Error('order 模块未初始化');
2520
2588
  case 2:
2521
- return _context18.abrupt("return", this.store.order.setSalesNote(input));
2589
+ return _context19.abrupt("return", this.store.order.setSalesNote(input));
2522
2590
  case 3:
2523
2591
  case "end":
2524
- return _context18.stop();
2592
+ return _context19.stop();
2525
2593
  }
2526
- }, _callee18, this);
2594
+ }, _callee19, this);
2527
2595
  }));
2528
2596
  function setSalesNote(_x17) {
2529
2597
  return _setSalesNote.apply(this, arguments);
@@ -2533,23 +2601,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2533
2601
  }, {
2534
2602
  key: "removeSalesNote",
2535
2603
  value: function () {
2536
- var _removeSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(uuid) {
2537
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2538
- while (1) switch (_context19.prev = _context19.next) {
2604
+ var _removeSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(uuid) {
2605
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2606
+ while (1) switch (_context20.prev = _context20.next) {
2539
2607
  case 0:
2540
2608
  if (this.store.order) {
2541
- _context19.next = 2;
2609
+ _context20.next = 2;
2542
2610
  break;
2543
2611
  }
2544
2612
  throw new Error('order 模块未初始化');
2545
2613
  case 2:
2546
- _context19.next = 4;
2614
+ _context20.next = 4;
2547
2615
  return this.store.order.removeSalesNote(uuid);
2548
2616
  case 4:
2549
2617
  case "end":
2550
- return _context19.stop();
2618
+ return _context20.stop();
2551
2619
  }
2552
- }, _callee19, this);
2620
+ }, _callee20, this);
2553
2621
  }));
2554
2622
  function removeSalesNote(_x18) {
2555
2623
  return _removeSalesNote.apply(this, arguments);
@@ -2559,23 +2627,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2559
2627
  }, {
2560
2628
  key: "clearSalesNotes",
2561
2629
  value: function () {
2562
- var _clearSalesNotes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
2563
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2564
- while (1) switch (_context20.prev = _context20.next) {
2630
+ var _clearSalesNotes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2631
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2632
+ while (1) switch (_context21.prev = _context21.next) {
2565
2633
  case 0:
2566
2634
  if (this.store.order) {
2567
- _context20.next = 2;
2635
+ _context21.next = 2;
2568
2636
  break;
2569
2637
  }
2570
2638
  throw new Error('order 模块未初始化');
2571
2639
  case 2:
2572
- _context20.next = 4;
2640
+ _context21.next = 4;
2573
2641
  return this.store.order.clearSalesNotes();
2574
2642
  case 4:
2575
2643
  case "end":
2576
- return _context20.stop();
2644
+ return _context21.stop();
2577
2645
  }
2578
- }, _callee20, this);
2646
+ }, _callee21, this);
2579
2647
  }));
2580
2648
  function clearSalesNotes() {
2581
2649
  return _clearSalesNotes.apply(this, arguments);
@@ -2628,10 +2696,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2628
2696
  }
2629
2697
  }, {
2630
2698
  key: "setServiceType",
2631
- value: function setServiceType(serviceType) {
2632
- if (!this.store.order) throw new Error('order 模块未初始化');
2633
- return this.store.order.updateTempOrderServiceType(serviceType);
2634
- }
2699
+ value: function () {
2700
+ var _setServiceType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(serviceType) {
2701
+ var serviceData;
2702
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2703
+ while (1) switch (_context22.prev = _context22.next) {
2704
+ case 0:
2705
+ if (this.store.order) {
2706
+ _context22.next = 2;
2707
+ break;
2708
+ }
2709
+ throw new Error('order 模块未初始化');
2710
+ case 2:
2711
+ serviceData = this.store.order.updateTempOrderServiceType(serviceType);
2712
+ _context22.next = 5;
2713
+ return this.getFulfillmentItemRulesController().apply(serviceType);
2714
+ case 5:
2715
+ return _context22.abrupt("return", serviceData);
2716
+ case 6:
2717
+ case "end":
2718
+ return _context22.stop();
2719
+ }
2720
+ }, _callee22, this);
2721
+ }));
2722
+ function setServiceType(_x19) {
2723
+ return _setServiceType.apply(this, arguments);
2724
+ }
2725
+ return setServiceType;
2726
+ }()
2635
2727
  }, {
2636
2728
  key: "getPickupTimingBooking",
2637
2729
  value: function getPickupTimingBooking() {
@@ -2683,40 +2775,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2683
2775
  }, {
2684
2776
  key: "addNewOrder",
2685
2777
  value: function () {
2686
- var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2778
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2687
2779
  var tempOrder;
2688
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2689
- while (1) switch (_context21.prev = _context21.next) {
2780
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2781
+ while (1) switch (_context23.prev = _context23.next) {
2690
2782
  case 0:
2691
- _context21.prev = 0;
2783
+ _context23.prev = 0;
2692
2784
  if (this.store.order) {
2693
- _context21.next = 3;
2785
+ _context23.next = 3;
2694
2786
  break;
2695
2787
  }
2696
2788
  throw new Error('order 模块未初始化');
2697
2789
  case 3:
2698
- _context21.next = 5;
2790
+ _context23.next = 5;
2699
2791
  return this.store.order.addNewOrder();
2700
2792
  case 5:
2701
- tempOrder = _context21.sent;
2793
+ tempOrder = _context23.sent;
2702
2794
  if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
2703
- _context21.next = 10;
2795
+ _context23.next = 10;
2704
2796
  break;
2705
2797
  }
2706
2798
  this.store.order.persistTempOrder();
2707
- _context21.next = 10;
2799
+ _context23.next = 10;
2708
2800
  return this.store.order.saveDraft();
2709
2801
  case 10:
2710
- return _context21.abrupt("return", tempOrder);
2802
+ return _context23.abrupt("return", tempOrder);
2711
2803
  case 13:
2712
- _context21.prev = 13;
2713
- _context21.t0 = _context21["catch"](0);
2714
- throw _context21.t0;
2804
+ _context23.prev = 13;
2805
+ _context23.t0 = _context23["catch"](0);
2806
+ throw _context23.t0;
2715
2807
  case 16:
2716
2808
  case "end":
2717
- return _context21.stop();
2809
+ return _context23.stop();
2718
2810
  }
2719
- }, _callee21, this, [[0, 13]]);
2811
+ }, _callee23, this, [[0, 13]]);
2720
2812
  }));
2721
2813
  function addNewOrder() {
2722
2814
  return _addNewOrder.apply(this, arguments);
@@ -2726,22 +2818,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2726
2818
  }, {
2727
2819
  key: "saveDraft",
2728
2820
  value: function () {
2729
- var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2730
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2731
- while (1) switch (_context22.prev = _context22.next) {
2821
+ var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2822
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2823
+ while (1) switch (_context24.prev = _context24.next) {
2732
2824
  case 0:
2733
2825
  if (this.store.order) {
2734
- _context22.next = 2;
2826
+ _context24.next = 2;
2735
2827
  break;
2736
2828
  }
2737
2829
  throw new Error('order 模块未初始化');
2738
2830
  case 2:
2739
- return _context22.abrupt("return", this.store.order.saveDraft());
2831
+ return _context24.abrupt("return", this.store.order.saveDraft());
2740
2832
  case 3:
2741
2833
  case "end":
2742
- return _context22.stop();
2834
+ return _context24.stop();
2743
2835
  }
2744
- }, _callee22, this);
2836
+ }, _callee24, this);
2745
2837
  }));
2746
2838
  function saveDraft() {
2747
2839
  return _saveDraft.apply(this, arguments);
@@ -2752,14 +2844,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2752
2844
  }, {
2753
2845
  key: "restoreOrder",
2754
2846
  value: function () {
2755
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2847
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2756
2848
  var _this$store$payment, tempOrder, appDataChanged, wallet;
2757
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2758
- while (1) switch (_context23.prev = _context23.next) {
2849
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2850
+ while (1) switch (_context25.prev = _context25.next) {
2759
2851
  case 0:
2760
- _context23.prev = 0;
2852
+ _context25.prev = 0;
2761
2853
  if (this.store.order) {
2762
- _context23.next = 3;
2854
+ _context25.next = 3;
2763
2855
  break;
2764
2856
  }
2765
2857
  throw new Error('scanOrder 解决方案需要 order 模块支持');
@@ -2772,37 +2864,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2772
2864
  this.hasManualDiscountSelection = false;
2773
2865
  wallet = (_this$store$payment = this.store.payment) === null || _this$store$payment === void 0 ? void 0 : _this$store$payment.wallet;
2774
2866
  if (!wallet) {
2775
- _context23.next = 14;
2867
+ _context25.next = 14;
2776
2868
  break;
2777
2869
  }
2778
2870
  this.walletAssetsRefreshSequence += 1;
2779
2871
  wallet.clearAllCache();
2780
- _context23.next = 14;
2872
+ _context25.next = 14;
2781
2873
  return this.publishWalletAssetsState(wallet.getWalletAssetsState());
2782
2874
  case 14:
2783
- _context23.next = 16;
2875
+ _context25.next = 16;
2784
2876
  return this.effectsEmit('onTempOrderReplaced', {
2785
2877
  tempOrder: tempOrder
2786
2878
  });
2787
2879
  case 16:
2788
2880
  if (!(appDataChanged && this.isTempOrderPersistEnabled())) {
2789
- _context23.next = 20;
2881
+ _context25.next = 20;
2790
2882
  break;
2791
2883
  }
2792
2884
  this.store.order.persistTempOrder();
2793
- _context23.next = 20;
2885
+ _context25.next = 20;
2794
2886
  return this.store.order.saveDraft();
2795
2887
  case 20:
2796
- return _context23.abrupt("return", tempOrder);
2888
+ return _context25.abrupt("return", tempOrder);
2797
2889
  case 23:
2798
- _context23.prev = 23;
2799
- _context23.t0 = _context23["catch"](0);
2800
- throw _context23.t0;
2890
+ _context25.prev = 23;
2891
+ _context25.t0 = _context25["catch"](0);
2892
+ throw _context25.t0;
2801
2893
  case 26:
2802
2894
  case "end":
2803
- return _context23.stop();
2895
+ return _context25.stop();
2804
2896
  }
2805
- }, _callee23, this, [[0, 23]]);
2897
+ }, _callee25, this, [[0, 23]]);
2806
2898
  }));
2807
2899
  function restoreOrder() {
2808
2900
  return _restoreOrder.apply(this, arguments);
@@ -2816,22 +2908,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2816
2908
  }, {
2817
2909
  key: "clearOrderCartLines",
2818
2910
  value: (function () {
2819
- var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2820
- var tempOrder;
2821
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2822
- while (1) switch (_context24.prev = _context24.next) {
2911
+ var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2912
+ var _this$fulfillmentItem2, tempOrder;
2913
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2914
+ while (1) switch (_context26.prev = _context26.next) {
2823
2915
  case 0:
2824
- _context24.prev = 0;
2916
+ _context26.prev = 0;
2825
2917
  if (this.store.order) {
2826
- _context24.next = 3;
2918
+ _context26.next = 3;
2827
2919
  break;
2828
2920
  }
2829
2921
  throw new Error('order 模块未初始化');
2830
2922
  case 3:
2831
- _context24.next = 5;
2923
+ (_this$fulfillmentItem2 = this.fulfillmentItemRulesController) === null || _this$fulfillmentItem2 === void 0 || _this$fulfillmentItem2.invalidate();
2924
+ _context26.next = 6;
2832
2925
  return this.store.order.clearOrderCartLines();
2833
- case 5:
2834
- tempOrder = _context24.sent;
2926
+ case 6:
2927
+ tempOrder = _context26.sent;
2835
2928
  if (this.currentSalesDetail) {
2836
2929
  this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
2837
2930
  products: [],
@@ -2841,29 +2934,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2841
2934
  discount_list: []
2842
2935
  });
2843
2936
  }
2844
- _context24.next = 9;
2937
+ _context26.next = 10;
2845
2938
  return this.effectsEmit('onTempOrderReplaced', {
2846
2939
  tempOrder: tempOrder
2847
2940
  });
2848
- case 9:
2941
+ case 10:
2849
2942
  if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
2850
- _context24.next = 13;
2943
+ _context26.next = 14;
2851
2944
  break;
2852
2945
  }
2853
2946
  this.store.order.persistTempOrder();
2854
- _context24.next = 13;
2947
+ _context26.next = 14;
2855
2948
  return this.store.order.saveDraft();
2856
- case 13:
2857
- return _context24.abrupt("return", tempOrder);
2858
- case 16:
2859
- _context24.prev = 16;
2860
- _context24.t0 = _context24["catch"](0);
2861
- throw _context24.t0;
2862
- case 19:
2949
+ case 14:
2950
+ return _context26.abrupt("return", tempOrder);
2951
+ case 17:
2952
+ _context26.prev = 17;
2953
+ _context26.t0 = _context26["catch"](0);
2954
+ throw _context26.t0;
2955
+ case 20:
2863
2956
  case "end":
2864
- return _context24.stop();
2957
+ return _context26.stop();
2865
2958
  }
2866
- }, _callee24, this, [[0, 16]]);
2959
+ }, _callee26, this, [[0, 17]]);
2867
2960
  }));
2868
2961
  function clearOrderCartLines() {
2869
2962
  return _clearOrderCartLines.apply(this, arguments);
@@ -2873,21 +2966,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2873
2966
  }, {
2874
2967
  key: "clearOrderForSettlementSwitch",
2875
2968
  value: (function () {
2876
- var _clearOrderForSettlementSwitch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2969
+ var _clearOrderForSettlementSwitch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2970
+ var _this$fulfillmentItem3;
2877
2971
  var tempOrder;
2878
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2879
- while (1) switch (_context25.prev = _context25.next) {
2972
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2973
+ while (1) switch (_context27.prev = _context27.next) {
2880
2974
  case 0:
2881
2975
  if (this.store.order) {
2882
- _context25.next = 2;
2976
+ _context27.next = 2;
2883
2977
  break;
2884
2978
  }
2885
2979
  throw new Error('order 模块未初始化');
2886
2980
  case 2:
2887
- _context25.next = 4;
2981
+ (_this$fulfillmentItem3 = this.fulfillmentItemRulesController) === null || _this$fulfillmentItem3 === void 0 || _this$fulfillmentItem3.invalidate();
2982
+ _context27.next = 5;
2888
2983
  return this.store.order.clearOrderForSettlementSwitch();
2889
- case 4:
2890
- tempOrder = _context25.sent;
2984
+ case 5:
2985
+ tempOrder = _context27.sent;
2891
2986
  if (this.currentSalesDetail) {
2892
2987
  this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
2893
2988
  products: [],
@@ -2898,12 +2993,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2898
2993
  payments: []
2899
2994
  });
2900
2995
  }
2901
- return _context25.abrupt("return", tempOrder);
2902
- case 7:
2996
+ return _context27.abrupt("return", tempOrder);
2997
+ case 8:
2903
2998
  case "end":
2904
- return _context25.stop();
2999
+ return _context27.stop();
2905
3000
  }
2906
- }, _callee25, this);
3001
+ }, _callee27, this);
2907
3002
  }));
2908
3003
  function clearOrderForSettlementSwitch() {
2909
3004
  return _clearOrderForSettlementSwitch.apply(this, arguments);
@@ -2920,32 +3015,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2920
3015
  }, {
2921
3016
  key: "getSummary",
2922
3017
  value: function () {
2923
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
3018
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2924
3019
  var summary;
2925
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2926
- while (1) switch (_context26.prev = _context26.next) {
3020
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3021
+ while (1) switch (_context28.prev = _context28.next) {
2927
3022
  case 0:
2928
- _context26.prev = 0;
3023
+ _context28.prev = 0;
2929
3024
  if (this.store.order) {
2930
- _context26.next = 3;
3025
+ _context28.next = 3;
2931
3026
  break;
2932
3027
  }
2933
3028
  throw new Error('order 模块未初始化');
2934
3029
  case 3:
2935
- _context26.next = 5;
3030
+ _context28.next = 5;
2936
3031
  return this.store.order.getOrderSummary();
2937
3032
  case 5:
2938
- summary = _context26.sent;
2939
- return _context26.abrupt("return", summary);
3033
+ summary = _context28.sent;
3034
+ return _context28.abrupt("return", summary);
2940
3035
  case 9:
2941
- _context26.prev = 9;
2942
- _context26.t0 = _context26["catch"](0);
2943
- throw _context26.t0;
3036
+ _context28.prev = 9;
3037
+ _context28.t0 = _context28["catch"](0);
3038
+ throw _context28.t0;
2944
3039
  case 12:
2945
3040
  case "end":
2946
- return _context26.stop();
3041
+ return _context28.stop();
2947
3042
  }
2948
- }, _callee26, this, [[0, 9]]);
3043
+ }, _callee28, this, [[0, 9]]);
2949
3044
  }));
2950
3045
  function getSummary() {
2951
3046
  return _getSummary.apply(this, arguments);
@@ -2955,10 +3050,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2955
3050
  }, {
2956
3051
  key: "getHistoricalProductDiscountList",
2957
3052
  value: function getHistoricalProductDiscountList(products) {
2958
- var _this15 = this;
3053
+ var _this16 = this;
2959
3054
  var historyDiscountList = [];
2960
3055
  products.forEach(function (item) {
2961
- if (!_this15.isPersistedOrderProduct(item)) return;
3056
+ if (!_this16.isPersistedOrderProduct(item)) return;
2962
3057
  (item.discount_list || []).forEach(function (discount) {
2963
3058
  var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
2964
3059
  var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
@@ -3018,11 +3113,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3018
3113
  }, {
3019
3114
  key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
3020
3115
  value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
3021
- var _this16 = this;
3116
+ var _this17 = this;
3022
3117
  if (params.discountAction !== 'edit') return false;
3023
3118
  if (!params.products.length) return false;
3024
3119
  var hasDraftProduct = params.products.some(function (product) {
3025
- return !_this16.isPersistedOrderProduct(product);
3120
+ return !_this17.isPersistedOrderProduct(product);
3026
3121
  });
3027
3122
  if (hasDraftProduct) return false;
3028
3123
 
@@ -3091,7 +3186,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3091
3186
  }, {
3092
3187
  key: "loadDiscountConfig",
3093
3188
  value: function () {
3094
- var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3189
+ var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3095
3190
  var _this$store$order$get2,
3096
3191
  _this$store$order8,
3097
3192
  _tempOrder$customer2,
@@ -3101,14 +3196,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3101
3196
  _discountModule$getOr,
3102
3197
  _this$store$order$get3,
3103
3198
  _this$store$order9,
3104
- _this17 = this,
3199
+ _this18 = this,
3105
3200
  _discountModule$getDi3;
3106
3201
  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$order10, _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;
3107
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3108
- while (1) switch (_context27.prev = _context27.next) {
3202
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3203
+ while (1) switch (_context29.prev = _context29.next) {
3109
3204
  case 0:
3110
3205
  if (this.store.order) {
3111
- _context27.next = 2;
3206
+ _context29.next = 2;
3112
3207
  break;
3113
3208
  }
3114
3209
  throw new Error('order 模块未初始化');
@@ -3129,18 +3224,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3129
3224
  discountConfigCacheKey = JSON.stringify([customerId, discountAction, Number(orderId) || 0, requestOrderIdentityKey]);
3130
3225
  requestEpoch = (_this$store$order$get3 = (_this$store$order9 = this.store.order).getCustomerWalletPrepareConfigEpoch) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order9);
3131
3226
  isCurrentRequest = function isCurrentRequest() {
3132
- var _this17$store$order, _this17$store$order$g, _this17$store$order2, _this17$store$order2$;
3133
- var currentTempOrder = (_this17$store$order = _this17.store.order) === null || _this17$store$order === void 0 || (_this17$store$order$g = _this17$store$order.getTempOrder) === null || _this17$store$order$g === void 0 ? void 0 : _this17$store$order$g.call(_this17$store$order);
3134
- return Boolean(currentTempOrder && (requestEpoch === undefined || ((_this17$store$order2 = _this17.store.order) === null || _this17$store$order2 === void 0 || (_this17$store$order2$ = _this17$store$order2.getCustomerWalletPrepareConfigEpoch) === null || _this17$store$order2$ === void 0 ? void 0 : _this17$store$order2$.call(_this17$store$order2)) === requestEpoch) && _this17.resolveDiscountConfigCustomerId(currentTempOrder) === customerId && _this17.getDiscountConfigOrderIdentityKey(currentTempOrder) === requestOrderIdentityKey);
3227
+ var _this18$store$order, _this18$store$order$g, _this18$store$order2, _this18$store$order2$;
3228
+ var currentTempOrder = (_this18$store$order = _this18.store.order) === null || _this18$store$order === void 0 || (_this18$store$order$g = _this18$store$order.getTempOrder) === null || _this18$store$order$g === void 0 ? void 0 : _this18$store$order$g.call(_this18$store$order);
3229
+ return Boolean(currentTempOrder && (requestEpoch === undefined || ((_this18$store$order2 = _this18.store.order) === null || _this18$store$order2 === void 0 || (_this18$store$order2$ = _this18$store$order2.getCustomerWalletPrepareConfigEpoch) === null || _this18$store$order2$ === void 0 ? void 0 : _this18$store$order2$.call(_this18$store$order2)) === requestEpoch) && _this18.resolveDiscountConfigCustomerId(currentTempOrder) === customerId && _this18.getDiscountConfigOrderIdentityKey(currentTempOrder) === requestOrderIdentityKey);
3135
3230
  };
3136
3231
  getCurrentResult = function getCurrentResult() {
3137
- var _this17$store$order3, _this17$store$order3$, _discountModule$getDi2;
3138
- var currentTempOrder = (_this17$store$order3 = _this17.store.order) === null || _this17$store$order3 === void 0 || (_this17$store$order3$ = _this17$store$order3.getTempOrder) === null || _this17$store$order3$ === void 0 ? void 0 : _this17$store$order3$.call(_this17$store$order3);
3232
+ var _this18$store$order3, _this18$store$order3$, _discountModule$getDi2;
3233
+ var currentTempOrder = (_this18$store$order3 = _this18.store.order) === null || _this18$store$order3 === void 0 || (_this18$store$order3$ = _this18$store$order3.getTempOrder) === null || _this18$store$order3$ === void 0 ? void 0 : _this18$store$order3$.call(_this18$store$order3);
3139
3234
  return {
3140
3235
  productList: (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.products) || [],
3141
3236
  discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi2 = discountModule.getDiscountList) === null || _discountModule$getDi2 === void 0 ? void 0 : _discountModule$getDi2.call(discountModule)) || [],
3142
- availableWalletIds: _this17.getAvailableWalletIds(),
3143
- virtualCurrencyList: _this17.getVirtualCurrencyList()
3237
+ availableWalletIds: _this18.getAvailableWalletIds(),
3238
+ virtualCurrencyList: _this18.getVirtualCurrencyList()
3144
3239
  };
3145
3240
  }; // Walk-In 不请求 prepare config;当前搜索/扫码券必须继续参与本次重算。
3146
3241
  // current 优先于 original,保留搜索后的最新选择与可用状态。
@@ -3154,15 +3249,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3154
3249
  return !searchedDiscountIds.has(String(discount.id));
3155
3250
  })));
3156
3251
  if (!(customerId && customerId !== 1)) {
3157
- _context27.next = 37;
3252
+ _context29.next = 37;
3158
3253
  break;
3159
3254
  }
3160
3255
  if (!(!(params !== null && params !== void 0 && params.force) && this.discountConfigCacheKey === discountConfigCacheKey)) {
3161
- _context27.next = 25;
3256
+ _context29.next = 25;
3162
3257
  break;
3163
3258
  }
3164
3259
  preparedDiscountList = originalDiscountList;
3165
- _context27.next = 37;
3260
+ _context29.next = 37;
3166
3261
  break;
3167
3262
  case 25:
3168
3263
  prepareConfigPromise = this.store.order.loadDiscountConfig({
@@ -3172,58 +3267,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3172
3267
  apply: false
3173
3268
  }); // OrderModule increments this epoch synchronously before its first await.
3174
3269
  requestEpoch = (_this$store$order$get4 = (_this$store$order10 = this.store.order).getCustomerWalletPrepareConfigEpoch) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order10);
3175
- _context27.next = 29;
3270
+ _context29.next = 29;
3176
3271
  return prepareConfigPromise;
3177
3272
  case 29:
3178
- preparedDiscountList = _context27.sent;
3273
+ preparedDiscountList = _context29.sent;
3179
3274
  if (isCurrentRequest()) {
3180
- _context27.next = 32;
3275
+ _context29.next = 32;
3181
3276
  break;
3182
3277
  }
3183
- return _context27.abrupt("return", getCurrentResult());
3278
+ return _context29.abrupt("return", getCurrentResult());
3184
3279
  case 32:
3185
- _context27.next = 34;
3280
+ _context29.next = 34;
3186
3281
  return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
3187
3282
  case 34:
3188
3283
  if (isCurrentRequest()) {
3189
- _context27.next = 36;
3284
+ _context29.next = 36;
3190
3285
  break;
3191
3286
  }
3192
- return _context27.abrupt("return", getCurrentResult());
3287
+ return _context29.abrupt("return", getCurrentResult());
3193
3288
  case 36:
3194
3289
  this.discountConfigCacheKey = discountConfigCacheKey;
3195
3290
  case 37:
3196
3291
  if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
3197
- _context27.next = 51;
3292
+ _context29.next = 51;
3198
3293
  break;
3199
3294
  }
3200
3295
  if (isCurrentRequest()) {
3201
- _context27.next = 40;
3296
+ _context29.next = 40;
3202
3297
  break;
3203
3298
  }
3204
- return _context27.abrupt("return", getCurrentResult());
3299
+ return _context29.abrupt("return", getCurrentResult());
3205
3300
  case 40:
3206
- _context27.next = 42;
3301
+ _context29.next = 42;
3207
3302
  return discountModule === null || discountModule === void 0 || (_discountModule$setOr2 = discountModule.setOriginalDiscountList) === null || _discountModule$setOr2 === void 0 ? void 0 : _discountModule$setOr2.call(discountModule, []);
3208
3303
  case 42:
3209
3304
  if (isCurrentRequest()) {
3210
- _context27.next = 44;
3305
+ _context29.next = 44;
3211
3306
  break;
3212
3307
  }
3213
- return _context27.abrupt("return", getCurrentResult());
3308
+ return _context29.abrupt("return", getCurrentResult());
3214
3309
  case 44:
3215
- _context27.next = 46;
3310
+ _context29.next = 46;
3216
3311
  return discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []);
3217
3312
  case 46:
3218
3313
  if (isCurrentRequest()) {
3219
- _context27.next = 48;
3314
+ _context29.next = 48;
3220
3315
  break;
3221
3316
  }
3222
- return _context27.abrupt("return", getCurrentResult());
3317
+ return _context29.abrupt("return", getCurrentResult());
3223
3318
  case 48:
3224
3319
  tempOrder.discount_list = [];
3225
3320
  tempOrder.shop_discount = '0.00';
3226
- return _context27.abrupt("return", {
3321
+ return _context29.abrupt("return", {
3227
3322
  productList: tempOrder.products || [],
3228
3323
  discountList: [],
3229
3324
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3231,10 +3326,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3231
3326
  });
3232
3327
  case 51:
3233
3328
  if (!(hasManualDiscountSelection && currentDiscountList.length)) {
3234
- _context27.next = 53;
3329
+ _context29.next = 53;
3235
3330
  break;
3236
3331
  }
3237
- return _context27.abrupt("return", {
3332
+ return _context29.abrupt("return", {
3238
3333
  productList: tempOrder.products || [],
3239
3334
  discountList: currentDiscountList,
3240
3335
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3244,19 +3339,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3244
3339
  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 || []);
3245
3340
  nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
3246
3341
  if (isCurrentRequest()) {
3247
- _context27.next = 57;
3342
+ _context29.next = 57;
3248
3343
  break;
3249
3344
  }
3250
- return _context27.abrupt("return", getCurrentResult());
3345
+ return _context29.abrupt("return", getCurrentResult());
3251
3346
  case 57:
3252
- _context27.next = 59;
3347
+ _context29.next = 59;
3253
3348
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3254
3349
  case 59:
3255
3350
  if (isCurrentRequest()) {
3256
- _context27.next = 61;
3351
+ _context29.next = 61;
3257
3352
  break;
3258
3353
  }
3259
- return _context27.abrupt("return", getCurrentResult());
3354
+ return _context29.abrupt("return", getCurrentResult());
3260
3355
  case 61:
3261
3356
  shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
3262
3357
  discountAction: discountAction,
@@ -3265,28 +3360,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3265
3360
  nextDiscountList: nextDiscountList
3266
3361
  });
3267
3362
  if (!shouldSkipAutoApplyFetchedDiscounts) {
3268
- _context27.next = 75;
3363
+ _context29.next = 75;
3269
3364
  break;
3270
3365
  }
3271
- _context27.next = 65;
3366
+ _context29.next = 65;
3272
3367
  return this.store.order.recalculateSummary({
3273
3368
  createIfMissing: true
3274
3369
  });
3275
3370
  case 65:
3276
3371
  if (isCurrentRequest()) {
3277
- _context27.next = 67;
3372
+ _context29.next = 67;
3278
3373
  break;
3279
3374
  }
3280
- return _context27.abrupt("return", getCurrentResult());
3375
+ return _context29.abrupt("return", getCurrentResult());
3281
3376
  case 67:
3282
3377
  this.store.order.persistTempOrder();
3283
3378
  if (isCurrentRequest()) {
3284
- _context27.next = 70;
3379
+ _context29.next = 70;
3285
3380
  break;
3286
3381
  }
3287
- return _context27.abrupt("return", getCurrentResult());
3382
+ return _context29.abrupt("return", getCurrentResult());
3288
3383
  case 70:
3289
- _context27.next = 72;
3384
+ _context29.next = 72;
3290
3385
  return this.effectsEmit('onDiscountApplied', {
3291
3386
  productList: tempOrder.products || [],
3292
3387
  discountList: nextDiscountList,
@@ -3295,12 +3390,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3295
3390
  });
3296
3391
  case 72:
3297
3392
  if (isCurrentRequest()) {
3298
- _context27.next = 74;
3393
+ _context29.next = 74;
3299
3394
  break;
3300
3395
  }
3301
- return _context27.abrupt("return", getCurrentResult());
3396
+ return _context29.abrupt("return", getCurrentResult());
3302
3397
  case 74:
3303
- return _context27.abrupt("return", {
3398
+ return _context29.abrupt("return", {
3304
3399
  productList: tempOrder.products || [],
3305
3400
  discountList: nextDiscountList,
3306
3401
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3308,14 +3403,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3308
3403
  });
3309
3404
  case 75:
3310
3405
  if (!rulesModule) {
3311
- _context27.next = 117;
3406
+ _context29.next = 117;
3312
3407
  break;
3313
3408
  }
3314
3409
  if (isCurrentRequest()) {
3315
- _context27.next = 78;
3410
+ _context29.next = 78;
3316
3411
  break;
3317
3412
  }
3318
- return _context27.abrupt("return", getCurrentResult());
3413
+ return _context29.abrupt("return", getCurrentResult());
3319
3414
  case 78:
3320
3415
  orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
3321
3416
  result = rulesModule.calcDiscount({
@@ -3334,21 +3429,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3334
3429
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
3335
3430
  }
3336
3431
  _iterator3 = _createForOfIteratorHelper(tempOrder.products || []);
3337
- _context27.prev = 82;
3432
+ _context29.prev = 82;
3338
3433
  _iterator3.s();
3339
3434
  case 84:
3340
3435
  if ((_step3 = _iterator3.n()).done) {
3341
- _context27.next = 99;
3436
+ _context29.next = 99;
3342
3437
  break;
3343
3438
  }
3344
3439
  product = _step3.value;
3345
3440
  productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
3346
3441
  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;
3347
3442
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
3348
- _context27.next = 90;
3443
+ _context29.next = 90;
3349
3444
  break;
3350
3445
  }
3351
- return _context27.abrupt("continue", 97);
3446
+ return _context29.abrupt("continue", 97);
3352
3447
  case 90:
3353
3448
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
3354
3449
  return sum + Number(pd.amount || 0);
@@ -3366,70 +3461,70 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3366
3461
  bundle: product.product_bundle
3367
3462
  });
3368
3463
  case 97:
3369
- _context27.next = 84;
3464
+ _context29.next = 84;
3370
3465
  break;
3371
3466
  case 99:
3372
- _context27.next = 104;
3467
+ _context29.next = 104;
3373
3468
  break;
3374
3469
  case 101:
3375
- _context27.prev = 101;
3376
- _context27.t0 = _context27["catch"](82);
3377
- _iterator3.e(_context27.t0);
3470
+ _context29.prev = 101;
3471
+ _context29.t0 = _context29["catch"](82);
3472
+ _iterator3.e(_context29.t0);
3378
3473
  case 104:
3379
- _context27.prev = 104;
3474
+ _context29.prev = 104;
3380
3475
  _iterator3.f();
3381
- return _context27.finish(104);
3476
+ return _context29.finish(104);
3382
3477
  case 107:
3383
3478
  if (!result.discountList) {
3384
- _context27.next = 117;
3479
+ _context29.next = 117;
3385
3480
  break;
3386
3481
  }
3387
3482
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
3388
3483
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
3389
3484
  if (isCurrentRequest()) {
3390
- _context27.next = 112;
3485
+ _context29.next = 112;
3391
3486
  break;
3392
3487
  }
3393
- return _context27.abrupt("return", getCurrentResult());
3488
+ return _context29.abrupt("return", getCurrentResult());
3394
3489
  case 112:
3395
- _context27.next = 114;
3490
+ _context29.next = 114;
3396
3491
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3397
3492
  case 114:
3398
3493
  if (isCurrentRequest()) {
3399
- _context27.next = 116;
3494
+ _context29.next = 116;
3400
3495
  break;
3401
3496
  }
3402
- return _context27.abrupt("return", getCurrentResult());
3497
+ return _context29.abrupt("return", getCurrentResult());
3403
3498
  case 116:
3404
3499
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
3405
3500
  return discount.isSelected;
3406
3501
  });
3407
3502
  case 117:
3408
3503
  if (isCurrentRequest()) {
3409
- _context27.next = 119;
3504
+ _context29.next = 119;
3410
3505
  break;
3411
3506
  }
3412
- return _context27.abrupt("return", getCurrentResult());
3507
+ return _context29.abrupt("return", getCurrentResult());
3413
3508
  case 119:
3414
- _context27.next = 121;
3509
+ _context29.next = 121;
3415
3510
  return this.store.order.recalculateSummary({
3416
3511
  createIfMissing: true
3417
3512
  });
3418
3513
  case 121:
3419
3514
  if (isCurrentRequest()) {
3420
- _context27.next = 123;
3515
+ _context29.next = 123;
3421
3516
  break;
3422
3517
  }
3423
- return _context27.abrupt("return", getCurrentResult());
3518
+ return _context29.abrupt("return", getCurrentResult());
3424
3519
  case 123:
3425
3520
  this.store.order.persistTempOrder();
3426
3521
  if (isCurrentRequest()) {
3427
- _context27.next = 126;
3522
+ _context29.next = 126;
3428
3523
  break;
3429
3524
  }
3430
- return _context27.abrupt("return", getCurrentResult());
3525
+ return _context29.abrupt("return", getCurrentResult());
3431
3526
  case 126:
3432
- _context27.next = 128;
3527
+ _context29.next = 128;
3433
3528
  return this.effectsEmit('onDiscountApplied', {
3434
3529
  productList: tempOrder.products || [],
3435
3530
  discountList: nextDiscountList,
@@ -3438,12 +3533,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3438
3533
  });
3439
3534
  case 128:
3440
3535
  if (isCurrentRequest()) {
3441
- _context27.next = 130;
3536
+ _context29.next = 130;
3442
3537
  break;
3443
3538
  }
3444
- return _context27.abrupt("return", getCurrentResult());
3539
+ return _context29.abrupt("return", getCurrentResult());
3445
3540
  case 130:
3446
- return _context27.abrupt("return", {
3541
+ return _context29.abrupt("return", {
3447
3542
  productList: tempOrder.products || [],
3448
3543
  discountList: nextDiscountList,
3449
3544
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3451,11 +3546,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3451
3546
  });
3452
3547
  case 131:
3453
3548
  case "end":
3454
- return _context27.stop();
3549
+ return _context29.stop();
3455
3550
  }
3456
- }, _callee27, this, [[82, 101, 104, 107]]);
3551
+ }, _callee29, this, [[82, 101, 104, 107]]);
3457
3552
  }));
3458
- function loadDiscountConfig(_x19) {
3553
+ function loadDiscountConfig(_x20) {
3459
3554
  return _loadDiscountConfig.apply(this, arguments);
3460
3555
  }
3461
3556
  return loadDiscountConfig;
@@ -3477,21 +3572,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3477
3572
  }, {
3478
3573
  key: "bestDiscount",
3479
3574
  value: function () {
3480
- var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(cb) {
3575
+ var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(cb) {
3481
3576
  var _discountModule$getOr2, _discountModule$getDi4;
3482
3577
  var tempOrder, _result2, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _orderStore$summary2, orderTotalAmount;
3483
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3484
- while (1) switch (_context28.prev = _context28.next) {
3578
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3579
+ while (1) switch (_context30.prev = _context30.next) {
3485
3580
  case 0:
3486
3581
  if (this.store.order) {
3487
- _context28.next = 2;
3582
+ _context30.next = 2;
3488
3583
  break;
3489
3584
  }
3490
3585
  throw new Error('order 模块未初始化');
3491
3586
  case 2:
3492
3587
  tempOrder = this.store.order.ensureTempOrder();
3493
3588
  if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
3494
- _context28.next = 7;
3589
+ _context30.next = 7;
3495
3590
  break;
3496
3591
  }
3497
3592
  _result2 = {
@@ -3499,7 +3594,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3499
3594
  discountList: []
3500
3595
  };
3501
3596
  cb === null || cb === void 0 || cb(_result2);
3502
- return _context28.abrupt("return", _result2);
3597
+ return _context30.abrupt("return", _result2);
3503
3598
  case 7:
3504
3599
  orderStore = this.store.order.store || {};
3505
3600
  discountModule = orderStore.discount;
@@ -3511,11 +3606,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3511
3606
  productList: tempOrder.products || [],
3512
3607
  discountList: nextDiscountList
3513
3608
  };
3514
- _context28.next = 16;
3609
+ _context30.next = 16;
3515
3610
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3516
3611
  case 16:
3517
3612
  if (!rulesModule) {
3518
- _context28.next = 27;
3613
+ _context30.next = 27;
3519
3614
  break;
3520
3615
  }
3521
3616
  orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
@@ -3534,12 +3629,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3534
3629
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
3535
3630
  }
3536
3631
  if (!result.discountList) {
3537
- _context28.next = 27;
3632
+ _context30.next = 27;
3538
3633
  break;
3539
3634
  }
3540
3635
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
3541
3636
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
3542
- _context28.next = 25;
3637
+ _context30.next = 25;
3543
3638
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3544
3639
  case 25:
3545
3640
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
@@ -3550,13 +3645,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3550
3645
  discountList: nextDiscountList
3551
3646
  };
3552
3647
  case 27:
3553
- _context28.next = 29;
3648
+ _context30.next = 29;
3554
3649
  return this.store.order.recalculateSummary({
3555
3650
  createIfMissing: true
3556
3651
  });
3557
3652
  case 29:
3558
3653
  this.store.order.persistTempOrder();
3559
- _context28.next = 32;
3654
+ _context30.next = 32;
3560
3655
  return this.effectsEmit('onDiscountApplied', {
3561
3656
  productList: tempOrder.products || [],
3562
3657
  discountList: nextDiscountList,
@@ -3565,14 +3660,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3565
3660
  });
3566
3661
  case 32:
3567
3662
  cb === null || cb === void 0 || cb(result);
3568
- return _context28.abrupt("return", result);
3663
+ return _context30.abrupt("return", result);
3569
3664
  case 34:
3570
3665
  case "end":
3571
- return _context28.stop();
3666
+ return _context30.stop();
3572
3667
  }
3573
- }, _callee28, this);
3668
+ }, _callee30, this);
3574
3669
  }));
3575
- function bestDiscount(_x20) {
3670
+ function bestDiscount(_x21) {
3576
3671
  return _bestDiscount.apply(this, arguments);
3577
3672
  }
3578
3673
  return bestDiscount;
@@ -3601,41 +3696,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3601
3696
  }, {
3602
3697
  key: "replaceDiscountStoreLists",
3603
3698
  value: (function () {
3604
- var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3699
+ var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3605
3700
  var _store2;
3606
3701
  var discountModule;
3607
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3608
- while (1) switch (_context29.prev = _context29.next) {
3702
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3703
+ while (1) switch (_context31.prev = _context31.next) {
3609
3704
  case 0:
3610
3705
  if (this.store.order) {
3611
- _context29.next = 2;
3706
+ _context31.next = 2;
3612
3707
  break;
3613
3708
  }
3614
3709
  throw new Error('order 模块未初始化');
3615
3710
  case 2:
3616
3711
  discountModule = (_store2 = this.store.order.store) === null || _store2 === void 0 ? void 0 : _store2.discount;
3617
3712
  if (discountModule) {
3618
- _context29.next = 5;
3713
+ _context31.next = 5;
3619
3714
  break;
3620
3715
  }
3621
- return _context29.abrupt("return");
3716
+ return _context31.abrupt("return");
3622
3717
  case 5:
3623
3718
  if (!params.originalDiscountList) {
3624
- _context29.next = 8;
3719
+ _context31.next = 8;
3625
3720
  break;
3626
3721
  }
3627
- _context29.next = 8;
3722
+ _context31.next = 8;
3628
3723
  return discountModule.setOriginalDiscountList(params.originalDiscountList);
3629
3724
  case 8:
3630
- _context29.next = 10;
3725
+ _context31.next = 10;
3631
3726
  return discountModule.setDiscountList(params.discountList);
3632
3727
  case 10:
3633
3728
  case "end":
3634
- return _context29.stop();
3729
+ return _context31.stop();
3635
3730
  }
3636
- }, _callee29, this);
3731
+ }, _callee31, this);
3637
3732
  }));
3638
- function replaceDiscountStoreLists(_x21) {
3733
+ function replaceDiscountStoreLists(_x22) {
3639
3734
  return _replaceDiscountStoreLists.apply(this, arguments);
3640
3735
  }
3641
3736
  return replaceDiscountStoreLists;
@@ -3643,34 +3738,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3643
3738
  }, {
3644
3739
  key: "scanPromotionCode",
3645
3740
  value: function () {
3646
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(code, customerId) {
3741
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(code, customerId) {
3647
3742
  var raw, tempOrder;
3648
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3649
- while (1) switch (_context30.prev = _context30.next) {
3743
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3744
+ while (1) switch (_context32.prev = _context32.next) {
3650
3745
  case 0:
3651
- _context30.prev = 0;
3746
+ _context32.prev = 0;
3652
3747
  if (this.store.order) {
3653
- _context30.next = 3;
3748
+ _context32.next = 3;
3654
3749
  break;
3655
3750
  }
3656
3751
  throw new Error('order 模块未初始化');
3657
3752
  case 3:
3658
- _context30.next = 5;
3753
+ _context32.next = 5;
3659
3754
  return this.store.order.scanCode(code, customerId);
3660
3755
  case 5:
3661
- raw = _context30.sent;
3756
+ raw = _context32.sent;
3662
3757
  if (!raw.isAvailable) {
3663
- _context30.next = 13;
3758
+ _context32.next = 13;
3664
3759
  break;
3665
3760
  }
3666
- _context30.next = 9;
3761
+ _context32.next = 9;
3667
3762
  return this.store.order.recalculateSummary({
3668
3763
  createIfMissing: true
3669
3764
  });
3670
3765
  case 9:
3671
3766
  this.store.order.persistTempOrder();
3672
3767
  tempOrder = this.store.order.ensureTempOrder();
3673
- _context30.next = 13;
3768
+ _context32.next = 13;
3674
3769
  return this.effectsEmit('onDiscountApplied', {
3675
3770
  productList: tempOrder.products || [],
3676
3771
  discountList: this.store.order.getDiscountList(),
@@ -3678,7 +3773,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3678
3773
  tempOrder: tempOrder
3679
3774
  });
3680
3775
  case 13:
3681
- return _context30.abrupt("return", _objectSpread(_objectSpread({
3776
+ return _context32.abrupt("return", _objectSpread(_objectSpread({
3682
3777
  isAvailable: raw.isAvailable
3683
3778
  }, raw.isAccepted !== undefined ? {
3684
3779
  isAccepted: raw.isAccepted
@@ -3688,16 +3783,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3688
3783
  scannedDiscountList: raw.scannedDiscountList
3689
3784
  }));
3690
3785
  case 16:
3691
- _context30.prev = 16;
3692
- _context30.t0 = _context30["catch"](0);
3693
- throw _context30.t0;
3786
+ _context32.prev = 16;
3787
+ _context32.t0 = _context32["catch"](0);
3788
+ throw _context32.t0;
3694
3789
  case 19:
3695
3790
  case "end":
3696
- return _context30.stop();
3791
+ return _context32.stop();
3697
3792
  }
3698
- }, _callee30, this, [[0, 16]]);
3793
+ }, _callee32, this, [[0, 16]]);
3699
3794
  }));
3700
- function scanPromotionCode(_x22, _x23) {
3795
+ function scanPromotionCode(_x23, _x24) {
3701
3796
  return _scanPromotionCode.apply(this, arguments);
3702
3797
  }
3703
3798
  return scanPromotionCode;
@@ -3705,35 +3800,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3705
3800
  }, {
3706
3801
  key: "setDiscountSelected",
3707
3802
  value: function () {
3708
- var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3803
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3709
3804
  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;
3710
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3711
- while (1) switch (_context31.prev = _context31.next) {
3805
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3806
+ while (1) switch (_context33.prev = _context33.next) {
3712
3807
  case 0:
3713
- _context31.prev = 0;
3808
+ _context33.prev = 0;
3714
3809
  if (this.store.order) {
3715
- _context31.next = 3;
3810
+ _context33.next = 3;
3716
3811
  break;
3717
3812
  }
3718
3813
  throw new Error('order 模块未初始化');
3719
3814
  case 3:
3720
3815
  currentOrder = this.store.order.ensureTempOrder();
3721
3816
  if (!this.isActiveVirtualSettlementOrder(currentOrder)) {
3722
- _context31.next = 13;
3817
+ _context33.next = 13;
3723
3818
  break;
3724
3819
  }
3725
3820
  currentOrder.discount_list = [];
3726
3821
  currentOrder.shop_discount = '0.00';
3727
- _context31.next = 9;
3822
+ _context33.next = 9;
3728
3823
  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, []);
3729
3824
  case 9:
3730
- _context31.next = 11;
3825
+ _context33.next = 11;
3731
3826
  return this.store.order.recalculateSummary({
3732
3827
  createIfMissing: true
3733
3828
  });
3734
3829
  case 11:
3735
3830
  this.store.order.persistTempOrder();
3736
- return _context31.abrupt("return");
3831
+ return _context33.abrupt("return");
3737
3832
  case 13:
3738
3833
  list = this.store.order.getDiscountList();
3739
3834
  updated = list.map(function (d) {
@@ -3748,7 +3843,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3748
3843
  _discountModule = orderStore.discount;
3749
3844
  rulesModule = orderStore.rules;
3750
3845
  nextDiscountList = updated;
3751
- _context31.next = 23;
3846
+ _context33.next = 23;
3752
3847
  return _discountModule === null || _discountModule === void 0 ? void 0 : _discountModule.setDiscountList(updated);
3753
3848
  case 23:
3754
3849
  if (rulesModule) {
@@ -3810,21 +3905,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3810
3905
  });
3811
3906
  };
3812
3907
  _iterator5 = _createForOfIteratorHelper(tempOrder.products);
3813
- _context31.prev = 27;
3908
+ _context33.prev = 27;
3814
3909
  _iterator5.s();
3815
3910
  case 29:
3816
3911
  if ((_step5 = _iterator5.n()).done) {
3817
- _context31.next = 46;
3912
+ _context33.next = 46;
3818
3913
  break;
3819
3914
  }
3820
3915
  product = _step5.value;
3821
3916
  productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
3822
3917
  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;
3823
3918
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
3824
- _context31.next = 35;
3919
+ _context33.next = 35;
3825
3920
  break;
3826
3921
  }
3827
- return _context31.abrupt("continue", 44);
3922
+ return _context33.abrupt("continue", 44);
3828
3923
  case 35:
3829
3924
  product.discount_list = filterSelectedDiscountDetails(product.discount_list);
3830
3925
  if (Array.isArray(product.product_bundle)) {
@@ -3860,28 +3955,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3860
3955
  bundle: product.product_bundle
3861
3956
  });
3862
3957
  case 44:
3863
- _context31.next = 29;
3958
+ _context33.next = 29;
3864
3959
  break;
3865
3960
  case 46:
3866
- _context31.next = 51;
3961
+ _context33.next = 51;
3867
3962
  break;
3868
3963
  case 48:
3869
- _context31.prev = 48;
3870
- _context31.t0 = _context31["catch"](27);
3871
- _iterator5.e(_context31.t0);
3964
+ _context33.prev = 48;
3965
+ _context33.t0 = _context33["catch"](27);
3966
+ _iterator5.e(_context33.t0);
3872
3967
  case 51:
3873
- _context31.prev = 51;
3968
+ _context33.prev = 51;
3874
3969
  _iterator5.f();
3875
- return _context31.finish(51);
3970
+ return _context33.finish(51);
3876
3971
  case 54:
3877
3972
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
3878
- _context31.next = 57;
3973
+ _context33.next = 57;
3879
3974
  return _discountModule === null || _discountModule === void 0 ? void 0 : _discountModule.setDiscountList(nextDiscountList);
3880
3975
  case 57:
3881
3976
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
3882
3977
  return d.isSelected;
3883
3978
  });
3884
- _context31.next = 60;
3979
+ _context33.next = 60;
3885
3980
  return this.store.order.recalculateSummary({
3886
3981
  createIfMissing: true
3887
3982
  });
@@ -3893,19 +3988,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3893
3988
  selectedDiscountList: tempOrder.discount_list,
3894
3989
  tempOrder: tempOrder
3895
3990
  });
3896
- _context31.next = 67;
3991
+ _context33.next = 67;
3897
3992
  break;
3898
3993
  case 64:
3899
- _context31.prev = 64;
3900
- _context31.t1 = _context31["catch"](0);
3901
- throw _context31.t1;
3994
+ _context33.prev = 64;
3995
+ _context33.t1 = _context33["catch"](0);
3996
+ throw _context33.t1;
3902
3997
  case 67:
3903
3998
  case "end":
3904
- return _context31.stop();
3999
+ return _context33.stop();
3905
4000
  }
3906
- }, _callee31, this, [[0, 64], [27, 48, 51, 54]]);
4001
+ }, _callee33, this, [[0, 64], [27, 48, 51, 54]]);
3907
4002
  }));
3908
- function setDiscountSelected(_x24) {
4003
+ function setDiscountSelected(_x25) {
3909
4004
  return _setDiscountSelected.apply(this, arguments);
3910
4005
  }
3911
4006
  return setDiscountSelected;
@@ -3913,23 +4008,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3913
4008
  }, {
3914
4009
  key: "applyDiscountCalculationResult",
3915
4010
  value: function () {
3916
- var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(result) {
4011
+ var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(result) {
3917
4012
  var tempOrder, orderStore, _discountModule2;
3918
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3919
- while (1) switch (_context32.prev = _context32.next) {
4013
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4014
+ while (1) switch (_context34.prev = _context34.next) {
3920
4015
  case 0:
3921
- _context32.prev = 0;
4016
+ _context34.prev = 0;
3922
4017
  if (this.store.order) {
3923
- _context32.next = 3;
4018
+ _context34.next = 3;
3924
4019
  break;
3925
4020
  }
3926
4021
  throw new Error('order 模块未初始化');
3927
4022
  case 3:
3928
4023
  if (result) {
3929
- _context32.next = 5;
4024
+ _context34.next = 5;
3930
4025
  break;
3931
4026
  }
3932
- return _context32.abrupt("return");
4027
+ return _context34.abrupt("return");
3933
4028
  case 5:
3934
4029
  tempOrder = this.store.order.ensureTempOrder();
3935
4030
  orderStore = this.store.order.store || {};
@@ -3938,24 +4033,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3938
4033
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
3939
4034
  }
3940
4035
  if (!result.discountList) {
3941
- _context32.next = 14;
4036
+ _context34.next = 14;
3942
4037
  break;
3943
4038
  }
3944
4039
  OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
3945
- _context32.next = 13;
4040
+ _context34.next = 13;
3946
4041
  return _discountModule2 === null || _discountModule2 === void 0 ? void 0 : _discountModule2.setDiscountList(result.discountList);
3947
4042
  case 13:
3948
4043
  tempOrder.discount_list = result.discountList.filter(function (discount) {
3949
4044
  return discount.isSelected;
3950
4045
  });
3951
4046
  case 14:
3952
- _context32.next = 16;
4047
+ _context34.next = 16;
3953
4048
  return this.store.order.recalculateSummary({
3954
4049
  createIfMissing: true
3955
4050
  });
3956
4051
  case 16:
3957
4052
  this.store.order.persistTempOrder();
3958
- _context32.next = 19;
4053
+ _context34.next = 19;
3959
4054
  return this.effectsEmit('onDiscountApplied', {
3960
4055
  productList: tempOrder.products || [],
3961
4056
  discountList: result.discountList || [],
@@ -3963,19 +4058,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3963
4058
  tempOrder: tempOrder
3964
4059
  });
3965
4060
  case 19:
3966
- _context32.next = 24;
4061
+ _context34.next = 24;
3967
4062
  break;
3968
4063
  case 21:
3969
- _context32.prev = 21;
3970
- _context32.t0 = _context32["catch"](0);
3971
- throw _context32.t0;
4064
+ _context34.prev = 21;
4065
+ _context34.t0 = _context34["catch"](0);
4066
+ throw _context34.t0;
3972
4067
  case 24:
3973
4068
  case "end":
3974
- return _context32.stop();
4069
+ return _context34.stop();
3975
4070
  }
3976
- }, _callee32, this, [[0, 21]]);
4071
+ }, _callee34, this, [[0, 21]]);
3977
4072
  }));
3978
- function applyDiscountCalculationResult(_x25) {
4073
+ function applyDiscountCalculationResult(_x26) {
3979
4074
  return _applyDiscountCalculationResult.apply(this, arguments);
3980
4075
  }
3981
4076
  return applyDiscountCalculationResult;
@@ -3983,18 +4078,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3983
4078
  }, {
3984
4079
  key: "submitScanOrder",
3985
4080
  value: function () {
3986
- var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3987
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3988
- while (1) switch (_context33.prev = _context33.next) {
4081
+ var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4082
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4083
+ while (1) switch (_context35.prev = _context35.next) {
3989
4084
  case 0:
3990
- return _context33.abrupt("return", this.submitSalesOrder(params));
4085
+ return _context35.abrupt("return", this.submitSalesOrder(params));
3991
4086
  case 1:
3992
4087
  case "end":
3993
- return _context33.stop();
4088
+ return _context35.stop();
3994
4089
  }
3995
- }, _callee33, this);
4090
+ }, _callee35, this);
3996
4091
  }));
3997
- function submitScanOrder(_x26) {
4092
+ function submitScanOrder(_x27) {
3998
4093
  return _submitScanOrder.apply(this, arguments);
3999
4094
  }
4000
4095
  return submitScanOrder;
@@ -4022,33 +4117,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4022
4117
  }, {
4023
4118
  key: "buildVirtualSettlementSubmitData",
4024
4119
  value: function () {
4025
- var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
4120
+ var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
4026
4121
  var settlement, tempOrder, currencyProductId, summary, amount, customerId, asset, balance, amountText, paymentNumber, payment, _paymentMethod$custom, paymentMethods, paymentMethod;
4027
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4028
- while (1) switch (_context34.prev = _context34.next) {
4122
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4123
+ while (1) switch (_context36.prev = _context36.next) {
4029
4124
  case 0:
4030
4125
  settlement = this.buildVirtualSettlementOrderData();
4031
4126
  if (!(!settlement || !this.store.order)) {
4032
- _context34.next = 3;
4127
+ _context36.next = 3;
4033
4128
  break;
4034
4129
  }
4035
- return _context34.abrupt("return", null);
4130
+ return _context36.abrupt("return", null);
4036
4131
  case 3:
4037
4132
  tempOrder = this.store.order.getTempOrder();
4038
4133
  currencyProductId = settlement.currencyProductId;
4039
- _context34.next = 7;
4134
+ _context36.next = 7;
4040
4135
  return this.store.order.recalculateSummary({
4041
4136
  createIfMissing: true
4042
4137
  });
4043
4138
  case 7:
4044
- summary = _context34.sent;
4139
+ summary = _context36.sent;
4045
4140
  amount = new Decimal((summary === null || summary === void 0 ? void 0 : summary.total_amount) || 0).toDecimalPlaces(2);
4046
4141
  customerId = Number((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id) || 0);
4047
4142
  if (!(amount.gt(0) && customerId > 0 && customerId !== 1)) {
4048
- _context34.next = 13;
4143
+ _context36.next = 13;
4049
4144
  break;
4050
4145
  }
4051
- _context34.next = 13;
4146
+ _context36.next = 13;
4052
4147
  return this.store.order.loadDiscountConfig({
4053
4148
  customerId: customerId,
4054
4149
  action: tempOrder !== null && tempOrder !== void 0 && tempOrder.order_id ? 'edit' : 'create',
@@ -4060,22 +4155,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4060
4155
  return Number(item === null || item === void 0 ? void 0 : item.product_id) === currencyProductId;
4061
4156
  });
4062
4157
  if (!amount.lte(0)) {
4063
- _context34.next = 16;
4158
+ _context36.next = 16;
4064
4159
  break;
4065
4160
  }
4066
- return _context34.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4161
+ return _context36.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4067
4162
  payments: []
4068
4163
  }));
4069
4164
  case 16:
4070
4165
  if (asset) {
4071
- _context34.next = 18;
4166
+ _context36.next = 18;
4072
4167
  break;
4073
4168
  }
4074
4169
  throw new Error('No matching virtual currency card is available.');
4075
4170
  case 18:
4076
4171
  balance = new Decimal(asset.balance || 0);
4077
4172
  if (!balance.lt(amount)) {
4078
- _context34.next = 21;
4173
+ _context36.next = 21;
4079
4174
  break;
4080
4175
  }
4081
4176
  throw new Error('Insufficient virtual currency balance.');
@@ -4083,7 +4178,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4083
4178
  amountText = amount.toFixed(2);
4084
4179
  paymentNumber = "LOCAL_".concat(createUuidV4());
4085
4180
  if (!this.store.order.isOnlineStorePlatform()) {
4086
- _context34.next = 27;
4181
+ _context36.next = 27;
4087
4182
  break;
4088
4183
  }
4089
4184
  payment = {
@@ -4100,18 +4195,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4100
4195
  },
4101
4196
  wallet_pass_use_value: amountText
4102
4197
  };
4103
- _context34.next = 34;
4198
+ _context36.next = 34;
4104
4199
  break;
4105
4200
  case 27:
4106
- _context34.next = 29;
4201
+ _context36.next = 29;
4107
4202
  return this.getPaymentMethodsAsync();
4108
4203
  case 29:
4109
- paymentMethods = _context34.sent;
4204
+ paymentMethods = _context36.sent;
4110
4205
  paymentMethod = paymentMethods.find(function (method) {
4111
4206
  return String(method.code || '').toUpperCase() === 'PRODUCTVOUCHER';
4112
4207
  });
4113
4208
  if (paymentMethod) {
4114
- _context34.next = 33;
4209
+ _context36.next = 33;
4115
4210
  break;
4116
4211
  }
4117
4212
  throw new Error('PRODUCTVOUCHER payment method is unavailable.');
@@ -4135,14 +4230,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4135
4230
  metadata: {}
4136
4231
  };
4137
4232
  case 34:
4138
- return _context34.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4233
+ return _context36.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4139
4234
  payments: [payment]
4140
4235
  }));
4141
4236
  case 35:
4142
4237
  case "end":
4143
- return _context34.stop();
4238
+ return _context36.stop();
4144
4239
  }
4145
- }, _callee34, this);
4240
+ }, _callee36, this);
4146
4241
  }));
4147
4242
  function buildVirtualSettlementSubmitData() {
4148
4243
  return _buildVirtualSettlementSubmitData.apply(this, arguments);
@@ -4158,42 +4253,42 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4158
4253
  }, {
4159
4254
  key: "submitSalesOrder",
4160
4255
  value: (function () {
4161
- var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4162
- var _params$smallTicketDa, _this$otherParams18, _this$otherParams19, _this$otherParams20, _this$otherParams21;
4256
+ var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
4257
+ var _params$smallTicketDa, _this$otherParams20, _this$otherParams21, _this$otherParams22, _this$otherParams23;
4163
4258
  var isDeferredPayment, virtualPaymentSettlement, virtualSettlement, inferredPaymentStatus, smallTicketDataFlag, virtualSettlementEnhancePayload, configuredEnhancePayload, _enhancePayload, submitParams;
4164
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4165
- while (1) switch (_context35.prev = _context35.next) {
4259
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4260
+ while (1) switch (_context37.prev = _context37.next) {
4166
4261
  case 0:
4167
4262
  if (this.store.order) {
4168
- _context35.next = 2;
4263
+ _context37.next = 2;
4169
4264
  break;
4170
4265
  }
4171
4266
  throw new Error('BaseSales 解决方案需要 order 模块支持');
4172
4267
  case 2:
4173
4268
  if (!this.isPickupTimingEnabled()) {
4174
- _context35.next = 5;
4269
+ _context37.next = 5;
4175
4270
  break;
4176
4271
  }
4177
- _context35.next = 5;
4272
+ _context37.next = 5;
4178
4273
  return this.preparePickupTimingForCheckout({
4179
4274
  freeze: true
4180
4275
  });
4181
4276
  case 5:
4182
4277
  isDeferredPayment = (params === null || params === void 0 ? void 0 : params.paymentExecution) === 'deferred';
4183
4278
  if (!isDeferredPayment) {
4184
- _context35.next = 10;
4279
+ _context37.next = 10;
4185
4280
  break;
4186
4281
  }
4187
- _context35.t0 = null;
4188
- _context35.next = 13;
4282
+ _context37.t0 = null;
4283
+ _context37.next = 13;
4189
4284
  break;
4190
4285
  case 10:
4191
- _context35.next = 12;
4286
+ _context37.next = 12;
4192
4287
  return this.buildVirtualSettlementSubmitData();
4193
4288
  case 12:
4194
- _context35.t0 = _context35.sent;
4289
+ _context37.t0 = _context37.sent;
4195
4290
  case 13:
4196
- virtualPaymentSettlement = _context35.t0;
4291
+ virtualPaymentSettlement = _context37.t0;
4197
4292
  virtualSettlement = isDeferredPayment ? this.buildVirtualSettlementOrderData() : virtualPaymentSettlement; // this.store.order.persistTempOrder();
4198
4293
  inferredPaymentStatus = isDeferredPayment ? undefined : this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
4199
4294
  smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
@@ -4226,10 +4321,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4226
4321
  } : configuredEnhancePayload;
4227
4322
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
4228
4323
  cacheId: this.cacheId,
4229
- platform: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform,
4230
- businessCode: ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.businessCode) || ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.business_code),
4324
+ platform: (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.platform,
4325
+ 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),
4231
4326
  channel: this.getSubmitOrderSalesChannel(),
4232
- type: (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.type,
4327
+ type: (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.type,
4233
4328
  request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
4234
4329
  }, isDeferredPayment ? {
4235
4330
  payments: []
@@ -4266,14 +4361,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4266
4361
  } : _enhancePayload !== undefined ? {
4267
4362
  enhancePayload: _enhancePayload
4268
4363
  } : {});
4269
- return _context35.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
4364
+ return _context37.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
4270
4365
  case 22:
4271
4366
  case "end":
4272
- return _context35.stop();
4367
+ return _context37.stop();
4273
4368
  }
4274
- }, _callee35, this);
4369
+ }, _callee37, this);
4275
4370
  }));
4276
- function submitSalesOrder(_x27) {
4371
+ function submitSalesOrder(_x28) {
4277
4372
  return _submitSalesOrder.apply(this, arguments);
4278
4373
  }
4279
4374
  return submitSalesOrder;
@@ -4281,42 +4376,42 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4281
4376
  }, {
4282
4377
  key: "saveSalesOrderDraft",
4283
4378
  value: function () {
4284
- var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
4285
- var _params$platform, _this$otherParams22, _this$otherParams23, _this$otherParams24, _params$channel, _params$type, _this$otherParams25;
4286
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4287
- while (1) switch (_context36.prev = _context36.next) {
4379
+ var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4380
+ var _params$platform, _this$otherParams24, _this$otherParams25, _this$otherParams26, _params$channel, _params$type, _this$otherParams27;
4381
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4382
+ while (1) switch (_context38.prev = _context38.next) {
4288
4383
  case 0:
4289
4384
  if (this.store.order) {
4290
- _context36.next = 2;
4385
+ _context38.next = 2;
4291
4386
  break;
4292
4387
  }
4293
4388
  throw new Error('BaseSales 解决方案需要 order 模块支持');
4294
4389
  case 2:
4295
4390
  if (!this.isPickupTimingEnabled()) {
4296
- _context36.next = 5;
4391
+ _context38.next = 5;
4297
4392
  break;
4298
4393
  }
4299
- _context36.next = 5;
4394
+ _context38.next = 5;
4300
4395
  return this.preparePickupTimingForCheckout({
4301
4396
  freeze: false
4302
4397
  });
4303
4398
  case 5:
4304
- return _context36.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
4399
+ return _context38.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
4305
4400
  cacheId: this.cacheId,
4306
- platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.platform,
4307
- businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.businessCode) || ((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.business_code),
4401
+ 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,
4402
+ 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),
4308
4403
  channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
4309
- type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.type
4404
+ 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
4310
4405
  }, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
4311
4406
  enhancePayload: params.enhancePayload
4312
4407
  } : {})));
4313
4408
  case 6:
4314
4409
  case "end":
4315
- return _context36.stop();
4410
+ return _context38.stop();
4316
4411
  }
4317
- }, _callee36, this);
4412
+ }, _callee38, this);
4318
4413
  }));
4319
- function saveSalesOrderDraft(_x28) {
4414
+ function saveSalesOrderDraft(_x29) {
4320
4415
  return _saveSalesOrderDraft.apply(this, arguments);
4321
4416
  }
4322
4417
  return saveSalesOrderDraft;
@@ -4324,23 +4419,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4324
4419
  }, {
4325
4420
  key: "submitTempOrderAsync",
4326
4421
  value: function () {
4327
- var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
4328
- var _params$smallTicketDa2, _this$otherParams26, _this$otherParams27, _this$otherParams28, _this$otherParams29;
4422
+ var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
4423
+ var _params$smallTicketDa2, _this$otherParams28, _this$otherParams29, _this$otherParams30, _this$otherParams31;
4329
4424
  var inferredPaymentStatus, smallTicketDataFlag, enhancePayload, submitParams;
4330
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4331
- while (1) switch (_context37.prev = _context37.next) {
4425
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4426
+ while (1) switch (_context39.prev = _context39.next) {
4332
4427
  case 0:
4333
4428
  if (this.store.order) {
4334
- _context37.next = 2;
4429
+ _context39.next = 2;
4335
4430
  break;
4336
4431
  }
4337
4432
  throw new Error('BaseSales 解决方案需要 order 模块支持');
4338
4433
  case 2:
4339
4434
  if (!this.isPickupTimingEnabled()) {
4340
- _context37.next = 5;
4435
+ _context39.next = 5;
4341
4436
  break;
4342
4437
  }
4343
- _context37.next = 5;
4438
+ _context39.next = 5;
4344
4439
  return this.preparePickupTimingForCheckout({
4345
4440
  freeze: true
4346
4441
  });
@@ -4350,10 +4445,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4350
4445
  enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params === null || params === void 0 ? void 0 : params.enhancePayload);
4351
4446
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
4352
4447
  cacheId: this.cacheId,
4353
- platform: (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform,
4354
- businessCode: ((_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.businessCode) || ((_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.business_code),
4448
+ platform: (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.platform,
4449
+ 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),
4355
4450
  channel: this.getSubmitOrderSalesChannel(),
4356
- type: (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.type,
4451
+ type: (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.type,
4357
4452
  request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
4358
4453
  }, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
4359
4454
  payments: params.payments
@@ -4366,14 +4461,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4366
4461
  } : {}), enhancePayload !== undefined ? {
4367
4462
  enhancePayload: enhancePayload
4368
4463
  } : {});
4369
- return _context37.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
4464
+ return _context39.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
4370
4465
  case 10:
4371
4466
  case "end":
4372
- return _context37.stop();
4467
+ return _context39.stop();
4373
4468
  }
4374
- }, _callee37, this);
4469
+ }, _callee39, this);
4375
4470
  }));
4376
- function submitTempOrderAsync(_x29) {
4471
+ function submitTempOrderAsync(_x30) {
4377
4472
  return _submitTempOrderAsync.apply(this, arguments);
4378
4473
  }
4379
4474
  return submitTempOrderAsync;
@@ -4385,8 +4480,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4385
4480
  }, {
4386
4481
  key: "shouldUseCheckoutSyncTask",
4387
4482
  value: function shouldUseCheckoutSyncTask() {
4388
- var _this$otherParams30;
4389
- var configured = (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.checkoutSyncTaskEnabled;
4483
+ var _this$otherParams32;
4484
+ var configured = (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.checkoutSyncTaskEnabled;
4390
4485
  return typeof configured === 'boolean' ? configured : true;
4391
4486
  }
4392
4487
 
@@ -4399,14 +4494,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4399
4494
  }, {
4400
4495
  key: "printLocalOrderReceipt",
4401
4496
  value: function () {
4402
- var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(lookup) {
4403
- var _this$otherParams31, _this$otherParams32, _this$otherParams33, _this$otherParams34;
4497
+ var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(lookup) {
4498
+ var _this$otherParams33, _this$otherParams34, _this$otherParams35, _this$otherParams36;
4404
4499
  var hasLookup, lookupPayload, context, payload, invoiceLayoutConfig, invoiceTemplateSettings, printPayload, response, _this$store$order$app, _this$store$order13, _data;
4405
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4406
- while (1) switch (_context38.prev = _context38.next) {
4500
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4501
+ while (1) switch (_context40.prev = _context40.next) {
4407
4502
  case 0:
4408
4503
  if (this.store.order) {
4409
- _context38.next = 2;
4504
+ _context40.next = 2;
4410
4505
  break;
4411
4506
  }
4412
4507
  throw new Error('BaseSales 解决方案需要 order 模块支持');
@@ -4418,10 +4513,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4418
4513
  external_sale_number: lookup
4419
4514
  };
4420
4515
  context = {
4421
- platform: (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.platform,
4422
- businessCode: ((_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.businessCode) || ((_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.business_code),
4516
+ platform: (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.platform,
4517
+ 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),
4423
4518
  channel: this.getSubmitOrderSalesChannel(),
4424
- type: (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.type
4519
+ type: (_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.type
4425
4520
  };
4426
4521
  payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
4427
4522
  lookup_order_from_db: 1,
@@ -4444,28 +4539,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4444
4539
  } : {}), invoiceTemplateSettings ? {
4445
4540
  template_settings: cloneDeep(invoiceTemplateSettings)
4446
4541
  } : {});
4447
- _context38.next = 11;
4542
+ _context40.next = 11;
4448
4543
  return this.request.post('/local/print-order', printPayload, {
4449
4544
  osServer: true,
4450
4545
  customToast: function customToast() {}
4451
4546
  });
4452
4547
  case 11:
4453
- response = _context38.sent;
4548
+ response = _context40.sent;
4454
4549
  if (hasLookup) {
4455
- _context38.next = 15;
4550
+ _context40.next = 15;
4456
4551
  break;
4457
4552
  }
4458
- _context38.next = 15;
4553
+ _context40.next = 15;
4459
4554
  return (_this$store$order$app = (_this$store$order13 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order13, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
4460
4555
  case 15:
4461
- return _context38.abrupt("return", response);
4556
+ return _context40.abrupt("return", response);
4462
4557
  case 16:
4463
4558
  case "end":
4464
- return _context38.stop();
4559
+ return _context40.stop();
4465
4560
  }
4466
- }, _callee38, this);
4561
+ }, _callee40, this);
4467
4562
  }));
4468
- function printLocalOrderReceipt(_x30) {
4563
+ function printLocalOrderReceipt(_x31) {
4469
4564
  return _printLocalOrderReceipt.apply(this, arguments);
4470
4565
  }
4471
4566
  return printLocalOrderReceipt;
@@ -4486,19 +4581,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4486
4581
  }, {
4487
4582
  key: "syncPaymentsToOrder",
4488
4583
  value: function () {
4489
- var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
4490
- var _ref48, _params$businessCode, _this$otherParams35, _this$otherParams36, _params$channel2;
4584
+ var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
4585
+ var _ref48, _params$businessCode, _this$otherParams37, _this$otherParams38, _params$channel2;
4491
4586
  var businessCode, channel, enhancePayload, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
4492
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4493
- while (1) switch (_context39.prev = _context39.next) {
4587
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4588
+ while (1) switch (_context41.prev = _context41.next) {
4494
4589
  case 0:
4495
4590
  if (this.store.order) {
4496
- _context39.next = 2;
4591
+ _context41.next = 2;
4497
4592
  break;
4498
4593
  }
4499
4594
  throw new Error('order 模块未初始化');
4500
4595
  case 2:
4501
- businessCode = (_ref48 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.businessCode) !== null && _ref48 !== void 0 ? _ref48 : (_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.business_code;
4596
+ 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;
4502
4597
  channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
4503
4598
  enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params.enhancePayload);
4504
4599
  syncParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, params), {}, {
@@ -4512,14 +4607,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4512
4607
  } : {});
4513
4608
  syncState = this.store.order.getOrderSyncState();
4514
4609
  if (!(params.submitWhenPaid && syncState === 'submitting')) {
4515
- _context39.next = 10;
4610
+ _context41.next = 10;
4516
4611
  break;
4517
4612
  }
4518
4613
  this.queueLatestAutoPaymentSync();
4519
- return _context39.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
4614
+ return _context41.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
4520
4615
  case 10:
4521
4616
  payments = params.payments || [];
4522
- _context39.next = 13;
4617
+ _context41.next = 13;
4523
4618
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
4524
4619
  payments: payments,
4525
4620
  params: syncParams,
@@ -4527,11 +4622,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4527
4622
  orderSnapshot: this.store.order.getOrderSnapshot()
4528
4623
  });
4529
4624
  case 13:
4530
- _context39.prev = 13;
4531
- _context39.next = 16;
4625
+ _context41.prev = 13;
4626
+ _context41.next = 16;
4532
4627
  return this.store.order.syncPaymentsToOrder(syncParams);
4533
4628
  case 16:
4534
- syncResult = _context39.sent;
4629
+ syncResult = _context41.sent;
4535
4630
  latestPayments = this.store.order.getOrderPayments();
4536
4631
  amountSnapshot = this.store.order.getOrderAmountSnapshot();
4537
4632
  orderSnapshot = this.store.order.getOrderSnapshot();
@@ -4549,25 +4644,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4549
4644
  depositAmount: syncResult.depositAmount,
4550
4645
  orderExpectedAmount: syncResult.orderExpectedAmount
4551
4646
  };
4552
- _context39.next = 23;
4647
+ _context41.next = 23;
4553
4648
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
4554
4649
  case 23:
4555
4650
  if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
4556
- _context39.next = 26;
4651
+ _context41.next = 26;
4557
4652
  break;
4558
4653
  }
4559
- _context39.next = 26;
4654
+ _context41.next = 26;
4560
4655
  return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
4561
4656
  case 26:
4562
4657
  this.scheduleQueuedAutoPaymentSyncFlush(0);
4563
- return _context39.abrupt("return", syncResult);
4658
+ return _context41.abrupt("return", syncResult);
4564
4659
  case 30:
4565
- _context39.prev = 30;
4566
- _context39.t0 = _context39["catch"](13);
4567
- _context39.next = 34;
4660
+ _context41.prev = 30;
4661
+ _context41.t0 = _context41["catch"](13);
4662
+ _context41.next = 34;
4568
4663
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
4569
4664
  ok: false,
4570
- error: _context39.t0,
4665
+ error: _context41.t0,
4571
4666
  payments: this.store.order.getOrderPayments(),
4572
4667
  params: syncParams,
4573
4668
  amountSnapshot: this.store.order.getOrderAmountSnapshot(),
@@ -4575,14 +4670,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4575
4670
  });
4576
4671
  case 34:
4577
4672
  this.scheduleQueuedAutoPaymentSyncFlush(0);
4578
- throw _context39.t0;
4673
+ throw _context41.t0;
4579
4674
  case 36:
4580
4675
  case "end":
4581
- return _context39.stop();
4676
+ return _context41.stop();
4582
4677
  }
4583
- }, _callee39, this, [[13, 30]]);
4678
+ }, _callee41, this, [[13, 30]]);
4584
4679
  }));
4585
- function syncPaymentsToOrder(_x31) {
4680
+ function syncPaymentsToOrder(_x32) {
4586
4681
  return _syncPaymentsToOrder.apply(this, arguments);
4587
4682
  }
4588
4683
  return syncPaymentsToOrder;
@@ -4619,58 +4714,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4619
4714
  }, {
4620
4715
  key: "scheduleQueuedAutoPaymentSyncFlush",
4621
4716
  value: function scheduleQueuedAutoPaymentSyncFlush() {
4622
- var _this18 = this;
4717
+ var _this19 = this;
4623
4718
  var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
4624
4719
  if (!this.queuedAutoPaymentSync) return;
4625
4720
  if (this.autoPaymentSyncTimer) return;
4626
4721
  this.autoPaymentSyncTimer = setTimeout(function () {
4627
- _this18.autoPaymentSyncTimer = null;
4628
- void _this18.flushQueuedAutoPaymentSync();
4722
+ _this19.autoPaymentSyncTimer = null;
4723
+ void _this19.flushQueuedAutoPaymentSync();
4629
4724
  }, delay);
4630
4725
  }
4631
4726
  }, {
4632
4727
  key: "flushQueuedAutoPaymentSync",
4633
4728
  value: function () {
4634
- var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
4729
+ var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
4635
4730
  var payments;
4636
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4637
- while (1) switch (_context40.prev = _context40.next) {
4731
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4732
+ while (1) switch (_context42.prev = _context42.next) {
4638
4733
  case 0:
4639
4734
  if (this.store.order) {
4640
- _context40.next = 2;
4735
+ _context42.next = 2;
4641
4736
  break;
4642
4737
  }
4643
- return _context40.abrupt("return");
4738
+ return _context42.abrupt("return");
4644
4739
  case 2:
4645
4740
  if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
4646
- _context40.next = 4;
4741
+ _context42.next = 4;
4647
4742
  break;
4648
4743
  }
4649
- return _context40.abrupt("return");
4744
+ return _context42.abrupt("return");
4650
4745
  case 4:
4651
4746
  if (!(this.store.order.getOrderSyncState() === 'submitting')) {
4652
- _context40.next = 7;
4747
+ _context42.next = 7;
4653
4748
  break;
4654
4749
  }
4655
4750
  this.scheduleQueuedAutoPaymentSyncFlush();
4656
- return _context40.abrupt("return");
4751
+ return _context42.abrupt("return");
4657
4752
  case 7:
4658
4753
  this.autoPaymentSyncFlushing = true;
4659
- _context40.prev = 8;
4754
+ _context42.prev = 8;
4660
4755
  case 9:
4661
4756
  if (!this.queuedAutoPaymentSync) {
4662
- _context40.next = 18;
4757
+ _context42.next = 18;
4663
4758
  break;
4664
4759
  }
4665
4760
  this.queuedAutoPaymentSync = false;
4666
4761
  payments = this.store.order.getOrderPayments();
4667
4762
  if (payments.length) {
4668
- _context40.next = 14;
4763
+ _context42.next = 14;
4669
4764
  break;
4670
4765
  }
4671
- return _context40.abrupt("continue", 9);
4766
+ return _context42.abrupt("continue", 9);
4672
4767
  case 14:
4673
- _context40.next = 16;
4768
+ _context42.next = 16;
4674
4769
  return this.syncPaymentsToOrder({
4675
4770
  payments: payments,
4676
4771
  paymentStatus: this.getPaymentStatusForSync(payments),
@@ -4678,29 +4773,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4678
4773
  smallTicketDataFlag: 1
4679
4774
  });
4680
4775
  case 16:
4681
- _context40.next = 9;
4776
+ _context42.next = 9;
4682
4777
  break;
4683
4778
  case 18:
4684
- _context40.next = 23;
4779
+ _context42.next = 23;
4685
4780
  break;
4686
4781
  case 20:
4687
- _context40.prev = 20;
4688
- _context40.t0 = _context40["catch"](8);
4782
+ _context42.prev = 20;
4783
+ _context42.t0 = _context42["catch"](8);
4689
4784
  this.logError('queued auto sync payments failed', {
4690
- error: _context40.t0 instanceof Error ? _context40.t0.message : String(_context40.t0)
4785
+ error: _context42.t0 instanceof Error ? _context42.t0.message : String(_context42.t0)
4691
4786
  });
4692
4787
  case 23:
4693
- _context40.prev = 23;
4788
+ _context42.prev = 23;
4694
4789
  this.autoPaymentSyncFlushing = false;
4695
4790
  if (this.queuedAutoPaymentSync) {
4696
4791
  this.scheduleQueuedAutoPaymentSyncFlush(0);
4697
4792
  }
4698
- return _context40.finish(23);
4793
+ return _context42.finish(23);
4699
4794
  case 27:
4700
4795
  case "end":
4701
- return _context40.stop();
4796
+ return _context42.stop();
4702
4797
  }
4703
- }, _callee40, this, [[8, 20, 23, 27]]);
4798
+ }, _callee42, this, [[8, 20, 23, 27]]);
4704
4799
  }));
4705
4800
  function flushQueuedAutoPaymentSync() {
4706
4801
  return _flushQueuedAutoPaymentSync.apply(this, arguments);
@@ -4724,35 +4819,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4724
4819
  }, {
4725
4820
  key: "addOrderPaymentAsync",
4726
4821
  value: (function () {
4727
- var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(payment) {
4822
+ var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(payment) {
4728
4823
  var paymentRecord, hasPaymentNumber, devicePrefix;
4729
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4730
- while (1) switch (_context41.prev = _context41.next) {
4824
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4825
+ while (1) switch (_context43.prev = _context43.next) {
4731
4826
  case 0:
4732
4827
  paymentRecord = payment;
4733
4828
  hasPaymentNumber = String(paymentRecord.payment_number || '').trim() !== '';
4734
4829
  if (!hasPaymentNumber) {
4735
- _context41.next = 6;
4830
+ _context43.next = 6;
4736
4831
  break;
4737
4832
  }
4738
- _context41.t0 = 'LOCAL';
4739
- _context41.next = 9;
4833
+ _context43.t0 = 'LOCAL';
4834
+ _context43.next = 9;
4740
4835
  break;
4741
4836
  case 6:
4742
- _context41.next = 8;
4837
+ _context43.next = 8;
4743
4838
  return this.getPaymentNumberDevicePrefixAsync();
4744
4839
  case 8:
4745
- _context41.t0 = _context41.sent;
4840
+ _context43.t0 = _context43.sent;
4746
4841
  case 9:
4747
- devicePrefix = _context41.t0;
4748
- return _context41.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
4842
+ devicePrefix = _context43.t0;
4843
+ return _context43.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
4749
4844
  case 11:
4750
4845
  case "end":
4751
- return _context41.stop();
4846
+ return _context43.stop();
4752
4847
  }
4753
- }, _callee41, this);
4848
+ }, _callee43, this);
4754
4849
  }));
4755
- function addOrderPaymentAsync(_x32) {
4850
+ function addOrderPaymentAsync(_x33) {
4756
4851
  return _addOrderPaymentAsync.apply(this, arguments);
4757
4852
  }
4758
4853
  return addOrderPaymentAsync;
@@ -4760,12 +4855,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4760
4855
  }, {
4761
4856
  key: "addOrderPaymentWithDevicePrefix",
4762
4857
  value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
4763
- var _this$otherParams37,
4858
+ var _this$otherParams39,
4764
4859
  _paymentRecord$paymen,
4765
4860
  _paymentRecord$create,
4766
4861
  _ref49,
4767
4862
  _paymentRecord$origin,
4768
- _this19 = this;
4863
+ _this20 = this;
4769
4864
  if (!this.store.order) throw new Error('order 模块未初始化');
4770
4865
  var paymentRecord = payment;
4771
4866
  var paymentAmount = new Decimal(paymentRecord.amount || 0);
@@ -4776,7 +4871,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4776
4871
  return this.store.order.getOrderPayments();
4777
4872
  }
4778
4873
  var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
4779
- var shopWalletPassId = (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.shop_wallet_pass_id;
4874
+ var shopWalletPassId = (_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.shop_wallet_pass_id;
4780
4875
  if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
4781
4876
  metadata.shop_wallet_pass_id = shopWalletPassId;
4782
4877
  }
@@ -4809,7 +4904,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4809
4904
  submitWhenPaid: true,
4810
4905
  smallTicketDataFlag: 1
4811
4906
  }).catch(function (error) {
4812
- _this19.logError('auto sync payments failed', {
4907
+ _this20.logError('auto sync payments failed', {
4813
4908
  error: error instanceof Error ? error.message : String(error)
4814
4909
  });
4815
4910
  });
@@ -4821,7 +4916,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4821
4916
  }, {
4822
4917
  key: "updateOrderPayment",
4823
4918
  value: (function () {
4824
- var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(paymentIdentity, updates) {
4919
+ var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(paymentIdentity, updates) {
4825
4920
  var _result$payment, _result$payment2;
4826
4921
  var options,
4827
4922
  matchMode,
@@ -4838,13 +4933,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4838
4933
  shouldSubmit,
4839
4934
  syncResult,
4840
4935
  _options$smallTicketD2,
4841
- _args42 = arguments;
4842
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4843
- while (1) switch (_context42.prev = _context42.next) {
4936
+ _args44 = arguments;
4937
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4938
+ while (1) switch (_context44.prev = _context44.next) {
4844
4939
  case 0:
4845
- options = _args42.length > 2 && _args42[2] !== undefined ? _args42[2] : {};
4940
+ options = _args44.length > 2 && _args44[2] !== undefined ? _args44[2] : {};
4846
4941
  if (this.store.order) {
4847
- _context42.next = 3;
4942
+ _context44.next = 3;
4848
4943
  break;
4849
4944
  }
4850
4945
  throw new Error('order 模块未初始化');
@@ -4853,15 +4948,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4853
4948
  previousMatch = resolveOrderPaymentIdentity(this.store.order.getOrderPayments(), paymentIdentity, matchMode);
4854
4949
  previousPayment = previousMatch === null || previousMatch === void 0 ? void 0 : previousMatch.payment;
4855
4950
  if (!((previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) === 'paid' && !options.applyUpdatesWhenPaid)) {
4856
- _context42.next = 13;
4951
+ _context44.next = 13;
4857
4952
  break;
4858
4953
  }
4859
4954
  currentPayments = this.store.order.getOrderPayments();
4860
4955
  if (!(options.submitWhenPaid && options.forceSubmitIfPaid)) {
4861
- _context42.next = 12;
4956
+ _context44.next = 12;
4862
4957
  break;
4863
4958
  }
4864
- _context42.next = 11;
4959
+ _context44.next = 11;
4865
4960
  return this.syncPaymentsToOrder({
4866
4961
  payments: currentPayments,
4867
4962
  paymentStatus: this.getPaymentStatusForSync(currentPayments),
@@ -4869,9 +4964,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4869
4964
  smallTicketDataFlag: (_options$smallTicketD = options.smallTicketDataFlag) !== null && _options$smallTicketD !== void 0 ? _options$smallTicketD : 1
4870
4965
  });
4871
4966
  case 11:
4872
- _syncResult = _context42.sent;
4967
+ _syncResult = _context44.sent;
4873
4968
  case 12:
4874
- return _context42.abrupt("return", _objectSpread({
4969
+ return _context44.abrupt("return", _objectSpread({
4875
4970
  updated: false,
4876
4971
  payment: previousPayment,
4877
4972
  payments: currentPayments,
@@ -4880,44 +4975,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4880
4975
  syncResult: _syncResult
4881
4976
  } : {}));
4882
4977
  case 13:
4883
- _context42.next = 15;
4978
+ _context44.next = 15;
4884
4979
  return this.store.order.updateOrderPayment(paymentIdentity, updates, {
4885
4980
  matchBy: matchMode
4886
4981
  });
4887
4982
  case 15:
4888
- result = _context42.sent;
4983
+ result = _context44.sent;
4889
4984
  if (!(options.persistDraft !== false)) {
4890
- _context42.next = 29;
4985
+ _context44.next = 29;
4891
4986
  break;
4892
4987
  }
4893
- _context42.prev = 17;
4894
- _context42.next = 20;
4988
+ _context44.prev = 17;
4989
+ _context44.next = 20;
4895
4990
  return this.saveSalesOrderDraft();
4896
4991
  case 20:
4897
- draftResult = _context42.sent;
4898
- _context42.next = 29;
4992
+ draftResult = _context44.sent;
4993
+ _context44.next = 29;
4899
4994
  break;
4900
4995
  case 23:
4901
- _context42.prev = 23;
4902
- _context42.t0 = _context42["catch"](17);
4903
- draftError = _context42.t0;
4996
+ _context44.prev = 23;
4997
+ _context44.t0 = _context44["catch"](17);
4998
+ draftError = _context44.t0;
4904
4999
  this.logError('updateOrderPayment: 保存支付草稿失败', {
4905
5000
  paymentIdentity: paymentIdentity,
4906
- error: _context42.t0 instanceof Error ? _context42.t0.message : String(_context42.t0)
5001
+ error: _context44.t0 instanceof Error ? _context44.t0.message : String(_context44.t0)
4907
5002
  });
4908
5003
  if (options.submitWhenPaid) {
4909
- _context42.next = 29;
5004
+ _context44.next = 29;
4910
5005
  break;
4911
5006
  }
4912
- throw _context42.t0;
5007
+ throw _context44.t0;
4913
5008
  case 29:
4914
5009
  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';
4915
5010
  shouldSubmit = Boolean(options.submitWhenPaid && ((_result$payment2 = result.payment) === null || _result$payment2 === void 0 ? void 0 : _result$payment2.status) === 'paid' && (becamePaid || options.forceSubmitIfPaid));
4916
5011
  if (!shouldSubmit) {
4917
- _context42.next = 35;
5012
+ _context44.next = 35;
4918
5013
  break;
4919
5014
  }
4920
- _context42.next = 34;
5015
+ _context44.next = 34;
4921
5016
  return this.syncPaymentsToOrder({
4922
5017
  payments: result.payments,
4923
5018
  paymentStatus: this.getPaymentStatusForSync(result.payments),
@@ -4925,9 +5020,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4925
5020
  smallTicketDataFlag: (_options$smallTicketD2 = options.smallTicketDataFlag) !== null && _options$smallTicketD2 !== void 0 ? _options$smallTicketD2 : 1
4926
5021
  });
4927
5022
  case 34:
4928
- syncResult = _context42.sent;
5023
+ syncResult = _context44.sent;
4929
5024
  case 35:
4930
- return _context42.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
5025
+ return _context44.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
4931
5026
  draftResult: draftResult
4932
5027
  } : {}), draftError !== undefined ? {
4933
5028
  draftError: draftError
@@ -4936,11 +5031,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4936
5031
  } : {}));
4937
5032
  case 36:
4938
5033
  case "end":
4939
- return _context42.stop();
5034
+ return _context44.stop();
4940
5035
  }
4941
- }, _callee42, this, [[17, 23]]);
5036
+ }, _callee44, this, [[17, 23]]);
4942
5037
  }));
4943
- function updateOrderPayment(_x33, _x34) {
5038
+ function updateOrderPayment(_x34, _x35) {
4944
5039
  return _updateOrderPayment.apply(this, arguments);
4945
5040
  }
4946
5041
  return updateOrderPayment;
@@ -4962,24 +5057,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4962
5057
  }, {
4963
5058
  key: "updateVoucherOrderPaymentsAsync",
4964
5059
  value: function () {
4965
- var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(payments, options) {
4966
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4967
- while (1) switch (_context43.prev = _context43.next) {
5060
+ var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(payments, options) {
5061
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5062
+ while (1) switch (_context45.prev = _context45.next) {
4968
5063
  case 0:
4969
5064
  if (this.store.order) {
4970
- _context43.next = 2;
5065
+ _context45.next = 2;
4971
5066
  break;
4972
5067
  }
4973
5068
  throw new Error('order 模块未初始化');
4974
5069
  case 2:
4975
- return _context43.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
5070
+ return _context45.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
4976
5071
  case 3:
4977
5072
  case "end":
4978
- return _context43.stop();
5073
+ return _context45.stop();
4979
5074
  }
4980
- }, _callee43, this);
5075
+ }, _callee45, this);
4981
5076
  }));
4982
- function updateVoucherOrderPaymentsAsync(_x35, _x36) {
5077
+ function updateVoucherOrderPaymentsAsync(_x36, _x37) {
4983
5078
  return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
4984
5079
  }
4985
5080
  return updateVoucherOrderPaymentsAsync;
@@ -5090,20 +5185,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5090
5185
  }, {
5091
5186
  key: "initWalletData",
5092
5187
  value: function () {
5093
- var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
5188
+ var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
5094
5189
  var _this$store$order$mer, _this$store$order17, _snapshot$identity;
5095
5190
  var snapshot, walletBusinessData, result;
5096
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5097
- while (1) switch (_context44.prev = _context44.next) {
5191
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5192
+ while (1) switch (_context46.prev = _context46.next) {
5098
5193
  case 0:
5099
5194
  if (this.store.order) {
5100
- _context44.next = 2;
5195
+ _context46.next = 2;
5101
5196
  break;
5102
5197
  }
5103
5198
  throw new Error('order 模块未初始化');
5104
5199
  case 2:
5105
5200
  if (this.store.payment) {
5106
- _context44.next = 4;
5201
+ _context46.next = 4;
5107
5202
  break;
5108
5203
  }
5109
5204
  throw new Error('payment 模块未初始化');
@@ -5111,10 +5206,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5111
5206
  snapshot = this.store.order.getOrderSnapshot();
5112
5207
  walletBusinessData = this.buildWalletInitBusinessData(params);
5113
5208
  if (walletBusinessData) {
5114
- _context44.next = 8;
5209
+ _context46.next = 8;
5115
5210
  break;
5116
5211
  }
5117
- return _context44.abrupt("return", {
5212
+ return _context46.abrupt("return", {
5118
5213
  walletRecommendList: [],
5119
5214
  userIdentificationCodes: [],
5120
5215
  transformList: [],
@@ -5122,15 +5217,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5122
5217
  products: []
5123
5218
  });
5124
5219
  case 8:
5125
- _context44.next = 10;
5220
+ _context46.next = 10;
5126
5221
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
5127
5222
  case 10:
5128
- result = _context44.sent;
5223
+ result = _context46.sent;
5129
5224
  (_this$store$order$mer = (_this$store$order17 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer === void 0 || _this$store$order$mer.call(_this$store$order17, result.userIdentificationCodes, {
5130
5225
  customerId: walletBusinessData.customer_id,
5131
5226
  orderIdentity: snapshot === null || snapshot === void 0 ? void 0 : snapshot.identity
5132
5227
  });
5133
- _context44.next = 14;
5228
+ _context46.next = 14;
5134
5229
  return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
5135
5230
  orderId: snapshot === null || snapshot === void 0 || (_snapshot$identity = snapshot.identity) === null || _snapshot$identity === void 0 ? void 0 : _snapshot$identity.orderId,
5136
5231
  customerId: walletBusinessData.customer_id,
@@ -5142,14 +5237,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5142
5237
  timestamp: Date.now()
5143
5238
  });
5144
5239
  case 14:
5145
- return _context44.abrupt("return", result);
5240
+ return _context46.abrupt("return", result);
5146
5241
  case 15:
5147
5242
  case "end":
5148
- return _context44.stop();
5243
+ return _context46.stop();
5149
5244
  }
5150
- }, _callee44, this);
5245
+ }, _callee46, this);
5151
5246
  }));
5152
- function initWalletData(_x37) {
5247
+ function initWalletData(_x38) {
5153
5248
  return _initWalletData.apply(this, arguments);
5154
5249
  }
5155
5250
  return initWalletData;
@@ -5200,27 +5295,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5200
5295
  }, {
5201
5296
  key: "publishWalletAssetsState",
5202
5297
  value: function () {
5203
- var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(state) {
5298
+ var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(state) {
5204
5299
  var changeSource,
5205
- _args45 = arguments;
5206
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5207
- while (1) switch (_context45.prev = _context45.next) {
5300
+ _args47 = arguments;
5301
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5302
+ while (1) switch (_context47.prev = _context47.next) {
5208
5303
  case 0:
5209
- changeSource = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : 'derived';
5210
- _context45.next = 3;
5304
+ changeSource = _args47.length > 1 && _args47[1] !== undefined ? _args47[1] : 'derived';
5305
+ _context47.next = 3;
5211
5306
  return this.effectsEmit(BaseSalesHookNames.onWalletAssetsStateChanged, {
5212
5307
  state: state,
5213
5308
  changeSource: changeSource
5214
5309
  });
5215
5310
  case 3:
5216
- return _context45.abrupt("return", state);
5311
+ return _context47.abrupt("return", state);
5217
5312
  case 4:
5218
5313
  case "end":
5219
- return _context45.stop();
5314
+ return _context47.stop();
5220
5315
  }
5221
- }, _callee45, this);
5316
+ }, _callee47, this);
5222
5317
  }));
5223
- function publishWalletAssetsState(_x38) {
5318
+ function publishWalletAssetsState(_x39) {
5224
5319
  return _publishWalletAssetsState.apply(this, arguments);
5225
5320
  }
5226
5321
  return publishWalletAssetsState;
@@ -5228,26 +5323,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5228
5323
  }, {
5229
5324
  key: "syncSelectedWalletAssets",
5230
5325
  value: function () {
5231
- var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(state) {
5326
+ var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(state) {
5232
5327
  var paymentMethods, methodByCode, preparePayments, selectedAssetById, voucherPayments, payments;
5233
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5234
- while (1) switch (_context46.prev = _context46.next) {
5328
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5329
+ while (1) switch (_context48.prev = _context48.next) {
5235
5330
  case 0:
5236
5331
  if (!(!this.store.order || !this.store.payment)) {
5237
- _context46.next = 2;
5332
+ _context48.next = 2;
5238
5333
  break;
5239
5334
  }
5240
5335
  throw new Error('订单或支付模块未初始化');
5241
5336
  case 2:
5242
5337
  paymentMethods = this.getPaymentMethods();
5243
5338
  if (!(!paymentMethods.length && state.selectedItems.length)) {
5244
- _context46.next = 7;
5339
+ _context48.next = 7;
5245
5340
  break;
5246
5341
  }
5247
- _context46.next = 6;
5342
+ _context48.next = 6;
5248
5343
  return this.getPaymentMethodsAsync();
5249
5344
  case 6:
5250
- paymentMethods = _context46.sent;
5345
+ paymentMethods = _context48.sent;
5251
5346
  case 7:
5252
5347
  methodByCode = new Map(paymentMethods.map(function (method) {
5253
5348
  return [String(method.code || '').toUpperCase(), method];
@@ -5289,19 +5384,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5289
5384
  payments = this.updateVoucherOrderPayments(voucherPayments, {
5290
5385
  status: 'payment_pending'
5291
5386
  });
5292
- _context46.next = 14;
5387
+ _context48.next = 14;
5293
5388
  return this.store.order.recalculateSummary({
5294
5389
  createIfMissing: true
5295
5390
  });
5296
5391
  case 14:
5297
- return _context46.abrupt("return", payments);
5392
+ return _context48.abrupt("return", payments);
5298
5393
  case 15:
5299
5394
  case "end":
5300
- return _context46.stop();
5395
+ return _context48.stop();
5301
5396
  }
5302
- }, _callee46, this);
5397
+ }, _callee48, this);
5303
5398
  }));
5304
- function syncSelectedWalletAssets(_x39) {
5399
+ function syncSelectedWalletAssets(_x40) {
5305
5400
  return _syncSelectedWalletAssets.apply(this, arguments);
5306
5401
  }
5307
5402
  return syncSelectedWalletAssets;
@@ -5335,31 +5430,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5335
5430
  }, {
5336
5431
  key: "importWalletAssetsSnapshot",
5337
5432
  value: (function () {
5338
- var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(snapshot) {
5433
+ var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(snapshot) {
5339
5434
  var _this$store$order19, _this$store$order19$m;
5340
5435
  var state;
5341
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5342
- while (1) switch (_context47.prev = _context47.next) {
5436
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5437
+ while (1) switch (_context49.prev = _context49.next) {
5343
5438
  case 0:
5344
5439
  if (this.store.payment) {
5345
- _context47.next = 2;
5440
+ _context49.next = 2;
5346
5441
  break;
5347
5442
  }
5348
5443
  throw new Error('payment 模块未初始化');
5349
5444
  case 2:
5350
5445
  state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
5351
5446
  (_this$store$order19 = this.store.order) === null || _this$store$order19 === void 0 || (_this$store$order19$m = _this$store$order19.mergePointCardSnapshotCodes) === null || _this$store$order19$m === void 0 || _this$store$order19$m.call(_this$store$order19, state.items);
5352
- _context47.next = 6;
5447
+ _context49.next = 6;
5353
5448
  return this.syncSelectedWalletAssets(state);
5354
5449
  case 6:
5355
- return _context47.abrupt("return", this.publishWalletAssetsState(state));
5450
+ return _context49.abrupt("return", this.publishWalletAssetsState(state));
5356
5451
  case 7:
5357
5452
  case "end":
5358
- return _context47.stop();
5453
+ return _context49.stop();
5359
5454
  }
5360
- }, _callee47, this);
5455
+ }, _callee49, this);
5361
5456
  }));
5362
- function importWalletAssetsSnapshot(_x40) {
5457
+ function importWalletAssetsSnapshot(_x41) {
5363
5458
  return _importWalletAssetsSnapshot.apply(this, arguments);
5364
5459
  }
5365
5460
  return importWalletAssetsSnapshot;
@@ -5371,20 +5466,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5371
5466
  }, {
5372
5467
  key: "refreshWalletAssets",
5373
5468
  value: (function () {
5374
- var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
5469
+ var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
5375
5470
  var _this$store$order$get6, _previousState$custom, _businessData$custome;
5376
5471
  var refreshSequence, wallet, businessData, emptyState, pointCardSnapshotMergeContext, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, _this$store$order$mer2, _this$store$order20, _wallet$getUserIdenti, committed;
5377
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5378
- while (1) switch (_context48.prev = _context48.next) {
5472
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5473
+ while (1) switch (_context50.prev = _context50.next) {
5379
5474
  case 0:
5380
5475
  if (this.store.order) {
5381
- _context48.next = 2;
5476
+ _context50.next = 2;
5382
5477
  break;
5383
5478
  }
5384
5479
  throw new Error('order 模块未初始化');
5385
5480
  case 2:
5386
5481
  if (this.store.payment) {
5387
- _context48.next = 4;
5482
+ _context50.next = 4;
5388
5483
  break;
5389
5484
  }
5390
5485
  throw new Error('payment 模块未初始化');
@@ -5393,7 +5488,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5393
5488
  wallet = this.store.payment.wallet;
5394
5489
  businessData = this.buildWalletInitBusinessData(params);
5395
5490
  if (businessData) {
5396
- _context48.next = 12;
5491
+ _context50.next = 12;
5397
5492
  break;
5398
5493
  }
5399
5494
  wallet.clearAllCache();
@@ -5401,7 +5496,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5401
5496
  this.updateVoucherOrderPayments([], {
5402
5497
  status: 'payment_pending'
5403
5498
  });
5404
- return _context48.abrupt("return", this.publishWalletAssetsState(emptyState));
5499
+ return _context50.abrupt("return", this.publishWalletAssetsState(emptyState));
5405
5500
  case 12:
5406
5501
  pointCardSnapshotMergeContext = {
5407
5502
  customerId: businessData.customer_id,
@@ -5411,49 +5506,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5411
5506
  hasPreviousWalletContext = previousState.status !== 'idle' || previousState.items.length > 0 || previousState.selectedIds.length > 0 || previousState.customerId !== undefined;
5412
5507
  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 : '');
5413
5508
  if (!customerChanged) {
5414
- _context48.next = 21;
5509
+ _context50.next = 21;
5415
5510
  break;
5416
5511
  }
5417
5512
  clearedState = wallet.clearWalletAssetSelection();
5418
5513
  this.updateVoucherOrderPayments([], {
5419
5514
  status: 'payment_pending'
5420
5515
  });
5421
- _context48.next = 21;
5516
+ _context50.next = 21;
5422
5517
  return this.publishWalletAssetsState(clearedState);
5423
5518
  case 21:
5424
5519
  refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
5425
5520
  preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged,
5426
5521
  retainSearchResultCodes: params === null || params === void 0 ? void 0 : params.retainSearchResultCodes
5427
5522
  });
5428
- _context48.next = 24;
5523
+ _context50.next = 24;
5429
5524
  return this.publishWalletAssetsState(wallet.getWalletAssetsState());
5430
5525
  case 24:
5431
- _context48.next = 26;
5526
+ _context50.next = 26;
5432
5527
  return refreshTask;
5433
5528
  case 26:
5434
- state = _context48.sent;
5529
+ state = _context50.sent;
5435
5530
  if (!(refreshSequence !== this.walletAssetsRefreshSequence)) {
5436
- _context48.next = 29;
5531
+ _context50.next = 29;
5437
5532
  break;
5438
5533
  }
5439
- return _context48.abrupt("return", wallet.getWalletAssetsState());
5534
+ return _context50.abrupt("return", wallet.getWalletAssetsState());
5440
5535
  case 29:
5441
5536
  if (state.status !== 'error') {
5442
5537
  committed = this.getCommittedWalletAssets();
5443
5538
  state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5444
5539
  (_this$store$order$mer2 = (_this$store$order20 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer2 === void 0 || _this$store$order$mer2.call(_this$store$order20, ((_wallet$getUserIdenti = wallet.getUserIdentificationCodes) === null || _wallet$getUserIdenti === void 0 ? void 0 : _wallet$getUserIdenti.call(wallet)) || [], pointCardSnapshotMergeContext);
5445
5540
  }
5446
- _context48.next = 32;
5541
+ _context50.next = 32;
5447
5542
  return this.syncSelectedWalletAssets(state);
5448
5543
  case 32:
5449
- return _context48.abrupt("return", this.publishWalletAssetsState(state));
5544
+ return _context50.abrupt("return", this.publishWalletAssetsState(state));
5450
5545
  case 33:
5451
5546
  case "end":
5452
- return _context48.stop();
5547
+ return _context50.stop();
5453
5548
  }
5454
- }, _callee48, this);
5549
+ }, _callee50, this);
5455
5550
  }));
5456
- function refreshWalletAssets(_x41) {
5551
+ function refreshWalletAssets(_x42) {
5457
5552
  return _refreshWalletAssets.apply(this, arguments);
5458
5553
  }
5459
5554
  return refreshWalletAssets;
@@ -5461,13 +5556,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5461
5556
  }, {
5462
5557
  key: "selectWalletAsset",
5463
5558
  value: (function () {
5464
- var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
5559
+ var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
5465
5560
  var state;
5466
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5467
- while (1) switch (_context49.prev = _context49.next) {
5561
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5562
+ while (1) switch (_context51.prev = _context51.next) {
5468
5563
  case 0:
5469
5564
  if (this.store.payment) {
5470
- _context49.next = 2;
5565
+ _context51.next = 2;
5471
5566
  break;
5472
5567
  }
5473
5568
  throw new Error('payment 模块未初始化');
@@ -5476,17 +5571,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5476
5571
  selected: params.selected,
5477
5572
  source: params.source
5478
5573
  });
5479
- _context49.next = 5;
5574
+ _context51.next = 5;
5480
5575
  return this.syncSelectedWalletAssets(state);
5481
5576
  case 5:
5482
- return _context49.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5577
+ return _context51.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5483
5578
  case 6:
5484
5579
  case "end":
5485
- return _context49.stop();
5580
+ return _context51.stop();
5486
5581
  }
5487
- }, _callee49, this);
5582
+ }, _callee51, this);
5488
5583
  }));
5489
- function selectWalletAsset(_x42) {
5584
+ function selectWalletAsset(_x43) {
5490
5585
  return _selectWalletAsset.apply(this, arguments);
5491
5586
  }
5492
5587
  return selectWalletAsset;
@@ -5494,29 +5589,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5494
5589
  }, {
5495
5590
  key: "updateWalletAssetAmount",
5496
5591
  value: (function () {
5497
- var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
5592
+ var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
5498
5593
  var state;
5499
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5500
- while (1) switch (_context50.prev = _context50.next) {
5594
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5595
+ while (1) switch (_context52.prev = _context52.next) {
5501
5596
  case 0:
5502
5597
  if (this.store.payment) {
5503
- _context50.next = 2;
5598
+ _context52.next = 2;
5504
5599
  break;
5505
5600
  }
5506
5601
  throw new Error('payment 模块未初始化');
5507
5602
  case 2:
5508
5603
  state = this.store.payment.wallet.updateWalletAssetAmount(params.assetId, params.amount);
5509
- _context50.next = 5;
5604
+ _context52.next = 5;
5510
5605
  return this.syncSelectedWalletAssets(state);
5511
5606
  case 5:
5512
- return _context50.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5607
+ return _context52.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5513
5608
  case 6:
5514
5609
  case "end":
5515
- return _context50.stop();
5610
+ return _context52.stop();
5516
5611
  }
5517
- }, _callee50, this);
5612
+ }, _callee52, this);
5518
5613
  }));
5519
- function updateWalletAssetAmount(_x43) {
5614
+ function updateWalletAssetAmount(_x44) {
5520
5615
  return _updateWalletAssetAmount.apply(this, arguments);
5521
5616
  }
5522
5617
  return updateWalletAssetAmount;
@@ -5524,13 +5619,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5524
5619
  }, {
5525
5620
  key: "scanWalletAsset",
5526
5621
  value: (function () {
5527
- var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(code) {
5622
+ var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(code) {
5528
5623
  var wallet, businessData, result;
5529
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5530
- while (1) switch (_context51.prev = _context51.next) {
5624
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5625
+ while (1) switch (_context53.prev = _context53.next) {
5531
5626
  case 0:
5532
5627
  if (this.store.payment) {
5533
- _context51.next = 2;
5628
+ _context53.next = 2;
5534
5629
  break;
5535
5630
  }
5536
5631
  throw new Error('payment 模块未初始化');
@@ -5540,28 +5635,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5540
5635
  if (businessData) {
5541
5636
  wallet.generateWalletParams(businessData);
5542
5637
  }
5543
- _context51.next = 7;
5638
+ _context53.next = 7;
5544
5639
  return wallet.scanWalletAssetAsync(code);
5545
5640
  case 7:
5546
- result = _context51.sent;
5641
+ result = _context53.sent;
5547
5642
  if (!(result.type === 'normalCode')) {
5548
- _context51.next = 13;
5643
+ _context53.next = 13;
5549
5644
  break;
5550
5645
  }
5551
- _context51.next = 11;
5646
+ _context53.next = 11;
5552
5647
  return this.syncSelectedWalletAssets(result.state);
5553
5648
  case 11:
5554
- _context51.next = 13;
5649
+ _context53.next = 13;
5555
5650
  return this.publishWalletAssetsState(result.state, 'local');
5556
5651
  case 13:
5557
- return _context51.abrupt("return", result);
5652
+ return _context53.abrupt("return", result);
5558
5653
  case 14:
5559
5654
  case "end":
5560
- return _context51.stop();
5655
+ return _context53.stop();
5561
5656
  }
5562
- }, _callee51, this);
5657
+ }, _callee53, this);
5563
5658
  }));
5564
- function scanWalletAsset(_x44) {
5659
+ function scanWalletAsset(_x45) {
5565
5660
  return _scanWalletAsset.apply(this, arguments);
5566
5661
  }
5567
5662
  return scanWalletAsset;
@@ -5569,27 +5664,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5569
5664
  }, {
5570
5665
  key: "clearWalletAssetSelection",
5571
5666
  value: (function () {
5572
- var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52() {
5667
+ var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54() {
5573
5668
  var state;
5574
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5575
- while (1) switch (_context52.prev = _context52.next) {
5669
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5670
+ while (1) switch (_context54.prev = _context54.next) {
5576
5671
  case 0:
5577
5672
  if (this.store.payment) {
5578
- _context52.next = 2;
5673
+ _context54.next = 2;
5579
5674
  break;
5580
5675
  }
5581
5676
  throw new Error('payment 模块未初始化');
5582
5677
  case 2:
5583
5678
  state = this.store.payment.wallet.clearWalletAssetSelection();
5584
- _context52.next = 5;
5679
+ _context54.next = 5;
5585
5680
  return this.syncSelectedWalletAssets(state);
5586
5681
  case 5:
5587
- return _context52.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5682
+ return _context54.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5588
5683
  case 6:
5589
5684
  case "end":
5590
- return _context52.stop();
5685
+ return _context54.stop();
5591
5686
  }
5592
- }, _callee52, this);
5687
+ }, _callee54, this);
5593
5688
  }));
5594
5689
  function clearWalletAssetSelection() {
5595
5690
  return _clearWalletAssetSelection.apply(this, arguments);
@@ -5626,35 +5721,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5626
5721
  }, {
5627
5722
  key: "getPaymentMethodsAsync",
5628
5723
  value: (function () {
5629
- var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53() {
5724
+ var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55() {
5630
5725
  var response, paymentMethods;
5631
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5632
- while (1) switch (_context53.prev = _context53.next) {
5726
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5727
+ while (1) switch (_context55.prev = _context55.next) {
5633
5728
  case 0:
5634
- _context53.prev = 0;
5635
- _context53.next = 3;
5729
+ _context55.prev = 0;
5730
+ _context55.next = 3;
5636
5731
  return this.request.get('/pay/custom-payment/all', {
5637
5732
  filterPaymentMethods: true
5638
5733
  }, {
5639
5734
  osServer: true
5640
5735
  });
5641
5736
  case 3:
5642
- response = _context53.sent;
5737
+ response = _context55.sent;
5643
5738
  paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
5644
5739
  this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
5645
- return _context53.abrupt("return", this.getPaymentMethods());
5740
+ return _context55.abrupt("return", this.getPaymentMethods());
5646
5741
  case 9:
5647
- _context53.prev = 9;
5648
- _context53.t0 = _context53["catch"](0);
5742
+ _context55.prev = 9;
5743
+ _context55.t0 = _context55["catch"](0);
5649
5744
  this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
5650
- error: _context53.t0 instanceof Error ? _context53.t0.message : String(_context53.t0)
5745
+ error: _context55.t0 instanceof Error ? _context55.t0.message : String(_context55.t0)
5651
5746
  });
5652
- return _context53.abrupt("return", this.getPaymentMethods());
5747
+ return _context55.abrupt("return", this.getPaymentMethods());
5653
5748
  case 13:
5654
5749
  case "end":
5655
- return _context53.stop();
5750
+ return _context55.stop();
5656
5751
  }
5657
- }, _callee53, this, [[0, 9]]);
5752
+ }, _callee55, this, [[0, 9]]);
5658
5753
  }));
5659
5754
  function getPaymentMethodsAsync() {
5660
5755
  return _getPaymentMethodsAsync.apply(this, arguments);
@@ -5703,8 +5798,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5703
5798
  }, {
5704
5799
  key: "getCashPaymentConfig",
5705
5800
  value: (function () {
5706
- var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54() {
5707
- var _this$store$order24, _this$store$order24$g, _this$store$order25, _this$store$order25$g, _this$otherParams38;
5801
+ var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56() {
5802
+ var _this$store$order24, _this$store$order24$g, _this$store$order25, _this$store$order25$g, _this$otherParams40;
5708
5803
  var options,
5709
5804
  paymentMethods,
5710
5805
  paymentMethod,
@@ -5713,13 +5808,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5713
5808
  amountDue,
5714
5809
  currency,
5715
5810
  recommendedAmounts,
5716
- _args54 = arguments;
5717
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5718
- while (1) switch (_context54.prev = _context54.next) {
5811
+ _args56 = arguments;
5812
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5813
+ while (1) switch (_context56.prev = _context56.next) {
5719
5814
  case 0:
5720
- options = _args54.length > 0 && _args54[0] !== undefined ? _args54[0] : {};
5815
+ options = _args56.length > 0 && _args56[0] !== undefined ? _args56[0] : {};
5721
5816
  if (this.store.payment) {
5722
- _context54.next = 3;
5817
+ _context56.next = 3;
5723
5818
  break;
5724
5819
  }
5725
5820
  throw new Error('payment 模块未初始化');
@@ -5727,17 +5822,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5727
5822
  paymentMethods = this.getPaymentMethods();
5728
5823
  paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
5729
5824
  if (paymentMethod) {
5730
- _context54.next = 10;
5825
+ _context56.next = 10;
5731
5826
  break;
5732
5827
  }
5733
- _context54.next = 8;
5828
+ _context56.next = 8;
5734
5829
  return this.getPaymentMethodsAsync();
5735
5830
  case 8:
5736
- paymentMethods = _context54.sent;
5831
+ paymentMethods = _context56.sent;
5737
5832
  paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
5738
5833
  case 10:
5739
5834
  if (!(!paymentMethod && options.paymentMethodId !== undefined)) {
5740
- _context54.next = 12;
5835
+ _context56.next = 12;
5741
5836
  break;
5742
5837
  }
5743
5838
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u73B0\u91D1\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(options.paymentMethodId));
@@ -5745,9 +5840,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5745
5840
  amountSnapshot = (_this$store$order24 = this.store.order) === null || _this$store$order24 === void 0 || (_this$store$order24$g = _this$store$order24.getOrderAmountSnapshot) === null || _this$store$order24$g === void 0 ? void 0 : _this$store$order24$g.call(_this$store$order24);
5746
5841
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
5747
5842
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
5748
- currency = ((_this$store$order25 = this.store.order) === null || _this$store$order25 === void 0 || (_this$store$order25$g = _this$store$order25.getTempOrder) === null || _this$store$order25$g === void 0 || (_this$store$order25$g = _this$store$order25$g.call(_this$store$order25)) === null || _this$store$order25$g === void 0 ? void 0 : _this$store$order25$g.currency_code) || ((_this$otherParams38 = this.otherParams) === null || _this$otherParams38 === void 0 ? void 0 : _this$otherParams38.currency) || 'USD';
5843
+ currency = ((_this$store$order25 = this.store.order) === null || _this$store$order25 === void 0 || (_this$store$order25$g = _this$store$order25.getTempOrder) === null || _this$store$order25$g === void 0 || (_this$store$order25$g = _this$store$order25$g.call(_this$store$order25)) === null || _this$store$order25$g === void 0 ? void 0 : _this$store$order25$g.currency_code) || ((_this$otherParams40 = this.otherParams) === null || _this$otherParams40 === void 0 ? void 0 : _this$otherParams40.currency) || 'USD';
5749
5844
  recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
5750
- return _context54.abrupt("return", {
5845
+ return _context56.abrupt("return", {
5751
5846
  available: Boolean(paymentMethod && amountDue > 0),
5752
5847
  paymentMethod: paymentMethod,
5753
5848
  amountDue: amountDue,
@@ -5755,9 +5850,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5755
5850
  });
5756
5851
  case 18:
5757
5852
  case "end":
5758
- return _context54.stop();
5853
+ return _context56.stop();
5759
5854
  }
5760
- }, _callee54, this);
5855
+ }, _callee56, this);
5761
5856
  }));
5762
5857
  function getCashPaymentConfig() {
5763
5858
  return _getCashPaymentConfig.apply(this, arguments);
@@ -5774,14 +5869,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5774
5869
  }, {
5775
5870
  key: "confirmWalletPayment",
5776
5871
  value: (function () {
5777
- var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55() {
5872
+ var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57() {
5778
5873
  var _this$store$order$get9, _this$store$order26, _this$store$order$get11, _this$store$order$get12, _this$store$order28;
5779
5874
  var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get10, _this$store$order27, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
5780
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5781
- while (1) switch (_context55.prev = _context55.next) {
5875
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5876
+ while (1) switch (_context57.prev = _context57.next) {
5782
5877
  case 0:
5783
5878
  if (this.store.order) {
5784
- _context55.next = 2;
5879
+ _context57.next = 2;
5785
5880
  break;
5786
5881
  }
5787
5882
  throw new Error('order 模块未初始化');
@@ -5790,26 +5885,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5790
5885
  pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
5791
5886
  amountSnapshot = (_this$store$order$get9 = (_this$store$order26 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.call(_this$store$order26);
5792
5887
  if (!pendingWalletAmount.lte(0)) {
5793
- _context55.next = 14;
5888
+ _context57.next = 14;
5794
5889
  break;
5795
5890
  }
5796
5891
  this.logWarning('confirmWalletPayment: 未发现待确认 Wallet 支付,跳过 Wallet 确认并按普通订单提交', {
5797
5892
  amountGap: amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap
5798
5893
  });
5799
- _context55.next = 9;
5894
+ _context57.next = 9;
5800
5895
  return this.submitSalesOrder({
5801
5896
  smallTicketDataFlag: 1
5802
5897
  });
5803
5898
  case 9:
5804
- _submitResult = _context55.sent;
5899
+ _submitResult = _context57.sent;
5805
5900
  if (!isRejectedSalesSubmitResult(_submitResult)) {
5806
- _context55.next = 12;
5901
+ _context57.next = 12;
5807
5902
  break;
5808
5903
  }
5809
5904
  throw new Error(getSalesSubmitErrorMessage(_submitResult, '订单提交失败'));
5810
5905
  case 12:
5811
5906
  _latestAmountSnapshot = (_this$store$order$get10 = (_this$store$order27 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get10 === void 0 ? void 0 : _this$store$order$get10.call(_this$store$order27);
5812
- return _context55.abrupt("return", {
5907
+ return _context57.abrupt("return", {
5813
5908
  submitResult: _submitResult,
5814
5909
  payments: this.store.order.getOrderPayments(),
5815
5910
  isOrderFullyPaid: new Decimal((_latestAmountSnapshot === null || _latestAmountSnapshot === void 0 ? void 0 : _latestAmountSnapshot.amountGap) || 0).lte(0)
@@ -5817,74 +5912,74 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5817
5912
  case 14:
5818
5913
  effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
5819
5914
  if (!effectiveAmountDue.gt(0.01)) {
5820
- _context55.next = 17;
5915
+ _context57.next = 17;
5821
5916
  break;
5822
5917
  }
5823
5918
  throw new Error('Wallet 支付尚未覆盖全部待支付金额');
5824
5919
  case 17:
5825
5920
  beforePaymentStatus = (_this$store$order$get11 = this.store.order.getTempOrder()) === null || _this$store$order$get11 === void 0 ? void 0 : _this$store$order$get11.payment_status;
5826
- _context55.prev = 18;
5827
- _context55.next = 21;
5921
+ _context57.prev = 18;
5922
+ _context57.next = 21;
5828
5923
  return this.submitSalesOrder({
5829
5924
  smallTicketDataFlag: 1,
5830
5925
  confirmPendingVoucherPayments: true
5831
5926
  });
5832
5927
  case 21:
5833
- submitResult = _context55.sent;
5928
+ submitResult = _context57.sent;
5834
5929
  if (!isRejectedSalesSubmitResult(submitResult)) {
5835
- _context55.next = 24;
5930
+ _context57.next = 24;
5836
5931
  break;
5837
5932
  }
5838
5933
  throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
5839
5934
  case 24:
5840
- _context55.next = 34;
5935
+ _context57.next = 34;
5841
5936
  break;
5842
5937
  case 26:
5843
- _context55.prev = 26;
5844
- _context55.t0 = _context55["catch"](18);
5938
+ _context57.prev = 26;
5939
+ _context57.t0 = _context57["catch"](18);
5845
5940
  this.store.order.setOrderPayments(beforePayments);
5846
5941
  restoredTempOrder = this.store.order.getTempOrder();
5847
5942
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
5848
5943
  restoredTempOrder.payment_status = beforePaymentStatus;
5849
5944
  this.store.order.persistTempOrder();
5850
5945
  }
5851
- _context55.next = 33;
5946
+ _context57.next = 33;
5852
5947
  return this.store.order.recalculateSummary({
5853
5948
  createIfMissing: true
5854
5949
  });
5855
5950
  case 33:
5856
- throw _context55.t0;
5951
+ throw _context57.t0;
5857
5952
  case 34:
5858
5953
  if (!this.store.payment) {
5859
- _context55.next = 45;
5954
+ _context57.next = 45;
5860
5955
  break;
5861
5956
  }
5862
- _context55.prev = 35;
5957
+ _context57.prev = 35;
5863
5958
  committed = this.getCommittedWalletAssets();
5864
5959
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5865
- _context55.next = 40;
5960
+ _context57.next = 40;
5866
5961
  return this.publishWalletAssetsState(walletState, 'local');
5867
5962
  case 40:
5868
- _context55.next = 45;
5963
+ _context57.next = 45;
5869
5964
  break;
5870
5965
  case 42:
5871
- _context55.prev = 42;
5872
- _context55.t1 = _context55["catch"](35);
5966
+ _context57.prev = 42;
5967
+ _context57.t1 = _context57["catch"](35);
5873
5968
  this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
5874
- error: _context55.t1 instanceof Error ? _context55.t1.message : String(_context55.t1)
5969
+ error: _context57.t1 instanceof Error ? _context57.t1.message : String(_context57.t1)
5875
5970
  });
5876
5971
  case 45:
5877
5972
  latestAmountSnapshot = (_this$store$order$get12 = (_this$store$order28 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get12 === void 0 ? void 0 : _this$store$order$get12.call(_this$store$order28);
5878
- return _context55.abrupt("return", {
5973
+ return _context57.abrupt("return", {
5879
5974
  submitResult: submitResult,
5880
5975
  payments: this.store.order.getOrderPayments(),
5881
5976
  isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
5882
5977
  });
5883
5978
  case 47:
5884
5979
  case "end":
5885
- return _context55.stop();
5980
+ return _context57.stop();
5886
5981
  }
5887
- }, _callee55, this, [[18, 26], [35, 42]]);
5982
+ }, _callee57, this, [[18, 26], [35, 42]]);
5888
5983
  }));
5889
5984
  function confirmWalletPayment() {
5890
5985
  return _confirmWalletPayment.apply(this, arguments);
@@ -5899,53 +5994,53 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5899
5994
  }, {
5900
5995
  key: "payCash",
5901
5996
  value: (function () {
5902
- var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
5903
- var _this$store$order$get13, _params$actualPaidAmo, _this$otherParams39, _this$window, _this$window$postMess;
5997
+ var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
5998
+ var _this$store$order$get13, _params$actualPaidAmo, _this$otherParams41, _this$window, _this$window$postMess;
5904
5999
  var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
5905
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5906
- while (1) switch (_context56.prev = _context56.next) {
6000
+ return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6001
+ while (1) switch (_context58.prev = _context58.next) {
5907
6002
  case 0:
5908
6003
  if (this.store.order) {
5909
- _context56.next = 2;
6004
+ _context58.next = 2;
5910
6005
  break;
5911
6006
  }
5912
6007
  throw new Error('order 模块未初始化');
5913
6008
  case 2:
5914
6009
  amount = Number(params.amount || 0);
5915
6010
  if (!(!Number.isFinite(amount) || amount <= 0)) {
5916
- _context56.next = 5;
6011
+ _context58.next = 5;
5917
6012
  break;
5918
6013
  }
5919
6014
  throw new Error('现金支付金额必须大于 0');
5920
6015
  case 5:
5921
6016
  if (!(params.paymentMethodId === undefined)) {
5922
- _context56.next = 11;
6017
+ _context58.next = 11;
5923
6018
  break;
5924
6019
  }
5925
- _context56.next = 8;
6020
+ _context58.next = 8;
5926
6021
  return this.getCashPaymentConfig();
5927
6022
  case 8:
5928
- _context56.t0 = _context56.sent;
5929
- _context56.next = 14;
6023
+ _context58.t0 = _context58.sent;
6024
+ _context58.next = 14;
5930
6025
  break;
5931
6026
  case 11:
5932
- _context56.next = 13;
6027
+ _context58.next = 13;
5933
6028
  return this.getCashPaymentConfig({
5934
6029
  paymentMethodId: params.paymentMethodId
5935
6030
  });
5936
6031
  case 13:
5937
- _context56.t0 = _context56.sent;
6032
+ _context58.t0 = _context58.sent;
5938
6033
  case 14:
5939
- config = _context56.t0;
6034
+ config = _context58.t0;
5940
6035
  paymentMethod = config.paymentMethod;
5941
6036
  if (paymentMethod) {
5942
- _context56.next = 18;
6037
+ _context58.next = 18;
5943
6038
  break;
5944
6039
  }
5945
6040
  throw new Error('未找到可用的 CASHMANUAL 支付方式');
5946
6041
  case 18:
5947
6042
  if (!(config.amountDue <= 0)) {
5948
- _context56.next = 20;
6043
+ _context58.next = 20;
5949
6044
  break;
5950
6045
  }
5951
6046
  throw new Error('当前订单没有待支付金额');
@@ -5953,7 +6048,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5953
6048
  roundingAmount = Number(params.roundingAmount || 0);
5954
6049
  effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
5955
6050
  if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
5956
- _context56.next = 24;
6051
+ _context58.next = 24;
5957
6052
  break;
5958
6053
  }
5959
6054
  throw new Error('现金支付金额超过当前待支付金额');
@@ -5964,18 +6059,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5964
6059
  paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
5965
6060
  actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
5966
6061
  changeAmount = Number(params.changeAmount || 0);
5967
- shopWalletPassId = (_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.shop_wallet_pass_id;
6062
+ shopWalletPassId = (_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41.shop_wallet_pass_id;
5968
6063
  if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
5969
- _context56.next = 33;
6064
+ _context58.next = 33;
5970
6065
  break;
5971
6066
  }
5972
6067
  throw new Error('顾客实收现金不能小于支付金额');
5973
6068
  case 33:
5974
6069
  if (!this.isPickupTimingEnabled()) {
5975
- _context56.next = 36;
6070
+ _context58.next = 36;
5976
6071
  break;
5977
6072
  }
5978
- _context56.next = 36;
6073
+ _context58.next = 36;
5979
6074
  return this.preparePickupTimingForCheckout({
5980
6075
  freeze: true
5981
6076
  });
@@ -6010,8 +6105,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6010
6105
  var _item$metadata2;
6011
6106
  return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
6012
6107
  });
6013
- _context56.prev = 39;
6014
- _context56.next = 42;
6108
+ _context58.prev = 39;
6109
+ _context58.next = 42;
6015
6110
  return this.syncPaymentsToOrder({
6016
6111
  payments: payments,
6017
6112
  submitWhenPaid: true,
@@ -6019,50 +6114,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6019
6114
  confirmPendingVoucherPayments: true
6020
6115
  });
6021
6116
  case 42:
6022
- syncResult = _context56.sent;
6117
+ syncResult = _context58.sent;
6023
6118
  if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
6024
- _context56.next = 45;
6119
+ _context58.next = 45;
6025
6120
  break;
6026
6121
  }
6027
6122
  throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
6028
6123
  case 45:
6029
6124
  if (!this.store.payment) {
6030
- _context56.next = 50;
6125
+ _context58.next = 50;
6031
6126
  break;
6032
6127
  }
6033
6128
  committed = this.getCommittedWalletAssets();
6034
6129
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
6035
- _context56.next = 50;
6130
+ _context58.next = 50;
6036
6131
  return this.publishWalletAssetsState(walletState, 'local');
6037
6132
  case 50:
6038
- return _context56.abrupt("return", {
6133
+ return _context58.abrupt("return", {
6039
6134
  payment: payment || {},
6040
6135
  payments: this.store.order.getOrderPayments(),
6041
6136
  syncResult: syncResult,
6042
6137
  isOrderFullyPaid: syncResult.isOrderFullyPaid
6043
6138
  });
6044
6139
  case 53:
6045
- _context56.prev = 53;
6046
- _context56.t1 = _context56["catch"](39);
6140
+ _context58.prev = 53;
6141
+ _context58.t1 = _context58["catch"](39);
6047
6142
  this.store.order.setOrderPayments(beforePayments);
6048
6143
  restoredTempOrder = this.store.order.getTempOrder();
6049
6144
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
6050
6145
  restoredTempOrder.payment_status = beforePaymentStatus;
6051
6146
  this.store.order.persistTempOrder();
6052
6147
  }
6053
- _context56.next = 60;
6148
+ _context58.next = 60;
6054
6149
  return this.store.order.recalculateSummary({
6055
6150
  createIfMissing: true
6056
6151
  });
6057
6152
  case 60:
6058
- throw _context56.t1;
6153
+ throw _context58.t1;
6059
6154
  case 61:
6060
6155
  case "end":
6061
- return _context56.stop();
6156
+ return _context58.stop();
6062
6157
  }
6063
- }, _callee56, this, [[39, 53]]);
6158
+ }, _callee58, this, [[39, 53]]);
6064
6159
  }));
6065
- function payCash(_x45) {
6160
+ function payCash(_x46) {
6066
6161
  return _payCash.apply(this, arguments);
6067
6162
  }
6068
6163
  return payCash;
@@ -6078,21 +6173,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6078
6173
  }, {
6079
6174
  key: "commitPaymentMethodPayment",
6080
6175
  value: (function () {
6081
- var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
6176
+ var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(params) {
6082
6177
  var _this$store$order$get14, _this$store$order29, _this$store$order$get15, _params$metadata, _params$originAmount;
6083
6178
  var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
6084
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6085
- while (1) switch (_context57.prev = _context57.next) {
6179
+ return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6180
+ while (1) switch (_context59.prev = _context59.next) {
6086
6181
  case 0:
6087
6182
  if (this.store.order) {
6088
- _context57.next = 2;
6183
+ _context59.next = 2;
6089
6184
  break;
6090
6185
  }
6091
6186
  throw new Error('order 模块未初始化');
6092
6187
  case 2:
6093
6188
  amount = Number(params.amount || 0);
6094
6189
  if (!(!Number.isFinite(amount) || amount <= 0)) {
6095
- _context57.next = 5;
6190
+ _context59.next = 5;
6096
6191
  break;
6097
6192
  }
6098
6193
  throw new Error('支付金额必须大于 0');
@@ -6108,17 +6203,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6108
6203
  };
6109
6204
  paymentMethod = findPaymentMethod();
6110
6205
  if (paymentMethod) {
6111
- _context57.next = 13;
6206
+ _context59.next = 13;
6112
6207
  break;
6113
6208
  }
6114
- _context57.next = 11;
6209
+ _context59.next = 11;
6115
6210
  return this.getPaymentMethodsAsync();
6116
6211
  case 11:
6117
- paymentMethods = _context57.sent;
6212
+ paymentMethods = _context59.sent;
6118
6213
  paymentMethod = findPaymentMethod();
6119
6214
  case 13:
6120
6215
  if (paymentMethod) {
6121
- _context57.next = 15;
6216
+ _context59.next = 15;
6122
6217
  break;
6123
6218
  }
6124
6219
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
@@ -6127,13 +6222,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6127
6222
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
6128
6223
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
6129
6224
  if (!amountDue.lte(0)) {
6130
- _context57.next = 20;
6225
+ _context59.next = 20;
6131
6226
  break;
6132
6227
  }
6133
6228
  throw new Error('当前订单没有待支付金额');
6134
6229
  case 20:
6135
6230
  if (!new Decimal(amount).gt(amountDue.plus(0.01))) {
6136
- _context57.next = 22;
6231
+ _context59.next = 22;
6137
6232
  break;
6138
6233
  }
6139
6234
  throw new Error('支付金额超过当前待支付金额');
@@ -6172,8 +6267,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6172
6267
  var _item$metadata3;
6173
6268
  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;
6174
6269
  });
6175
- _context57.prev = 30;
6176
- _context57.next = 33;
6270
+ _context59.prev = 30;
6271
+ _context59.next = 33;
6177
6272
  return this.syncPaymentsToOrder({
6178
6273
  payments: payments,
6179
6274
  submitWhenPaid: true,
@@ -6181,50 +6276,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6181
6276
  confirmPendingVoucherPayments: true
6182
6277
  });
6183
6278
  case 33:
6184
- syncResult = _context57.sent;
6279
+ syncResult = _context59.sent;
6185
6280
  if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
6186
- _context57.next = 36;
6281
+ _context59.next = 36;
6187
6282
  break;
6188
6283
  }
6189
6284
  throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
6190
6285
  case 36:
6191
6286
  if (!this.store.payment) {
6192
- _context57.next = 41;
6287
+ _context59.next = 41;
6193
6288
  break;
6194
6289
  }
6195
6290
  committed = this.getCommittedWalletAssets();
6196
6291
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
6197
- _context57.next = 41;
6292
+ _context59.next = 41;
6198
6293
  return this.publishWalletAssetsState(walletState, 'local');
6199
6294
  case 41:
6200
- return _context57.abrupt("return", {
6295
+ return _context59.abrupt("return", {
6201
6296
  payment: payment || {},
6202
6297
  payments: this.store.order.getOrderPayments(),
6203
6298
  syncResult: syncResult,
6204
6299
  isOrderFullyPaid: syncResult.isOrderFullyPaid
6205
6300
  });
6206
6301
  case 44:
6207
- _context57.prev = 44;
6208
- _context57.t0 = _context57["catch"](30);
6302
+ _context59.prev = 44;
6303
+ _context59.t0 = _context59["catch"](30);
6209
6304
  this.store.order.setOrderPayments(beforePayments);
6210
6305
  restoredTempOrder = this.store.order.getTempOrder();
6211
6306
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
6212
6307
  restoredTempOrder.payment_status = beforePaymentStatus;
6213
6308
  this.store.order.persistTempOrder();
6214
6309
  }
6215
- _context57.next = 51;
6310
+ _context59.next = 51;
6216
6311
  return this.store.order.recalculateSummary({
6217
6312
  createIfMissing: true
6218
6313
  });
6219
6314
  case 51:
6220
- throw _context57.t0;
6315
+ throw _context59.t0;
6221
6316
  case 52:
6222
6317
  case "end":
6223
- return _context57.stop();
6318
+ return _context59.stop();
6224
6319
  }
6225
- }, _callee57, this, [[30, 44]]);
6320
+ }, _callee59, this, [[30, 44]]);
6226
6321
  }));
6227
- function commitPaymentMethodPayment(_x46) {
6322
+ function commitPaymentMethodPayment(_x47) {
6228
6323
  return _commitPaymentMethodPayment.apply(this, arguments);
6229
6324
  }
6230
6325
  return commitPaymentMethodPayment;
@@ -6239,40 +6334,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6239
6334
  }, {
6240
6335
  key: "roundAmount",
6241
6336
  value: (function () {
6242
- var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
6337
+ var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
6243
6338
  var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
6244
6339
  var amount, cashManualPayment;
6245
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6246
- while (1) switch (_context58.prev = _context58.next) {
6340
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6341
+ while (1) switch (_context60.prev = _context60.next) {
6247
6342
  case 0:
6248
6343
  amount = params.amount;
6249
6344
  cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
6250
6345
  return paymentMethod.code === 'CASHMANUAL';
6251
6346
  });
6252
6347
  if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
6253
- _context58.next = 4;
6348
+ _context60.next = 4;
6254
6349
  break;
6255
6350
  }
6256
- return _context58.abrupt("return", {
6351
+ return _context60.abrupt("return", {
6257
6352
  originalAmount: amount.toString(),
6258
6353
  roundedAmount: amount.toString(),
6259
6354
  roundingDifference: '0.00'
6260
6355
  });
6261
6356
  case 4:
6262
6357
  if (this.payment) {
6263
- _context58.next = 6;
6358
+ _context60.next = 6;
6264
6359
  break;
6265
6360
  }
6266
6361
  throw new Error('payment 模块未初始化');
6267
6362
  case 6:
6268
- return _context58.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));
6363
+ return _context60.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));
6269
6364
  case 7:
6270
6365
  case "end":
6271
- return _context58.stop();
6366
+ return _context60.stop();
6272
6367
  }
6273
- }, _callee58, this);
6368
+ }, _callee60, this);
6274
6369
  }));
6275
- function roundAmount(_x47) {
6370
+ function roundAmount(_x48) {
6276
6371
  return _roundAmount.apply(this, arguments);
6277
6372
  }
6278
6373
  return roundAmount;
@@ -6287,49 +6382,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6287
6382
  }, {
6288
6383
  key: "sendCustomerPayLink",
6289
6384
  value: (function () {
6290
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(params) {
6385
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(params) {
6291
6386
  var orderIds, _ref53, _ref54, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
6292
- return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6293
- while (1) switch (_context59.prev = _context59.next) {
6387
+ return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6388
+ while (1) switch (_context61.prev = _context61.next) {
6294
6389
  case 0:
6295
6390
  if (this.store.order) {
6296
- _context59.next = 2;
6391
+ _context61.next = 2;
6297
6392
  break;
6298
6393
  }
6299
6394
  throw new Error('order 模块未初始化');
6300
6395
  case 2:
6301
6396
  orderIds = params.order_ids || params.orderIds || [];
6302
6397
  if (!(!orderIds.length || params.submitBeforeSend)) {
6303
- _context59.next = 11;
6398
+ _context61.next = 11;
6304
6399
  break;
6305
6400
  }
6306
- _context59.next = 6;
6401
+ _context61.next = 6;
6307
6402
  return this.submitSalesOrder({
6308
6403
  smallTicketDataFlag: 1
6309
6404
  });
6310
6405
  case 6:
6311
- submitResult = _context59.sent;
6406
+ submitResult = _context61.sent;
6312
6407
  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;
6313
6408
  if (orderId) {
6314
- _context59.next = 10;
6409
+ _context61.next = 10;
6315
6410
  break;
6316
6411
  }
6317
6412
  throw new Error('本地订单提交云端失败,无法发送支付链接');
6318
6413
  case 10:
6319
6414
  orderIds = [orderId];
6320
6415
  case 11:
6321
- return _context59.abrupt("return", this.store.order.sendCustomerPayLink({
6416
+ return _context61.abrupt("return", this.store.order.sendCustomerPayLink({
6322
6417
  emails: params.emails,
6323
6418
  notify_action: params.notify_action,
6324
6419
  order_ids: orderIds
6325
6420
  }));
6326
6421
  case 12:
6327
6422
  case "end":
6328
- return _context59.stop();
6423
+ return _context61.stop();
6329
6424
  }
6330
- }, _callee59, this);
6425
+ }, _callee61, this);
6331
6426
  }));
6332
- function sendCustomerPayLink(_x48) {
6427
+ function sendCustomerPayLink(_x49) {
6333
6428
  return _sendCustomerPayLink.apply(this, arguments);
6334
6429
  }
6335
6430
  return sendCustomerPayLink;
@@ -6342,20 +6437,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6342
6437
  }, {
6343
6438
  key: "calculateProductBookingPrice",
6344
6439
  value: function () {
6345
- var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
6440
+ var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(params) {
6346
6441
  var _params$customer_id;
6347
6442
  var useCustomerUserPricing, quotation, customerId, channel, _yield$this$resolvePr, _yield$this$resolvePr2, authoritativeProduct, product;
6348
- return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6349
- while (1) switch (_context60.prev = _context60.next) {
6443
+ return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6444
+ while (1) switch (_context62.prev = _context62.next) {
6350
6445
  case 0:
6351
6446
  useCustomerUserPricing = this.isCustomerUserPriceQuery();
6352
6447
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
6353
6448
  customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
6354
- _context60.next = 5;
6449
+ _context62.next = 5;
6355
6450
  return this.prepareProductPriceQueryContext(customerId);
6356
6451
  case 5:
6357
6452
  channel = this.getPriceQueryChannel(params.channel);
6358
- _context60.next = 8;
6453
+ _context62.next = 8;
6359
6454
  return this.resolveProductsForPriceQuery({
6360
6455
  priceQueries: [params],
6361
6456
  schedule: this.getPriceQuerySchedule(params),
@@ -6363,22 +6458,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6363
6458
  channel: channel
6364
6459
  });
6365
6460
  case 8:
6366
- _yield$this$resolvePr = _context60.sent;
6461
+ _yield$this$resolvePr = _context62.sent;
6367
6462
  _yield$this$resolvePr2 = _slicedToArray(_yield$this$resolvePr, 1);
6368
6463
  authoritativeProduct = _yield$this$resolvePr2[0];
6369
6464
  product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
6370
6465
  if (useCustomerUserPricing) {
6371
- _context60.next = 15;
6466
+ _context62.next = 15;
6372
6467
  break;
6373
6468
  }
6374
- _context60.next = 15;
6469
+ _context62.next = 15;
6375
6470
  return this.loadQuotationForPriceQuery({
6376
6471
  quotation: quotation,
6377
6472
  customer_id: customerId,
6378
6473
  channel: channel
6379
6474
  });
6380
6475
  case 15:
6381
- return _context60.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
6476
+ return _context62.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
6382
6477
  channel: channel,
6383
6478
  product: product,
6384
6479
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
@@ -6387,11 +6482,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6387
6482
  })));
6388
6483
  case 16:
6389
6484
  case "end":
6390
- return _context60.stop();
6485
+ return _context62.stop();
6391
6486
  }
6392
- }, _callee60, this);
6487
+ }, _callee62, this);
6393
6488
  }));
6394
- function calculateProductBookingPrice(_x49) {
6489
+ function calculateProductBookingPrice(_x50) {
6395
6490
  return _calculateProductBookingPrice.apply(this, arguments);
6396
6491
  }
6397
6492
  return calculateProductBookingPrice;
@@ -6399,7 +6494,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6399
6494
  }, {
6400
6495
  key: "getQuotationCustomerScopeInfo",
6401
6496
  value: function getQuotationCustomerScopeInfo() {
6402
- var _this20 = this;
6497
+ var _this21 = this;
6403
6498
  var quotation = this.store.quotation;
6404
6499
  if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
6405
6500
  return quotation.getQuotationCustomerScopeInfo();
@@ -6411,7 +6506,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6411
6506
  }).map(function (item) {
6412
6507
  var localSeen = new Set();
6413
6508
  var customers = item.customer.filter(function (customer) {
6414
- var customerId = _this20.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
6509
+ var customerId = _this21.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
6415
6510
  if (!customerId || localSeen.has(customerId)) return false;
6416
6511
  localSeen.add(customerId);
6417
6512
  if (!customerById.has(customerId)) customerById.set(customerId, customer);
@@ -6475,23 +6570,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6475
6570
  }, {
6476
6571
  key: "calculateProductBookingPrices",
6477
6572
  value: function () {
6478
- var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(paramsList) {
6479
- var _this21 = this;
6573
+ var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(paramsList) {
6574
+ var _this22 = this;
6480
6575
  var useCustomerUserPricing, quotation, currentOrderCustomerId, resolvedChannels, authoritativeProducts, groups, quotationContexts;
6481
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6482
- while (1) switch (_context62.prev = _context62.next) {
6576
+ return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6577
+ while (1) switch (_context64.prev = _context64.next) {
6483
6578
  case 0:
6484
6579
  if (paramsList.length) {
6485
- _context62.next = 2;
6580
+ _context64.next = 2;
6486
6581
  break;
6487
6582
  }
6488
- return _context62.abrupt("return", []);
6583
+ return _context64.abrupt("return", []);
6489
6584
  case 2:
6490
6585
  useCustomerUserPricing = this.isCustomerUserPriceQuery();
6491
6586
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
6492
6587
  currentOrderCustomerId = this.getCurrentOrderCustomerId();
6493
6588
  resolvedChannels = paramsList.map(function (params) {
6494
- return _this21.getPriceQueryChannel(params.channel);
6589
+ return _this22.getPriceQueryChannel(params.channel);
6495
6590
  });
6496
6591
  authoritativeProducts = paramsList.map(function () {
6497
6592
  return null;
@@ -6499,10 +6594,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6499
6594
  groups = new Map();
6500
6595
  paramsList.forEach(function (params, index) {
6501
6596
  var _params$customer_id2;
6502
- var schedule = _this21.getPriceQuerySchedule(params);
6597
+ var schedule = _this22.getPriceQuerySchedule(params);
6503
6598
  var channel = resolvedChannels[index];
6504
6599
  var customerId = (_params$customer_id2 = params.customer_id) !== null && _params$customer_id2 !== void 0 ? _params$customer_id2 : currentOrderCustomerId;
6505
- var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || '', _this21.normalizePriceContextCustomerId(customerId) || ''].join('|');
6600
+ var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || '', _this22.normalizePriceContextCustomerId(customerId) || ''].join('|');
6506
6601
  var group = groups.get(groupKey) || {
6507
6602
  indices: [],
6508
6603
  schedule: schedule,
@@ -6512,44 +6607,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6512
6607
  group.indices.push(index);
6513
6608
  groups.set(groupKey, group);
6514
6609
  });
6515
- _context62.next = 11;
6610
+ _context64.next = 11;
6516
6611
  return Promise.all(Array.from(groups.values()).map( /*#__PURE__*/function () {
6517
- var _ref55 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(group) {
6612
+ var _ref55 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(group) {
6518
6613
  var priceQueries, resolvedProducts;
6519
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6520
- while (1) switch (_context61.prev = _context61.next) {
6614
+ return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6615
+ while (1) switch (_context63.prev = _context63.next) {
6521
6616
  case 0:
6522
- _context61.next = 2;
6523
- return _this21.prepareProductPriceQueryContext(group.customerId);
6617
+ _context63.next = 2;
6618
+ return _this22.prepareProductPriceQueryContext(group.customerId);
6524
6619
  case 2:
6525
6620
  priceQueries = group.indices.map(function (index) {
6526
6621
  return paramsList[index];
6527
6622
  });
6528
- _context61.next = 5;
6529
- return _this21.resolveProductsForPriceQuery({
6623
+ _context63.next = 5;
6624
+ return _this22.resolveProductsForPriceQuery({
6530
6625
  priceQueries: priceQueries,
6531
6626
  schedule: group.schedule,
6532
6627
  customerId: group.customerId,
6533
6628
  channel: group.channel
6534
6629
  });
6535
6630
  case 5:
6536
- resolvedProducts = _context61.sent;
6631
+ resolvedProducts = _context63.sent;
6537
6632
  group.indices.forEach(function (originalIndex, groupIndex) {
6538
6633
  authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
6539
6634
  });
6540
6635
  case 7:
6541
6636
  case "end":
6542
- return _context61.stop();
6637
+ return _context63.stop();
6543
6638
  }
6544
- }, _callee61);
6639
+ }, _callee63);
6545
6640
  }));
6546
- return function (_x51) {
6641
+ return function (_x52) {
6547
6642
  return _ref55.apply(this, arguments);
6548
6643
  };
6549
6644
  }()));
6550
6645
  case 11:
6551
6646
  if (useCustomerUserPricing) {
6552
- _context62.next = 16;
6647
+ _context64.next = 16;
6553
6648
  break;
6554
6649
  }
6555
6650
  quotationContexts = new Map();
@@ -6563,18 +6658,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6563
6658
  customer_id: (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId
6564
6659
  });
6565
6660
  });
6566
- _context62.next = 16;
6661
+ _context64.next = 16;
6567
6662
  return Promise.all(Array.from(quotationContexts.values()).map(function (context) {
6568
- return _this21.loadQuotationForPriceQuery(_objectSpread({
6663
+ return _this22.loadQuotationForPriceQuery(_objectSpread({
6569
6664
  quotation: quotation
6570
6665
  }, context));
6571
6666
  }));
6572
6667
  case 16:
6573
- return _context62.abrupt("return", paramsList.map(function (params, index) {
6668
+ return _context64.abrupt("return", paramsList.map(function (params, index) {
6574
6669
  var _params$customer_id4;
6575
6670
  var productInput = params.product || {};
6576
6671
  var authoritativeProduct = authoritativeProducts[index];
6577
- var product = _this21.mergeProductForPriceQuery(productInput, authoritativeProduct);
6672
+ var product = _this22.mergeProductForPriceQuery(productInput, authoritativeProduct);
6578
6673
  var customerId = (_params$customer_id4 = params.customer_id) !== null && _params$customer_id4 !== void 0 ? _params$customer_id4 : currentOrderCustomerId;
6579
6674
  var channel = resolvedChannels[index];
6580
6675
  return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
@@ -6582,16 +6677,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6582
6677
  product: product,
6583
6678
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
6584
6679
  customer_id: customerId,
6585
- quotation: authoritativeProduct && _this21.preferAuthoritativeProductQueryPrice() ? undefined : quotation
6680
+ quotation: authoritativeProduct && _this22.preferAuthoritativeProductQueryPrice() ? undefined : quotation
6586
6681
  }));
6587
6682
  }));
6588
6683
  case 17:
6589
6684
  case "end":
6590
- return _context62.stop();
6685
+ return _context64.stop();
6591
6686
  }
6592
- }, _callee62, this);
6687
+ }, _callee64, this);
6593
6688
  }));
6594
- function calculateProductBookingPrices(_x50) {
6689
+ function calculateProductBookingPrices(_x51) {
6595
6690
  return _calculateProductBookingPrices.apply(this, arguments);
6596
6691
  }
6597
6692
  return calculateProductBookingPrices;
@@ -6599,47 +6694,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6599
6694
  }, {
6600
6695
  key: "addProductToOrder",
6601
6696
  value: function () {
6602
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(product, booking, options) {
6697
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(product, booking, options) {
6603
6698
  var products;
6604
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6605
- while (1) switch (_context63.prev = _context63.next) {
6699
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6700
+ while (1) switch (_context65.prev = _context65.next) {
6606
6701
  case 0:
6607
- _context63.prev = 0;
6702
+ _context65.prev = 0;
6608
6703
  if (this.store.order) {
6609
- _context63.next = 3;
6704
+ _context65.next = 3;
6610
6705
  break;
6611
6706
  }
6612
6707
  throw new Error('order 模块未初始化');
6613
6708
  case 3:
6614
6709
  if (!(options === undefined)) {
6615
- _context63.next = 9;
6710
+ _context65.next = 9;
6616
6711
  break;
6617
6712
  }
6618
- _context63.next = 6;
6713
+ _context65.next = 6;
6619
6714
  return this.store.order.addProductToOrder(product, booking);
6620
6715
  case 6:
6621
- _context63.t0 = _context63.sent;
6622
- _context63.next = 12;
6716
+ _context65.t0 = _context65.sent;
6717
+ _context65.next = 12;
6623
6718
  break;
6624
6719
  case 9:
6625
- _context63.next = 11;
6720
+ _context65.next = 11;
6626
6721
  return this.store.order.addProductToOrder(product, booking, options);
6627
6722
  case 11:
6628
- _context63.t0 = _context63.sent;
6723
+ _context65.t0 = _context65.sent;
6629
6724
  case 12:
6630
- products = _context63.t0;
6631
- return _context63.abrupt("return", products);
6725
+ products = _context65.t0;
6726
+ return _context65.abrupt("return", products);
6632
6727
  case 16:
6633
- _context63.prev = 16;
6634
- _context63.t1 = _context63["catch"](0);
6635
- throw _context63.t1;
6728
+ _context65.prev = 16;
6729
+ _context65.t1 = _context65["catch"](0);
6730
+ throw _context65.t1;
6636
6731
  case 19:
6637
6732
  case "end":
6638
- return _context63.stop();
6733
+ return _context65.stop();
6639
6734
  }
6640
- }, _callee63, this, [[0, 16]]);
6735
+ }, _callee65, this, [[0, 16]]);
6641
6736
  }));
6642
- function addProductToOrder(_x52, _x53, _x54) {
6737
+ function addProductToOrder(_x53, _x54, _x55) {
6643
6738
  return _addProductToOrder.apply(this, arguments);
6644
6739
  }
6645
6740
  return addProductToOrder;
@@ -6647,34 +6742,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6647
6742
  }, {
6648
6743
  key: "updateOrderProduct",
6649
6744
  value: function () {
6650
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(params) {
6745
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(params) {
6651
6746
  var products;
6652
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6653
- while (1) switch (_context64.prev = _context64.next) {
6747
+ return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6748
+ while (1) switch (_context66.prev = _context66.next) {
6654
6749
  case 0:
6655
- _context64.prev = 0;
6750
+ _context66.prev = 0;
6656
6751
  if (this.store.order) {
6657
- _context64.next = 3;
6752
+ _context66.next = 3;
6658
6753
  break;
6659
6754
  }
6660
6755
  throw new Error('order 模块未初始化');
6661
6756
  case 3:
6662
- _context64.next = 5;
6757
+ _context66.next = 5;
6663
6758
  return this.store.order.updateOrderProduct(params);
6664
6759
  case 5:
6665
- products = _context64.sent;
6666
- return _context64.abrupt("return", products);
6760
+ products = _context66.sent;
6761
+ return _context66.abrupt("return", products);
6667
6762
  case 9:
6668
- _context64.prev = 9;
6669
- _context64.t0 = _context64["catch"](0);
6670
- throw _context64.t0;
6763
+ _context66.prev = 9;
6764
+ _context66.t0 = _context66["catch"](0);
6765
+ throw _context66.t0;
6671
6766
  case 12:
6672
6767
  case "end":
6673
- return _context64.stop();
6768
+ return _context66.stop();
6674
6769
  }
6675
- }, _callee64, this, [[0, 9]]);
6770
+ }, _callee66, this, [[0, 9]]);
6676
6771
  }));
6677
- function updateOrderProduct(_x55) {
6772
+ function updateOrderProduct(_x56) {
6678
6773
  return _updateOrderProduct.apply(this, arguments);
6679
6774
  }
6680
6775
  return updateOrderProduct;
@@ -6682,34 +6777,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6682
6777
  }, {
6683
6778
  key: "updateOrderProducts",
6684
6779
  value: function () {
6685
- var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(paramsList) {
6780
+ var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(paramsList) {
6686
6781
  var products;
6687
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6688
- while (1) switch (_context65.prev = _context65.next) {
6782
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6783
+ while (1) switch (_context67.prev = _context67.next) {
6689
6784
  case 0:
6690
- _context65.prev = 0;
6785
+ _context67.prev = 0;
6691
6786
  if (this.store.order) {
6692
- _context65.next = 3;
6787
+ _context67.next = 3;
6693
6788
  break;
6694
6789
  }
6695
6790
  throw new Error('order 模块未初始化');
6696
6791
  case 3:
6697
- _context65.next = 5;
6792
+ _context67.next = 5;
6698
6793
  return this.store.order.updateOrderProducts(paramsList);
6699
6794
  case 5:
6700
- products = _context65.sent;
6701
- return _context65.abrupt("return", products);
6795
+ products = _context67.sent;
6796
+ return _context67.abrupt("return", products);
6702
6797
  case 9:
6703
- _context65.prev = 9;
6704
- _context65.t0 = _context65["catch"](0);
6705
- throw _context65.t0;
6798
+ _context67.prev = 9;
6799
+ _context67.t0 = _context67["catch"](0);
6800
+ throw _context67.t0;
6706
6801
  case 12:
6707
6802
  case "end":
6708
- return _context65.stop();
6803
+ return _context67.stop();
6709
6804
  }
6710
- }, _callee65, this, [[0, 9]]);
6805
+ }, _callee67, this, [[0, 9]]);
6711
6806
  }));
6712
- function updateOrderProducts(_x56) {
6807
+ function updateOrderProducts(_x57) {
6713
6808
  return _updateOrderProducts.apply(this, arguments);
6714
6809
  }
6715
6810
  return updateOrderProducts;
@@ -6717,34 +6812,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6717
6812
  }, {
6718
6813
  key: "updateOrderProductQuantity",
6719
6814
  value: function () {
6720
- var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(params) {
6815
+ var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(params) {
6721
6816
  var products;
6722
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6723
- while (1) switch (_context66.prev = _context66.next) {
6817
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6818
+ while (1) switch (_context68.prev = _context68.next) {
6724
6819
  case 0:
6725
- _context66.prev = 0;
6820
+ _context68.prev = 0;
6726
6821
  if (this.store.order) {
6727
- _context66.next = 3;
6822
+ _context68.next = 3;
6728
6823
  break;
6729
6824
  }
6730
6825
  throw new Error('order 模块未初始化');
6731
6826
  case 3:
6732
- _context66.next = 5;
6827
+ _context68.next = 5;
6733
6828
  return this.store.order.updateOrderProductQuantity(params);
6734
6829
  case 5:
6735
- products = _context66.sent;
6736
- return _context66.abrupt("return", products);
6830
+ products = _context68.sent;
6831
+ return _context68.abrupt("return", products);
6737
6832
  case 9:
6738
- _context66.prev = 9;
6739
- _context66.t0 = _context66["catch"](0);
6740
- throw _context66.t0;
6833
+ _context68.prev = 9;
6834
+ _context68.t0 = _context68["catch"](0);
6835
+ throw _context68.t0;
6741
6836
  case 12:
6742
6837
  case "end":
6743
- return _context66.stop();
6838
+ return _context68.stop();
6744
6839
  }
6745
- }, _callee66, this, [[0, 9]]);
6840
+ }, _callee68, this, [[0, 9]]);
6746
6841
  }));
6747
- function updateOrderProductQuantity(_x57) {
6842
+ function updateOrderProductQuantity(_x58) {
6748
6843
  return _updateOrderProductQuantity.apply(this, arguments);
6749
6844
  }
6750
6845
  return updateOrderProductQuantity;
@@ -6767,12 +6862,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6767
6862
  }, {
6768
6863
  key: "setOrderProductLineNote",
6769
6864
  value: (function () {
6770
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(identity, note) {
6865
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(identity, note) {
6771
6866
  var params, products;
6772
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6773
- while (1) switch (_context67.prev = _context67.next) {
6867
+ return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6868
+ while (1) switch (_context69.prev = _context69.next) {
6774
6869
  case 0:
6775
- _context67.prev = 0;
6870
+ _context69.prev = 0;
6776
6871
  params = {
6777
6872
  product_id: identity.product_id,
6778
6873
  product_variant_id: identity.product_variant_id,
@@ -6787,22 +6882,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6787
6882
  params.product_sku = identity.product_sku;
6788
6883
  }
6789
6884
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
6790
- _context67.next = 7;
6885
+ _context69.next = 7;
6791
6886
  return this.updateOrderProduct(params);
6792
6887
  case 7:
6793
- products = _context67.sent;
6794
- return _context67.abrupt("return", products);
6888
+ products = _context69.sent;
6889
+ return _context69.abrupt("return", products);
6795
6890
  case 11:
6796
- _context67.prev = 11;
6797
- _context67.t0 = _context67["catch"](0);
6798
- throw _context67.t0;
6891
+ _context69.prev = 11;
6892
+ _context69.t0 = _context69["catch"](0);
6893
+ throw _context69.t0;
6799
6894
  case 14:
6800
6895
  case "end":
6801
- return _context67.stop();
6896
+ return _context69.stop();
6802
6897
  }
6803
- }, _callee67, this, [[0, 11]]);
6898
+ }, _callee69, this, [[0, 11]]);
6804
6899
  }));
6805
- function setOrderProductLineNote(_x58, _x59) {
6900
+ function setOrderProductLineNote(_x59, _x60) {
6806
6901
  return _setOrderProductLineNote.apply(this, arguments);
6807
6902
  }
6808
6903
  return setOrderProductLineNote;
@@ -6817,45 +6912,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6817
6912
  }, {
6818
6913
  key: "removeProductsFromOrder",
6819
6914
  value: (function () {
6820
- var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(identities, options) {
6821
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6822
- while (1) switch (_context68.prev = _context68.next) {
6915
+ var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(identities, options) {
6916
+ return _regeneratorRuntime().wrap(function _callee70$(_context70) {
6917
+ while (1) switch (_context70.prev = _context70.next) {
6823
6918
  case 0:
6824
- _context68.prev = 0;
6919
+ _context70.prev = 0;
6825
6920
  if (this.store.order) {
6826
- _context68.next = 3;
6921
+ _context70.next = 3;
6827
6922
  break;
6828
6923
  }
6829
6924
  throw new Error('order 模块未初始化');
6830
6925
  case 3:
6831
6926
  if (!(options === undefined)) {
6832
- _context68.next = 9;
6927
+ _context70.next = 9;
6833
6928
  break;
6834
6929
  }
6835
- _context68.next = 6;
6930
+ _context70.next = 6;
6836
6931
  return this.store.order.removeProductsFromOrder(identities);
6837
6932
  case 6:
6838
- _context68.t0 = _context68.sent;
6839
- _context68.next = 12;
6933
+ _context70.t0 = _context70.sent;
6934
+ _context70.next = 12;
6840
6935
  break;
6841
6936
  case 9:
6842
- _context68.next = 11;
6937
+ _context70.next = 11;
6843
6938
  return this.store.order.removeProductsFromOrder(identities, options);
6844
6939
  case 11:
6845
- _context68.t0 = _context68.sent;
6940
+ _context70.t0 = _context70.sent;
6846
6941
  case 12:
6847
- return _context68.abrupt("return", _context68.t0);
6942
+ return _context70.abrupt("return", _context70.t0);
6848
6943
  case 15:
6849
- _context68.prev = 15;
6850
- _context68.t1 = _context68["catch"](0);
6851
- throw _context68.t1;
6944
+ _context70.prev = 15;
6945
+ _context70.t1 = _context70["catch"](0);
6946
+ throw _context70.t1;
6852
6947
  case 18:
6853
6948
  case "end":
6854
- return _context68.stop();
6949
+ return _context70.stop();
6855
6950
  }
6856
- }, _callee68, this, [[0, 15]]);
6951
+ }, _callee70, this, [[0, 15]]);
6857
6952
  }));
6858
- function removeProductsFromOrder(_x60, _x61) {
6953
+ function removeProductsFromOrder(_x61, _x62) {
6859
6954
  return _removeProductsFromOrder.apply(this, arguments);
6860
6955
  }
6861
6956
  return removeProductsFromOrder;
@@ -6863,18 +6958,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6863
6958
  }, {
6864
6959
  key: "removeProductFromOrder",
6865
6960
  value: function () {
6866
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(identity, options) {
6867
- return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6868
- while (1) switch (_context69.prev = _context69.next) {
6961
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(identity, options) {
6962
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
6963
+ while (1) switch (_context71.prev = _context71.next) {
6869
6964
  case 0:
6870
- return _context69.abrupt("return", this.removeProductsFromOrder([identity], options));
6965
+ return _context71.abrupt("return", this.removeProductsFromOrder([identity], options));
6871
6966
  case 1:
6872
6967
  case "end":
6873
- return _context69.stop();
6968
+ return _context71.stop();
6874
6969
  }
6875
- }, _callee69, this);
6970
+ }, _callee71, this);
6876
6971
  }));
6877
- function removeProductFromOrder(_x62, _x63) {
6972
+ function removeProductFromOrder(_x63, _x64) {
6878
6973
  return _removeProductFromOrder.apply(this, arguments);
6879
6974
  }
6880
6975
  return removeProductFromOrder;
@@ -6924,23 +7019,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6924
7019
  }, {
6925
7020
  key: "applyPromotion",
6926
7021
  value: (function () {
6927
- var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70() {
6928
- return _regeneratorRuntime().wrap(function _callee70$(_context70) {
6929
- while (1) switch (_context70.prev = _context70.next) {
7022
+ var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72() {
7023
+ return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7024
+ while (1) switch (_context72.prev = _context72.next) {
6930
7025
  case 0:
6931
7026
  if (this.store.order) {
6932
- _context70.next = 2;
7027
+ _context72.next = 2;
6933
7028
  break;
6934
7029
  }
6935
7030
  throw new Error('order 模块未初始化');
6936
7031
  case 2:
6937
- _context70.next = 4;
7032
+ _context72.next = 4;
6938
7033
  return this.store.order.applyPromotion();
6939
7034
  case 4:
6940
7035
  case "end":
6941
- return _context70.stop();
7036
+ return _context72.stop();
6942
7037
  }
6943
- }, _callee70, this);
7038
+ }, _callee72, this);
6944
7039
  }));
6945
7040
  function applyPromotion() {
6946
7041
  return _applyPromotion.apply(this, arguments);
@@ -6967,18 +7062,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6967
7062
  }, {
6968
7063
  key: "getProductList",
6969
7064
  value: function () {
6970
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71() {
6971
- var _this$otherParams40;
7065
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73() {
7066
+ var _this$otherParams42;
6972
7067
  var menu_list_ids, _this$store$products, res;
6973
- return _regeneratorRuntime().wrap(function _callee71$(_context71) {
6974
- while (1) switch (_context71.prev = _context71.next) {
7068
+ return _regeneratorRuntime().wrap(function _callee73$(_context73) {
7069
+ while (1) switch (_context73.prev = _context73.next) {
6975
7070
  case 0:
6976
7071
  // 可以直接通过配置里的 menu 读取
6977
- menu_list_ids = ((_this$otherParams40 = this.otherParams) === null || _this$otherParams40 === void 0 || (_this$otherParams40 = _this$otherParams40.dineInConfig) === null || _this$otherParams40 === void 0 ? void 0 : _this$otherParams40['menu.associated_menus'].map(function (n) {
7072
+ 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) {
6978
7073
  return Number(n.value);
6979
7074
  })) || [];
6980
- _context71.prev = 1;
6981
- _context71.next = 4;
7075
+ _context73.prev = 1;
7076
+ _context73.next = 4;
6982
7077
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
6983
7078
  menu_list_ids: menu_list_ids,
6984
7079
  cacheId: this.cacheId,
@@ -6986,17 +7081,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6986
7081
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
6987
7082
  });
6988
7083
  case 4:
6989
- res = _context71.sent;
6990
- return _context71.abrupt("return", res);
7084
+ res = _context73.sent;
7085
+ return _context73.abrupt("return", res);
6991
7086
  case 8:
6992
- _context71.prev = 8;
6993
- _context71.t0 = _context71["catch"](1);
6994
- throw _context71.t0;
7087
+ _context73.prev = 8;
7088
+ _context73.t0 = _context73["catch"](1);
7089
+ throw _context73.t0;
6995
7090
  case 11:
6996
7091
  case "end":
6997
- return _context71.stop();
7092
+ return _context73.stop();
6998
7093
  }
6999
- }, _callee71, this, [[1, 8]]);
7094
+ }, _callee73, this, [[1, 8]]);
7000
7095
  }));
7001
7096
  function getProductList() {
7002
7097
  return _getProductList.apply(this, arguments);
@@ -7011,36 +7106,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7011
7106
  }, {
7012
7107
  key: "setOtherParams",
7013
7108
  value: function () {
7014
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(params) {
7015
- var _this$otherParams41;
7109
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(params) {
7110
+ var _this$otherParams43;
7016
7111
  var _ref56,
7017
7112
  _ref56$cover,
7018
7113
  cover,
7019
7114
  previousPickupTimingScope,
7020
- _args72 = arguments;
7021
- return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7022
- while (1) switch (_context72.prev = _context72.next) {
7115
+ _args74 = arguments;
7116
+ return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7117
+ while (1) switch (_context74.prev = _context74.next) {
7023
7118
  case 0:
7024
- _ref56 = _args72.length > 1 && _args72[1] !== undefined ? _args72[1] : {}, _ref56$cover = _ref56.cover, cover = _ref56$cover === void 0 ? false : _ref56$cover;
7119
+ _ref56 = _args74.length > 1 && _args74[1] !== undefined ? _args74[1] : {}, _ref56$cover = _ref56.cover, cover = _ref56$cover === void 0 ? false : _ref56$cover;
7025
7120
  previousPickupTimingScope = this.getPickupTimingScope();
7026
7121
  if (cover) {
7027
7122
  this.otherParams = _objectSpread({}, params);
7028
7123
  } else {
7029
7124
  this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
7030
7125
  }
7031
- this.cacheId = (_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41.cacheId;
7126
+ this.cacheId = (_this$otherParams43 = this.otherParams) === null || _this$otherParams43 === void 0 ? void 0 : _this$otherParams43.cacheId;
7032
7127
  if (previousPickupTimingScope !== this.getPickupTimingScope()) this.resetPickupTimingCache();
7033
- _context72.next = 7;
7128
+ _context74.next = 7;
7034
7129
  return this.syncOtherParamsToSubModules(params, {
7035
7130
  cover: cover
7036
7131
  });
7037
7132
  case 7:
7038
7133
  case "end":
7039
- return _context72.stop();
7134
+ return _context74.stop();
7040
7135
  }
7041
- }, _callee72, this);
7136
+ }, _callee74, this);
7042
7137
  }));
7043
- function setOtherParams(_x64) {
7138
+ function setOtherParams(_x65) {
7044
7139
  return _setOtherParams.apply(this, arguments);
7045
7140
  }
7046
7141
  return setOtherParams;