@pisell/pisellos 2.3.150 → 2.3.152

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 +3 -1
  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 +1127 -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 +3 -1
  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 +43 -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,45 @@ 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, tempOrder;
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
+ // 费用规则可能增删商品;即使没有普通促销,也要同步页面的购物车和金额快照。
2716
+ tempOrder = this.getTempOrder();
2717
+ if (!tempOrder) {
2718
+ _context22.next = 9;
2719
+ break;
2720
+ }
2721
+ _context22.next = 9;
2722
+ return this.effectsEmit('onTempOrderReplaced', {
2723
+ tempOrder: tempOrder
2724
+ });
2725
+ case 9:
2726
+ return _context22.abrupt("return", serviceData);
2727
+ case 10:
2728
+ case "end":
2729
+ return _context22.stop();
2730
+ }
2731
+ }, _callee22, this);
2732
+ }));
2733
+ function setServiceType(_x19) {
2734
+ return _setServiceType.apply(this, arguments);
2735
+ }
2736
+ return setServiceType;
2737
+ }()
2635
2738
  }, {
2636
2739
  key: "getPickupTimingBooking",
2637
2740
  value: function getPickupTimingBooking() {
@@ -2683,40 +2786,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2683
2786
  }, {
2684
2787
  key: "addNewOrder",
2685
2788
  value: function () {
2686
- var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2789
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2687
2790
  var tempOrder;
2688
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2689
- while (1) switch (_context21.prev = _context21.next) {
2791
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2792
+ while (1) switch (_context23.prev = _context23.next) {
2690
2793
  case 0:
2691
- _context21.prev = 0;
2794
+ _context23.prev = 0;
2692
2795
  if (this.store.order) {
2693
- _context21.next = 3;
2796
+ _context23.next = 3;
2694
2797
  break;
2695
2798
  }
2696
2799
  throw new Error('order 模块未初始化');
2697
2800
  case 3:
2698
- _context21.next = 5;
2801
+ _context23.next = 5;
2699
2802
  return this.store.order.addNewOrder();
2700
2803
  case 5:
2701
- tempOrder = _context21.sent;
2804
+ tempOrder = _context23.sent;
2702
2805
  if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
2703
- _context21.next = 10;
2806
+ _context23.next = 10;
2704
2807
  break;
2705
2808
  }
2706
2809
  this.store.order.persistTempOrder();
2707
- _context21.next = 10;
2810
+ _context23.next = 10;
2708
2811
  return this.store.order.saveDraft();
2709
2812
  case 10:
2710
- return _context21.abrupt("return", tempOrder);
2813
+ return _context23.abrupt("return", tempOrder);
2711
2814
  case 13:
2712
- _context21.prev = 13;
2713
- _context21.t0 = _context21["catch"](0);
2714
- throw _context21.t0;
2815
+ _context23.prev = 13;
2816
+ _context23.t0 = _context23["catch"](0);
2817
+ throw _context23.t0;
2715
2818
  case 16:
2716
2819
  case "end":
2717
- return _context21.stop();
2820
+ return _context23.stop();
2718
2821
  }
2719
- }, _callee21, this, [[0, 13]]);
2822
+ }, _callee23, this, [[0, 13]]);
2720
2823
  }));
2721
2824
  function addNewOrder() {
2722
2825
  return _addNewOrder.apply(this, arguments);
@@ -2726,22 +2829,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2726
2829
  }, {
2727
2830
  key: "saveDraft",
2728
2831
  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) {
2832
+ var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2833
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2834
+ while (1) switch (_context24.prev = _context24.next) {
2732
2835
  case 0:
2733
2836
  if (this.store.order) {
2734
- _context22.next = 2;
2837
+ _context24.next = 2;
2735
2838
  break;
2736
2839
  }
2737
2840
  throw new Error('order 模块未初始化');
2738
2841
  case 2:
2739
- return _context22.abrupt("return", this.store.order.saveDraft());
2842
+ return _context24.abrupt("return", this.store.order.saveDraft());
2740
2843
  case 3:
2741
2844
  case "end":
2742
- return _context22.stop();
2845
+ return _context24.stop();
2743
2846
  }
2744
- }, _callee22, this);
2847
+ }, _callee24, this);
2745
2848
  }));
2746
2849
  function saveDraft() {
2747
2850
  return _saveDraft.apply(this, arguments);
@@ -2752,14 +2855,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2752
2855
  }, {
2753
2856
  key: "restoreOrder",
2754
2857
  value: function () {
2755
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2858
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2756
2859
  var _this$store$payment, tempOrder, appDataChanged, wallet;
2757
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2758
- while (1) switch (_context23.prev = _context23.next) {
2860
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2861
+ while (1) switch (_context25.prev = _context25.next) {
2759
2862
  case 0:
2760
- _context23.prev = 0;
2863
+ _context25.prev = 0;
2761
2864
  if (this.store.order) {
2762
- _context23.next = 3;
2865
+ _context25.next = 3;
2763
2866
  break;
2764
2867
  }
2765
2868
  throw new Error('scanOrder 解决方案需要 order 模块支持');
@@ -2772,37 +2875,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2772
2875
  this.hasManualDiscountSelection = false;
2773
2876
  wallet = (_this$store$payment = this.store.payment) === null || _this$store$payment === void 0 ? void 0 : _this$store$payment.wallet;
2774
2877
  if (!wallet) {
2775
- _context23.next = 14;
2878
+ _context25.next = 14;
2776
2879
  break;
2777
2880
  }
2778
2881
  this.walletAssetsRefreshSequence += 1;
2779
2882
  wallet.clearAllCache();
2780
- _context23.next = 14;
2883
+ _context25.next = 14;
2781
2884
  return this.publishWalletAssetsState(wallet.getWalletAssetsState());
2782
2885
  case 14:
2783
- _context23.next = 16;
2886
+ _context25.next = 16;
2784
2887
  return this.effectsEmit('onTempOrderReplaced', {
2785
2888
  tempOrder: tempOrder
2786
2889
  });
2787
2890
  case 16:
2788
2891
  if (!(appDataChanged && this.isTempOrderPersistEnabled())) {
2789
- _context23.next = 20;
2892
+ _context25.next = 20;
2790
2893
  break;
2791
2894
  }
2792
2895
  this.store.order.persistTempOrder();
2793
- _context23.next = 20;
2896
+ _context25.next = 20;
2794
2897
  return this.store.order.saveDraft();
2795
2898
  case 20:
2796
- return _context23.abrupt("return", tempOrder);
2899
+ return _context25.abrupt("return", tempOrder);
2797
2900
  case 23:
2798
- _context23.prev = 23;
2799
- _context23.t0 = _context23["catch"](0);
2800
- throw _context23.t0;
2901
+ _context25.prev = 23;
2902
+ _context25.t0 = _context25["catch"](0);
2903
+ throw _context25.t0;
2801
2904
  case 26:
2802
2905
  case "end":
2803
- return _context23.stop();
2906
+ return _context25.stop();
2804
2907
  }
2805
- }, _callee23, this, [[0, 23]]);
2908
+ }, _callee25, this, [[0, 23]]);
2806
2909
  }));
2807
2910
  function restoreOrder() {
2808
2911
  return _restoreOrder.apply(this, arguments);
@@ -2816,22 +2919,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2816
2919
  }, {
2817
2920
  key: "clearOrderCartLines",
2818
2921
  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) {
2922
+ var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2923
+ var _this$fulfillmentItem2, tempOrder;
2924
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2925
+ while (1) switch (_context26.prev = _context26.next) {
2823
2926
  case 0:
2824
- _context24.prev = 0;
2927
+ _context26.prev = 0;
2825
2928
  if (this.store.order) {
2826
- _context24.next = 3;
2929
+ _context26.next = 3;
2827
2930
  break;
2828
2931
  }
2829
2932
  throw new Error('order 模块未初始化');
2830
2933
  case 3:
2831
- _context24.next = 5;
2934
+ (_this$fulfillmentItem2 = this.fulfillmentItemRulesController) === null || _this$fulfillmentItem2 === void 0 || _this$fulfillmentItem2.invalidate();
2935
+ _context26.next = 6;
2832
2936
  return this.store.order.clearOrderCartLines();
2833
- case 5:
2834
- tempOrder = _context24.sent;
2937
+ case 6:
2938
+ tempOrder = _context26.sent;
2835
2939
  if (this.currentSalesDetail) {
2836
2940
  this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
2837
2941
  products: [],
@@ -2841,29 +2945,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2841
2945
  discount_list: []
2842
2946
  });
2843
2947
  }
2844
- _context24.next = 9;
2948
+ _context26.next = 10;
2845
2949
  return this.effectsEmit('onTempOrderReplaced', {
2846
2950
  tempOrder: tempOrder
2847
2951
  });
2848
- case 9:
2952
+ case 10:
2849
2953
  if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
2850
- _context24.next = 13;
2954
+ _context26.next = 14;
2851
2955
  break;
2852
2956
  }
2853
2957
  this.store.order.persistTempOrder();
2854
- _context24.next = 13;
2958
+ _context26.next = 14;
2855
2959
  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:
2960
+ case 14:
2961
+ return _context26.abrupt("return", tempOrder);
2962
+ case 17:
2963
+ _context26.prev = 17;
2964
+ _context26.t0 = _context26["catch"](0);
2965
+ throw _context26.t0;
2966
+ case 20:
2863
2967
  case "end":
2864
- return _context24.stop();
2968
+ return _context26.stop();
2865
2969
  }
2866
- }, _callee24, this, [[0, 16]]);
2970
+ }, _callee26, this, [[0, 17]]);
2867
2971
  }));
2868
2972
  function clearOrderCartLines() {
2869
2973
  return _clearOrderCartLines.apply(this, arguments);
@@ -2873,21 +2977,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2873
2977
  }, {
2874
2978
  key: "clearOrderForSettlementSwitch",
2875
2979
  value: (function () {
2876
- var _clearOrderForSettlementSwitch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2980
+ var _clearOrderForSettlementSwitch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2981
+ var _this$fulfillmentItem3;
2877
2982
  var tempOrder;
2878
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2879
- while (1) switch (_context25.prev = _context25.next) {
2983
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2984
+ while (1) switch (_context27.prev = _context27.next) {
2880
2985
  case 0:
2881
2986
  if (this.store.order) {
2882
- _context25.next = 2;
2987
+ _context27.next = 2;
2883
2988
  break;
2884
2989
  }
2885
2990
  throw new Error('order 模块未初始化');
2886
2991
  case 2:
2887
- _context25.next = 4;
2992
+ (_this$fulfillmentItem3 = this.fulfillmentItemRulesController) === null || _this$fulfillmentItem3 === void 0 || _this$fulfillmentItem3.invalidate();
2993
+ _context27.next = 5;
2888
2994
  return this.store.order.clearOrderForSettlementSwitch();
2889
- case 4:
2890
- tempOrder = _context25.sent;
2995
+ case 5:
2996
+ tempOrder = _context27.sent;
2891
2997
  if (this.currentSalesDetail) {
2892
2998
  this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
2893
2999
  products: [],
@@ -2898,12 +3004,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2898
3004
  payments: []
2899
3005
  });
2900
3006
  }
2901
- return _context25.abrupt("return", tempOrder);
2902
- case 7:
3007
+ return _context27.abrupt("return", tempOrder);
3008
+ case 8:
2903
3009
  case "end":
2904
- return _context25.stop();
3010
+ return _context27.stop();
2905
3011
  }
2906
- }, _callee25, this);
3012
+ }, _callee27, this);
2907
3013
  }));
2908
3014
  function clearOrderForSettlementSwitch() {
2909
3015
  return _clearOrderForSettlementSwitch.apply(this, arguments);
@@ -2920,32 +3026,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2920
3026
  }, {
2921
3027
  key: "getSummary",
2922
3028
  value: function () {
2923
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
3029
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2924
3030
  var summary;
2925
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2926
- while (1) switch (_context26.prev = _context26.next) {
3031
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3032
+ while (1) switch (_context28.prev = _context28.next) {
2927
3033
  case 0:
2928
- _context26.prev = 0;
3034
+ _context28.prev = 0;
2929
3035
  if (this.store.order) {
2930
- _context26.next = 3;
3036
+ _context28.next = 3;
2931
3037
  break;
2932
3038
  }
2933
3039
  throw new Error('order 模块未初始化');
2934
3040
  case 3:
2935
- _context26.next = 5;
3041
+ _context28.next = 5;
2936
3042
  return this.store.order.getOrderSummary();
2937
3043
  case 5:
2938
- summary = _context26.sent;
2939
- return _context26.abrupt("return", summary);
3044
+ summary = _context28.sent;
3045
+ return _context28.abrupt("return", summary);
2940
3046
  case 9:
2941
- _context26.prev = 9;
2942
- _context26.t0 = _context26["catch"](0);
2943
- throw _context26.t0;
3047
+ _context28.prev = 9;
3048
+ _context28.t0 = _context28["catch"](0);
3049
+ throw _context28.t0;
2944
3050
  case 12:
2945
3051
  case "end":
2946
- return _context26.stop();
3052
+ return _context28.stop();
2947
3053
  }
2948
- }, _callee26, this, [[0, 9]]);
3054
+ }, _callee28, this, [[0, 9]]);
2949
3055
  }));
2950
3056
  function getSummary() {
2951
3057
  return _getSummary.apply(this, arguments);
@@ -2955,10 +3061,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2955
3061
  }, {
2956
3062
  key: "getHistoricalProductDiscountList",
2957
3063
  value: function getHistoricalProductDiscountList(products) {
2958
- var _this15 = this;
3064
+ var _this16 = this;
2959
3065
  var historyDiscountList = [];
2960
3066
  products.forEach(function (item) {
2961
- if (!_this15.isPersistedOrderProduct(item)) return;
3067
+ if (!_this16.isPersistedOrderProduct(item)) return;
2962
3068
  (item.discount_list || []).forEach(function (discount) {
2963
3069
  var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
2964
3070
  var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
@@ -3018,11 +3124,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3018
3124
  }, {
3019
3125
  key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
3020
3126
  value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
3021
- var _this16 = this;
3127
+ var _this17 = this;
3022
3128
  if (params.discountAction !== 'edit') return false;
3023
3129
  if (!params.products.length) return false;
3024
3130
  var hasDraftProduct = params.products.some(function (product) {
3025
- return !_this16.isPersistedOrderProduct(product);
3131
+ return !_this17.isPersistedOrderProduct(product);
3026
3132
  });
3027
3133
  if (hasDraftProduct) return false;
3028
3134
 
@@ -3091,7 +3197,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3091
3197
  }, {
3092
3198
  key: "loadDiscountConfig",
3093
3199
  value: function () {
3094
- var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3200
+ var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3095
3201
  var _this$store$order$get2,
3096
3202
  _this$store$order8,
3097
3203
  _tempOrder$customer2,
@@ -3101,14 +3207,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3101
3207
  _discountModule$getOr,
3102
3208
  _this$store$order$get3,
3103
3209
  _this$store$order9,
3104
- _this17 = this,
3210
+ _this18 = this,
3105
3211
  _discountModule$getDi3;
3106
3212
  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) {
3213
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3214
+ while (1) switch (_context29.prev = _context29.next) {
3109
3215
  case 0:
3110
3216
  if (this.store.order) {
3111
- _context27.next = 2;
3217
+ _context29.next = 2;
3112
3218
  break;
3113
3219
  }
3114
3220
  throw new Error('order 模块未初始化');
@@ -3129,18 +3235,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3129
3235
  discountConfigCacheKey = JSON.stringify([customerId, discountAction, Number(orderId) || 0, requestOrderIdentityKey]);
3130
3236
  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
3237
  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);
3238
+ var _this18$store$order, _this18$store$order$g, _this18$store$order2, _this18$store$order2$;
3239
+ 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);
3240
+ 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
3241
  };
3136
3242
  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);
3243
+ var _this18$store$order3, _this18$store$order3$, _discountModule$getDi2;
3244
+ 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
3245
  return {
3140
3246
  productList: (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.products) || [],
3141
3247
  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()
3248
+ availableWalletIds: _this18.getAvailableWalletIds(),
3249
+ virtualCurrencyList: _this18.getVirtualCurrencyList()
3144
3250
  };
3145
3251
  }; // Walk-In 不请求 prepare config;当前搜索/扫码券必须继续参与本次重算。
3146
3252
  // current 优先于 original,保留搜索后的最新选择与可用状态。
@@ -3154,15 +3260,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3154
3260
  return !searchedDiscountIds.has(String(discount.id));
3155
3261
  })));
3156
3262
  if (!(customerId && customerId !== 1)) {
3157
- _context27.next = 37;
3263
+ _context29.next = 37;
3158
3264
  break;
3159
3265
  }
3160
3266
  if (!(!(params !== null && params !== void 0 && params.force) && this.discountConfigCacheKey === discountConfigCacheKey)) {
3161
- _context27.next = 25;
3267
+ _context29.next = 25;
3162
3268
  break;
3163
3269
  }
3164
3270
  preparedDiscountList = originalDiscountList;
3165
- _context27.next = 37;
3271
+ _context29.next = 37;
3166
3272
  break;
3167
3273
  case 25:
3168
3274
  prepareConfigPromise = this.store.order.loadDiscountConfig({
@@ -3172,58 +3278,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3172
3278
  apply: false
3173
3279
  }); // OrderModule increments this epoch synchronously before its first await.
3174
3280
  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;
3281
+ _context29.next = 29;
3176
3282
  return prepareConfigPromise;
3177
3283
  case 29:
3178
- preparedDiscountList = _context27.sent;
3284
+ preparedDiscountList = _context29.sent;
3179
3285
  if (isCurrentRequest()) {
3180
- _context27.next = 32;
3286
+ _context29.next = 32;
3181
3287
  break;
3182
3288
  }
3183
- return _context27.abrupt("return", getCurrentResult());
3289
+ return _context29.abrupt("return", getCurrentResult());
3184
3290
  case 32:
3185
- _context27.next = 34;
3291
+ _context29.next = 34;
3186
3292
  return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
3187
3293
  case 34:
3188
3294
  if (isCurrentRequest()) {
3189
- _context27.next = 36;
3295
+ _context29.next = 36;
3190
3296
  break;
3191
3297
  }
3192
- return _context27.abrupt("return", getCurrentResult());
3298
+ return _context29.abrupt("return", getCurrentResult());
3193
3299
  case 36:
3194
3300
  this.discountConfigCacheKey = discountConfigCacheKey;
3195
3301
  case 37:
3196
3302
  if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
3197
- _context27.next = 51;
3303
+ _context29.next = 51;
3198
3304
  break;
3199
3305
  }
3200
3306
  if (isCurrentRequest()) {
3201
- _context27.next = 40;
3307
+ _context29.next = 40;
3202
3308
  break;
3203
3309
  }
3204
- return _context27.abrupt("return", getCurrentResult());
3310
+ return _context29.abrupt("return", getCurrentResult());
3205
3311
  case 40:
3206
- _context27.next = 42;
3312
+ _context29.next = 42;
3207
3313
  return discountModule === null || discountModule === void 0 || (_discountModule$setOr2 = discountModule.setOriginalDiscountList) === null || _discountModule$setOr2 === void 0 ? void 0 : _discountModule$setOr2.call(discountModule, []);
3208
3314
  case 42:
3209
3315
  if (isCurrentRequest()) {
3210
- _context27.next = 44;
3316
+ _context29.next = 44;
3211
3317
  break;
3212
3318
  }
3213
- return _context27.abrupt("return", getCurrentResult());
3319
+ return _context29.abrupt("return", getCurrentResult());
3214
3320
  case 44:
3215
- _context27.next = 46;
3321
+ _context29.next = 46;
3216
3322
  return discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []);
3217
3323
  case 46:
3218
3324
  if (isCurrentRequest()) {
3219
- _context27.next = 48;
3325
+ _context29.next = 48;
3220
3326
  break;
3221
3327
  }
3222
- return _context27.abrupt("return", getCurrentResult());
3328
+ return _context29.abrupt("return", getCurrentResult());
3223
3329
  case 48:
3224
3330
  tempOrder.discount_list = [];
