@pisell/pisellos 0.10.50 → 0.10.52

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 (64) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
  3. package/dist/modules/FulfillmentTiming/index.js +407 -0
  4. package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
  5. package/dist/modules/FulfillmentTiming/types.js +1 -0
  6. package/dist/modules/OpenData/types.d.ts +6 -0
  7. package/dist/modules/Order/index.d.ts +18 -1
  8. package/dist/modules/Order/index.js +322 -195
  9. package/dist/modules/Order/pickupTiming.d.ts +46 -0
  10. package/dist/modules/Order/pickupTiming.js +53 -0
  11. package/dist/modules/Order/types.d.ts +11 -1
  12. package/dist/modules/Order/utils.d.ts +10 -0
  13. package/dist/modules/Order/utils.js +145 -85
  14. package/dist/modules/Rules/index.js +3 -2
  15. package/dist/modules/Schedule/index.d.ts +8 -0
  16. package/dist/modules/Schedule/index.js +134 -37
  17. package/dist/modules/index.d.ts +1 -0
  18. package/dist/modules/index.js +1 -0
  19. package/dist/server/modules/order/index.d.ts +8 -0
  20. package/dist/server/modules/order/index.js +506 -453
  21. package/dist/server/modules/order/types.d.ts +1 -0
  22. package/dist/server/utils/small-ticket.js +165 -94
  23. package/dist/solution/BaseSales/index.d.ts +24 -0
  24. package/dist/solution/BaseSales/index.js +1231 -1037
  25. package/dist/solution/BaseSales/pickupTiming.d.ts +43 -0
  26. package/dist/solution/BaseSales/pickupTiming.js +589 -0
  27. package/dist/solution/BaseSales/utils/parseSalesResponse.js +3 -0
  28. package/dist/solution/BookingByStep/index.d.ts +1 -1
  29. package/dist/solution/BookingTicket/index.d.ts +2 -2
  30. package/dist/solution/BookingTicket/utils/cartView.js +3 -1
  31. package/dist/solution/UnifiedBookingSales/index.d.ts +13 -4
  32. package/dist/solution/UnifiedBookingSales/index.js +873 -708
  33. package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
  34. package/lib/modules/FulfillmentTiming/index.js +359 -0
  35. package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
  36. package/lib/modules/FulfillmentTiming/types.js +5 -0
  37. package/lib/modules/OpenData/types.d.ts +6 -0
  38. package/lib/modules/Order/index.d.ts +18 -1
  39. package/lib/modules/Order/index.js +101 -3
  40. package/lib/modules/Order/pickupTiming.d.ts +46 -0
  41. package/lib/modules/Order/pickupTiming.js +61 -0
  42. package/lib/modules/Order/types.d.ts +11 -1
  43. package/lib/modules/Order/utils.d.ts +10 -0
  44. package/lib/modules/Order/utils.js +58 -4
  45. package/lib/modules/Rules/index.js +3 -2
  46. package/lib/modules/Schedule/index.d.ts +8 -0
  47. package/lib/modules/Schedule/index.js +64 -11
  48. package/lib/modules/index.d.ts +1 -0
  49. package/lib/modules/index.js +11 -0
  50. package/lib/server/modules/order/index.d.ts +8 -0
  51. package/lib/server/modules/order/index.js +19 -0
  52. package/lib/server/modules/order/types.d.ts +1 -0
  53. package/lib/server/utils/small-ticket.js +86 -22
  54. package/lib/solution/BaseSales/index.d.ts +24 -0
  55. package/lib/solution/BaseSales/index.js +109 -1
  56. package/lib/solution/BaseSales/pickupTiming.d.ts +43 -0
  57. package/lib/solution/BaseSales/pickupTiming.js +269 -0
  58. package/lib/solution/BaseSales/utils/parseSalesResponse.js +3 -0
  59. package/lib/solution/BookingByStep/index.d.ts +1 -1
  60. package/lib/solution/BookingTicket/index.d.ts +2 -2
  61. package/lib/solution/BookingTicket/utils/cartView.js +3 -1
  62. package/lib/solution/UnifiedBookingSales/index.d.ts +13 -4
  63. package/lib/solution/UnifiedBookingSales/index.js +130 -46
  64. package/package.json +1 -1
@@ -33,6 +33,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
33
33
  import { BaseModule } from "../../modules/BaseModule";
34
34
  import { BaseSalesHookNames } from "./types";
35
35
  import { OrderModule } from "../../modules/Order";
36
+ import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
37
+ import { PickupTimingController } from "./pickupTiming";
36
38
  import Decimal from 'decimal.js';
37
39
  import { cloneDeep, isEqual, mergeWith } from 'lodash-es';
38
40
  import { createModule } from "../BookingByStep/types";
@@ -44,7 +46,7 @@ import { applyOrderCollectionUidRemaps, getOrderCollectionPersistentId, getOrder
44
46
  import dayjs from 'dayjs';
45
47
  export * from "./types";
46
48
  import { isProductQueryHandledByOsServer, PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants, tryResolveClientDataVariants } from "../../modules/ProductList/clientDataVariants";
47
- import { isCustomerUserPlatform } from "../../utils/platform";
49
+ import { isCustomerUserPlatform, normalizeRuntimePlatform } from "../../utils/platform";
48
50
  import { QuotationModule } from "../../modules/Quotation";
49
51
  import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
50
52
  import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
@@ -552,6 +554,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
552
554
  _defineProperty(_assertThisInitialized(_this), "serverOrderChangeHydrateInFlight", null);
553
555
  _defineProperty(_assertThisInitialized(_this), "queuedServerOrderChanges", []);
554
556
  _defineProperty(_assertThisInitialized(_this), "serverOrderChangeSyncEnabled", false);
557
+ _defineProperty(_assertThisInitialized(_this), "pickupTimingEnabled", false);
558
+ _defineProperty(_assertThisInitialized(_this), "pickupTimingController", void 0);
555
559
  return _this;
556
560
  }
557
561
 
@@ -1572,6 +1576,123 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1572
1576
  return (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.channel;
1573
1577
  }
1574
1578
 
1579
+ /** Only solutions opting into Pickup Timing supply effective OpenData. */
1580
+ }, {
1581
+ key: "loadPickupTimingOpenData",
1582
+ value: (function () {
1583
+ var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_force) {
1584
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1585
+ while (1) switch (_context10.prev = _context10.next) {
1586
+ case 0:
1587
+ return _context10.abrupt("return", {});
1588
+ case 1:
1589
+ case "end":
1590
+ return _context10.stop();
1591
+ }
1592
+ }, _callee10);
1593
+ }));
1594
+ function loadPickupTimingOpenData(_x9) {
1595
+ return _loadPickupTimingOpenData.apply(this, arguments);
1596
+ }
1597
+ return loadPickupTimingOpenData;
1598
+ }())
1599
+ }, {
1600
+ key: "isPickupTimingEnabled",
1601
+ value: function isPickupTimingEnabled() {
1602
+ var _this$otherParams9;
1603
+ return this.pickupTimingEnabled && ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.enablePickupTiming) !== false;
1604
+ }
1605
+ }, {
1606
+ key: "getPickupTimingContextData",
1607
+ value: function getPickupTimingContextData(key) {
1608
+ var _this$core4;
1609
+ var context = (_this$core4 = this.core) === null || _this$core4 === void 0 ? void 0 : _this$core4.context;
1610
+ var getData = context === null || context === void 0 ? void 0 : context.getData;
1611
+ return typeof getData === 'function' ? getData.call(context, key) : undefined;
1612
+ }
1613
+ }, {
1614
+ key: "getPickupTimingScope",
1615
+ value: function getPickupTimingScope() {
1616
+ var _this$otherParams$bus, _this$otherParams10, _this$otherParams11, _this$otherParams12;
1617
+ return JSON.stringify({
1618
+ shop: this.getPickupTimingContextData('shop_id'),
1619
+ 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,
1620
+ channel: this.getSubmitOrderSalesChannel(),
1621
+ timezone: this.getPickupTimingContextData('timezone'),
1622
+ platform: normalizeRuntimePlatform((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.platform),
1623
+ cacheId: this.cacheId
1624
+ });
1625
+ }
1626
+ }, {
1627
+ key: "resetPickupTimingCache",
1628
+ value: function resetPickupTimingCache() {
1629
+ var _this$pickupTimingCon;
1630
+ (_this$pickupTimingCon = this.pickupTimingController) === null || _this$pickupTimingCon === void 0 || _this$pickupTimingCon.invalidate();
1631
+ }
1632
+ }, {
1633
+ key: "getPickupTimingController",
1634
+ value: function getPickupTimingController() {
1635
+ var _this8 = this;
1636
+ if (!this.pickupTimingController) {
1637
+ this.pickupTimingController = new PickupTimingController({
1638
+ getOrder: function getOrder() {
1639
+ if (!_this8.store.order) throw new Error('order 模块未初始化');
1640
+ return _this8.store.order;
1641
+ },
1642
+ getSchedule: function getSchedule() {
1643
+ return _this8.store.schedule;
1644
+ },
1645
+ loadOpenData: function loadOpenData(force) {
1646
+ return _this8.loadPickupTimingOpenData(force);
1647
+ },
1648
+ getTimezone: function getTimezone() {
1649
+ var _this8$getPickupTimin;
1650
+ return String((_this8$getPickupTimin = _this8.getPickupTimingContextData('timezone')) !== null && _this8$getPickupTimin !== void 0 ? _this8$getPickupTimin : '');
1651
+ },
1652
+ getScope: function getScope() {
1653
+ return _this8.getPickupTimingScope();
1654
+ },
1655
+ isPos: function isPos() {
1656
+ var _this8$otherParams;
1657
+ return normalizeRuntimePlatform((_this8$otherParams = _this8.otherParams) === null || _this8$otherParams === void 0 ? void 0 : _this8$otherParams.platform) === 'pos';
1658
+ }
1659
+ });
1660
+ }
1661
+ return this.pickupTimingController;
1662
+ }
1663
+ }, {
1664
+ key: "getPickupTimingAvailability",
1665
+ value: function getPickupTimingAvailability(params) {
1666
+ return this.getPickupTimingController().getAvailability(params);
1667
+ }
1668
+ }, {
1669
+ key: "getPickupTimingSelection",
1670
+ value: function getPickupTimingSelection() {
1671
+ return this.getPickupTimingController().getSelection();
1672
+ }
1673
+ }, {
1674
+ key: "setPickupTimingSelection",
1675
+ value: function setPickupTimingSelection(selection) {
1676
+ return this.getPickupTimingController().setSelection(selection);
1677
+ }
1678
+ }, {
1679
+ key: "validatePickupTimingSelection",
1680
+ value: function validatePickupTimingSelection(selection) {
1681
+ return this.getPickupTimingController().validate(selection);
1682
+ }
1683
+ }, {
1684
+ key: "preparePickupTimingForCheckout",
1685
+ value: function preparePickupTimingForCheckout(options) {
1686
+ if (!this.isPickupTimingEnabled()) {
1687
+ var _this$getTempOrder;
1688
+ return Promise.resolve({
1689
+ serviceType: String(((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 || (_this$getTempOrder = _this$getTempOrder.metadata) === null || _this$getTempOrder === void 0 || (_this$getTempOrder = _this$getTempOrder.shop_service_data) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.service_type) || ''),
1690
+ mode: 'asap'
1691
+ });
1692
+ }
1693
+ return this.getPickupTimingController().prepare(options);
1694
+ }
1695
+
1575
1696
  /** Subclasses with target-scoped OpenData override this guard before reusing the cache. */
1576
1697
  }, {
1577
1698
  key: "isInvoiceOpenDataCacheCurrent",
@@ -1581,8 +1702,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1581
1702
  }, {
1582
1703
  key: "getFulfillmentRefModeConfigs",
1583
1704
  value: function getFulfillmentRefModeConfigs() {
1584
- var _this$otherParams9, _this$otherParams10, _this$store, _this$store$getOpenDa;
1585
- var candidates = [(_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.openData, (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.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)];
1705
+ var _this$otherParams13, _this$otherParams14, _this$store, _this$store$getOpenDa;
1706
+ 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)];
1586
1707
  return candidates.filter(function (candidate) {
1587
1708
  return candidate && _typeof(candidate) === 'object' && !Array.isArray(candidate);
1588
1709
  });
@@ -1718,60 +1839,60 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1718
1839
  }, {
1719
1840
  key: "syncOtherParamsToSubModules",
1720
1841
  value: (function () {
1721
- var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(changedParams) {
1722
- var _this8 = this;
1842
+ var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(changedParams) {
1843
+ var _this9 = this;
1723
1844
  var _ref30,
1724
1845
  _ref30$cover,
1725
1846
  cover,
1726
- _args11 = arguments;
1727
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1728
- while (1) switch (_context11.prev = _context11.next) {
1847
+ _args12 = arguments;
1848
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1849
+ while (1) switch (_context12.prev = _context12.next) {
1729
1850
  case 0:
1730
- _ref30 = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {}, _ref30$cover = _ref30.cover, cover = _ref30$cover === void 0 ? false : _ref30$cover;
1731
- _context11.next = 3;
1851
+ _ref30 = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {}, _ref30$cover = _ref30.cover, cover = _ref30$cover === void 0 ? false : _ref30$cover;
1852
+ _context12.next = 3;
1732
1853
  return Promise.all(Object.entries(this.store).map( /*#__PURE__*/function () {
1733
- var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref31) {
1854
+ var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref31) {
1734
1855
  var _ref33, moduleName, subModule, targetModule, nextSubModuleOtherParams;
1735
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1736
- while (1) switch (_context10.prev = _context10.next) {
1856
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1857
+ while (1) switch (_context11.prev = _context11.next) {
1737
1858
  case 0:
1738
1859
  _ref33 = _slicedToArray(_ref31, 2), moduleName = _ref33[0], subModule = _ref33[1];
1739
- if (!_this8.reusedSharedSubModuleNames.has(moduleName)) {
1740
- _context10.next = 3;
1860
+ if (!_this9.reusedSharedSubModuleNames.has(moduleName)) {
1861
+ _context11.next = 3;
1741
1862
  break;
1742
1863
  }
1743
- return _context10.abrupt("return");
1864
+ return _context11.abrupt("return");
1744
1865
  case 3:
1745
1866
  targetModule = subModule;
1746
1867
  if (!(!targetModule || typeof targetModule.updateOtherParams !== 'function')) {
1747
- _context10.next = 6;
1868
+ _context11.next = 6;
1748
1869
  break;
1749
1870
  }
1750
- return _context10.abrupt("return");
1871
+ return _context11.abrupt("return");
1751
1872
  case 6:
1752
- nextSubModuleOtherParams = _this8.buildSubModuleOtherParams(moduleName);
1753
- _context10.next = 9;
1873
+ nextSubModuleOtherParams = _this9.buildSubModuleOtherParams(moduleName);
1874
+ _context11.next = 9;
1754
1875
  return targetModule.updateOtherParams(nextSubModuleOtherParams, {
1755
1876
  changedParams: changedParams,
1756
1877
  cover: cover
1757
1878
  });
1758
1879
  case 9:
1759
1880
  case "end":
1760
- return _context10.stop();
1881
+ return _context11.stop();
1761
1882
  }
1762
- }, _callee10);
1883
+ }, _callee11);
1763
1884
  }));
1764
- return function (_x10) {
1885
+ return function (_x11) {
1765
1886
  return _ref32.apply(this, arguments);
1766
1887
  };
1767
1888
  }()));
1768
1889
  case 3:
1769
1890
  case "end":
1770
- return _context11.stop();
1891
+ return _context12.stop();
1771
1892
  }
1772
- }, _callee11, this);
1893
+ }, _callee12, this);
1773
1894
  }));
1774
- function syncOtherParamsToSubModules(_x9) {
1895
+ function syncOtherParamsToSubModules(_x10) {
1775
1896
  return _syncOtherParamsToSubModules.apply(this, arguments);
1776
1897
  }
1777
1898
  return syncOtherParamsToSubModules;
@@ -1821,29 +1942,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1821
1942
  }, {
1822
1943
  key: "getPaymentNumberDevicePrefixSync",
1823
1944
  value: function getPaymentNumberDevicePrefixSync() {
1824
- var _this9 = this;
1945
+ var _this10 = this;
1825
1946
  if (!this.appPlugin) return 'LOCAL';
1826
1947
  return resolvePaymentNumberDevicePrefixFromDeviceId(function (key) {
1827
- return _this9.getAppData(key);
1948
+ return _this10.getAppData(key);
1828
1949
  });
1829
1950
  }
1830
1951
  }, {
1831
1952
  key: "getPaymentNumberDevicePrefixAsync",
1832
1953
  value: function getPaymentNumberDevicePrefixAsync() {
1833
- var _this10 = this;
1954
+ var _this11 = this;
1834
1955
  if (!this.appPlugin) return Promise.resolve('LOCAL');
1835
1956
  if (this.paymentNumberDevicePrefix) {
1836
1957
  return Promise.resolve(this.paymentNumberDevicePrefix);
1837
1958
  }
1838
1959
  return resolvePaymentNumberDevicePrefix(function (key) {
1839
- return _this10.getAppData(key);
1960
+ return _this11.getAppData(key);
1840
1961
  });
1841
1962
  }
1842
1963
  }, {
1843
1964
  key: "isMultiCurrencySettlementEnabled",
1844
1965
  value: function isMultiCurrencySettlementEnabled() {
1845
- var _this$otherParams11;
1846
- return ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.enableMultiCurrencySettlement) === true;
1966
+ var _this$otherParams15;
1967
+ return ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.enableMultiCurrencySettlement) === true;
1847
1968
  }
1848
1969
  }, {
1849
1970
  key: "isActiveVirtualSettlementOrder",
@@ -1914,27 +2035,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1914
2035
  }, {
1915
2036
  key: "initialize",
1916
2037
  value: function () {
1917
- var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(core) {
1918
- var _this$otherParams12,
2038
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(core) {
2039
+ var _this$otherParams16,
1919
2040
  _this$appPlugin2,
1920
2041
  _this$appPlugin2$getA,
1921
- _this11 = this,
1922
- _this$otherParams13;
2042
+ _this12 = this,
2043
+ _this$otherParams17;
1923
2044
  var options,
1924
2045
  app,
1925
2046
  targetCacheData,
1926
2047
  moduleNames,
1927
- _args12 = arguments;
1928
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1929
- while (1) switch (_context12.prev = _context12.next) {
2048
+ _args13 = arguments;
2049
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2050
+ while (1) switch (_context13.prev = _context13.next) {
1930
2051
  case 0:
1931
- options = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
2052
+ options = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : {};
2053
+ this.resetPickupTimingCache();
1932
2054
  this.core = core;
1933
2055
  this.initializeOptions = options || {};
1934
2056
  this.paymentNumberDevicePrefix = null;
1935
2057
  // this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
1936
2058
  this.otherParams = options.otherParams || {};
1937
- this.cacheId = (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.cacheId;
2059
+ this.cacheId = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.cacheId;
1938
2060
  this.reusedSharedSubModuleNames.clear();
1939
2061
  this.window = core.getPlugin('window');
1940
2062
  this.request = core.getPlugin('request');
@@ -1949,48 +2071,48 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1949
2071
  targetCacheData = this.readSessionCacheData();
1950
2072
  moduleNames = this.getRegisteredModuleNames();
1951
2073
  moduleNames.forEach(function (step) {
1952
- var reusedModule = _this11.getReusableSharedSubModule(step);
2074
+ var reusedModule = _this12.getReusableSharedSubModule(step);
1953
2075
  if (reusedModule) {
1954
- _this11.store[step] = reusedModule;
1955
- _this11.reusedSharedSubModuleNames.add(step);
2076
+ _this12.store[step] = reusedModule;
2077
+ _this12.reusedSharedSubModuleNames.add(step);
1956
2078
  return;
1957
2079
  }
1958
- var targetModule = _this11.createSubModule(step);
2080
+ var targetModule = _this12.createSubModule(step);
1959
2081
  if (!targetModule) {
1960
2082
  throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
1961
2083
  }
1962
- var hooks = _this11.getSubModuleHooks(step);
1963
- _this11.store[step] = targetModule;
1964
- _this11.core.registerModule(targetModule, _objectSpread(_objectSpread({
1965
- initialState: _this11.shouldUseSessionStorageForSubModule(step) ? (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {} : {}
2084
+ var hooks = _this12.getSubModuleHooks(step);
2085
+ _this12.store[step] = targetModule;
2086
+ _this12.core.registerModule(targetModule, _objectSpread(_objectSpread({
2087
+ initialState: _this12.shouldUseSessionStorageForSubModule(step) ? (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {} : {}
1966
2088
  }, hooks ? {
1967
2089
  hooks: hooks
1968
2090
  } : {}), {}, {
1969
- otherParams: _this11.buildSubModuleOtherParams(step)
2091
+ otherParams: _this12.buildSubModuleOtherParams(step)
1970
2092
  }));
1971
2093
  });
1972
2094
  if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
1973
- _context12.next = 19;
2095
+ _context13.next = 20;
1974
2096
  break;
1975
2097
  }
1976
- _context12.next = 19;
2098
+ _context13.next = 20;
1977
2099
  return this.store.schedule.loadAllSchedule();
1978
- case 19:
1979
- if (this.store.order && typeof ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.enableTempOrderPersist) === 'boolean') {
2100
+ case 20:
2101
+ if (this.store.order && typeof ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.enableTempOrderPersist) === 'boolean') {
1980
2102
  this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
1981
2103
  }
1982
- _context12.next = 22;
2104
+ _context13.next = 23;
1983
2105
  return this.getPaymentMethodsAsync();
1984
- case 22:
2106
+ case 23:
1985
2107
  this.registerServerOrderChangeSync();
1986
2108
  this.core.effects.emit("".concat(this.name, ":onInited"), {});
1987
- case 24:
2109
+ case 25:
1988
2110
  case "end":
1989
- return _context12.stop();
2111
+ return _context13.stop();
1990
2112
  }
1991
- }, _callee12, this);
2113
+ }, _callee13, this);
1992
2114
  }));
1993
- function initialize(_x11) {
2115
+ function initialize(_x12) {
1994
2116
  return _initialize.apply(this, arguments);
1995
2117
  }
1996
2118
  return initialize;
@@ -1998,17 +2120,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1998
2120
  }, {
1999
2121
  key: "destroy",
2000
2122
  value: function () {
2001
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
2123
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
2002
2124
  var _this$serverOrderChan2,
2003
- _this12 = this;
2004
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2005
- while (1) switch (_context13.prev = _context13.next) {
2125
+ _this13 = this;
2126
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2127
+ while (1) switch (_context14.prev = _context14.next) {
2006
2128
  case 0:
2129
+ this.resetPickupTimingCache();
2007
2130
  (_this$serverOrderChan2 = this.serverOrderChangeUnsubscribe) === null || _this$serverOrderChan2 === void 0 || _this$serverOrderChan2.call(this);
2008
2131
  this.serverOrderChangeUnsubscribe = null;
2009
2132
  Object.keys(this.store).forEach(function (key) {
2010
- if (_this12.reusedSharedSubModuleNames.has(key)) return;
2011
- var sub = _this12.store[key];
2133
+ if (_this13.reusedSharedSubModuleNames.has(key)) return;
2134
+ var sub = _this13.store[key];
2012
2135
  if (sub && typeof sub.destroy === 'function') {
2013
2136
  try {
2014
2137
  sub.destroy();
@@ -2022,15 +2145,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2022
2145
  this.queuedServerOrderChanges = [];
2023
2146
  this.salesDetailLoadSequence += 1;
2024
2147
  this.walletAssetsRefreshSequence += 1;
2025
- _context13.next = 10;
2148
+ _context14.next = 11;
2026
2149
  return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
2027
- case 10:
2028
- _get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
2029
2150
  case 11:
2151
+ _get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
2152
+ case 12:
2030
2153
  case "end":
2031
- return _context13.stop();
2154
+ return _context14.stop();
2032
2155
  }
2033
- }, _callee13, this);
2156
+ }, _callee14, this);
2034
2157
  }));
2035
2158
  function destroy() {
2036
2159
  return _destroy.apply(this, arguments);
@@ -2047,20 +2170,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2047
2170
  }, {
2048
2171
  key: "loadSalesDetail",
2049
2172
  value: (function () {
2050
- var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(orderIdOrParams) {
2173
+ var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(orderIdOrParams) {
2051
2174
  var loadSequence, _ref38, _ref39, _ref40, _ref41, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, mergeSourceRecord, currentTempOrder, mergedRecord, record;
2052
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2053
- while (1) switch (_context14.prev = _context14.next) {
2175
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2176
+ while (1) switch (_context15.prev = _context15.next) {
2054
2177
  case 0:
2055
2178
  if (this.store.order) {
2056
- _context14.next = 2;
2179
+ _context15.next = 2;
2057
2180
  break;
2058
2181
  }
2059
2182
  throw new Error('order 模块未初始化');
2060
2183
  case 2:
2061
2184
  loadSequence = ++this.salesDetailLoadSequence;
2062
2185
  this.salesDetailLoadInFlightCount += 1;
2063
- _context14.prev = 4;
2186
+ _context15.prev = 4;
2064
2187
  params = _typeof(orderIdOrParams) === 'object' ? orderIdOrParams : {
2065
2188
  orderId: orderIdOrParams
2066
2189
  };
@@ -2068,30 +2191,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2068
2191
  preloadedSalesDetail = params.preloadedSalesDetail;
2069
2192
  lookup = (_ref38 = (_ref39 = (_ref40 = (_ref41 = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : externalSaleNumber) !== null && _ref41 !== void 0 ? _ref41 : params.orderNumber) !== null && _ref40 !== void 0 ? _ref40 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_id) !== null && _ref39 !== void 0 ? _ref39 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.external_sale_number) !== null && _ref38 !== void 0 ? _ref38 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_number;
2070
2193
  if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
2071
- _context14.next = 11;
2194
+ _context15.next = 11;
2072
2195
  break;
2073
2196
  }
2074
2197
  throw new Error('加载销售详情需要 orderId、externalSaleNumber 或 orderNumber');
2075
2198
  case 11:
2076
2199
  if (!(preloadedSalesDetail !== null && preloadedSalesDetail !== void 0)) {
2077
- _context14.next = 15;
2200
+ _context15.next = 15;
2078
2201
  break;
2079
2202
  }
2080
- _context14.t0 = preloadedSalesDetail;
2081
- _context14.next = 18;
2203
+ _context15.t0 = preloadedSalesDetail;
2204
+ _context15.next = 18;
2082
2205
  break;
2083
2206
  case 15:
2084
- _context14.next = 17;
2207
+ _context15.next = 17;
2085
2208
  return this.store.order.getSalesOrderByLookup({
2086
2209
  lookup: lookup,
2087
2210
  forceRemote: params.forceRemote
2088
2211
  });
2089
2212
  case 17:
2090
- _context14.t0 = _context14.sent;
2213
+ _context15.t0 = _context15.sent;
2091
2214
  case 18:
2092
- loadedRecord = _context14.t0;
2215
+ loadedRecord = _context15.t0;
2093
2216
  if (!(!preloadedSalesDetail && (!loadedRecord || loadedRecord.code !== 200))) {
2094
- _context14.next = 22;
2217
+ _context15.next = 22;
2095
2218
  break;
2096
2219
  }
2097
2220
  message = loadedRecord && (loadedRecord.message || loadedRecord.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(lookup);
@@ -2104,41 +2227,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2104
2227
  currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
2105
2228
  mergedRecord = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, mergeSourceRecord, 'preserve-local') : mergeSourceRecord;
2106
2229
  record = shouldFilterPendingPayments ? filterPendingPaymentsFromLoadedSalesDetail(mergedRecord) : mergedRecord;
2107
- _context14.next = 31;
2230
+ _context15.next = 31;
2108
2231
  return this.hydrateLatestLoadedSalesDetail(record, loadSequence, {
2109
2232
  hydrateSource: params.hydrateSource,
2110
2233
  merge: params.merge
2111
2234
  });
2112
2235
  case 31:
2113
- return _context14.abrupt("return", _context14.sent);
2236
+ return _context15.abrupt("return", _context15.sent);
2114
2237
  case 32:
2115
- _context14.prev = 32;
2238
+ _context15.prev = 32;
2116
2239
  this.salesDetailLoadInFlightCount = Math.max(0, this.salesDetailLoadInFlightCount - 1);
2117
2240
  if (!(this.salesDetailLoadInFlightCount === 0)) {
2118
- _context14.next = 43;
2241
+ _context15.next = 43;
2119
2242
  break;
2120
2243
  }
2121
- _context14.prev = 35;
2122
- _context14.next = 38;
2244
+ _context15.prev = 35;
2245
+ _context15.next = 38;
2123
2246
  return this.drainQueuedServerOrderChanges();
2124
2247
  case 38:
2125
- _context14.next = 43;
2248
+ _context15.next = 43;
2126
2249
  break;
2127
2250
  case 40:
2128
- _context14.prev = 40;
2129
- _context14.t1 = _context14["catch"](35);
2251
+ _context15.prev = 40;
2252
+ _context15.t1 = _context15["catch"](35);
2130
2253
  this.logError('drain queued server order changes failed', {
2131
- error: _context14.t1 instanceof Error ? _context14.t1.message : String(_context14.t1)
2254
+ error: _context15.t1 instanceof Error ? _context15.t1.message : String(_context15.t1)
2132
2255
  });
2133
2256
  case 43:
2134
- return _context14.finish(32);
2257
+ return _context15.finish(32);
2135
2258
  case 44:
2136
2259
  case "end":
2137
- return _context14.stop();
2260
+ return _context15.stop();
2138
2261
  }
2139
- }, _callee14, this, [[4,, 32, 44], [35, 40]]);
2262
+ }, _callee15, this, [[4,, 32, 44], [35, 40]]);
2140
2263
  }));
2141
- function loadSalesDetail(_x12) {
2264
+ function loadSalesDetail(_x13) {
2142
2265
  return _loadSalesDetail.apply(this, arguments);
2143
2266
  }
2144
2267
  return loadSalesDetail;
@@ -2170,9 +2293,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2170
2293
  key: "getRootBooking",
2171
2294
  value: function getRootBooking() {
2172
2295
  if (!this.currentSalesDetail) return null;
2173
- if (this.currentSalesDetail.rootBooking) return this.currentSalesDetail.rootBooking;
2296
+ if (this.currentSalesDetail.rootBooking && !isFulfillmentTimingBooking(this.currentSalesDetail.rootBooking)) {
2297
+ return this.currentSalesDetail.rootBooking;
2298
+ }
2174
2299
  var bookings = this.currentSalesDetail.bookings || [];
2175
2300
  return bookings.find(function (booking) {
2301
+ if (isFulfillmentTimingBooking(booking)) return false;
2176
2302
  var parentId = booking === null || booking === void 0 ? void 0 : booking.parent_id;
2177
2303
  return parentId === 0 || parentId === null || parentId === undefined;
2178
2304
  }) || null;
@@ -2218,34 +2344,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2218
2344
  }, {
2219
2345
  key: "replaceTempOrder",
2220
2346
  value: function () {
2221
- var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(tempOrder, options) {
2347
+ var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(tempOrder, options) {
2222
2348
  var nextTempOrder;
2223
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2224
- while (1) switch (_context15.prev = _context15.next) {
2349
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2350
+ while (1) switch (_context16.prev = _context16.next) {
2225
2351
  case 0:
2226
2352
  if (this.store.order) {
2227
- _context15.next = 2;
2353
+ _context16.next = 2;
2228
2354
  break;
2229
2355
  }
2230
2356
  throw new Error('order 模块未初始化');
2231
2357
  case 2:
2232
- _context15.next = 4;
2358
+ _context16.next = 4;
2233
2359
  return this.store.order.replaceTempOrder(tempOrder, options);
2234
2360
  case 4:
2235
- nextTempOrder = _context15.sent;
2236
- _context15.next = 7;
2361
+ nextTempOrder = _context16.sent;
2362
+ _context16.next = 7;
2237
2363
  return this.effectsEmit('onTempOrderReplaced', {
2238
2364
  tempOrder: nextTempOrder
2239
2365
  });
2240
2366
  case 7:
2241
- return _context15.abrupt("return", nextTempOrder);
2367
+ return _context16.abrupt("return", nextTempOrder);
2242
2368
  case 8:
2243
2369
  case "end":
2244
- return _context15.stop();
2370
+ return _context16.stop();
2245
2371
  }
2246
- }, _callee15, this);
2372
+ }, _callee16, this);
2247
2373
  }));
