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