3225
3331
  tempOrder.shop_discount = '0.00';
3226
- return _context27.abrupt("return", {
3332
+ return _context29.abrupt("return", {
3227
3333
  productList: tempOrder.products || [],
3228
3334
  discountList: [],
3229
3335
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3231,10 +3337,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3231
3337
  });
3232
3338
  case 51:
3233
3339
  if (!(hasManualDiscountSelection && currentDiscountList.length)) {
3234
- _context27.next = 53;
3340
+ _context29.next = 53;
3235
3341
  break;
3236
3342
  }
3237
- return _context27.abrupt("return", {
3343
+ return _context29.abrupt("return", {
3238
3344
  productList: tempOrder.products || [],
3239
3345
  discountList: currentDiscountList,
3240
3346
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3244,19 +3350,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3244
3350
  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
3351
  nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
3246
3352
  if (isCurrentRequest()) {
3247
- _context27.next = 57;
3353
+ _context29.next = 57;
3248
3354
  break;
3249
3355
  }
3250
- return _context27.abrupt("return", getCurrentResult());
3356
+ return _context29.abrupt("return", getCurrentResult());
3251
3357
  case 57:
3252
- _context27.next = 59;
3358
+ _context29.next = 59;
3253
3359
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3254
3360
  case 59:
3255
3361
  if (isCurrentRequest()) {
3256
- _context27.next = 61;
3362
+ _context29.next = 61;
3257
3363
  break;
3258
3364
  }
3259
- return _context27.abrupt("return", getCurrentResult());
3365
+ return _context29.abrupt("return", getCurrentResult());
3260
3366
  case 61:
3261
3367
  shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
3262
3368
  discountAction: discountAction,
@@ -3265,28 +3371,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3265
3371
  nextDiscountList: nextDiscountList
3266
3372
  });
3267
3373
  if (!shouldSkipAutoApplyFetchedDiscounts) {
3268
- _context27.next = 75;
3374
+ _context29.next = 75;
3269
3375
  break;
3270
3376
  }
3271
- _context27.next = 65;
3377
+ _context29.next = 65;
3272
3378
  return this.store.order.recalculateSummary({
3273
3379
  createIfMissing: true
3274
3380
  });
3275
3381
  case 65:
3276
3382
  if (isCurrentRequest()) {
3277
- _context27.next = 67;
3383
+ _context29.next = 67;
3278
3384
  break;
3279
3385
  }
3280
- return _context27.abrupt("return", getCurrentResult());
3386
+ return _context29.abrupt("return", getCurrentResult());
3281
3387
  case 67:
3282
3388
  this.store.order.persistTempOrder();
3283
3389
  if (isCurrentRequest()) {
3284
- _context27.next = 70;
3390
+ _context29.next = 70;
3285
3391
  break;
3286
3392
  }
3287
- return _context27.abrupt("return", getCurrentResult());
3393
+ return _context29.abrupt("return", getCurrentResult());
3288
3394
  case 70:
3289
- _context27.next = 72;
3395
+ _context29.next = 72;
3290
3396
  return this.effectsEmit('onDiscountApplied', {
3291
3397
  productList: tempOrder.products || [],
3292
3398
  discountList: nextDiscountList,
@@ -3295,12 +3401,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3295
3401
  });
3296
3402
  case 72:
3297
3403
  if (isCurrentRequest()) {
3298
- _context27.next = 74;
3404
+ _context29.next = 74;
3299
3405
  break;
3300
3406
  }
3301
- return _context27.abrupt("return", getCurrentResult());
3407
+ return _context29.abrupt("return", getCurrentResult());
3302
3408
  case 74:
3303
- return _context27.abrupt("return", {
3409
+ return _context29.abrupt("return", {
3304
3410
  productList: tempOrder.products || [],
3305
3411
  discountList: nextDiscountList,
3306
3412
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3308,14 +3414,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3308
3414
  });
3309
3415
  case 75:
3310
3416
  if (!rulesModule) {
3311
- _context27.next = 117;
3417
+ _context29.next = 117;
3312
3418
  break;
3313
3419
  }
3314
3420
  if (isCurrentRequest()) {
3315
- _context27.next = 78;
3421
+ _context29.next = 78;
3316
3422
  break;
3317
3423
  }
3318
- return _context27.abrupt("return", getCurrentResult());
3424
+ return _context29.abrupt("return", getCurrentResult());
3319
3425
  case 78:
3320
3426
  orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
3321
3427
  result = rulesModule.calcDiscount({
@@ -3334,21 +3440,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3334
3440
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
3335
3441
  }
3336
3442
  _iterator3 = _createForOfIteratorHelper(tempOrder.products || []);
3337
- _context27.prev = 82;
3443
+ _context29.prev = 82;
3338
3444
  _iterator3.s();
3339
3445
  case 84:
3340
3446
  if ((_step3 = _iterator3.n()).done) {
3341
- _context27.next = 99;
3447
+ _context29.next = 99;
3342
3448
  break;
3343
3449
  }
3344
3450
  product = _step3.value;
3345
3451
  productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
3346
3452
  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
3453
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
3348
- _context27.next = 90;
3454
+ _context29.next = 90;
3349
3455
  break;
3350
3456
  }
3351
- return _context27.abrupt("continue", 97);
3457
+ return _context29.abrupt("continue", 97);
3352
3458
  case 90:
3353
3459
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
3354
3460
  return sum + Number(pd.amount || 0);
@@ -3366,70 +3472,70 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3366
3472
  bundle: product.product_bundle
3367
3473
  });
3368
3474
  case 97:
3369
- _context27.next = 84;
3475
+ _context29.next = 84;
3370
3476
  break;
3371
3477
  case 99:
3372
- _context27.next = 104;
3478
+ _context29.next = 104;
3373
3479
  break;
3374
3480
  case 101:
3375
- _context27.prev = 101;
3376
- _context27.t0 = _context27["catch"](82);
3377
- _iterator3.e(_context27.t0);
3481
+ _context29.prev = 101;
3482
+ _context29.t0 = _context29["catch"](82);
3483
+ _iterator3.e(_context29.t0);
3378
3484
  case 104:
3379
- _context27.prev = 104;
3485
+ _context29.prev = 104;
3380
3486
  _iterator3.f();
3381
- return _context27.finish(104);
3487
+ return _context29.finish(104);
3382
3488
  case 107:
3383
3489
  if (!result.discountList) {
3384
- _context27.next = 117;
3490
+ _context29.next = 117;
3385
3491
  break;
3386
3492
  }
3387
3493
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
3388
3494
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
3389
3495
  if (isCurrentRequest()) {
3390
- _context27.next = 112;
3496
+ _context29.next = 112;
3391
3497
  break;
3392
3498
  }
3393
- return _context27.abrupt("return", getCurrentResult());
3499
+ return _context29.abrupt("return", getCurrentResult());
3394
3500
  case 112:
3395
- _context27.next = 114;
3501
+ _context29.next = 114;
3396
3502
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3397
3503
  case 114:
3398
3504
  if (isCurrentRequest()) {
3399
- _context27.next = 116;
3505
+ _context29.next = 116;
3400
3506
  break;
3401
3507
  }
3402
- return _context27.abrupt("return", getCurrentResult());
3508
+ return _context29.abrupt("return", getCurrentResult());
3403
3509
  case 116:
3404
3510
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
3405
3511
  return discount.isSelected;
3406
3512
  });
3407
3513
  case 117:
3408
3514
  if (isCurrentRequest()) {
3409
- _context27.next = 119;
3515
+ _context29.next = 119;
3410
3516
  break;
3411
3517
  }
3412
- return _context27.abrupt("return", getCurrentResult());
3518
+ return _context29.abrupt("return", getCurrentResult());
3413
3519
  case 119:
3414
- _context27.next = 121;
3520
+ _context29.next = 121;
3415
3521
  return this.store.order.recalculateSummary({
3416
3522
  createIfMissing: true
3417
3523
  });
3418
3524
  case 121:
3419
3525
  if (isCurrentRequest()) {
3420
- _context27.next = 123;
3526
+ _context29.next = 123;
3421
3527
  break;
3422
3528
  }
3423
- return _context27.abrupt("return", getCurrentResult());
3529
+ return _context29.abrupt("return", getCurrentResult());
3424
3530
  case 123:
3425
3531
  this.store.order.persistTempOrder();
3426
3532
  if (isCurrentRequest()) {
3427
- _context27.next = 126;
3533
+ _context29.next = 126;
3428
3534
  break;
3429
3535
  }
3430
- return _context27.abrupt("return", getCurrentResult());
3536
+ return _context29.abrupt("return", getCurrentResult());
3431
3537
  case 126:
3432
- _context27.next = 128;
3538
+ _context29.next = 128;
3433
3539
  return this.effectsEmit('onDiscountApplied', {
3434
3540
  productList: tempOrder.products || [],
3435
3541
  discountList: nextDiscountList,
@@ -3438,12 +3544,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3438
3544
  });
3439
3545
  case 128:
3440
3546
  if (isCurrentRequest()) {
3441
- _context27.next = 130;
3547
+ _context29.next = 130;
3442
3548
  break;
3443
3549
  }
3444
- return _context27.abrupt("return", getCurrentResult());
3550
+ return _context29.abrupt("return", getCurrentResult());
3445
3551
  case 130:
3446
- return _context27.abrupt("return", {
3552
+ return _context29.abrupt("return", {
3447
3553
  productList: tempOrder.products || [],
3448
3554
  discountList: nextDiscountList,
3449
3555
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3451,11 +3557,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3451
3557
  });
3452
3558
  case 131:
3453
3559
  case "end":
3454
- return _context27.stop();
3560
+ return _context29.stop();
3455
3561
  }
3456
- }, _callee27, this, [[82, 101, 104, 107]]);
3562
+ }, _callee29, this, [[82, 101, 104, 107]]);
3457
3563
  }));
3458
- function loadDiscountConfig(_x19) {
3564
+ function loadDiscountConfig(_x20) {
3459
3565
  return _loadDiscountConfig.apply(this, arguments);
3460
3566
  }
3461
3567
  return loadDiscountConfig;
@@ -3477,21 +3583,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3477
3583
  }, {
3478
3584
  key: "bestDiscount",
3479
3585
  value: function () {
3480
- var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(cb) {
3586
+ var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(cb) {
3481
3587
  var _discountModule$getOr2, _discountModule$getDi4;
3482
3588
  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) {
3589
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3590
+ while (1) switch (_context30.prev = _context30.next) {
3485
3591
  case 0:
3486
3592
  if (this.store.order) {
3487
- _context28.next = 2;
3593
+ _context30.next = 2;
3488
3594
  break;
3489
3595
  }
3490
3596
  throw new Error('order 模块未初始化');
3491
3597
  case 2:
3492
3598
  tempOrder = this.store.order.ensureTempOrder();
3493
3599
  if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
3494
- _context28.next = 7;
3600
+ _context30.next = 7;
3495
3601
  break;
3496
3602
  }
3497
3603
  _result2 = {
@@ -3499,7 +3605,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3499
3605
  discountList: []
3500
3606
  };
3501
3607
  cb === null || cb === void 0 || cb(_result2);
3502
- return _context28.abrupt("return", _result2);
3608
+ return _context30.abrupt("return", _result2);
3503
3609
  case 7:
3504
3610
  orderStore = this.store.order.store || {};
3505
3611
  discountModule = orderStore.discount;
@@ -3511,11 +3617,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3511
3617
  productList: tempOrder.products || [],
3512
3618
  discountList: nextDiscountList
3513
3619
  };
3514
- _context28.next = 16;
3620
+ _context30.next = 16;
3515
3621
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3516
3622
  case 16:
3517
3623
  if (!rulesModule) {
3518
- _context28.next = 27;
3624
+ _context30.next = 27;
3519
3625
  break;
3520
3626
  }
3521
3627
  orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
@@ -3534,12 +3640,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3534
3640
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
3535
3641
  }
3536
3642
  if (!result.discountList) {
3537
- _context28.next = 27;
3643
+ _context30.next = 27;
3538
3644
  break;
3539
3645
  }
3540
3646
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
3541
3647
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
3542
- _context28.next = 25;
3648
+ _context30.next = 25;
3543
3649
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3544
3650
  case 25:
3545
3651
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
@@ -3550,13 +3656,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3550
3656
  discountList: nextDiscountList
3551
3657
  };
3552
3658
  case 27:
3553
- _context28.next = 29;
3659
+ _context30.next = 29;
3554
3660
  return this.store.order.recalculateSummary({
3555
3661
  createIfMissing: true
3556
3662
  });
3557
3663
  case 29:
3558
3664
  this.store.order.persistTempOrder();
3559
- _context28.next = 32;
3665
+ _context30.next = 32;
3560
3666
  return this.effectsEmit('onDiscountApplied', {
3561
3667
  productList: tempOrder.products || [],
3562
3668
  discountList: nextDiscountList,
@@ -3565,14 +3671,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3565
3671
  });
3566
3672
  case 32:
3567
3673
  cb === null || cb === void 0 || cb(result);
3568
- return _context28.abrupt("return", result);
3674
+ return _context30.abrupt("return", result);
3569
3675
  case 34:
3570
3676
  case "end":
3571
- return _context28.stop();
3677
+ return _context30.stop();
3572
3678
  }
3573
- }, _callee28, this);
3679
+ }, _callee30, this);
3574
3680
  }));
3575
- function bestDiscount(_x20) {
3681
+ function bestDiscount(_x21) {
3576
3682
  return _bestDiscount.apply(this, arguments);
3577
3683
  }
3578
3684
  return bestDiscount;
@@ -3601,41 +3707,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3601
3707
  }, {
3602
3708
  key: "replaceDiscountStoreLists",
3603
3709
  value: (function () {
3604
- var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3710
+ var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3605
3711
  var _store2;
3606
3712
  var discountModule;
3607
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3608
- while (1) switch (_context29.prev = _context29.next) {
3713
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3714
+ while (1) switch (_context31.prev = _context31.next) {
3609
3715
  case 0:
3610
3716
  if (this.store.order) {
3611
- _context29.next = 2;
3717
+ _context31.next = 2;
3612
3718
  break;
3613
3719
  }
3614
3720
  throw new Error('order 模块未初始化');
3615
3721
  case 2:
3616
3722
  discountModule = (_store2 = this.store.order.store) === null || _store2 === void 0 ? void 0 : _store2.discount;
3617
3723
  if (discountModule) {
3618
- _context29.next = 5;
3724
+ _context31.next = 5;
3619
3725
  break;
3620
3726
  }
3621
- return _context29.abrupt("return");
3727
+ return _context31.abrupt("return");
3622
3728
  case 5:
3623
3729
  if (!params.originalDiscountList) {
3624
- _context29.next = 8;
3730
+ _context31.next = 8;
3625
3731
  break;
3626
3732
  }
3627
- _context29.next = 8;
3733
+ _context31.next = 8;
3628
3734
  return discountModule.setOriginalDiscountList(params.originalDiscountList);
3629
3735
  case 8:
3630
- _context29.next = 10;
3736
+ _context31.next = 10;
3631
3737
  return discountModule.setDiscountList(params.discountList);
3632
3738
  case 10:
3633
3739
  case "end":
3634
- return _context29.stop();
3740
+ return _context31.stop();
3635
3741
  }
3636
- }, _callee29, this);
3742
+ }, _callee31, this);
3637
3743
  }));
3638
- function replaceDiscountStoreLists(_x21) {
3744
+ function replaceDiscountStoreLists(_x22) {
3639
3745
  return _replaceDiscountStoreLists.apply(this, arguments);
3640
3746
  }
3641
3747
  return replaceDiscountStoreLists;
@@ -3643,34 +3749,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3643
3749
  }, {
3644
3750
  key: "scanPromotionCode",
3645
3751
  value: function () {
3646
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(code, customerId) {
3752
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(code, customerId) {
3647
3753
  var raw, tempOrder;
3648
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3649
- while (1) switch (_context30.prev = _context30.next) {
3754
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3755
+ while (1) switch (_context32.prev = _context32.next) {
3650
3756
  case 0:
3651
- _context30.prev = 0;
3757
+ _context32.prev = 0;
3652
3758
  if (this.store.order) {
3653
- _context30.next = 3;
3759
+ _context32.next = 3;
3654
3760
  break;
3655
3761
  }
3656
3762
  throw new Error('order 模块未初始化');
3657
3763
  case 3:
3658
- _context30.next = 5;
3764
+ _context32.next = 5;
3659
3765
  return this.store.order.scanCode(code, customerId);
3660
3766
  case 5:
3661
- raw = _context30.sent;
3767
+ raw = _context32.sent;
3662
3768
  if (!raw.isAvailable) {
3663
- _context30.next = 13;
3769
+ _context32.next = 13;
3664
3770
  break;
3665
3771
  }
3666
- _context30.next = 9;
3772
+ _context32.next = 9;
3667
3773
  return this.store.order.recalculateSummary({
3668
3774
  createIfMissing: true
3669
3775
  });
3670
3776
  case 9:
3671
3777
  this.store.order.persistTempOrder();
3672
3778
  tempOrder = this.store.order.ensureTempOrder();
3673
- _context30.next = 13;
3779
+ _context32.next = 13;
3674
3780
  return this.effectsEmit('onDiscountApplied', {
3675
3781
  productList: tempOrder.products || [],
3676
3782
  discountList: this.store.order.getDiscountList(),
@@ -3678,7 +3784,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3678
3784
  tempOrder: tempOrder
3679
3785
  });
3680
3786
  case 13:
3681
- return _context30.abrupt("return", _objectSpread(_objectSpread({
3787
+ return _context32.abrupt("return", _objectSpread(_objectSpread({
3682
3788
  isAvailable: raw.isAvailable
3683
3789
  }, raw.isAccepted !== undefined ? {
3684
3790
  isAccepted: raw.isAccepted
@@ -3688,16 +3794,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3688
3794
  scannedDiscountList: raw.scannedDiscountList
3689
3795
  }));
3690
3796
  case 16:
3691
- _context30.prev = 16;
3692
- _context30.t0 = _context30["catch"](0);
3693
- throw _context30.t0;
3797
+ _context32.prev = 16;
3798
+ _context32.t0 = _context32["catch"](0);
3799
+ throw _context32.t0;
3694
3800
  case 19:
3695
3801
  case "end":
3696
- return _context30.stop();
3802
+ return _context32.stop();
3697
3803
  }
3698
- }, _callee30, this, [[0, 16]]);
3804
+ }, _callee32, this, [[0, 16]]);
3699
3805
  }));
3700
- function scanPromotionCode(_x22, _x23) {
3806
+ function scanPromotionCode(_x23, _x24) {
3701
3807
  return _scanPromotionCode.apply(this, arguments);
3702
3808
  }
3703
3809
  return scanPromotionCode;
@@ -3705,35 +3811,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3705
3811
  }, {
3706
3812
  key: "setDiscountSelected",
3707
3813
  value: function () {
3708
- var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3814
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3709
3815
  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) {
3816
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3817
+ while (1) switch (_context33.prev = _context33.next) {
3712
3818
  case 0:
3713
- _context31.prev = 0;
3819
+ _context33.prev = 0;
3714
3820
  if (this.store.order) {
3715
- _context31.next = 3;
3821
+ _context33.next = 3;
3716
3822
  break;
3717
3823
  }
3718
3824
  throw new Error('order 模块未初始化');
3719
3825
  case 3:
3720
3826
  currentOrder = this.store.order.ensureTempOrder();
3721
3827
  if (!this.isActiveVirtualSettlementOrder(currentOrder)) {
3722
- _context31.next = 13;
3828
+ _context33.next = 13;
3723
3829
  break;
3724
3830
  }
3725
3831
  currentOrder.discount_list = [];
3726
3832
  currentOrder.shop_discount = '0.00';
3727
- _context31.next = 9;
3833
+ _context33.next = 9;
3728
3834
  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
3835
  case 9:
3730
- _context31.next = 11;
3836
+ _context33.next = 11;
3731
3837
  return this.store.order.recalculateSummary({
3732
3838
  createIfMissing: true
3733
3839
  });
3734
3840
  case 11:
3735
3841
  this.store.order.persistTempOrder();
3736
- return _context31.abrupt("return");
3842
+ return _context33.abrupt("return");
3737
3843
  case 13:
3738
3844
  list = this.store.order.getDiscountList();
3739
3845
  updated = list.map(function (d) {
@@ -3748,7 +3854,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3748
3854
  _discountModule = orderStore.discount;
3749
3855
  rulesModule = orderStore.rules;
3750
3856
  nextDiscountList = updated;
3751
- _context31.next = 23;
3857
+ _context33.next = 23;
3752
3858
  return _discountModule === null || _discountModule === void 0 ? void 0 : _discountModule.setDiscountList(updated);
3753
3859
  case 23:
3754
3860
  if (rulesModule) {
@@ -3810,21 +3916,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3810
3916
  });
3811
3917
  };
3812
3918
  _iterator5 = _createForOfIteratorHelper(tempOrder.products);
3813
- _context31.prev = 27;
3919
+ _context33.prev = 27;
3814
3920
  _iterator5.s();
3815
3921
  case 29:
3816
3922
  if ((_step5 = _iterator5.n()).done) {
3817
- _context31.next = 46;
3923
+ _context33.next = 46;
3818
3924
  break;
3819
3925
  }
3820
3926
  product = _step5.value;
3821
3927
  productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
3822
3928
  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
3929
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
3824
- _context31.next = 35;
3930
+ _context33.next = 35;
3825
3931
  break;
3826
3932
  }
3827
- return _context31.abrupt("continue", 44);
3933
+ return _context33.abrupt("continue", 44);
3828
3934
  case 35:
3829
3935
  product.discount_list = filterSelectedDiscountDetails(product.discount_list);
3830
3936
  if (Array.isArray(product.product_bundle)) {
@@ -3860,28 +3966,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3860
3966
  bundle: product.product_bundle
3861
3967
  });
3862
3968
  case 44:
3863
- _context31.next = 29;
3969
+ _context33.next = 29;
3864
3970
  break;
3865
3971
  case 46:
3866
- _context31.next = 51;
3972
+ _context33.next = 51;
3867
3973
  break;
3868
3974
  case 48:
3869
- _context31.prev = 48;
3870
- _context31.t0 = _context31["catch"](27);
3871
- _iterator5.e(_context31.t0);
3975
+ _context33.prev = 48;
3976
+ _context33.t0 = _context33["catch"](27);
3977
+ _iterator5.e(_context33.t0);
3872
3978
  case 51:
3873
- _context31.prev = 51;
3979
+ _context33.prev = 51;
3874
3980
  _iterator5.f();
3875
- return _context31.finish(51);
3981
+ return _context33.finish(51);
3876
3982
  case 54:
3877
3983
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
3878
- _context31.next = 57;
3984
+ _context33.next = 57;
3879
3985
  return _discountModule === null || _discountModule === void 0 ? void 0 : _discountModule.setDiscountList(nextDiscountList);
3880
3986
  case 57:
3881
3987
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
3882
3988
  return d.isSelected;
3883
3989
  });
3884
- _context31.next = 60;
3990
+ _context33.next = 60;
3885
3991
  return this.store.order.recalculateSummary({
3886
3992
  createIfMissing: true
3887
3993
  });
@@ -3893,19 +3999,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3893
3999
  selectedDiscountList: tempOrder.discount_list,
3894
4000
  tempOrder: tempOrder
3895
4001
  });