2248
- function replaceTempOrder(_x13, _x14) {
2374
+ function replaceTempOrder(_x14, _x15) {
2249
2375
  return _replaceTempOrder.apply(this, arguments);
2250
2376
  }
2251
2377
  return replaceTempOrder;
@@ -2301,24 +2427,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2301
2427
  }, {
2302
2428
  key: "setSalesNote",
2303
2429
  value: function () {
2304
- var _setSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(input) {
2305
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2306
- while (1) switch (_context16.prev = _context16.next) {
2430
+ var _setSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(input) {
2431
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2432
+ while (1) switch (_context17.prev = _context17.next) {
2307
2433
  case 0:
2308
2434
  if (this.store.order) {
2309
- _context16.next = 2;
2435
+ _context17.next = 2;
2310
2436
  break;
2311
2437
  }
2312
2438
  throw new Error('order 模块未初始化');
2313
2439
  case 2:
2314
- return _context16.abrupt("return", this.store.order.setSalesNote(input));
2440
+ return _context17.abrupt("return", this.store.order.setSalesNote(input));
2315
2441
  case 3:
2316
2442
  case "end":
2317
- return _context16.stop();
2443
+ return _context17.stop();
2318
2444
  }
2319
- }, _callee16, this);
2445
+ }, _callee17, this);
2320
2446
  }));
2321
- function setSalesNote(_x15) {
2447
+ function setSalesNote(_x16) {
2322
2448
  return _setSalesNote.apply(this, arguments);
2323
2449
  }
2324
2450
  return setSalesNote;
@@ -2326,25 +2452,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2326
2452
  }, {
2327
2453
  key: "removeSalesNote",
2328
2454
  value: function () {
2329
- var _removeSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(uuid) {
2330
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2331
- while (1) switch (_context17.prev = _context17.next) {
2455
+ var _removeSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(uuid) {
2456
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2457
+ while (1) switch (_context18.prev = _context18.next) {
2332
2458
  case 0:
2333
2459
  if (this.store.order) {
2334
- _context17.next = 2;
2460
+ _context18.next = 2;
2335
2461
  break;
2336
2462
  }
2337
2463
  throw new Error('order 模块未初始化');
2338
2464
  case 2:
2339
- _context17.next = 4;
2465
+ _context18.next = 4;
2340
2466
  return this.store.order.removeSalesNote(uuid);
2341
2467
  case 4:
2342
2468
  case "end":
2343
- return _context17.stop();
2469
+ return _context18.stop();
2344
2470
  }
2345
- }, _callee17, this);
2471
+ }, _callee18, this);
2346
2472
  }));
2347
- function removeSalesNote(_x16) {
2473
+ function removeSalesNote(_x17) {
2348
2474
  return _removeSalesNote.apply(this, arguments);
2349
2475
  }
2350
2476
  return removeSalesNote;
@@ -2352,23 +2478,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2352
2478
  }, {
2353
2479
  key: "clearSalesNotes",
2354
2480
  value: function () {
2355
- var _clearSalesNotes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
2356
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2357
- while (1) switch (_context18.prev = _context18.next) {
2481
+ var _clearSalesNotes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2482
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2483
+ while (1) switch (_context19.prev = _context19.next) {
2358
2484
  case 0:
2359
2485
  if (this.store.order) {
2360
- _context18.next = 2;
2486
+ _context19.next = 2;
2361
2487
  break;
2362
2488
  }
2363
2489
  throw new Error('order 模块未初始化');
2364
2490
  case 2:
2365
- _context18.next = 4;
2491
+ _context19.next = 4;
2366
2492
  return this.store.order.clearSalesNotes();
2367
2493
  case 4:
2368
2494
  case "end":
2369
- return _context18.stop();
2495
+ return _context19.stop();
2370
2496
  }
2371
- }, _callee18, this);
2497
+ }, _callee19, this);
2372
2498
  }));
2373
2499
  function clearSalesNotes() {
2374
2500
  return _clearSalesNotes.apply(this, arguments);
@@ -2425,6 +2551,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2425
2551
  if (!this.store.order) throw new Error('order 模块未初始化');
2426
2552
  return this.store.order.updateTempOrderServiceType(serviceType);
2427
2553
  }
2554
+ }, {
2555
+ key: "getPickupTimingBooking",
2556
+ value: function getPickupTimingBooking() {
2557
+ var _this$store$order4;
2558
+ return ((_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getPickupTimingBooking()) || null;
2559
+ }
2560
+ }, {
2561
+ key: "setPickupTimingBooking",
2562
+ value: function setPickupTimingBooking(input) {
2563
+ if (!this.store.order) throw new Error('order 模块未初始化');
2564
+ return this.store.order.setPickupTimingBooking(input);
2565
+ }
2566
+ }, {
2567
+ key: "clearPickupTimingBooking",
2568
+ value: function clearPickupTimingBooking() {
2569
+ var _this$store$order5;
2570
+ (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || _this$store$order5.clearPickupTimingBooking();
2571
+ }
2428
2572
  }, {
2429
2573
  key: "updateTempOrderContactsInfo",
2430
2574
  value: function updateTempOrderContactsInfo(contactsInfo) {
@@ -2458,40 +2602,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2458
2602
  }, {
2459
2603
  key: "addNewOrder",
2460
2604
  value: function () {
2461
- var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2605
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
2462
2606
  var tempOrder;
2463
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2464
- while (1) switch (_context19.prev = _context19.next) {
2607
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2608
+ while (1) switch (_context20.prev = _context20.next) {
2465
2609
  case 0:
2466
- _context19.prev = 0;
2610
+ _context20.prev = 0;
2467
2611
  if (this.store.order) {
2468
- _context19.next = 3;
2612
+ _context20.next = 3;
2469
2613
  break;
2470
2614
  }
2471
2615
  throw new Error('order 模块未初始化');
2472
2616
  case 3:
2473
- _context19.next = 5;
2617
+ _context20.next = 5;
2474
2618
  return this.store.order.addNewOrder();
2475
2619
  case 5:
2476
- tempOrder = _context19.sent;
2620
+ tempOrder = _context20.sent;
2477
2621
  if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
2478
- _context19.next = 10;
2622
+ _context20.next = 10;
2479
2623
  break;
2480
2624
  }
2481
2625
  this.store.order.persistTempOrder();
2482
- _context19.next = 10;
2626
+ _context20.next = 10;
2483
2627
  return this.store.order.saveDraft();
2484
2628
  case 10:
2485
- return _context19.abrupt("return", tempOrder);
2629
+ return _context20.abrupt("return", tempOrder);
2486
2630
  case 13:
2487
- _context19.prev = 13;
2488
- _context19.t0 = _context19["catch"](0);
2489
- throw _context19.t0;
2631
+ _context20.prev = 13;
2632
+ _context20.t0 = _context20["catch"](0);
2633
+ throw _context20.t0;
2490
2634
  case 16:
2491
2635
  case "end":
2492
- return _context19.stop();
2636
+ return _context20.stop();
2493
2637
  }
2494
- }, _callee19, this, [[0, 13]]);
2638
+ }, _callee20, this, [[0, 13]]);
2495
2639
  }));
2496
2640
  function addNewOrder() {
2497
2641
  return _addNewOrder.apply(this, arguments);
@@ -2501,22 +2645,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2501
2645
  }, {
2502
2646
  key: "saveDraft",
2503
2647
  value: function () {
2504
- var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
2505
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2506
- while (1) switch (_context20.prev = _context20.next) {
2648
+ var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2649
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2650
+ while (1) switch (_context21.prev = _context21.next) {
2507
2651
  case 0:
2508
2652
  if (this.store.order) {
2509
- _context20.next = 2;
2653
+ _context21.next = 2;
2510
2654
  break;
2511
2655
  }
2512
2656
  throw new Error('order 模块未初始化');
2513
2657
  case 2:
2514
- return _context20.abrupt("return", this.store.order.saveDraft());
2658
+ return _context21.abrupt("return", this.store.order.saveDraft());
2515
2659
  case 3:
2516
2660
  case "end":
2517
- return _context20.stop();
2661
+ return _context21.stop();
2518
2662
  }
2519
- }, _callee20, this);
2663
+ }, _callee21, this);
2520
2664
  }));
2521
2665
  function saveDraft() {
2522
2666
  return _saveDraft.apply(this, arguments);
@@ -2527,14 +2671,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2527
2671
  }, {
2528
2672
  key: "restoreOrder",
2529
2673
  value: function () {
2530
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2674
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2531
2675
  var _this$store$payment, tempOrder, appDataChanged, wallet;
2532
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2533
- while (1) switch (_context21.prev = _context21.next) {
2676
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2677
+ while (1) switch (_context22.prev = _context22.next) {
2534
2678
  case 0:
2535
- _context21.prev = 0;
2679
+ _context22.prev = 0;
2536
2680
  if (this.store.order) {
2537
- _context21.next = 3;
2681
+ _context22.next = 3;
2538
2682
  break;
2539
2683
  }
2540
2684
  throw new Error('scanOrder 解决方案需要 order 模块支持');
@@ -2547,37 +2691,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2547
2691
  this.hasManualDiscountSelection = false;
2548
2692
  wallet = (_this$store$payment = this.store.payment) === null || _this$store$payment === void 0 ? void 0 : _this$store$payment.wallet;
2549
2693
  if (!wallet) {
2550
- _context21.next = 14;
2694
+ _context22.next = 14;
2551
2695
  break;
2552
2696
  }
2553
2697
  this.walletAssetsRefreshSequence += 1;
2554
2698
  wallet.clearAllCache();
2555
- _context21.next = 14;
2699
+ _context22.next = 14;
2556
2700
  return this.publishWalletAssetsState(wallet.getWalletAssetsState());
2557
2701
  case 14:
2558
- _context21.next = 16;
2702
+ _context22.next = 16;
2559
2703
  return this.effectsEmit('onTempOrderReplaced', {
2560
2704
  tempOrder: tempOrder
2561
2705
  });
2562
2706
  case 16:
2563
2707
  if (!(appDataChanged && this.isTempOrderPersistEnabled())) {
2564
- _context21.next = 20;
2708
+ _context22.next = 20;
2565
2709
  break;
2566
2710
  }
2567
2711
  this.store.order.persistTempOrder();
2568
- _context21.next = 20;
2712
+ _context22.next = 20;
2569
2713
  return this.store.order.saveDraft();
2570
2714
  case 20:
2571
- return _context21.abrupt("return", tempOrder);
2715
+ return _context22.abrupt("return", tempOrder);
2572
2716
  case 23:
2573
- _context21.prev = 23;
2574
- _context21.t0 = _context21["catch"](0);
2575
- throw _context21.t0;
2717
+ _context22.prev = 23;
2718
+ _context22.t0 = _context22["catch"](0);
2719
+ throw _context22.t0;
2576
2720
  case 26:
2577
2721
  case "end":
2578
- return _context21.stop();
2722
+ return _context22.stop();
2579
2723
  }
2580
- }, _callee21, this, [[0, 23]]);
2724
+ }, _callee22, this, [[0, 23]]);
2581
2725
  }));
2582
2726
  function restoreOrder() {
2583
2727
  return _restoreOrder.apply(this, arguments);
@@ -2591,22 +2735,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2591
2735
  }, {
2592
2736
  key: "clearOrderCartLines",
2593
2737
  value: (function () {
2594
- var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2738
+ var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2595
2739
  var tempOrder;
2596
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2597
- while (1) switch (_context22.prev = _context22.next) {
2740
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2741
+ while (1) switch (_context23.prev = _context23.next) {
2598
2742
  case 0:
2599
- _context22.prev = 0;
2743
+ _context23.prev = 0;
2600
2744
  if (this.store.order) {
2601
- _context22.next = 3;
2745
+ _context23.next = 3;
2602
2746
  break;
2603
2747
  }
2604
2748
  throw new Error('order 模块未初始化');
2605
2749
  case 3:
2606
- _context22.next = 5;
2750
+ _context23.next = 5;
2607
2751
  return this.store.order.clearOrderCartLines();
2608
2752
  case 5:
2609
- tempOrder = _context22.sent;
2753
+ tempOrder = _context23.sent;
2610
2754
  if (this.currentSalesDetail) {
2611
2755
  this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
2612
2756
  products: [],
@@ -2616,29 +2760,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2616
2760
  discount_list: []
2617
2761
  });
2618
2762
  }
2619
- _context22.next = 9;
2763
+ _context23.next = 9;
2620
2764
  return this.effectsEmit('onTempOrderReplaced', {
2621
2765
  tempOrder: tempOrder
2622
2766
  });
2623
2767
  case 9:
2624
2768
  if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
2625
- _context22.next = 13;
2769
+ _context23.next = 13;
2626
2770
  break;
2627
2771
  }
2628
2772
  this.store.order.persistTempOrder();
2629
- _context22.next = 13;
2773
+ _context23.next = 13;
2630
2774
  return this.store.order.saveDraft();
2631
2775
  case 13:
2632
- return _context22.abrupt("return", tempOrder);
2776
+ return _context23.abrupt("return", tempOrder);
2633
2777
  case 16:
2634
- _context22.prev = 16;
2635
- _context22.t0 = _context22["catch"](0);
2636
- throw _context22.t0;
2778
+ _context23.prev = 16;
2779
+ _context23.t0 = _context23["catch"](0);
2780
+ throw _context23.t0;
2637
2781
  case 19:
2638
2782
  case "end":
2639
- return _context22.stop();
2783
+ return _context23.stop();
2640
2784
  }
2641
- }, _callee22, this, [[0, 16]]);
2785
+ }, _callee23, this, [[0, 16]]);
2642
2786
  }));
2643
2787
  function clearOrderCartLines() {
2644
2788
  return _clearOrderCartLines.apply(this, arguments);
@@ -2648,21 +2792,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2648
2792
  }, {
2649
2793
  key: "clearOrderForSettlementSwitch",
2650
2794
  value: (function () {
2651
- var _clearOrderForSettlementSwitch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2795
+ var _clearOrderForSettlementSwitch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2652
2796
  var tempOrder;
2653
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2654
- while (1) switch (_context23.prev = _context23.next) {
2797
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2798
+ while (1) switch (_context24.prev = _context24.next) {
2655
2799
  case 0:
2656
2800
  if (this.store.order) {
2657
- _context23.next = 2;
2801
+ _context24.next = 2;
2658
2802
  break;
2659
2803
  }
2660
2804
  throw new Error('order 模块未初始化');
2661
2805
  case 2:
2662
- _context23.next = 4;
2806
+ _context24.next = 4;
2663
2807
  return this.store.order.clearOrderForSettlementSwitch();
2664
2808
  case 4:
2665
- tempOrder = _context23.sent;
2809
+ tempOrder = _context24.sent;
2666
2810
  if (this.currentSalesDetail) {
2667
2811
  this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
2668
2812
  products: [],
@@ -2673,12 +2817,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2673
2817
  payments: []
2674
2818
  });
2675
2819
  }
2676
- return _context23.abrupt("return", tempOrder);
2820
+ return _context24.abrupt("return", tempOrder);
2677
2821
  case 7:
2678
2822
  case "end":
2679
- return _context23.stop();
2823
+ return _context24.stop();
2680
2824
  }
2681
- }, _callee23, this);
2825
+ }, _callee24, this);
2682
2826
  }));
2683
2827
  function clearOrderForSettlementSwitch() {
2684
2828
  return _clearOrderForSettlementSwitch.apply(this, arguments);
@@ -2695,32 +2839,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2695
2839
  }, {
2696
2840
  key: "getSummary",
2697
2841
  value: function () {
2698
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2842
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2699
2843
  var summary;
2700
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2701
- while (1) switch (_context24.prev = _context24.next) {
2844
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2845
+ while (1) switch (_context25.prev = _context25.next) {
2702
2846
  case 0:
2703
- _context24.prev = 0;
2847
+ _context25.prev = 0;
2704
2848
  if (this.store.order) {
2705
- _context24.next = 3;
2849
+ _context25.next = 3;
2706
2850
  break;
2707
2851
  }
2708
2852
  throw new Error('order 模块未初始化');
2709
2853
  case 3:
2710
- _context24.next = 5;
2854
+ _context25.next = 5;
2711
2855
  return this.store.order.getOrderSummary();
2712
2856
  case 5:
2713
- summary = _context24.sent;
2714
- return _context24.abrupt("return", summary);
2857
+ summary = _context25.sent;
2858
+ return _context25.abrupt("return", summary);
2715
2859
  case 9:
2716
- _context24.prev = 9;
2717
- _context24.t0 = _context24["catch"](0);
2718
- throw _context24.t0;
2860
+ _context25.prev = 9;
2861
+ _context25.t0 = _context25["catch"](0);
2862
+ throw _context25.t0;
2719
2863
  case 12:
2720
2864
  case "end":
2721
- return _context24.stop();
2865
+ return _context25.stop();
2722
2866
  }
2723
- }, _callee24, this, [[0, 9]]);
2867
+ }, _callee25, this, [[0, 9]]);
2724
2868
  }));
2725
2869
  function getSummary() {
2726
2870
  return _getSummary.apply(this, arguments);
@@ -2730,10 +2874,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2730
2874
  }, {
2731
2875
  key: "getHistoricalProductDiscountList",
2732
2876
  value: function getHistoricalProductDiscountList(products) {
2733
- var _this13 = this;
2877
+ var _this14 = this;
2734
2878
  var historyDiscountList = [];
2735
2879
  products.forEach(function (item) {
2736
- if (!_this13.isPersistedOrderProduct(item)) return;
2880
+ if (!_this14.isPersistedOrderProduct(item)) return;
2737
2881
  (item.discount_list || []).forEach(function (discount) {
2738
2882
  var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
2739
2883
  var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
@@ -2793,11 +2937,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2793
2937
  }, {
2794
2938
  key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
2795
2939
  value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
2796
- var _this14 = this;
2940
+ var _this15 = this;
2797
2941
  if (params.discountAction !== 'edit') return false;
2798
2942
  if (!params.products.length) return false;
2799
2943
  var hasDraftProduct = params.products.some(function (product) {
2800
- return !_this14.isPersistedOrderProduct(product);
2944
+ return !_this15.isPersistedOrderProduct(product);
2801
2945
  });
2802
2946
  if (hasDraftProduct) return false;
2803
2947
 
@@ -2859,31 +3003,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2859
3003
  }, {
2860
3004
  key: "getDiscountConfigOrderIdentityKey",
2861
3005
  value: function getDiscountConfigOrderIdentityKey(tempOrder) {
2862
- var _this$store$order4, _this$store$order4$ge, _ref42, _identity$orderId, _tempOrder$request_un, _ref43, _identity$externalSal, _ref44, _ref45, _identity$localId, _tempOrder$_extend3;
2863
- var identity = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || (_this$store$order4$ge = _this$store$order4.getOrderIdentity) === null || _this$store$order4$ge === void 0 ? void 0 : _this$store$order4$ge.call(_this$store$order4);
3006
+ var _this$store$order6, _this$store$order6$ge, _ref42, _identity$orderId, _tempOrder$request_un, _ref43, _identity$externalSal, _ref44, _ref45, _identity$localId, _tempOrder$_extend3;
3007
+ var identity = (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$ge = _this$store$order6.getOrderIdentity) === null || _this$store$order6$ge === void 0 ? void 0 : _this$store$order6$ge.call(_this$store$order6);
2864
3008
  return JSON.stringify([(_ref42 = (_identity$orderId = identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _identity$orderId !== void 0 ? _identity$orderId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _ref42 !== void 0 ? _ref42 : '', (_tempOrder$request_un = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.request_unique_idempotency_token) !== null && _tempOrder$request_un !== void 0 ? _tempOrder$request_un : '', (_ref43 = (_identity$externalSal = identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) !== null && _identity$externalSal !== void 0 ? _identity$externalSal : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) !== null && _ref43 !== void 0 ? _ref43 : '', (_ref44 = (_ref45 = (_identity$localId = identity === null || identity === void 0 ? void 0 : identity.localId) !== null && _identity$localId !== void 0 ? _identity$localId : tempOrder === null || tempOrder === void 0 || (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.localId) !== null && _ref45 !== void 0 ? _ref45 : this.cacheId) !== null && _ref44 !== void 0 ? _ref44 : '']);
2865
3009
  }
2866
3010
  }, {
2867
3011
  key: "loadDiscountConfig",
2868
3012
  value: function () {
2869
- var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
3013
+ var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2870
3014
  var _this$store$order$get2,
2871
- _this$store$order5,
3015
+ _this$store$order7,
2872
3016
  _tempOrder$customer2,
2873
3017
  _tempOrder$_extend4,
2874
3018
  _tempOrder$_extend5,
2875
3019
  _discountModule$getDi,
2876
3020
  _discountModule$getOr,
2877
3021
  _this$store$order$get3,
2878
- _this$store$order6,
2879
- _this15 = this,
3022
+ _this$store$order8,
3023
+ _this16 = this,
2880
3024
  _discountModule$getDi3;
2881
- 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$order7, _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;
2882
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2883
- while (1) switch (_context25.prev = _context25.next) {
3025
+ 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$order9, _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;
3026
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3027
+ while (1) switch (_context26.prev = _context26.next) {
2884
3028
  case 0:
2885
3029
  if (this.store.order) {
2886
- _context25.next = 2;
3030
+ _context26.next = 2;
2887
3031
  break;
2888
3032
  }
2889
3033
  throw new Error('order 模块未初始化');
@@ -2892,7 +3036,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2892
3036
  orderStore = this.store.order.store || {};
2893
3037
  discountModule = orderStore.discount;
2894
3038
  rulesModule = orderStore.rules;
2895
- orderId = tempOrder.order_id || ((_this$store$order$get2 = (_this$store$order5 = this.store.order).getOrderIdentity) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.call(_this$store$order5)) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2.orderId);
3039
+ orderId = tempOrder.order_id || ((_this$store$order$get2 = (_this$store$order7 = this.store.order).getOrderIdentity) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.call(_this$store$order7)) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2.orderId);
2896
3040
  customerId = Number((params === null || params === void 0 ? void 0 : params.customerId) || tempOrder.customer_id || ((_tempOrder$customer2 = tempOrder.customer) === null || _tempOrder$customer2 === void 0 ? void 0 : _tempOrder$customer2.id) || ((_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.customerSnapshot) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.id) || ((_tempOrder$_extend5 = tempOrder._extend) === null || _tempOrder$_extend5 === void 0 || (_tempOrder$_extend5 = _tempOrder$_extend5.customerSnapshot) === null || _tempOrder$_extend5 === void 0 ? void 0 : _tempOrder$_extend5.customer_id) || 0);
2897
3041
  currentDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [];
2898
3042
  originalDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || [];
@@ -2902,20 +3046,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2902
3046
  discountAction = (params === null || params === void 0 ? void 0 : params.action) || (orderId ? 'edit' : 'create');
2903
3047
  requestOrderIdentityKey = this.getDiscountConfigOrderIdentityKey(tempOrder);
2904
3048
  discountConfigCacheKey = JSON.stringify([customerId, discountAction, Number(orderId) || 0, requestOrderIdentityKey]);
2905
- requestEpoch = (_this$store$order$get3 = (_this$store$order6 = this.store.order).getCustomerWalletPrepareConfigEpoch) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order6);
3049
+ requestEpoch = (_this$store$order$get3 = (_this$store$order8 = this.store.order).getCustomerWalletPrepareConfigEpoch) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order8);
2906
3050
  isCurrentRequest = function isCurrentRequest() {
2907
- var _this15$store$order, _this15$store$order$g, _this15$store$order2, _this15$store$order2$;
2908
- var currentTempOrder = (_this15$store$order = _this15.store.order) === null || _this15$store$order === void 0 || (_this15$store$order$g = _this15$store$order.getTempOrder) === null || _this15$store$order$g === void 0 ? void 0 : _this15$store$order$g.call(_this15$store$order);
2909
- return Boolean(currentTempOrder && (requestEpoch === undefined || ((_this15$store$order2 = _this15.store.order) === null || _this15$store$order2 === void 0 || (_this15$store$order2$ = _this15$store$order2.getCustomerWalletPrepareConfigEpoch) === null || _this15$store$order2$ === void 0 ? void 0 : _this15$store$order2$.call(_this15$store$order2)) === requestEpoch) && _this15.resolveDiscountConfigCustomerId(currentTempOrder) === customerId && _this15.getDiscountConfigOrderIdentityKey(currentTempOrder) === requestOrderIdentityKey);
3051
+ var _this16$store$order, _this16$store$order$g, _this16$store$order2, _this16$store$order2$;
3052
+ var currentTempOrder = (_this16$store$order = _this16.store.order) === null || _this16$store$order === void 0 || (_this16$store$order$g = _this16$store$order.getTempOrder) === null || _this16$store$order$g === void 0 ? void 0 : _this16$store$order$g.call(_this16$store$order);
3053
+ return Boolean(currentTempOrder && (requestEpoch === undefined || ((_this16$store$order2 = _this16.store.order) === null || _this16$store$order2 === void 0 || (_this16$store$order2$ = _this16$store$order2.getCustomerWalletPrepareConfigEpoch) === null || _this16$store$order2$ === void 0 ? void 0 : _this16$store$order2$.call(_this16$store$order2)) === requestEpoch) && _this16.resolveDiscountConfigCustomerId(currentTempOrder) === customerId && _this16.getDiscountConfigOrderIdentityKey(currentTempOrder) === requestOrderIdentityKey);
2910
3054
  };
2911
3055
  getCurrentResult = function getCurrentResult() {
2912
- var _this15$store$order3, _this15$store$order3$, _discountModule$getDi2;
2913
- var currentTempOrder = (_this15$store$order3 = _this15.store.order) === null || _this15$store$order3 === void 0 || (_this15$store$order3$ = _this15$store$order3.getTempOrder) === null || _this15$store$order3$ === void 0 ? void 0 : _this15$store$order3$.call(_this15$store$order3);
3056
+ var _this16$store$order3, _this16$store$order3$, _discountModule$getDi2;
3057
+ var currentTempOrder = (_this16$store$order3 = _this16.store.order) === null || _this16$store$order3 === void 0 || (_this16$store$order3$ = _this16$store$order3.getTempOrder) === null || _this16$store$order3$ === void 0 ? void 0 : _this16$store$order3$.call(_this16$store$order3);
2914
3058
  return {
2915
3059
  productList: (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.products) || [],
2916
3060
  discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi2 = discountModule.getDiscountList) === null || _discountModule$getDi2 === void 0 ? void 0 : _discountModule$getDi2.call(discountModule)) || [],
2917
- availableWalletIds: _this15.getAvailableWalletIds(),
2918
- virtualCurrencyList: _this15.getVirtualCurrencyList()
3061
+ availableWalletIds: _this16.getAvailableWalletIds(),
3062
+ virtualCurrencyList: _this16.getVirtualCurrencyList()
2919
3063
  };
2920
3064
  }; // Walk-In 不请求 prepare config;当前搜索/扫码券必须继续参与本次重算。
2921
3065
  // current 优先于 original,保留搜索后的最新选择与可用状态。
@@ -2929,15 +3073,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2929
3073
  return !searchedDiscountIds.has(String(discount.id));
2930
3074
  })));
2931
3075
  if (!(customerId && customerId !== 1)) {
2932
- _context25.next = 37;
3076
+ _context26.next = 37;
2933
3077
  break;
2934
3078
  }
2935
3079
  if (!(!(params !== null && params !== void 0 && params.force) && this.discountConfigCacheKey === discountConfigCacheKey)) {
2936
- _context25.next = 25;
3080
+ _context26.next = 25;
2937
3081
  break;
2938
3082
  }
2939
3083
  preparedDiscountList = originalDiscountList;
2940
- _context25.next = 37;
3084
+ _context26.next = 37;
2941
3085
  break;
2942
3086
  case 25:
2943
3087
  prepareConfigPromise = this.store.order.loadDiscountConfig({
@@ -2946,59 +3090,59 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2946
3090
  orderId: Number(orderId) || undefined,
2947
3091
  apply: false
2948
3092
  }); // OrderModule increments this epoch synchronously before its first await.
2949
- requestEpoch = (_this$store$order$get4 = (_this$store$order7 = this.store.order).getCustomerWalletPrepareConfigEpoch) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order7);
2950
- _context25.next = 29;
3093
+ requestEpoch = (_this$store$order$get4 = (_this$store$order9 = this.store.order).getCustomerWalletPrepareConfigEpoch) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order9);
3094
+ _context26.next = 29;
2951
3095
  return prepareConfigPromise;