3896
- _context31.next = 67;
4002
+ _context33.next = 67;
3897
4003
  break;
3898
4004
  case 64:
3899
- _context31.prev = 64;
3900
- _context31.t1 = _context31["catch"](0);
3901
- throw _context31.t1;
4005
+ _context33.prev = 64;
4006
+ _context33.t1 = _context33["catch"](0);
4007
+ throw _context33.t1;
3902
4008
  case 67:
3903
4009
  case "end":
3904
- return _context31.stop();
4010
+ return _context33.stop();
3905
4011
  }
3906
- }, _callee31, this, [[0, 64], [27, 48, 51, 54]]);
4012
+ }, _callee33, this, [[0, 64], [27, 48, 51, 54]]);
3907
4013
  }));
3908
- function setDiscountSelected(_x24) {
4014
+ function setDiscountSelected(_x25) {
3909
4015
  return _setDiscountSelected.apply(this, arguments);
3910
4016
  }
3911
4017
  return setDiscountSelected;
@@ -3913,23 +4019,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3913
4019
  }, {
3914
4020
  key: "applyDiscountCalculationResult",
3915
4021
  value: function () {
3916
- var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(result) {
4022
+ var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(result) {
3917
4023
  var tempOrder, orderStore, _discountModule2;
3918
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3919
- while (1) switch (_context32.prev = _context32.next) {
4024
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4025
+ while (1) switch (_context34.prev = _context34.next) {
3920
4026
  case 0:
3921
- _context32.prev = 0;
4027
+ _context34.prev = 0;
3922
4028
  if (this.store.order) {
3923
- _context32.next = 3;
4029
+ _context34.next = 3;
3924
4030
  break;
3925
4031
  }
3926
4032
  throw new Error('order 模块未初始化');
3927
4033
  case 3:
3928
4034
  if (result) {
3929
- _context32.next = 5;
4035
+ _context34.next = 5;
3930
4036
  break;
3931
4037
  }
3932
- return _context32.abrupt("return");
4038
+ return _context34.abrupt("return");
3933
4039
  case 5:
3934
4040
  tempOrder = this.store.order.ensureTempOrder();
3935
4041
  orderStore = this.store.order.store || {};
@@ -3938,24 +4044,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3938
4044
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
3939
4045
  }
3940
4046
  if (!result.discountList) {
3941
- _context32.next = 14;
4047
+ _context34.next = 14;
3942
4048
  break;
3943
4049
  }
3944
4050
  OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
3945
- _context32.next = 13;
4051
+ _context34.next = 13;
3946
4052
  return _discountModule2 === null || _discountModule2 === void 0 ? void 0 : _discountModule2.setDiscountList(result.discountList);
3947
4053
  case 13:
3948
4054
  tempOrder.discount_list = result.discountList.filter(function (discount) {
3949
4055
  return discount.isSelected;
3950
4056
  });
3951
4057
  case 14:
3952
- _context32.next = 16;
4058
+ _context34.next = 16;
3953
4059
  return this.store.order.recalculateSummary({
3954
4060
  createIfMissing: true
3955
4061
  });
3956
4062
  case 16:
3957
4063
  this.store.order.persistTempOrder();
3958
- _context32.next = 19;
4064
+ _context34.next = 19;
3959
4065
  return this.effectsEmit('onDiscountApplied', {
3960
4066
  productList: tempOrder.products || [],
3961
4067
  discountList: result.discountList || [],
@@ -3963,19 +4069,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3963
4069
  tempOrder: tempOrder
3964
4070
  });
3965
4071
  case 19:
3966
- _context32.next = 24;
4072
+ _context34.next = 24;
3967
4073
  break;
3968
4074
  case 21:
3969
- _context32.prev = 21;
3970
- _context32.t0 = _context32["catch"](0);
3971
- throw _context32.t0;
4075
+ _context34.prev = 21;
4076
+ _context34.t0 = _context34["catch"](0);
4077
+ throw _context34.t0;
3972
4078
  case 24:
3973
4079
  case "end":
3974
- return _context32.stop();
4080
+ return _context34.stop();
3975
4081
  }
3976
- }, _callee32, this, [[0, 21]]);
4082
+ }, _callee34, this, [[0, 21]]);
3977
4083
  }));
3978
- function applyDiscountCalculationResult(_x25) {
4084
+ function applyDiscountCalculationResult(_x26) {
3979
4085
  return _applyDiscountCalculationResult.apply(this, arguments);
3980
4086
  }
3981
4087
  return applyDiscountCalculationResult;
@@ -3983,18 +4089,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3983
4089
  }, {
3984
4090
  key: "submitScanOrder",
3985
4091
  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) {
4092
+ var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4093
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4094
+ while (1) switch (_context35.prev = _context35.next) {
3989
4095
  case 0:
3990
- return _context33.abrupt("return", this.submitSalesOrder(params));
4096
+ return _context35.abrupt("return", this.submitSalesOrder(params));
3991
4097
  case 1:
3992
4098
  case "end":
3993
- return _context33.stop();
4099
+ return _context35.stop();
3994
4100
  }
3995
- }, _callee33, this);
4101
+ }, _callee35, this);
3996
4102
  }));
3997
- function submitScanOrder(_x26) {
4103
+ function submitScanOrder(_x27) {
3998
4104
  return _submitScanOrder.apply(this, arguments);
3999
4105
  }
4000
4106
  return submitScanOrder;
@@ -4022,33 +4128,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4022
4128
  }, {
4023
4129
  key: "buildVirtualSettlementSubmitData",
4024
4130
  value: function () {
4025
- var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
4131
+ var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
4026
4132
  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) {
4133
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4134
+ while (1) switch (_context36.prev = _context36.next) {
4029
4135
  case 0:
4030
4136
  settlement = this.buildVirtualSettlementOrderData();
4031
4137
  if (!(!settlement || !this.store.order)) {
4032
- _context34.next = 3;
4138
+ _context36.next = 3;
4033
4139
  break;
4034
4140
  }
4035
- return _context34.abrupt("return", null);
4141
+ return _context36.abrupt("return", null);
4036
4142
  case 3:
4037
4143
  tempOrder = this.store.order.getTempOrder();
4038
4144
  currencyProductId = settlement.currencyProductId;
4039
- _context34.next = 7;
4145
+ _context36.next = 7;
4040
4146
  return this.store.order.recalculateSummary({
4041
4147
  createIfMissing: true
4042
4148
  });
4043
4149
  case 7:
4044
- summary = _context34.sent;
4150
+ summary = _context36.sent;
4045
4151
  amount = new Decimal((summary === null || summary === void 0 ? void 0 : summary.total_amount) || 0).toDecimalPlaces(2);
4046
4152
  customerId = Number((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id) || 0);
4047
4153
  if (!(amount.gt(0) && customerId > 0 && customerId !== 1)) {
4048
- _context34.next = 13;
4154
+ _context36.next = 13;
4049
4155
  break;
4050
4156
  }
4051
- _context34.next = 13;
4157
+ _context36.next = 13;
4052
4158
  return this.store.order.loadDiscountConfig({
4053
4159
  customerId: customerId,
4054
4160
  action: tempOrder !== null && tempOrder !== void 0 && tempOrder.order_id ? 'edit' : 'create',
@@ -4060,22 +4166,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4060
4166
  return Number(item === null || item === void 0 ? void 0 : item.product_id) === currencyProductId;
4061
4167
  });
4062
4168
  if (!amount.lte(0)) {
4063
- _context34.next = 16;
4169
+ _context36.next = 16;
4064
4170
  break;
4065
4171
  }
4066
- return _context34.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4172
+ return _context36.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4067
4173
  payments: []
4068
4174
  }));
4069
4175
  case 16:
4070
4176
  if (asset) {
4071
- _context34.next = 18;
4177
+ _context36.next = 18;
4072
4178
  break;
4073
4179
  }
4074
4180
  throw new Error('No matching virtual currency card is available.');
4075
4181
  case 18:
4076
4182
  balance = new Decimal(asset.balance || 0);
4077
4183
  if (!balance.lt(amount)) {
4078
- _context34.next = 21;
4184
+ _context36.next = 21;
4079
4185
  break;
4080
4186
  }
4081
4187
  throw new Error('Insufficient virtual currency balance.');
@@ -4083,7 +4189,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4083
4189
  amountText = amount.toFixed(2);
4084
4190
  paymentNumber = "LOCAL_".concat(createUuidV4());
4085
4191
  if (!this.store.order.isOnlineStorePlatform()) {
4086
- _context34.next = 27;
4192
+ _context36.next = 27;
4087
4193
  break;
4088
4194
  }
4089
4195
  payment = {
@@ -4100,18 +4206,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4100
4206
  },
4101
4207
  wallet_pass_use_value: amountText
4102
4208
  };
4103
- _context34.next = 34;
4209
+ _context36.next = 34;
4104
4210
  break;
4105
4211
  case 27:
4106
- _context34.next = 29;
4212
+ _context36.next = 29;
4107
4213
  return this.getPaymentMethodsAsync();
4108
4214
  case 29:
4109
- paymentMethods = _context34.sent;
4215
+ paymentMethods = _context36.sent;
4110
4216
  paymentMethod = paymentMethods.find(function (method) {
4111
4217
  return String(method.code || '').toUpperCase() === 'PRODUCTVOUCHER';
4112
4218
  });
4113
4219
  if (paymentMethod) {
4114
- _context34.next = 33;
4220
+ _context36.next = 33;
4115
4221
  break;
4116
4222
  }
4117
4223
  throw new Error('PRODUCTVOUCHER payment method is unavailable.');
@@ -4135,14 +4241,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4135
4241
  metadata: {}
4136
4242
  };
4137
4243
  case 34:
4138
- return _context34.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4244
+ return _context36.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4139
4245
  payments: [payment]
4140
4246
  }));
4141
4247
  case 35:
4142
4248
  case "end":
4143
- return _context34.stop();
4249
+ return _context36.stop();
4144
4250
  }
4145
- }, _callee34, this);
4251
+ }, _callee36, this);
4146
4252
  }));
4147
4253
  function buildVirtualSettlementSubmitData() {
4148
4254
  return _buildVirtualSettlementSubmitData.apply(this, arguments);
@@ -4158,42 +4264,42 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4158
4264
  }, {
4159
4265
  key: "submitSalesOrder",
4160
4266
  value: (function () {
4161
- var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4162
- var _params$smallTicketDa, _this$otherParams18, _this$otherParams19, _this$otherParams20, _this$otherParams21;
4267
+ var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
4268
+ var _params$smallTicketDa, _this$otherParams20, _this$otherParams21, _this$otherParams22, _this$otherParams23;
4163
4269
  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) {
4270
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4271
+ while (1) switch (_context37.prev = _context37.next) {
4166
4272
  case 0:
4167
4273
  if (this.store.order) {
4168
- _context35.next = 2;
4274
+ _context37.next = 2;
4169
4275
  break;
4170
4276
  }
4171
4277
  throw new Error('BaseSales 解决方案需要 order 模块支持');
4172
4278
  case 2:
4173
4279
  if (!this.isPickupTimingEnabled()) {
4174
- _context35.next = 5;
4280
+ _context37.next = 5;
4175
4281
  break;
4176
4282
  }
4177
- _context35.next = 5;
4283
+ _context37.next = 5;
4178
4284
  return this.preparePickupTimingForCheckout({
4179
4285
  freeze: true
4180
4286
  });
4181
4287
  case 5:
4182
4288
  isDeferredPayment = (params === null || params === void 0 ? void 0 : params.paymentExecution) === 'deferred';
4183
4289
  if (!isDeferredPayment) {
4184
- _context35.next = 10;
4290
+ _context37.next = 10;
4185
4291
  break;
4186
4292
  }
4187
- _context35.t0 = null;
4188
- _context35.next = 13;
4293
+ _context37.t0 = null;
4294
+ _context37.next = 13;
4189
4295
  break;
4190
4296
  case 10:
4191
- _context35.next = 12;
4297
+ _context37.next = 12;
4192
4298
  return this.buildVirtualSettlementSubmitData();
4193
4299
  case 12:
4194
- _context35.t0 = _context35.sent;
4300
+ _context37.t0 = _context37.sent;
4195
4301
  case 13:
4196
- virtualPaymentSettlement = _context35.t0;
4302
+ virtualPaymentSettlement = _context37.t0;
4197
4303
  virtualSettlement = isDeferredPayment ? this.buildVirtualSettlementOrderData() : virtualPaymentSettlement; // this.store.order.persistTempOrder();
4198
4304
  inferredPaymentStatus = isDeferredPayment ? undefined : this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
4199
4305
  smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
@@ -4226,10 +4332,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4226
4332
  } : configuredEnhancePayload;
4227
4333
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
4228
4334
  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),
4335
+ platform: (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.platform,
4336
+ 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
4337
  channel: this.getSubmitOrderSalesChannel(),
4232
- type: (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.type,
4338
+ type: (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.type,
4233
4339
  request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
4234
4340
  }, isDeferredPayment ? {
4235
4341
  payments: []
@@ -4266,14 +4372,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4266
4372
  } : _enhancePayload !== undefined ? {
4267
4373
  enhancePayload: _enhancePayload
4268
4374
  } : {});
4269
- return _context35.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
4375
+ return _context37.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
4270
4376
  case 22:
4271
4377
  case "end":
4272
- return _context35.stop();
4378
+ return _context37.stop();
4273
4379
  }
4274
- }, _callee35, this);
4380
+ }, _callee37, this);
4275
4381
  }));
4276
- function submitSalesOrder(_x27) {
4382
+ function submitSalesOrder(_x28) {
4277
4383
  return _submitSalesOrder.apply(this, arguments);
4278
4384
  }
4279
4385
  return submitSalesOrder;
@@ -4281,42 +4387,42 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4281
4387
  }, {
4282
4388
  key: "saveSalesOrderDraft",
4283
4389
  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) {
4390
+ var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4391
+ var _params$platform, _this$otherParams24, _this$otherParams25, _this$otherParams26, _params$channel, _params$type, _this$otherParams27;
4392
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4393
+ while (1) switch (_context38.prev = _context38.next) {
4288
4394
  case 0:
4289
4395
  if (this.store.order) {
4290
- _context36.next = 2;
4396
+ _context38.next = 2;
4291
4397
  break;
4292
4398
  }
4293
4399
  throw new Error('BaseSales 解决方案需要 order 模块支持');
4294
4400
  case 2:
4295
4401
  if (!this.isPickupTimingEnabled()) {
4296
- _context36.next = 5;
4402
+ _context38.next = 5;
4297
4403
  break;
4298
4404
  }
4299
- _context36.next = 5;
4405
+ _context38.next = 5;
4300
4406
  return this.preparePickupTimingForCheckout({
4301
4407
  freeze: false
4302
4408
  });
4303
4409
  case 5:
4304
- return _context36.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
4410
+ return _context38.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
4305
4411
  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),
4412
+ 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,
4413
+ 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
4414
  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
4415
+ 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
4416
  }, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
4311
4417
  enhancePayload: params.enhancePayload
4312
4418
  } : {})));
4313
4419
  case 6:
4314
4420
  case "end":
4315
- return _context36.stop();
4421
+ return _context38.stop();
4316
4422
  }
4317
- }, _callee36, this);
4423
+ }, _callee38, this);
4318
4424
  }));
4319
- function saveSalesOrderDraft(_x28) {
4425
+ function saveSalesOrderDraft(_x29) {
4320
4426
  return _saveSalesOrderDraft.apply(this, arguments);
4321
4427
  }
4322
4428
  return saveSalesOrderDraft;
@@ -4324,23 +4430,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4324
4430
  }, {
4325
4431
  key: "submitTempOrderAsync",
4326
4432
  value: function () {
4327
- var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
4328
- var _params$smallTicketDa2, _this$otherParams26, _this$otherParams27, _this$otherParams28, _this$otherParams29;
4433
+ var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
4434
+ var _params$smallTicketDa2, _this$otherParams28, _this$otherParams29, _this$otherParams30, _this$otherParams31;
4329
4435
  var inferredPaymentStatus, smallTicketDataFlag, enhancePayload, submitParams;
4330
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4331
- while (1) switch (_context37.prev = _context37.next) {
4436
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4437
+ while (1) switch (_context39.prev = _context39.next) {
4332
4438
  case 0:
4333
4439
  if (this.store.order) {
4334
- _context37.next = 2;
4440
+ _context39.next = 2;
4335
4441
  break;
4336
4442
  }
4337
4443
  throw new Error('BaseSales 解决方案需要 order 模块支持');
4338
4444
  case 2:
4339
4445
  if (!this.isPickupTimingEnabled()) {
4340
- _context37.next = 5;
4446
+ _context39.next = 5;
4341
4447
  break;
4342
4448
  }
4343
- _context37.next = 5;
4449
+ _context39.next = 5;
4344
4450
  return this.preparePickupTimingForCheckout({
4345
4451
  freeze: true
4346
4452
  });
@@ -4350,10 +4456,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4350
4456
  enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params === null || params === void 0 ? void 0 : params.enhancePayload);
4351
4457
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
4352
4458
  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),
4459
+ platform: (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.platform,
4460
+ 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
4461
  channel: this.getSubmitOrderSalesChannel(),
4356
- type: (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.type,
4462
+ type: (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.type,
4357
4463
  request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
4358
4464
  }, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
4359
4465
  payments: params.payments
@@ -4366,14 +4472,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4366
4472
  } : {}), enhancePayload !== undefined ? {
4367
4473
  enhancePayload: enhancePayload
4368
4474
  } : {});
4369
- return _context37.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
4475
+ return _context39.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
4370
4476
  case 10:
4371
4477
  case "end":
4372
- return _context37.stop();
4478
+ return _context39.stop();
4373
4479
  }