2952
3096
  case 29:
2953
- preparedDiscountList = _context25.sent;
3097
+ preparedDiscountList = _context26.sent;
2954
3098
  if (isCurrentRequest()) {
2955
- _context25.next = 32;
3099
+ _context26.next = 32;
2956
3100
  break;
2957
3101
  }
2958
- return _context25.abrupt("return", getCurrentResult());
3102
+ return _context26.abrupt("return", getCurrentResult());
2959
3103
  case 32:
2960
- _context25.next = 34;
3104
+ _context26.next = 34;
2961
3105
  return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
2962
3106
  case 34:
2963
3107
  if (isCurrentRequest()) {
2964
- _context25.next = 36;
3108
+ _context26.next = 36;
2965
3109
  break;
2966
3110
  }
2967
- return _context25.abrupt("return", getCurrentResult());
3111
+ return _context26.abrupt("return", getCurrentResult());
2968
3112
  case 36:
2969
3113
  this.discountConfigCacheKey = discountConfigCacheKey;
2970
3114
  case 37:
2971
3115
  if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
2972
- _context25.next = 51;
3116
+ _context26.next = 51;
2973
3117
  break;
2974
3118
  }
2975
3119
  if (isCurrentRequest()) {
2976
- _context25.next = 40;
3120
+ _context26.next = 40;
2977
3121
  break;
2978
3122
  }
2979
- return _context25.abrupt("return", getCurrentResult());
3123
+ return _context26.abrupt("return", getCurrentResult());
2980
3124
  case 40:
2981
- _context25.next = 42;
3125
+ _context26.next = 42;
2982
3126
  return discountModule === null || discountModule === void 0 || (_discountModule$setOr2 = discountModule.setOriginalDiscountList) === null || _discountModule$setOr2 === void 0 ? void 0 : _discountModule$setOr2.call(discountModule, []);
2983
3127
  case 42:
2984
3128
  if (isCurrentRequest()) {
2985
- _context25.next = 44;
3129
+ _context26.next = 44;
2986
3130
  break;
2987
3131
  }
2988
- return _context25.abrupt("return", getCurrentResult());
3132
+ return _context26.abrupt("return", getCurrentResult());
2989
3133
  case 44:
2990
- _context25.next = 46;
3134
+ _context26.next = 46;
2991
3135
  return discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []);
2992
3136
  case 46:
2993
3137
  if (isCurrentRequest()) {
2994
- _context25.next = 48;
3138
+ _context26.next = 48;
2995
3139
  break;
2996
3140
  }
2997
- return _context25.abrupt("return", getCurrentResult());
3141
+ return _context26.abrupt("return", getCurrentResult());
2998
3142
  case 48:
2999
3143
  tempOrder.discount_list = [];
3000
3144
  tempOrder.shop_discount = '0.00';
3001
- return _context25.abrupt("return", {
3145
+ return _context26.abrupt("return", {
3002
3146
  productList: tempOrder.products || [],
3003
3147
  discountList: [],
3004
3148
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3006,10 +3150,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3006
3150
  });
3007
3151
  case 51:
3008
3152
  if (!(hasManualDiscountSelection && currentDiscountList.length)) {
3009
- _context25.next = 53;
3153
+ _context26.next = 53;
3010
3154
  break;
3011
3155
  }
3012
- return _context25.abrupt("return", {
3156
+ return _context26.abrupt("return", {
3013
3157
  productList: tempOrder.products || [],
3014
3158
  discountList: currentDiscountList,
3015
3159
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3019,19 +3163,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3019
3163
  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 || []);
3020
3164
  nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
3021
3165
  if (isCurrentRequest()) {
3022
- _context25.next = 57;
3166
+ _context26.next = 57;
3023
3167
  break;
3024
3168
  }
3025
- return _context25.abrupt("return", getCurrentResult());
3169
+ return _context26.abrupt("return", getCurrentResult());
3026
3170
  case 57:
3027
- _context25.next = 59;
3171
+ _context26.next = 59;
3028
3172
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3029
3173
  case 59:
3030
3174
  if (isCurrentRequest()) {
3031
- _context25.next = 61;
3175
+ _context26.next = 61;
3032
3176
  break;
3033
3177
  }
3034
- return _context25.abrupt("return", getCurrentResult());
3178
+ return _context26.abrupt("return", getCurrentResult());
3035
3179
  case 61:
3036
3180
  shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
3037
3181
  discountAction: discountAction,
@@ -3040,28 +3184,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3040
3184
  nextDiscountList: nextDiscountList
3041
3185
  });
3042
3186
  if (!shouldSkipAutoApplyFetchedDiscounts) {
3043
- _context25.next = 75;
3187
+ _context26.next = 75;
3044
3188
  break;
3045
3189
  }
3046
- _context25.next = 65;
3190
+ _context26.next = 65;
3047
3191
  return this.store.order.recalculateSummary({
3048
3192
  createIfMissing: true
3049
3193
  });
3050
3194
  case 65:
3051
3195
  if (isCurrentRequest()) {
3052
- _context25.next = 67;
3196
+ _context26.next = 67;
3053
3197
  break;
3054
3198
  }
3055
- return _context25.abrupt("return", getCurrentResult());
3199
+ return _context26.abrupt("return", getCurrentResult());
3056
3200
  case 67:
3057
3201
  this.store.order.persistTempOrder();
3058
3202
  if (isCurrentRequest()) {
3059
- _context25.next = 70;
3203
+ _context26.next = 70;
3060
3204
  break;
3061
3205
  }
3062
- return _context25.abrupt("return", getCurrentResult());
3206
+ return _context26.abrupt("return", getCurrentResult());
3063
3207
  case 70:
3064
- _context25.next = 72;
3208
+ _context26.next = 72;
3065
3209
  return this.effectsEmit('onDiscountApplied', {
3066
3210
  productList: tempOrder.products || [],
3067
3211
  discountList: nextDiscountList,
@@ -3070,12 +3214,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3070
3214
  });
3071
3215
  case 72:
3072
3216
  if (isCurrentRequest()) {
3073
- _context25.next = 74;
3217
+ _context26.next = 74;
3074
3218
  break;
3075
3219
  }
3076
- return _context25.abrupt("return", getCurrentResult());
3220
+ return _context26.abrupt("return", getCurrentResult());
3077
3221
  case 74:
3078
- return _context25.abrupt("return", {
3222
+ return _context26.abrupt("return", {
3079
3223
  productList: tempOrder.products || [],
3080
3224
  discountList: nextDiscountList,
3081
3225
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3083,14 +3227,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3083
3227
  });
3084
3228
  case 75:
3085
3229
  if (!rulesModule) {
3086
- _context25.next = 117;
3230
+ _context26.next = 117;
3087
3231
  break;
3088
3232
  }
3089
3233
  if (isCurrentRequest()) {
3090
- _context25.next = 78;
3234
+ _context26.next = 78;
3091
3235
  break;
3092
3236
  }
3093
- return _context25.abrupt("return", getCurrentResult());
3237
+ return _context26.abrupt("return", getCurrentResult());
3094
3238
  case 78:
3095
3239
  orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
3096
3240
  result = rulesModule.calcDiscount({
@@ -3109,21 +3253,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3109
3253
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
3110
3254
  }
3111
3255
  _iterator3 = _createForOfIteratorHelper(tempOrder.products || []);
3112
- _context25.prev = 82;
3256
+ _context26.prev = 82;
3113
3257
  _iterator3.s();
3114
3258
  case 84:
3115
3259
  if ((_step3 = _iterator3.n()).done) {
3116
- _context25.next = 99;
3260
+ _context26.next = 99;
3117
3261
  break;
3118
3262
  }
3119
3263
  product = _step3.value;
3120
3264
  productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
3121
3265
  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;
3122
3266
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
3123
- _context25.next = 90;
3267
+ _context26.next = 90;
3124
3268
  break;
3125
3269
  }
3126
- return _context25.abrupt("continue", 97);
3270
+ return _context26.abrupt("continue", 97);
3127
3271
  case 90:
3128
3272
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
3129
3273
  return sum + Number(pd.amount || 0);
@@ -3141,70 +3285,70 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3141
3285
  bundle: product.product_bundle
3142
3286
  });
3143
3287
  case 97:
3144
- _context25.next = 84;
3288
+ _context26.next = 84;
3145
3289
  break;
3146
3290
  case 99:
3147
- _context25.next = 104;
3291
+ _context26.next = 104;
3148
3292
  break;
3149
3293
  case 101:
3150
- _context25.prev = 101;
3151
- _context25.t0 = _context25["catch"](82);
3152
- _iterator3.e(_context25.t0);
3294
+ _context26.prev = 101;
3295
+ _context26.t0 = _context26["catch"](82);
3296
+ _iterator3.e(_context26.t0);
3153
3297
  case 104:
3154
- _context25.prev = 104;
3298
+ _context26.prev = 104;
3155
3299
  _iterator3.f();
3156
- return _context25.finish(104);
3300
+ return _context26.finish(104);
3157
3301
  case 107:
3158
3302
  if (!result.discountList) {
3159
- _context25.next = 117;
3303
+ _context26.next = 117;
3160
3304
  break;
3161
3305
  }
3162
3306
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
3163
3307
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
3164
3308
  if (isCurrentRequest()) {
3165
- _context25.next = 112;
3309
+ _context26.next = 112;
3166
3310
  break;
3167
3311
  }
3168
- return _context25.abrupt("return", getCurrentResult());
3312
+ return _context26.abrupt("return", getCurrentResult());
3169
3313
  case 112:
3170
- _context25.next = 114;
3314
+ _context26.next = 114;
3171
3315
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3172
3316
  case 114:
3173
3317
  if (isCurrentRequest()) {
3174
- _context25.next = 116;
3318
+ _context26.next = 116;
3175
3319
  break;
3176
3320
  }
3177
- return _context25.abrupt("return", getCurrentResult());
3321
+ return _context26.abrupt("return", getCurrentResult());
3178
3322
  case 116:
3179
3323
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
3180
3324
  return discount.isSelected;
3181
3325
  });
3182
3326
  case 117:
3183
3327
  if (isCurrentRequest()) {
3184
- _context25.next = 119;
3328
+ _context26.next = 119;
3185
3329
  break;
3186
3330
  }
3187
- return _context25.abrupt("return", getCurrentResult());
3331
+ return _context26.abrupt("return", getCurrentResult());
3188
3332
  case 119:
3189
- _context25.next = 121;
3333
+ _context26.next = 121;
3190
3334
  return this.store.order.recalculateSummary({
3191
3335
  createIfMissing: true
3192
3336
  });
3193
3337
  case 121:
3194
3338
  if (isCurrentRequest()) {
3195
- _context25.next = 123;
3339
+ _context26.next = 123;
3196
3340
  break;
3197
3341
  }
3198
- return _context25.abrupt("return", getCurrentResult());
3342
+ return _context26.abrupt("return", getCurrentResult());
3199
3343
  case 123:
3200
3344
  this.store.order.persistTempOrder();
3201
3345
  if (isCurrentRequest()) {
3202
- _context25.next = 126;
3346
+ _context26.next = 126;
3203
3347
  break;
3204
3348
  }
3205
- return _context25.abrupt("return", getCurrentResult());
3349
+ return _context26.abrupt("return", getCurrentResult());
3206
3350
  case 126:
3207
- _context25.next = 128;
3351
+ _context26.next = 128;
3208
3352
  return this.effectsEmit('onDiscountApplied', {
3209
3353
  productList: tempOrder.products || [],
3210
3354
  discountList: nextDiscountList,
@@ -3213,12 +3357,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3213
3357
  });
3214
3358
  case 128:
3215
3359
  if (isCurrentRequest()) {
3216
- _context25.next = 130;
3360
+ _context26.next = 130;
3217
3361
  break;
3218
3362
  }
3219
- return _context25.abrupt("return", getCurrentResult());
3363
+ return _context26.abrupt("return", getCurrentResult());
3220
3364
  case 130:
3221
- return _context25.abrupt("return", {
3365
+ return _context26.abrupt("return", {
3222
3366
  productList: tempOrder.products || [],
3223
3367
  discountList: nextDiscountList,
3224
3368
  availableWalletIds: this.getAvailableWalletIds(),
@@ -3226,11 +3370,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3226
3370
  });
3227
3371
  case 131:
3228
3372
  case "end":
3229
- return _context25.stop();
3373
+ return _context26.stop();
3230
3374
  }
3231
- }, _callee25, this, [[82, 101, 104, 107]]);
3375
+ }, _callee26, this, [[82, 101, 104, 107]]);
3232
3376
  }));
3233
- function loadDiscountConfig(_x17) {
3377
+ function loadDiscountConfig(_x18) {
3234
3378
  return _loadDiscountConfig.apply(this, arguments);
3235
3379
  }
3236
3380
  return loadDiscountConfig;
@@ -3238,35 +3382,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3238
3382
  }, {
3239
3383
  key: "getAvailableWalletIds",
3240
3384
  value: function getAvailableWalletIds() {
3241
- var _this$store$order8;
3242
- if (!((_this$store$order8 = this.store.order) !== null && _this$store$order8 !== void 0 && _this$store$order8.getAvailableWalletIds)) return [];
3385
+ var _this$store$order10;
3386
+ if (!((_this$store$order10 = this.store.order) !== null && _this$store$order10 !== void 0 && _this$store$order10.getAvailableWalletIds)) return [];
3243
3387
  return this.store.order.getAvailableWalletIds();
3244
3388
  }
3245
3389
  }, {
3246
3390
  key: "getVirtualCurrencyList",
3247
3391
  value: function getVirtualCurrencyList() {
3248
- var _this$store$order9;
3249
- if (!((_this$store$order9 = this.store.order) !== null && _this$store$order9 !== void 0 && _this$store$order9.getVirtualCurrencyList)) return [];
3392
+ var _this$store$order11;
3393
+ if (!((_this$store$order11 = this.store.order) !== null && _this$store$order11 !== void 0 && _this$store$order11.getVirtualCurrencyList)) return [];
3250
3394
  return this.store.order.getVirtualCurrencyList();
3251
3395
  }
3252
3396
  }, {
3253
3397
  key: "bestDiscount",
3254
3398
  value: function () {
3255
- var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(cb) {
3399
+ var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(cb) {
3256
3400
  var _discountModule$getOr2, _discountModule$getDi4;
3257
3401
  var tempOrder, _result2, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _orderStore$summary2, orderTotalAmount;
3258
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3259
- while (1) switch (_context26.prev = _context26.next) {
3402
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3403
+ while (1) switch (_context27.prev = _context27.next) {
3260
3404
  case 0:
3261
3405
  if (this.store.order) {
3262
- _context26.next = 2;
3406
+ _context27.next = 2;
3263
3407
  break;
3264
3408
  }
3265
3409
  throw new Error('order 模块未初始化');
3266
3410
  case 2:
3267
3411
  tempOrder = this.store.order.ensureTempOrder();
3268
3412
  if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
3269
- _context26.next = 7;
3413
+ _context27.next = 7;
3270
3414
  break;
3271
3415
  }
3272
3416
  _result2 = {
@@ -3274,7 +3418,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3274
3418
  discountList: []
3275
3419
  };
3276
3420
  cb === null || cb === void 0 || cb(_result2);
3277
- return _context26.abrupt("return", _result2);
3421
+ return _context27.abrupt("return", _result2);
3278
3422
  case 7:
3279
3423
  orderStore = this.store.order.store || {};
3280
3424
  discountModule = orderStore.discount;
@@ -3286,11 +3430,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3286
3430
  productList: tempOrder.products || [],
3287
3431
  discountList: nextDiscountList
3288
3432
  };
3289
- _context26.next = 16;
3433
+ _context27.next = 16;
3290
3434
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3291
3435
  case 16:
3292
3436
  if (!rulesModule) {
3293
- _context26.next = 27;
3437
+ _context27.next = 27;
3294
3438
  break;
3295
3439
  }
3296
3440
  orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
@@ -3309,12 +3453,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3309
3453
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
3310
3454
  }
3311
3455
  if (!result.discountList) {
3312
- _context26.next = 27;
3456
+ _context27.next = 27;
3313
3457
  break;
3314
3458
  }
3315
3459
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
3316
3460
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
3317
- _context26.next = 25;
3461
+ _context27.next = 25;
3318
3462
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3319
3463
  case 25:
3320
3464
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
@@ -3325,13 +3469,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3325
3469
  discountList: nextDiscountList
3326
3470
  };
3327
3471
  case 27:
3328
- _context26.next = 29;
3472
+ _context27.next = 29;
3329
3473
  return this.store.order.recalculateSummary({
3330
3474
  createIfMissing: true
3331
3475
  });
3332
3476
  case 29:
3333
3477
  this.store.order.persistTempOrder();
3334
- _context26.next = 32;
3478
+ _context27.next = 32;
3335
3479
  return this.effectsEmit('onDiscountApplied', {
3336
3480
  productList: tempOrder.products || [],
3337
3481
  discountList: nextDiscountList,
@@ -3340,14 +3484,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3340
3484
  });
3341
3485
  case 32:
3342
3486
  cb === null || cb === void 0 || cb(result);
3343
- return _context26.abrupt("return", result);
3487
+ return _context27.abrupt("return", result);
3344
3488
  case 34:
3345
3489
  case "end":
3346
- return _context26.stop();
3490
+ return _context27.stop();
3347
3491
  }
3348
- }, _callee26, this);
3492
+ }, _callee27, this);
3349
3493
  }));
3350
- function bestDiscount(_x18) {
3494
+ function bestDiscount(_x19) {
3351
3495
  return _bestDiscount.apply(this, arguments);
3352
3496
  }
3353
3497
  return bestDiscount;
@@ -3376,41 +3520,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3376
3520
  }, {
3377
3521
  key: "replaceDiscountStoreLists",
3378
3522
  value: (function () {
3379
- var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3523
+ var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3380
3524
  var _store2;
3381
3525
  var discountModule;
3382
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3383
- while (1) switch (_context27.prev = _context27.next) {
3526
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3527
+ while (1) switch (_context28.prev = _context28.next) {
3384
3528
  case 0:
3385
3529
  if (this.store.order) {
3386
- _context27.next = 2;
3530
+ _context28.next = 2;
3387
3531
  break;
3388
3532
  }
3389
3533
  throw new Error('order 模块未初始化');
3390
3534
  case 2:
3391
3535
  discountModule = (_store2 = this.store.order.store) === null || _store2 === void 0 ? void 0 : _store2.discount;
3392
3536
  if (discountModule) {
3393
- _context27.next = 5;
3537
+ _context28.next = 5;
3394
3538
  break;
3395
3539
  }
3396
- return _context27.abrupt("return");
3540
+ return _context28.abrupt("return");
3397
3541
  case 5:
3398
3542
  if (!params.originalDiscountList) {
3399
- _context27.next = 8;
3543
+ _context28.next = 8;
3400
3544
  break;
3401
3545
  }
3402
- _context27.next = 8;
3546
+ _context28.next = 8;
3403
3547
  return discountModule.setOriginalDiscountList(params.originalDiscountList);
3404
3548
  case 8:
3405
- _context27.next = 10;
3549
+ _context28.next = 10;
3406
3550
  return discountModule.setDiscountList(params.discountList);
3407
3551
  case 10:
3408
3552
  case "end":
3409
- return _context27.stop();
3553
+ return _context28.stop();
3410
3554
  }
3411
- }, _callee27, this);
3555
+ }, _callee28, this);
3412
3556
  }));