4374
- }, _callee37, this);
4480
+ }, _callee39, this);
4375
4481
  }));
4376
- function submitTempOrderAsync(_x29) {
4482
+ function submitTempOrderAsync(_x30) {
4377
4483
  return _submitTempOrderAsync.apply(this, arguments);
4378
4484
  }
4379
4485
  return submitTempOrderAsync;
@@ -4385,8 +4491,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4385
4491
  }, {
4386
4492
  key: "shouldUseCheckoutSyncTask",
4387
4493
  value: function shouldUseCheckoutSyncTask() {
4388
- var _this$otherParams30;
4389
- var configured = (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.checkoutSyncTaskEnabled;
4494
+ var _this$otherParams32;
4495
+ var configured = (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.checkoutSyncTaskEnabled;
4390
4496
  return typeof configured === 'boolean' ? configured : true;
4391
4497
  }
4392
4498
 
@@ -4399,14 +4505,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4399
4505
  }, {
4400
4506
  key: "printLocalOrderReceipt",
4401
4507
  value: function () {
4402
- var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(lookup) {
4403
- var _this$otherParams31, _this$otherParams32, _this$otherParams33, _this$otherParams34;
4508
+ var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(lookup) {
4509
+ var _this$otherParams33, _this$otherParams34, _this$otherParams35, _this$otherParams36;
4404
4510
  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) {
4511
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4512
+ while (1) switch (_context40.prev = _context40.next) {
4407
4513
  case 0:
4408
4514
  if (this.store.order) {
4409
- _context38.next = 2;
4515
+ _context40.next = 2;
4410
4516
  break;
4411
4517
  }
4412
4518
  throw new Error('BaseSales 解决方案需要 order 模块支持');
@@ -4418,10 +4524,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4418
4524
  external_sale_number: lookup
4419
4525
  };
4420
4526
  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),
4527
+ platform: (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.platform,
4528
+ 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
4529
  channel: this.getSubmitOrderSalesChannel(),
4424
- type: (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.type
4530
+ type: (_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.type
4425
4531
  };
4426
4532
  payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
4427
4533
  lookup_order_from_db: 1,
@@ -4444,28 +4550,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4444
4550
  } : {}), invoiceTemplateSettings ? {
4445
4551
  template_settings: cloneDeep(invoiceTemplateSettings)
4446
4552
  } : {});
4447
- _context38.next = 11;
4553
+ _context40.next = 11;
4448
4554
  return this.request.post('/local/print-order', printPayload, {
4449
4555
  osServer: true,
4450
4556
  customToast: function customToast() {}
4451
4557
  });
4452
4558
  case 11:
4453
- response = _context38.sent;
4559
+ response = _context40.sent;
4454
4560
  if (hasLookup) {
4455
- _context38.next = 15;
4561
+ _context40.next = 15;
4456
4562
  break;
4457
4563
  }
4458
- _context38.next = 15;
4564
+ _context40.next = 15;
4459
4565
  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
4566
  case 15:
4461
- return _context38.abrupt("return", response);
4567
+ return _context40.abrupt("return", response);
4462
4568
  case 16:
4463
4569
  case "end":
4464
- return _context38.stop();
4570
+ return _context40.stop();
4465
4571
  }
4466
- }, _callee38, this);
4572
+ }, _callee40, this);
4467
4573
  }));
4468
- function printLocalOrderReceipt(_x30) {
4574
+ function printLocalOrderReceipt(_x31) {
4469
4575
  return _printLocalOrderReceipt.apply(this, arguments);
4470
4576
  }
4471
4577
  return printLocalOrderReceipt;
@@ -4486,19 +4592,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4486
4592
  }, {
4487
4593
  key: "syncPaymentsToOrder",
4488
4594
  value: function () {
4489
- var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
4490
- var _ref48, _params$businessCode, _this$otherParams35, _this$otherParams36, _params$channel2;
4595
+ var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
4596
+ var _ref48, _params$businessCode, _this$otherParams37, _this$otherParams38, _params$channel2;
4491
4597
  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) {
4598
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4599
+ while (1) switch (_context41.prev = _context41.next) {
4494
4600
  case 0:
4495
4601
  if (this.store.order) {
4496
- _context39.next = 2;
4602
+ _context41.next = 2;
4497
4603
  break;
4498
4604
  }
4499
4605
  throw new Error('order 模块未初始化');
4500
4606
  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;
4607
+ 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
4608
  channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
4503
4609
  enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params.enhancePayload);
4504
4610
  syncParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, params), {}, {
@@ -4512,14 +4618,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4512
4618
  } : {});
4513
4619
  syncState = this.store.order.getOrderSyncState();
4514
4620
  if (!(params.submitWhenPaid && syncState === 'submitting')) {
4515
- _context39.next = 10;
4621
+ _context41.next = 10;
4516
4622
  break;
4517
4623
  }
4518
4624
  this.queueLatestAutoPaymentSync();
4519
- return _context39.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
4625
+ return _context41.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
4520
4626
  case 10:
4521
4627
  payments = params.payments || [];
4522
- _context39.next = 13;
4628
+ _context41.next = 13;
4523
4629
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
4524
4630
  payments: payments,
4525
4631
  params: syncParams,
@@ -4527,11 +4633,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4527
4633
  orderSnapshot: this.store.order.getOrderSnapshot()
4528
4634
  });
4529
4635
  case 13:
4530
- _context39.prev = 13;
4531
- _context39.next = 16;
4636
+ _context41.prev = 13;
4637
+ _context41.next = 16;
4532
4638
  return this.store.order.syncPaymentsToOrder(syncParams);
4533
4639
  case 16:
4534
- syncResult = _context39.sent;
4640
+ syncResult = _context41.sent;
4535
4641
  latestPayments = this.store.order.getOrderPayments();
4536
4642
  amountSnapshot = this.store.order.getOrderAmountSnapshot();
4537
4643
  orderSnapshot = this.store.order.getOrderSnapshot();
@@ -4549,25 +4655,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4549
4655
  depositAmount: syncResult.depositAmount,
4550
4656
  orderExpectedAmount: syncResult.orderExpectedAmount
4551
4657
  };
4552
- _context39.next = 23;
4658
+ _context41.next = 23;
4553
4659
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
4554
4660
  case 23:
4555
4661
  if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
4556
- _context39.next = 26;
4662
+ _context41.next = 26;
4557
4663
  break;
4558
4664
  }
4559
- _context39.next = 26;
4665
+ _context41.next = 26;
4560
4666
  return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
4561
4667
  case 26:
4562
4668
  this.scheduleQueuedAutoPaymentSyncFlush(0);
4563
- return _context39.abrupt("return", syncResult);
4669
+ return _context41.abrupt("return", syncResult);
4564
4670
  case 30:
4565
- _context39.prev = 30;
4566
- _context39.t0 = _context39["catch"](13);
4567
- _context39.next = 34;
4671
+ _context41.prev = 30;
4672
+ _context41.t0 = _context41["catch"](13);
4673
+ _context41.next = 34;
4568
4674
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
4569
4675
  ok: false,
4570
- error: _context39.t0,
4676
+ error: _context41.t0,
4571
4677
  payments: this.store.order.getOrderPayments(),
4572
4678
  params: syncParams,
4573
4679
  amountSnapshot: this.store.order.getOrderAmountSnapshot(),
@@ -4575,14 +4681,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4575
4681
  });
4576
4682
  case 34:
4577
4683
  this.scheduleQueuedAutoPaymentSyncFlush(0);
4578
- throw _context39.t0;
4684
+ throw _context41.t0;
4579
4685
  case 36:
4580
4686
  case "end":
4581
- return _context39.stop();
4687
+ return _context41.stop();
4582
4688
  }
4583
- }, _callee39, this, [[13, 30]]);
4689
+ }, _callee41, this, [[13, 30]]);
4584
4690
  }));
4585
- function syncPaymentsToOrder(_x31) {
4691
+ function syncPaymentsToOrder(_x32) {
4586
4692
  return _syncPaymentsToOrder.apply(this, arguments);
4587
4693
  }
4588
4694
  return syncPaymentsToOrder;
@@ -4619,58 +4725,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4619
4725
  }, {
4620
4726
  key: "scheduleQueuedAutoPaymentSyncFlush",
4621
4727
  value: function scheduleQueuedAutoPaymentSyncFlush() {
4622
- var _this18 = this;
4728
+ var _this19 = this;
4623
4729
  var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
4624
4730
  if (!this.queuedAutoPaymentSync) return;
4625
4731
  if (this.autoPaymentSyncTimer) return;
4626
4732
  this.autoPaymentSyncTimer = setTimeout(function () {
4627
- _this18.autoPaymentSyncTimer = null;
4628
- void _this18.flushQueuedAutoPaymentSync();
4733
+ _this19.autoPaymentSyncTimer = null;
4734
+ void _this19.flushQueuedAutoPaymentSync();
4629
4735
  }, delay);
4630
4736
  }
4631
4737
  }, {
4632
4738
  key: "flushQueuedAutoPaymentSync",
4633
4739
  value: function () {
4634
- var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
4740
+ var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
4635
4741
  var payments;
4636
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4637
- while (1) switch (_context40.prev = _context40.next) {
4742
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4743
+ while (1) switch (_context42.prev = _context42.next) {
4638
4744
  case 0:
4639
4745
  if (this.store.order) {
4640
- _context40.next = 2;
4746
+ _context42.next = 2;
4641
4747
  break;
4642
4748
  }
4643
- return _context40.abrupt("return");
4749
+ return _context42.abrupt("return");
4644
4750
  case 2:
4645
4751
  if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
4646
- _context40.next = 4;
4752
+ _context42.next = 4;
4647
4753
  break;
4648
4754
  }
4649
- return _context40.abrupt("return");
4755
+ return _context42.abrupt("return");
4650
4756
  case 4:
4651
4757
  if (!(this.store.order.getOrderSyncState() === 'submitting')) {
4652
- _context40.next = 7;
4758
+ _context42.next = 7;
4653
4759
  break;
4654
4760
  }
4655
4761
  this.scheduleQueuedAutoPaymentSyncFlush();
4656
- return _context40.abrupt("return");
4762
+ return _context42.abrupt("return");
4657
4763
  case 7:
4658
4764
  this.autoPaymentSyncFlushing = true;
4659
- _context40.prev = 8;
4765
+ _context42.prev = 8;
4660
4766
  case 9:
4661
4767
  if (!this.queuedAutoPaymentSync) {
4662
- _context40.next = 18;
4768
+ _context42.next = 18;
4663
4769
  break;
4664
4770
  }
4665
4771
  this.queuedAutoPaymentSync = false;
4666
4772
  payments = this.store.order.getOrderPayments();
4667
4773
  if (payments.length) {
4668
- _context40.next = 14;
4774
+ _context42.next = 14;
4669
4775
  break;
4670
4776
  }
4671
- return _context40.abrupt("continue", 9);
4777
+ return _context42.abrupt("continue", 9);
4672
4778
  case 14:
4673
- _context40.next = 16;
4779
+ _context42.next = 16;
4674
4780
  return this.syncPaymentsToOrder({
4675
4781
  payments: payments,
4676
4782
  paymentStatus: this.getPaymentStatusForSync(payments),
@@ -4678,29 +4784,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4678
4784
  smallTicketDataFlag: 1
4679
4785
  });
4680
4786
  case 16:
4681
- _context40.next = 9;
4787
+ _context42.next = 9;
4682
4788
  break;
4683
4789
  case 18:
4684
- _context40.next = 23;
4790
+ _context42.next = 23;
4685
4791
  break;
4686
4792
  case 20:
4687
- _context40.prev = 20;
4688
- _context40.t0 = _context40["catch"](8);
4793
+ _context42.prev = 20;
4794
+ _context42.t0 = _context42["catch"](8);
4689
4795
  this.logError('queued auto sync payments failed', {
4690
- error: _context40.t0 instanceof Error ? _context40.t0.message : String(_context40.t0)
4796
+ error: _context42.t0 instanceof Error ? _context42.t0.message : String(_context42.t0)
4691
4797
  });
4692
4798
  case 23:
4693
- _context40.prev = 23;
4799
+ _context42.prev = 23;
4694
4800
  this.autoPaymentSyncFlushing = false;
4695
4801
  if (this.queuedAutoPaymentSync) {
4696
4802
  this.scheduleQueuedAutoPaymentSyncFlush(0);
4697
4803
  }
4698
- return _context40.finish(23);
4804
+ return _context42.finish(23);
4699
4805
  case 27:
4700
4806
  case "end":
4701
- return _context40.stop();
4807
+ return _context42.stop();
4702
4808
  }
4703
- }, _callee40, this, [[8, 20, 23, 27]]);
4809
+ }, _callee42, this, [[8, 20, 23, 27]]);
4704
4810
  }));
4705
4811
  function flushQueuedAutoPaymentSync() {
4706
4812
  return _flushQueuedAutoPaymentSync.apply(this, arguments);
@@ -4724,35 +4830,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4724
4830
  }, {
4725
4831
  key: "addOrderPaymentAsync",
4726
4832
  value: (function () {
4727
- var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(payment) {
4833
+ var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(payment) {
4728
4834
  var paymentRecord, hasPaymentNumber, devicePrefix;
4729
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4730
- while (1) switch (_context41.prev = _context41.next) {
4835
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4836
+ while (1) switch (_context43.prev = _context43.next) {
4731
4837
  case 0:
4732
4838
  paymentRecord = payment;
4733
4839
  hasPaymentNumber = String(paymentRecord.payment_number || '').trim() !== '';
4734
4840
  if (!hasPaymentNumber) {
4735
- _context41.next = 6;
4841
+ _context43.next = 6;
4736
4842
  break;
4737
4843
  }
4738
- _context41.t0 = 'LOCAL';
4739
- _context41.next = 9;
4844
+ _context43.t0 = 'LOCAL';
4845
+ _context43.next = 9;
4740
4846
  break;
4741
4847
  case 6:
4742
- _context41.next = 8;
4848
+ _context43.next = 8;
4743
4849
  return this.getPaymentNumberDevicePrefixAsync();
4744
4850
  case 8:
4745
- _context41.t0 = _context41.sent;
4851
+ _context43.t0 = _context43.sent;
4746
4852
  case 9:
4747
- devicePrefix = _context41.t0;
4748
- return _context41.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
4853
+ devicePrefix = _context43.t0;
4854
+ return _context43.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
4749
4855
  case 11:
4750
4856
  case "end":
4751
- return _context41.stop();
4857
+ return _context43.stop();
4752
4858
  }
4753
- }, _callee41, this);
4859
+ }, _callee43, this);
4754
4860
  }));
4755
- function addOrderPaymentAsync(_x32) {
4861
+ function addOrderPaymentAsync(_x33) {
4756
4862
  return _addOrderPaymentAsync.apply(this, arguments);
4757
4863
  }
4758
4864
  return addOrderPaymentAsync;
@@ -4760,12 +4866,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4760
4866
  }, {
4761
4867
  key: "addOrderPaymentWithDevicePrefix",
4762
4868
  value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
4763
- var _this$otherParams37,
4869
+ var _this$otherParams39,
4764
4870
  _paymentRecord$paymen,
4765
4871
  _paymentRecord$create,
4766
4872
  _ref49,
4767
4873
  _paymentRecord$origin,
4768
- _this19 = this;
4874
+ _this20 = this;
4769
4875
  if (!this.store.order) throw new Error('order 模块未初始化');
4770
4876
  var paymentRecord = payment;
4771
4877
  var paymentAmount = new Decimal(paymentRecord.amount || 0);
@@ -4776,7 +4882,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4776
4882
  return this.store.order.getOrderPayments();
4777
4883
  }
4778
4884
  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;
4885
+ var shopWalletPassId = (_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.shop_wallet_pass_id;
4780
4886
  if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
4781
4887
  metadata.shop_wallet_pass_id = shopWalletPassId;
4782
4888
  }
@@ -4809,7 +4915,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4809
4915
  submitWhenPaid: true,
4810
4916
  smallTicketDataFlag: 1