3413
- function replaceDiscountStoreLists(_x19) {
3557
+ function replaceDiscountStoreLists(_x20) {
3414
3558
  return _replaceDiscountStoreLists.apply(this, arguments);
3415
3559
  }
3416
3560
  return replaceDiscountStoreLists;
@@ -3418,34 +3562,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3418
3562
  }, {
3419
3563
  key: "scanPromotionCode",
3420
3564
  value: function () {
3421
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(code, customerId) {
3565
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(code, customerId) {
3422
3566
  var raw, tempOrder;
3423
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3424
- while (1) switch (_context28.prev = _context28.next) {
3567
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3568
+ while (1) switch (_context29.prev = _context29.next) {
3425
3569
  case 0:
3426
- _context28.prev = 0;
3570
+ _context29.prev = 0;
3427
3571
  if (this.store.order) {
3428
- _context28.next = 3;
3572
+ _context29.next = 3;
3429
3573
  break;
3430
3574
  }
3431
3575
  throw new Error('order 模块未初始化');
3432
3576
  case 3:
3433
- _context28.next = 5;
3577
+ _context29.next = 5;
3434
3578
  return this.store.order.scanCode(code, customerId);
3435
3579
  case 5:
3436
- raw = _context28.sent;
3580
+ raw = _context29.sent;
3437
3581
  if (!raw.isAvailable) {
3438
- _context28.next = 13;
3582
+ _context29.next = 13;
3439
3583
  break;
3440
3584
  }
3441
- _context28.next = 9;
3585
+ _context29.next = 9;
3442
3586
  return this.store.order.recalculateSummary({
3443
3587
  createIfMissing: true
3444
3588
  });
3445
3589
  case 9:
3446
3590
  this.store.order.persistTempOrder();
3447
3591
  tempOrder = this.store.order.ensureTempOrder();
3448
- _context28.next = 13;
3592
+ _context29.next = 13;
3449
3593
  return this.effectsEmit('onDiscountApplied', {
3450
3594
  productList: tempOrder.products || [],
3451
3595
  discountList: this.store.order.getDiscountList(),
@@ -3453,7 +3597,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3453
3597
  tempOrder: tempOrder
3454
3598
  });
3455
3599
  case 13:
3456
- return _context28.abrupt("return", _objectSpread(_objectSpread({
3600
+ return _context29.abrupt("return", _objectSpread(_objectSpread({
3457
3601
  isAvailable: raw.isAvailable
3458
3602
  }, raw.isAccepted !== undefined ? {
3459
3603
  isAccepted: raw.isAccepted
@@ -3463,16 +3607,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3463
3607
  scannedDiscountList: raw.scannedDiscountList
3464
3608
  }));
3465
3609
  case 16:
3466
- _context28.prev = 16;
3467
- _context28.t0 = _context28["catch"](0);
3468
- throw _context28.t0;
3610
+ _context29.prev = 16;
3611
+ _context29.t0 = _context29["catch"](0);
3612
+ throw _context29.t0;
3469
3613
  case 19:
3470
3614
  case "end":
3471
- return _context28.stop();
3615
+ return _context29.stop();
3472
3616
  }
3473
- }, _callee28, this, [[0, 16]]);
3617
+ }, _callee29, this, [[0, 16]]);
3474
3618
  }));
3475
- function scanPromotionCode(_x20, _x21) {
3619
+ function scanPromotionCode(_x21, _x22) {
3476
3620
  return _scanPromotionCode.apply(this, arguments);
3477
3621
  }
3478
3622
  return scanPromotionCode;
@@ -3480,35 +3624,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3480
3624
  }, {
3481
3625
  key: "setDiscountSelected",
3482
3626
  value: function () {
3483
- var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3627
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
3484
3628
  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;
3485
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3486
- while (1) switch (_context29.prev = _context29.next) {
3629
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3630
+ while (1) switch (_context30.prev = _context30.next) {
3487
3631
  case 0:
3488
- _context29.prev = 0;
3632
+ _context30.prev = 0;
3489
3633
  if (this.store.order) {
3490
- _context29.next = 3;
3634
+ _context30.next = 3;
3491
3635
  break;
3492
3636
  }
3493
3637
  throw new Error('order 模块未初始化');
3494
3638
  case 3:
3495
3639
  currentOrder = this.store.order.ensureTempOrder();
3496
3640
  if (!this.isActiveVirtualSettlementOrder(currentOrder)) {
3497
- _context29.next = 13;
3641
+ _context30.next = 13;
3498
3642
  break;
3499
3643
  }
3500
3644
  currentOrder.discount_list = [];
3501
3645
  currentOrder.shop_discount = '0.00';
3502
- _context29.next = 9;
3646
+ _context30.next = 9;
3503
3647
  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, []);
3504
3648
  case 9:
3505
- _context29.next = 11;
3649
+ _context30.next = 11;
3506
3650
  return this.store.order.recalculateSummary({
3507
3651
  createIfMissing: true
3508
3652
  });
3509
3653
  case 11:
3510
3654
  this.store.order.persistTempOrder();
3511
- return _context29.abrupt("return");
3655
+ return _context30.abrupt("return");
3512
3656
  case 13:
3513
3657
  list = this.store.order.getDiscountList();
3514
3658
  updated = list.map(function (d) {
@@ -3523,7 +3667,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3523
3667
  _discountModule = orderStore.discount;
3524
3668
  rulesModule = orderStore.rules;
3525
3669
  nextDiscountList = updated;
3526
- _context29.next = 23;
3670
+ _context30.next = 23;
3527
3671
  return _discountModule === null || _discountModule === void 0 ? void 0 : _discountModule.setDiscountList(updated);
3528
3672
  case 23:
3529
3673
  if (rulesModule) {
@@ -3585,21 +3729,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3585
3729
  });
3586
3730
  };
3587
3731
  _iterator5 = _createForOfIteratorHelper(tempOrder.products);
3588
- _context29.prev = 27;
3732
+ _context30.prev = 27;
3589
3733
  _iterator5.s();
3590
3734
  case 29:
3591
3735
  if ((_step5 = _iterator5.n()).done) {
3592
- _context29.next = 46;
3736
+ _context30.next = 46;
3593
3737
  break;
3594
3738
  }
3595
3739
  product = _step5.value;
3596
3740
  productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
3597
3741
  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;
3598
3742
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
3599
- _context29.next = 35;
3743
+ _context30.next = 35;
3600
3744
  break;
3601
3745
  }
3602
- return _context29.abrupt("continue", 44);
3746
+ return _context30.abrupt("continue", 44);
3603
3747
  case 35:
3604
3748
  product.discount_list = filterSelectedDiscountDetails(product.discount_list);
3605
3749
  if (Array.isArray(product.product_bundle)) {
@@ -3635,28 +3779,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3635
3779
  bundle: product.product_bundle
3636
3780
  });
3637
3781
  case 44:
3638
- _context29.next = 29;
3782
+ _context30.next = 29;
3639
3783
  break;
3640
3784
  case 46:
3641
- _context29.next = 51;
3785
+ _context30.next = 51;
3642
3786
  break;
3643
3787
  case 48:
3644
- _context29.prev = 48;
3645
- _context29.t0 = _context29["catch"](27);
3646
- _iterator5.e(_context29.t0);
3788
+ _context30.prev = 48;
3789
+ _context30.t0 = _context30["catch"](27);
3790
+ _iterator5.e(_context30.t0);
3647
3791
  case 51:
3648
- _context29.prev = 51;
3792
+ _context30.prev = 51;
3649
3793
  _iterator5.f();
3650
- return _context29.finish(51);
3794
+ return _context30.finish(51);
3651
3795
  case 54:
3652
3796
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
3653
- _context29.next = 57;
3797
+ _context30.next = 57;
3654
3798
  return _discountModule === null || _discountModule === void 0 ? void 0 : _discountModule.setDiscountList(nextDiscountList);
3655
3799
  case 57:
3656
3800
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
3657
3801
  return d.isSelected;
3658
3802
  });
3659
- _context29.next = 60;
3803
+ _context30.next = 60;
3660
3804
  return this.store.order.recalculateSummary({
3661
3805
  createIfMissing: true
3662
3806
  });
@@ -3668,19 +3812,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3668
3812
  selectedDiscountList: tempOrder.discount_list,
3669
3813
  tempOrder: tempOrder
3670
3814
  });
3671
- _context29.next = 67;
3815
+ _context30.next = 67;
3672
3816
  break;
3673
3817
  case 64:
3674
- _context29.prev = 64;
3675
- _context29.t1 = _context29["catch"](0);
3676
- throw _context29.t1;
3818
+ _context30.prev = 64;
3819
+ _context30.t1 = _context30["catch"](0);
3820
+ throw _context30.t1;
3677
3821
  case 67:
3678
3822
  case "end":
3679
- return _context29.stop();
3823
+ return _context30.stop();
3680
3824
  }
3681
- }, _callee29, this, [[0, 64], [27, 48, 51, 54]]);
3825
+ }, _callee30, this, [[0, 64], [27, 48, 51, 54]]);
3682
3826
  }));
3683
- function setDiscountSelected(_x22) {
3827
+ function setDiscountSelected(_x23) {
3684
3828
  return _setDiscountSelected.apply(this, arguments);
3685
3829
  }
3686
3830
  return setDiscountSelected;
@@ -3688,23 +3832,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3688
3832
  }, {
3689
3833
  key: "applyDiscountCalculationResult",
3690
3834
  value: function () {
3691
- var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(result) {
3835
+ var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(result) {
3692
3836
  var tempOrder, orderStore, _discountModule2;
3693
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3694
- while (1) switch (_context30.prev = _context30.next) {
3837
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3838
+ while (1) switch (_context31.prev = _context31.next) {
3695
3839
  case 0:
3696
- _context30.prev = 0;
3840
+ _context31.prev = 0;
3697
3841
  if (this.store.order) {
3698
- _context30.next = 3;
3842
+ _context31.next = 3;
3699
3843
  break;
3700
3844
  }
3701
3845
  throw new Error('order 模块未初始化');
3702
3846
  case 3:
3703
3847
  if (result) {
3704
- _context30.next = 5;
3848
+ _context31.next = 5;
3705
3849
  break;
3706
3850
  }
3707
- return _context30.abrupt("return");
3851
+ return _context31.abrupt("return");
3708
3852
  case 5:
3709
3853
  tempOrder = this.store.order.ensureTempOrder();
3710
3854
  orderStore = this.store.order.store || {};
@@ -3713,24 +3857,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3713
3857
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
3714
3858
  }
3715
3859
  if (!result.discountList) {
3716
- _context30.next = 14;
3860
+ _context31.next = 14;
3717
3861
  break;
3718
3862
  }
3719
3863
  OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
3720
- _context30.next = 13;
3864
+ _context31.next = 13;
3721
3865
  return _discountModule2 === null || _discountModule2 === void 0 ? void 0 : _discountModule2.setDiscountList(result.discountList);
3722
3866
  case 13:
3723
3867
  tempOrder.discount_list = result.discountList.filter(function (discount) {
3724
3868
  return discount.isSelected;
3725
3869
  });
3726
3870
  case 14:
3727
- _context30.next = 16;
3871
+ _context31.next = 16;
3728
3872
  return this.store.order.recalculateSummary({
3729
3873
  createIfMissing: true
3730
3874
  });
3731
3875
  case 16:
3732
3876
  this.store.order.persistTempOrder();
3733
- _context30.next = 19;
3877
+ _context31.next = 19;
3734
3878
  return this.effectsEmit('onDiscountApplied', {
3735
3879
  productList: tempOrder.products || [],
3736
3880
  discountList: result.discountList || [],
@@ -3738,19 +3882,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3738
3882
  tempOrder: tempOrder
3739
3883
  });
3740
3884
  case 19:
3741
- _context30.next = 24;
3885
+ _context31.next = 24;
3742
3886
  break;
3743
3887
  case 21:
3744
- _context30.prev = 21;
3745
- _context30.t0 = _context30["catch"](0);
3746
- throw _context30.t0;
3888
+ _context31.prev = 21;
3889
+ _context31.t0 = _context31["catch"](0);
3890
+ throw _context31.t0;
3747
3891
  case 24:
3748
3892
  case "end":
3749
- return _context30.stop();
3893
+ return _context31.stop();
3750
3894
  }
3751
- }, _callee30, this, [[0, 21]]);
3895
+ }, _callee31, this, [[0, 21]]);
3752
3896
  }));
3753
- function applyDiscountCalculationResult(_x23) {
3897
+ function applyDiscountCalculationResult(_x24) {
3754
3898
  return _applyDiscountCalculationResult.apply(this, arguments);
3755
3899
  }
3756
3900
  return applyDiscountCalculationResult;
@@ -3758,18 +3902,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3758
3902
  }, {
3759
3903
  key: "submitScanOrder",
3760
3904
  value: function () {
3761
- var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3762
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3763
- while (1) switch (_context31.prev = _context31.next) {
3905
+ var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3906
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3907
+ while (1) switch (_context32.prev = _context32.next) {
3764
3908
  case 0:
3765
- return _context31.abrupt("return", this.submitSalesOrder(params));
3909
+ return _context32.abrupt("return", this.submitSalesOrder(params));
3766
3910
  case 1:
3767
3911
  case "end":
3768
- return _context31.stop();
3912
+ return _context32.stop();
3769
3913
  }
3770
- }, _callee31, this);
3914
+ }, _callee32, this);
3771
3915
  }));
3772
- function submitScanOrder(_x24) {
3916
+ function submitScanOrder(_x25) {
3773
3917
  return _submitScanOrder.apply(this, arguments);
3774
3918
  }
3775
3919
  return submitScanOrder;
@@ -3777,46 +3921,46 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3777
3921
  }, {
3778
3922
  key: "buildVirtualSettlementSubmitData",
3779
3923
  value: function () {
3780
- var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
3924
+ var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
3781
3925
  var _tempOrder$metadata$c, _tempOrder$metadata2;
3782
3926
  var tempOrder, snapshot, currencyProductId, summary, amount, customerId, asset, currencyCode, currencySymbol, currencyFormat, balance, amountText, paymentNumber, payment, _paymentMethod$custom, paymentMethods, paymentMethod;
3783
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3784
- while (1) switch (_context32.prev = _context32.next) {
3927
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3928
+ while (1) switch (_context33.prev = _context33.next) {
3785
3929
  case 0:
3786
3930
  if (this.store.order) {
3787
- _context32.next = 2;
3931
+ _context33.next = 2;
3788
3932
  break;
3789
3933
  }
3790
- return _context32.abrupt("return", null);
3934
+ return _context33.abrupt("return", null);
3791
3935
  case 2:
3792
3936
  tempOrder = this.store.order.getTempOrder();
3793
3937
  if (this.isActiveVirtualSettlementOrder(tempOrder)) {
3794
- _context32.next = 5;
3938
+ _context33.next = 5;
3795
3939
  break;
3796
3940
  }
3797
- return _context32.abrupt("return", null);
3941
+ return _context33.abrupt("return", null);
3798
3942
  case 5:
3799
3943
  snapshot = getTempOrderSettlementSnapshot(tempOrder);
3800
3944
  currencyProductId = Number((_tempOrder$metadata$c = tempOrder === null || tempOrder === void 0 || (_tempOrder$metadata2 = tempOrder.metadata) === null || _tempOrder$metadata2 === void 0 || (_tempOrder$metadata2 = _tempOrder$metadata2.currency_settlement_config) === null || _tempOrder$metadata2 === void 0 || (_tempOrder$metadata2 = _tempOrder$metadata2.settlement_ids) === null || _tempOrder$metadata2 === void 0 ? void 0 : _tempOrder$metadata2[0]) !== null && _tempOrder$metadata$c !== void 0 ? _tempOrder$metadata$c : snapshot === null || snapshot === void 0 ? void 0 : snapshot.currency_product_id);
3801
3945
  if (!(!snapshot || !Number.isFinite(currencyProductId) || currencyProductId <= 0)) {
3802
- _context32.next = 9;
3946
+ _context33.next = 9;
3803
3947
  break;
3804
3948
  }
3805
3949
  throw new Error('Virtual currency settlement configuration is invalid.');
3806
3950
  case 9:
3807
- _context32.next = 11;
3951
+ _context33.next = 11;
3808
3952
  return this.store.order.recalculateSummary({
3809
3953
  createIfMissing: true
3810
3954
  });
3811
3955
  case 11:
3812
- summary = _context32.sent;
3956
+ summary = _context33.sent;
3813
3957
  amount = new Decimal((summary === null || summary === void 0 ? void 0 : summary.total_amount) || 0).toDecimalPlaces(2);
3814
3958
  customerId = Number((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id) || 0);
3815
3959
  if (!(amount.gt(0) && customerId > 0 && customerId !== 1)) {
3816
- _context32.next = 17;
3960
+ _context33.next = 17;
3817
3961
  break;
3818
3962
  }
3819
- _context32.next = 17;
3963
+ _context33.next = 17;
3820
3964
  return this.store.order.loadDiscountConfig({
3821
3965
  customerId: customerId,
3822
3966
  action: tempOrder !== null && tempOrder !== void 0 && tempOrder.order_id ? 'edit' : 'create',
@@ -3831,10 +3975,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3831
3975
  currencySymbol = String((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.currency_symbol) || '');
3832
3976
  currencyFormat = String((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.currency_format) || 'symbol_first');
3833
3977
  if (!amount.lte(0)) {
3834
- _context32.next = 23;
3978
+ _context33.next = 23;
3835
3979
  break;
3836
3980
  }
3837
- return _context32.abrupt("return", {
3981
+ return _context33.abrupt("return", {
3838
3982
  payments: [],
3839
3983
  snapshot: snapshot,
3840
3984
  currencyProductId: currencyProductId,
@@ -3844,14 +3988,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3844
3988
  });
3845
3989
  case 23:
3846
3990
  if (asset) {
3847
- _context32.next = 25;
3991
+ _context33.next = 25;
3848
3992
  break;
3849
3993
  }
3850
3994
  throw new Error('No matching virtual currency card is available.');
3851
3995
  case 25:
3852
3996
  balance = new Decimal(asset.balance || 0);
3853
3997
  if (!balance.lt(amount)) {
3854
- _context32.next = 28;
3998
+ _context33.next = 28;
3855
3999
  break;
3856
4000
  }
3857
4001
  throw new Error('Insufficient virtual currency balance.');
@@ -3859,7 +4003,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3859
4003
  amountText = amount.toFixed(2);
3860
4004
  paymentNumber = "LOCAL_".concat(createUuidV4());
3861
4005
  if (!this.store.order.isOnlineStorePlatform()) {
3862
- _context32.next = 34;
4006
+ _context33.next = 34;
3863
4007
  break;
3864
4008
  }
3865
4009
  payment = {
@@ -3876,18 +4020,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3876
4020
  },
3877
4021
  wallet_pass_use_value: amountText
3878
4022
  };
3879
- _context32.next = 41;
4023
+ _context33.next = 41;
3880
4024
  break;
3881
4025
  case 34:
3882
- _context32.next = 36;
4026
+ _context33.next = 36;
3883
4027
  return this.getPaymentMethodsAsync();
3884
4028
  case 36:
3885
- paymentMethods = _context32.sent;
4029
+ paymentMethods = _context33.sent;
3886
4030
  paymentMethod = paymentMethods.find(function (method) {
3887
4031
  return String(method.code || '').toUpperCase() === 'PRODUCTVOUCHER';
3888
4032
  });
3889
4033
  if (paymentMethod) {
3890
- _context32.next = 40;
4034
+ _context33.next = 40;
3891
4035
  break;
3892
4036
  }
3893
4037
  throw new Error('PRODUCTVOUCHER payment method is unavailable.');
@@ -3911,7 +4055,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3911
4055
  metadata: {}
3912
4056
  };
3913
4057
  case 41:
3914
- return _context32.abrupt("return", {
4058
+ return _context33.abrupt("return", {
3915
4059
  payments: [payment],
3916
4060
  snapshot: snapshot,
3917
4061
  currencyProductId: currencyProductId,
@@ -3921,9 +4065,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3921
4065
  });
3922
4066
  case 42:
3923
4067
  case "end":
3924
- return _context32.stop();
4068
+ return _context33.stop();
3925
4069
  }
3926
- }, _callee32, this);
4070
+ }, _callee33, this);
3927
4071
  }));
3928
4072
  function buildVirtualSettlementSubmitData() {
3929
4073
  return _buildVirtualSettlementSubmitData.apply(this, arguments);
@@ -3939,22 +4083,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3939
4083
  }, {
3940
4084
  key: "submitSalesOrder",
3941
4085
  value: (function () {
3942
- var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3943
- var _params$smallTicketDa, _this$otherParams14, _this$otherParams15, _this$otherParams16, _this$otherParams17;
4086
+ var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
4087
+ var _params$smallTicketDa, _this$otherParams18, _this$otherParams19, _this$otherParams20, _this$otherParams21;
3944
4088
  var virtualSettlement, inferredPaymentStatus, smallTicketDataFlag, virtualSettlementEnhancePayload, enhancePayload, submitParams;
3945
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3946
- while (1) switch (_context33.prev = _context33.next) {
4089
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4090
+ while (1) switch (_context34.prev = _context34.next) {
3947
4091
  case 0:
3948
4092
  if (this.store.order) {
3949
- _context33.next = 2;
4093
+ _context34.next = 2;
3950
4094
  break;
3951
4095
  }
3952
4096
  throw new Error('BaseSales 解决方案需要 order 模块支持');
3953
4097
  case 2:
3954
- _context33.next = 4;
4098
+ if (!this.isPickupTimingEnabled()) {
4099
+ _context34.next = 5;
4100
+ break;
4101
+ }
4102
+ _context34.next = 5;
4103
+ return this.preparePickupTimingForCheckout({
4104
+ freeze: true
4105
+ });
4106
+ case 5:
4107
+ _context34.next = 7;
3955
4108
  return this.buildVirtualSettlementSubmitData();
3956
- case 4:
3957
- virtualSettlement = _context33.sent;
4109
+ case 7:
4110
+ virtualSettlement = _context34.sent;
3958
4111
  // this.store.order.persistTempOrder();
3959
4112
  inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
3960
4113
  smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
@@ -3978,10 +4131,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3978
4131
  enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(virtualSettlementEnhancePayload);
3979
4132
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
3980
4133
  cacheId: this.cacheId,
3981
- platform: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform,
3982
- businessCode: ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.businessCode) || ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.business_code),
4134
+ platform: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform,
4135
+ 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),
3983
4136
  channel: this.getSubmitOrderSalesChannel(),
3984
- type: (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.type,
4137
+ type: (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.type,
3985
4138
  request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
3986
4139
  }, virtualSettlement ? {
3987
4140
  payments: virtualSettlement.payments
@@ -3998,14 +4151,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3998
4151
  } : {}), enhancePayload !== undefined ? {
3999
4152
  enhancePayload: enhancePayload
4000
4153
  } : {});
4001
- return _context33.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
4002
- case 11:
4154
+ return _context34.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
4155
+ case 14:
4003
4156
  case "end":
4004
- return _context33.stop();
4157
+ return _context34.stop();
4005
4158
  }
4006
- }, _callee33, this);
4159
+ }, _callee34, this);
4007
4160
  }));
4008
- function submitSalesOrder(_x25) {
4161
+ function submitSalesOrder(_x26) {
4009
4162
  return _submitSalesOrder.apply(this, arguments);
4010
4163
  }
4011
4164
  return submitSalesOrder;
@@ -4013,33 +4166,42 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4013
4166
  }, {
4014
4167
  key: "saveSalesOrderDraft",
4015
4168
  value: function () {
4016
- var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
4017
- var _params$platform, _this$otherParams18, _this$otherParams19, _this$otherParams20, _params$channel, _params$type, _this$otherParams21;
4018
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4019
- while (1) switch (_context34.prev = _context34.next) {
4169
+ var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4170
+ var _params$platform, _this$otherParams22, _this$otherParams23, _this$otherParams24, _params$channel, _params$type, _this$otherParams25;
4171
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4172
+ while (1) switch (_context35.prev = _context35.next) {
4020
4173
  case 0:
4021
4174
  if (this.store.order) {
4022
- _context34.next = 2;
4175
+ _context35.next = 2;
4023
4176
  break;
4024
4177
  }
4025
4178
  throw new Error('BaseSales 解决方案需要 order 模块支持');
4026
4179
  case 2:
4027
- return _context34.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
4180
+ if (!this.isPickupTimingEnabled()) {
4181
+ _context35.next = 5;
4182
+ break;
4183
+ }
4184
+ _context35.next = 5;
4185
+ return this.preparePickupTimingForCheckout({
4186
+ freeze: false
4187
+ });
4188
+ case 5:
4189
+ return _context35.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
4028
4190
  cacheId: this.cacheId,
4029
- platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform,
4030
- businessCode: (params === null || params === void 0 ? void 0 : params.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),
4191
+ 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,
4192
+ 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),
4031
4193
  channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
4032
- type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.type
4194
+ 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
4033
4195
  }, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
4034
4196
  enhancePayload: params.enhancePayload
4035
4197
  } : {})));
4036
- case 3:
4198
+ case 6:
4037
4199
  case "end":
4038
- return _context34.stop();
4200
+ return _context35.stop();
4039
4201
  }
4040
- }, _callee34, this);
4202
+ }, _callee35, this);
4041
4203
  }));
4042
- function saveSalesOrderDraft(_x26) {
4204
+ function saveSalesOrderDraft(_x27) {
4043
4205
  return _saveSalesOrderDraft.apply(this, arguments);
4044
4206
  }
4045
4207
  return saveSalesOrderDraft;
@@ -4047,27 +4209,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4047
4209
  }, {
4048
4210
  key: "submitTempOrderAsync",
4049
4211
  value: function () {
4050
- var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4051
- var _params$smallTicketDa2, _this$otherParams22, _this$otherParams23, _this$otherParams24, _this$otherParams25;
4212
+ var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
4213
+ var _params$smallTicketDa2, _this$otherParams26, _this$otherParams27, _this$otherParams28, _this$otherParams29;
4052
4214
  var inferredPaymentStatus, smallTicketDataFlag, enhancePayload, submitParams;
4053
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4054
- while (1) switch (_context35.prev = _context35.next) {
4215
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4216
+ while (1) switch (_context36.prev = _context36.next) {
4055
4217
  case 0:
4056
4218
  if (this.store.order) {
4057
- _context35.next = 2;
4219
+ _context36.next = 2;
4058
4220
  break;
4059
4221
  }
4060
4222
  throw new Error('BaseSales 解决方案需要 order 模块支持');
4061
4223
  case 2:
4224
+ if (!this.isPickupTimingEnabled()) {
4225
+ _context36.next = 5;
4226
+ break;
4227
+ }
4228
+ _context36.next = 5;
4229
+ return this.preparePickupTimingForCheckout({
4230
+ freeze: true
4231
+ });
4232
+ case 5:
4062
4233
  inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
4063
4234
  smallTicketDataFlag = (_params$smallTicketDa2 = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa2 !== void 0 ? _params$smallTicketDa2 : this.getDefaultCheckoutSmallTicketDataFlag();
4064
4235
  enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params === null || params === void 0 ? void 0 : params.enhancePayload);
4065
4236
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
4066
4237
  cacheId: this.cacheId,
4067
- platform: (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.platform,
4068
- 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),
4238
+ platform: (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform,
4239
+ 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),
4069
4240
  channel: this.getSubmitOrderSalesChannel(),
4070
- type: (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.type,
4241
+ type: (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.type,
4071
4242
  request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
4072
4243
  }, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
4073
4244
  payments: params.payments
@@ -4080,14 +4251,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4080
4251
  } : {}), enhancePayload !== undefined ? {
4081
4252
  enhancePayload: enhancePayload
4082
4253
  } : {});
4083
- return _context35.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
4084
- case 7:
4254
+ return _context36.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
4255
+ case 10:
4085
4256
  case "end":
4086
- return _context35.stop();
4257
+ return _context36.stop();
4087
4258
  }
4088
- }, _callee35, this);
4259
+ }, _callee36, this);
4089
4260
  }));