4811
4917
  }).catch(function (error) {
4812
- _this19.logError('auto sync payments failed', {
4918
+ _this20.logError('auto sync payments failed', {
4813
4919
  error: error instanceof Error ? error.message : String(error)
4814
4920
  });
4815
4921
  });
@@ -4821,7 +4927,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4821
4927
  }, {
4822
4928
  key: "updateOrderPayment",
4823
4929
  value: (function () {
4824
- var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(paymentIdentity, updates) {
4930
+ var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(paymentIdentity, updates) {
4825
4931
  var _result$payment, _result$payment2;
4826
4932
  var options,
4827
4933
  matchMode,
@@ -4838,13 +4944,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4838
4944
  shouldSubmit,
4839
4945
  syncResult,
4840
4946
  _options$smallTicketD2,
4841
- _args42 = arguments;
4842
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4843
- while (1) switch (_context42.prev = _context42.next) {
4947
+ _args44 = arguments;
4948
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4949
+ while (1) switch (_context44.prev = _context44.next) {
4844
4950
  case 0:
4845
- options = _args42.length > 2 && _args42[2] !== undefined ? _args42[2] : {};
4951
+ options = _args44.length > 2 && _args44[2] !== undefined ? _args44[2] : {};
4846
4952
  if (this.store.order) {
4847
- _context42.next = 3;
4953
+ _context44.next = 3;
4848
4954
  break;
4849
4955
  }
4850
4956
  throw new Error('order 模块未初始化');
@@ -4853,15 +4959,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4853
4959
  previousMatch = resolveOrderPaymentIdentity(this.store.order.getOrderPayments(), paymentIdentity, matchMode);
4854
4960
  previousPayment = previousMatch === null || previousMatch === void 0 ? void 0 : previousMatch.payment;
4855
4961
  if (!((previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) === 'paid' && !options.applyUpdatesWhenPaid)) {
4856
- _context42.next = 13;
4962
+ _context44.next = 13;
4857
4963
  break;
4858
4964
  }
4859
4965
  currentPayments = this.store.order.getOrderPayments();
4860
4966
  if (!(options.submitWhenPaid && options.forceSubmitIfPaid)) {
4861
- _context42.next = 12;
4967
+ _context44.next = 12;
4862
4968
  break;
4863
4969
  }
4864
- _context42.next = 11;
4970
+ _context44.next = 11;
4865
4971
  return this.syncPaymentsToOrder({
4866
4972
  payments: currentPayments,
4867
4973
  paymentStatus: this.getPaymentStatusForSync(currentPayments),
@@ -4869,9 +4975,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4869
4975
  smallTicketDataFlag: (_options$smallTicketD = options.smallTicketDataFlag) !== null && _options$smallTicketD !== void 0 ? _options$smallTicketD : 1
4870
4976
  });
4871
4977
  case 11:
4872
- _syncResult = _context42.sent;
4978
+ _syncResult = _context44.sent;
4873
4979
  case 12:
4874
- return _context42.abrupt("return", _objectSpread({
4980
+ return _context44.abrupt("return", _objectSpread({
4875
4981
  updated: false,
4876
4982
  payment: previousPayment,
4877
4983
  payments: currentPayments,
@@ -4880,44 +4986,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4880
4986
  syncResult: _syncResult
4881
4987
  } : {}));
4882
4988
  case 13:
4883
- _context42.next = 15;
4989
+ _context44.next = 15;
4884
4990
  return this.store.order.updateOrderPayment(paymentIdentity, updates, {
4885
4991
  matchBy: matchMode
4886
4992
  });
4887
4993
  case 15:
4888
- result = _context42.sent;
4994
+ result = _context44.sent;
4889
4995
  if (!(options.persistDraft !== false)) {
4890
- _context42.next = 29;
4996
+ _context44.next = 29;
4891
4997
  break;
4892
4998
  }
4893
- _context42.prev = 17;
4894
- _context42.next = 20;
4999
+ _context44.prev = 17;
5000
+ _context44.next = 20;
4895
5001
  return this.saveSalesOrderDraft();
4896
5002
  case 20:
4897
- draftResult = _context42.sent;
4898
- _context42.next = 29;
5003
+ draftResult = _context44.sent;
5004
+ _context44.next = 29;
4899
5005
  break;
4900
5006
  case 23:
4901
- _context42.prev = 23;
4902
- _context42.t0 = _context42["catch"](17);
4903
- draftError = _context42.t0;
5007
+ _context44.prev = 23;
5008
+ _context44.t0 = _context44["catch"](17);
5009
+ draftError = _context44.t0;
4904
5010
  this.logError('updateOrderPayment: 保存支付草稿失败', {
4905
5011
  paymentIdentity: paymentIdentity,
4906
- error: _context42.t0 instanceof Error ? _context42.t0.message : String(_context42.t0)
5012
+ error: _context44.t0 instanceof Error ? _context44.t0.message : String(_context44.t0)
4907
5013
  });
4908
5014
  if (options.submitWhenPaid) {
4909
- _context42.next = 29;
5015
+ _context44.next = 29;
4910
5016
  break;
4911
5017
  }
4912
- throw _context42.t0;
5018
+ throw _context44.t0;
4913
5019
  case 29:
4914
5020
  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
5021
  shouldSubmit = Boolean(options.submitWhenPaid && ((_result$payment2 = result.payment) === null || _result$payment2 === void 0 ? void 0 : _result$payment2.status) === 'paid' && (becamePaid || options.forceSubmitIfPaid));
4916
5022
  if (!shouldSubmit) {
4917
- _context42.next = 35;
5023
+ _context44.next = 35;
4918
5024
  break;
4919
5025
  }
4920
- _context42.next = 34;
5026
+ _context44.next = 34;
4921
5027
  return this.syncPaymentsToOrder({
4922
5028
  payments: result.payments,
4923
5029
  paymentStatus: this.getPaymentStatusForSync(result.payments),
@@ -4925,9 +5031,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4925
5031
  smallTicketDataFlag: (_options$smallTicketD2 = options.smallTicketDataFlag) !== null && _options$smallTicketD2 !== void 0 ? _options$smallTicketD2 : 1
4926
5032
  });
4927
5033
  case 34:
4928
- syncResult = _context42.sent;
5034
+ syncResult = _context44.sent;
4929
5035
  case 35:
4930
- return _context42.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
5036
+ return _context44.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
4931
5037
  draftResult: draftResult
4932
5038
  } : {}), draftError !== undefined ? {
4933
5039
  draftError: draftError
@@ -4936,11 +5042,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4936
5042
  } : {}));
4937
5043
  case 36:
4938
5044
  case "end":
4939
- return _context42.stop();
5045
+ return _context44.stop();
4940
5046
  }
4941
- }, _callee42, this, [[17, 23]]);
5047
+ }, _callee44, this, [[17, 23]]);
4942
5048
  }));
4943
- function updateOrderPayment(_x33, _x34) {
5049
+ function updateOrderPayment(_x34, _x35) {
4944
5050
  return _updateOrderPayment.apply(this, arguments);
4945
5051
  }
4946
5052
  return updateOrderPayment;
@@ -4962,24 +5068,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4962
5068
  }, {
4963
5069
  key: "updateVoucherOrderPaymentsAsync",
4964
5070
  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) {
5071
+ var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(payments, options) {
5072
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5073
+ while (1) switch (_context45.prev = _context45.next) {
4968
5074
  case 0:
4969
5075
  if (this.store.order) {
4970
- _context43.next = 2;
5076
+ _context45.next = 2;
4971
5077
  break;
4972
5078
  }
4973
5079
  throw new Error('order 模块未初始化');
4974
5080
  case 2:
4975
- return _context43.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
5081
+ return _context45.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
4976
5082
  case 3:
4977
5083
  case "end":
4978
- return _context43.stop();
5084
+ return _context45.stop();
4979
5085
  }
4980
- }, _callee43, this);
5086
+ }, _callee45, this);
4981
5087
  }));
4982
- function updateVoucherOrderPaymentsAsync(_x35, _x36) {
5088
+ function updateVoucherOrderPaymentsAsync(_x36, _x37) {
4983
5089
  return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
4984
5090
  }
4985
5091
  return updateVoucherOrderPaymentsAsync;
@@ -5090,20 +5196,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5090
5196
  }, {
5091
5197
  key: "initWalletData",
5092
5198
  value: function () {
5093
- var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
5199
+ var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
5094
5200
  var _this$store$order$mer, _this$store$order17, _snapshot$identity;
5095
5201
  var snapshot, walletBusinessData, result;
5096
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5097
- while (1) switch (_context44.prev = _context44.next) {
5202
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5203
+ while (1) switch (_context46.prev = _context46.next) {
5098
5204
  case 0:
5099
5205
  if (this.store.order) {
5100
- _context44.next = 2;
5206
+ _context46.next = 2;
5101
5207
  break;
5102
5208
  }
5103
5209
  throw new Error('order 模块未初始化');
5104
5210
  case 2:
5105
5211
  if (this.store.payment) {
5106
- _context44.next = 4;
5212
+ _context46.next = 4;
5107
5213
  break;
5108
5214
  }
5109
5215
  throw new Error('payment 模块未初始化');
@@ -5111,10 +5217,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5111
5217
  snapshot = this.store.order.getOrderSnapshot();
5112
5218
  walletBusinessData = this.buildWalletInitBusinessData(params);
5113
5219
  if (walletBusinessData) {
5114
- _context44.next = 8;
5220
+ _context46.next = 8;
5115
5221
  break;
5116
5222
  }
5117
- return _context44.abrupt("return", {
5223
+ return _context46.abrupt("return", {
5118
5224
  walletRecommendList: [],
5119
5225
  userIdentificationCodes: [],
5120
5226
  transformList: [],
@@ -5122,15 +5228,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5122
5228
  products: []
5123
5229
  });
5124
5230
  case 8:
5125
- _context44.next = 10;
5231
+ _context46.next = 10;
5126
5232
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
5127
5233
  case 10:
5128
- result = _context44.sent;
5234
+ result = _context46.sent;
5129
5235
  (_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
5236
  customerId: walletBusinessData.customer_id,
5131
5237
  orderIdentity: snapshot === null || snapshot === void 0 ? void 0 : snapshot.identity
5132
5238
  });
5133
- _context44.next = 14;
5239
+ _context46.next = 14;
5134
5240
  return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
5135
5241
  orderId: snapshot === null || snapshot === void 0 || (_snapshot$identity = snapshot.identity) === null || _snapshot$identity === void 0 ? void 0 : _snapshot$identity.orderId,
5136
5242
  customerId: walletBusinessData.customer_id,
@@ -5142,14 +5248,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5142
5248
  timestamp: Date.now()
5143
5249
  });
5144
5250
  case 14:
5145
- return _context44.abrupt("return", result);
5251
+ return _context46.abrupt("return", result);
5146
5252
  case 15:
5147
5253
  case "end":
5148
- return _context44.stop();
5254
+ return _context46.stop();
5149
5255
  }
5150
- }, _callee44, this);
5256
+ }, _callee46, this);
5151
5257
  }));
5152
- function initWalletData(_x37) {
5258
+ function initWalletData(_x38) {
5153
5259
  return _initWalletData.apply(this, arguments);
5154
5260
  }
5155
5261
  return initWalletData;
@@ -5200,27 +5306,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5200
5306
  }, {
5201
5307
  key: "publishWalletAssetsState",
5202
5308
  value: function () {
5203
- var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(state) {
5309
+ var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(state) {
5204
5310
  var changeSource,
5205
- _args45 = arguments;
5206
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5207
- while (1) switch (_context45.prev = _context45.next) {
5311
+ _args47 = arguments;
5312
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5313
+ while (1) switch (_context47.prev = _context47.next) {
5208
5314
  case 0:
5209
- changeSource = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : 'derived';
5210
- _context45.next = 3;
5315
+ changeSource = _args47.length > 1 && _args47[1] !== undefined ? _args47[1] : 'derived';
5316
+ _context47.next = 3;
5211
5317
  return this.effectsEmit(BaseSalesHookNames.onWalletAssetsStateChanged, {
5212
5318
  state: state,
5213
5319
  changeSource: changeSource
5214
5320
  });
5215
5321
  case 3:
5216
- return _context45.abrupt("return", state);
5322
+ return _context47.abrupt("return", state);
5217
5323
  case 4:
5218
5324
  case "end":
5219
- return _context45.stop();
5325
+ return _context47.stop();
5220
5326
  }
5221
- }, _callee45, this);
5327
+ }, _callee47, this);
5222
5328
  }));
5223
- function publishWalletAssetsState(_x38) {
5329
+ function publishWalletAssetsState(_x39) {
5224
5330
  return _publishWalletAssetsState.apply(this, arguments);
5225
5331
  }
5226
5332
  return publishWalletAssetsState;
@@ -5228,26 +5334,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5228
5334
  }, {
5229
5335
  key: "syncSelectedWalletAssets",
5230
5336
  value: function () {
5231
- var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(state) {
5337
+ var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(state) {
5232
5338
  var paymentMethods, methodByCode, preparePayments, selectedAssetById, voucherPayments, payments;
5233
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5234
- while (1) switch (_context46.prev = _context46.next) {
5339
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5340
+ while (1) switch (_context48.prev = _context48.next) {
5235
5341
  case 0:
5236
5342
  if (!(!this.store.order || !this.store.payment)) {
5237
- _context46.next = 2;
5343
+ _context48.next = 2;
5238
5344
  break;
5239
5345
  }
5240
5346
  throw new Error('订单或支付模块未初始化');
5241
5347
  case 2:
5242
5348
  paymentMethods = this.getPaymentMethods();
5243
5349
  if (!(!paymentMethods.length && state.selectedItems.length)) {
5244
- _context46.next = 7;
5350
+ _context48.next = 7;
5245
5351
  break;
5246
5352
  }
5247
- _context46.next = 6;
5353
+ _context48.next = 6;
5248
5354
  return this.getPaymentMethodsAsync();
5249
5355
  case 6:
5250
- paymentMethods = _context46.sent;
5356
+ paymentMethods = _context48.sent;
5251
5357
  case 7:
5252
5358
  methodByCode = new Map(paymentMethods.map(function (method) {
5253
5359
  return [String(method.code || '').toUpperCase(), method];
@@ -5289,19 +5395,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5289
5395
  payments = this.updateVoucherOrderPayments(voucherPayments, {
5290
5396
  status: 'payment_pending'
5291
5397
  });
5292
- _context46.next = 14;
5398
+ _context48.next = 14;
5293
5399
  return this.store.order.recalculateSummary({
5294
5400
  createIfMissing: true
5295
5401
  });
5296
5402
  case 14:
5297
- return _context46.abrupt("return", payments);
5403
+ return _context48.abrupt("return", payments);
5298
5404
  case 15:
5299
5405
  case "end":
5300
- return _context46.stop();
5406
+ return _context48.stop();
5301
5407
  }
5302
- }, _callee46, this);
5408
+ }, _callee48, this);
5303
5409
  }));
5304
- function syncSelectedWalletAssets(_x39) {
5410
+ function syncSelectedWalletAssets(_x40) {
5305
5411
  return _syncSelectedWalletAssets.apply(this, arguments);
5306
5412
  }
5307
5413
  return syncSelectedWalletAssets;
@@ -5335,31 +5441,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5335
5441
  }, {
5336
5442
  key: "importWalletAssetsSnapshot",
5337
5443
  value: (function () {
5338
- var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(snapshot) {
5444
+ var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(snapshot) {
5339
5445
  var _this$store$order19, _this$store$order19$m;
5340
5446
  var state;
5341
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5342
- while (1) switch (_context47.prev = _context47.next) {
5447
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5448
+ while (1) switch (_context49.prev = _context49.next) {
5343
5449
  case 0:
5344
5450
  if (this.store.payment) {
5345
- _context47.next = 2;
5451
+ _context49.next = 2;
5346
5452
  break;
5347
5453
  }
5348
5454
  throw new Error('payment 模块未初始化');
5349
5455
  case 2:
5350
5456
  state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
5351
5457
  (_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;
5458
+ _context49.next = 6;
5353
5459
  return this.syncSelectedWalletAssets(state);
5354
5460
  case 6:
5355
- return _context47.abrupt("return", this.publishWalletAssetsState(state));
5461
+ return _context49.abrupt("return", this.publishWalletAssetsState(state));
5356
5462
  case 7:
5357
5463
  case "end":
5358
- return _context47.stop();
5464
+ return _context49.stop();
5359
5465
  }
5360
- }, _callee47, this);
5466
+ }, _callee49, this);
5361
5467
  }));
5362
- function importWalletAssetsSnapshot(_x40) {
5468
+ function importWalletAssetsSnapshot(_x41) {
5363
5469
  return _importWalletAssetsSnapshot.apply(this, arguments);
5364
5470
  }
5365
5471
  return importWalletAssetsSnapshot;
@@ -5371,20 +5477,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5371
5477
  }, {
5372
5478
  key: "refreshWalletAssets",
5373
5479
  value: (function () {
5374
- var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
5480
+ var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
5375
5481
  var _this$store$order$get6, _previousState$custom, _businessData$custome;
5376
5482
  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) {
5483
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5484
+ while (1) switch (_context50.prev = _context50.next) {
5379
5485
  case 0:
5380
5486
  if (this.store.order) {
5381
- _context48.next = 2;
5487
+ _context50.next = 2;
5382
5488
  break;
5383
5489
  }
5384
5490
  throw new Error('order 模块未初始化');
5385
5491
  case 2:
5386
5492
  if (this.store.payment) {
5387
- _context48.next = 4;
5493
+ _context50.next = 4;
5388
5494
  break;
5389
5495
  }
5390
5496
  throw new Error('payment 模块未初始化');
@@ -5393,7 +5499,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5393
5499
  wallet = this.store.payment.wallet;
5394
5500
  businessData = this.buildWalletInitBusinessData(params);
5395
5501
  if (businessData) {
5396
- _context48.next = 12;
5502
+ _context50.next = 12;
5397
5503
  break;
5398
5504
  }
5399
5505
  wallet.clearAllCache();
@@ -5401,7 +5507,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5401
5507
  this.updateVoucherOrderPayments([], {
5402
5508
  status: 'payment_pending'
5403
5509
  });
5404
- return _context48.abrupt("return", this.publishWalletAssetsState(emptyState));
5510
+ return _context50.abrupt("return", this.publishWalletAssetsState(emptyState));
5405
5511
  case 12:
5406
5512
  pointCardSnapshotMergeContext = {
5407
5513
  customerId: businessData.customer_id,
@@ -5411,49 +5517,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5411
5517
  hasPreviousWalletContext = previousState.status !== 'idle' || previousState.items.length > 0 || previousState.selectedIds.length > 0 || previousState.customerId !== undefined;
5412
5518
  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
5519
  if (!customerChanged) {
5414
- _context48.next = 21;
5520
+ _context50.next = 21;
5415
5521
  break;
5416
5522
  }
5417
5523
  clearedState = wallet.clearWalletAssetSelection();
5418
5524
  this.updateVoucherOrderPayments([], {
5419
5525
  status: 'payment_pending'
5420
5526
  });
5421
- _context48.next = 21;
5527
+ _context50.next = 21;
5422
5528
  return this.publishWalletAssetsState(clearedState);
5423
5529
  case 21:
5424
5530
  refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
5425
5531
  preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged,
5426
5532
  retainSearchResultCodes: params === null || params === void 0 ? void 0 : params.retainSearchResultCodes
5427
5533
  });
5428
- _context48.next = 24;
5534
+ _context50.next = 24;
5429
5535
  return this.publishWalletAssetsState(wallet.getWalletAssetsState());
5430
5536
  case 24:
5431
- _context48.next = 26;
5537
+ _context50.next = 26;
5432
5538
  return refreshTask;
5433
5539
  case 26:
5434
- state = _context48.sent;
5540
+ state = _context50.sent;
5435
5541
  if (!(refreshSequence !== this.walletAssetsRefreshSequence)) {
5436
- _context48.next = 29;
5542
+ _context50.next = 29;
5437
5543
  break;
5438
5544
  }
5439
- return _context48.abrupt("return", wallet.getWalletAssetsState());
5545
+ return _context50.abrupt("return", wallet.getWalletAssetsState());
5440
5546
  case 29:
5441
5547
  if (state.status !== 'error') {
5442
5548
  committed = this.getCommittedWalletAssets();
5443
5549
  state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5444
5550
  (_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
5551
  }
5446
- _context48.next = 32;
5552
+ _context50.next = 32;
5447
5553
  return this.syncSelectedWalletAssets(state);
5448
5554
  case 32:
5449
- return _context48.abrupt("return", this.publishWalletAssetsState(state));
5555
+ return _context50.abrupt("return", this.publishWalletAssetsState(state));
5450
5556
  case 33:
5451
5557
  case "end":
5452
- return _context48.stop();
5558
+ return _context50.stop();
5453
5559
  }
5454
- }, _callee48, this);
5560
+ }, _callee50, this);
5455
5561
  }));
5456
- function refreshWalletAssets(_x41) {
5562
+ function refreshWalletAssets(_x42) {
5457
5563
  return _refreshWalletAssets.apply(this, arguments);
5458
5564
  }
5459
5565
  return refreshWalletAssets;
@@ -5461,13 +5567,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5461
5567
  }, {
5462
5568
  key: "selectWalletAsset",
5463
5569
  value: (function () {
5464
- var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
5570
+ var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
5465
5571
  var state;
5466
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5467
- while (1) switch (_context49.prev = _context49.next) {
5572
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5573
+ while (1) switch (_context51.prev = _context51.next) {
5468
5574
  case 0:
5469
5575
  if (this.store.payment) {
5470
- _context49.next = 2;
5576
+ _context51.next = 2;
5471
5577
  break;
5472
5578
  }
5473
5579
  throw new Error('payment 模块未初始化');
@@ -5476,17 +5582,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5476
5582
  selected: params.selected,
5477
5583
  source: params.source
5478
5584
  });
5479
- _context49.next = 5;
5585
+ _context51.next = 5;
5480
5586
  return this.syncSelectedWalletAssets(state);
5481
5587
  case 5:
5482
- return _context49.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5588
+ return _context51.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5483
5589
  case 6:
5484
5590
  case "end":
5485
- return _context49.stop();
5591
+ return _context51.stop();
5486
5592
  }
5487
- }, _callee49, this);
5593
+ }, _callee51, this);
5488
5594
  }));
5489
- function selectWalletAsset(_x42) {
5595
+ function selectWalletAsset(_x43) {
5490
5596
  return _selectWalletAsset.apply(this, arguments);
5491
5597
  }
5492
5598
  return selectWalletAsset;
@@ -5494,29 +5600,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5494
5600
  }, {
5495
5601
  key: "updateWalletAssetAmount",
5496
5602
  value: (function () {
5497
- var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
5603
+ var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
5498
5604
  var state;
5499
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5500
- while (1) switch (_context50.prev = _context50.next) {
5605
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5606
+ while (1) switch (_context52.prev = _context52.next) {
5501
5607
  case 0:
5502
5608
  if (this.store.payment) {
5503
- _context50.next = 2;
5609
+ _context52.next = 2;
5504
5610
  break;
5505
5611
  }
5506
5612
  throw new Error('payment 模块未初始化');
5507
5613
  case 2:
5508
5614
  state = this.store.payment.wallet.updateWalletAssetAmount(params.assetId, params.amount);
5509
- _context50.next = 5;
5615
+ _context52.next = 5;
5510
5616
  return this.syncSelectedWalletAssets(state);
5511
5617
  case 5:
5512
- return _context50.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5618
+ return _context52.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5513
5619
  case 6:
5514
5620
  case "end":
5515
- return _context50.stop();
5621
+ return _context52.stop();
5516
5622
  }
5517
- }, _callee50, this);
5623
+ }, _callee52, this);
5518
5624
  }));
5519
- function updateWalletAssetAmount(_x43) {
5625
+ function updateWalletAssetAmount(_x44) {
5520
5626
  return _updateWalletAssetAmount.apply(this, arguments);
5521
5627
  }
5522
5628
  return updateWalletAssetAmount;
@@ -5524,13 +5630,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5524
5630
  }, {
5525
5631
  key: "scanWalletAsset",
5526
5632
  value: (function () {
5527
- var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(code) {
5633
+ var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(code) {
5528
5634
  var wallet, businessData, result;
5529
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5530
- while (1) switch (_context51.prev = _context51.next) {
5635
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5636
+ while (1) switch (_context53.prev = _context53.next) {
5531
5637
  case 0:
5532
5638
  if (this.store.payment) {
5533
- _context51.next = 2;
5639
+ _context53.next = 2;
5534
5640
  break;
5535
5641
  }
5536
5642
  throw new Error('payment 模块未初始化');
@@ -5540,28 +5646,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5540
5646
  if (businessData) {
5541
5647
  wallet.generateWalletParams(businessData);
5542
5648
  }
5543
- _context51.next = 7;
5649
+ _context53.next = 7;
5544
5650
  return wallet.scanWalletAssetAsync(code);
5545
5651
  case 7:
5546
- result = _context51.sent;
5652
+ result = _context53.sent;
5547
5653
  if (!(result.type === 'normalCode')) {
5548
- _context51.next = 13;
5654
+ _context53.next = 13;
5549
5655
  break;
5550
5656
  }
5551
- _context51.next = 11;
5657
+ _context53.next = 11;
5552
5658
  return this.syncSelectedWalletAssets(result.state);
5553
5659
  case 11:
5554
- _context51.next = 13;
5660
+ _context53.next = 13;
5555
5661
  return this.publishWalletAssetsState(result.state, 'local');
5556
5662
  case 13:
5557
- return _context51.abrupt("return", result);
5663
+ return _context53.abrupt("return", result);
5558
5664
  case 14:
5559
5665
  case "end":
5560
- return _context51.stop();
5666
+ return _context53.stop();
5561
5667
  }
5562
- }, _callee51, this);
5668
+ }, _callee53, this);
5563
5669
  }));
5564
- function scanWalletAsset(_x44) {
5670
+ function scanWalletAsset(_x45) {
5565
5671
  return _scanWalletAsset.apply(this, arguments);
5566
5672
  }
5567
5673
  return scanWalletAsset;
@@ -5569,27 +5675,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5569
5675
  }, {
5570
5676
  key: "clearWalletAssetSelection",
5571
5677
  value: (function () {
5572
- var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52() {
5678
+ var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54() {
5573
5679
  var state;
5574
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5575
- while (1) switch (_context52.prev = _context52.next) {
5680
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5681
+ while (1) switch (_context54.prev = _context54.next) {
5576
5682
  case 0:
5577
5683
  if (this.store.payment) {
5578
- _context52.next = 2;
5684
+ _context54.next = 2;
5579
5685
  break;
5580
5686
  }
5581
5687
  throw new Error('payment 模块未初始化');
5582
5688
  case 2:
5583
5689
  state = this.store.payment.wallet.clearWalletAssetSelection();
5584
- _context52.next = 5;
5690
+ _context54.next = 5;
5585
5691
  return this.syncSelectedWalletAssets(state);
5586
5692
  case 5:
5587
- return _context52.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5693
+ return _context54.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5588
5694
  case 6:
5589
5695
  case "end":
5590
- return _context52.stop();
5696
+ return _context54.stop();
5591
5697
  }
5592
- }, _callee52, this);
5698
+ }, _callee54, this);
5593
5699
  }));
5594
5700
  function clearWalletAssetSelection() {
5595
5701
  return _clearWalletAssetSelection.apply(this, arguments);
@@ -5626,35 +5732,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5626
5732
  }, {
5627
5733
  key: "getPaymentMethodsAsync",
5628
5734
  value: (function () {
5629
- var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53() {
5735
+ var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55() {
5630
5736
  var response, paymentMethods;
5631
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5632
- while (1) switch (_context53.prev = _context53.next) {
5737
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5738
+ while (1) switch (_context55.prev = _context55.next) {
5633
5739
  case 0:
5634
- _context53.prev = 0;
5635
- _context53.next = 3;
5740
+ _context55.prev = 0;
5741
+ _context55.next = 3;
5636
5742
  return this.request.get('/pay/custom-payment/all', {
5637
5743
  filterPaymentMethods: true
5638
5744
  }, {
5639
5745
  osServer: true
5640
5746
  });
5641
5747
  case 3:
5642
- response = _context53.sent;
5748
+ response = _context55.sent;
5643
5749
  paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
5644
5750
  this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
5645
- return _context53.abrupt("return", this.getPaymentMethods());
5751
+ return _context55.abrupt("return", this.getPaymentMethods());
5646
5752
  case 9:
5647
- _context53.prev = 9;
5648
- _context53.t0 = _context53["catch"](0);
5753
+ _context55.prev = 9;
5754
+ _context55.t0 = _context55["catch"](0);
5649
5755
  this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
5650
- error: _context53.t0 instanceof Error ? _context53.t0.message : String(_context53.t0)
5756
+ error: _context55.t0 instanceof Error ? _context55.t0.message : String(_context55.t0)
5651
5757
  });
5652
- return _context53.abrupt("return", this.getPaymentMethods());
5758
+ return _context55.abrupt("return", this.getPaymentMethods());
5653
5759
  case 13:
5654
5760
  case "end":
5655
- return _context53.stop();
5761
+ return _context55.stop();
5656
5762
  }
5657
- }, _callee53, this, [[0, 9]]);
5763
+ }, _callee55, this, [[0, 9]]);
5658
5764
  }));
5659
5765
  function getPaymentMethodsAsync() {
5660
5766
  return _getPaymentMethodsAsync.apply(this, arguments);
@@ -5703,8 +5809,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5703
5809
  }, {
5704
5810
  key: "getCashPaymentConfig",
5705
5811
  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;
5812
+ var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56() {
5813
+ var _this$store$order24, _this$store$order24$g, _this$store$order25, _this$store$order25$g, _this$otherParams40;
5708
5814
  var options,
5709
5815
  paymentMethods,
5710
5816
  paymentMethod,
@@ -5713,13 +5819,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5713
5819
  amountDue,
5714
5820
  currency,
5715
5821
  recommendedAmounts,
5716
- _args54 = arguments;
5717
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5718
- while (1) switch (_context54.prev = _context54.next) {
5822
+ _args56 = arguments;
5823
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5824
+ while (1) switch (_context56.prev = _context56.next) {
5719
5825
  case 0:
5720
- options = _args54.length > 0 && _args54[0] !== undefined ? _args54[0] : {};
5826
+ options = _args56.length > 0 && _args56[0] !== undefined ? _args56[0] : {};
5721
5827
  if (this.store.payment) {
5722
- _context54.next = 3;
5828
+ _context56.next = 3;
5723
5829
  break;
5724
5830
  }
5725
5831
  throw new Error('payment 模块未初始化');
@@ -5727,17 +5833,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5727
5833
  paymentMethods = this.getPaymentMethods();
5728
5834
  paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
5729
5835
  if (paymentMethod) {
5730
- _context54.next = 10;
5836
+ _context56.next = 10;
5731
5837
  break;
5732
5838
  }
5733
- _context54.next = 8;
5839
+ _context56.next = 8;
5734
5840
  return this.getPaymentMethodsAsync();
5735
5841
  case 8:
5736
- paymentMethods = _context54.sent;
5842
+ paymentMethods = _context56.sent;
5737
5843
  paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
5738
5844
  case 10:
5739
5845
  if (!(!paymentMethod && options.paymentMethodId !== undefined)) {
5740
- _context54.next = 12;
5846
+ _context56.next = 12;
5741
5847
  break;
5742
5848
  }
5743
5849
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u73B0\u91D1\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(options.paymentMethodId));
@@ -5745,9 +5851,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5745
5851
  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
5852
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
5747
5853
  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';
5854
+ 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
5855
  recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
5750
- return _context54.abrupt("return", {
5856
+ return _context56.abrupt("return", {
5751
5857
  available: Boolean(paymentMethod && amountDue > 0),
5752
5858
  paymentMethod: paymentMethod,
5753
5859
  amountDue: amountDue,
@@ -5755,9 +5861,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5755
5861
  });
5756
5862
  case 18:
5757
5863
  case "end":
5758
- return _context54.stop();
5864
+ return _context56.stop();
5759
5865
  }
5760
- }, _callee54, this);
5866
+ }, _callee56, this);
5761
5867
  }));
5762
5868
  function getCashPaymentConfig() {
5763
5869
  return _getCashPaymentConfig.apply(this, arguments);
@@ -5774,14 +5880,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5774
5880
  }, {
5775
5881
  key: "confirmWalletPayment",
5776
5882
  value: (function () {
5777
- var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55() {
5883
+ var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57() {
5778
5884
  var _this$store$order$get9, _this$store$order26, _this$store$order$get11, _this$store$order$get12, _this$store$order28;
5779
5885
  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) {
5886
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5887
+ while (1) switch (_context57.prev = _context57.next) {
5782
5888
  case 0:
5783
5889
  if (this.store.order) {
5784
- _context55.next = 2;
5890
+ _context57.next = 2;
5785
5891
  break;
5786
5892
  }
5787
5893
  throw new Error('order 模块未初始化');
@@ -5790,26 +5896,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5790
5896
  pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
5791
5897
  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
5898
  if (!pendingWalletAmount.lte(0)) {
5793
- _context55.next = 14;
5899
+ _context57.next = 14;
5794
5900
  break;
5795
5901
  }
5796
5902
  this.logWarning('confirmWalletPayment: 未发现待确认 Wallet 支付,跳过 Wallet 确认并按普通订单提交', {
5797
5903
  amountGap: amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap
5798
5904
  });
5799
- _context55.next = 9;
5905
+ _context57.next = 9;
5800
5906
  return this.submitSalesOrder({
5801
5907
  smallTicketDataFlag: 1
5802
5908
  });
5803
5909
  case 9:
5804
- _submitResult = _context55.sent;
5910
+ _submitResult = _context57.sent;
5805
5911
  if (!isRejectedSalesSubmitResult(_submitResult)) {
5806
- _context55.next = 12;
5912
+ _context57.next = 12;
5807
5913
  break;
5808
5914
  }
5809
5915
  throw new Error(getSalesSubmitErrorMessage(_submitResult, '订单提交失败'));
5810
5916
  case 12:
5811
5917
  _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", {
5918
+ return _context57.abrupt("return", {
5813
5919
  submitResult: _submitResult,
5814
5920
  payments: this.store.order.getOrderPayments(),
5815
5921
  isOrderFullyPaid: new Decimal((_latestAmountSnapshot === null || _latestAmountSnapshot === void 0 ? void 0 : _latestAmountSnapshot.amountGap) || 0).lte(0)
@@ -5817,74 +5923,74 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5817
5923
  case 14:
5818
5924
  effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
5819
5925
  if (!effectiveAmountDue.gt(0.01)) {
5820
- _context55.next = 17;
5926
+ _context57.next = 17;
5821
5927
  break;
5822
5928
  }
5823
5929
  throw new Error('Wallet 支付尚未覆盖全部待支付金额');
5824
5930
  case 17:
5825
5931
  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;
5932
+ _context57.prev = 18;
5933
+ _context57.next = 21;
5828
5934
  return this.submitSalesOrder({
5829
5935
  smallTicketDataFlag: 1,
5830
5936
  confirmPendingVoucherPayments: true
5831
5937
  });
5832
5938
  case 21:
5833
- submitResult = _context55.sent;
5939
+ submitResult = _context57.sent;
5834
5940
  if (!isRejectedSalesSubmitResult(submitResult)) {
5835
- _context55.next = 24;
5941
+ _context57.next = 24;
5836
5942
  break;
5837
5943
  }
5838
5944
  throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
5839
5945
  case 24:
5840
- _context55.next = 34;
5946
+ _context57.next = 34;
5841
5947
  break;
5842
5948
  case 26:
5843
- _context55.prev = 26;
5844
- _context55.t0 = _context55["catch"](18);
5949
+ _context57.prev = 26;
5950
+ _context57.t0 = _context57["catch"](18);
5845
5951
  this.store.order.setOrderPayments(beforePayments);
5846
5952
  restoredTempOrder = this.store.order.getTempOrder();
5847
5953
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
5848
5954
  restoredTempOrder.payment_status = beforePaymentStatus;
5849
5955
  this.store.order.persistTempOrder();
5850
5956
  }
5851
- _context55.next = 33;
5957
+ _context57.next = 33;
5852
5958
  return this.store.order.recalculateSummary({
5853
5959
  createIfMissing: true
5854
5960
  });
5855
5961
  case 33:
5856
- throw _context55.t0;
5962
+ throw _context57.t0;
5857
5963
  case 34:
5858
5964
  if (!this.store.payment) {
5859
- _context55.next = 45;
5965
+ _context57.next = 45;
5860
5966
  break;
5861
5967
  }
5862
- _context55.prev = 35;
5968
+ _context57.prev = 35;
5863
5969
  committed = this.getCommittedWalletAssets();
5864
5970
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5865
- _context55.next = 40;
5971
+ _context57.next = 40;
5866
5972
  return this.publishWalletAssetsState(walletState, 'local');
5867
5973
  case 40:
5868
- _context55.next = 45;
5974
+ _context57.next = 45;
5869
5975
  break;
5870
5976
  case 42:
5871
- _context55.prev = 42;
5872
- _context55.t1 = _context55["catch"](35);
5977
+ _context57.prev = 42;
5978
+ _context57.t1 = _context57["catch"](35);
5873
5979
  this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
5874
- error: _context55.t1 instanceof Error ? _context55.t1.message : String(_context55.t1)
5980
+ error: _context57.t1 instanceof Error ? _context57.t1.message : String(_context57.t1)
5875
5981
  });
5876
5982
  case 45:
5877
5983
  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", {
5984
+ return _context57.abrupt("return", {
5879
5985
  submitResult: submitResult,
5880
5986
  payments: this.store.order.getOrderPayments(),
5881
5987
  isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
5882
5988
  });
5883
5989
  case 47:
5884
5990
  case "end":
5885
- return _context55.stop();
5991
+ return _context57.stop();
5886
5992
  }
5887
- }, _callee55, this, [[18, 26], [35, 42]]);
5993
+ }, _callee57, this, [[18, 26], [35, 42]]);
5888
5994
  }));
5889
5995
  function confirmWalletPayment() {
5890
5996
  return _confirmWalletPayment.apply(this, arguments);
@@ -5899,53 +6005,53 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5899
6005
  }, {
5900
6006
  key: "payCash",
5901
6007
  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;
6008
+ var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
6009
+ var _this$store$order$get13, _params$actualPaidAmo, _this$otherParams41, _this$window, _this$window$postMess;
5904
6010
  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) {
6011
+ return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6012
+ while (1) switch (_context58.prev = _context58.next) {
5907
6013
  case 0:
5908
6014
  if (this.store.order) {
5909
- _context56.next = 2;
6015
+ _context58.next = 2;
5910
6016
  break;
5911
6017
  }
5912
6018
  throw new Error('order 模块未初始化');
5913
6019
  case 2:
5914
6020
  amount = Number(params.amount || 0);
5915
6021
  if (!(!Number.isFinite(amount) || amount <= 0)) {
5916
- _context56.next = 5;
6022
+ _context58.next = 5;
5917
6023
  break;
5918
6024
  }
5919
6025
  throw new Error('现金支付金额必须大于 0');
5920
6026
  case 5:
5921
6027
  if (!(params.paymentMethodId === undefined)) {
5922
- _context56.next = 11;
6028
+ _context58.next = 11;
5923
6029
  break;
5924
6030
  }
5925
- _context56.next = 8;
6031
+ _context58.next = 8;
5926
6032
  return this.getCashPaymentConfig();
5927
6033
  case 8:
5928
- _context56.t0 = _context56.sent;
5929
- _context56.next = 14;
6034
+ _context58.t0 = _context58.sent;
6035
+ _context58.next = 14;
5930
6036
  break;
5931
6037
  case 11:
5932
- _context56.next = 13;
6038
+ _context58.next = 13;
5933
6039
  return this.getCashPaymentConfig({
5934
6040
  paymentMethodId: params.paymentMethodId
5935
6041
  });
5936
6042
  case 13:
5937
- _context56.t0 = _context56.sent;
6043
+ _context58.t0 = _context58.sent;
5938
6044
  case 14:
5939
- config = _context56.t0;
6045
+ config = _context58.t0;
5940
6046
  paymentMethod = config.paymentMethod;
5941
6047
  if (paymentMethod) {
5942
- _context56.next = 18;
6048
+ _context58.next = 18;
5943
6049
  break;
5944
6050
  }
5945
6051
  throw new Error('未找到可用的 CASHMANUAL 支付方式');
5946
6052
  case 18:
5947
6053
  if (!(config.amountDue <= 0)) {
5948
- _context56.next = 20;
6054
+ _context58.next = 20;
5949
6055
  break;
5950
6056
  }
5951
6057
  throw new Error('当前订单没有待支付金额');
@@ -5953,7 +6059,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5953
6059
  roundingAmount = Number(params.roundingAmount || 0);
5954
6060
  effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
5955
6061
  if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
5956
- _context56.next = 24;
6062
+ _context58.next = 24;
5957
6063
  break;
5958
6064
  }
5959
6065
  throw new Error('现金支付金额超过当前待支付金额');
@@ -5964,18 +6070,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5964
6070
  paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
5965
6071
  actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
5966
6072
  changeAmount = Number(params.changeAmount || 0);
5967
- shopWalletPassId = (_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.shop_wallet_pass_id;
6073
+ shopWalletPassId = (_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41.shop_wallet_pass_id;
5968
6074
  if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
5969
- _context56.next = 33;
6075
+ _context58.next = 33;
5970
6076
  break;
5971
6077
  }
5972
6078
  throw new Error('顾客实收现金不能小于支付金额');
5973
6079
  case 33:
5974
6080
  if (!this.isPickupTimingEnabled()) {
5975
- _context56.next = 36;
6081
+ _context58.next = 36;
5976
6082
  break;
5977
6083
  }
5978
- _context56.next = 36;
6084
+ _context58.next = 36;
5979
6085
  return this.preparePickupTimingForCheckout({
5980
6086
  freeze: true
5981
6087
  });
@@ -6010,8 +6116,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6010
6116
  var _item$metadata2;
6011
6117
  return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
6012
6118
  });
6013
- _context56.prev = 39;
6014
- _context56.next = 42;
6119
+ _context58.prev = 39;
6120
+ _context58.next = 42;
6015
6121
  return this.syncPaymentsToOrder({
6016
6122
  payments: payments,
6017
6123
  submitWhenPaid: true,
@@ -6019,50 +6125,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6019
6125
  confirmPendingVoucherPayments: true
6020
6126
  });
6021
6127
  case 42:
6022
- syncResult = _context56.sent;
6128
+ syncResult = _context58.sent;
6023
6129
  if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
6024
- _context56.next = 45;
6130
+ _context58.next = 45;
6025
6131
  break;
6026
6132
  }
6027
6133
  throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
6028
6134
  case 45:
6029
6135
  if (!this.store.payment) {
6030
- _context56.next = 50;
6136
+ _context58.next = 50;
6031
6137
  break;
6032
6138
  }
6033
6139
  committed = this.getCommittedWalletAssets();