4090
- function submitTempOrderAsync(_x27) {
4261
+ function submitTempOrderAsync(_x28) {
4091
4262
  return _submitTempOrderAsync.apply(this, arguments);
4092
4263
  }
4093
4264
  return submitTempOrderAsync;
@@ -4099,8 +4270,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4099
4270
  }, {
4100
4271
  key: "shouldUseCheckoutSyncTask",
4101
4272
  value: function shouldUseCheckoutSyncTask() {
4102
- var _this$otherParams26;
4103
- var configured = (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.checkoutSyncTaskEnabled;
4273
+ var _this$otherParams30;
4274
+ var configured = (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.checkoutSyncTaskEnabled;
4104
4275
  return typeof configured === 'boolean' ? configured : true;
4105
4276
  }
4106
4277
 
@@ -4113,14 +4284,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4113
4284
  }, {
4114
4285
  key: "printLocalOrderReceipt",
4115
4286
  value: function () {
4116
- var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(lookup) {
4117
- var _this$otherParams27, _this$otherParams28, _this$otherParams29, _this$otherParams30;
4118
- var hasLookup, lookupPayload, context, payload, invoiceLayoutConfig, invoiceTemplateSettings, printPayload, response, _this$store$order$app, _this$store$order10, _data;
4119
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4120
- while (1) switch (_context36.prev = _context36.next) {
4287
+ var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(lookup) {
4288
+ var _this$otherParams31, _this$otherParams32, _this$otherParams33, _this$otherParams34;
4289
+ var hasLookup, lookupPayload, context, payload, invoiceLayoutConfig, invoiceTemplateSettings, printPayload, response, _this$store$order$app, _this$store$order12, _data;
4290
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4291
+ while (1) switch (_context37.prev = _context37.next) {
4121
4292
  case 0:
4122
4293
  if (this.store.order) {
4123
- _context36.next = 2;
4294
+ _context37.next = 2;
4124
4295
  break;
4125
4296
  }
4126
4297
  throw new Error('BaseSales 解决方案需要 order 模块支持');
@@ -4132,10 +4303,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4132
4303
  external_sale_number: lookup
4133
4304
  };
4134
4305
  context = {
4135
- platform: (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform,
4136
- businessCode: ((_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.businessCode) || ((_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.business_code),
4306
+ platform: (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.platform,
4307
+ 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),
4137
4308
  channel: this.getSubmitOrderSalesChannel(),
4138
- type: (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.type
4309
+ type: (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.type
4139
4310
  };
4140
4311
  payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
4141
4312
  lookup_order_from_db: 1,
@@ -4158,28 +4329,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4158
4329
  } : {}), invoiceTemplateSettings ? {
4159
4330
  template_settings: cloneDeep(invoiceTemplateSettings)
4160
4331
  } : {});
4161
- _context36.next = 11;
4332
+ _context37.next = 11;
4162
4333
  return this.request.post('/local/print-order', printPayload, {
4163
4334
  osServer: true,
4164
4335
  customToast: function customToast() {}
4165
4336
  });
4166
4337
  case 11:
4167
- response = _context36.sent;
4338
+ response = _context37.sent;
4168
4339
  if (hasLookup) {
4169
- _context36.next = 15;
4340
+ _context37.next = 15;
4170
4341
  break;
4171
4342
  }
4172
- _context36.next = 15;
4173
- return (_this$store$order$app = (_this$store$order10 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order10, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
4343
+ _context37.next = 15;
4344
+ return (_this$store$order$app = (_this$store$order12 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order12, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
4174
4345
  case 15:
4175
- return _context36.abrupt("return", response);
4346
+ return _context37.abrupt("return", response);
4176
4347
  case 16:
4177
4348
  case "end":
4178
- return _context36.stop();
4349
+ return _context37.stop();
4179
4350
  }
4180
- }, _callee36, this);
4351
+ }, _callee37, this);
4181
4352
  }));
4182
- function printLocalOrderReceipt(_x28) {
4353
+ function printLocalOrderReceipt(_x29) {
4183
4354
  return _printLocalOrderReceipt.apply(this, arguments);
4184
4355
  }
4185
4356
  return printLocalOrderReceipt;
@@ -4187,9 +4358,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4187
4358
  }, {
4188
4359
  key: "getSubmitPaymentStatus",
4189
4360
  value: function getSubmitPaymentStatus(paymentStatus) {
4190
- var _this$store$order11, _this$store$order11$g;
4361
+ var _this$store$order13, _this$store$order13$g;
4191
4362
  if (paymentStatus !== undefined) return paymentStatus;
4192
- var amountSnapshot = (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$g = _this$store$order11.getOrderAmountSnapshot) === null || _this$store$order11$g === void 0 ? void 0 : _this$store$order11$g.call(_this$store$order11);
4363
+ var amountSnapshot = (_this$store$order13 = this.store.order) === null || _this$store$order13 === void 0 || (_this$store$order13$g = _this$store$order13.getOrderAmountSnapshot) === null || _this$store$order13$g === void 0 ? void 0 : _this$store$order13$g.call(_this$store$order13);
4193
4364
  if (!amountSnapshot) return undefined;
4194
4365
  try {
4195
4366
  return new Decimal(amountSnapshot.amountGap || 0).lte(0) ? 'paid' : undefined;
@@ -4200,19 +4371,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4200
4371
  }, {
4201
4372
  key: "syncPaymentsToOrder",
4202
4373
  value: function () {
4203
- var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
4204
- var _ref47, _params$businessCode, _this$otherParams31, _this$otherParams32, _params$channel2;
4374
+ var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4375
+ var _ref47, _params$businessCode, _this$otherParams35, _this$otherParams36, _params$channel2;
4205
4376
  var businessCode, channel, enhancePayload, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
4206
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4207
- while (1) switch (_context37.prev = _context37.next) {
4377
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4378
+ while (1) switch (_context38.prev = _context38.next) {
4208
4379
  case 0:
4209
4380
  if (this.store.order) {
4210
- _context37.next = 2;
4381
+ _context38.next = 2;
4211
4382
  break;
4212
4383
  }
4213
4384
  throw new Error('order 模块未初始化');
4214
4385
  case 2:
4215
- businessCode = (_ref47 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.businessCode) !== null && _ref47 !== void 0 ? _ref47 : (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.business_code;
4386
+ businessCode = (_ref47 = (_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 && _ref47 !== void 0 ? _ref47 : (_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.business_code;
4216
4387
  channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
4217
4388
  enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params.enhancePayload);
4218
4389
  syncParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, params), {}, {
@@ -4226,14 +4397,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4226
4397
  } : {});
4227
4398
  syncState = this.store.order.getOrderSyncState();
4228
4399
  if (!(params.submitWhenPaid && syncState === 'submitting')) {
4229
- _context37.next = 10;
4400
+ _context38.next = 10;
4230
4401
  break;
4231
4402
  }
4232
4403
  this.queueLatestAutoPaymentSync();
4233
- return _context37.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
4404
+ return _context38.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
4234
4405
  case 10:
4235
4406
  payments = params.payments || [];
4236
- _context37.next = 13;
4407
+ _context38.next = 13;
4237
4408
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
4238
4409
  payments: payments,
4239
4410
  params: syncParams,
@@ -4241,11 +4412,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4241
4412
  orderSnapshot: this.store.order.getOrderSnapshot()
4242
4413
  });
4243
4414
  case 13:
4244
- _context37.prev = 13;
4245
- _context37.next = 16;
4415
+ _context38.prev = 13;
4416
+ _context38.next = 16;
4246
4417
  return this.store.order.syncPaymentsToOrder(syncParams);
4247
4418
  case 16:
4248
- syncResult = _context37.sent;
4419
+ syncResult = _context38.sent;
4249
4420
  latestPayments = this.store.order.getOrderPayments();
4250
4421
  amountSnapshot = this.store.order.getOrderAmountSnapshot();
4251
4422
  orderSnapshot = this.store.order.getOrderSnapshot();
@@ -4263,25 +4434,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4263
4434
  depositAmount: syncResult.depositAmount,
4264
4435
  orderExpectedAmount: syncResult.orderExpectedAmount
4265
4436
  };
4266
- _context37.next = 23;
4437
+ _context38.next = 23;
4267
4438
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
4268
4439
  case 23:
4269
4440
  if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
4270
- _context37.next = 26;
4441
+ _context38.next = 26;
4271
4442
  break;
4272
4443
  }
4273
- _context37.next = 26;
4444
+ _context38.next = 26;
4274
4445
  return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
4275
4446
  case 26:
4276
4447
  this.scheduleQueuedAutoPaymentSyncFlush(0);
4277
- return _context37.abrupt("return", syncResult);
4448
+ return _context38.abrupt("return", syncResult);
4278
4449
  case 30:
4279
- _context37.prev = 30;
4280
- _context37.t0 = _context37["catch"](13);
4281
- _context37.next = 34;
4450
+ _context38.prev = 30;
4451
+ _context38.t0 = _context38["catch"](13);
4452
+ _context38.next = 34;
4282
4453
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
4283
4454
  ok: false,
4284
- error: _context37.t0,
4455
+ error: _context38.t0,
4285
4456
  payments: this.store.order.getOrderPayments(),
4286
4457
  params: syncParams,
4287
4458
  amountSnapshot: this.store.order.getOrderAmountSnapshot(),
@@ -4289,14 +4460,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4289
4460
  });
4290
4461
  case 34:
4291
4462
  this.scheduleQueuedAutoPaymentSyncFlush(0);
4292
- throw _context37.t0;
4463
+ throw _context38.t0;
4293
4464
  case 36:
4294
4465
  case "end":
4295
- return _context37.stop();
4466
+ return _context38.stop();
4296
4467
  }
4297
- }, _callee37, this, [[13, 30]]);
4468
+ }, _callee38, this, [[13, 30]]);
4298
4469
  }));
4299
- function syncPaymentsToOrder(_x29) {
4470
+ function syncPaymentsToOrder(_x30) {
4300
4471
  return _syncPaymentsToOrder.apply(this, arguments);
4301
4472
  }
4302
4473
  return syncPaymentsToOrder;
@@ -4333,58 +4504,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4333
4504
  }, {
4334
4505
  key: "scheduleQueuedAutoPaymentSyncFlush",
4335
4506
  value: function scheduleQueuedAutoPaymentSyncFlush() {
4336
- var _this16 = this;
4507
+ var _this17 = this;
4337
4508
  var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
4338
4509
  if (!this.queuedAutoPaymentSync) return;
4339
4510
  if (this.autoPaymentSyncTimer) return;
4340
4511
  this.autoPaymentSyncTimer = setTimeout(function () {
4341
- _this16.autoPaymentSyncTimer = null;
4342
- void _this16.flushQueuedAutoPaymentSync();
4512
+ _this17.autoPaymentSyncTimer = null;
4513
+ void _this17.flushQueuedAutoPaymentSync();
4343
4514
  }, delay);
4344
4515
  }
4345
4516
  }, {
4346
4517
  key: "flushQueuedAutoPaymentSync",
4347
4518
  value: function () {
4348
- var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
4519
+ var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
4349
4520
  var payments;
4350
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4351
- while (1) switch (_context38.prev = _context38.next) {
4521
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4522
+ while (1) switch (_context39.prev = _context39.next) {
4352
4523
  case 0:
4353
4524
  if (this.store.order) {
4354
- _context38.next = 2;
4525
+ _context39.next = 2;
4355
4526
  break;
4356
4527
  }
4357
- return _context38.abrupt("return");
4528
+ return _context39.abrupt("return");
4358
4529
  case 2:
4359
4530
  if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
4360
- _context38.next = 4;
4531
+ _context39.next = 4;
4361
4532
  break;
4362
4533
  }
4363
- return _context38.abrupt("return");
4534
+ return _context39.abrupt("return");
4364
4535
  case 4:
4365
4536
  if (!(this.store.order.getOrderSyncState() === 'submitting')) {
4366
- _context38.next = 7;
4537
+ _context39.next = 7;
4367
4538
  break;
4368
4539
  }
4369
4540
  this.scheduleQueuedAutoPaymentSyncFlush();
4370
- return _context38.abrupt("return");
4541
+ return _context39.abrupt("return");
4371
4542
  case 7:
4372
4543
  this.autoPaymentSyncFlushing = true;
4373
- _context38.prev = 8;
4544
+ _context39.prev = 8;
4374
4545
  case 9:
4375
4546
  if (!this.queuedAutoPaymentSync) {
4376
- _context38.next = 18;
4547
+ _context39.next = 18;
4377
4548
  break;
4378
4549
  }
4379
4550
  this.queuedAutoPaymentSync = false;
4380
4551
  payments = this.store.order.getOrderPayments();
4381
4552
  if (payments.length) {
4382
- _context38.next = 14;
4553
+ _context39.next = 14;
4383
4554
  break;
4384
4555
  }
4385
- return _context38.abrupt("continue", 9);
4556
+ return _context39.abrupt("continue", 9);
4386
4557
  case 14:
4387
- _context38.next = 16;
4558
+ _context39.next = 16;
4388
4559
  return this.syncPaymentsToOrder({
4389
4560
  payments: payments,
4390
4561
  paymentStatus: this.getPaymentStatusForSync(payments),
@@ -4392,29 +4563,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4392
4563
  smallTicketDataFlag: 1
4393
4564
  });
4394
4565
  case 16:
4395
- _context38.next = 9;
4566
+ _context39.next = 9;
4396
4567
  break;
4397
4568
  case 18:
4398
- _context38.next = 23;
4569
+ _context39.next = 23;
4399
4570
  break;
4400
4571
  case 20:
4401
- _context38.prev = 20;
4402
- _context38.t0 = _context38["catch"](8);
4572
+ _context39.prev = 20;
4573
+ _context39.t0 = _context39["catch"](8);
4403
4574
  this.logError('queued auto sync payments failed', {
4404
- error: _context38.t0 instanceof Error ? _context38.t0.message : String(_context38.t0)
4575
+ error: _context39.t0 instanceof Error ? _context39.t0.message : String(_context39.t0)
4405
4576
  });
4406
4577
  case 23:
4407
- _context38.prev = 23;
4578
+ _context39.prev = 23;
4408
4579
  this.autoPaymentSyncFlushing = false;
4409
4580
  if (this.queuedAutoPaymentSync) {
4410
4581
  this.scheduleQueuedAutoPaymentSyncFlush(0);
4411
4582
  }
4412
- return _context38.finish(23);
4583
+ return _context39.finish(23);
4413
4584
  case 27:
4414
4585
  case "end":
4415
- return _context38.stop();
4586
+ return _context39.stop();
4416
4587
  }
4417
- }, _callee38, this, [[8, 20, 23, 27]]);
4588
+ }, _callee39, this, [[8, 20, 23, 27]]);
4418
4589
  }));
4419
4590
  function flushQueuedAutoPaymentSync() {
4420
4591
  return _flushQueuedAutoPaymentSync.apply(this, arguments);
@@ -4438,35 +4609,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4438
4609
  }, {
4439
4610
  key: "addOrderPaymentAsync",
4440
4611
  value: (function () {
4441
- var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(payment) {
4612
+ var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(payment) {
4442
4613
  var paymentRecord, hasPaymentNumber, devicePrefix;
4443
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4444
- while (1) switch (_context39.prev = _context39.next) {
4614
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4615
+ while (1) switch (_context40.prev = _context40.next) {
4445
4616
  case 0:
4446
4617
  paymentRecord = payment;
4447
4618
  hasPaymentNumber = String(paymentRecord.payment_number || '').trim() !== '';
4448
4619
  if (!hasPaymentNumber) {
4449
- _context39.next = 6;
4620
+ _context40.next = 6;
4450
4621
  break;
4451
4622
  }
4452
- _context39.t0 = 'LOCAL';
4453
- _context39.next = 9;
4623
+ _context40.t0 = 'LOCAL';
4624
+ _context40.next = 9;
4454
4625
  break;
4455
4626
  case 6:
4456
- _context39.next = 8;
4627
+ _context40.next = 8;
4457
4628
  return this.getPaymentNumberDevicePrefixAsync();
4458
4629
  case 8:
4459
- _context39.t0 = _context39.sent;
4630
+ _context40.t0 = _context40.sent;
4460
4631
  case 9:
4461
- devicePrefix = _context39.t0;
4462
- return _context39.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
4632
+ devicePrefix = _context40.t0;
4633
+ return _context40.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
4463
4634
  case 11:
4464
4635
  case "end":
4465
- return _context39.stop();
4636
+ return _context40.stop();
4466
4637
  }
4467
- }, _callee39, this);
4638
+ }, _callee40, this);
4468
4639
  }));
4469
- function addOrderPaymentAsync(_x30) {
4640
+ function addOrderPaymentAsync(_x31) {
4470
4641
  return _addOrderPaymentAsync.apply(this, arguments);
4471
4642
  }
4472
4643
  return addOrderPaymentAsync;
@@ -4474,12 +4645,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4474
4645
  }, {
4475
4646
  key: "addOrderPaymentWithDevicePrefix",
4476
4647
  value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
4477
- var _this$otherParams33,
4648
+ var _this$otherParams37,
4478
4649
  _paymentRecord$paymen,
4479
4650
  _paymentRecord$create,
4480
4651
  _ref48,
4481
4652
  _paymentRecord$origin,
4482
- _this17 = this;
4653
+ _this18 = this;
4483
4654
  if (!this.store.order) throw new Error('order 模块未初始化');
4484
4655
  var paymentRecord = payment;
4485
4656
  var paymentAmount = new Decimal(paymentRecord.amount || 0);
@@ -4490,7 +4661,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4490
4661
  return this.store.order.getOrderPayments();
4491
4662
  }
4492
4663
  var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
4493
- var shopWalletPassId = (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.shop_wallet_pass_id;
4664
+ var shopWalletPassId = (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.shop_wallet_pass_id;
4494
4665
  if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
4495
4666
  metadata.shop_wallet_pass_id = shopWalletPassId;
4496
4667
  }
@@ -4523,7 +4694,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4523
4694
  submitWhenPaid: true,
4524
4695
  smallTicketDataFlag: 1
4525
4696
  }).catch(function (error) {
4526
- _this17.logError('auto sync payments failed', {
4697
+ _this18.logError('auto sync payments failed', {
4527
4698
  error: error instanceof Error ? error.message : String(error)
4528
4699
  });
4529
4700
  });
@@ -4535,7 +4706,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4535
4706
  }, {
4536
4707
  key: "updateOrderPayment",
4537
4708
  value: (function () {
4538
- var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(paymentIdentity, updates) {
4709
+ var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(paymentIdentity, updates) {
4539
4710
  var _result$payment, _result$payment2;
4540
4711
  var options,
4541
4712
  matchMode,
@@ -4552,13 +4723,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4552
4723
  shouldSubmit,
4553
4724
  syncResult,
4554
4725
  _options$smallTicketD2,
4555
- _args40 = arguments;
4556
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4557
- while (1) switch (_context40.prev = _context40.next) {
4726
+ _args41 = arguments;
4727
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4728
+ while (1) switch (_context41.prev = _context41.next) {
4558
4729
  case 0:
4559
- options = _args40.length > 2 && _args40[2] !== undefined ? _args40[2] : {};
4730
+ options = _args41.length > 2 && _args41[2] !== undefined ? _args41[2] : {};
4560
4731
  if (this.store.order) {
4561
- _context40.next = 3;
4732
+ _context41.next = 3;
4562
4733
  break;
4563
4734
  }
4564
4735
  throw new Error('order 模块未初始化');
@@ -4567,15 +4738,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4567
4738
  previousMatch = resolveOrderPaymentIdentity(this.store.order.getOrderPayments(), paymentIdentity, matchMode);
4568
4739
  previousPayment = previousMatch === null || previousMatch === void 0 ? void 0 : previousMatch.payment;
4569
4740
  if (!((previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) === 'paid' && !options.applyUpdatesWhenPaid)) {
4570
- _context40.next = 13;
4741
+ _context41.next = 13;
4571
4742
  break;
4572
4743
  }
4573
4744
  currentPayments = this.store.order.getOrderPayments();
4574
4745
  if (!(options.submitWhenPaid && options.forceSubmitIfPaid)) {
4575
- _context40.next = 12;
4746
+ _context41.next = 12;
4576
4747
  break;
4577
4748
  }
4578
- _context40.next = 11;
4749
+ _context41.next = 11;
4579
4750
  return this.syncPaymentsToOrder({
4580
4751
  payments: currentPayments,
4581
4752
  paymentStatus: this.getPaymentStatusForSync(currentPayments),
@@ -4583,9 +4754,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4583
4754
  smallTicketDataFlag: (_options$smallTicketD = options.smallTicketDataFlag) !== null && _options$smallTicketD !== void 0 ? _options$smallTicketD : 1
4584
4755
  });
4585
4756
  case 11:
4586
- _syncResult = _context40.sent;
4757
+ _syncResult = _context41.sent;
4587
4758
  case 12:
4588
- return _context40.abrupt("return", _objectSpread({
4759
+ return _context41.abrupt("return", _objectSpread({
4589
4760
  updated: false,
4590
4761
  payment: previousPayment,
4591
4762
  payments: currentPayments,
@@ -4594,44 +4765,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4594
4765
  syncResult: _syncResult
4595
4766
  } : {}));
4596
4767
  case 13:
4597
- _context40.next = 15;
4768
+ _context41.next = 15;
4598
4769
  return this.store.order.updateOrderPayment(paymentIdentity, updates, {
4599
4770
  matchBy: matchMode
4600
4771
  });
4601
4772
  case 15:
4602
- result = _context40.sent;
4773
+ result = _context41.sent;
4603
4774
  if (!(options.persistDraft !== false)) {
4604
- _context40.next = 29;
4775
+ _context41.next = 29;
4605
4776
  break;
4606
4777
  }
4607
- _context40.prev = 17;
4608
- _context40.next = 20;
4778
+ _context41.prev = 17;
4779
+ _context41.next = 20;
4609
4780
  return this.saveSalesOrderDraft();
4610
4781
  case 20:
4611
- draftResult = _context40.sent;
4612
- _context40.next = 29;
4782
+ draftResult = _context41.sent;
4783
+ _context41.next = 29;
4613
4784
  break;
4614
4785
  case 23:
4615
- _context40.prev = 23;
4616
- _context40.t0 = _context40["catch"](17);
4617
- draftError = _context40.t0;
4786
+ _context41.prev = 23;
4787
+ _context41.t0 = _context41["catch"](17);
4788
+ draftError = _context41.t0;
4618
4789
  this.logError('updateOrderPayment: 保存支付草稿失败', {
4619
4790
  paymentIdentity: paymentIdentity,
4620
- error: _context40.t0 instanceof Error ? _context40.t0.message : String(_context40.t0)
4791
+ error: _context41.t0 instanceof Error ? _context41.t0.message : String(_context41.t0)
4621
4792
  });
4622
4793
  if (options.submitWhenPaid) {
4623
- _context40.next = 29;
4794
+ _context41.next = 29;
4624
4795
  break;
4625
4796
  }
4626
- throw _context40.t0;
4797
+ throw _context41.t0;
4627
4798
  case 29:
4628
4799
  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';
4629
4800
  shouldSubmit = Boolean(options.submitWhenPaid && ((_result$payment2 = result.payment) === null || _result$payment2 === void 0 ? void 0 : _result$payment2.status) === 'paid' && (becamePaid || options.forceSubmitIfPaid));
4630
4801
  if (!shouldSubmit) {
4631
- _context40.next = 35;
4802
+ _context41.next = 35;
4632
4803
  break;
4633
4804
  }
4634
- _context40.next = 34;
4805
+ _context41.next = 34;
4635
4806
  return this.syncPaymentsToOrder({
4636
4807
  payments: result.payments,
4637
4808
  paymentStatus: this.getPaymentStatusForSync(result.payments),
@@ -4639,9 +4810,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4639
4810
  smallTicketDataFlag: (_options$smallTicketD2 = options.smallTicketDataFlag) !== null && _options$smallTicketD2 !== void 0 ? _options$smallTicketD2 : 1
4640
4811
  });
4641
4812
  case 34:
4642
- syncResult = _context40.sent;
4813
+ syncResult = _context41.sent;
4643
4814
  case 35:
4644
- return _context40.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
4815
+ return _context41.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
4645
4816
  draftResult: draftResult
4646
4817
  } : {}), draftError !== undefined ? {
4647
4818
  draftError: draftError
@@ -4650,11 +4821,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4650
4821
  } : {}));
4651
4822
  case 36:
4652
4823
  case "end":
4653
- return _context40.stop();
4824
+ return _context41.stop();
4654
4825
  }
4655
- }, _callee40, this, [[17, 23]]);
4826
+ }, _callee41, this, [[17, 23]]);
4656
4827
  }));
4657
- function updateOrderPayment(_x31, _x32) {
4828
+ function updateOrderPayment(_x32, _x33) {
4658
4829
  return _updateOrderPayment.apply(this, arguments);
4659
4830
  }
4660
4831
  return updateOrderPayment;
@@ -4676,24 +4847,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4676
4847
  }, {
4677
4848
  key: "updateVoucherOrderPaymentsAsync",
4678
4849
  value: function () {
4679
- var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(payments, options) {
4680
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4681
- while (1) switch (_context41.prev = _context41.next) {
4850
+ var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(payments, options) {
4851
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4852
+ while (1) switch (_context42.prev = _context42.next) {
4682
4853
  case 0:
4683
4854
  if (this.store.order) {
4684
- _context41.next = 2;
4855
+ _context42.next = 2;
4685
4856
  break;
4686
4857
  }
4687
4858
  throw new Error('order 模块未初始化');
4688
4859
  case 2:
4689
- return _context41.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
4860
+ return _context42.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
4690
4861
  case 3:
4691
4862
  case "end":
4692
- return _context41.stop();
4863
+ return _context42.stop();
4693
4864
  }
4694
- }, _callee41, this);
4865
+ }, _callee42, this);
4695
4866
  }));
4696
- function updateVoucherOrderPaymentsAsync(_x33, _x34) {
4867
+ function updateVoucherOrderPaymentsAsync(_x34, _x35) {
4697
4868
  return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
4698
4869
  }
4699
4870
  return updateVoucherOrderPaymentsAsync;
@@ -4719,8 +4890,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4719
4890
  }, {
4720
4891
  key: "getWalletProductList",
4721
4892
  value: function getWalletProductList() {
4722
- var _this$store$order12, _tempOrder$products;
4723
- var tempOrder = (_this$store$order12 = this.store.order) === null || _this$store$order12 === void 0 ? void 0 : _this$store$order12.getTempOrder();
4893
+ var _this$store$order14, _tempOrder$products;
4894
+ var tempOrder = (_this$store$order14 = this.store.order) === null || _this$store$order14 === void 0 ? void 0 : _this$store$order14.getTempOrder();
4724
4895
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
4725
4896
  // 过滤出有 product_id的商品来,如果没有代表他是自定义商品,不需要参与 wallet
4726
4897
  // debugger
@@ -4780,8 +4951,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4780
4951
  }, {
4781
4952
  key: "buildWalletInitBusinessData",
4782
4953
  value: function buildWalletInitBusinessData(params) {
4783
- var _this$store$order13, _params$order_wait_pa, _ref49, _tempOrder$is_price_i;
4784
- var snapshot = (_this$store$order13 = this.store.order) === null || _this$store$order13 === void 0 ? void 0 : _this$store$order13.getOrderSnapshot();
4954
+ var _this$store$order15, _params$order_wait_pa, _ref49, _tempOrder$is_price_i;
4955
+ var snapshot = (_this$store$order15 = this.store.order) === null || _this$store$order15 === void 0 ? void 0 : _this$store$order15.getOrderSnapshot();
4785
4956
  var tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
4786
4957
  var amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
4787
4958
  if (!tempOrder || !amount) return null;
@@ -4804,20 +4975,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4804
4975
  }, {
4805
4976
  key: "initWalletData",
4806
4977
  value: function () {
4807
- var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
4808
- var _snapshot$identity;
4978
+ var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
4979
+ var _this$store$order$mer, _this$store$order16, _snapshot$identity;
4809
4980
  var snapshot, walletBusinessData, result;
4810
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4811
- while (1) switch (_context42.prev = _context42.next) {
4981
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4982
+ while (1) switch (_context43.prev = _context43.next) {
4812
4983
  case 0:
4813
4984
  if (this.store.order) {
4814
- _context42.next = 2;
4985
+ _context43.next = 2;
4815
4986
  break;
4816
4987
  }
4817
4988
  throw new Error('order 模块未初始化');
4818
4989
  case 2:
4819
4990
  if (this.store.payment) {
4820
- _context42.next = 4;
4991
+ _context43.next = 4;
4821
4992
  break;
4822
4993
  }
4823
4994
  throw new Error('payment 模块未初始化');
@@ -4825,10 +4996,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4825
4996
  snapshot = this.store.order.getOrderSnapshot();
4826
4997
  walletBusinessData = this.buildWalletInitBusinessData(params);
4827
4998
  if (walletBusinessData) {
4828
- _context42.next = 8;
4999
+ _context43.next = 8;
4829
5000
  break;
4830
5001
  }
4831
- return _context42.abrupt("return", {
5002
+ return _context43.abrupt("return", {
4832
5003
  walletRecommendList: [],
4833
5004
  userIdentificationCodes: [],
4834
5005
  transformList: [],
@@ -4836,11 +5007,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4836
5007
  products: []
4837
5008
  });
4838
5009
  case 8:
4839
- _context42.next = 10;
5010
+ _context43.next = 10;
4840
5011
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
4841
5012
  case 10:
4842
- result = _context42.sent;
4843
- _context42.next = 13;
5013
+ result = _context43.sent;
5014
+ (_this$store$order$mer = (_this$store$order16 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer === void 0 || _this$store$order$mer.call(_this$store$order16, result.userIdentificationCodes, {
5015
+ customerId: walletBusinessData.customer_id,
5016
+ orderIdentity: snapshot === null || snapshot === void 0 ? void 0 : snapshot.identity
5017
+ });
5018
+ _context43.next = 14;
4844
5019
  return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
4845
5020
  orderId: snapshot === null || snapshot === void 0 || (_snapshot$identity = snapshot.identity) === null || _snapshot$identity === void 0 ? void 0 : _snapshot$identity.orderId,
4846
5021
  customerId: walletBusinessData.customer_id,
@@ -4851,15 +5026,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4851
5026
  },
4852
5027
  timestamp: Date.now()
4853
5028
  });
4854
- case 13:
4855
- return _context42.abrupt("return", result);
4856
5029
  case 14:
5030
+ return _context43.abrupt("return", result);
5031
+ case 15:
4857
5032
  case "end":
4858
- return _context42.stop();
5033
+ return _context43.stop();
4859
5034
  }
4860
- }, _callee42, this);
5035
+ }, _callee43, this);
4861
5036
  }));