6034
6140
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
6035
- _context56.next = 50;
6141
+ _context58.next = 50;
6036
6142
  return this.publishWalletAssetsState(walletState, 'local');
6037
6143
  case 50:
6038
- return _context56.abrupt("return", {
6144
+ return _context58.abrupt("return", {
6039
6145
  payment: payment || {},
6040
6146
  payments: this.store.order.getOrderPayments(),
6041
6147
  syncResult: syncResult,
6042
6148
  isOrderFullyPaid: syncResult.isOrderFullyPaid
6043
6149
  });
6044
6150
  case 53:
6045
- _context56.prev = 53;
6046
- _context56.t1 = _context56["catch"](39);
6151
+ _context58.prev = 53;
6152
+ _context58.t1 = _context58["catch"](39);
6047
6153
  this.store.order.setOrderPayments(beforePayments);
6048
6154
  restoredTempOrder = this.store.order.getTempOrder();
6049
6155
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
6050
6156
  restoredTempOrder.payment_status = beforePaymentStatus;
6051
6157
  this.store.order.persistTempOrder();
6052
6158
  }
6053
- _context56.next = 60;
6159
+ _context58.next = 60;
6054
6160
  return this.store.order.recalculateSummary({
6055
6161
  createIfMissing: true
6056
6162
  });
6057
6163
  case 60:
6058
- throw _context56.t1;
6164
+ throw _context58.t1;
6059
6165
  case 61:
6060
6166
  case "end":
6061
- return _context56.stop();
6167
+ return _context58.stop();
6062
6168
  }
6063
- }, _callee56, this, [[39, 53]]);
6169
+ }, _callee58, this, [[39, 53]]);
6064
6170
  }));
6065
- function payCash(_x45) {
6171
+ function payCash(_x46) {
6066
6172
  return _payCash.apply(this, arguments);
6067
6173
  }
6068
6174
  return payCash;
@@ -6078,21 +6184,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6078
6184
  }, {
6079
6185
  key: "commitPaymentMethodPayment",
6080
6186
  value: (function () {
6081
- var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
6187
+ var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(params) {
6082
6188
  var _this$store$order$get14, _this$store$order29, _this$store$order$get15, _params$metadata, _params$originAmount;
6083
6189
  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) {
6190
+ return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6191
+ while (1) switch (_context59.prev = _context59.next) {
6086
6192
  case 0:
6087
6193
  if (this.store.order) {
6088
- _context57.next = 2;
6194
+ _context59.next = 2;
6089
6195
  break;
6090
6196
  }
6091
6197
  throw new Error('order 模块未初始化');
6092
6198
  case 2:
6093
6199
  amount = Number(params.amount || 0);
6094
6200
  if (!(!Number.isFinite(amount) || amount <= 0)) {
6095
- _context57.next = 5;
6201
+ _context59.next = 5;
6096
6202
  break;
6097
6203
  }
6098
6204
  throw new Error('支付金额必须大于 0');
@@ -6108,17 +6214,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6108
6214
  };
6109
6215
  paymentMethod = findPaymentMethod();
6110
6216
  if (paymentMethod) {
6111
- _context57.next = 13;
6217
+ _context59.next = 13;
6112
6218
  break;
6113
6219
  }
6114
- _context57.next = 11;
6220
+ _context59.next = 11;
6115
6221
  return this.getPaymentMethodsAsync();
6116
6222
  case 11:
6117
- paymentMethods = _context57.sent;
6223
+ paymentMethods = _context59.sent;
6118
6224
  paymentMethod = findPaymentMethod();
6119
6225
  case 13:
6120
6226
  if (paymentMethod) {
6121
- _context57.next = 15;
6227
+ _context59.next = 15;
6122
6228
  break;
6123
6229
  }
6124
6230
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
@@ -6127,13 +6233,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6127
6233
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
6128
6234
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
6129
6235
  if (!amountDue.lte(0)) {
6130
- _context57.next = 20;
6236
+ _context59.next = 20;
6131
6237
  break;
6132
6238
  }
6133
6239
  throw new Error('当前订单没有待支付金额');
6134
6240
  case 20:
6135
6241
  if (!new Decimal(amount).gt(amountDue.plus(0.01))) {
6136
- _context57.next = 22;
6242
+ _context59.next = 22;
6137
6243
  break;
6138
6244
  }
6139
6245
  throw new Error('支付金额超过当前待支付金额');
@@ -6172,8 +6278,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6172
6278
  var _item$metadata3;
6173
6279
  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
6280
  });
6175
- _context57.prev = 30;
6176
- _context57.next = 33;
6281
+ _context59.prev = 30;
6282
+ _context59.next = 33;
6177
6283
  return this.syncPaymentsToOrder({
6178
6284
  payments: payments,
6179
6285
  submitWhenPaid: true,
@@ -6181,50 +6287,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6181
6287
  confirmPendingVoucherPayments: true
6182
6288
  });
6183
6289
  case 33:
6184
- syncResult = _context57.sent;
6290
+ syncResult = _context59.sent;
6185
6291
  if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
6186
- _context57.next = 36;
6292
+ _context59.next = 36;
6187
6293
  break;
6188
6294
  }
6189
6295
  throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
6190
6296
  case 36:
6191
6297
  if (!this.store.payment) {
6192
- _context57.next = 41;
6298
+ _context59.next = 41;
6193
6299
  break;
6194
6300
  }
6195
6301
  committed = this.getCommittedWalletAssets();
6196
6302
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
6197
- _context57.next = 41;
6303
+ _context59.next = 41;
6198
6304
  return this.publishWalletAssetsState(walletState, 'local');
6199
6305
  case 41:
6200
- return _context57.abrupt("return", {
6306
+ return _context59.abrupt("return", {
6201
6307
  payment: payment || {},
6202
6308
  payments: this.store.order.getOrderPayments(),
6203
6309
  syncResult: syncResult,
6204
6310
  isOrderFullyPaid: syncResult.isOrderFullyPaid
6205
6311
  });
6206
6312
  case 44:
6207
- _context57.prev = 44;
6208
- _context57.t0 = _context57["catch"](30);
6313
+ _context59.prev = 44;
6314
+ _context59.t0 = _context59["catch"](30);
6209
6315
  this.store.order.setOrderPayments(beforePayments);
6210
6316
  restoredTempOrder = this.store.order.getTempOrder();
6211
6317
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
6212
6318
  restoredTempOrder.payment_status = beforePaymentStatus;
6213
6319
  this.store.order.persistTempOrder();
6214
6320
  }
6215
- _context57.next = 51;
6321
+ _context59.next = 51;
6216
6322
  return this.store.order.recalculateSummary({
6217
6323
  createIfMissing: true
6218
6324
  });
6219
6325
  case 51:
6220
- throw _context57.t0;
6326
+ throw _context59.t0;
6221
6327
  case 52:
6222
6328
  case "end":
6223
- return _context57.stop();
6329
+ return _context59.stop();
6224
6330
  }
6225
- }, _callee57, this, [[30, 44]]);
6331
+ }, _callee59, this, [[30, 44]]);
6226
6332
  }));
6227
- function commitPaymentMethodPayment(_x46) {
6333
+ function commitPaymentMethodPayment(_x47) {
6228
6334
  return _commitPaymentMethodPayment.apply(this, arguments);
6229
6335
  }
6230
6336
  return commitPaymentMethodPayment;
@@ -6239,40 +6345,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6239
6345
  }, {
6240
6346
  key: "roundAmount",
6241
6347
  value: (function () {
6242
- var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
6348
+ var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
6243
6349
  var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
6244
6350
  var amount, cashManualPayment;
6245
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6246
- while (1) switch (_context58.prev = _context58.next) {
6351
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6352
+ while (1) switch (_context60.prev = _context60.next) {
6247
6353
  case 0:
6248
6354
  amount = params.amount;
6249
6355
  cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
6250
6356
  return paymentMethod.code === 'CASHMANUAL';
6251
6357
  });
6252
6358
  if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
6253
- _context58.next = 4;
6359
+ _context60.next = 4;
6254
6360
  break;
6255
6361
  }
6256
- return _context58.abrupt("return", {
6362
+ return _context60.abrupt("return", {
6257
6363
  originalAmount: amount.toString(),
6258
6364
  roundedAmount: amount.toString(),
6259
6365
  roundingDifference: '0.00'
6260
6366
  });
6261
6367
  case 4:
6262
6368
  if (this.payment) {
6263
- _context58.next = 6;
6369
+ _context60.next = 6;
6264
6370
  break;
6265
6371
  }
6266
6372
  throw new Error('payment 模块未初始化');
6267
6373
  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));
6374
+ 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
6375
  case 7:
6270
6376
  case "end":
6271
- return _context58.stop();
6377
+ return _context60.stop();
6272
6378
  }
6273
- }, _callee58, this);
6379
+ }, _callee60, this);
6274
6380
  }));
6275
- function roundAmount(_x47) {
6381
+ function roundAmount(_x48) {
6276
6382
  return _roundAmount.apply(this, arguments);
6277
6383
  }
6278
6384
  return roundAmount;
@@ -6287,49 +6393,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6287
6393
  }, {
6288
6394
  key: "sendCustomerPayLink",
6289
6395
  value: (function () {
6290
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(params) {
6396
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(params) {
6291
6397
  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) {
6398
+ return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6399
+ while (1) switch (_context61.prev = _context61.next) {
6294
6400
  case 0:
6295
6401
  if (this.store.order) {
6296
- _context59.next = 2;
6402
+ _context61.next = 2;
6297
6403
  break;
6298
6404
  }
6299
6405
  throw new Error('order 模块未初始化');
6300
6406
  case 2:
6301
6407
  orderIds = params.order_ids || params.orderIds || [];
6302
6408
  if (!(!orderIds.length || params.submitBeforeSend)) {
6303
- _context59.next = 11;
6409
+ _context61.next = 11;
6304
6410
  break;
6305
6411
  }
6306
- _context59.next = 6;
6412
+ _context61.next = 6;
6307
6413
  return this.submitSalesOrder({
6308
6414
  smallTicketDataFlag: 1
6309
6415
  });
6310
6416
  case 6:
6311
- submitResult = _context59.sent;
6417
+ submitResult = _context61.sent;
6312
6418
  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
6419
  if (orderId) {
6314
- _context59.next = 10;
6420
+ _context61.next = 10;
6315
6421
  break;
6316
6422
  }
6317
6423
  throw new Error('本地订单提交云端失败,无法发送支付链接');
6318
6424
  case 10:
6319
6425
  orderIds = [orderId];
6320
6426
  case 11:
6321
- return _context59.abrupt("return", this.store.order.sendCustomerPayLink({
6427
+ return _context61.abrupt("return", this.store.order.sendCustomerPayLink({
6322
6428
  emails: params.emails,
6323
6429
  notify_action: params.notify_action,
6324
6430
  order_ids: orderIds
6325
6431
  }));
6326
6432
  case 12:
6327
6433
  case "end":
6328
- return _context59.stop();
6434
+ return _context61.stop();
6329
6435
  }
6330
- }, _callee59, this);
6436
+ }, _callee61, this);
6331
6437
  }));
6332
- function sendCustomerPayLink(_x48) {
6438
+ function sendCustomerPayLink(_x49) {
6333
6439
  return _sendCustomerPayLink.apply(this, arguments);
6334
6440
  }
6335
6441
  return sendCustomerPayLink;
@@ -6342,20 +6448,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6342
6448
  }, {
6343
6449
  key: "calculateProductBookingPrice",
6344
6450
  value: function () {
6345
- var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
6451
+ var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(params) {
6346
6452
  var _params$customer_id;
6347
6453
  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) {
6454
+ return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6455
+ while (1) switch (_context62.prev = _context62.next) {
6350
6456
  case 0:
6351
6457
  useCustomerUserPricing = this.isCustomerUserPriceQuery();
6352
6458
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
6353
6459
  customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
6354
- _context60.next = 5;
6460
+ _context62.next = 5;
6355
6461
  return this.prepareProductPriceQueryContext(customerId);
6356
6462
  case 5:
6357
6463
  channel = this.getPriceQueryChannel(params.channel);
6358
- _context60.next = 8;
6464
+ _context62.next = 8;
6359
6465
  return this.resolveProductsForPriceQuery({
6360
6466
  priceQueries: [params],
6361
6467
  schedule: this.getPriceQuerySchedule(params),
@@ -6363,22 +6469,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6363
6469
  channel: channel
6364
6470
  });
6365
6471
  case 8:
6366
- _yield$this$resolvePr = _context60.sent;
6472
+ _yield$this$resolvePr = _context62.sent;
6367
6473
  _yield$this$resolvePr2 = _slicedToArray(_yield$this$resolvePr, 1);
6368
6474
  authoritativeProduct = _yield$this$resolvePr2[0];
6369
6475
  product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
6370
6476
  if (useCustomerUserPricing) {
6371
- _context60.next = 15;
6477
+ _context62.next = 15;
6372
6478
  break;
6373
6479
  }
6374
- _context60.next = 15;
6480
+ _context62.next = 15;
6375
6481
  return this.loadQuotationForPriceQuery({
6376
6482
  quotation: quotation,
6377
6483
  customer_id: customerId,
6378
6484
  channel: channel
6379
6485
  });
6380
6486
  case 15:
6381
- return _context60.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
6487
+ return _context62.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
6382
6488
  channel: channel,
6383
6489
  product: product,
6384
6490
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
@@ -6387,11 +6493,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6387
6493
  })));
6388
6494
  case 16:
6389
6495
  case "end":
6390
- return _context60.stop();
6496
+ return _context62.stop();
6391
6497
  }
6392
- }, _callee60, this);
6498
+ }, _callee62, this);
6393
6499
  }));
6394
- function calculateProductBookingPrice(_x49) {
6500
+ function calculateProductBookingPrice(_x50) {
6395
6501
  return _calculateProductBookingPrice.apply(this, arguments);
6396
6502
  }
6397
6503
  return calculateProductBookingPrice;
@@ -6399,7 +6505,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6399
6505
  }, {
6400
6506
  key: "getQuotationCustomerScopeInfo",
6401
6507
  value: function getQuotationCustomerScopeInfo() {
6402
- var _this20 = this;
6508
+ var _this21 = this;
6403
6509
  var quotation = this.store.quotation;
6404
6510
  if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
6405
6511
  return quotation.getQuotationCustomerScopeInfo();
@@ -6411,7 +6517,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6411
6517
  }).map(function (item) {
6412
6518
  var localSeen = new Set();
6413
6519
  var customers = item.customer.filter(function (customer) {
6414
- var customerId = _this20.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
6520
+ var customerId = _this21.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
6415
6521
  if (!customerId || localSeen.has(customerId)) return false;
6416
6522
  localSeen.add(customerId);
6417
6523
  if (!customerById.has(customerId)) customerById.set(customerId, customer);
@@ -6475,23 +6581,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6475
6581
  }, {
6476
6582
  key: "calculateProductBookingPrices",
6477
6583
  value: function () {
6478
- var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(paramsList) {
6479
- var _this21 = this;
6584
+ var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(paramsList) {
6585
+ var _this22 = this;
6480
6586
  var useCustomerUserPricing, quotation, currentOrderCustomerId, resolvedChannels, authoritativeProducts, groups, quotationContexts;
6481
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6482
- while (1) switch (_context62.prev = _context62.next) {
6587
+ return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6588
+ while (1) switch (_context64.prev = _context64.next) {
6483
6589
  case 0:
6484
6590
  if (paramsList.length) {
6485
- _context62.next = 2;
6591
+ _context64.next = 2;
6486
6592
  break;
6487
6593
  }
6488
- return _context62.abrupt("return", []);
6594
+ return _context64.abrupt("return", []);
6489
6595
  case 2:
6490
6596
  useCustomerUserPricing = this.isCustomerUserPriceQuery();
6491
6597
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
6492
6598
  currentOrderCustomerId = this.getCurrentOrderCustomerId();
6493
6599
  resolvedChannels = paramsList.map(function (params) {
6494
- return _this21.getPriceQueryChannel(params.channel);
6600
+ return _this22.getPriceQueryChannel(params.channel);
6495
6601
  });
6496
6602
  authoritativeProducts = paramsList.map(function () {
6497
6603
  return null;
@@ -6499,10 +6605,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6499
6605
  groups = new Map();
6500
6606
  paramsList.forEach(function (params, index) {
6501
6607
  var _params$customer_id2;
6502
- var schedule = _this21.getPriceQuerySchedule(params);
6608
+ var schedule = _this22.getPriceQuerySchedule(params);
6503
6609
  var channel = resolvedChannels[index];
6504
6610
  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('|');
6611
+ var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || '', _this22.normalizePriceContextCustomerId(customerId) || ''].join('|');
6506
6612
  var group = groups.get(groupKey) || {
6507
6613
  indices: [],
6508
6614
  schedule: schedule,
@@ -6512,44 +6618,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6512
6618
  group.indices.push(index);
6513
6619
  groups.set(groupKey, group);
6514
6620
  });
6515
- _context62.next = 11;
6621
+ _context64.next = 11;
6516
6622
  return Promise.all(Array.from(groups.values()).map( /*#__PURE__*/function () {
6517
- var _ref55 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(group) {
6623
+ var _ref55 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(group) {
6518
6624
  var priceQueries, resolvedProducts;
6519
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6520
- while (1) switch (_context61.prev = _context61.next) {
6625
+ return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6626
+ while (1) switch (_context63.prev = _context63.next) {
6521
6627
  case 0:
6522
- _context61.next = 2;
6523
- return _this21.prepareProductPriceQueryContext(group.customerId);
6628
+ _context63.next = 2;
6629
+ return _this22.prepareProductPriceQueryContext(group.customerId);
6524
6630
  case 2:
6525
6631
  priceQueries = group.indices.map(function (index) {
6526
6632
  return paramsList[index];
6527
6633
  });
6528
- _context61.next = 5;
6529
- return _this21.resolveProductsForPriceQuery({
6634
+ _context63.next = 5;
6635
+ return _this22.resolveProductsForPriceQuery({
6530
6636
  priceQueries: priceQueries,
6531
6637
  schedule: group.schedule,
6532
6638
  customerId: group.customerId,
6533
6639
  channel: group.channel
6534
6640
  });
6535
6641
  case 5:
6536
- resolvedProducts = _context61.sent;
6642
+ resolvedProducts = _context63.sent;
6537
6643
  group.indices.forEach(function (originalIndex, groupIndex) {
6538
6644
  authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
6539
6645
  });
6540
6646
  case 7:
6541
6647
  case "end":
6542
- return _context61.stop();
6648
+ return _context63.stop();
6543
6649
  }
6544
- }, _callee61);
6650
+ }, _callee63);
6545
6651
  }));
6546
- return function (_x51) {
6652
+ return function (_x52) {
6547
6653
  return _ref55.apply(this, arguments);
6548
6654
  };
6549
6655
  }()));
6550
6656
  case 11:
6551
6657
  if (useCustomerUserPricing) {
6552
- _context62.next = 16;
6658
+ _context64.next = 16;
6553
6659
  break;
6554
6660
  }
6555
6661
  quotationContexts = new Map();
@@ -6563,18 +6669,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6563
6669
  customer_id: (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId
6564
6670
  });
6565
6671
  });
6566
- _context62.next = 16;
6672
+ _context64.next = 16;
6567
6673
  return Promise.all(Array.from(quotationContexts.values()).map(function (context) {
6568
- return _this21.loadQuotationForPriceQuery(_objectSpread({
6674
+ return _this22.loadQuotationForPriceQuery(_objectSpread({
6569
6675
  quotation: quotation
6570
6676
  }, context));
6571
6677
  }));
6572
6678
  case 16:
6573
- return _context62.abrupt("return", paramsList.map(function (params, index) {
6679
+ return _context64.abrupt("return", paramsList.map(function (params, index) {
6574
6680
  var _params$customer_id4;
6575
6681
  var productInput = params.product || {};
6576
6682
  var authoritativeProduct = authoritativeProducts[index];
6577
- var product = _this21.mergeProductForPriceQuery(productInput, authoritativeProduct);
6683
+ var product = _this22.mergeProductForPriceQuery(productInput, authoritativeProduct);
6578
6684
  var customerId = (_params$customer_id4 = params.customer_id) !== null && _params$customer_id4 !== void 0 ? _params$customer_id4 : currentOrderCustomerId;
6579
6685
  var channel = resolvedChannels[index];
6580
6686
  return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
@@ -6582,16 +6688,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6582
6688
  product: product,
6583
6689
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
6584
6690
  customer_id: customerId,
6585
- quotation: authoritativeProduct && _this21.preferAuthoritativeProductQueryPrice() ? undefined : quotation
6691
+ quotation: authoritativeProduct && _this22.preferAuthoritativeProductQueryPrice() ? undefined : quotation
6586
6692
  }));
6587
6693
  }));
6588
6694
  case 17:
6589
6695
  case "end":
6590
- return _context62.stop();
6696
+ return _context64.stop();
6591
6697
  }
6592
- }, _callee62, this);
6698
+ }, _callee64, this);
6593
6699
  }));
6594
- function calculateProductBookingPrices(_x50) {
6700
+ function calculateProductBookingPrices(_x51) {
6595
6701
  return _calculateProductBookingPrices.apply(this, arguments);
6596
6702
  }
6597
6703
  return calculateProductBookingPrices;
@@ -6599,47 +6705,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6599
6705
  }, {
6600
6706
  key: "addProductToOrder",
6601
6707
  value: function () {
6602
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(product, booking, options) {
6708
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(product, booking, options) {
6603
6709
  var products;
6604
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6605
- while (1) switch (_context63.prev = _context63.next) {
6710
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6711
+ while (1) switch (_context65.prev = _context65.next) {
6606
6712
  case 0:
6607
- _context63.prev = 0;
6713
+ _context65.prev = 0;
6608
6714
  if (this.store.order) {
6609
- _context63.next = 3;
6715
+ _context65.next = 3;
6610
6716
  break;
6611
6717
  }
6612
6718
  throw new Error('order 模块未初始化');
6613
6719
  case 3:
6614
6720
  if (!(options === undefined)) {
6615
- _context63.next = 9;
6721
+ _context65.next = 9;
6616
6722
  break;
6617
6723
  }
6618
- _context63.next = 6;
6724
+ _context65.next = 6;
6619
6725
  return this.store.order.addProductToOrder(product, booking);
6620
6726
  case 6:
6621
- _context63.t0 = _context63.sent;
6622
- _context63.next = 12;
6727
+ _context65.t0 = _context65.sent;
6728
+ _context65.next = 12;
6623
6729
  break;
6624
6730
  case 9:
6625
- _context63.next = 11;
6731
+ _context65.next = 11;
6626
6732
  return this.store.order.addProductToOrder(product, booking, options);
6627
6733
  case 11:
6628
- _context63.t0 = _context63.sent;
6734
+ _context65.t0 = _context65.sent;
6629
6735
  case 12:
6630
- products = _context63.t0;
6631
- return _context63.abrupt("return", products);
6736
+ products = _context65.t0;
6737
+ return _context65.abrupt("return", products);
6632
6738
  case 16:
6633
- _context63.prev = 16;
6634
- _context63.t1 = _context63["catch"](0);
6635
- throw _context63.t1;
6739
+ _context65.prev = 16;
6740
+ _context65.t1 = _context65["catch"](0);
6741
+ throw _context65.t1;
6636
6742
  case 19:
6637
6743
  case "end":
6638
- return _context63.stop();
6744
+ return _context65.stop();
6639
6745
  }
6640
- }, _callee63, this, [[0, 16]]);
6746
+ }, _callee65, this, [[0, 16]]);
6641
6747
  }));