4862
- function initWalletData(_x35) {
5037
+ function initWalletData(_x36) {
4863
5038
  return _initWalletData.apply(this, arguments);
4864
5039
  }
4865
5040
  return initWalletData;
@@ -4867,8 +5042,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4867
5042
  }, {
4868
5043
  key: "getCommittedWalletAssets",
4869
5044
  value: function getCommittedWalletAssets() {
4870
- var _this$store$order14, _this$store$order14$g;
4871
- var payments = ((_this$store$order14 = this.store.order) === null || _this$store$order14 === void 0 || (_this$store$order14$g = _this$store$order14.getOrderPayments) === null || _this$store$order14$g === void 0 ? void 0 : _this$store$order14$g.call(_this$store$order14)) || [];
5045
+ var _this$store$order17, _this$store$order17$g;
5046
+ var payments = ((_this$store$order17 = this.store.order) === null || _this$store$order17 === void 0 || (_this$store$order17$g = _this$store$order17.getOrderPayments) === null || _this$store$order17$g === void 0 ? void 0 : _this$store$order17$g.call(_this$store$order17)) || [];
4872
5047
  var committed = payments.filter(function (payment) {
4873
5048
  var voucherId = payment === null || payment === void 0 ? void 0 : payment.voucher_id;
4874
5049
  if (voucherId === undefined || voucherId === null || voucherId === 0) {
@@ -4910,27 +5085,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4910
5085
  }, {
4911
5086
  key: "publishWalletAssetsState",
4912
5087
  value: function () {
4913
- var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(state) {
5088
+ var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(state) {
4914
5089
  var changeSource,
4915
- _args43 = arguments;
4916
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4917
- while (1) switch (_context43.prev = _context43.next) {
5090
+ _args44 = arguments;
5091
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5092
+ while (1) switch (_context44.prev = _context44.next) {
4918
5093
  case 0:
4919
- changeSource = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : 'derived';
4920
- _context43.next = 3;
5094
+ changeSource = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : 'derived';
5095
+ _context44.next = 3;
4921
5096
  return this.effectsEmit(BaseSalesHookNames.onWalletAssetsStateChanged, {
4922
5097
  state: state,
4923
5098
  changeSource: changeSource
4924
5099
  });
4925
5100
  case 3:
4926
- return _context43.abrupt("return", state);
5101
+ return _context44.abrupt("return", state);
4927
5102
  case 4:
4928
5103
  case "end":
4929
- return _context43.stop();
5104
+ return _context44.stop();
4930
5105
  }
4931
- }, _callee43, this);
5106
+ }, _callee44, this);
4932
5107
  }));
4933
- function publishWalletAssetsState(_x36) {
5108
+ function publishWalletAssetsState(_x37) {
4934
5109
  return _publishWalletAssetsState.apply(this, arguments);
4935
5110
  }
4936
5111
  return publishWalletAssetsState;
@@ -4938,26 +5113,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4938
5113
  }, {
4939
5114
  key: "syncSelectedWalletAssets",
4940
5115
  value: function () {
4941
- var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(state) {
5116
+ var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(state) {
4942
5117
  var paymentMethods, methodByCode, preparePayments, selectedAssetById, voucherPayments, payments;
4943
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4944
- while (1) switch (_context44.prev = _context44.next) {
5118
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5119
+ while (1) switch (_context45.prev = _context45.next) {
4945
5120
  case 0:
4946
5121
  if (!(!this.store.order || !this.store.payment)) {
4947
- _context44.next = 2;
5122
+ _context45.next = 2;
4948
5123
  break;
4949
5124
  }
4950
5125
  throw new Error('订单或支付模块未初始化');
4951
5126
  case 2:
4952
5127
  paymentMethods = this.getPaymentMethods();
4953
5128
  if (!(!paymentMethods.length && state.selectedItems.length)) {
4954
- _context44.next = 7;
5129
+ _context45.next = 7;
4955
5130
  break;
4956
5131
  }
4957
- _context44.next = 6;
5132
+ _context45.next = 6;
4958
5133
  return this.getPaymentMethodsAsync();
4959
5134
  case 6:
4960
- paymentMethods = _context44.sent;
5135
+ paymentMethods = _context45.sent;
4961
5136
  case 7:
4962
5137
  methodByCode = new Map(paymentMethods.map(function (method) {
4963
5138
  return [String(method.code || '').toUpperCase(), method];
@@ -4999,19 +5174,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4999
5174
  payments = this.updateVoucherOrderPayments(voucherPayments, {
5000
5175
  status: 'payment_pending'
5001
5176
  });
5002
- _context44.next = 14;
5177
+ _context45.next = 14;
5003
5178
  return this.store.order.recalculateSummary({
5004
5179
  createIfMissing: true
5005
5180
  });
5006
5181
  case 14:
5007
- return _context44.abrupt("return", payments);
5182
+ return _context45.abrupt("return", payments);
5008
5183
  case 15:
5009
5184
  case "end":
5010
- return _context44.stop();
5185
+ return _context45.stop();
5011
5186
  }
5012
- }, _callee44, this);
5187
+ }, _callee45, this);
5013
5188
  }));
5014
- function syncSelectedWalletAssets(_x37) {
5189
+ function syncSelectedWalletAssets(_x38) {
5015
5190
  return _syncSelectedWalletAssets.apply(this, arguments);
5016
5191
  }
5017
5192
  return syncSelectedWalletAssets;
@@ -5045,29 +5220,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5045
5220
  }, {
5046
5221
  key: "importWalletAssetsSnapshot",
5047
5222
  value: (function () {
5048
- var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(snapshot) {
5223
+ var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(snapshot) {
5224
+ var _this$store$order18, _this$store$order18$m;
5049
5225
  var state;
5050
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5051
- while (1) switch (_context45.prev = _context45.next) {
5226
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5227
+ while (1) switch (_context46.prev = _context46.next) {
5052
5228
  case 0:
5053
5229
  if (this.store.payment) {
5054
- _context45.next = 2;
5230
+ _context46.next = 2;
5055
5231
  break;
5056
5232
  }
5057
5233
  throw new Error('payment 模块未初始化');
5058
5234
  case 2:
5059
5235
  state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
5060
- _context45.next = 5;
5236
+ (_this$store$order18 = this.store.order) === null || _this$store$order18 === void 0 || (_this$store$order18$m = _this$store$order18.mergePointCardSnapshotCodes) === null || _this$store$order18$m === void 0 || _this$store$order18$m.call(_this$store$order18, state.items);
5237
+ _context46.next = 6;
5061
5238
  return this.syncSelectedWalletAssets(state);
5062
- case 5:
5063
- return _context45.abrupt("return", this.publishWalletAssetsState(state));
5064
5239
  case 6:
5240
+ return _context46.abrupt("return", this.publishWalletAssetsState(state));
5241
+ case 7:
5065
5242
  case "end":
5066
- return _context45.stop();
5243
+ return _context46.stop();
5067
5244
  }
5068
- }, _callee45, this);
5245
+ }, _callee46, this);
5069
5246
  }));
5070
- function importWalletAssetsSnapshot(_x38) {
5247
+ function importWalletAssetsSnapshot(_x39) {
5071
5248
  return _importWalletAssetsSnapshot.apply(this, arguments);
5072
5249
  }
5073
5250
  return importWalletAssetsSnapshot;
@@ -5079,20 +5256,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5079
5256
  }, {
5080
5257
  key: "refreshWalletAssets",
5081
5258
  value: (function () {
5082
- var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
5083
- var _previousState$custom, _businessData$custome;
5084
- var refreshSequence, wallet, businessData, emptyState, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, committed;
5085
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5086
- while (1) switch (_context46.prev = _context46.next) {
5259
+ var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
5260
+ var _this$store$order$get6, _previousState$custom, _businessData$custome;
5261
+ var refreshSequence, wallet, businessData, emptyState, pointCardSnapshotMergeContext, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, _this$store$order$mer2, _this$store$order19, _wallet$getUserIdenti, committed;
5262
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5263
+ while (1) switch (_context47.prev = _context47.next) {
5087
5264
  case 0:
5088
5265
  if (this.store.order) {
5089
- _context46.next = 2;
5266
+ _context47.next = 2;
5090
5267
  break;
5091
5268
  }
5092
5269
  throw new Error('order 模块未初始化');
5093
5270
  case 2:
5094
5271
  if (this.store.payment) {
5095
- _context46.next = 4;
5272
+ _context47.next = 4;
5096
5273
  break;
5097
5274
  }
5098
5275
  throw new Error('payment 模块未初始化');
@@ -5101,7 +5278,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5101
5278
  wallet = this.store.payment.wallet;
5102
5279
  businessData = this.buildWalletInitBusinessData(params);
5103
5280
  if (businessData) {
5104
- _context46.next = 12;
5281
+ _context47.next = 12;
5105
5282
  break;
5106
5283
  }
5107
5284
  wallet.clearAllCache();
@@ -5109,54 +5286,59 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5109
5286
  this.updateVoucherOrderPayments([], {
5110
5287
  status: 'payment_pending'
5111
5288
  });
5112
- return _context46.abrupt("return", this.publishWalletAssetsState(emptyState));
5289
+ return _context47.abrupt("return", this.publishWalletAssetsState(emptyState));
5113
5290
  case 12:
5291
+ pointCardSnapshotMergeContext = {
5292
+ customerId: businessData.customer_id,
5293
+ orderIdentity: (_this$store$order$get6 = this.store.order.getOrderSnapshot()) === null || _this$store$order$get6 === void 0 ? void 0 : _this$store$order$get6.identity
5294
+ };
5114
5295
  previousState = wallet.getWalletAssetsState();
5115
5296
  hasPreviousWalletContext = previousState.status !== 'idle' || previousState.items.length > 0 || previousState.selectedIds.length > 0 || previousState.customerId !== undefined;
5116
5297
  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 : '');
5117
5298
  if (!customerChanged) {
5118
- _context46.next = 20;
5299
+ _context47.next = 21;
5119
5300
  break;
5120
5301
  }
5121
5302
  clearedState = wallet.clearWalletAssetSelection();
5122
5303
  this.updateVoucherOrderPayments([], {
5123
5304
  status: 'payment_pending'
5124
5305
  });
5125
- _context46.next = 20;
5306
+ _context47.next = 21;
5126
5307
  return this.publishWalletAssetsState(clearedState);
5127
- case 20:
5308
+ case 21:
5128
5309
  refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
5129
5310
  preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged,
5130
5311
  retainSearchResultCodes: params === null || params === void 0 ? void 0 : params.retainSearchResultCodes
5131
5312
  });
5132
- _context46.next = 23;
5313
+ _context47.next = 24;
5133
5314
  return this.publishWalletAssetsState(wallet.getWalletAssetsState());
5134
- case 23:
5135
- _context46.next = 25;
5315
+ case 24:
5316
+ _context47.next = 26;
5136
5317
  return refreshTask;
5137
- case 25:
5138
- state = _context46.sent;
5318
+ case 26:
5319
+ state = _context47.sent;
5139
5320
  if (!(refreshSequence !== this.walletAssetsRefreshSequence)) {
5140
- _context46.next = 28;
5321
+ _context47.next = 29;
5141
5322
  break;
5142
5323
  }
5143
- return _context46.abrupt("return", wallet.getWalletAssetsState());
5144
- case 28:
5324
+ return _context47.abrupt("return", wallet.getWalletAssetsState());
5325
+ case 29:
5145
5326
  if (state.status !== 'error') {
5146
5327
  committed = this.getCommittedWalletAssets();
5147
5328
  state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5329
+ (_this$store$order$mer2 = (_this$store$order19 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer2 === void 0 || _this$store$order$mer2.call(_this$store$order19, ((_wallet$getUserIdenti = wallet.getUserIdentificationCodes) === null || _wallet$getUserIdenti === void 0 ? void 0 : _wallet$getUserIdenti.call(wallet)) || [], pointCardSnapshotMergeContext);
5148
5330
  }
5149
- _context46.next = 31;
5331
+ _context47.next = 32;
5150
5332
  return this.syncSelectedWalletAssets(state);
5151
- case 31:
5152
- return _context46.abrupt("return", this.publishWalletAssetsState(state));
5153
5333
  case 32:
5334
+ return _context47.abrupt("return", this.publishWalletAssetsState(state));
5335
+ case 33:
5154
5336
  case "end":
5155
- return _context46.stop();
5337
+ return _context47.stop();
5156
5338
  }
5157
- }, _callee46, this);
5339
+ }, _callee47, this);
5158
5340
  }));
5159
- function refreshWalletAssets(_x39) {
5341
+ function refreshWalletAssets(_x40) {
5160
5342
  return _refreshWalletAssets.apply(this, arguments);
5161
5343
  }
5162
5344
  return refreshWalletAssets;
@@ -5164,13 +5346,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5164
5346
  }, {
5165
5347
  key: "selectWalletAsset",
5166
5348
  value: (function () {
5167
- var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
5349
+ var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
5168
5350
  var state;
5169
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5170
- while (1) switch (_context47.prev = _context47.next) {
5351
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5352
+ while (1) switch (_context48.prev = _context48.next) {
5171
5353
  case 0:
5172
5354
  if (this.store.payment) {
5173
- _context47.next = 2;
5355
+ _context48.next = 2;
5174
5356
  break;
5175
5357
  }
5176
5358
  throw new Error('payment 模块未初始化');
@@ -5179,17 +5361,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5179
5361
  selected: params.selected,
5180
5362
  source: params.source
5181
5363
  });
5182
- _context47.next = 5;
5364
+ _context48.next = 5;
5183
5365
  return this.syncSelectedWalletAssets(state);
5184
5366
  case 5:
5185
- return _context47.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5367
+ return _context48.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5186
5368
  case 6:
5187
5369
  case "end":
5188
- return _context47.stop();
5370
+ return _context48.stop();
5189
5371
  }
5190
- }, _callee47, this);
5372
+ }, _callee48, this);
5191
5373
  }));
5192
- function selectWalletAsset(_x40) {
5374
+ function selectWalletAsset(_x41) {
5193
5375
  return _selectWalletAsset.apply(this, arguments);
5194
5376
  }
5195
5377
  return selectWalletAsset;
@@ -5197,29 +5379,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5197
5379
  }, {
5198
5380
  key: "updateWalletAssetAmount",
5199
5381
  value: (function () {
5200
- var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
5382
+ var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
5201
5383
  var state;
5202
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5203
- while (1) switch (_context48.prev = _context48.next) {
5384
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5385
+ while (1) switch (_context49.prev = _context49.next) {
5204
5386
  case 0:
5205
5387
  if (this.store.payment) {
5206
- _context48.next = 2;
5388
+ _context49.next = 2;
5207
5389
  break;
5208
5390
  }
5209
5391
  throw new Error('payment 模块未初始化');
5210
5392
  case 2:
5211
5393
  state = this.store.payment.wallet.updateWalletAssetAmount(params.assetId, params.amount);
5212
- _context48.next = 5;
5394
+ _context49.next = 5;
5213
5395
  return this.syncSelectedWalletAssets(state);
5214
5396
  case 5:
5215
- return _context48.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5397
+ return _context49.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5216
5398
  case 6:
5217
5399
  case "end":
5218
- return _context48.stop();
5400
+ return _context49.stop();
5219
5401
  }
5220
- }, _callee48, this);
5402
+ }, _callee49, this);
5221
5403
  }));
5222
- function updateWalletAssetAmount(_x41) {
5404
+ function updateWalletAssetAmount(_x42) {
5223
5405
  return _updateWalletAssetAmount.apply(this, arguments);
5224
5406
  }
5225
5407
  return updateWalletAssetAmount;
@@ -5227,13 +5409,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5227
5409
  }, {
5228
5410
  key: "scanWalletAsset",
5229
5411
  value: (function () {
5230
- var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(code) {
5412
+ var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(code) {
5231
5413
  var wallet, businessData, result;
5232
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5233
- while (1) switch (_context49.prev = _context49.next) {
5414
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5415
+ while (1) switch (_context50.prev = _context50.next) {
5234
5416
  case 0:
5235
5417
  if (this.store.payment) {
5236
- _context49.next = 2;
5418
+ _context50.next = 2;
5237
5419
  break;
5238
5420
  }
5239
5421
  throw new Error('payment 模块未初始化');
@@ -5243,28 +5425,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5243
5425
  if (businessData) {
5244
5426
  wallet.generateWalletParams(businessData);
5245
5427
  }
5246
- _context49.next = 7;
5428
+ _context50.next = 7;
5247
5429
  return wallet.scanWalletAssetAsync(code);
5248
5430
  case 7:
5249
- result = _context49.sent;
5431
+ result = _context50.sent;
5250
5432
  if (!(result.type === 'normalCode')) {
5251
- _context49.next = 13;
5433
+ _context50.next = 13;
5252
5434
  break;
5253
5435
  }
5254
- _context49.next = 11;
5436
+ _context50.next = 11;
5255
5437
  return this.syncSelectedWalletAssets(result.state);
5256
5438
  case 11:
5257
- _context49.next = 13;
5439
+ _context50.next = 13;
5258
5440
  return this.publishWalletAssetsState(result.state, 'local');
5259
5441
  case 13:
5260
- return _context49.abrupt("return", result);
5442
+ return _context50.abrupt("return", result);
5261
5443
  case 14:
5262
5444
  case "end":
5263
- return _context49.stop();
5445
+ return _context50.stop();
5264
5446
  }
5265
- }, _callee49, this);
5447
+ }, _callee50, this);
5266
5448
  }));
5267
- function scanWalletAsset(_x42) {
5449
+ function scanWalletAsset(_x43) {
5268
5450
  return _scanWalletAsset.apply(this, arguments);
5269
5451
  }
5270
5452
  return scanWalletAsset;
@@ -5272,27 +5454,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5272
5454
  }, {
5273
5455
  key: "clearWalletAssetSelection",
5274
5456
  value: (function () {
5275
- var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50() {
5457
+ var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51() {
5276
5458
  var state;
5277
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5278
- while (1) switch (_context50.prev = _context50.next) {
5459
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5460
+ while (1) switch (_context51.prev = _context51.next) {
5279
5461
  case 0:
5280
5462
  if (this.store.payment) {
5281
- _context50.next = 2;
5463
+ _context51.next = 2;
5282
5464
  break;
5283
5465
  }
5284
5466
  throw new Error('payment 模块未初始化');
5285
5467
  case 2:
5286
5468
  state = this.store.payment.wallet.clearWalletAssetSelection();
5287
- _context50.next = 5;
5469
+ _context51.next = 5;
5288
5470
  return this.syncSelectedWalletAssets(state);
5289
5471
  case 5:
5290
- return _context50.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5472
+ return _context51.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5291
5473
  case 6:
5292
5474
  case "end":
5293
- return _context50.stop();
5475
+ return _context51.stop();
5294
5476
  }
5295
- }, _callee50, this);
5477
+ }, _callee51, this);
5296
5478
  }));
5297
5479
  function clearWalletAssetSelection() {
5298
5480
  return _clearWalletAssetSelection.apply(this, arguments);
@@ -5309,11 +5491,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5309
5491
  }, {
5310
5492
  key: "updateOrderCustomer",
5311
5493
  value: function updateOrderCustomer(customer) {
5312
- var _this$store$order$get6, _this$store$order15, _this$store$order$get7, _this$store$order16;
5494
+ var _this$store$order$get7, _this$store$order20, _this$store$order$get8, _this$store$order21;
5313
5495
  if (!this.store.order) throw new Error('order 模块未初始化');
5314
- var previousCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get6 = (_this$store$order15 = this.store.order).getTempOrder) === null || _this$store$order$get6 === void 0 ? void 0 : _this$store$order$get6.call(_this$store$order15));
5496
+ var previousCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get7 = (_this$store$order20 = this.store.order).getTempOrder) === null || _this$store$order$get7 === void 0 ? void 0 : _this$store$order$get7.call(_this$store$order20));
5315
5497
  var result = this.store.order.updateTempOrderCustomer(customer);
5316
- var nextCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get7 = (_this$store$order16 = this.store.order).getTempOrder) === null || _this$store$order$get7 === void 0 ? void 0 : _this$store$order$get7.call(_this$store$order16));
5498
+ var nextCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get8 = (_this$store$order21 = this.store.order).getTempOrder) === null || _this$store$order$get8 === void 0 ? void 0 : _this$store$order$get8.call(_this$store$order21));
5317
5499
  if (String(previousCustomerId) !== String(nextCustomerId)) {
5318
5500
  this.discountConfigCacheKey = null;
5319
5501
  this.hasManualDiscountSelection = false;
@@ -5329,35 +5511,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5329
5511
  }, {
5330
5512
  key: "getPaymentMethodsAsync",
5331
5513
  value: (function () {
5332
- var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51() {
5514
+ var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52() {
5333
5515
  var response, paymentMethods;
5334
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5335
- while (1) switch (_context51.prev = _context51.next) {
5516
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5517
+ while (1) switch (_context52.prev = _context52.next) {
5336
5518
  case 0:
5337
- _context51.prev = 0;
5338
- _context51.next = 3;
5519
+ _context52.prev = 0;
5520
+ _context52.next = 3;
5339
5521
  return this.request.get('/pay/custom-payment/all', {
5340
5522
  filterPaymentMethods: true
5341
5523
  }, {
5342
5524
  osServer: true
5343
5525
  });
5344
5526
  case 3:
5345
- response = _context51.sent;
5527
+ response = _context52.sent;
5346
5528
  paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
5347
5529
  this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
5348
- return _context51.abrupt("return", this.getPaymentMethods());
5530
+ return _context52.abrupt("return", this.getPaymentMethods());
5349
5531
  case 9:
5350
- _context51.prev = 9;
5351
- _context51.t0 = _context51["catch"](0);
5532
+ _context52.prev = 9;
5533
+ _context52.t0 = _context52["catch"](0);
5352
5534
  this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
5353
- error: _context51.t0 instanceof Error ? _context51.t0.message : String(_context51.t0)
5535
+ error: _context52.t0 instanceof Error ? _context52.t0.message : String(_context52.t0)
5354
5536
  });
5355
- return _context51.abrupt("return", this.getPaymentMethods());
5537
+ return _context52.abrupt("return", this.getPaymentMethods());
5356
5538
  case 13:
5357
5539
  case "end":
5358
- return _context51.stop();
5540
+ return _context52.stop();
5359
5541
  }
5360
- }, _callee51, this, [[0, 9]]);
5542
+ }, _callee52, this, [[0, 9]]);
5361
5543
  }));
5362
5544
  function getPaymentMethodsAsync() {
5363
5545
  return _getPaymentMethodsAsync.apply(this, arguments);
@@ -5382,8 +5564,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5382
5564
  }, {
5383
5565
  key: "getPendingWalletPaymentAmount",
5384
5566
  value: function getPendingWalletPaymentAmount() {
5385
- var _this$store$order17, _this$store$order17$g;
5386
- var payments = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ((_this$store$order17 = this.store.order) === null || _this$store$order17 === void 0 || (_this$store$order17$g = _this$store$order17.getOrderPayments) === null || _this$store$order17$g === void 0 ? void 0 : _this$store$order17$g.call(_this$store$order17)) || [];
5567
+ var _this$store$order22, _this$store$order22$g;
5568
+ var payments = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ((_this$store$order22 = this.store.order) === null || _this$store$order22 === void 0 || (_this$store$order22$g = _this$store$order22.getOrderPayments) === null || _this$store$order22$g === void 0 ? void 0 : _this$store$order22$g.call(_this$store$order22)) || [];
5387
5569
  return payments.reduce(function (total, payment) {
5388
5570
  if ((payment === null || payment === void 0 ? void 0 : payment.status) !== 'payment_pending' || (payment === null || payment === void 0 ? void 0 : payment.voucher_id) === undefined || Number(payment.voucher_id) === 0) {
5389
5571
  return total;
@@ -5400,14 +5582,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5400
5582
  }, {
5401
5583
  key: "getCashPaymentConfig",
5402
5584
  value: (function () {
5403
- var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52() {
5404
- var _this$store$order18, _this$store$order18$g, _this$store$order19, _this$store$order19$g, _this$otherParams34;
5585
+ var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53() {
5586
+ var _this$store$order23, _this$store$order23$g, _this$store$order24, _this$store$order24$g, _this$otherParams38;
5405
5587
  var paymentMethods, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, currency, recommendedAmounts;
5406
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5407
- while (1) switch (_context52.prev = _context52.next) {
5588
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5589
+ while (1) switch (_context53.prev = _context53.next) {
5408
5590
  case 0:
5409
5591
  if (this.store.payment) {
5410
- _context52.next = 2;
5592
+ _context53.next = 2;
5411
5593
  break;
5412
5594
  }
5413
5595
  throw new Error('payment 模块未初始化');
@@ -5415,21 +5597,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5415
5597
  paymentMethods = this.getPaymentMethods();
5416
5598
  paymentMethod = this.findCashPaymentMethod(paymentMethods);
5417
5599
  if (paymentMethod) {
5418
- _context52.next = 9;
5600
+ _context53.next = 9;
5419
5601
  break;
5420
5602
  }
5421
- _context52.next = 7;
5603
+ _context53.next = 7;
5422
5604
  return this.getPaymentMethodsAsync();
5423
5605
  case 7:
5424
- paymentMethods = _context52.sent;
5606
+ paymentMethods = _context53.sent;
5425
5607
  paymentMethod = this.findCashPaymentMethod(paymentMethods);
5426
5608
  case 9:
5427
- amountSnapshot = (_this$store$order18 = this.store.order) === null || _this$store$order18 === void 0 || (_this$store$order18$g = _this$store$order18.getOrderAmountSnapshot) === null || _this$store$order18$g === void 0 ? void 0 : _this$store$order18$g.call(_this$store$order18);
5609
+ amountSnapshot = (_this$store$order23 = this.store.order) === null || _this$store$order23 === void 0 || (_this$store$order23$g = _this$store$order23.getOrderAmountSnapshot) === null || _this$store$order23$g === void 0 ? void 0 : _this$store$order23$g.call(_this$store$order23);
5428
5610
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
5429
5611
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
5430
- currency = ((_this$store$order19 = this.store.order) === null || _this$store$order19 === void 0 || (_this$store$order19$g = _this$store$order19.getTempOrder) === null || _this$store$order19$g === void 0 || (_this$store$order19$g = _this$store$order19$g.call(_this$store$order19)) === null || _this$store$order19$g === void 0 ? void 0 : _this$store$order19$g.currency_code) || ((_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.currency) || 'USD';
5612
+ currency = ((_this$store$order24 = this.store.order) === null || _this$store$order24 === void 0 || (_this$store$order24$g = _this$store$order24.getTempOrder) === null || _this$store$order24$g === void 0 || (_this$store$order24$g = _this$store$order24$g.call(_this$store$order24)) === null || _this$store$order24$g === void 0 ? void 0 : _this$store$order24$g.currency_code) || ((_this$otherParams38 = this.otherParams) === null || _this$otherParams38 === void 0 ? void 0 : _this$otherParams38.currency) || 'USD';
5431
5613
  recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
5432
- return _context52.abrupt("return", {
5614
+ return _context53.abrupt("return", {
5433
5615
  available: Boolean(paymentMethod && amountDue > 0),
5434
5616
  paymentMethod: paymentMethod,
5435
5617
  amountDue: amountDue,
@@ -5437,9 +5619,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5437
5619
  });
5438
5620
  case 15:
5439
5621
  case "end":
5440
- return _context52.stop();
5622
+ return _context53.stop();
5441
5623
  }
5442
- }, _callee52, this);
5624
+ }, _callee53, this);
5443
5625
  }));
5444
5626
  function getCashPaymentConfig() {
5445
5627
  return _getCashPaymentConfig.apply(this, arguments);
@@ -5456,42 +5638,42 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5456
5638
  }, {
5457
5639
  key: "confirmWalletPayment",
5458
5640
  value: (function () {
5459
- var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53() {
5460
- var _this$store$order$get8, _this$store$order20, _this$store$order$get10, _this$store$order$get11, _this$store$order22;
5461
- var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get9, _this$store$order21, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
5462
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5463
- while (1) switch (_context53.prev = _context53.next) {
5641
+ var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54() {
5642
+ var _this$store$order$get9, _this$store$order25, _this$store$order$get11, _this$store$order$get12, _this$store$order27;
5643
+ var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get10, _this$store$order26, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
5644
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5645
+ while (1) switch (_context54.prev = _context54.next) {
5464
5646
  case 0:
5465
5647
  if (this.store.order) {
5466
- _context53.next = 2;
5648
+ _context54.next = 2;
5467
5649
  break;
5468
5650
  }
5469
5651
  throw new Error('order 模块未初始化');
5470
5652
  case 2:
5471
5653
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
5472
5654
  pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
5473
- amountSnapshot = (_this$store$order$get8 = (_this$store$order20 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get8 === void 0 ? void 0 : _this$store$order$get8.call(_this$store$order20);
5655
+ amountSnapshot = (_this$store$order$get9 = (_this$store$order25 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.call(_this$store$order25);
5474
5656
  if (!pendingWalletAmount.lte(0)) {
5475
- _context53.next = 14;
5657
+ _context54.next = 14;
5476
5658
  break;
5477
5659
  }
5478
5660
  this.logWarning('confirmWalletPayment: 未发现待确认 Wallet 支付,跳过 Wallet 确认并按普通订单提交', {
5479
5661
  amountGap: amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap
5480
5662
  });
5481
- _context53.next = 9;
5663
+ _context54.next = 9;
5482
5664
  return this.submitSalesOrder({
5483
5665
  smallTicketDataFlag: 1
5484
5666
  });
5485
5667
  case 9:
5486
- _submitResult = _context53.sent;
5668
+ _submitResult = _context54.sent;
5487
5669
  if (!isRejectedSalesSubmitResult(_submitResult)) {
5488
- _context53.next = 12;
5670
+ _context54.next = 12;
5489
5671
  break;
5490
5672
  }
5491
5673
  throw new Error(getSalesSubmitErrorMessage(_submitResult, '订单提交失败'));
5492
5674
  case 12:
5493
- _latestAmountSnapshot = (_this$store$order$get9 = (_this$store$order21 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.call(_this$store$order21);
5494
- return _context53.abrupt("return", {
5675
+ _latestAmountSnapshot = (_this$store$order$get10 = (_this$store$order26 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get10 === void 0 ? void 0 : _this$store$order$get10.call(_this$store$order26);
5676
+ return _context54.abrupt("return", {
5495
5677
  submitResult: _submitResult,
5496
5678
  payments: this.store.order.getOrderPayments(),
5497
5679
  isOrderFullyPaid: new Decimal((_latestAmountSnapshot === null || _latestAmountSnapshot === void 0 ? void 0 : _latestAmountSnapshot.amountGap) || 0).lte(0)
@@ -5499,74 +5681,74 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5499
5681
  case 14:
5500
5682
  effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
5501
5683
  if (!effectiveAmountDue.gt(0.01)) {
5502
- _context53.next = 17;
5684
+ _context54.next = 17;
5503
5685
  break;
5504
5686
  }
5505
5687
  throw new Error('Wallet 支付尚未覆盖全部待支付金额');
5506
5688
  case 17:
5507
- beforePaymentStatus = (_this$store$order$get10 = this.store.order.getTempOrder()) === null || _this$store$order$get10 === void 0 ? void 0 : _this$store$order$get10.payment_status;
5508
- _context53.prev = 18;
5509
- _context53.next = 21;
5689
+ beforePaymentStatus = (_this$store$order$get11 = this.store.order.getTempOrder()) === null || _this$store$order$get11 === void 0 ? void 0 : _this$store$order$get11.payment_status;
5690
+ _context54.prev = 18;
5691
+ _context54.next = 21;
5510
5692
  return this.submitSalesOrder({
5511
5693
  smallTicketDataFlag: 1,
5512
5694
  confirmPendingVoucherPayments: true
5513
5695
  });
5514
5696
  case 21:
5515
- submitResult = _context53.sent;
5697
+ submitResult = _context54.sent;
5516
5698
  if (!isRejectedSalesSubmitResult(submitResult)) {
5517
- _context53.next = 24;
5699
+ _context54.next = 24;
5518
5700
  break;
5519
5701
  }
5520
5702
  throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
5521
5703
  case 24:
5522
- _context53.next = 34;
5704
+ _context54.next = 34;
5523
5705
  break;
5524
5706
  case 26:
5525
- _context53.prev = 26;
5526
- _context53.t0 = _context53["catch"](18);
5707
+ _context54.prev = 26;
5708
+ _context54.t0 = _context54["catch"](18);
5527
5709
  this.store.order.setOrderPayments(beforePayments);
5528
5710
  restoredTempOrder = this.store.order.getTempOrder();
5529
5711
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
5530
5712
  restoredTempOrder.payment_status = beforePaymentStatus;
5531
5713
  this.store.order.persistTempOrder();
5532
5714
  }
5533
- _context53.next = 33;
5715
+ _context54.next = 33;
5534
5716
  return this.store.order.recalculateSummary({
5535
5717
  createIfMissing: true
5536
5718
  });
5537
5719
  case 33:
5538
- throw _context53.t0;
5720
+ throw _context54.t0;
5539
5721
  case 34:
5540
5722
  if (!this.store.payment) {
5541
- _context53.next = 45;
5723
+ _context54.next = 45;
5542
5724
  break;
5543
5725
  }
5544
- _context53.prev = 35;
5726
+ _context54.prev = 35;
5545
5727
  committed = this.getCommittedWalletAssets();
5546
5728
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5547
- _context53.next = 40;
5729
+ _context54.next = 40;
5548
5730
  return this.publishWalletAssetsState(walletState, 'local');
5549
5731
  case 40:
5550
- _context53.next = 45;
5732
+ _context54.next = 45;
5551
5733
  break;
5552
5734
  case 42:
5553
- _context53.prev = 42;
5554
- _context53.t1 = _context53["catch"](35);
5735
+ _context54.prev = 42;
5736
+ _context54.t1 = _context54["catch"](35);
5555
5737
  this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
5556
- error: _context53.t1 instanceof Error ? _context53.t1.message : String(_context53.t1)
5738
+ error: _context54.t1 instanceof Error ? _context54.t1.message : String(_context54.t1)
5557
5739
  });
5558
5740
  case 45:
5559
- latestAmountSnapshot = (_this$store$order$get11 = (_this$store$order22 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get11 === void 0 ? void 0 : _this$store$order$get11.call(_this$store$order22);
5560
- return _context53.abrupt("return", {
5741
+ latestAmountSnapshot = (_this$store$order$get12 = (_this$store$order27 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get12 === void 0 ? void 0 : _this$store$order$get12.call(_this$store$order27);
5742
+ return _context54.abrupt("return", {
5561
5743
  submitResult: submitResult,
5562
5744
  payments: this.store.order.getOrderPayments(),
5563
5745
  isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
5564
5746
  });
5565
5747
  case 47:
5566
5748
  case "end":
5567
- return _context53.stop();
5749
+ return _context54.stop();
5568
5750
  }
5569
- }, _callee53, this, [[18, 26], [35, 42]]);
5751
+ }, _callee54, this, [[18, 26], [35, 42]]);
5570
5752
  }));
5571
5753
  function confirmWalletPayment() {
5572
5754
  return _confirmWalletPayment.apply(this, arguments);
@@ -5581,38 +5763,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5581
5763
  }, {
5582
5764
  key: "payCash",
5583
5765
  value: (function () {
5584
- var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(params) {
5585
- var _this$store$order$get12, _params$actualPaidAmo, _this$otherParams35, _this$window, _this$window$postMess;
5766
+ var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
5767
+ var _this$store$order$get13, _params$actualPaidAmo, _this$otherParams39, _this$window, _this$window$postMess;
5586
5768
  var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
5587
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5588
- while (1) switch (_context54.prev = _context54.next) {
5769
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5770
+ while (1) switch (_context55.prev = _context55.next) {
5589
5771
  case 0:
5590
5772
  if (this.store.order) {
5591
- _context54.next = 2;
5773
+ _context55.next = 2;
5592
5774
  break;
5593
5775
  }
5594
5776
  throw new Error('order 模块未初始化');
5595
5777
  case 2:
5596
5778
  amount = Number(params.amount || 0);
5597
5779
  if (!(!Number.isFinite(amount) || amount <= 0)) {
5598
- _context54.next = 5;
5780
+ _context55.next = 5;
5599
5781
  break;
5600
5782
  }
5601
5783
  throw new Error('现金支付金额必须大于 0');
5602
5784
  case 5:
5603
- _context54.next = 7;
5785
+ _context55.next = 7;
5604
5786
  return this.getCashPaymentConfig();
5605
5787
  case 7:
5606
- config = _context54.sent;
5788
+ config = _context55.sent;
5607
5789
  paymentMethod = config.paymentMethod;
5608
5790
  if (paymentMethod) {
5609
- _context54.next = 11;
5791
+ _context55.next = 11;
5610
5792
  break;
5611
5793
  }
5612
5794
  throw new Error('未找到可用的 CASHMANUAL 支付方式');
5613
5795
  case 11:
5614
5796
  if (!(config.amountDue <= 0)) {
5615
- _context54.next = 13;
5797
+ _context55.next = 13;
5616
5798
  break;
5617
5799
  }
5618
5800
  throw new Error('当前订单没有待支付金额');
@@ -5620,24 +5802,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5620
5802
  roundingAmount = Number(params.roundingAmount || 0);
5621
5803
  effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
5622
5804
  if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
5623
- _context54.next = 17;
5805
+ _context55.next = 17;
5624
5806
  break;
5625
5807
  }
5626
5808
  throw new Error('现金支付金额超过当前待支付金额');
5627
5809
  case 17:
5628
5810
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
5629
- beforePaymentStatus = (_this$store$order$get12 = this.store.order.getTempOrder()) === null || _this$store$order$get12 === void 0 ? void 0 : _this$store$order$get12.payment_status;
5811
+ beforePaymentStatus = (_this$store$order$get13 = this.store.order.getTempOrder()) === null || _this$store$order$get13 === void 0 ? void 0 : _this$store$order$get13.payment_status;
5630
5812
  uniquePaymentNumber = createUuidV4();
5631
5813
  paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
5632
5814
  actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
5633
5815
  changeAmount = Number(params.changeAmount || 0);
5634
- shopWalletPassId = (_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.shop_wallet_pass_id;
5816
+ shopWalletPassId = (_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.shop_wallet_pass_id;
5635
5817
  if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
5636
- _context54.next = 26;
5818
+ _context55.next = 26;
5637
5819
  break;
5638
5820
  }
5639
5821
  throw new Error('顾客实收现金不能小于支付金额');
5640
5822
  case 26:
5823
+ if (!this.isPickupTimingEnabled()) {
5824
+ _context55.next = 29;
5825
+ break;
5826
+ }
5827
+ _context55.next = 29;
5828
+ return this.preparePickupTimingForCheckout({
5829
+ freeze: true
5830
+ });
5831
+ case 29:
5641
5832
  (_this$window = this.window) === null || _this$window === void 0 || (_this$window = _this$window.interaction) === null || _this$window === void 0 || (_this$window = _this$window.utils) === null || _this$window === void 0 || (_this$window$postMess = _this$window.postMessageToApp) === null || _this$window$postMess === void 0 || _this$window$postMess.call(_this$window, {
5642
5833
  module: 'till',
5643
5834
  key: 'open_till',
@@ -5668,59 +5859,59 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5668
5859
  var _item$metadata2;
5669
5860
  return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
5670
5861
  });
5671
- _context54.prev = 29;
5672
- _context54.next = 32;
5862
+ _context55.prev = 32;
5863
+ _context55.next = 35;
5673
5864
  return this.syncPaymentsToOrder({
5674
5865
  payments: payments,
5675
5866
  submitWhenPaid: true,
5676
5867
  smallTicketDataFlag: 1,
5677
5868
  confirmPendingVoucherPayments: true
5678
5869
  });
5679
- case 32:
5680
- syncResult = _context54.sent;
5870
+ case 35:
5871
+ syncResult = _context55.sent;
5681
5872
  if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
5682
- _context54.next = 35;
5873
+ _context55.next = 38;
5683
5874
  break;
5684
5875
  }
5685
5876
  throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
5686
- case 35:
5877
+ case 38:
5687
5878
  if (!this.store.payment) {
5688
- _context54.next = 40;
5879
+ _context55.next = 43;
5689
5880
  break;
5690
5881
  }
5691
5882
  committed = this.getCommittedWalletAssets();
5692
5883
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5693
- _context54.next = 40;
5884
+ _context55.next = 43;
5694
5885
  return this.publishWalletAssetsState(walletState, 'local');
5695
- case 40:
5696
- return _context54.abrupt("return", {
5886
+ case 43:
5887
+ return _context55.abrupt("return", {
5697
5888
  payment: payment || {},
5698
5889
  payments: this.store.order.getOrderPayments(),
5699
5890
  syncResult: syncResult,
5700
5891
  isOrderFullyPaid: syncResult.isOrderFullyPaid
5701
5892
  });
5702
- case 43:
5703
- _context54.prev = 43;
5704
- _context54.t0 = _context54["catch"](29);
5893
+ case 46:
5894
+ _context55.prev = 46;
5895
+ _context55.t0 = _context55["catch"](32);
5705
5896
  this.store.order.setOrderPayments(beforePayments);
5706
5897
  restoredTempOrder = this.store.order.getTempOrder();
5707
5898
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
5708
5899
  restoredTempOrder.payment_status = beforePaymentStatus;
5709
5900
  this.store.order.persistTempOrder();
5710
5901
  }
5711
- _context54.next = 50;
5902
+ _context55.next = 53;
5712
5903
  return this.store.order.recalculateSummary({
5713
5904
  createIfMissing: true
5714
5905
  });
5715
- case 50:
5716
- throw _context54.t0;
5717
- case 51:
5906
+ case 53:
5907
+ throw _context55.t0;
5908
+ case 54:
5718
5909
  case "end":
5719
- return _context54.stop();
5910
+ return _context55.stop();
5720
5911
  }
5721
- }, _callee54, this, [[29, 43]]);
5912
+ }, _callee55, this, [[32, 46]]);
5722
5913
  }));
5723
- function payCash(_x43) {
5914
+ function payCash(_x44) {
5724
5915
  return _payCash.apply(this, arguments);
5725
5916
  }
5726
5917
  return payCash;
@@ -5736,21 +5927,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5736
5927
  }, {
5737
5928
  key: "commitPaymentMethodPayment",
5738
5929
  value: (function () {
5739
- var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
5740
- var _this$store$order$get13, _this$store$order23, _this$store$order$get14, _params$metadata, _params$originAmount;
5930
+ var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
5931
+ var _this$store$order$get14, _this$store$order28, _this$store$order$get15, _params$metadata, _params$originAmount;
5741
5932
  var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
5742
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5743
- while (1) switch (_context55.prev = _context55.next) {
5933
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5934
+ while (1) switch (_context56.prev = _context56.next) {
5744
5935
  case 0:
5745
5936
  if (this.store.order) {
5746
- _context55.next = 2;
5937
+ _context56.next = 2;
5747
5938
  break;
5748
5939
  }
5749
5940
  throw new Error('order 模块未初始化');
5750
5941
  case 2:
5751
5942
  amount = Number(params.amount || 0);
5752
5943
  if (!(!Number.isFinite(amount) || amount <= 0)) {
5753
- _context55.next = 5;
5944
+ _context56.next = 5;
5754
5945
  break;
5755
5946
  }
5756
5947
  throw new Error('支付金额必须大于 0');
@@ -5766,38 +5957,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5766
5957
  };
5767
5958
  paymentMethod = findPaymentMethod();
5768
5959
  if (paymentMethod) {
5769
- _context55.next = 13;
5960
+ _context56.next = 13;
5770
5961
  break;
5771
5962
  }
5772
- _context55.next = 11;
5963
+ _context56.next = 11;
5773
5964
  return this.getPaymentMethodsAsync();
5774
5965
  case 11:
5775
- paymentMethods = _context55.sent;
5966
+ paymentMethods = _context56.sent;
5776
5967
  paymentMethod = findPaymentMethod();
5777
5968
  case 13:
5778
5969
  if (paymentMethod) {
5779
- _context55.next = 15;
5970
+ _context56.next = 15;
5780
5971
  break;
5781
5972
  }
5782
5973
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
5783
5974
  case 15:
5784
- amountSnapshot = (_this$store$order$get13 = (_this$store$order23 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get13 === void 0 ? void 0 : _this$store$order$get13.call(_this$store$order23);
5975
+ amountSnapshot = (_this$store$order$get14 = (_this$store$order28 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get14 === void 0 ? void 0 : _this$store$order$get14.call(_this$store$order28);
5785
5976
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
5786
5977
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
5787
5978
  if (!amountDue.lte(0)) {
5788
- _context55.next = 20;
5979
+ _context56.next = 20;
5789
5980
  break;
5790
5981
  }
5791
5982
  throw new Error('当前订单没有待支付金额');
5792
5983
  case 20:
5793
5984
  if (!new Decimal(amount).gt(amountDue.plus(0.01))) {
5794
- _context55.next = 22;
5985
+ _context56.next = 22;
5795
5986
  break;
5796
5987
  }
5797
5988
  throw new Error('支付金额超过当前待支付金额');
5798
5989
  case 22:
5799
5990
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
5800
- beforePaymentStatus = (_this$store$order$get14 = this.store.order.getTempOrder()) === null || _this$store$order$get14 === void 0 ? void 0 : _this$store$order$get14.payment_status;
5991
+ beforePaymentStatus = (_this$store$order$get15 = this.store.order.getTempOrder()) === null || _this$store$order$get15 === void 0 ? void 0 : _this$store$order$get15.payment_status;
5801
5992
  paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
5802
5993
  metadata = _objectSpread(_objectSpread({}, params.metadata || {}), {}, {
5803
5994
  unique_payment_number: ((_params$metadata = params.metadata) === null || _params$metadata === void 0 ? void 0 : _params$metadata.unique_payment_number) || createUuidV4()
@@ -5830,8 +6021,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5830
6021
  var _item$metadata3;
5831
6022
  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;
5832
6023
  });
5833
- _context55.prev = 30;
5834
- _context55.next = 33;
6024
+ _context56.prev = 30;
6025
+ _context56.next = 33;
5835
6026
  return this.syncPaymentsToOrder({
5836
6027
  payments: payments,
5837
6028
  submitWhenPaid: true,
@@ -5839,50 +6030,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5839
6030
  confirmPendingVoucherPayments: true
5840
6031
  });
5841
6032
  case 33:
5842
- syncResult = _context55.sent;
6033
+ syncResult = _context56.sent;
5843
6034
  if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
5844
- _context55.next = 36;
6035
+ _context56.next = 36;
5845
6036
  break;
5846
6037
  }
5847
6038
  throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
5848
6039
  case 36:
5849
6040
  if (!this.store.payment) {
5850
- _context55.next = 41;
6041
+ _context56.next = 41;
5851
6042
  break;
5852
6043
  }
5853
6044
  committed = this.getCommittedWalletAssets();
5854
6045
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5855
- _context55.next = 41;
6046
+ _context56.next = 41;
5856
6047
  return this.publishWalletAssetsState(walletState, 'local');
5857
6048
  case 41:
5858
- return _context55.abrupt("return", {
6049
+ return _context56.abrupt("return", {
5859
6050
  payment: payment || {},
5860
6051
  payments: this.store.order.getOrderPayments(),
5861
6052
  syncResult: syncResult,
5862
6053
  isOrderFullyPaid: syncResult.isOrderFullyPaid
5863
6054
  });
5864
6055
  case 44:
5865
- _context55.prev = 44;
5866
- _context55.t0 = _context55["catch"](30);
6056
+ _context56.prev = 44;
6057
+ _context56.t0 = _context56["catch"](30);
5867
6058
  this.store.order.setOrderPayments(beforePayments);
5868
6059
  restoredTempOrder = this.store.order.getTempOrder();
5869
6060
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
5870
6061
  restoredTempOrder.payment_status = beforePaymentStatus;
5871
6062
  this.store.order.persistTempOrder();
5872
6063
  }
5873
- _context55.next = 51;
6064
+ _context56.next = 51;
5874
6065
  return this.store.order.recalculateSummary({
5875
6066
  createIfMissing: true
5876
6067
  });
5877
6068
  case 51:
5878
- throw _context55.t0;
6069
+ throw _context56.t0;
5879
6070
  case 52:
5880
6071
  case "end":
5881
- return _context55.stop();
6072
+ return _context56.stop();
5882
6073
  }
5883
- }, _callee55, this, [[30, 44]]);
6074
+ }, _callee56, this, [[30, 44]]);
5884
6075
  }));
5885
- function commitPaymentMethodPayment(_x44) {
6076
+ function commitPaymentMethodPayment(_x45) {
5886
6077
  return _commitPaymentMethodPayment.apply(this, arguments);
5887
6078
  }
5888
6079
  return commitPaymentMethodPayment;
@@ -5897,40 +6088,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5897
6088
  }, {
5898
6089
  key: "roundAmount",
5899
6090
  value: (function () {
5900
- var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
6091
+ var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
5901
6092
  var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
5902
6093
  var amount, cashManualPayment;
5903
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5904
- while (1) switch (_context56.prev = _context56.next) {
6094
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6095
+ while (1) switch (_context57.prev = _context57.next) {
5905
6096
  case 0:
5906
6097
  amount = params.amount;
5907
6098
  cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
5908
6099
  return paymentMethod.code === 'CASHMANUAL';
5909
6100
  });
5910
6101
  if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
5911
- _context56.next = 4;
6102
+ _context57.next = 4;
5912
6103
  break;
5913
6104
  }
5914
- return _context56.abrupt("return", {
6105
+ return _context57.abrupt("return", {
5915
6106
  originalAmount: amount.toString(),
5916
6107
  roundedAmount: amount.toString(),
5917
6108
  roundingDifference: '0.00'
5918
6109
  });
5919
6110
  case 4:
5920
6111
  if (this.payment) {
5921
- _context56.next = 6;
6112
+ _context57.next = 6;
5922
6113
  break;
5923
6114
  }
5924
6115
  throw new Error('payment 模块未初始化');
5925
6116
  case 6:
5926
- return _context56.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));
6117
+ return _context57.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));
5927
6118
  case 7:
5928
6119
  case "end":
5929
- return _context56.stop();
6120
+ return _context57.stop();
5930
6121
  }
5931
- }, _callee56, this);
6122
+ }, _callee57, this);
5932
6123
  }));
5933
- function roundAmount(_x45) {
6124
+ function roundAmount(_x46) {
5934
6125
  return _roundAmount.apply(this, arguments);
5935
6126
  }
5936
6127
  return roundAmount;
@@ -5945,49 +6136,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5945
6136
  }, {
5946
6137
  key: "sendCustomerPayLink",
5947
6138
  value: (function () {
5948
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
6139
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
5949
6140
  var orderIds, _ref52, _ref53, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
5950
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5951
- while (1) switch (_context57.prev = _context57.next) {
6141
+ return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6142
+ while (1) switch (_context58.prev = _context58.next) {
5952
6143
  case 0:
5953
6144
  if (this.store.order) {
5954
- _context57.next = 2;
6145
+ _context58.next = 2;
5955
6146
  break;
5956
6147
  }
5957
6148
  throw new Error('order 模块未初始化');
5958
6149
  case 2:
5959
6150
  orderIds = params.order_ids || params.orderIds || [];
5960
6151
  if (!(!orderIds.length || params.submitBeforeSend)) {
5961
- _context57.next = 11;
6152
+ _context58.next = 11;
5962
6153
  break;
5963
6154
  }
5964
- _context57.next = 6;
6155
+ _context58.next = 6;
5965
6156
  return this.submitSalesOrder({
5966
6157
  smallTicketDataFlag: 1
5967
6158
  });
5968
6159
  case 6:
5969
- submitResult = _context57.sent;
6160
+ submitResult = _context58.sent;
5970
6161
  orderId = (_ref52 = (_ref53 = (_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 && _ref53 !== void 0 ? _ref53 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref52 !== void 0 ? _ref52 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
5971
6162
  if (orderId) {
5972
- _context57.next = 10;
6163
+ _context58.next = 10;
5973
6164
  break;
5974
6165
  }
5975
6166
  throw new Error('本地订单提交云端失败,无法发送支付链接');
5976
6167
  case 10:
5977
6168
  orderIds = [orderId];
5978
6169
  case 11:
5979
- return _context57.abrupt("return", this.store.order.sendCustomerPayLink({
6170
+ return _context58.abrupt("return", this.store.order.sendCustomerPayLink({
5980
6171
  emails: params.emails,
5981
6172
  notify_action: params.notify_action,
5982
6173
  order_ids: orderIds
5983
6174
  }));
5984
6175
  case 12:
5985
6176
  case "end":
5986
- return _context57.stop();
6177
+ return _context58.stop();
5987
6178
  }
5988
- }, _callee57, this);
6179
+ }, _callee58, this);
5989
6180
  }));
5990
- function sendCustomerPayLink(_x46) {
6181
+ function sendCustomerPayLink(_x47) {
5991
6182
  return _sendCustomerPayLink.apply(this, arguments);
5992
6183
  }
5993
6184
  return sendCustomerPayLink;
@@ -6000,20 +6191,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6000
6191
  }, {
6001
6192
  key: "calculateProductBookingPrice",
6002
6193
  value: function () {
6003
- var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
6194
+ var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(params) {
6004
6195
  var _params$customer_id;
6005
6196
  var useCustomerUserPricing, quotation, customerId, channel, _yield$this$resolvePr, _yield$this$resolvePr2, authoritativeProduct, product;
6006
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6007
- while (1) switch (_context58.prev = _context58.next) {
6197
+ return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6198
+ while (1) switch (_context59.prev = _context59.next) {
6008
6199
  case 0:
6009
6200
  useCustomerUserPricing = this.isCustomerUserPriceQuery();
6010
6201
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
6011
6202
  customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
6012
- _context58.next = 5;
6203
+ _context59.next = 5;
6013
6204
  return this.prepareProductPriceQueryContext(customerId);
6014
6205
  case 5:
6015
6206
  channel = this.getPriceQueryChannel(params.channel);
6016
- _context58.next = 8;
6207
+ _context59.next = 8;
6017
6208
  return this.resolveProductsForPriceQuery({
6018
6209
  priceQueries: [params],
6019
6210
  schedule: this.getPriceQuerySchedule(params),
@@ -6021,22 +6212,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6021
6212
  channel: channel
6022
6213
  });
6023
6214
  case 8:
6024
- _yield$this$resolvePr = _context58.sent;
6215
+ _yield$this$resolvePr = _context59.sent;
6025
6216
  _yield$this$resolvePr2 = _slicedToArray(_yield$this$resolvePr, 1);
6026
6217
  authoritativeProduct = _yield$this$resolvePr2[0];
6027
6218
  product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
6028
6219
  if (useCustomerUserPricing) {
6029
- _context58.next = 15;
6220
+ _context59.next = 15;
6030
6221
  break;
6031
6222
  }
6032
- _context58.next = 15;
6223
+ _context59.next = 15;
6033
6224
  return this.loadQuotationForPriceQuery({
6034
6225
  quotation: quotation,
6035
6226
  customer_id: customerId,
6036
6227
  channel: channel
6037
6228
  });
6038
6229
  case 15:
6039
- return _context58.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
6230
+ return _context59.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
6040
6231
  channel: channel,
6041
6232
  product: product,
6042
6233
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
@@ -6045,11 +6236,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6045
6236
  })));
6046
6237
  case 16:
6047
6238
  case "end":
6048
- return _context58.stop();
6239
+ return _context59.stop();
6049
6240
  }
6050
- }, _callee58, this);
6241
+ }, _callee59, this);
6051
6242
  }));
6052
- function calculateProductBookingPrice(_x47) {
6243
+ function calculateProductBookingPrice(_x48) {
6053
6244
  return _calculateProductBookingPrice.apply(this, arguments);
6054
6245
  }
6055
6246
  return calculateProductBookingPrice;
@@ -6057,7 +6248,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6057
6248
  }, {
6058
6249
  key: "getQuotationCustomerScopeInfo",
6059
6250
  value: function getQuotationCustomerScopeInfo() {
6060
- var _this18 = this;
6251
+ var _this19 = this;
6061
6252
  var quotation = this.store.quotation;
6062
6253
  if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
6063
6254
  return quotation.getQuotationCustomerScopeInfo();
@@ -6069,7 +6260,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6069
6260
  }).map(function (item) {
6070
6261
  var localSeen = new Set();
6071
6262
  var customers = item.customer.filter(function (customer) {
6072
- var customerId = _this18.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
6263
+ var customerId = _this19.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
6073
6264
  if (!customerId || localSeen.has(customerId)) return false;
6074
6265
  localSeen.add(customerId);
6075
6266
  if (!customerById.has(customerId)) customerById.set(customerId, customer);
@@ -6096,8 +6287,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6096
6287
  }, {
6097
6288
  key: "hasSmartPricingStrategies",
6098
6289
  value: function hasSmartPricingStrategies() {
6099
- var _this$core4;
6100
- var evaluator = (_this$core4 = this.core) === null || _this$core4 === void 0 || (_this$core4 = _this$core4.context) === null || _this$core4 === void 0 ? void 0 : _this$core4.dataVariantEvaluator;
6290
+ var _this$core5;
6291
+ var evaluator = (_this$core5 = this.core) === null || _this$core5 === void 0 || (_this$core5 = _this$core5.context) === null || _this$core5 === void 0 ? void 0 : _this$core5.dataVariantEvaluator;
6101
6292
  if (!evaluator || typeof evaluator.getStrategyConfigs !== 'function') {
6102
6293
  return false;
6103
6294
  }
@@ -6133,23 +6324,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6133
6324
  }, {
6134
6325
  key: "calculateProductBookingPrices",
6135
6326
  value: function () {
6136
- var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(paramsList) {
6137
- var _this19 = this;
6327
+ var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(paramsList) {
6328
+ var _this20 = this;
6138
6329
  var useCustomerUserPricing, quotation, currentOrderCustomerId, resolvedChannels, authoritativeProducts, groups, quotationContexts;
6139
- return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6140
- while (1) switch (_context60.prev = _context60.next) {
6330
+ return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6331
+ while (1) switch (_context61.prev = _context61.next) {
6141
6332
  case 0:
6142
6333
  if (paramsList.length) {
6143
- _context60.next = 2;
6334
+ _context61.next = 2;
6144
6335
  break;
6145
6336
  }
6146
- return _context60.abrupt("return", []);
6337
+ return _context61.abrupt("return", []);
6147
6338
  case 2:
6148
6339
  useCustomerUserPricing = this.isCustomerUserPriceQuery();
6149
6340
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
6150
6341
  currentOrderCustomerId = this.getCurrentOrderCustomerId();
6151
6342
  resolvedChannels = paramsList.map(function (params) {
6152
- return _this19.getPriceQueryChannel(params.channel);
6343
+ return _this20.getPriceQueryChannel(params.channel);
6153
6344
  });
6154
6345
  authoritativeProducts = paramsList.map(function () {
6155
6346
  return null;
@@ -6157,10 +6348,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6157
6348
  groups = new Map();
6158
6349
  paramsList.forEach(function (params, index) {
6159
6350
  var _params$customer_id2;
6160
- var schedule = _this19.getPriceQuerySchedule(params);
6351
+ var schedule = _this20.getPriceQuerySchedule(params);
6161
6352
  var channel = resolvedChannels[index];
6162
6353
  var customerId = (_params$customer_id2 = params.customer_id) !== null && _params$customer_id2 !== void 0 ? _params$customer_id2 : currentOrderCustomerId;
6163
- var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || '', _this19.normalizePriceContextCustomerId(customerId) || ''].join('|');
6354
+ var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || '', _this20.normalizePriceContextCustomerId(customerId) || ''].join('|');
6164
6355
  var group = groups.get(groupKey) || {
6165
6356
  indices: [],
6166
6357
  schedule: schedule,
@@ -6170,44 +6361,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6170
6361
  group.indices.push(index);
6171
6362
  groups.set(groupKey, group);
6172
6363
  });
6173
- _context60.next = 11;
6364
+ _context61.next = 11;
6174
6365
  return Promise.all(Array.from(groups.values()).map( /*#__PURE__*/function () {
6175
- var _ref54 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(group) {
6366
+ var _ref54 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(group) {
6176
6367
  var priceQueries, resolvedProducts;
6177
- return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6178
- while (1) switch (_context59.prev = _context59.next) {
6368
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6369
+ while (1) switch (_context60.prev = _context60.next) {
6179
6370
  case 0:
6180
- _context59.next = 2;
6181
- return _this19.prepareProductPriceQueryContext(group.customerId);
6371
+ _context60.next = 2;
6372
+ return _this20.prepareProductPriceQueryContext(group.customerId);
6182
6373
  case 2:
6183
6374
  priceQueries = group.indices.map(function (index) {
6184
6375
  return paramsList[index];
6185
6376
  });
6186
- _context59.next = 5;
6187
- return _this19.resolveProductsForPriceQuery({
6377
+ _context60.next = 5;
6378
+ return _this20.resolveProductsForPriceQuery({
6188
6379
  priceQueries: priceQueries,
6189
6380
  schedule: group.schedule,
6190
6381
  customerId: group.customerId,
6191
6382
  channel: group.channel
6192
6383
  });
6193
6384
  case 5:
6194
- resolvedProducts = _context59.sent;
6385
+ resolvedProducts = _context60.sent;
6195
6386
  group.indices.forEach(function (originalIndex, groupIndex) {
6196
6387
  authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
6197
6388
  });
6198
6389
  case 7:
6199
6390
  case "end":
6200
- return _context59.stop();
6391
+ return _context60.stop();
6201
6392
  }
6202
- }, _callee59);
6393
+ }, _callee60);
6203
6394
  }));
6204
- return function (_x49) {
6395
+ return function (_x50) {
6205
6396
  return _ref54.apply(this, arguments);
6206
6397
  };
6207
6398
  }()));
6208
6399
  case 11:
6209
6400
  if (useCustomerUserPricing) {
6210
- _context60.next = 16;
6401
+ _context61.next = 16;
6211
6402
  break;
6212
6403
  }
6213
6404
  quotationContexts = new Map();
@@ -6221,18 +6412,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6221
6412
  customer_id: (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId
6222
6413
  });
6223
6414
  });
6224
- _context60.next = 16;
6415
+ _context61.next = 16;
6225
6416
  return Promise.all(Array.from(quotationContexts.values()).map(function (context) {
6226
- return _this19.loadQuotationForPriceQuery(_objectSpread({
6417
+ return _this20.loadQuotationForPriceQuery(_objectSpread({
6227
6418
  quotation: quotation
6228
6419
  }, context));
6229
6420
  }));
6230
6421
  case 16:
6231
- return _context60.abrupt("return", paramsList.map(function (params, index) {
6422
+ return _context61.abrupt("return", paramsList.map(function (params, index) {
6232
6423
  var _params$customer_id4;
6233
6424
  var productInput = params.product || {};
6234
6425
  var authoritativeProduct = authoritativeProducts[index];
6235
- var product = _this19.mergeProductForPriceQuery(productInput, authoritativeProduct);
6426
+ var product = _this20.mergeProductForPriceQuery(productInput, authoritativeProduct);
6236
6427
  var customerId = (_params$customer_id4 = params.customer_id) !== null && _params$customer_id4 !== void 0 ? _params$customer_id4 : currentOrderCustomerId;
6237
6428
  var channel = resolvedChannels[index];
6238
6429
  return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
@@ -6240,16 +6431,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6240
6431
  product: product,
6241
6432
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
6242
6433
  customer_id: customerId,
6243
- quotation: authoritativeProduct && _this19.preferAuthoritativeProductQueryPrice() ? undefined : quotation
6434
+ quotation: authoritativeProduct && _this20.preferAuthoritativeProductQueryPrice() ? undefined : quotation
6244
6435
  }));
6245
6436
  }));
6246
6437
  case 17:
6247
6438
  case "end":
6248
- return _context60.stop();
6439
+ return _context61.stop();
6249
6440
  }
6250
- }, _callee60, this);
6441
+ }, _callee61, this);
6251
6442
  }));
6252
- function calculateProductBookingPrices(_x48) {
6443
+ function calculateProductBookingPrices(_x49) {
6253
6444
  return _calculateProductBookingPrices.apply(this, arguments);
6254
6445
  }
6255
6446
  return calculateProductBookingPrices;
@@ -6257,42 +6448,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6257
6448
  }, {
6258
6449
  key: "addProductToOrder",
6259
6450
  value: function () {
6260
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(product, booking, options) {
6261
- var products;
6262
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6263
- while (1) switch (_context61.prev = _context61.next) {
6264
- case 0:
6265
- _context61.prev = 0;
6266
- if (this.store.order) {
6267
- _context61.next = 3;
6268
- break;
6269
- }
6270
- throw new Error('order 模块未初始化');
6271
- case 3:
6272
- _context61.next = 5;
6273
- return this.store.order.addProductToOrder(product, booking, options);
6274
- case 5:
6275
- products = _context61.sent;
6276
- return _context61.abrupt("return", products);
6277
- case 9:
6278
- _context61.prev = 9;
6279
- _context61.t0 = _context61["catch"](0);
6280
- throw _context61.t0;
6281
- case 12:
6282
- case "end":
6283
- return _context61.stop();
6284
- }
6285
- }, _callee61, this, [[0, 9]]);
6286
- }));
6287
- function addProductToOrder(_x50, _x51, _x52) {
6288
- return _addProductToOrder.apply(this, arguments);
6289
- }
6290
- return addProductToOrder;
6291
- }()
6292
- }, {
6293
- key: "updateOrderProduct",
6294
- value: function () {
6295
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(params) {
6451
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(product, booking, options) {
6296
6452
  var products;
6297
6453
  return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6298
6454
  while (1) switch (_context62.prev = _context62.next) {
@@ -6305,7 +6461,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6305
6461
  throw new Error('order 模块未初始化');
6306
6462
  case 3:
6307
6463
  _context62.next = 5;
6308
- return this.store.order.updateOrderProduct(params);
6464
+ return this.store.order.addProductToOrder(product, booking, options);
6309
6465
  case 5:
6310
6466
  products = _context62.sent;
6311
6467
  return _context62.abrupt("return", products);
@@ -6319,15 +6475,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6319
6475
  }
6320
6476
  }, _callee62, this, [[0, 9]]);
6321
6477
  }));
6322
- function updateOrderProduct(_x53) {
6323
- return _updateOrderProduct.apply(this, arguments);
6478
+ function addProductToOrder(_x51, _x52, _x53) {
6479
+ return _addProductToOrder.apply(this, arguments);
6324
6480
  }
6325
- return updateOrderProduct;
6481
+ return addProductToOrder;
6326
6482
  }()
6327
6483
  }, {
6328
- key: "updateOrderProducts",
6484
+ key: "updateOrderProduct",
6329
6485
  value: function () {
6330
- var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(paramsList) {
6486
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
6331
6487
  var products;
6332
6488
  return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6333
6489
  while (1) switch (_context63.prev = _context63.next) {
@@ -6340,7 +6496,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6340
6496
  throw new Error('order 模块未初始化');
6341
6497
  case 3:
6342
6498
  _context63.next = 5;
6343
- return this.store.order.updateOrderProducts(paramsList);
6499
+ return this.store.order.updateOrderProduct(params);
6344
6500
  case 5:
6345
6501
  products = _context63.sent;
6346
6502
  return _context63.abrupt("return", products);
@@ -6354,15 +6510,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6354
6510
  }
6355
6511
  }, _callee63, this, [[0, 9]]);
6356
6512
  }));