6642
- function addProductToOrder(_x52, _x53, _x54) {
6748
+ function addProductToOrder(_x53, _x54, _x55) {
6643
6749
  return _addProductToOrder.apply(this, arguments);
6644
6750
  }
6645
6751
  return addProductToOrder;
@@ -6647,34 +6753,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6647
6753
  }, {
6648
6754
  key: "updateOrderProduct",
6649
6755
  value: function () {
6650
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(params) {
6756
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(params) {
6651
6757
  var products;
6652
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6653
- while (1) switch (_context64.prev = _context64.next) {
6758
+ return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6759
+ while (1) switch (_context66.prev = _context66.next) {
6654
6760
  case 0:
6655
- _context64.prev = 0;
6761
+ _context66.prev = 0;
6656
6762
  if (this.store.order) {
6657
- _context64.next = 3;
6763
+ _context66.next = 3;
6658
6764
  break;
6659
6765
  }
6660
6766
  throw new Error('order 模块未初始化');
6661
6767
  case 3:
6662
- _context64.next = 5;
6768
+ _context66.next = 5;
6663
6769
  return this.store.order.updateOrderProduct(params);
6664
6770
  case 5:
6665
- products = _context64.sent;
6666
- return _context64.abrupt("return", products);
6771
+ products = _context66.sent;
6772
+ return _context66.abrupt("return", products);
6667
6773
  case 9:
6668
- _context64.prev = 9;
6669
- _context64.t0 = _context64["catch"](0);
6670
- throw _context64.t0;
6774
+ _context66.prev = 9;
6775
+ _context66.t0 = _context66["catch"](0);
6776
+ throw _context66.t0;
6671
6777
  case 12:
6672
6778
  case "end":
6673
- return _context64.stop();
6779
+ return _context66.stop();
6674
6780
  }
6675
- }, _callee64, this, [[0, 9]]);
6781
+ }, _callee66, this, [[0, 9]]);
6676
6782
  }));
6677
- function updateOrderProduct(_x55) {
6783
+ function updateOrderProduct(_x56) {
6678
6784
  return _updateOrderProduct.apply(this, arguments);
6679
6785
  }
6680
6786
  return updateOrderProduct;
@@ -6682,34 +6788,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6682
6788
  }, {
6683
6789
  key: "updateOrderProducts",
6684
6790
  value: function () {
6685
- var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(paramsList) {
6791
+ var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(paramsList) {
6686
6792
  var products;
6687
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6688
- while (1) switch (_context65.prev = _context65.next) {
6793
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6794
+ while (1) switch (_context67.prev = _context67.next) {
6689
6795
  case 0:
6690
- _context65.prev = 0;
6796
+ _context67.prev = 0;
6691
6797
  if (this.store.order) {
6692
- _context65.next = 3;
6798
+ _context67.next = 3;
6693
6799
  break;
6694
6800
  }
6695
6801
  throw new Error('order 模块未初始化');
6696
6802
  case 3:
6697
- _context65.next = 5;
6803
+ _context67.next = 5;
6698
6804
  return this.store.order.updateOrderProducts(paramsList);
6699
6805
  case 5:
6700
- products = _context65.sent;
6701
- return _context65.abrupt("return", products);
6806
+ products = _context67.sent;
6807
+ return _context67.abrupt("return", products);
6702
6808
  case 9:
6703
- _context65.prev = 9;
6704
- _context65.t0 = _context65["catch"](0);
6705
- throw _context65.t0;
6809
+ _context67.prev = 9;
6810
+ _context67.t0 = _context67["catch"](0);
6811
+ throw _context67.t0;
6706
6812
  case 12:
6707
6813
  case "end":
6708
- return _context65.stop();
6814
+ return _context67.stop();
6709
6815
  }
6710
- }, _callee65, this, [[0, 9]]);
6816
+ }, _callee67, this, [[0, 9]]);
6711
6817
  }));
6712
- function updateOrderProducts(_x56) {
6818
+ function updateOrderProducts(_x57) {
6713
6819
  return _updateOrderProducts.apply(this, arguments);
6714
6820
  }
6715
6821
  return updateOrderProducts;
@@ -6717,34 +6823,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6717
6823
  }, {
6718
6824
  key: "updateOrderProductQuantity",
6719
6825
  value: function () {
6720
- var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(params) {
6826
+ var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(params) {
6721
6827
  var products;
6722
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6723
- while (1) switch (_context66.prev = _context66.next) {
6828
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6829
+ while (1) switch (_context68.prev = _context68.next) {
6724
6830
  case 0:
6725
- _context66.prev = 0;
6831
+ _context68.prev = 0;
6726
6832
  if (this.store.order) {
6727
- _context66.next = 3;
6833
+ _context68.next = 3;
6728
6834
  break;
6729
6835
  }
6730
6836
  throw new Error('order 模块未初始化');
6731
6837
  case 3:
6732
- _context66.next = 5;
6838
+ _context68.next = 5;
6733
6839
  return this.store.order.updateOrderProductQuantity(params);
6734
6840
  case 5:
6735
- products = _context66.sent;
6736
- return _context66.abrupt("return", products);
6841
+ products = _context68.sent;
6842
+ return _context68.abrupt("return", products);
6737
6843
  case 9:
6738
- _context66.prev = 9;
6739
- _context66.t0 = _context66["catch"](0);
6740
- throw _context66.t0;
6844
+ _context68.prev = 9;
6845
+ _context68.t0 = _context68["catch"](0);
6846
+ throw _context68.t0;
6741
6847
  case 12:
6742
6848
  case "end":
6743
- return _context66.stop();
6849
+ return _context68.stop();
6744
6850
  }
6745
- }, _callee66, this, [[0, 9]]);
6851
+ }, _callee68, this, [[0, 9]]);
6746
6852
  }));
6747
- function updateOrderProductQuantity(_x57) {
6853
+ function updateOrderProductQuantity(_x58) {
6748
6854
  return _updateOrderProductQuantity.apply(this, arguments);
6749
6855
  }
6750
6856
  return updateOrderProductQuantity;
@@ -6767,12 +6873,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6767
6873
  }, {
6768
6874
  key: "setOrderProductLineNote",
6769
6875
  value: (function () {
6770
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(identity, note) {
6876
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(identity, note) {
6771
6877
  var params, products;
6772
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6773
- while (1) switch (_context67.prev = _context67.next) {
6878
+ return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6879
+ while (1) switch (_context69.prev = _context69.next) {
6774
6880
  case 0:
6775
- _context67.prev = 0;
6881
+ _context69.prev = 0;
6776
6882
  params = {
6777
6883
  product_id: identity.product_id,
6778
6884
  product_variant_id: identity.product_variant_id,
@@ -6787,22 +6893,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6787
6893
  params.product_sku = identity.product_sku;
6788
6894
  }
6789
6895
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
6790
- _context67.next = 7;
6896
+ _context69.next = 7;
6791
6897
  return this.updateOrderProduct(params);
6792
6898
  case 7:
6793
- products = _context67.sent;
6794
- return _context67.abrupt("return", products);
6899
+ products = _context69.sent;
6900
+ return _context69.abrupt("return", products);
6795
6901
  case 11:
6796
- _context67.prev = 11;
6797
- _context67.t0 = _context67["catch"](0);
6798
- throw _context67.t0;
6902
+ _context69.prev = 11;
6903
+ _context69.t0 = _context69["catch"](0);
6904
+ throw _context69.t0;
6799
6905
  case 14:
6800
6906
  case "end":
6801
- return _context67.stop();
6907
+ return _context69.stop();
6802
6908
  }
6803
- }, _callee67, this, [[0, 11]]);
6909
+ }, _callee69, this, [[0, 11]]);
6804
6910
  }));
6805
- function setOrderProductLineNote(_x58, _x59) {
6911
+ function setOrderProductLineNote(_x59, _x60) {
6806
6912
  return _setOrderProductLineNote.apply(this, arguments);
6807
6913
  }
6808
6914
  return setOrderProductLineNote;
@@ -6817,45 +6923,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6817
6923
  }, {
6818
6924
  key: "removeProductsFromOrder",
6819
6925
  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) {
6926
+ var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(identities, options) {
6927
+ return _regeneratorRuntime().wrap(function _callee70$(_context70) {
6928
+ while (1) switch (_context70.prev = _context70.next) {
6823
6929
  case 0:
6824
- _context68.prev = 0;
6930
+ _context70.prev = 0;
6825
6931
  if (this.store.order) {
6826
- _context68.next = 3;
6932
+ _context70.next = 3;
6827
6933
  break;
6828
6934
  }
6829
6935
  throw new Error('order 模块未初始化');
6830
6936
  case 3:
6831
6937
  if (!(options === undefined)) {
6832
- _context68.next = 9;
6938
+ _context70.next = 9;
6833
6939
  break;
6834
6940
  }
6835
- _context68.next = 6;
6941
+ _context70.next = 6;
6836
6942
  return this.store.order.removeProductsFromOrder(identities);
6837
6943
  case 6:
6838
- _context68.t0 = _context68.sent;
6839
- _context68.next = 12;
6944
+ _context70.t0 = _context70.sent;
6945
+ _context70.next = 12;
6840
6946
  break;
6841
6947
  case 9:
6842
- _context68.next = 11;
6948
+ _context70.next = 11;
6843
6949
  return this.store.order.removeProductsFromOrder(identities, options);
6844
6950
  case 11:
6845
- _context68.t0 = _context68.sent;
6951
+ _context70.t0 = _context70.sent;
6846
6952
  case 12:
6847
- return _context68.abrupt("return", _context68.t0);
6953
+ return _context70.abrupt("return", _context70.t0);
6848
6954
  case 15:
6849
- _context68.prev = 15;
6850
- _context68.t1 = _context68["catch"](0);
6851
- throw _context68.t1;
6955
+ _context70.prev = 15;
6956
+ _context70.t1 = _context70["catch"](0);
6957
+ throw _context70.t1;
6852
6958
  case 18:
6853
6959
  case "end":
6854
- return _context68.stop();
6960
+ return _context70.stop();
6855
6961
  }
6856
- }, _callee68, this, [[0, 15]]);
6962
+ }, _callee70, this, [[0, 15]]);
6857
6963
  }));
6858
- function removeProductsFromOrder(_x60, _x61) {
6964
+ function removeProductsFromOrder(_x61, _x62) {
6859
6965
  return _removeProductsFromOrder.apply(this, arguments);
6860
6966
  }
6861
6967
  return removeProductsFromOrder;
@@ -6863,18 +6969,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6863
6969
  }, {
6864
6970
  key: "removeProductFromOrder",
6865
6971
  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) {
6972
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(identity, options) {
6973
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
6974
+ while (1) switch (_context71.prev = _context71.next) {
6869
6975
  case 0:
6870
- return _context69.abrupt("return", this.removeProductsFromOrder([identity], options));
6976
+ return _context71.abrupt("return", this.removeProductsFromOrder([identity], options));
6871
6977
  case 1:
6872
6978
  case "end":
6873
- return _context69.stop();
6979
+ return _context71.stop();
6874
6980
  }
6875
- }, _callee69, this);
6981
+ }, _callee71, this);
6876
6982
  }));
6877
- function removeProductFromOrder(_x62, _x63) {
6983
+ function removeProductFromOrder(_x63, _x64) {
6878
6984
  return _removeProductFromOrder.apply(this, arguments);
6879
6985
  }
6880
6986
  return removeProductFromOrder;
@@ -6924,23 +7030,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6924
7030
  }, {
6925
7031
  key: "applyPromotion",
6926
7032
  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) {
7033
+ var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72() {
7034
+ return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7035
+ while (1) switch (_context72.prev = _context72.next) {
6930
7036
  case 0:
6931
7037
  if (this.store.order) {
6932
- _context70.next = 2;
7038
+ _context72.next = 2;
6933
7039
  break;
6934
7040
  }
6935
7041
  throw new Error('order 模块未初始化');
6936
7042
  case 2:
6937
- _context70.next = 4;
7043
+ _context72.next = 4;
6938
7044
  return this.store.order.applyPromotion();
6939
7045
  case 4:
6940
7046
  case "end":
6941
- return _context70.stop();
7047
+ return _context72.stop();
6942
7048
  }
6943
- }, _callee70, this);
7049
+ }, _callee72, this);
6944
7050
  }));
6945
7051
  function applyPromotion() {
6946
7052
  return _applyPromotion.apply(this, arguments);
@@ -6967,18 +7073,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6967
7073
  }, {
6968
7074
  key: "getProductList",
6969
7075
  value: function () {
6970
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71() {
6971
- var _this$otherParams40;
7076
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73() {
7077
+ var _this$otherParams42;
6972
7078
  var menu_list_ids, _this$store$products, res;
6973
- return _regeneratorRuntime().wrap(function _callee71$(_context71) {
6974
- while (1) switch (_context71.prev = _context71.next) {
7079
+ return _regeneratorRuntime().wrap(function _callee73$(_context73) {
7080
+ while (1) switch (_context73.prev = _context73.next) {
6975
7081
  case 0:
6976
7082
  // 可以直接通过配置里的 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) {
7083
+ 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
7084
  return Number(n.value);
6979
7085
  })) || [];
6980
- _context71.prev = 1;
6981
- _context71.next = 4;
7086
+ _context73.prev = 1;
7087
+ _context73.next = 4;
6982
7088
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
6983
7089
  menu_list_ids: menu_list_ids,
6984
7090
  cacheId: this.cacheId,
@@ -6986,17 +7092,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6986
7092
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
6987
7093
  });
6988
7094
  case 4:
6989
- res = _context71.sent;
6990
- return _context71.abrupt("return", res);
7095
+ res = _context73.sent;
7096
+ return _context73.abrupt("return", res);
6991
7097
  case 8:
6992
- _context71.prev = 8;
6993
- _context71.t0 = _context71["catch"](1);
6994
- throw _context71.t0;
7098
+ _context73.prev = 8;
7099
+ _context73.t0 = _context73["catch"](1);
7100
+ throw _context73.t0;
6995
7101
  case 11:
6996
7102
  case "end":
6997
- return _context71.stop();
7103
+ return _context73.stop();
6998
7104
  }
6999
- }, _callee71, this, [[1, 8]]);
7105
+ }, _callee73, this, [[1, 8]]);
7000
7106
  }));
7001
7107
  function getProductList() {
7002
7108
  return _getProductList.apply(this, arguments);
@@ -7011,36 +7117,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7011
7117
  }, {
7012
7118
  key: "setOtherParams",
7013
7119
  value: function () {
7014
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(params) {
7015
- var _this$otherParams41;
7120
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(params) {
7121
+ var _this$otherParams43;
7016
7122
  var _ref56,
7017
7123
  _ref56$cover,
7018
7124
  cover,
7019
7125
  previousPickupTimingScope,
7020
- _args72 = arguments;
7021
- return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7022
- while (1) switch (_context72.prev = _context72.next) {
7126
+ _args74 = arguments;
7127
+ return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7128
+ while (1) switch (_context74.prev = _context74.next) {
7023
7129
  case 0:
7024
- _ref56 = _args72.length > 1 && _args72[1] !== undefined ? _args72[1] : {}, _ref56$cover = _ref56.cover, cover = _ref56$cover === void 0 ? false : _ref56$cover;
7130
+ _ref56 = _args74.length > 1 && _args74[1] !== undefined ? _args74[1] : {}, _ref56$cover = _ref56.cover, cover = _ref56$cover === void 0 ? false : _ref56$cover;
7025
7131
  previousPickupTimingScope = this.getPickupTimingScope();
7026
7132
  if (cover) {
7027
7133
  this.otherParams = _objectSpread({}, params);
7028
7134
  } else {
7029
7135
  this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
7030
7136
  }
7031
- this.cacheId = (_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41.cacheId;
7137
+ this.cacheId = (_this$otherParams43 = this.otherParams) === null || _this$otherParams43 === void 0 ? void 0 : _this$otherParams43.cacheId;
7032
7138
  if (previousPickupTimingScope !== this.getPickupTimingScope()) this.resetPickupTimingCache();
7033
- _context72.next = 7;
7139
+ _context74.next = 7;
7034
7140
  return this.syncOtherParamsToSubModules(params, {
7035
7141
  cover: cover
7036
7142
  });
7037
7143
  case 7:
7038
7144
  case "end":
7039
- return _context72.stop();
7145
+ return _context74.stop();
7040
7146
  }
7041
- }, _callee72, this);
7147
+ }, _callee74, this);
7042
7148
  }));
7043
- function setOtherParams(_x64) {
7149
+ function setOtherParams(_x65) {
7044
7150
  return _setOtherParams.apply(this, arguments);
7045
7151
  }
7046
7152
  return setOtherParams;