6357
- function updateOrderProducts(_x54) {
6358
- return _updateOrderProducts.apply(this, arguments);
6513
+ function updateOrderProduct(_x54) {
6514
+ return _updateOrderProduct.apply(this, arguments);
6359
6515
  }
6360
- return updateOrderProducts;
6516
+ return updateOrderProduct;
6361
6517
  }()
6362
6518
  }, {
6363
- key: "updateOrderProductQuantity",
6519
+ key: "updateOrderProducts",
6364
6520
  value: function () {
6365
- var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(params) {
6521
+ var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(paramsList) {
6366
6522
  var products;
6367
6523
  return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6368
6524
  while (1) switch (_context64.prev = _context64.next) {
@@ -6375,7 +6531,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6375
6531
  throw new Error('order 模块未初始化');
6376
6532
  case 3:
6377
6533
  _context64.next = 5;
6378
- return this.store.order.updateOrderProductQuantity(params);
6534
+ return this.store.order.updateOrderProducts(paramsList);
6379
6535
  case 5:
6380
6536
  products = _context64.sent;
6381
6537
  return _context64.abrupt("return", products);
@@ -6389,7 +6545,42 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6389
6545
  }
6390
6546
  }, _callee64, this, [[0, 9]]);
6391
6547
  }));
6392
- function updateOrderProductQuantity(_x55) {
6548
+ function updateOrderProducts(_x55) {
6549
+ return _updateOrderProducts.apply(this, arguments);
6550
+ }
6551
+ return updateOrderProducts;
6552
+ }()
6553
+ }, {
6554
+ key: "updateOrderProductQuantity",
6555
+ value: function () {
6556
+ var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(params) {
6557
+ var products;
6558
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6559
+ while (1) switch (_context65.prev = _context65.next) {
6560
+ case 0:
6561
+ _context65.prev = 0;
6562
+ if (this.store.order) {
6563
+ _context65.next = 3;
6564
+ break;
6565
+ }
6566
+ throw new Error('order 模块未初始化');
6567
+ case 3:
6568
+ _context65.next = 5;
6569
+ return this.store.order.updateOrderProductQuantity(params);
6570
+ case 5:
6571
+ products = _context65.sent;
6572
+ return _context65.abrupt("return", products);
6573
+ case 9:
6574
+ _context65.prev = 9;
6575
+ _context65.t0 = _context65["catch"](0);
6576
+ throw _context65.t0;
6577
+ case 12:
6578
+ case "end":
6579
+ return _context65.stop();
6580
+ }
6581
+ }, _callee65, this, [[0, 9]]);
6582
+ }));
6583
+ function updateOrderProductQuantity(_x56) {
6393
6584
  return _updateOrderProductQuantity.apply(this, arguments);
6394
6585
  }
6395
6586
  return updateOrderProductQuantity;
@@ -6412,12 +6603,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6412
6603
  }, {
6413
6604
  key: "setOrderProductLineNote",
6414
6605
  value: (function () {
6415
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(identity, note) {
6606
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(identity, note) {
6416
6607
  var params, products;
6417
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6418
- while (1) switch (_context65.prev = _context65.next) {
6608
+ return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6609
+ while (1) switch (_context66.prev = _context66.next) {
6419
6610
  case 0:
6420
- _context65.prev = 0;
6611
+ _context66.prev = 0;
6421
6612
  params = {
6422
6613
  product_id: identity.product_id,
6423
6614
  product_variant_id: identity.product_variant_id,
@@ -6432,22 +6623,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6432
6623
  params.product_sku = identity.product_sku;
6433
6624
  }
6434
6625
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
6435
- _context65.next = 7;
6626
+ _context66.next = 7;
6436
6627
  return this.updateOrderProduct(params);
6437
6628
  case 7:
6438
- products = _context65.sent;
6439
- return _context65.abrupt("return", products);
6629
+ products = _context66.sent;
6630
+ return _context66.abrupt("return", products);
6440
6631
  case 11:
6441
- _context65.prev = 11;
6442
- _context65.t0 = _context65["catch"](0);
6443
- throw _context65.t0;
6632
+ _context66.prev = 11;
6633
+ _context66.t0 = _context66["catch"](0);
6634
+ throw _context66.t0;
6444
6635
  case 14:
6445
6636
  case "end":
6446
- return _context65.stop();
6637
+ return _context66.stop();
6447
6638
  }
6448
- }, _callee65, this, [[0, 11]]);
6639
+ }, _callee66, this, [[0, 11]]);
6449
6640
  }));
6450
- function setOrderProductLineNote(_x56, _x57) {
6641
+ function setOrderProductLineNote(_x57, _x58) {
6451
6642
  return _setOrderProductLineNote.apply(this, arguments);
6452
6643
  }
6453
6644
  return setOrderProductLineNote;
@@ -6462,32 +6653,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6462
6653
  }, {
6463
6654
  key: "removeProductsFromOrder",
6464
6655
  value: (function () {
6465
- var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(identities, options) {
6466
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6467
- while (1) switch (_context66.prev = _context66.next) {
6656
+ var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(identities, options) {
6657
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6658
+ while (1) switch (_context67.prev = _context67.next) {
6468
6659
  case 0:
6469
- _context66.prev = 0;
6660
+ _context67.prev = 0;
6470
6661
  if (this.store.order) {
6471
- _context66.next = 3;
6662
+ _context67.next = 3;
6472
6663
  break;
6473
6664
  }
6474
6665
  throw new Error('order 模块未初始化');
6475
6666
  case 3:
6476
- _context66.next = 5;
6667
+ _context67.next = 5;
6477
6668
  return this.store.order.removeProductsFromOrder(identities, options);
6478
6669
  case 5:
6479
- return _context66.abrupt("return", _context66.sent);
6670
+ return _context67.abrupt("return", _context67.sent);
6480
6671
  case 8:
6481
- _context66.prev = 8;
6482
- _context66.t0 = _context66["catch"](0);
6483
- throw _context66.t0;
6672
+ _context67.prev = 8;
6673
+ _context67.t0 = _context67["catch"](0);
6674
+ throw _context67.t0;
6484
6675
  case 11:
6485
6676
  case "end":
6486
- return _context66.stop();
6677
+ return _context67.stop();
6487
6678
  }
6488
- }, _callee66, this, [[0, 8]]);
6679
+ }, _callee67, this, [[0, 8]]);
6489
6680
  }));
6490
- function removeProductsFromOrder(_x58, _x59) {
6681
+ function removeProductsFromOrder(_x59, _x60) {
6491
6682
  return _removeProductsFromOrder.apply(this, arguments);
6492
6683
  }
6493
6684
  return removeProductsFromOrder;
@@ -6495,18 +6686,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6495
6686
  }, {
6496
6687
  key: "removeProductFromOrder",
6497
6688
  value: function () {
6498
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(identity, options) {
6499
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6500
- while (1) switch (_context67.prev = _context67.next) {
6689
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(identity, options) {
6690
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6691
+ while (1) switch (_context68.prev = _context68.next) {
6501
6692
  case 0:
6502
- return _context67.abrupt("return", this.removeProductsFromOrder([identity], options));
6693
+ return _context68.abrupt("return", this.removeProductsFromOrder([identity], options));
6503
6694
  case 1:
6504
6695
  case "end":
6505
- return _context67.stop();
6696
+ return _context68.stop();
6506
6697
  }
6507
- }, _callee67, this);
6698
+ }, _callee68, this);
6508
6699
  }));
6509
- function removeProductFromOrder(_x60, _x61) {
6700
+ function removeProductFromOrder(_x61, _x62) {
6510
6701
  return _removeProductFromOrder.apply(this, arguments);
6511
6702
  }
6512
6703
  return removeProductFromOrder;
@@ -6556,23 +6747,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6556
6747
  }, {
6557
6748
  key: "applyPromotion",
6558
6749
  value: (function () {
6559
- var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68() {
6560
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6561
- while (1) switch (_context68.prev = _context68.next) {
6750
+ var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69() {
6751
+ return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6752
+ while (1) switch (_context69.prev = _context69.next) {
6562
6753
  case 0:
6563
6754
  if (this.store.order) {
6564
- _context68.next = 2;
6755
+ _context69.next = 2;
6565
6756
  break;
6566
6757
  }
6567
6758
  throw new Error('order 模块未初始化');
6568
6759
  case 2:
6569
- _context68.next = 4;
6760
+ _context69.next = 4;
6570
6761
  return this.store.order.applyPromotion();
6571
6762
  case 4:
6572
6763
  case "end":
6573
- return _context68.stop();
6764
+ return _context69.stop();
6574
6765
  }
6575
- }, _callee68, this);
6766
+ }, _callee69, this);
6576
6767
  }));
6577
6768
  function applyPromotion() {
6578
6769
  return _applyPromotion.apply(this, arguments);
@@ -6582,16 +6773,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6582
6773
  }, {
6583
6774
  key: "getUnfulfilledPromotions",
6584
6775
  value: function getUnfulfilledPromotions() {
6585
- var _this$store$order24;
6586
- return ((_this$store$order24 = this.store.order) === null || _this$store$order24 === void 0 ? void 0 : _this$store$order24.getUnfulfilledPromotions()) || [];
6776
+ var _this$store$order29;
6777
+ return ((_this$store$order29 = this.store.order) === null || _this$store$order29 === void 0 ? void 0 : _this$store$order29.getUnfulfilledPromotions()) || [];
6587
6778
  }
6588
6779
 
6589
6780
  /** 最近一次促销计算输出的赠品操作 diff。 */
6590
6781
  }, {
6591
6782
  key: "getLastGiftActions",
6592
6783
  value: function getLastGiftActions() {
6593
- var _this$store$order25;
6594
- return ((_this$store$order25 = this.store.order) === null || _this$store$order25 === void 0 ? void 0 : _this$store$order25.getLastGiftActions()) || null;
6784
+ var _this$store$order30;
6785
+ return ((_this$store$order30 = this.store.order) === null || _this$store$order30 === void 0 ? void 0 : _this$store$order30.getLastGiftActions()) || null;
6595
6786
  }
6596
6787
 
6597
6788
  // 获取商品列表
@@ -6599,18 +6790,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6599
6790
  }, {
6600
6791
  key: "getProductList",
6601
6792
  value: function () {
6602
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69() {
6603
- var _this$otherParams36;
6793
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70() {
6794
+ var _this$otherParams40;
6604
6795
  var menu_list_ids, _this$store$products, res;
6605
- return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6606
- while (1) switch (_context69.prev = _context69.next) {
6796
+ return _regeneratorRuntime().wrap(function _callee70$(_context70) {
6797
+ while (1) switch (_context70.prev = _context70.next) {
6607
6798
  case 0:
6608
6799
  // 可以直接通过配置里的 menu 读取
6609
- menu_list_ids = ((_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 || (_this$otherParams36 = _this$otherParams36.dineInConfig) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36['menu.associated_menus'].map(function (n) {
6800
+ 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) {
6610
6801
  return Number(n.value);
6611
6802
  })) || [];
6612
- _context69.prev = 1;
6613
- _context69.next = 4;
6803
+ _context70.prev = 1;
6804
+ _context70.next = 4;
6614
6805
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
6615
6806
  menu_list_ids: menu_list_ids,
6616
6807
  cacheId: this.cacheId,
@@ -6618,17 +6809,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6618
6809
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
6619
6810
  });
6620
6811
  case 4:
6621
- res = _context69.sent;
6622
- return _context69.abrupt("return", res);
6812
+ res = _context70.sent;
6813
+ return _context70.abrupt("return", res);
6623
6814
  case 8:
6624
- _context69.prev = 8;
6625
- _context69.t0 = _context69["catch"](1);
6626
- throw _context69.t0;
6815
+ _context70.prev = 8;
6816
+ _context70.t0 = _context70["catch"](1);
6817
+ throw _context70.t0;
6627
6818
  case 11:
6628
6819
  case "end":
6629
- return _context69.stop();
6820
+ return _context70.stop();
6630
6821
  }
6631
- }, _callee69, this, [[1, 8]]);
6822
+ }, _callee70, this, [[1, 8]]);
6632
6823
  }));
6633
6824
  function getProductList() {
6634
6825
  return _getProductList.apply(this, arguments);
@@ -6643,33 +6834,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6643
6834
  }, {
6644
6835
  key: "setOtherParams",
6645
6836
  value: function () {
6646
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(params) {
6647
- var _this$otherParams37;
6837
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(params) {
6838
+ var _this$otherParams41;
6648
6839
  var _ref55,
6649
6840
  _ref55$cover,
6650
6841
  cover,
6651
- _args70 = arguments;
6652
- return _regeneratorRuntime().wrap(function _callee70$(_context70) {
6653
- while (1) switch (_context70.prev = _context70.next) {
6842
+ previousPickupTimingScope,
6843
+ _args71 = arguments;
6844
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
6845
+ while (1) switch (_context71.prev = _context71.next) {
6654
6846
  case 0:
6655
- _ref55 = _args70.length > 1 && _args70[1] !== undefined ? _args70[1] : {}, _ref55$cover = _ref55.cover, cover = _ref55$cover === void 0 ? false : _ref55$cover;
6847
+ _ref55 = _args71.length > 1 && _args71[1] !== undefined ? _args71[1] : {}, _ref55$cover = _ref55.cover, cover = _ref55$cover === void 0 ? false : _ref55$cover;
6848
+ previousPickupTimingScope = this.getPickupTimingScope();
6656
6849
  if (cover) {
6657
6850
  this.otherParams = _objectSpread({}, params);
6658
6851
  } else {
6659
6852
  this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
6660
6853
  }
6661
- this.cacheId = (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.cacheId;
6662
- _context70.next = 5;
6854
+ this.cacheId = (_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41.cacheId;
6855
+ if (previousPickupTimingScope !== this.getPickupTimingScope()) this.resetPickupTimingCache();
6856
+ _context71.next = 7;
6663
6857
  return this.syncOtherParamsToSubModules(params, {
6664
6858
  cover: cover
6665
6859
  });
6666
- case 5:
6860
+ case 7:
6667
6861
  case "end":
6668
- return _context70.stop();
6862
+ return _context71.stop();
6669
6863
  }
6670
- }, _callee70, this);
6864
+ }, _callee71, this);
6671
6865
  }));
6672
- function setOtherParams(_x62) {
6866
+ function setOtherParams(_x63) {
6673
6867
  return _setOtherParams.apply(this, arguments);
6674
6868
  }
6675
6869
  return setOtherParams;