@pisell/pisellos 2.3.101 → 2.3.103
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/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +10 -7
- package/dist/modules/Discount/index.d.ts +2 -0
- package/dist/modules/Discount/index.js +38 -5
- package/dist/modules/Discount/types.d.ts +11 -0
- package/dist/modules/Order/index.d.ts +29 -3
- package/dist/modules/Order/index.js +1105 -703
- package/dist/modules/Order/types.d.ts +14 -6
- package/dist/modules/Order/types.js +1 -1
- package/dist/modules/Order/utils/virtualSettlement.d.ts +63 -0
- package/dist/modules/Order/utils/virtualSettlement.js +284 -0
- package/dist/modules/Order/utils.d.ts +1 -0
- package/dist/modules/Order/utils.js +63 -24
- package/dist/modules/Product/types.d.ts +23 -0
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -3
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +21 -1
- package/dist/solution/BaseSales/index.d.ts +10 -1
- package/dist/solution/BaseSales/index.js +1074 -746
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +72 -9
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +137 -6
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +4 -0
- package/lib/modules/Discount/index.d.ts +2 -0
- package/lib/modules/Discount/index.js +31 -2
- package/lib/modules/Discount/types.d.ts +11 -0
- package/lib/modules/Order/index.d.ts +29 -3
- package/lib/modules/Order/index.js +326 -51
- package/lib/modules/Order/types.d.ts +14 -6
- package/lib/modules/Order/types.js +1 -1
- package/lib/modules/Order/utils/virtualSettlement.d.ts +63 -0
- package/lib/modules/Order/utils/virtualSettlement.js +262 -0
- package/lib/modules/Order/utils.d.ts +1 -0
- package/lib/modules/Order/utils.js +57 -20
- package/lib/modules/Product/types.d.ts +23 -0
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +4 -2
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +17 -1
- package/lib/solution/BaseSales/index.d.ts +10 -1
- package/lib/solution/BaseSales/index.js +228 -20
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +38 -0
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -0
- package/package.json +1 -1
|
@@ -37,6 +37,7 @@ import Decimal from 'decimal.js';
|
|
|
37
37
|
import { cloneDeep, isEqual, mergeWith } from 'lodash-es';
|
|
38
38
|
import { createModule } from "../BookingByStep/types";
|
|
39
39
|
import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, resolveIsFormSubject, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
40
|
+
import { buildCurrencyDisplaySnapshot, getTempOrderSettlementSnapshot, isVirtualSettlementOrder } from "../../modules/Order/utils/virtualSettlement";
|
|
40
41
|
import { ensureOrderPaymentNumber, isIdentifiedPendingOrderPayment, isPendingOrderPayment, mergeOrderPaymentListsByIdentity, resolveOrderPaymentIdentity } from "../../modules/Order/payment-utils";
|
|
41
42
|
import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
|
|
42
43
|
import { applyOrderCollectionUidRemaps, getOrderCollectionPersistentId, getOrderCollectionReferenceUid, getOrderCollectionUid, isSameOrderCollectionItem, mergeOrderCollectionItems, normalizeOrderCollection, normalizeOrderCollections, setOrderCollectionUid } from "../../modules/Order/utils/orderCollectionIdentity";
|
|
@@ -1763,6 +1764,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1763
1764
|
return _this10.getAppData(key);
|
|
1764
1765
|
});
|
|
1765
1766
|
}
|
|
1767
|
+
}, {
|
|
1768
|
+
key: "isMultiCurrencySettlementEnabled",
|
|
1769
|
+
value: function isMultiCurrencySettlementEnabled() {
|
|
1770
|
+
var _this$otherParams11;
|
|
1771
|
+
return ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.enableMultiCurrencySettlement) === true;
|
|
1772
|
+
}
|
|
1773
|
+
}, {
|
|
1774
|
+
key: "isActiveVirtualSettlementOrder",
|
|
1775
|
+
value: function isActiveVirtualSettlementOrder(tempOrder) {
|
|
1776
|
+
return this.isMultiCurrencySettlementEnabled() && isVirtualSettlementOrder(tempOrder);
|
|
1777
|
+
}
|
|
1778
|
+
}, {
|
|
1779
|
+
key: "isHistoricalVirtualSettlementOrder",
|
|
1780
|
+
value: function isHistoricalVirtualSettlementOrder(tempOrder) {
|
|
1781
|
+
var _tempOrder$metadata;
|
|
1782
|
+
return (tempOrder === null || tempOrder === void 0 || (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 || (_tempOrder$metadata = _tempOrder$metadata.currency_settlement_config) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.settlement_type) === 'virtual_currency';
|
|
1783
|
+
}
|
|
1766
1784
|
}, {
|
|
1767
1785
|
key: "syncAppDataToTempOrder",
|
|
1768
1786
|
value: function syncAppDataToTempOrder(tempOrder) {
|
|
@@ -1770,6 +1788,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1770
1788
|
var taxCountryCode = this.getAppData('tax_country_code');
|
|
1771
1789
|
var currencyCode = this.getAppData('shop_currency_code');
|
|
1772
1790
|
var currencySymbol = this.getAppData('shop_symbol');
|
|
1791
|
+
// 历史虚拟币订单不依赖交易开关;普通 POS 不从商品行残留快照推断订单币种。
|
|
1792
|
+
var isHistoricalVirtualSettlement = this.isHistoricalVirtualSettlementOrder(tempOrder);
|
|
1793
|
+
var isVirtualSettlement = this.isActiveVirtualSettlementOrder(tempOrder) || isHistoricalVirtualSettlement;
|
|
1794
|
+
var shouldManageLegalCurrencySnapshot = this.isMultiCurrencySettlementEnabled() || isHistoricalVirtualSettlement;
|
|
1773
1795
|
var isChanged = false;
|
|
1774
1796
|
if (isPriceIncludeTax !== undefined) {
|
|
1775
1797
|
var nextIsPriceIncludeTax = Number(isPriceIncludeTax);
|
|
@@ -1785,14 +1807,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1785
1807
|
isChanged = true;
|
|
1786
1808
|
}
|
|
1787
1809
|
}
|
|
1788
|
-
|
|
1810
|
+
tempOrder.metadata = tempOrder.metadata || {};
|
|
1811
|
+
if (shouldManageLegalCurrencySnapshot) {
|
|
1812
|
+
var _ref31, _ref32, _tempOrder$metadata$l, _ref33, _ref34, _tempOrder$metadata$l2, _tempOrder$metadata$l3;
|
|
1813
|
+
var legalCurrencySnapshot = {
|
|
1814
|
+
currency_code: String((_ref31 = (_ref32 = currencyCode !== null && currencyCode !== void 0 ? currencyCode : (_tempOrder$metadata$l = tempOrder.metadata.legal_currency_snapshot) === null || _tempOrder$metadata$l === void 0 ? void 0 : _tempOrder$metadata$l.currency_code) !== null && _ref32 !== void 0 ? _ref32 : tempOrder.currency_code) !== null && _ref31 !== void 0 ? _ref31 : ''),
|
|
1815
|
+
currency_symbol: String((_ref33 = (_ref34 = currencySymbol !== null && currencySymbol !== void 0 ? currencySymbol : (_tempOrder$metadata$l2 = tempOrder.metadata.legal_currency_snapshot) === null || _tempOrder$metadata$l2 === void 0 ? void 0 : _tempOrder$metadata$l2.currency_symbol) !== null && _ref34 !== void 0 ? _ref34 : tempOrder.currency_symbol) !== null && _ref33 !== void 0 ? _ref33 : ''),
|
|
1816
|
+
currency_format: String(((_tempOrder$metadata$l3 = tempOrder.metadata.legal_currency_snapshot) === null || _tempOrder$metadata$l3 === void 0 ? void 0 : _tempOrder$metadata$l3.currency_format) || (isVirtualSettlement ? 'symbol_first' : tempOrder.currency_format) || 'symbol_first')
|
|
1817
|
+
};
|
|
1818
|
+
if (JSON.stringify(tempOrder.metadata.legal_currency_snapshot || {}) !== JSON.stringify(legalCurrencySnapshot)) {
|
|
1819
|
+
tempOrder.metadata.legal_currency_snapshot = legalCurrencySnapshot;
|
|
1820
|
+
isChanged = true;
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
if (!isVirtualSettlement && currencyCode !== undefined) {
|
|
1789
1824
|
var nextCurrencyCode = String(currencyCode || '');
|
|
1790
1825
|
if (tempOrder.currency_code !== nextCurrencyCode) {
|
|
1791
1826
|
tempOrder.currency_code = nextCurrencyCode;
|
|
1792
1827
|
isChanged = true;
|
|
1793
1828
|
}
|
|
1794
1829
|
}
|
|
1795
|
-
if (currencySymbol !== undefined) {
|
|
1830
|
+
if (!isVirtualSettlement && currencySymbol !== undefined) {
|
|
1796
1831
|
var nextCurrencySymbol = String(currencySymbol || '');
|
|
1797
1832
|
if (tempOrder.currency_symbol !== nextCurrencySymbol) {
|
|
1798
1833
|
tempOrder.currency_symbol = nextCurrencySymbol;
|
|
@@ -1805,11 +1840,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1805
1840
|
key: "initialize",
|
|
1806
1841
|
value: function () {
|
|
1807
1842
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(core) {
|
|
1808
|
-
var _this$
|
|
1843
|
+
var _this$otherParams12,
|
|
1809
1844
|
_this$appPlugin2,
|
|
1810
1845
|
_this$appPlugin2$getA,
|
|
1811
1846
|
_this11 = this,
|
|
1812
|
-
_this$
|
|
1847
|
+
_this$otherParams13;
|
|
1813
1848
|
var options,
|
|
1814
1849
|
app,
|
|
1815
1850
|
targetCacheData,
|
|
@@ -1824,7 +1859,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1824
1859
|
this.paymentNumberDevicePrefix = null;
|
|
1825
1860
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
1826
1861
|
this.otherParams = options.otherParams || {};
|
|
1827
|
-
this.cacheId = (_this$
|
|
1862
|
+
this.cacheId = (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.cacheId;
|
|
1828
1863
|
this.reusedSharedSubModuleNames.clear();
|
|
1829
1864
|
this.window = core.getPlugin('window');
|
|
1830
1865
|
this.request = core.getPlugin('request');
|
|
@@ -1866,7 +1901,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1866
1901
|
_context12.next = 19;
|
|
1867
1902
|
return this.store.schedule.loadAllSchedule();
|
|
1868
1903
|
case 19:
|
|
1869
|
-
if (this.store.order && typeof ((_this$
|
|
1904
|
+
if (this.store.order && typeof ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.enableTempOrderPersist) === 'boolean') {
|
|
1870
1905
|
this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
|
|
1871
1906
|
}
|
|
1872
1907
|
_context12.next = 22;
|
|
@@ -1938,7 +1973,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1938
1973
|
key: "loadSalesDetail",
|
|
1939
1974
|
value: (function () {
|
|
1940
1975
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(orderIdOrParams) {
|
|
1941
|
-
var loadSequence,
|
|
1976
|
+
var loadSequence, _ref35, _ref36, _ref37, _ref38, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, mergeSourceRecord, currentTempOrder, mergedRecord, record;
|
|
1942
1977
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1943
1978
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1944
1979
|
case 0:
|
|
@@ -1956,7 +1991,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1956
1991
|
};
|
|
1957
1992
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
1958
1993
|
preloadedSalesDetail = params.preloadedSalesDetail;
|
|
1959
|
-
lookup = (
|
|
1994
|
+
lookup = (_ref35 = (_ref36 = (_ref37 = (_ref38 = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : externalSaleNumber) !== null && _ref38 !== void 0 ? _ref38 : params.orderNumber) !== null && _ref37 !== void 0 ? _ref37 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_id) !== null && _ref36 !== void 0 ? _ref36 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.external_sale_number) !== null && _ref35 !== void 0 ? _ref35 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_number;
|
|
1960
1995
|
if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
|
|
1961
1996
|
_context14.next = 11;
|
|
1962
1997
|
break;
|
|
@@ -2526,6 +2561,46 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2526
2561
|
return _clearOrderCartLines.apply(this, arguments);
|
|
2527
2562
|
}
|
|
2528
2563
|
return clearOrderCartLines;
|
|
2564
|
+
}() /** 切换法币 / WalletPass 单位时清空商品、折扣与支付状态,保留客户。 */)
|
|
2565
|
+
}, {
|
|
2566
|
+
key: "clearOrderForSettlementSwitch",
|
|
2567
|
+
value: (function () {
|
|
2568
|
+
var _clearOrderForSettlementSwitch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
2569
|
+
var tempOrder;
|
|
2570
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2571
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2572
|
+
case 0:
|
|
2573
|
+
if (this.store.order) {
|
|
2574
|
+
_context23.next = 2;
|
|
2575
|
+
break;
|
|
2576
|
+
}
|
|
2577
|
+
throw new Error('order 模块未初始化');
|
|
2578
|
+
case 2:
|
|
2579
|
+
_context23.next = 4;
|
|
2580
|
+
return this.store.order.clearOrderForSettlementSwitch();
|
|
2581
|
+
case 4:
|
|
2582
|
+
tempOrder = _context23.sent;
|
|
2583
|
+
if (this.currentSalesDetail) {
|
|
2584
|
+
this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
|
|
2585
|
+
products: [],
|
|
2586
|
+
bookings: [],
|
|
2587
|
+
rootBooking: null,
|
|
2588
|
+
bookingsByProductUid: {},
|
|
2589
|
+
discount_list: [],
|
|
2590
|
+
payments: []
|
|
2591
|
+
});
|
|
2592
|
+
}
|
|
2593
|
+
return _context23.abrupt("return", tempOrder);
|
|
2594
|
+
case 7:
|
|
2595
|
+
case "end":
|
|
2596
|
+
return _context23.stop();
|
|
2597
|
+
}
|
|
2598
|
+
}, _callee23, this);
|
|
2599
|
+
}));
|
|
2600
|
+
function clearOrderForSettlementSwitch() {
|
|
2601
|
+
return _clearOrderForSettlementSwitch.apply(this, arguments);
|
|
2602
|
+
}
|
|
2603
|
+
return clearOrderForSettlementSwitch;
|
|
2529
2604
|
}())
|
|
2530
2605
|
}, {
|
|
2531
2606
|
key: "getOrderProducts",
|
|
@@ -2537,32 +2612,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2537
2612
|
}, {
|
|
2538
2613
|
key: "getSummary",
|
|
2539
2614
|
value: function () {
|
|
2540
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2615
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2541
2616
|
var summary;
|
|
2542
|
-
return _regeneratorRuntime().wrap(function
|
|
2543
|
-
while (1) switch (
|
|
2617
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2618
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2544
2619
|
case 0:
|
|
2545
|
-
|
|
2620
|
+
_context24.prev = 0;
|
|
2546
2621
|
if (this.store.order) {
|
|
2547
|
-
|
|
2622
|
+
_context24.next = 3;
|
|
2548
2623
|
break;
|
|
2549
2624
|
}
|
|
2550
2625
|
throw new Error('order 模块未初始化');
|
|
2551
2626
|
case 3:
|
|
2552
|
-
|
|
2627
|
+
_context24.next = 5;
|
|
2553
2628
|
return this.store.order.getOrderSummary();
|
|
2554
2629
|
case 5:
|
|
2555
|
-
summary =
|
|
2556
|
-
return
|
|
2630
|
+
summary = _context24.sent;
|
|
2631
|
+
return _context24.abrupt("return", summary);
|
|
2557
2632
|
case 9:
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
throw
|
|
2633
|
+
_context24.prev = 9;
|
|
2634
|
+
_context24.t0 = _context24["catch"](0);
|
|
2635
|
+
throw _context24.t0;
|
|
2561
2636
|
case 12:
|
|
2562
2637
|
case "end":
|
|
2563
|
-
return
|
|
2638
|
+
return _context24.stop();
|
|
2564
2639
|
}
|
|
2565
|
-
},
|
|
2640
|
+
}, _callee24, this, [[0, 9]]);
|
|
2566
2641
|
}));
|
|
2567
2642
|
function getSummary() {
|
|
2568
2643
|
return _getSummary.apply(this, arguments);
|
|
@@ -2690,14 +2765,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2690
2765
|
}, {
|
|
2691
2766
|
key: "loadDiscountConfig",
|
|
2692
2767
|
value: function () {
|
|
2693
|
-
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2768
|
+
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
2694
2769
|
var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
|
|
2695
|
-
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _orderStore$summary, orderTotalAmount, result, _iterator3, _step3, _product$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
|
|
2696
|
-
return _regeneratorRuntime().wrap(function
|
|
2697
|
-
while (1) switch (
|
|
2770
|
+
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, searchedDiscountList, searchedDiscountIds, preparedDiscountList, _discountModule$setOr, _discountModule$setOr2, _discountModule$setDi, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _orderStore$summary, orderTotalAmount, result, _iterator3, _step3, _product$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
|
|
2771
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2772
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2698
2773
|
case 0:
|
|
2699
2774
|
if (this.store.order) {
|
|
2700
|
-
|
|
2775
|
+
_context25.next = 2;
|
|
2701
2776
|
break;
|
|
2702
2777
|
}
|
|
2703
2778
|
throw new Error('order 模块未初始化');
|
|
@@ -2714,48 +2789,77 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2714
2789
|
return discount.isManualSelect;
|
|
2715
2790
|
});
|
|
2716
2791
|
discountAction = (params === null || params === void 0 ? void 0 : params.action) || (orderId ? 'edit' : 'create');
|
|
2717
|
-
discountConfigCacheKey = [customerId, discountAction, Number(orderId) || 0].join(':');
|
|
2718
|
-
|
|
2792
|
+
discountConfigCacheKey = [customerId, discountAction, Number(orderId) || 0].join(':'); // Walk-In 不请求 prepare config;当前搜索/扫码券必须继续参与本次重算。
|
|
2793
|
+
// current 优先于 original,保留搜索后的最新选择与可用状态。
|
|
2794
|
+
searchedDiscountList = currentDiscountList.filter(function (discount) {
|
|
2795
|
+
return discount.isScan;
|
|
2796
|
+
});
|
|
2797
|
+
searchedDiscountIds = new Set(searchedDiscountList.map(function (discount) {
|
|
2798
|
+
return String(discount.id);
|
|
2799
|
+
}));
|
|
2800
|
+
preparedDiscountList = [].concat(_toConsumableArray(searchedDiscountList), _toConsumableArray(originalDiscountList.filter(function (discount) {
|
|
2801
|
+
return !searchedDiscountIds.has(String(discount.id));
|
|
2802
|
+
})));
|
|
2719
2803
|
if (!(customerId && customerId !== 1)) {
|
|
2720
|
-
|
|
2804
|
+
_context25.next = 27;
|
|
2721
2805
|
break;
|
|
2722
2806
|
}
|
|
2723
|
-
if (!(this.discountConfigCacheKey === discountConfigCacheKey)) {
|
|
2724
|
-
|
|
2807
|
+
if (!(!(params !== null && params !== void 0 && params.force) && this.discountConfigCacheKey === discountConfigCacheKey)) {
|
|
2808
|
+
_context25.next = 21;
|
|
2725
2809
|
break;
|
|
2726
2810
|
}
|
|
2727
2811
|
preparedDiscountList = originalDiscountList;
|
|
2728
|
-
|
|
2812
|
+
_context25.next = 27;
|
|
2729
2813
|
break;
|
|
2730
|
-
case
|
|
2731
|
-
|
|
2814
|
+
case 21:
|
|
2815
|
+
_context25.next = 23;
|
|
2732
2816
|
return this.store.order.loadDiscountConfig({
|
|
2733
2817
|
customerId: customerId,
|
|
2734
2818
|
action: discountAction,
|
|
2735
2819
|
orderId: Number(orderId) || undefined,
|
|
2736
2820
|
apply: false
|
|
2737
2821
|
});
|
|
2738
|
-
case
|
|
2739
|
-
preparedDiscountList =
|
|
2822
|
+
case 23:
|
|
2823
|
+
preparedDiscountList = _context25.sent;
|
|
2740
2824
|
this.discountConfigCacheKey = discountConfigCacheKey;
|
|
2741
|
-
|
|
2825
|
+
_context25.next = 27;
|
|
2742
2826
|
return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
|
|
2743
|
-
case
|
|
2827
|
+
case 27:
|
|
2828
|
+
if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
|
|
2829
|
+
_context25.next = 35;
|
|
2830
|
+
break;
|
|
2831
|
+
}
|
|
2832
|
+
_context25.next = 30;
|
|
2833
|
+
return discountModule === null || discountModule === void 0 || (_discountModule$setOr2 = discountModule.setOriginalDiscountList) === null || _discountModule$setOr2 === void 0 ? void 0 : _discountModule$setOr2.call(discountModule, []);
|
|
2834
|
+
case 30:
|
|
2835
|
+
_context25.next = 32;
|
|
2836
|
+
return discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []);
|
|
2837
|
+
case 32:
|
|
2838
|
+
tempOrder.discount_list = [];
|
|
2839
|
+
tempOrder.shop_discount = '0.00';
|
|
2840
|
+
return _context25.abrupt("return", {
|
|
2841
|
+
productList: tempOrder.products || [],
|
|
2842
|
+
discountList: [],
|
|
2843
|
+
availableWalletIds: this.getAvailableWalletIds(),
|
|
2844
|
+
virtualCurrencyList: this.store.order.getVirtualCurrencyList()
|
|
2845
|
+
});
|
|
2846
|
+
case 35:
|
|
2744
2847
|
if (!(hasManualDiscountSelection && currentDiscountList.length)) {
|
|
2745
|
-
|
|
2848
|
+
_context25.next = 37;
|
|
2746
2849
|
break;
|
|
2747
2850
|
}
|
|
2748
|
-
return
|
|
2851
|
+
return _context25.abrupt("return", {
|
|
2749
2852
|
productList: tempOrder.products || [],
|
|
2750
2853
|
discountList: currentDiscountList,
|
|
2751
|
-
availableWalletIds: this.getAvailableWalletIds()
|
|
2854
|
+
availableWalletIds: this.getAvailableWalletIds(),
|
|
2855
|
+
virtualCurrencyList: this.store.order.getVirtualCurrencyList()
|
|
2752
2856
|
});
|
|
2753
|
-
case
|
|
2857
|
+
case 37:
|
|
2754
2858
|
nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi2 = discountModule.getDiscountList) === null || _discountModule$getDi2 === void 0 ? void 0 : _discountModule$getDi2.call(discountModule)) || [], tempOrder.products || []);
|
|
2755
2859
|
nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
|
|
2756
|
-
|
|
2860
|
+
_context25.next = 41;
|
|
2757
2861
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2758
|
-
case
|
|
2862
|
+
case 41:
|
|
2759
2863
|
shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
|
|
2760
2864
|
discountAction: discountAction,
|
|
2761
2865
|
products: tempOrder.products || [],
|
|
@@ -2763,32 +2867,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2763
2867
|
nextDiscountList: nextDiscountList
|
|
2764
2868
|
});
|
|
2765
2869
|
if (!shouldSkipAutoApplyFetchedDiscounts) {
|
|
2766
|
-
|
|
2870
|
+
_context25.next = 50;
|
|
2767
2871
|
break;
|
|
2768
2872
|
}
|
|
2769
|
-
|
|
2873
|
+
_context25.next = 45;
|
|
2770
2874
|
return this.store.order.recalculateSummary({
|
|
2771
2875
|
createIfMissing: true
|
|
2772
2876
|
});
|
|
2773
|
-
case
|
|
2774
|
-
_summary =
|
|
2877
|
+
case 45:
|
|
2878
|
+
_summary = _context25.sent;
|
|
2775
2879
|
this.store.order.persistTempOrder();
|
|
2776
|
-
|
|
2880
|
+
_context25.next = 49;
|
|
2777
2881
|
return this.effectsEmit('onDiscountApplied', {
|
|
2778
2882
|
productList: tempOrder.products || [],
|
|
2779
2883
|
discountList: nextDiscountList,
|
|
2780
2884
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
2781
2885
|
tempOrder: tempOrder
|
|
2782
2886
|
});
|
|
2783
|
-
case
|
|
2784
|
-
return
|
|
2887
|
+
case 49:
|
|
2888
|
+
return _context25.abrupt("return", {
|
|
2785
2889
|
productList: tempOrder.products || [],
|
|
2786
2890
|
discountList: nextDiscountList,
|
|
2787
|
-
availableWalletIds: this.getAvailableWalletIds()
|
|
2891
|
+
availableWalletIds: this.getAvailableWalletIds(),
|
|
2892
|
+
virtualCurrencyList: this.store.order.getVirtualCurrencyList()
|
|
2788
2893
|
});
|
|
2789
|
-
case
|
|
2894
|
+
case 50:
|
|
2790
2895
|
if (!rulesModule) {
|
|
2791
|
-
|
|
2896
|
+
_context25.next = 86;
|
|
2792
2897
|
break;
|
|
2793
2898
|
}
|
|
2794
2899
|
orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
|
|
@@ -2808,22 +2913,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2808
2913
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2809
2914
|
}
|
|
2810
2915
|
_iterator3 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2811
|
-
|
|
2916
|
+
_context25.prev = 55;
|
|
2812
2917
|
_iterator3.s();
|
|
2813
|
-
case
|
|
2918
|
+
case 57:
|
|
2814
2919
|
if ((_step3 = _iterator3.n()).done) {
|
|
2815
|
-
|
|
2920
|
+
_context25.next = 72;
|
|
2816
2921
|
break;
|
|
2817
2922
|
}
|
|
2818
2923
|
product = _step3.value;
|
|
2819
2924
|
productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
|
|
2820
2925
|
runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
|
|
2821
2926
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
2822
|
-
|
|
2927
|
+
_context25.next = 63;
|
|
2823
2928
|
break;
|
|
2824
2929
|
}
|
|
2825
|
-
return
|
|
2826
|
-
case
|
|
2930
|
+
return _context25.abrupt("continue", 70);
|
|
2931
|
+
case 63:
|
|
2827
2932
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
2828
2933
|
return sum + Number(pd.amount || 0);
|
|
2829
2934
|
}, 0);
|
|
@@ -2839,59 +2944,60 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2839
2944
|
mainPrice: newMainSellingPrice,
|
|
2840
2945
|
bundle: product.product_bundle
|
|
2841
2946
|
});
|
|
2842
|
-
case
|
|
2843
|
-
|
|
2947
|
+
case 70:
|
|
2948
|
+
_context25.next = 57;
|
|
2844
2949
|
break;
|
|
2845
|
-
case
|
|
2846
|
-
|
|
2950
|
+
case 72:
|
|
2951
|
+
_context25.next = 77;
|
|
2847
2952
|
break;
|
|
2848
|
-
case
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
_iterator3.e(
|
|
2852
|
-
case
|
|
2853
|
-
|
|
2953
|
+
case 74:
|
|
2954
|
+
_context25.prev = 74;
|
|
2955
|
+
_context25.t0 = _context25["catch"](55);
|
|
2956
|
+
_iterator3.e(_context25.t0);
|
|
2957
|
+
case 77:
|
|
2958
|
+
_context25.prev = 77;
|
|
2854
2959
|
_iterator3.f();
|
|
2855
|
-
return
|
|
2856
|
-
case
|
|
2960
|
+
return _context25.finish(77);
|
|
2961
|
+
case 80:
|
|
2857
2962
|
if (!result.discountList) {
|
|
2858
|
-
|
|
2963
|
+
_context25.next = 86;
|
|
2859
2964
|
break;
|
|
2860
2965
|
}
|
|
2861
2966
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
2862
2967
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2863
|
-
|
|
2968
|
+
_context25.next = 85;
|
|
2864
2969
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2865
|
-
case
|
|
2970
|
+
case 85:
|
|
2866
2971
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
2867
2972
|
return discount.isSelected;
|
|
2868
2973
|
});
|
|
2869
|
-
case
|
|
2870
|
-
|
|
2974
|
+
case 86:
|
|
2975
|
+
_context25.next = 88;
|
|
2871
2976
|
return this.store.order.recalculateSummary({
|
|
2872
2977
|
createIfMissing: true
|
|
2873
2978
|
});
|
|
2874
|
-
case
|
|
2875
|
-
summary =
|
|
2979
|
+
case 88:
|
|
2980
|
+
summary = _context25.sent;
|
|
2876
2981
|
this.store.order.persistTempOrder();
|
|
2877
|
-
|
|
2982
|
+
_context25.next = 92;
|
|
2878
2983
|
return this.effectsEmit('onDiscountApplied', {
|
|
2879
2984
|
productList: tempOrder.products || [],
|
|
2880
2985
|
discountList: nextDiscountList,
|
|
2881
2986
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
2882
2987
|
tempOrder: tempOrder
|
|
2883
2988
|
});
|
|
2884
|
-
case
|
|
2885
|
-
return
|
|
2989
|
+
case 92:
|
|
2990
|
+
return _context25.abrupt("return", {
|
|
2886
2991
|
productList: tempOrder.products || [],
|
|
2887
2992
|
discountList: nextDiscountList,
|
|
2888
|
-
availableWalletIds: this.getAvailableWalletIds()
|
|
2993
|
+
availableWalletIds: this.getAvailableWalletIds(),
|
|
2994
|
+
virtualCurrencyList: this.store.order.getVirtualCurrencyList()
|
|
2889
2995
|
});
|
|
2890
|
-
case
|
|
2996
|
+
case 93:
|
|
2891
2997
|
case "end":
|
|
2892
|
-
return
|
|
2998
|
+
return _context25.stop();
|
|
2893
2999
|
}
|
|
2894
|
-
},
|
|
3000
|
+
}, _callee25, this, [[55, 74, 77, 80]]);
|
|
2895
3001
|
}));
|
|
2896
3002
|
function loadDiscountConfig(_x17) {
|
|
2897
3003
|
return _loadDiscountConfig.apply(this, arguments);
|
|
@@ -2905,22 +3011,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2905
3011
|
if (!((_this$store$order4 = this.store.order) !== null && _this$store$order4 !== void 0 && _this$store$order4.getAvailableWalletIds)) return [];
|
|
2906
3012
|
return this.store.order.getAvailableWalletIds();
|
|
2907
3013
|
}
|
|
3014
|
+
}, {
|
|
3015
|
+
key: "getVirtualCurrencyList",
|
|
3016
|
+
value: function getVirtualCurrencyList() {
|
|
3017
|
+
var _this$store$order5;
|
|
3018
|
+
if (!((_this$store$order5 = this.store.order) !== null && _this$store$order5 !== void 0 && _this$store$order5.getVirtualCurrencyList)) return [];
|
|
3019
|
+
return this.store.order.getVirtualCurrencyList();
|
|
3020
|
+
}
|
|
2908
3021
|
}, {
|
|
2909
3022
|
key: "bestDiscount",
|
|
2910
3023
|
value: function () {
|
|
2911
|
-
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3024
|
+
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(cb) {
|
|
2912
3025
|
var _discountModule$getOr2, _discountModule$getDi3;
|
|
2913
|
-
var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _orderStore$summary2, orderTotalAmount;
|
|
2914
|
-
return _regeneratorRuntime().wrap(function
|
|
2915
|
-
while (1) switch (
|
|
3026
|
+
var tempOrder, _result2, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _orderStore$summary2, orderTotalAmount;
|
|
3027
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
3028
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2916
3029
|
case 0:
|
|
2917
3030
|
if (this.store.order) {
|
|
2918
|
-
|
|
3031
|
+
_context26.next = 2;
|
|
2919
3032
|
break;
|
|
2920
3033
|
}
|
|
2921
3034
|
throw new Error('order 模块未初始化');
|
|
2922
3035
|
case 2:
|
|
2923
3036
|
tempOrder = this.store.order.ensureTempOrder();
|
|
3037
|
+
if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
|
|
3038
|
+
_context26.next = 7;
|
|
3039
|
+
break;
|
|
3040
|
+
}
|
|
3041
|
+
_result2 = {
|
|
3042
|
+
productList: tempOrder.products || [],
|
|
3043
|
+
discountList: []
|
|
3044
|
+
};
|
|
3045
|
+
cb === null || cb === void 0 || cb(_result2);
|
|
3046
|
+
return _context26.abrupt("return", _result2);
|
|
3047
|
+
case 7:
|
|
2924
3048
|
orderStore = this.store.order.store || {};
|
|
2925
3049
|
discountModule = orderStore.discount;
|
|
2926
3050
|
rulesModule = orderStore.rules;
|
|
@@ -2931,11 +3055,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2931
3055
|
productList: tempOrder.products || [],
|
|
2932
3056
|
discountList: nextDiscountList
|
|
2933
3057
|
};
|
|
2934
|
-
|
|
3058
|
+
_context26.next = 16;
|
|
2935
3059
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2936
|
-
case
|
|
3060
|
+
case 16:
|
|
2937
3061
|
if (!rulesModule) {
|
|
2938
|
-
|
|
3062
|
+
_context26.next = 27;
|
|
2939
3063
|
break;
|
|
2940
3064
|
}
|
|
2941
3065
|
orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
|
|
@@ -2952,14 +3076,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2952
3076
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2953
3077
|
}
|
|
2954
3078
|
if (!result.discountList) {
|
|
2955
|
-
|
|
3079
|
+
_context26.next = 27;
|
|
2956
3080
|
break;
|
|
2957
3081
|
}
|
|
2958
3082
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
2959
3083
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2960
|
-
|
|
3084
|
+
_context26.next = 25;
|
|
2961
3085
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2962
|
-
case
|
|
3086
|
+
case 25:
|
|
2963
3087
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
2964
3088
|
return discount.isSelected;
|
|
2965
3089
|
});
|
|
@@ -2967,28 +3091,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2967
3091
|
productList: tempOrder.products,
|
|
2968
3092
|
discountList: nextDiscountList
|
|
2969
3093
|
};
|
|
2970
|
-
case
|
|
2971
|
-
|
|
3094
|
+
case 27:
|
|
3095
|
+
_context26.next = 29;
|
|
2972
3096
|
return this.store.order.recalculateSummary({
|
|
2973
3097
|
createIfMissing: true
|
|
2974
3098
|
});
|
|
2975
|
-
case
|
|
3099
|
+
case 29:
|
|
2976
3100
|
this.store.order.persistTempOrder();
|
|
2977
|
-
|
|
3101
|
+
_context26.next = 32;
|
|
2978
3102
|
return this.effectsEmit('onDiscountApplied', {
|
|
2979
3103
|
productList: tempOrder.products || [],
|
|
2980
3104
|
discountList: nextDiscountList,
|
|
2981
3105
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
2982
3106
|
tempOrder: tempOrder
|
|
2983
3107
|
});
|
|
2984
|
-
case
|
|
3108
|
+
case 32:
|
|
2985
3109
|
cb === null || cb === void 0 || cb(result);
|
|
2986
|
-
return
|
|
2987
|
-
case
|
|
3110
|
+
return _context26.abrupt("return", result);
|
|
3111
|
+
case 34:
|
|
2988
3112
|
case "end":
|
|
2989
|
-
return
|
|
3113
|
+
return _context26.stop();
|
|
2990
3114
|
}
|
|
2991
|
-
},
|
|
3115
|
+
}, _callee26, this);
|
|
2992
3116
|
}));
|
|
2993
3117
|
function bestDiscount(_x18) {
|
|
2994
3118
|
return _bestDiscount.apply(this, arguments);
|
|
@@ -3019,39 +3143,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3019
3143
|
}, {
|
|
3020
3144
|
key: "replaceDiscountStoreLists",
|
|
3021
3145
|
value: (function () {
|
|
3022
|
-
var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3146
|
+
var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
3023
3147
|
var _store2;
|
|
3024
3148
|
var discountModule;
|
|
3025
|
-
return _regeneratorRuntime().wrap(function
|
|
3026
|
-
while (1) switch (
|
|
3149
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
3150
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
3027
3151
|
case 0:
|
|
3028
3152
|
if (this.store.order) {
|
|
3029
|
-
|
|
3153
|
+
_context27.next = 2;
|
|
3030
3154
|
break;
|
|
3031
3155
|
}
|
|
3032
3156
|
throw new Error('order 模块未初始化');
|
|
3033
3157
|
case 2:
|
|
3034
3158
|
discountModule = (_store2 = this.store.order.store) === null || _store2 === void 0 ? void 0 : _store2.discount;
|
|
3035
3159
|
if (discountModule) {
|
|
3036
|
-
|
|
3160
|
+
_context27.next = 5;
|
|
3037
3161
|
break;
|
|
3038
3162
|
}
|
|
3039
|
-
return
|
|
3163
|
+
return _context27.abrupt("return");
|
|
3040
3164
|
case 5:
|
|
3041
3165
|
if (!params.originalDiscountList) {
|
|
3042
|
-
|
|
3166
|
+
_context27.next = 8;
|
|
3043
3167
|
break;
|
|
3044
3168
|
}
|
|
3045
|
-
|
|
3169
|
+
_context27.next = 8;
|
|
3046
3170
|
return discountModule.setOriginalDiscountList(params.originalDiscountList);
|
|
3047
3171
|
case 8:
|
|
3048
|
-
|
|
3172
|
+
_context27.next = 10;
|
|
3049
3173
|
return discountModule.setDiscountList(params.discountList);
|
|
3050
3174
|
case 10:
|
|
3051
3175
|
case "end":
|
|
3052
|
-
return
|
|
3176
|
+
return _context27.stop();
|
|
3053
3177
|
}
|
|
3054
|
-
},
|
|
3178
|
+
}, _callee27, this);
|
|
3055
3179
|
}));
|
|
3056
3180
|
function replaceDiscountStoreLists(_x19) {
|
|
3057
3181
|
return _replaceDiscountStoreLists.apply(this, arguments);
|
|
@@ -3061,34 +3185,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3061
3185
|
}, {
|
|
3062
3186
|
key: "scanPromotionCode",
|
|
3063
3187
|
value: function () {
|
|
3064
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3188
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(code, customerId) {
|
|
3065
3189
|
var raw, tempOrder;
|
|
3066
|
-
return _regeneratorRuntime().wrap(function
|
|
3067
|
-
while (1) switch (
|
|
3190
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3191
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3068
3192
|
case 0:
|
|
3069
|
-
|
|
3193
|
+
_context28.prev = 0;
|
|
3070
3194
|
if (this.store.order) {
|
|
3071
|
-
|
|
3195
|
+
_context28.next = 3;
|
|
3072
3196
|
break;
|
|
3073
3197
|
}
|
|
3074
3198
|
throw new Error('order 模块未初始化');
|
|
3075
3199
|
case 3:
|
|
3076
|
-
|
|
3200
|
+
_context28.next = 5;
|
|
3077
3201
|
return this.store.order.scanCode(code, customerId);
|
|
3078
3202
|
case 5:
|
|
3079
|
-
raw =
|
|
3203
|
+
raw = _context28.sent;
|
|
3080
3204
|
if (!raw.isAvailable) {
|
|
3081
|
-
|
|
3205
|
+
_context28.next = 13;
|
|
3082
3206
|
break;
|
|
3083
3207
|
}
|
|
3084
|
-
|
|
3208
|
+
_context28.next = 9;
|
|
3085
3209
|
return this.store.order.recalculateSummary({
|
|
3086
3210
|
createIfMissing: true
|
|
3087
3211
|
});
|
|
3088
3212
|
case 9:
|
|
3089
3213
|
this.store.order.persistTempOrder();
|
|
3090
3214
|
tempOrder = this.store.order.ensureTempOrder();
|
|
3091
|
-
|
|
3215
|
+
_context28.next = 13;
|
|
3092
3216
|
return this.effectsEmit('onDiscountApplied', {
|
|
3093
3217
|
productList: tempOrder.products || [],
|
|
3094
3218
|
discountList: this.store.order.getDiscountList(),
|
|
@@ -3096,7 +3220,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3096
3220
|
tempOrder: tempOrder
|
|
3097
3221
|
});
|
|
3098
3222
|
case 13:
|
|
3099
|
-
return
|
|
3223
|
+
return _context28.abrupt("return", _objectSpread(_objectSpread({
|
|
3100
3224
|
isAvailable: raw.isAvailable
|
|
3101
3225
|
}, raw.isAccepted !== undefined ? {
|
|
3102
3226
|
isAccepted: raw.isAccepted
|
|
@@ -3106,14 +3230,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3106
3230
|
scannedDiscountList: raw.scannedDiscountList
|
|
3107
3231
|
}));
|
|
3108
3232
|
case 16:
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
throw
|
|
3233
|
+
_context28.prev = 16;
|
|
3234
|
+
_context28.t0 = _context28["catch"](0);
|
|
3235
|
+
throw _context28.t0;
|
|
3112
3236
|
case 19:
|
|
3113
3237
|
case "end":
|
|
3114
|
-
return
|
|
3238
|
+
return _context28.stop();
|
|
3115
3239
|
}
|
|
3116
|
-
},
|
|
3240
|
+
}, _callee28, this, [[0, 16]]);
|
|
3117
3241
|
}));
|
|
3118
3242
|
function scanPromotionCode(_x20, _x21) {
|
|
3119
3243
|
return _scanPromotionCode.apply(this, arguments);
|
|
@@ -3123,18 +3247,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3123
3247
|
}, {
|
|
3124
3248
|
key: "setDiscountSelected",
|
|
3125
3249
|
value: function () {
|
|
3126
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3127
|
-
var list, updated, tempOrder, orderStore, discountModule, rulesModule, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator4, _step4, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator5, _step5, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
3128
|
-
return _regeneratorRuntime().wrap(function
|
|
3129
|
-
while (1) switch (
|
|
3250
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
3251
|
+
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$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
3252
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3253
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3130
3254
|
case 0:
|
|
3131
|
-
|
|
3255
|
+
_context29.prev = 0;
|
|
3132
3256
|
if (this.store.order) {
|
|
3133
|
-
|
|
3257
|
+
_context29.next = 3;
|
|
3134
3258
|
break;
|
|
3135
3259
|
}
|
|
3136
3260
|
throw new Error('order 模块未初始化');
|
|
3137
3261
|
case 3:
|
|
3262
|
+
currentOrder = this.store.order.ensureTempOrder();
|
|
3263
|
+
if (!this.isActiveVirtualSettlementOrder(currentOrder)) {
|
|
3264
|
+
_context29.next = 13;
|
|
3265
|
+
break;
|
|
3266
|
+
}
|
|
3267
|
+
currentOrder.discount_list = [];
|
|
3268
|
+
currentOrder.shop_discount = '0.00';
|
|
3269
|
+
_context29.next = 9;
|
|
3270
|
+
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, []);
|
|
3271
|
+
case 9:
|
|
3272
|
+
_context29.next = 11;
|
|
3273
|
+
return this.store.order.recalculateSummary({
|
|
3274
|
+
createIfMissing: true
|
|
3275
|
+
});
|
|
3276
|
+
case 11:
|
|
3277
|
+
this.store.order.persistTempOrder();
|
|
3278
|
+
return _context29.abrupt("return");
|
|
3279
|
+
case 13:
|
|
3138
3280
|
list = this.store.order.getDiscountList();
|
|
3139
3281
|
updated = list.map(function (d) {
|
|
3140
3282
|
return d.id === params.discountId && !isBaseSalesHistoricalDiscountEntry(d) ? _objectSpread(_objectSpread({}, d), {}, {
|
|
@@ -3148,9 +3290,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3148
3290
|
discountModule = orderStore.discount;
|
|
3149
3291
|
rulesModule = orderStore.rules;
|
|
3150
3292
|
nextDiscountList = updated;
|
|
3151
|
-
|
|
3293
|
+
_context29.next = 23;
|
|
3152
3294
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
3153
|
-
case
|
|
3295
|
+
case 23:
|
|
3154
3296
|
if (rulesModule) {
|
|
3155
3297
|
orderTotalAmount = Number(((_orderStore$summary3 = orderStore.summary) === null || _orderStore$summary3 === void 0 ? void 0 : _orderStore$summary3.total_amount) || 0);
|
|
3156
3298
|
result = rulesModule.calcDiscount({
|
|
@@ -3210,29 +3352,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3210
3352
|
});
|
|
3211
3353
|
};
|
|
3212
3354
|
_iterator5 = _createForOfIteratorHelper(tempOrder.products);
|
|
3213
|
-
|
|
3355
|
+
_context29.prev = 27;
|
|
3214
3356
|
_iterator5.s();
|
|
3215
|
-
case
|
|
3357
|
+
case 29:
|
|
3216
3358
|
if ((_step5 = _iterator5.n()).done) {
|
|
3217
|
-
|
|
3359
|
+
_context29.next = 46;
|
|
3218
3360
|
break;
|
|
3219
3361
|
}
|
|
3220
3362
|
product = _step5.value;
|
|
3221
3363
|
productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
|
|
3222
3364
|
runtimeOrigin = productUid ? (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[productUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin : undefined;
|
|
3223
3365
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
3224
|
-
|
|
3366
|
+
_context29.next = 35;
|
|
3225
3367
|
break;
|
|
3226
3368
|
}
|
|
3227
|
-
return
|
|
3228
|
-
case
|
|
3369
|
+
return _context29.abrupt("continue", 44);
|
|
3370
|
+
case 35:
|
|
3229
3371
|
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
3230
3372
|
if (Array.isArray(product.product_bundle)) {
|
|
3231
3373
|
product.product_bundle = product.product_bundle.map(function (bundle) {
|
|
3232
|
-
var
|
|
3374
|
+
var _ref39, _bundle$original_pric;
|
|
3233
3375
|
var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
|
|
3234
3376
|
var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
|
|
3235
|
-
var restoredBundlePrice = (
|
|
3377
|
+
var restoredBundlePrice = (_ref39 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref39 !== void 0 ? _ref39 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
|
|
3236
3378
|
return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
|
|
3237
3379
|
price: restoredBundlePrice,
|
|
3238
3380
|
bundle_selling_price: restoredBundlePrice
|
|
@@ -3259,33 +3401,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3259
3401
|
mainPrice: newMainSellingPrice,
|
|
3260
3402
|
bundle: product.product_bundle
|
|
3261
3403
|
});
|
|
3262
|
-
case
|
|
3263
|
-
|
|
3404
|
+
case 44:
|
|
3405
|
+
_context29.next = 29;
|
|
3264
3406
|
break;
|
|
3265
|
-
case
|
|
3266
|
-
|
|
3407
|
+
case 46:
|
|
3408
|
+
_context29.next = 51;
|
|
3267
3409
|
break;
|
|
3268
|
-
case
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
_iterator5.e(
|
|
3272
|
-
case
|
|
3273
|
-
|
|
3410
|
+
case 48:
|
|
3411
|
+
_context29.prev = 48;
|
|
3412
|
+
_context29.t0 = _context29["catch"](27);
|
|
3413
|
+
_iterator5.e(_context29.t0);
|
|
3414
|
+
case 51:
|
|
3415
|
+
_context29.prev = 51;
|
|
3274
3416
|
_iterator5.f();
|
|
3275
|
-
return
|
|
3276
|
-
case
|
|
3417
|
+
return _context29.finish(51);
|
|
3418
|
+
case 54:
|
|
3277
3419
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
3278
|
-
|
|
3420
|
+
_context29.next = 57;
|
|
3279
3421
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
3280
|
-
case
|
|
3422
|
+
case 57:
|
|
3281
3423
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
3282
3424
|
return d.isSelected;
|
|
3283
3425
|
});
|
|
3284
|
-
|
|
3426
|
+
_context29.next = 60;
|
|
3285
3427
|
return this.store.order.recalculateSummary({
|
|
3286
3428
|
createIfMissing: true
|
|
3287
3429
|
});
|
|
3288
|
-
case
|
|
3430
|
+
case 60:
|
|
3289
3431
|
this.store.order.persistTempOrder();
|
|
3290
3432
|
this.effectsEmit('onDiscountApplied', {
|
|
3291
3433
|
productList: tempOrder.products,
|
|
@@ -3293,17 +3435,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3293
3435
|
selectedDiscountList: tempOrder.discount_list,
|
|
3294
3436
|
tempOrder: tempOrder
|
|
3295
3437
|
});
|
|
3296
|
-
|
|
3438
|
+
_context29.next = 67;
|
|
3297
3439
|
break;
|
|
3298
|
-
case
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
throw
|
|
3302
|
-
case
|
|
3440
|
+
case 64:
|
|
3441
|
+
_context29.prev = 64;
|
|
3442
|
+
_context29.t1 = _context29["catch"](0);
|
|
3443
|
+
throw _context29.t1;
|
|
3444
|
+
case 67:
|
|
3303
3445
|
case "end":
|
|
3304
|
-
return
|
|
3446
|
+
return _context29.stop();
|
|
3305
3447
|
}
|
|
3306
|
-
},
|
|
3448
|
+
}, _callee29, this, [[0, 64], [27, 48, 51, 54]]);
|
|
3307
3449
|
}));
|
|
3308
3450
|
function setDiscountSelected(_x22) {
|
|
3309
3451
|
return _setDiscountSelected.apply(this, arguments);
|
|
@@ -3313,23 +3455,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3313
3455
|
}, {
|
|
3314
3456
|
key: "applyDiscountCalculationResult",
|
|
3315
3457
|
value: function () {
|
|
3316
|
-
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3458
|
+
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(result) {
|
|
3317
3459
|
var tempOrder, orderStore, discountModule;
|
|
3318
|
-
return _regeneratorRuntime().wrap(function
|
|
3319
|
-
while (1) switch (
|
|
3460
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3461
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3320
3462
|
case 0:
|
|
3321
|
-
|
|
3463
|
+
_context30.prev = 0;
|
|
3322
3464
|
if (this.store.order) {
|
|
3323
|
-
|
|
3465
|
+
_context30.next = 3;
|
|
3324
3466
|
break;
|
|
3325
3467
|
}
|
|
3326
3468
|
throw new Error('order 模块未初始化');
|
|
3327
3469
|
case 3:
|
|
3328
3470
|
if (result) {
|
|
3329
|
-
|
|
3471
|
+
_context30.next = 5;
|
|
3330
3472
|
break;
|
|
3331
3473
|
}
|
|
3332
|
-
return
|
|
3474
|
+
return _context30.abrupt("return");
|
|
3333
3475
|
case 5:
|
|
3334
3476
|
tempOrder = this.store.order.ensureTempOrder();
|
|
3335
3477
|
orderStore = this.store.order.store || {};
|
|
@@ -3338,24 +3480,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3338
3480
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
3339
3481
|
}
|
|
3340
3482
|
if (!result.discountList) {
|
|
3341
|
-
|
|
3483
|
+
_context30.next = 14;
|
|
3342
3484
|
break;
|
|
3343
3485
|
}
|
|
3344
3486
|
OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
|
|
3345
|
-
|
|
3487
|
+
_context30.next = 13;
|
|
3346
3488
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
|
|
3347
3489
|
case 13:
|
|
3348
3490
|
tempOrder.discount_list = result.discountList.filter(function (discount) {
|
|
3349
3491
|
return discount.isSelected;
|
|
3350
3492
|
});
|
|
3351
3493
|
case 14:
|
|
3352
|
-
|
|
3494
|
+
_context30.next = 16;
|
|
3353
3495
|
return this.store.order.recalculateSummary({
|
|
3354
3496
|
createIfMissing: true
|
|
3355
3497
|
});
|
|
3356
3498
|
case 16:
|
|
3357
3499
|
this.store.order.persistTempOrder();
|
|
3358
|
-
|
|
3500
|
+
_context30.next = 19;
|
|
3359
3501
|
return this.effectsEmit('onDiscountApplied', {
|
|
3360
3502
|
productList: tempOrder.products || [],
|
|
3361
3503
|
discountList: result.discountList || [],
|
|
@@ -3363,17 +3505,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3363
3505
|
tempOrder: tempOrder
|
|
3364
3506
|
});
|
|
3365
3507
|
case 19:
|
|
3366
|
-
|
|
3508
|
+
_context30.next = 24;
|
|
3367
3509
|
break;
|
|
3368
3510
|
case 21:
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
throw
|
|
3511
|
+
_context30.prev = 21;
|
|
3512
|
+
_context30.t0 = _context30["catch"](0);
|
|
3513
|
+
throw _context30.t0;
|
|
3372
3514
|
case 24:
|
|
3373
3515
|
case "end":
|
|
3374
|
-
return
|
|
3516
|
+
return _context30.stop();
|
|
3375
3517
|
}
|
|
3376
|
-
},
|
|
3518
|
+
}, _callee30, this, [[0, 21]]);
|
|
3377
3519
|
}));
|
|
3378
3520
|
function applyDiscountCalculationResult(_x23) {
|
|
3379
3521
|
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
@@ -3383,22 +3525,178 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3383
3525
|
}, {
|
|
3384
3526
|
key: "submitScanOrder",
|
|
3385
3527
|
value: function () {
|
|
3386
|
-
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3387
|
-
return _regeneratorRuntime().wrap(function
|
|
3388
|
-
while (1) switch (
|
|
3528
|
+
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3529
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3530
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3389
3531
|
case 0:
|
|
3390
|
-
return
|
|
3532
|
+
return _context31.abrupt("return", this.submitSalesOrder(params));
|
|
3391
3533
|
case 1:
|
|
3392
3534
|
case "end":
|
|
3393
|
-
return
|
|
3535
|
+
return _context31.stop();
|
|
3394
3536
|
}
|
|
3395
|
-
},
|
|
3537
|
+
}, _callee31, this);
|
|
3396
3538
|
}));
|
|
3397
3539
|
function submitScanOrder(_x24) {
|
|
3398
3540
|
return _submitScanOrder.apply(this, arguments);
|
|
3399
3541
|
}
|
|
3400
3542
|
return submitScanOrder;
|
|
3401
3543
|
}()
|
|
3544
|
+
}, {
|
|
3545
|
+
key: "buildVirtualSettlementSubmitData",
|
|
3546
|
+
value: function () {
|
|
3547
|
+
var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
3548
|
+
var _tempOrder$metadata$c, _tempOrder$metadata2;
|
|
3549
|
+
var tempOrder, snapshot, currencyProductId, summary, amount, customerId, asset, currencyCode, currencySymbol, currencyFormat, balance, amountText, paymentNumber, payment, _paymentMethod$custom, paymentMethods, paymentMethod;
|
|
3550
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3551
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3552
|
+
case 0:
|
|
3553
|
+
if (this.store.order) {
|
|
3554
|
+
_context32.next = 2;
|
|
3555
|
+
break;
|
|
3556
|
+
}
|
|
3557
|
+
return _context32.abrupt("return", null);
|
|
3558
|
+
case 2:
|
|
3559
|
+
tempOrder = this.store.order.getTempOrder();
|
|
3560
|
+
if (this.isActiveVirtualSettlementOrder(tempOrder)) {
|
|
3561
|
+
_context32.next = 5;
|
|
3562
|
+
break;
|
|
3563
|
+
}
|
|
3564
|
+
return _context32.abrupt("return", null);
|
|
3565
|
+
case 5:
|
|
3566
|
+
snapshot = getTempOrderSettlementSnapshot(tempOrder);
|
|
3567
|
+
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);
|
|
3568
|
+
if (!(!snapshot || !Number.isFinite(currencyProductId) || currencyProductId <= 0)) {
|
|
3569
|
+
_context32.next = 9;
|
|
3570
|
+
break;
|
|
3571
|
+
}
|
|
3572
|
+
throw new Error('Virtual currency settlement configuration is invalid.');
|
|
3573
|
+
case 9:
|
|
3574
|
+
_context32.next = 11;
|
|
3575
|
+
return this.store.order.recalculateSummary({
|
|
3576
|
+
createIfMissing: true
|
|
3577
|
+
});
|
|
3578
|
+
case 11:
|
|
3579
|
+
summary = _context32.sent;
|
|
3580
|
+
amount = new Decimal((summary === null || summary === void 0 ? void 0 : summary.total_amount) || 0).toDecimalPlaces(2);
|
|
3581
|
+
customerId = Number((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id) || 0);
|
|
3582
|
+
if (!(amount.gt(0) && customerId > 0 && customerId !== 1)) {
|
|
3583
|
+
_context32.next = 17;
|
|
3584
|
+
break;
|
|
3585
|
+
}
|
|
3586
|
+
_context32.next = 17;
|
|
3587
|
+
return this.store.order.loadDiscountConfig({
|
|
3588
|
+
customerId: customerId,
|
|
3589
|
+
action: tempOrder !== null && tempOrder !== void 0 && tempOrder.order_id ? 'edit' : 'create',
|
|
3590
|
+
orderId: Number(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || undefined,
|
|
3591
|
+
apply: false
|
|
3592
|
+
});
|
|
3593
|
+
case 17:
|
|
3594
|
+
asset = this.store.order.getVirtualCurrencyList().find(function (item) {
|
|
3595
|
+
return Number(item === null || item === void 0 ? void 0 : item.product_id) === currencyProductId;
|
|
3596
|
+
});
|
|
3597
|
+
currencyCode = String((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.currency_code) || '');
|
|
3598
|
+
currencySymbol = String((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.currency_symbol) || '');
|
|
3599
|
+
currencyFormat = String((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.currency_format) || 'symbol_first');
|
|
3600
|
+
if (!amount.lte(0)) {
|
|
3601
|
+
_context32.next = 23;
|
|
3602
|
+
break;
|
|
3603
|
+
}
|
|
3604
|
+
return _context32.abrupt("return", {
|
|
3605
|
+
payments: [],
|
|
3606
|
+
snapshot: snapshot,
|
|
3607
|
+
currencyProductId: currencyProductId,
|
|
3608
|
+
currencyCode: currencyCode,
|
|
3609
|
+
currencySymbol: currencySymbol,
|
|
3610
|
+
currencyFormat: currencyFormat
|
|
3611
|
+
});
|
|
3612
|
+
case 23:
|
|
3613
|
+
if (asset) {
|
|
3614
|
+
_context32.next = 25;
|
|
3615
|
+
break;
|
|
3616
|
+
}
|
|
3617
|
+
throw new Error('No matching virtual currency card is available.');
|
|
3618
|
+
case 25:
|
|
3619
|
+
balance = new Decimal(asset.balance || 0);
|
|
3620
|
+
if (!balance.lt(amount)) {
|
|
3621
|
+
_context32.next = 28;
|
|
3622
|
+
break;
|
|
3623
|
+
}
|
|
3624
|
+
throw new Error('Insufficient virtual currency balance.');
|
|
3625
|
+
case 28:
|
|
3626
|
+
amountText = amount.toFixed(2);
|
|
3627
|
+
paymentNumber = "LOCAL_".concat(createUuidV4());
|
|
3628
|
+
if (!this.store.order.isOnlineStorePlatform()) {
|
|
3629
|
+
_context32.next = 34;
|
|
3630
|
+
break;
|
|
3631
|
+
}
|
|
3632
|
+
payment = {
|
|
3633
|
+
payment_number: paymentNumber,
|
|
3634
|
+
amount: amount.toNumber(),
|
|
3635
|
+
metadata: {
|
|
3636
|
+
unique_payment_number: createUuidV4()
|
|
3637
|
+
},
|
|
3638
|
+
tag: asset.tag,
|
|
3639
|
+
voucher_id: asset.id,
|
|
3640
|
+
wallet_pass_usage_unit: {
|
|
3641
|
+
price: 1,
|
|
3642
|
+
points: 1
|
|
3643
|
+
},
|
|
3644
|
+
wallet_pass_use_value: amountText
|
|
3645
|
+
};
|
|
3646
|
+
_context32.next = 41;
|
|
3647
|
+
break;
|
|
3648
|
+
case 34:
|
|
3649
|
+
_context32.next = 36;
|
|
3650
|
+
return this.getPaymentMethodsAsync();
|
|
3651
|
+
case 36:
|
|
3652
|
+
paymentMethods = _context32.sent;
|
|
3653
|
+
paymentMethod = paymentMethods.find(function (method) {
|
|
3654
|
+
return String(method.code || '').toUpperCase() === 'PRODUCTVOUCHER';
|
|
3655
|
+
});
|
|
3656
|
+
if (paymentMethod) {
|
|
3657
|
+
_context32.next = 40;
|
|
3658
|
+
break;
|
|
3659
|
+
}
|
|
3660
|
+
throw new Error('PRODUCTVOUCHER payment method is unavailable.');
|
|
3661
|
+
case 40:
|
|
3662
|
+
payment = {
|
|
3663
|
+
payment_number: paymentNumber,
|
|
3664
|
+
amount: amountText,
|
|
3665
|
+
origin_amount: amountText,
|
|
3666
|
+
code: paymentMethod.code,
|
|
3667
|
+
custom_payment_id: paymentMethod.id,
|
|
3668
|
+
custom_payment_type: (_paymentMethod$custom = paymentMethod.custom_payment_type) !== null && _paymentMethod$custom !== void 0 ? _paymentMethod$custom : paymentMethod.type,
|
|
3669
|
+
name: paymentMethod.name,
|
|
3670
|
+
type: 'normal',
|
|
3671
|
+
voucher_id: asset.id,
|
|
3672
|
+
order_payment_type: 'normal',
|
|
3673
|
+
wallet_pass_usage_unit: {
|
|
3674
|
+
price: 1,
|
|
3675
|
+
points: 1
|
|
3676
|
+
},
|
|
3677
|
+
wallet_pass_use_value: amountText,
|
|
3678
|
+
metadata: {}
|
|
3679
|
+
};
|
|
3680
|
+
case 41:
|
|
3681
|
+
return _context32.abrupt("return", {
|
|
3682
|
+
payments: [payment],
|
|
3683
|
+
snapshot: snapshot,
|
|
3684
|
+
currencyProductId: currencyProductId,
|
|
3685
|
+
currencyCode: currencyCode,
|
|
3686
|
+
currencySymbol: currencySymbol,
|
|
3687
|
+
currencyFormat: currencyFormat
|
|
3688
|
+
});
|
|
3689
|
+
case 42:
|
|
3690
|
+
case "end":
|
|
3691
|
+
return _context32.stop();
|
|
3692
|
+
}
|
|
3693
|
+
}, _callee32, this);
|
|
3694
|
+
}));
|
|
3695
|
+
function buildVirtualSettlementSubmitData() {
|
|
3696
|
+
return _buildVirtualSettlementSubmitData.apply(this, arguments);
|
|
3697
|
+
}
|
|
3698
|
+
return buildVirtualSettlementSubmitData;
|
|
3699
|
+
}()
|
|
3402
3700
|
/**
|
|
3403
3701
|
* 提交当前 Sales 订单。
|
|
3404
3702
|
*
|
|
@@ -3408,46 +3706,72 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3408
3706
|
}, {
|
|
3409
3707
|
key: "submitSalesOrder",
|
|
3410
3708
|
value: (function () {
|
|
3411
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3412
|
-
var _params$smallTicketDa, _this$
|
|
3413
|
-
var inferredPaymentStatus, smallTicketDataFlag,
|
|
3414
|
-
return _regeneratorRuntime().wrap(function
|
|
3415
|
-
while (1) switch (
|
|
3709
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
3710
|
+
var _params$smallTicketDa, _this$otherParams14, _this$otherParams15, _this$otherParams16, _this$otherParams17;
|
|
3711
|
+
var virtualSettlement, inferredPaymentStatus, smallTicketDataFlag, _enhancePayload, submitParams;
|
|
3712
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3713
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3416
3714
|
case 0:
|
|
3417
3715
|
if (this.store.order) {
|
|
3418
|
-
|
|
3716
|
+
_context33.next = 2;
|
|
3419
3717
|
break;
|
|
3420
3718
|
}
|
|
3421
3719
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
3422
3720
|
case 2:
|
|
3721
|
+
_context33.next = 4;
|
|
3722
|
+
return this.buildVirtualSettlementSubmitData();
|
|
3723
|
+
case 4:
|
|
3724
|
+
virtualSettlement = _context33.sent;
|
|
3423
3725
|
// this.store.order.persistTempOrder();
|
|
3424
3726
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
3425
3727
|
smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
3426
|
-
|
|
3728
|
+
_enhancePayload = this.buildSubmitPayloadEnhancerWithFulfillmentRefMode(params === null || params === void 0 ? void 0 : params.enhancePayload);
|
|
3427
3729
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
3428
3730
|
cacheId: this.cacheId,
|
|
3429
|
-
platform: (_this$
|
|
3430
|
-
businessCode: ((_this$
|
|
3731
|
+
platform: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform,
|
|
3732
|
+
businessCode: ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.businessCode) || ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.business_code),
|
|
3431
3733
|
channel: this.getSubmitOrderSalesChannel(),
|
|
3432
|
-
type: (_this$
|
|
3734
|
+
type: (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.type,
|
|
3433
3735
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
3434
|
-
},
|
|
3736
|
+
}, virtualSettlement ? {
|
|
3737
|
+
payments: virtualSettlement.payments
|
|
3738
|
+
} : (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
3435
3739
|
payments: params.payments
|
|
3436
3740
|
} : {}), inferredPaymentStatus !== undefined ? {
|
|
3437
3741
|
paymentStatus: inferredPaymentStatus
|
|
3438
3742
|
} : {}), smallTicketDataFlag !== undefined ? {
|
|
3439
3743
|
smallTicketDataFlag: smallTicketDataFlag
|
|
3440
|
-
} : {}),
|
|
3744
|
+
} : {}), virtualSettlement ? {
|
|
3745
|
+
confirmPendingVoucherPayments: false
|
|
3746
|
+
} : (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
3441
3747
|
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
3442
|
-
} : {}),
|
|
3443
|
-
enhancePayload: enhancePayload
|
|
3748
|
+
} : {}), virtualSettlement ? {
|
|
3749
|
+
enhancePayload: function enhancePayload(payload, ctx) {
|
|
3750
|
+
var _callerPayload$metada, _currencySettlementCo;
|
|
3751
|
+
var callerPayload = _enhancePayload ? _enhancePayload(payload, ctx) : payload;
|
|
3752
|
+
var currencySettlementConfig = ((_callerPayload$metada = callerPayload.metadata) === null || _callerPayload$metada === void 0 ? void 0 : _callerPayload$metada.currency_settlement_config) || {};
|
|
3753
|
+
return _objectSpread(_objectSpread({}, callerPayload), {}, {
|
|
3754
|
+
metadata: _objectSpread(_objectSpread({}, callerPayload.metadata || {}), {}, {
|
|
3755
|
+
currency_settlement_config: _objectSpread(_objectSpread({}, currencySettlementConfig), {}, {
|
|
3756
|
+
settlement_type: 'virtual_currency',
|
|
3757
|
+
settlement_ids: [virtualSettlement.currencyProductId],
|
|
3758
|
+
currency_display_snapshot: cloneDeep((_currencySettlementCo = currencySettlementConfig.currency_display_snapshot) !== null && _currencySettlementCo !== void 0 ? _currencySettlementCo : buildCurrencyDisplaySnapshot(virtualSettlement.snapshot))
|
|
3759
|
+
})
|
|
3760
|
+
}),
|
|
3761
|
+
currency_code: virtualSettlement.currencyCode,
|
|
3762
|
+
currency_symbol: virtualSettlement.currencySymbol,
|
|
3763
|
+
currency_format: virtualSettlement.currencyFormat
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3766
|
+
} : _enhancePayload !== undefined ? {
|
|
3767
|
+
enhancePayload: _enhancePayload
|
|
3444
3768
|
} : {});
|
|
3445
|
-
return
|
|
3446
|
-
case
|
|
3769
|
+
return _context33.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
|
|
3770
|
+
case 10:
|
|
3447
3771
|
case "end":
|
|
3448
|
-
return
|
|
3772
|
+
return _context33.stop();
|
|
3449
3773
|
}
|
|
3450
|
-
},
|
|
3774
|
+
}, _callee33, this);
|
|
3451
3775
|
}));
|
|
3452
3776
|
function submitSalesOrder(_x25) {
|
|
3453
3777
|
return _submitSalesOrder.apply(this, arguments);
|
|
@@ -3457,31 +3781,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3457
3781
|
}, {
|
|
3458
3782
|
key: "saveSalesOrderDraft",
|
|
3459
3783
|
value: function () {
|
|
3460
|
-
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3461
|
-
var _params$platform, _this$
|
|
3462
|
-
return _regeneratorRuntime().wrap(function
|
|
3463
|
-
while (1) switch (
|
|
3784
|
+
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
3785
|
+
var _params$platform, _this$otherParams18, _this$otherParams19, _this$otherParams20, _params$channel, _params$type, _this$otherParams21;
|
|
3786
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3787
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3464
3788
|
case 0:
|
|
3465
3789
|
if (this.store.order) {
|
|
3466
|
-
|
|
3790
|
+
_context34.next = 2;
|
|
3467
3791
|
break;
|
|
3468
3792
|
}
|
|
3469
3793
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
3470
3794
|
case 2:
|
|
3471
|
-
return
|
|
3795
|
+
return _context34.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
|
|
3472
3796
|
cacheId: this.cacheId,
|
|
3473
|
-
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$
|
|
3474
|
-
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$
|
|
3797
|
+
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform,
|
|
3798
|
+
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.businessCode) || ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.business_code),
|
|
3475
3799
|
channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
|
|
3476
|
-
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$
|
|
3800
|
+
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.type
|
|
3477
3801
|
}, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
3478
3802
|
enhancePayload: params.enhancePayload
|
|
3479
3803
|
} : {})));
|
|
3480
3804
|
case 3:
|
|
3481
3805
|
case "end":
|
|
3482
|
-
return
|
|
3806
|
+
return _context34.stop();
|
|
3483
3807
|
}
|
|
3484
|
-
},
|
|
3808
|
+
}, _callee34, this);
|
|
3485
3809
|
}));
|
|
3486
3810
|
function saveSalesOrderDraft(_x26) {
|
|
3487
3811
|
return _saveSalesOrderDraft.apply(this, arguments);
|
|
@@ -3491,14 +3815,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3491
3815
|
}, {
|
|
3492
3816
|
key: "submitTempOrderAsync",
|
|
3493
3817
|
value: function () {
|
|
3494
|
-
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3495
|
-
var _params$smallTicketDa2, _this$
|
|
3818
|
+
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
3819
|
+
var _params$smallTicketDa2, _this$otherParams22, _this$otherParams23, _this$otherParams24, _this$otherParams25;
|
|
3496
3820
|
var inferredPaymentStatus, smallTicketDataFlag, enhancePayload, submitParams;
|
|
3497
|
-
return _regeneratorRuntime().wrap(function
|
|
3498
|
-
while (1) switch (
|
|
3821
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3822
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3499
3823
|
case 0:
|
|
3500
3824
|
if (this.store.order) {
|
|
3501
|
-
|
|
3825
|
+
_context35.next = 2;
|
|
3502
3826
|
break;
|
|
3503
3827
|
}
|
|
3504
3828
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -3508,10 +3832,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3508
3832
|
enhancePayload = this.buildSubmitPayloadEnhancerWithFulfillmentRefMode(params === null || params === void 0 ? void 0 : params.enhancePayload);
|
|
3509
3833
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
3510
3834
|
cacheId: this.cacheId,
|
|
3511
|
-
platform: (_this$
|
|
3512
|
-
businessCode: ((_this$
|
|
3835
|
+
platform: (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.platform,
|
|
3836
|
+
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),
|
|
3513
3837
|
channel: this.getSubmitOrderSalesChannel(),
|
|
3514
|
-
type: (_this$
|
|
3838
|
+
type: (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.type,
|
|
3515
3839
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
3516
3840
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
3517
3841
|
payments: params.payments
|
|
@@ -3524,12 +3848,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3524
3848
|
} : {}), enhancePayload !== undefined ? {
|
|
3525
3849
|
enhancePayload: enhancePayload
|
|
3526
3850
|
} : {});
|
|
3527
|
-
return
|
|
3851
|
+
return _context35.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
|
|
3528
3852
|
case 7:
|
|
3529
3853
|
case "end":
|
|
3530
|
-
return
|
|
3854
|
+
return _context35.stop();
|
|
3531
3855
|
}
|
|
3532
|
-
},
|
|
3856
|
+
}, _callee35, this);
|
|
3533
3857
|
}));
|
|
3534
3858
|
function submitTempOrderAsync(_x27) {
|
|
3535
3859
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
@@ -3543,8 +3867,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3543
3867
|
}, {
|
|
3544
3868
|
key: "shouldUseCheckoutSyncTask",
|
|
3545
3869
|
value: function shouldUseCheckoutSyncTask() {
|
|
3546
|
-
var _this$
|
|
3547
|
-
var configured = (_this$
|
|
3870
|
+
var _this$otherParams26;
|
|
3871
|
+
var configured = (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.checkoutSyncTaskEnabled;
|
|
3548
3872
|
return typeof configured === 'boolean' ? configured : true;
|
|
3549
3873
|
}
|
|
3550
3874
|
|
|
@@ -3557,14 +3881,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3557
3881
|
}, {
|
|
3558
3882
|
key: "printLocalOrderReceipt",
|
|
3559
3883
|
value: function () {
|
|
3560
|
-
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3561
|
-
var _this$
|
|
3562
|
-
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$
|
|
3563
|
-
return _regeneratorRuntime().wrap(function
|
|
3564
|
-
while (1) switch (
|
|
3884
|
+
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(lookup) {
|
|
3885
|
+
var _this$otherParams27, _this$otherParams28, _this$otherParams29, _this$otherParams30;
|
|
3886
|
+
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order6, _data;
|
|
3887
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3888
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3565
3889
|
case 0:
|
|
3566
3890
|
if (this.store.order) {
|
|
3567
|
-
|
|
3891
|
+
_context36.next = 2;
|
|
3568
3892
|
break;
|
|
3569
3893
|
}
|
|
3570
3894
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -3576,10 +3900,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3576
3900
|
external_sale_number: lookup
|
|
3577
3901
|
};
|
|
3578
3902
|
context = {
|
|
3579
|
-
platform: (_this$
|
|
3580
|
-
businessCode: ((_this$
|
|
3903
|
+
platform: (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform,
|
|
3904
|
+
businessCode: ((_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.businessCode) || ((_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.business_code),
|
|
3581
3905
|
channel: this.getSubmitOrderSalesChannel(),
|
|
3582
|
-
type: (_this$
|
|
3906
|
+
type: (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.type
|
|
3583
3907
|
};
|
|
3584
3908
|
payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
|
|
3585
3909
|
lookup_order_from_db: 1,
|
|
@@ -3595,26 +3919,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3595
3919
|
channel: context.channel,
|
|
3596
3920
|
type: context.type
|
|
3597
3921
|
});
|
|
3598
|
-
|
|
3922
|
+
_context36.next = 8;
|
|
3599
3923
|
return this.request.post('/local/print-order', payload, {
|
|
3600
3924
|
osServer: true,
|
|
3601
3925
|
customToast: function customToast() {}
|
|
3602
3926
|
});
|
|
3603
3927
|
case 8:
|
|
3604
|
-
response =
|
|
3928
|
+
response = _context36.sent;
|
|
3605
3929
|
if (hasLookup) {
|
|
3606
|
-
|
|
3930
|
+
_context36.next = 12;
|
|
3607
3931
|
break;
|
|
3608
3932
|
}
|
|
3609
|
-
|
|
3610
|
-
return (_this$store$order$app = (_this$store$
|
|
3933
|
+
_context36.next = 12;
|
|
3934
|
+
return (_this$store$order$app = (_this$store$order6 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order6, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
|
|
3611
3935
|
case 12:
|
|
3612
|
-
return
|
|
3936
|
+
return _context36.abrupt("return", response);
|
|
3613
3937
|
case 13:
|
|
3614
3938
|
case "end":
|
|
3615
|
-
return
|
|
3939
|
+
return _context36.stop();
|
|
3616
3940
|
}
|
|
3617
|
-
},
|
|
3941
|
+
}, _callee36, this);
|
|
3618
3942
|
}));
|
|
3619
3943
|
function printLocalOrderReceipt(_x28) {
|
|
3620
3944
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
@@ -3624,9 +3948,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3624
3948
|
}, {
|
|
3625
3949
|
key: "getSubmitPaymentStatus",
|
|
3626
3950
|
value: function getSubmitPaymentStatus(paymentStatus) {
|
|
3627
|
-
var _this$store$
|
|
3951
|
+
var _this$store$order7, _this$store$order7$ge;
|
|
3628
3952
|
if (paymentStatus !== undefined) return paymentStatus;
|
|
3629
|
-
var amountSnapshot = (_this$store$
|
|
3953
|
+
var amountSnapshot = (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getOrderAmountSnapshot) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7);
|
|
3630
3954
|
if (!amountSnapshot) return undefined;
|
|
3631
3955
|
try {
|
|
3632
3956
|
return new Decimal(amountSnapshot.amountGap || 0).lte(0) ? 'paid' : undefined;
|
|
@@ -3637,19 +3961,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3637
3961
|
}, {
|
|
3638
3962
|
key: "syncPaymentsToOrder",
|
|
3639
3963
|
value: function () {
|
|
3640
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3641
|
-
var
|
|
3964
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
3965
|
+
var _ref40, _params$businessCode, _this$otherParams31, _this$otherParams32, _params$channel2;
|
|
3642
3966
|
var businessCode, channel, enhancePayload, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
3643
|
-
return _regeneratorRuntime().wrap(function
|
|
3644
|
-
while (1) switch (
|
|
3967
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3968
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3645
3969
|
case 0:
|
|
3646
3970
|
if (this.store.order) {
|
|
3647
|
-
|
|
3971
|
+
_context37.next = 2;
|
|
3648
3972
|
break;
|
|
3649
3973
|
}
|
|
3650
3974
|
throw new Error('order 模块未初始化');
|
|
3651
3975
|
case 2:
|
|
3652
|
-
businessCode = (
|
|
3976
|
+
businessCode = (_ref40 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.businessCode) !== null && _ref40 !== void 0 ? _ref40 : (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.business_code;
|
|
3653
3977
|
channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
|
|
3654
3978
|
enhancePayload = this.buildSubmitPayloadEnhancerWithFulfillmentRefMode(params.enhancePayload);
|
|
3655
3979
|
syncParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -3663,14 +3987,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3663
3987
|
} : {});
|
|
3664
3988
|
syncState = this.store.order.getOrderSyncState();
|
|
3665
3989
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
3666
|
-
|
|
3990
|
+
_context37.next = 10;
|
|
3667
3991
|
break;
|
|
3668
3992
|
}
|
|
3669
3993
|
this.queueLatestAutoPaymentSync();
|
|
3670
|
-
return
|
|
3994
|
+
return _context37.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
3671
3995
|
case 10:
|
|
3672
3996
|
payments = params.payments || [];
|
|
3673
|
-
|
|
3997
|
+
_context37.next = 13;
|
|
3674
3998
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
3675
3999
|
payments: payments,
|
|
3676
4000
|
params: syncParams,
|
|
@@ -3678,11 +4002,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3678
4002
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
3679
4003
|
});
|
|
3680
4004
|
case 13:
|
|
3681
|
-
|
|
3682
|
-
|
|
4005
|
+
_context37.prev = 13;
|
|
4006
|
+
_context37.next = 16;
|
|
3683
4007
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
3684
4008
|
case 16:
|
|
3685
|
-
syncResult =
|
|
4009
|
+
syncResult = _context37.sent;
|
|
3686
4010
|
latestPayments = this.store.order.getOrderPayments();
|
|
3687
4011
|
amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
3688
4012
|
orderSnapshot = this.store.order.getOrderSnapshot();
|
|
@@ -3700,25 +4024,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3700
4024
|
depositAmount: syncResult.depositAmount,
|
|
3701
4025
|
orderExpectedAmount: syncResult.orderExpectedAmount
|
|
3702
4026
|
};
|
|
3703
|
-
|
|
4027
|
+
_context37.next = 23;
|
|
3704
4028
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
|
|
3705
4029
|
case 23:
|
|
3706
4030
|
if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
|
|
3707
|
-
|
|
4031
|
+
_context37.next = 26;
|
|
3708
4032
|
break;
|
|
3709
4033
|
}
|
|
3710
|
-
|
|
4034
|
+
_context37.next = 26;
|
|
3711
4035
|
return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
|
|
3712
4036
|
case 26:
|
|
3713
4037
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
3714
|
-
return
|
|
4038
|
+
return _context37.abrupt("return", syncResult);
|
|
3715
4039
|
case 30:
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
4040
|
+
_context37.prev = 30;
|
|
4041
|
+
_context37.t0 = _context37["catch"](13);
|
|
4042
|
+
_context37.next = 34;
|
|
3719
4043
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
3720
4044
|
ok: false,
|
|
3721
|
-
error:
|
|
4045
|
+
error: _context37.t0,
|
|
3722
4046
|
payments: this.store.order.getOrderPayments(),
|
|
3723
4047
|
params: syncParams,
|
|
3724
4048
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
@@ -3726,12 +4050,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3726
4050
|
});
|
|
3727
4051
|
case 34:
|
|
3728
4052
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
3729
|
-
throw
|
|
4053
|
+
throw _context37.t0;
|
|
3730
4054
|
case 36:
|
|
3731
4055
|
case "end":
|
|
3732
|
-
return
|
|
4056
|
+
return _context37.stop();
|
|
3733
4057
|
}
|
|
3734
|
-
},
|
|
4058
|
+
}, _callee37, this, [[13, 30]]);
|
|
3735
4059
|
}));
|
|
3736
4060
|
function syncPaymentsToOrder(_x29) {
|
|
3737
4061
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
@@ -3782,46 +4106,46 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3782
4106
|
}, {
|
|
3783
4107
|
key: "flushQueuedAutoPaymentSync",
|
|
3784
4108
|
value: function () {
|
|
3785
|
-
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4109
|
+
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3786
4110
|
var payments;
|
|
3787
|
-
return _regeneratorRuntime().wrap(function
|
|
3788
|
-
while (1) switch (
|
|
4111
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
4112
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3789
4113
|
case 0:
|
|
3790
4114
|
if (this.store.order) {
|
|
3791
|
-
|
|
4115
|
+
_context38.next = 2;
|
|
3792
4116
|
break;
|
|
3793
4117
|
}
|
|
3794
|
-
return
|
|
4118
|
+
return _context38.abrupt("return");
|
|
3795
4119
|
case 2:
|
|
3796
4120
|
if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
|
|
3797
|
-
|
|
4121
|
+
_context38.next = 4;
|
|
3798
4122
|
break;
|
|
3799
4123
|
}
|
|
3800
|
-
return
|
|
4124
|
+
return _context38.abrupt("return");
|
|
3801
4125
|
case 4:
|
|
3802
4126
|
if (!(this.store.order.getOrderSyncState() === 'submitting')) {
|
|
3803
|
-
|
|
4127
|
+
_context38.next = 7;
|
|
3804
4128
|
break;
|
|
3805
4129
|
}
|
|
3806
4130
|
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
3807
|
-
return
|
|
4131
|
+
return _context38.abrupt("return");
|
|
3808
4132
|
case 7:
|
|
3809
4133
|
this.autoPaymentSyncFlushing = true;
|
|
3810
|
-
|
|
4134
|
+
_context38.prev = 8;
|
|
3811
4135
|
case 9:
|
|
3812
4136
|
if (!this.queuedAutoPaymentSync) {
|
|
3813
|
-
|
|
4137
|
+
_context38.next = 18;
|
|
3814
4138
|
break;
|
|
3815
4139
|
}
|
|
3816
4140
|
this.queuedAutoPaymentSync = false;
|
|
3817
4141
|
payments = this.store.order.getOrderPayments();
|
|
3818
4142
|
if (payments.length) {
|
|
3819
|
-
|
|
4143
|
+
_context38.next = 14;
|
|
3820
4144
|
break;
|
|
3821
4145
|
}
|
|
3822
|
-
return
|
|
4146
|
+
return _context38.abrupt("continue", 9);
|
|
3823
4147
|
case 14:
|
|
3824
|
-
|
|
4148
|
+
_context38.next = 16;
|
|
3825
4149
|
return this.syncPaymentsToOrder({
|
|
3826
4150
|
payments: payments,
|
|
3827
4151
|
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
@@ -3829,29 +4153,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3829
4153
|
smallTicketDataFlag: 1
|
|
3830
4154
|
});
|
|
3831
4155
|
case 16:
|
|
3832
|
-
|
|
4156
|
+
_context38.next = 9;
|
|
3833
4157
|
break;
|
|
3834
4158
|
case 18:
|
|
3835
|
-
|
|
4159
|
+
_context38.next = 23;
|
|
3836
4160
|
break;
|
|
3837
4161
|
case 20:
|
|
3838
|
-
|
|
3839
|
-
|
|
4162
|
+
_context38.prev = 20;
|
|
4163
|
+
_context38.t0 = _context38["catch"](8);
|
|
3840
4164
|
this.logError('queued auto sync payments failed', {
|
|
3841
|
-
error:
|
|
4165
|
+
error: _context38.t0 instanceof Error ? _context38.t0.message : String(_context38.t0)
|
|
3842
4166
|
});
|
|
3843
4167
|
case 23:
|
|
3844
|
-
|
|
4168
|
+
_context38.prev = 23;
|
|
3845
4169
|
this.autoPaymentSyncFlushing = false;
|
|
3846
4170
|
if (this.queuedAutoPaymentSync) {
|
|
3847
4171
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
3848
4172
|
}
|
|
3849
|
-
return
|
|
4173
|
+
return _context38.finish(23);
|
|
3850
4174
|
case 27:
|
|
3851
4175
|
case "end":
|
|
3852
|
-
return
|
|
4176
|
+
return _context38.stop();
|
|
3853
4177
|
}
|
|
3854
|
-
},
|
|
4178
|
+
}, _callee38, this, [[8, 20, 23, 27]]);
|
|
3855
4179
|
}));
|
|
3856
4180
|
function flushQueuedAutoPaymentSync() {
|
|
3857
4181
|
return _flushQueuedAutoPaymentSync.apply(this, arguments);
|
|
@@ -3875,33 +4199,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3875
4199
|
}, {
|
|
3876
4200
|
key: "addOrderPaymentAsync",
|
|
3877
4201
|
value: (function () {
|
|
3878
|
-
var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4202
|
+
var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(payment) {
|
|
3879
4203
|
var paymentRecord, hasPaymentNumber, devicePrefix;
|
|
3880
|
-
return _regeneratorRuntime().wrap(function
|
|
3881
|
-
while (1) switch (
|
|
4204
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4205
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3882
4206
|
case 0:
|
|
3883
4207
|
paymentRecord = payment;
|
|
3884
4208
|
hasPaymentNumber = String(paymentRecord.payment_number || '').trim() !== '';
|
|
3885
4209
|
if (!hasPaymentNumber) {
|
|
3886
|
-
|
|
4210
|
+
_context39.next = 6;
|
|
3887
4211
|
break;
|
|
3888
4212
|
}
|
|
3889
|
-
|
|
3890
|
-
|
|
4213
|
+
_context39.t0 = 'LOCAL';
|
|
4214
|
+
_context39.next = 9;
|
|
3891
4215
|
break;
|
|
3892
4216
|
case 6:
|
|
3893
|
-
|
|
4217
|
+
_context39.next = 8;
|
|
3894
4218
|
return this.getPaymentNumberDevicePrefixAsync();
|
|
3895
4219
|
case 8:
|
|
3896
|
-
|
|
4220
|
+
_context39.t0 = _context39.sent;
|
|
3897
4221
|
case 9:
|
|
3898
|
-
devicePrefix =
|
|
3899
|
-
return
|
|
4222
|
+
devicePrefix = _context39.t0;
|
|
4223
|
+
return _context39.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
|
|
3900
4224
|
case 11:
|
|
3901
4225
|
case "end":
|
|
3902
|
-
return
|
|
4226
|
+
return _context39.stop();
|
|
3903
4227
|
}
|
|
3904
|
-
},
|
|
4228
|
+
}, _callee39, this);
|
|
3905
4229
|
}));
|
|
3906
4230
|
function addOrderPaymentAsync(_x30) {
|
|
3907
4231
|
return _addOrderPaymentAsync.apply(this, arguments);
|
|
@@ -3911,10 +4235,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3911
4235
|
}, {
|
|
3912
4236
|
key: "addOrderPaymentWithDevicePrefix",
|
|
3913
4237
|
value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
|
|
3914
|
-
var _this$
|
|
4238
|
+
var _this$otherParams33,
|
|
3915
4239
|
_paymentRecord$paymen,
|
|
3916
4240
|
_paymentRecord$create,
|
|
3917
|
-
|
|
4241
|
+
_ref41,
|
|
3918
4242
|
_paymentRecord$origin,
|
|
3919
4243
|
_this16 = this;
|
|
3920
4244
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
@@ -3927,7 +4251,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3927
4251
|
return this.store.order.getOrderPayments();
|
|
3928
4252
|
}
|
|
3929
4253
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
3930
|
-
var shopWalletPassId = (_this$
|
|
4254
|
+
var shopWalletPassId = (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.shop_wallet_pass_id;
|
|
3931
4255
|
if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
|
|
3932
4256
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
3933
4257
|
}
|
|
@@ -3936,7 +4260,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3936
4260
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
3937
4261
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
3938
4262
|
var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
|
|
3939
|
-
var calculatedServiceFee = serviceCharge ? new Decimal((
|
|
4263
|
+
var calculatedServiceFee = serviceCharge ? new Decimal((_ref41 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref41 !== void 0 ? _ref41 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
|
|
3940
4264
|
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, normalizedPaymentRecord), calculatedServiceFee !== undefined ? {
|
|
3941
4265
|
service_fee: calculatedServiceFee
|
|
3942
4266
|
} : {}), {}, {
|
|
@@ -3972,7 +4296,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3972
4296
|
}, {
|
|
3973
4297
|
key: "updateOrderPayment",
|
|
3974
4298
|
value: (function () {
|
|
3975
|
-
var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4299
|
+
var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(paymentIdentity, updates) {
|
|
3976
4300
|
var _result$payment, _result$payment2;
|
|
3977
4301
|
var options,
|
|
3978
4302
|
matchMode,
|
|
@@ -3989,13 +4313,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3989
4313
|
shouldSubmit,
|
|
3990
4314
|
syncResult,
|
|
3991
4315
|
_options$smallTicketD2,
|
|
3992
|
-
|
|
3993
|
-
return _regeneratorRuntime().wrap(function
|
|
3994
|
-
while (1) switch (
|
|
4316
|
+
_args40 = arguments;
|
|
4317
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4318
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3995
4319
|
case 0:
|
|
3996
|
-
options =
|
|
4320
|
+
options = _args40.length > 2 && _args40[2] !== undefined ? _args40[2] : {};
|
|
3997
4321
|
if (this.store.order) {
|
|
3998
|
-
|
|
4322
|
+
_context40.next = 3;
|
|
3999
4323
|
break;
|
|
4000
4324
|
}
|
|
4001
4325
|
throw new Error('order 模块未初始化');
|
|
@@ -4004,15 +4328,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4004
4328
|
previousMatch = resolveOrderPaymentIdentity(this.store.order.getOrderPayments(), paymentIdentity, matchMode);
|
|
4005
4329
|
previousPayment = previousMatch === null || previousMatch === void 0 ? void 0 : previousMatch.payment;
|
|
4006
4330
|
if (!((previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) === 'paid' && !options.applyUpdatesWhenPaid)) {
|
|
4007
|
-
|
|
4331
|
+
_context40.next = 13;
|
|
4008
4332
|
break;
|
|
4009
4333
|
}
|
|
4010
4334
|
currentPayments = this.store.order.getOrderPayments();
|
|
4011
4335
|
if (!(options.submitWhenPaid && options.forceSubmitIfPaid)) {
|
|
4012
|
-
|
|
4336
|
+
_context40.next = 12;
|
|
4013
4337
|
break;
|
|
4014
4338
|
}
|
|
4015
|
-
|
|
4339
|
+
_context40.next = 11;
|
|
4016
4340
|
return this.syncPaymentsToOrder({
|
|
4017
4341
|
payments: currentPayments,
|
|
4018
4342
|
paymentStatus: this.getPaymentStatusForSync(currentPayments),
|
|
@@ -4020,9 +4344,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4020
4344
|
smallTicketDataFlag: (_options$smallTicketD = options.smallTicketDataFlag) !== null && _options$smallTicketD !== void 0 ? _options$smallTicketD : 1
|
|
4021
4345
|
});
|
|
4022
4346
|
case 11:
|
|
4023
|
-
_syncResult =
|
|
4347
|
+
_syncResult = _context40.sent;
|
|
4024
4348
|
case 12:
|
|
4025
|
-
return
|
|
4349
|
+
return _context40.abrupt("return", _objectSpread({
|
|
4026
4350
|
updated: false,
|
|
4027
4351
|
payment: previousPayment,
|
|
4028
4352
|
payments: currentPayments,
|
|
@@ -4031,44 +4355,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4031
4355
|
syncResult: _syncResult
|
|
4032
4356
|
} : {}));
|
|
4033
4357
|
case 13:
|
|
4034
|
-
|
|
4358
|
+
_context40.next = 15;
|
|
4035
4359
|
return this.store.order.updateOrderPayment(paymentIdentity, updates, {
|
|
4036
4360
|
matchBy: matchMode
|
|
4037
4361
|
});
|
|
4038
4362
|
case 15:
|
|
4039
|
-
result =
|
|
4363
|
+
result = _context40.sent;
|
|
4040
4364
|
if (!(options.persistDraft !== false)) {
|
|
4041
|
-
|
|
4365
|
+
_context40.next = 29;
|
|
4042
4366
|
break;
|
|
4043
4367
|
}
|
|
4044
|
-
|
|
4045
|
-
|
|
4368
|
+
_context40.prev = 17;
|
|
4369
|
+
_context40.next = 20;
|
|
4046
4370
|
return this.saveSalesOrderDraft();
|
|
4047
4371
|
case 20:
|
|
4048
|
-
draftResult =
|
|
4049
|
-
|
|
4372
|
+
draftResult = _context40.sent;
|
|
4373
|
+
_context40.next = 29;
|
|
4050
4374
|
break;
|
|
4051
4375
|
case 23:
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
draftError =
|
|
4376
|
+
_context40.prev = 23;
|
|
4377
|
+
_context40.t0 = _context40["catch"](17);
|
|
4378
|
+
draftError = _context40.t0;
|
|
4055
4379
|
this.logError('updateOrderPayment: 保存支付草稿失败', {
|
|
4056
4380
|
paymentIdentity: paymentIdentity,
|
|
4057
|
-
error:
|
|
4381
|
+
error: _context40.t0 instanceof Error ? _context40.t0.message : String(_context40.t0)
|
|
4058
4382
|
});
|
|
4059
4383
|
if (options.submitWhenPaid) {
|
|
4060
|
-
|
|
4384
|
+
_context40.next = 29;
|
|
4061
4385
|
break;
|
|
4062
4386
|
}
|
|
4063
|
-
throw
|
|
4387
|
+
throw _context40.t0;
|
|
4064
4388
|
case 29:
|
|
4065
4389
|
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';
|
|
4066
4390
|
shouldSubmit = Boolean(options.submitWhenPaid && ((_result$payment2 = result.payment) === null || _result$payment2 === void 0 ? void 0 : _result$payment2.status) === 'paid' && (becamePaid || options.forceSubmitIfPaid));
|
|
4067
4391
|
if (!shouldSubmit) {
|
|
4068
|
-
|
|
4392
|
+
_context40.next = 35;
|
|
4069
4393
|
break;
|
|
4070
4394
|
}
|
|
4071
|
-
|
|
4395
|
+
_context40.next = 34;
|
|
4072
4396
|
return this.syncPaymentsToOrder({
|
|
4073
4397
|
payments: result.payments,
|
|
4074
4398
|
paymentStatus: this.getPaymentStatusForSync(result.payments),
|
|
@@ -4076,9 +4400,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4076
4400
|
smallTicketDataFlag: (_options$smallTicketD2 = options.smallTicketDataFlag) !== null && _options$smallTicketD2 !== void 0 ? _options$smallTicketD2 : 1
|
|
4077
4401
|
});
|
|
4078
4402
|
case 34:
|
|
4079
|
-
syncResult =
|
|
4403
|
+
syncResult = _context40.sent;
|
|
4080
4404
|
case 35:
|
|
4081
|
-
return
|
|
4405
|
+
return _context40.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
|
|
4082
4406
|
draftResult: draftResult
|
|
4083
4407
|
} : {}), draftError !== undefined ? {
|
|
4084
4408
|
draftError: draftError
|
|
@@ -4087,9 +4411,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4087
4411
|
} : {}));
|
|
4088
4412
|
case 36:
|
|
4089
4413
|
case "end":
|
|
4090
|
-
return
|
|
4414
|
+
return _context40.stop();
|
|
4091
4415
|
}
|
|
4092
|
-
},
|
|
4416
|
+
}, _callee40, this, [[17, 23]]);
|
|
4093
4417
|
}));
|
|
4094
4418
|
function updateOrderPayment(_x31, _x32) {
|
|
4095
4419
|
return _updateOrderPayment.apply(this, arguments);
|
|
@@ -4113,22 +4437,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4113
4437
|
}, {
|
|
4114
4438
|
key: "updateVoucherOrderPaymentsAsync",
|
|
4115
4439
|
value: function () {
|
|
4116
|
-
var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4117
|
-
return _regeneratorRuntime().wrap(function
|
|
4118
|
-
while (1) switch (
|
|
4440
|
+
var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(payments, options) {
|
|
4441
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4442
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
4119
4443
|
case 0:
|
|
4120
4444
|
if (this.store.order) {
|
|
4121
|
-
|
|
4445
|
+
_context41.next = 2;
|
|
4122
4446
|
break;
|
|
4123
4447
|
}
|
|
4124
4448
|
throw new Error('order 模块未初始化');
|
|
4125
4449
|
case 2:
|
|
4126
|
-
return
|
|
4450
|
+
return _context41.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
|
|
4127
4451
|
case 3:
|
|
4128
4452
|
case "end":
|
|
4129
|
-
return
|
|
4453
|
+
return _context41.stop();
|
|
4130
4454
|
}
|
|
4131
|
-
},
|
|
4455
|
+
}, _callee41, this);
|
|
4132
4456
|
}));
|
|
4133
4457
|
function updateVoucherOrderPaymentsAsync(_x33, _x34) {
|
|
4134
4458
|
return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
|
|
@@ -4143,7 +4467,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4143
4467
|
if (this.store.payment) {
|
|
4144
4468
|
var committed = this.getCommittedWalletAssets();
|
|
4145
4469
|
var state = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4146
|
-
void this.publishWalletAssetsState(state);
|
|
4470
|
+
void this.publishWalletAssetsState(state, 'local');
|
|
4147
4471
|
}
|
|
4148
4472
|
return payments;
|
|
4149
4473
|
}
|
|
@@ -4156,8 +4480,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4156
4480
|
}, {
|
|
4157
4481
|
key: "getWalletProductList",
|
|
4158
4482
|
value: function getWalletProductList() {
|
|
4159
|
-
var _this$store$
|
|
4160
|
-
var tempOrder = (_this$store$
|
|
4483
|
+
var _this$store$order8, _tempOrder$products;
|
|
4484
|
+
var tempOrder = (_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 ? void 0 : _this$store$order8.getTempOrder();
|
|
4161
4485
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
|
|
4162
4486
|
// 过滤出有 product_id的商品来,如果没有代表他是自定义商品,不需要参与 wallet
|
|
4163
4487
|
// debugger
|
|
@@ -4217,8 +4541,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4217
4541
|
}, {
|
|
4218
4542
|
key: "buildWalletInitBusinessData",
|
|
4219
4543
|
value: function buildWalletInitBusinessData(params) {
|
|
4220
|
-
var _this$store$
|
|
4221
|
-
var snapshot = (_this$store$
|
|
4544
|
+
var _this$store$order9, _params$order_wait_pa, _ref42, _tempOrder$is_price_i;
|
|
4545
|
+
var snapshot = (_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 ? void 0 : _this$store$order9.getOrderSnapshot();
|
|
4222
4546
|
var tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
4223
4547
|
var amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
4224
4548
|
if (!tempOrder || !amount) return null;
|
|
@@ -4233,7 +4557,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4233
4557
|
},
|
|
4234
4558
|
products: this.getWalletProductList(),
|
|
4235
4559
|
order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
|
|
4236
|
-
is_price_include_tax: (
|
|
4560
|
+
is_price_include_tax: (_ref42 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref42 !== void 0 ? _ref42 : 1
|
|
4237
4561
|
}, snapshot.identity.orderId ? {
|
|
4238
4562
|
payment_order_id: String(snapshot.identity.orderId)
|
|
4239
4563
|
} : {});
|
|
@@ -4241,20 +4565,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4241
4565
|
}, {
|
|
4242
4566
|
key: "initWalletData",
|
|
4243
4567
|
value: function () {
|
|
4244
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4568
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
|
|
4245
4569
|
var _snapshot$identity;
|
|
4246
4570
|
var snapshot, walletBusinessData, result;
|
|
4247
|
-
return _regeneratorRuntime().wrap(function
|
|
4248
|
-
while (1) switch (
|
|
4571
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4572
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4249
4573
|
case 0:
|
|
4250
4574
|
if (this.store.order) {
|
|
4251
|
-
|
|
4575
|
+
_context42.next = 2;
|
|
4252
4576
|
break;
|
|
4253
4577
|
}
|
|
4254
4578
|
throw new Error('order 模块未初始化');
|
|
4255
4579
|
case 2:
|
|
4256
4580
|
if (this.store.payment) {
|
|
4257
|
-
|
|
4581
|
+
_context42.next = 4;
|
|
4258
4582
|
break;
|
|
4259
4583
|
}
|
|
4260
4584
|
throw new Error('payment 模块未初始化');
|
|
@@ -4262,10 +4586,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4262
4586
|
snapshot = this.store.order.getOrderSnapshot();
|
|
4263
4587
|
walletBusinessData = this.buildWalletInitBusinessData(params);
|
|
4264
4588
|
if (walletBusinessData) {
|
|
4265
|
-
|
|
4589
|
+
_context42.next = 8;
|
|
4266
4590
|
break;
|
|
4267
4591
|
}
|
|
4268
|
-
return
|
|
4592
|
+
return _context42.abrupt("return", {
|
|
4269
4593
|
walletRecommendList: [],
|
|
4270
4594
|
userIdentificationCodes: [],
|
|
4271
4595
|
transformList: [],
|
|
@@ -4273,11 +4597,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4273
4597
|
products: []
|
|
4274
4598
|
});
|
|
4275
4599
|
case 8:
|
|
4276
|
-
|
|
4600
|
+
_context42.next = 10;
|
|
4277
4601
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
4278
4602
|
case 10:
|
|
4279
|
-
result =
|
|
4280
|
-
|
|
4603
|
+
result = _context42.sent;
|
|
4604
|
+
_context42.next = 13;
|
|
4281
4605
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
4282
4606
|
orderId: snapshot === null || snapshot === void 0 || (_snapshot$identity = snapshot.identity) === null || _snapshot$identity === void 0 ? void 0 : _snapshot$identity.orderId,
|
|
4283
4607
|
customerId: walletBusinessData.customer_id,
|
|
@@ -4289,12 +4613,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4289
4613
|
timestamp: Date.now()
|
|
4290
4614
|
});
|
|
4291
4615
|
case 13:
|
|
4292
|
-
return
|
|
4616
|
+
return _context42.abrupt("return", result);
|
|
4293
4617
|
case 14:
|
|
4294
4618
|
case "end":
|
|
4295
|
-
return
|
|
4619
|
+
return _context42.stop();
|
|
4296
4620
|
}
|
|
4297
|
-
},
|
|
4621
|
+
}, _callee42, this);
|
|
4298
4622
|
}));
|
|
4299
4623
|
function initWalletData(_x35) {
|
|
4300
4624
|
return _initWalletData.apply(this, arguments);
|
|
@@ -4304,8 +4628,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4304
4628
|
}, {
|
|
4305
4629
|
key: "getCommittedWalletAssets",
|
|
4306
4630
|
value: function getCommittedWalletAssets() {
|
|
4307
|
-
var _this$store$
|
|
4308
|
-
var payments = ((_this$store$
|
|
4631
|
+
var _this$store$order10, _this$store$order10$g;
|
|
4632
|
+
var payments = ((_this$store$order10 = this.store.order) === null || _this$store$order10 === void 0 || (_this$store$order10$g = _this$store$order10.getOrderPayments) === null || _this$store$order10$g === void 0 ? void 0 : _this$store$order10$g.call(_this$store$order10)) || [];
|
|
4309
4633
|
var committed = payments.filter(function (payment) {
|
|
4310
4634
|
var voucherId = payment === null || payment === void 0 ? void 0 : payment.voucher_id;
|
|
4311
4635
|
if (voucherId === undefined || voucherId === null || voucherId === 0) {
|
|
@@ -4323,9 +4647,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4323
4647
|
var walletPassName = fundRecord.wallet_pass_name;
|
|
4324
4648
|
var title = walletPassName && _typeof(walletPassName) === 'object' ? walletPassName.default || Object.values(walletPassName)[0] : walletPassName;
|
|
4325
4649
|
var code = String((payment === null || payment === void 0 ? void 0 : payment.code) || '').toUpperCase();
|
|
4326
|
-
var tag = ((_Object$entries$find = Object.entries(WALLET_PAYMENT_CODE_BY_TAG).find(function (
|
|
4327
|
-
var
|
|
4328
|
-
paymentCode =
|
|
4650
|
+
var tag = ((_Object$entries$find = Object.entries(WALLET_PAYMENT_CODE_BY_TAG).find(function (_ref43) {
|
|
4651
|
+
var _ref44 = _slicedToArray(_ref43, 2),
|
|
4652
|
+
paymentCode = _ref44[1];
|
|
4329
4653
|
return paymentCode === code;
|
|
4330
4654
|
})) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[0]) || fundRecord.tag;
|
|
4331
4655
|
return {
|
|
@@ -4347,21 +4671,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4347
4671
|
}, {
|
|
4348
4672
|
key: "publishWalletAssetsState",
|
|
4349
4673
|
value: function () {
|
|
4350
|
-
var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4351
|
-
|
|
4352
|
-
|
|
4674
|
+
var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(state) {
|
|
4675
|
+
var changeSource,
|
|
4676
|
+
_args43 = arguments;
|
|
4677
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4678
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4353
4679
|
case 0:
|
|
4354
|
-
|
|
4680
|
+
changeSource = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : 'derived';
|
|
4681
|
+
_context43.next = 3;
|
|
4355
4682
|
return this.effectsEmit(BaseSalesHookNames.onWalletAssetsStateChanged, {
|
|
4356
|
-
state: state
|
|
4683
|
+
state: state,
|
|
4684
|
+
changeSource: changeSource
|
|
4357
4685
|
});
|
|
4358
|
-
case 2:
|
|
4359
|
-
return _context41.abrupt("return", state);
|
|
4360
4686
|
case 3:
|
|
4687
|
+
return _context43.abrupt("return", state);
|
|
4688
|
+
case 4:
|
|
4361
4689
|
case "end":
|
|
4362
|
-
return
|
|
4690
|
+
return _context43.stop();
|
|
4363
4691
|
}
|
|
4364
|
-
},
|
|
4692
|
+
}, _callee43, this);
|
|
4365
4693
|
}));
|
|
4366
4694
|
function publishWalletAssetsState(_x36) {
|
|
4367
4695
|
return _publishWalletAssetsState.apply(this, arguments);
|
|
@@ -4371,26 +4699,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4371
4699
|
}, {
|
|
4372
4700
|
key: "syncSelectedWalletAssets",
|
|
4373
4701
|
value: function () {
|
|
4374
|
-
var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4702
|
+
var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(state) {
|
|
4375
4703
|
var paymentMethods, methodByCode, preparePayments, selectedAssetById, voucherPayments, payments;
|
|
4376
|
-
return _regeneratorRuntime().wrap(function
|
|
4377
|
-
while (1) switch (
|
|
4704
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4705
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4378
4706
|
case 0:
|
|
4379
4707
|
if (!(!this.store.order || !this.store.payment)) {
|
|
4380
|
-
|
|
4708
|
+
_context44.next = 2;
|
|
4381
4709
|
break;
|
|
4382
4710
|
}
|
|
4383
4711
|
throw new Error('订单或支付模块未初始化');
|
|
4384
4712
|
case 2:
|
|
4385
4713
|
paymentMethods = this.getPaymentMethods();
|
|
4386
4714
|
if (!(!paymentMethods.length && state.selectedItems.length)) {
|
|
4387
|
-
|
|
4715
|
+
_context44.next = 7;
|
|
4388
4716
|
break;
|
|
4389
4717
|
}
|
|
4390
|
-
|
|
4718
|
+
_context44.next = 6;
|
|
4391
4719
|
return this.getPaymentMethodsAsync();
|
|
4392
4720
|
case 6:
|
|
4393
|
-
paymentMethods =
|
|
4721
|
+
paymentMethods = _context44.sent;
|
|
4394
4722
|
case 7:
|
|
4395
4723
|
methodByCode = new Map(paymentMethods.map(function (method) {
|
|
4396
4724
|
return [String(method.code || '').toUpperCase(), method];
|
|
@@ -4432,17 +4760,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4432
4760
|
payments = this.updateVoucherOrderPayments(voucherPayments, {
|
|
4433
4761
|
status: 'payment_pending'
|
|
4434
4762
|
});
|
|
4435
|
-
|
|
4763
|
+
_context44.next = 14;
|
|
4436
4764
|
return this.store.order.recalculateSummary({
|
|
4437
4765
|
createIfMissing: true
|
|
4438
4766
|
});
|
|
4439
4767
|
case 14:
|
|
4440
|
-
return
|
|
4768
|
+
return _context44.abrupt("return", payments);
|
|
4441
4769
|
case 15:
|
|
4442
4770
|
case "end":
|
|
4443
|
-
return
|
|
4771
|
+
return _context44.stop();
|
|
4444
4772
|
}
|
|
4445
|
-
},
|
|
4773
|
+
}, _callee44, this);
|
|
4446
4774
|
}));
|
|
4447
4775
|
function syncSelectedWalletAssets(_x37) {
|
|
4448
4776
|
return _syncSelectedWalletAssets.apply(this, arguments);
|
|
@@ -4478,27 +4806,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4478
4806
|
}, {
|
|
4479
4807
|
key: "importWalletAssetsSnapshot",
|
|
4480
4808
|
value: (function () {
|
|
4481
|
-
var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4809
|
+
var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(snapshot) {
|
|
4482
4810
|
var state;
|
|
4483
|
-
return _regeneratorRuntime().wrap(function
|
|
4484
|
-
while (1) switch (
|
|
4811
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
4812
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4485
4813
|
case 0:
|
|
4486
4814
|
if (this.store.payment) {
|
|
4487
|
-
|
|
4815
|
+
_context45.next = 2;
|
|
4488
4816
|
break;
|
|
4489
4817
|
}
|
|
4490
4818
|
throw new Error('payment 模块未初始化');
|
|
4491
4819
|
case 2:
|
|
4492
4820
|
state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
|
|
4493
|
-
|
|
4821
|
+
_context45.next = 5;
|
|
4494
4822
|
return this.syncSelectedWalletAssets(state);
|
|
4495
4823
|
case 5:
|
|
4496
|
-
return
|
|
4824
|
+
return _context45.abrupt("return", this.publishWalletAssetsState(state));
|
|
4497
4825
|
case 6:
|
|
4498
4826
|
case "end":
|
|
4499
|
-
return
|
|
4827
|
+
return _context45.stop();
|
|
4500
4828
|
}
|
|
4501
|
-
},
|
|
4829
|
+
}, _callee45, this);
|
|
4502
4830
|
}));
|
|
4503
4831
|
function importWalletAssetsSnapshot(_x38) {
|
|
4504
4832
|
return _importWalletAssetsSnapshot.apply(this, arguments);
|
|
@@ -4512,20 +4840,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4512
4840
|
}, {
|
|
4513
4841
|
key: "refreshWalletAssets",
|
|
4514
4842
|
value: (function () {
|
|
4515
|
-
var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4843
|
+
var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
4516
4844
|
var _previousState$custom, _businessData$custome;
|
|
4517
4845
|
var refreshSequence, wallet, businessData, emptyState, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, committed;
|
|
4518
|
-
return _regeneratorRuntime().wrap(function
|
|
4519
|
-
while (1) switch (
|
|
4846
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
4847
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4520
4848
|
case 0:
|
|
4521
4849
|
if (this.store.order) {
|
|
4522
|
-
|
|
4850
|
+
_context46.next = 2;
|
|
4523
4851
|
break;
|
|
4524
4852
|
}
|
|
4525
4853
|
throw new Error('order 模块未初始化');
|
|
4526
4854
|
case 2:
|
|
4527
4855
|
if (this.store.payment) {
|
|
4528
|
-
|
|
4856
|
+
_context46.next = 4;
|
|
4529
4857
|
break;
|
|
4530
4858
|
}
|
|
4531
4859
|
throw new Error('payment 模块未初始化');
|
|
@@ -4534,7 +4862,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4534
4862
|
wallet = this.store.payment.wallet;
|
|
4535
4863
|
businessData = this.buildWalletInitBusinessData(params);
|
|
4536
4864
|
if (businessData) {
|
|
4537
|
-
|
|
4865
|
+
_context46.next = 12;
|
|
4538
4866
|
break;
|
|
4539
4867
|
}
|
|
4540
4868
|
wallet.clearAllCache();
|
|
@@ -4542,51 +4870,51 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4542
4870
|
this.updateVoucherOrderPayments([], {
|
|
4543
4871
|
status: 'payment_pending'
|
|
4544
4872
|
});
|
|
4545
|
-
return
|
|
4873
|
+
return _context46.abrupt("return", this.publishWalletAssetsState(emptyState));
|
|
4546
4874
|
case 12:
|
|
4547
4875
|
previousState = wallet.getWalletAssetsState();
|
|
4548
4876
|
hasPreviousWalletContext = previousState.status !== 'idle' || previousState.items.length > 0 || previousState.selectedIds.length > 0 || previousState.customerId !== undefined;
|
|
4549
4877
|
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 : '');
|
|
4550
4878
|
if (!customerChanged) {
|
|
4551
|
-
|
|
4879
|
+
_context46.next = 20;
|
|
4552
4880
|
break;
|
|
4553
4881
|
}
|
|
4554
4882
|
clearedState = wallet.clearWalletAssetSelection();
|
|
4555
4883
|
this.updateVoucherOrderPayments([], {
|
|
4556
4884
|
status: 'payment_pending'
|
|
4557
4885
|
});
|
|
4558
|
-
|
|
4886
|
+
_context46.next = 20;
|
|
4559
4887
|
return this.publishWalletAssetsState(clearedState);
|
|
4560
4888
|
case 20:
|
|
4561
4889
|
refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
|
|
4562
4890
|
preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged
|
|
4563
4891
|
});
|
|
4564
|
-
|
|
4892
|
+
_context46.next = 23;
|
|
4565
4893
|
return this.publishWalletAssetsState(wallet.getWalletAssetsState());
|
|
4566
4894
|
case 23:
|
|
4567
|
-
|
|
4895
|
+
_context46.next = 25;
|
|
4568
4896
|
return refreshTask;
|
|
4569
4897
|
case 25:
|
|
4570
|
-
state =
|
|
4898
|
+
state = _context46.sent;
|
|
4571
4899
|
if (!(refreshSequence !== this.walletAssetsRefreshSequence)) {
|
|
4572
|
-
|
|
4900
|
+
_context46.next = 28;
|
|
4573
4901
|
break;
|
|
4574
4902
|
}
|
|
4575
|
-
return
|
|
4903
|
+
return _context46.abrupt("return", wallet.getWalletAssetsState());
|
|
4576
4904
|
case 28:
|
|
4577
4905
|
if (state.status !== 'error') {
|
|
4578
4906
|
committed = this.getCommittedWalletAssets();
|
|
4579
4907
|
state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4580
4908
|
}
|
|
4581
|
-
|
|
4909
|
+
_context46.next = 31;
|
|
4582
4910
|
return this.syncSelectedWalletAssets(state);
|
|
4583
4911
|
case 31:
|
|
4584
|
-
return
|
|
4912
|
+
return _context46.abrupt("return", this.publishWalletAssetsState(state));
|
|
4585
4913
|
case 32:
|
|
4586
4914
|
case "end":
|
|
4587
|
-
return
|
|
4915
|
+
return _context46.stop();
|
|
4588
4916
|
}
|
|
4589
|
-
},
|
|
4917
|
+
}, _callee46, this);
|
|
4590
4918
|
}));
|
|
4591
4919
|
function refreshWalletAssets(_x39) {
|
|
4592
4920
|
return _refreshWalletAssets.apply(this, arguments);
|
|
@@ -4596,13 +4924,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4596
4924
|
}, {
|
|
4597
4925
|
key: "selectWalletAsset",
|
|
4598
4926
|
value: (function () {
|
|
4599
|
-
var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4927
|
+
var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
4600
4928
|
var state;
|
|
4601
|
-
return _regeneratorRuntime().wrap(function
|
|
4602
|
-
while (1) switch (
|
|
4929
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4930
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4603
4931
|
case 0:
|
|
4604
4932
|
if (this.store.payment) {
|
|
4605
|
-
|
|
4933
|
+
_context47.next = 2;
|
|
4606
4934
|
break;
|
|
4607
4935
|
}
|
|
4608
4936
|
throw new Error('payment 模块未初始化');
|
|
@@ -4611,15 +4939,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4611
4939
|
selected: params.selected,
|
|
4612
4940
|
source: params.source
|
|
4613
4941
|
});
|
|
4614
|
-
|
|
4942
|
+
_context47.next = 5;
|
|
4615
4943
|
return this.syncSelectedWalletAssets(state);
|
|
4616
4944
|
case 5:
|
|
4617
|
-
return
|
|
4945
|
+
return _context47.abrupt("return", this.publishWalletAssetsState(state, 'local'));
|
|
4618
4946
|
case 6:
|
|
4619
4947
|
case "end":
|
|
4620
|
-
return
|
|
4948
|
+
return _context47.stop();
|
|
4621
4949
|
}
|
|
4622
|
-
},
|
|
4950
|
+
}, _callee47, this);
|
|
4623
4951
|
}));
|
|
4624
4952
|
function selectWalletAsset(_x40) {
|
|
4625
4953
|
return _selectWalletAsset.apply(this, arguments);
|
|
@@ -4629,27 +4957,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4629
4957
|
}, {
|
|
4630
4958
|
key: "updateWalletAssetAmount",
|
|
4631
4959
|
value: (function () {
|
|
4632
|
-
var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4960
|
+
var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
|
|
4633
4961
|
var state;
|
|
4634
|
-
return _regeneratorRuntime().wrap(function
|
|
4635
|
-
while (1) switch (
|
|
4962
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
4963
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4636
4964
|
case 0:
|
|
4637
4965
|
if (this.store.payment) {
|
|
4638
|
-
|
|
4966
|
+
_context48.next = 2;
|
|
4639
4967
|
break;
|
|
4640
4968
|
}
|
|
4641
4969
|
throw new Error('payment 模块未初始化');
|
|
4642
4970
|
case 2:
|
|
4643
4971
|
state = this.store.payment.wallet.updateWalletAssetAmount(params.assetId, params.amount);
|
|
4644
|
-
|
|
4972
|
+
_context48.next = 5;
|
|
4645
4973
|
return this.syncSelectedWalletAssets(state);
|
|
4646
4974
|
case 5:
|
|
4647
|
-
return
|
|
4975
|
+
return _context48.abrupt("return", this.publishWalletAssetsState(state, 'local'));
|
|
4648
4976
|
case 6:
|
|
4649
4977
|
case "end":
|
|
4650
|
-
return
|
|
4978
|
+
return _context48.stop();
|
|
4651
4979
|
}
|
|
4652
|
-
},
|
|
4980
|
+
}, _callee48, this);
|
|
4653
4981
|
}));
|
|
4654
4982
|
function updateWalletAssetAmount(_x41) {
|
|
4655
4983
|
return _updateWalletAssetAmount.apply(this, arguments);
|
|
@@ -4659,13 +4987,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4659
4987
|
}, {
|
|
4660
4988
|
key: "scanWalletAsset",
|
|
4661
4989
|
value: (function () {
|
|
4662
|
-
var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4990
|
+
var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(code) {
|
|
4663
4991
|
var wallet, businessData, result;
|
|
4664
|
-
return _regeneratorRuntime().wrap(function
|
|
4665
|
-
while (1) switch (
|
|
4992
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4993
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
4666
4994
|
case 0:
|
|
4667
4995
|
if (this.store.payment) {
|
|
4668
|
-
|
|
4996
|
+
_context49.next = 2;
|
|
4669
4997
|
break;
|
|
4670
4998
|
}
|
|
4671
4999
|
throw new Error('payment 模块未初始化');
|
|
@@ -4675,26 +5003,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4675
5003
|
if (businessData) {
|
|
4676
5004
|
wallet.generateWalletParams(businessData);
|
|
4677
5005
|
}
|
|
4678
|
-
|
|
5006
|
+
_context49.next = 7;
|
|
4679
5007
|
return wallet.scanWalletAssetAsync(code);
|
|
4680
5008
|
case 7:
|
|
4681
|
-
result =
|
|
5009
|
+
result = _context49.sent;
|
|
4682
5010
|
if (!(result.type === 'normalCode')) {
|
|
4683
|
-
|
|
5011
|
+
_context49.next = 13;
|
|
4684
5012
|
break;
|
|
4685
5013
|
}
|
|
4686
|
-
|
|
5014
|
+
_context49.next = 11;
|
|
4687
5015
|
return this.syncSelectedWalletAssets(result.state);
|
|
4688
5016
|
case 11:
|
|
4689
|
-
|
|
4690
|
-
return this.publishWalletAssetsState(result.state);
|
|
5017
|
+
_context49.next = 13;
|
|
5018
|
+
return this.publishWalletAssetsState(result.state, 'local');
|
|
4691
5019
|
case 13:
|
|
4692
|
-
return
|
|
5020
|
+
return _context49.abrupt("return", result);
|
|
4693
5021
|
case 14:
|
|
4694
5022
|
case "end":
|
|
4695
|
-
return
|
|
5023
|
+
return _context49.stop();
|
|
4696
5024
|
}
|
|
4697
|
-
},
|
|
5025
|
+
}, _callee49, this);
|
|
4698
5026
|
}));
|
|
4699
5027
|
function scanWalletAsset(_x42) {
|
|
4700
5028
|
return _scanWalletAsset.apply(this, arguments);
|
|
@@ -4704,27 +5032,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4704
5032
|
}, {
|
|
4705
5033
|
key: "clearWalletAssetSelection",
|
|
4706
5034
|
value: (function () {
|
|
4707
|
-
var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5035
|
+
var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50() {
|
|
4708
5036
|
var state;
|
|
4709
|
-
return _regeneratorRuntime().wrap(function
|
|
4710
|
-
while (1) switch (
|
|
5037
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
5038
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
4711
5039
|
case 0:
|
|
4712
5040
|
if (this.store.payment) {
|
|
4713
|
-
|
|
5041
|
+
_context50.next = 2;
|
|
4714
5042
|
break;
|
|
4715
5043
|
}
|
|
4716
5044
|
throw new Error('payment 模块未初始化');
|
|
4717
5045
|
case 2:
|
|
4718
5046
|
state = this.store.payment.wallet.clearWalletAssetSelection();
|
|
4719
|
-
|
|
5047
|
+
_context50.next = 5;
|
|
4720
5048
|
return this.syncSelectedWalletAssets(state);
|
|
4721
5049
|
case 5:
|
|
4722
|
-
return
|
|
5050
|
+
return _context50.abrupt("return", this.publishWalletAssetsState(state, 'local'));
|
|
4723
5051
|
case 6:
|
|
4724
5052
|
case "end":
|
|
4725
|
-
return
|
|
5053
|
+
return _context50.stop();
|
|
4726
5054
|
}
|
|
4727
|
-
},
|
|
5055
|
+
}, _callee50, this);
|
|
4728
5056
|
}));
|
|
4729
5057
|
function clearWalletAssetSelection() {
|
|
4730
5058
|
return _clearWalletAssetSelection.apply(this, arguments);
|
|
@@ -4754,35 +5082,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4754
5082
|
}, {
|
|
4755
5083
|
key: "getPaymentMethodsAsync",
|
|
4756
5084
|
value: (function () {
|
|
4757
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5085
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51() {
|
|
4758
5086
|
var response, paymentMethods;
|
|
4759
|
-
return _regeneratorRuntime().wrap(function
|
|
4760
|
-
while (1) switch (
|
|
5087
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
5088
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
4761
5089
|
case 0:
|
|
4762
|
-
|
|
4763
|
-
|
|
5090
|
+
_context51.prev = 0;
|
|
5091
|
+
_context51.next = 3;
|
|
4764
5092
|
return this.request.get('/pay/custom-payment/all', {
|
|
4765
5093
|
filterPaymentMethods: true
|
|
4766
5094
|
}, {
|
|
4767
5095
|
osServer: true
|
|
4768
5096
|
});
|
|
4769
5097
|
case 3:
|
|
4770
|
-
response =
|
|
5098
|
+
response = _context51.sent;
|
|
4771
5099
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
4772
5100
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
4773
|
-
return
|
|
5101
|
+
return _context51.abrupt("return", this.getPaymentMethods());
|
|
4774
5102
|
case 9:
|
|
4775
|
-
|
|
4776
|
-
|
|
5103
|
+
_context51.prev = 9;
|
|
5104
|
+
_context51.t0 = _context51["catch"](0);
|
|
4777
5105
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
4778
|
-
error:
|
|
5106
|
+
error: _context51.t0 instanceof Error ? _context51.t0.message : String(_context51.t0)
|
|
4779
5107
|
});
|
|
4780
|
-
return
|
|
5108
|
+
return _context51.abrupt("return", this.getPaymentMethods());
|
|
4781
5109
|
case 13:
|
|
4782
5110
|
case "end":
|
|
4783
|
-
return
|
|
5111
|
+
return _context51.stop();
|
|
4784
5112
|
}
|
|
4785
|
-
},
|
|
5113
|
+
}, _callee51, this, [[0, 9]]);
|
|
4786
5114
|
}));
|
|
4787
5115
|
function getPaymentMethodsAsync() {
|
|
4788
5116
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -4807,8 +5135,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4807
5135
|
}, {
|
|
4808
5136
|
key: "getPendingWalletPaymentAmount",
|
|
4809
5137
|
value: function getPendingWalletPaymentAmount() {
|
|
4810
|
-
var _this$store$
|
|
4811
|
-
var payments = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ((_this$store$
|
|
5138
|
+
var _this$store$order11, _this$store$order11$g;
|
|
5139
|
+
var payments = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ((_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$g = _this$store$order11.getOrderPayments) === null || _this$store$order11$g === void 0 ? void 0 : _this$store$order11$g.call(_this$store$order11)) || [];
|
|
4812
5140
|
return payments.reduce(function (total, payment) {
|
|
4813
5141
|
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) {
|
|
4814
5142
|
return total;
|
|
@@ -4825,14 +5153,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4825
5153
|
}, {
|
|
4826
5154
|
key: "getCashPaymentConfig",
|
|
4827
5155
|
value: (function () {
|
|
4828
|
-
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4829
|
-
var _this$store$
|
|
5156
|
+
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52() {
|
|
5157
|
+
var _this$store$order12, _this$store$order12$g, _this$store$order13, _this$store$order13$g, _this$otherParams34;
|
|
4830
5158
|
var paymentMethods, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, currency, recommendedAmounts;
|
|
4831
|
-
return _regeneratorRuntime().wrap(function
|
|
4832
|
-
while (1) switch (
|
|
5159
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
5160
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
4833
5161
|
case 0:
|
|
4834
5162
|
if (this.store.payment) {
|
|
4835
|
-
|
|
5163
|
+
_context52.next = 2;
|
|
4836
5164
|
break;
|
|
4837
5165
|
}
|
|
4838
5166
|
throw new Error('payment 模块未初始化');
|
|
@@ -4840,21 +5168,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4840
5168
|
paymentMethods = this.getPaymentMethods();
|
|
4841
5169
|
paymentMethod = this.findCashPaymentMethod(paymentMethods);
|
|
4842
5170
|
if (paymentMethod) {
|
|
4843
|
-
|
|
5171
|
+
_context52.next = 9;
|
|
4844
5172
|
break;
|
|
4845
5173
|
}
|
|
4846
|
-
|
|
5174
|
+
_context52.next = 7;
|
|
4847
5175
|
return this.getPaymentMethodsAsync();
|
|
4848
5176
|
case 7:
|
|
4849
|
-
paymentMethods =
|
|
5177
|
+
paymentMethods = _context52.sent;
|
|
4850
5178
|
paymentMethod = this.findCashPaymentMethod(paymentMethods);
|
|
4851
5179
|
case 9:
|
|
4852
|
-
amountSnapshot = (_this$store$
|
|
5180
|
+
amountSnapshot = (_this$store$order12 = this.store.order) === null || _this$store$order12 === void 0 || (_this$store$order12$g = _this$store$order12.getOrderAmountSnapshot) === null || _this$store$order12$g === void 0 ? void 0 : _this$store$order12$g.call(_this$store$order12);
|
|
4853
5181
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
4854
5182
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
|
|
4855
|
-
currency = ((_this$store$
|
|
5183
|
+
currency = ((_this$store$order13 = this.store.order) === null || _this$store$order13 === void 0 || (_this$store$order13$g = _this$store$order13.getTempOrder) === null || _this$store$order13$g === void 0 || (_this$store$order13$g = _this$store$order13$g.call(_this$store$order13)) === null || _this$store$order13$g === void 0 ? void 0 : _this$store$order13$g.currency_code) || ((_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.currency) || 'USD';
|
|
4856
5184
|
recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
|
|
4857
|
-
return
|
|
5185
|
+
return _context52.abrupt("return", {
|
|
4858
5186
|
available: Boolean(paymentMethod && amountDue > 0),
|
|
4859
5187
|
paymentMethod: paymentMethod,
|
|
4860
5188
|
amountDue: amountDue,
|
|
@@ -4862,9 +5190,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4862
5190
|
});
|
|
4863
5191
|
case 15:
|
|
4864
5192
|
case "end":
|
|
4865
|
-
return
|
|
5193
|
+
return _context52.stop();
|
|
4866
5194
|
}
|
|
4867
|
-
},
|
|
5195
|
+
}, _callee52, this);
|
|
4868
5196
|
}));
|
|
4869
5197
|
function getCashPaymentConfig() {
|
|
4870
5198
|
return _getCashPaymentConfig.apply(this, arguments);
|
|
@@ -4881,14 +5209,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4881
5209
|
}, {
|
|
4882
5210
|
key: "confirmWalletPayment",
|
|
4883
5211
|
value: (function () {
|
|
4884
|
-
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4885
|
-
var _this$store$order$get3, _this$store$
|
|
5212
|
+
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53() {
|
|
5213
|
+
var _this$store$order$get3, _this$store$order14, _this$store$order$get4, _this$store$order$get5, _this$store$order15;
|
|
4886
5214
|
var beforePayments, pendingWalletAmount, amountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
|
|
4887
|
-
return _regeneratorRuntime().wrap(function
|
|
4888
|
-
while (1) switch (
|
|
5215
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
5216
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
4889
5217
|
case 0:
|
|
4890
5218
|
if (this.store.order) {
|
|
4891
|
-
|
|
5219
|
+
_context53.next = 2;
|
|
4892
5220
|
break;
|
|
4893
5221
|
}
|
|
4894
5222
|
throw new Error('order 模块未初始化');
|
|
@@ -4896,82 +5224,82 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4896
5224
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
4897
5225
|
pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
|
|
4898
5226
|
if (!pendingWalletAmount.lte(0)) {
|
|
4899
|
-
|
|
5227
|
+
_context53.next = 6;
|
|
4900
5228
|
break;
|
|
4901
5229
|
}
|
|
4902
5230
|
throw new Error('当前订单没有待确认的 Wallet 支付');
|
|
4903
5231
|
case 6:
|
|
4904
|
-
amountSnapshot = (_this$store$order$get3 = (_this$store$
|
|
5232
|
+
amountSnapshot = (_this$store$order$get3 = (_this$store$order14 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order14);
|
|
4905
5233
|
effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
4906
5234
|
if (!effectiveAmountDue.gt(0.01)) {
|
|
4907
|
-
|
|
5235
|
+
_context53.next = 10;
|
|
4908
5236
|
break;
|
|
4909
5237
|
}
|
|
4910
5238
|
throw new Error('Wallet 支付尚未覆盖全部待支付金额');
|
|
4911
5239
|
case 10:
|
|
4912
5240
|
beforePaymentStatus = (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.payment_status;
|
|
4913
|
-
|
|
4914
|
-
|
|
5241
|
+
_context53.prev = 11;
|
|
5242
|
+
_context53.next = 14;
|
|
4915
5243
|
return this.submitSalesOrder({
|
|
4916
5244
|
smallTicketDataFlag: 1,
|
|
4917
5245
|
confirmPendingVoucherPayments: true
|
|
4918
5246
|
});
|
|
4919
5247
|
case 14:
|
|
4920
|
-
submitResult =
|
|
5248
|
+
submitResult = _context53.sent;
|
|
4921
5249
|
if (!isRejectedSalesSubmitResult(submitResult)) {
|
|
4922
|
-
|
|
5250
|
+
_context53.next = 17;
|
|
4923
5251
|
break;
|
|
4924
5252
|
}
|
|
4925
5253
|
throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
|
|
4926
5254
|
case 17:
|
|
4927
|
-
|
|
5255
|
+
_context53.next = 27;
|
|
4928
5256
|
break;
|
|
4929
5257
|
case 19:
|
|
4930
|
-
|
|
4931
|
-
|
|
5258
|
+
_context53.prev = 19;
|
|
5259
|
+
_context53.t0 = _context53["catch"](11);
|
|
4932
5260
|
this.store.order.setOrderPayments(beforePayments);
|
|
4933
5261
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
4934
5262
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
4935
5263
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4936
5264
|
this.store.order.persistTempOrder();
|
|
4937
5265
|
}
|
|
4938
|
-
|
|
5266
|
+
_context53.next = 26;
|
|
4939
5267
|
return this.store.order.recalculateSummary({
|
|
4940
5268
|
createIfMissing: true
|
|
4941
5269
|
});
|
|
4942
5270
|
case 26:
|
|
4943
|
-
throw
|
|
5271
|
+
throw _context53.t0;
|
|
4944
5272
|
case 27:
|
|
4945
5273
|
if (!this.store.payment) {
|
|
4946
|
-
|
|
5274
|
+
_context53.next = 38;
|
|
4947
5275
|
break;
|
|
4948
5276
|
}
|
|
4949
|
-
|
|
5277
|
+
_context53.prev = 28;
|
|
4950
5278
|
committed = this.getCommittedWalletAssets();
|
|
4951
5279
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4952
|
-
|
|
4953
|
-
return this.publishWalletAssetsState(walletState);
|
|
5280
|
+
_context53.next = 33;
|
|
5281
|
+
return this.publishWalletAssetsState(walletState, 'local');
|
|
4954
5282
|
case 33:
|
|
4955
|
-
|
|
5283
|
+
_context53.next = 38;
|
|
4956
5284
|
break;
|
|
4957
5285
|
case 35:
|
|
4958
|
-
|
|
4959
|
-
|
|
5286
|
+
_context53.prev = 35;
|
|
5287
|
+
_context53.t1 = _context53["catch"](28);
|
|
4960
5288
|
this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
|
|
4961
|
-
error:
|
|
5289
|
+
error: _context53.t1 instanceof Error ? _context53.t1.message : String(_context53.t1)
|
|
4962
5290
|
});
|
|
4963
5291
|
case 38:
|
|
4964
|
-
latestAmountSnapshot = (_this$store$order$get5 = (_this$store$
|
|
4965
|
-
return
|
|
5292
|
+
latestAmountSnapshot = (_this$store$order$get5 = (_this$store$order15 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.call(_this$store$order15);
|
|
5293
|
+
return _context53.abrupt("return", {
|
|
4966
5294
|
submitResult: submitResult,
|
|
4967
5295
|
payments: this.store.order.getOrderPayments(),
|
|
4968
5296
|
isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
|
|
4969
5297
|
});
|
|
4970
5298
|
case 40:
|
|
4971
5299
|
case "end":
|
|
4972
|
-
return
|
|
5300
|
+
return _context53.stop();
|
|
4973
5301
|
}
|
|
4974
|
-
},
|
|
5302
|
+
}, _callee53, this, [[11, 19], [28, 35]]);
|
|
4975
5303
|
}));
|
|
4976
5304
|
function confirmWalletPayment() {
|
|
4977
5305
|
return _confirmWalletPayment.apply(this, arguments);
|
|
@@ -4986,38 +5314,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4986
5314
|
}, {
|
|
4987
5315
|
key: "payCash",
|
|
4988
5316
|
value: (function () {
|
|
4989
|
-
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4990
|
-
var _this$store$order$get6, _params$actualPaidAmo, _this$
|
|
5317
|
+
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(params) {
|
|
5318
|
+
var _this$store$order$get6, _params$actualPaidAmo, _this$otherParams35, _this$window, _this$window$postMess;
|
|
4991
5319
|
var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
4992
|
-
return _regeneratorRuntime().wrap(function
|
|
4993
|
-
while (1) switch (
|
|
5320
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5321
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
4994
5322
|
case 0:
|
|
4995
5323
|
if (this.store.order) {
|
|
4996
|
-
|
|
5324
|
+
_context54.next = 2;
|
|
4997
5325
|
break;
|
|
4998
5326
|
}
|
|
4999
5327
|
throw new Error('order 模块未初始化');
|
|
5000
5328
|
case 2:
|
|
5001
5329
|
amount = Number(params.amount || 0);
|
|
5002
5330
|
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
5003
|
-
|
|
5331
|
+
_context54.next = 5;
|
|
5004
5332
|
break;
|
|
5005
5333
|
}
|
|
5006
5334
|
throw new Error('现金支付金额必须大于 0');
|
|
5007
5335
|
case 5:
|
|
5008
|
-
|
|
5336
|
+
_context54.next = 7;
|
|
5009
5337
|
return this.getCashPaymentConfig();
|
|
5010
5338
|
case 7:
|
|
5011
|
-
config =
|
|
5339
|
+
config = _context54.sent;
|
|
5012
5340
|
paymentMethod = config.paymentMethod;
|
|
5013
5341
|
if (paymentMethod) {
|
|
5014
|
-
|
|
5342
|
+
_context54.next = 11;
|
|
5015
5343
|
break;
|
|
5016
5344
|
}
|
|
5017
5345
|
throw new Error('未找到可用的 CASHMANUAL 支付方式');
|
|
5018
5346
|
case 11:
|
|
5019
5347
|
if (!(config.amountDue <= 0)) {
|
|
5020
|
-
|
|
5348
|
+
_context54.next = 13;
|
|
5021
5349
|
break;
|
|
5022
5350
|
}
|
|
5023
5351
|
throw new Error('当前订单没有待支付金额');
|
|
@@ -5025,7 +5353,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5025
5353
|
roundingAmount = Number(params.roundingAmount || 0);
|
|
5026
5354
|
effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
|
|
5027
5355
|
if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
|
|
5028
|
-
|
|
5356
|
+
_context54.next = 17;
|
|
5029
5357
|
break;
|
|
5030
5358
|
}
|
|
5031
5359
|
throw new Error('现金支付金额超过当前待支付金额');
|
|
@@ -5036,9 +5364,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5036
5364
|
paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
5037
5365
|
actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
|
|
5038
5366
|
changeAmount = Number(params.changeAmount || 0);
|
|
5039
|
-
shopWalletPassId = (_this$
|
|
5367
|
+
shopWalletPassId = (_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.shop_wallet_pass_id;
|
|
5040
5368
|
if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
|
|
5041
|
-
|
|
5369
|
+
_context54.next = 26;
|
|
5042
5370
|
break;
|
|
5043
5371
|
}
|
|
5044
5372
|
throw new Error('顾客实收现金不能小于支付金额');
|
|
@@ -5073,8 +5401,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5073
5401
|
var _item$metadata2;
|
|
5074
5402
|
return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
|
|
5075
5403
|
});
|
|
5076
|
-
|
|
5077
|
-
|
|
5404
|
+
_context54.prev = 29;
|
|
5405
|
+
_context54.next = 32;
|
|
5078
5406
|
return this.syncPaymentsToOrder({
|
|
5079
5407
|
payments: payments,
|
|
5080
5408
|
submitWhenPaid: true,
|
|
@@ -5082,48 +5410,48 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5082
5410
|
confirmPendingVoucherPayments: true
|
|
5083
5411
|
});
|
|
5084
5412
|
case 32:
|
|
5085
|
-
syncResult =
|
|
5413
|
+
syncResult = _context54.sent;
|
|
5086
5414
|
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
5087
|
-
|
|
5415
|
+
_context54.next = 35;
|
|
5088
5416
|
break;
|
|
5089
5417
|
}
|
|
5090
5418
|
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
5091
5419
|
case 35:
|
|
5092
5420
|
if (!this.store.payment) {
|
|
5093
|
-
|
|
5421
|
+
_context54.next = 40;
|
|
5094
5422
|
break;
|
|
5095
5423
|
}
|
|
5096
5424
|
committed = this.getCommittedWalletAssets();
|
|
5097
5425
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
5098
|
-
|
|
5099
|
-
return this.publishWalletAssetsState(walletState);
|
|
5426
|
+
_context54.next = 40;
|
|
5427
|
+
return this.publishWalletAssetsState(walletState, 'local');
|
|
5100
5428
|
case 40:
|
|
5101
|
-
return
|
|
5429
|
+
return _context54.abrupt("return", {
|
|
5102
5430
|
payment: payment || {},
|
|
5103
5431
|
payments: this.store.order.getOrderPayments(),
|
|
5104
5432
|
syncResult: syncResult,
|
|
5105
5433
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
5106
5434
|
});
|
|
5107
5435
|
case 43:
|
|
5108
|
-
|
|
5109
|
-
|
|
5436
|
+
_context54.prev = 43;
|
|
5437
|
+
_context54.t0 = _context54["catch"](29);
|
|
5110
5438
|
this.store.order.setOrderPayments(beforePayments);
|
|
5111
5439
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
5112
5440
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
5113
5441
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
5114
5442
|
this.store.order.persistTempOrder();
|
|
5115
5443
|
}
|
|
5116
|
-
|
|
5444
|
+
_context54.next = 50;
|
|
5117
5445
|
return this.store.order.recalculateSummary({
|
|
5118
5446
|
createIfMissing: true
|
|
5119
5447
|
});
|
|
5120
5448
|
case 50:
|
|
5121
|
-
throw
|
|
5449
|
+
throw _context54.t0;
|
|
5122
5450
|
case 51:
|
|
5123
5451
|
case "end":
|
|
5124
|
-
return
|
|
5452
|
+
return _context54.stop();
|
|
5125
5453
|
}
|
|
5126
|
-
},
|
|
5454
|
+
}, _callee54, this, [[29, 43]]);
|
|
5127
5455
|
}));
|
|
5128
5456
|
function payCash(_x43) {
|
|
5129
5457
|
return _payCash.apply(this, arguments);
|
|
@@ -5141,21 +5469,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5141
5469
|
}, {
|
|
5142
5470
|
key: "commitPaymentMethodPayment",
|
|
5143
5471
|
value: (function () {
|
|
5144
|
-
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5145
|
-
var _this$store$order$get7, _this$store$
|
|
5472
|
+
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
|
|
5473
|
+
var _this$store$order$get7, _this$store$order16, _this$store$order$get8, _params$metadata, _params$originAmount;
|
|
5146
5474
|
var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
5147
|
-
return _regeneratorRuntime().wrap(function
|
|
5148
|
-
while (1) switch (
|
|
5475
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5476
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
5149
5477
|
case 0:
|
|
5150
5478
|
if (this.store.order) {
|
|
5151
|
-
|
|
5479
|
+
_context55.next = 2;
|
|
5152
5480
|
break;
|
|
5153
5481
|
}
|
|
5154
5482
|
throw new Error('order 模块未初始化');
|
|
5155
5483
|
case 2:
|
|
5156
5484
|
amount = Number(params.amount || 0);
|
|
5157
5485
|
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
5158
|
-
|
|
5486
|
+
_context55.next = 5;
|
|
5159
5487
|
break;
|
|
5160
5488
|
}
|
|
5161
5489
|
throw new Error('支付金额必须大于 0');
|
|
@@ -5171,32 +5499,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5171
5499
|
};
|
|
5172
5500
|
paymentMethod = findPaymentMethod();
|
|
5173
5501
|
if (paymentMethod) {
|
|
5174
|
-
|
|
5502
|
+
_context55.next = 13;
|
|
5175
5503
|
break;
|
|
5176
5504
|
}
|
|
5177
|
-
|
|
5505
|
+
_context55.next = 11;
|
|
5178
5506
|
return this.getPaymentMethodsAsync();
|
|
5179
5507
|
case 11:
|
|
5180
|
-
paymentMethods =
|
|
5508
|
+
paymentMethods = _context55.sent;
|
|
5181
5509
|
paymentMethod = findPaymentMethod();
|
|
5182
5510
|
case 13:
|
|
5183
5511
|
if (paymentMethod) {
|
|
5184
|
-
|
|
5512
|
+
_context55.next = 15;
|
|
5185
5513
|
break;
|
|
5186
5514
|
}
|
|
5187
5515
|
throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
|
|
5188
5516
|
case 15:
|
|
5189
|
-
amountSnapshot = (_this$store$order$get7 = (_this$store$
|
|
5517
|
+
amountSnapshot = (_this$store$order$get7 = (_this$store$order16 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get7 === void 0 ? void 0 : _this$store$order$get7.call(_this$store$order16);
|
|
5190
5518
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
5191
5519
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
5192
5520
|
if (!amountDue.lte(0)) {
|
|
5193
|
-
|
|
5521
|
+
_context55.next = 20;
|
|
5194
5522
|
break;
|
|
5195
5523
|
}
|
|
5196
5524
|
throw new Error('当前订单没有待支付金额');
|
|
5197
5525
|
case 20:
|
|
5198
5526
|
if (!new Decimal(amount).gt(amountDue.plus(0.01))) {
|
|
5199
|
-
|
|
5527
|
+
_context55.next = 22;
|
|
5200
5528
|
break;
|
|
5201
5529
|
}
|
|
5202
5530
|
throw new Error('支付金额超过当前待支付金额');
|
|
@@ -5235,8 +5563,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5235
5563
|
var _item$metadata3;
|
|
5236
5564
|
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;
|
|
5237
5565
|
});
|
|
5238
|
-
|
|
5239
|
-
|
|
5566
|
+
_context55.prev = 30;
|
|
5567
|
+
_context55.next = 33;
|
|
5240
5568
|
return this.syncPaymentsToOrder({
|
|
5241
5569
|
payments: payments,
|
|
5242
5570
|
submitWhenPaid: true,
|
|
@@ -5244,48 +5572,48 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5244
5572
|
confirmPendingVoucherPayments: true
|
|
5245
5573
|
});
|
|
5246
5574
|
case 33:
|
|
5247
|
-
syncResult =
|
|
5575
|
+
syncResult = _context55.sent;
|
|
5248
5576
|
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
5249
|
-
|
|
5577
|
+
_context55.next = 36;
|
|
5250
5578
|
break;
|
|
5251
5579
|
}
|
|
5252
5580
|
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
5253
5581
|
case 36:
|
|
5254
5582
|
if (!this.store.payment) {
|
|
5255
|
-
|
|
5583
|
+
_context55.next = 41;
|
|
5256
5584
|
break;
|
|
5257
5585
|
}
|
|
5258
5586
|
committed = this.getCommittedWalletAssets();
|
|
5259
5587
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
5260
|
-
|
|
5261
|
-
return this.publishWalletAssetsState(walletState);
|
|
5588
|
+
_context55.next = 41;
|
|
5589
|
+
return this.publishWalletAssetsState(walletState, 'local');
|
|
5262
5590
|
case 41:
|
|
5263
|
-
return
|
|
5591
|
+
return _context55.abrupt("return", {
|
|
5264
5592
|
payment: payment || {},
|
|
5265
5593
|
payments: this.store.order.getOrderPayments(),
|
|
5266
5594
|
syncResult: syncResult,
|
|
5267
5595
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
5268
5596
|
});
|
|
5269
5597
|
case 44:
|
|
5270
|
-
|
|
5271
|
-
|
|
5598
|
+
_context55.prev = 44;
|
|
5599
|
+
_context55.t0 = _context55["catch"](30);
|
|
5272
5600
|
this.store.order.setOrderPayments(beforePayments);
|
|
5273
5601
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
5274
5602
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
5275
5603
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
5276
5604
|
this.store.order.persistTempOrder();
|
|
5277
5605
|
}
|
|
5278
|
-
|
|
5606
|
+
_context55.next = 51;
|
|
5279
5607
|
return this.store.order.recalculateSummary({
|
|
5280
5608
|
createIfMissing: true
|
|
5281
5609
|
});
|
|
5282
5610
|
case 51:
|
|
5283
|
-
throw
|
|
5611
|
+
throw _context55.t0;
|
|
5284
5612
|
case 52:
|
|
5285
5613
|
case "end":
|
|
5286
|
-
return
|
|
5614
|
+
return _context55.stop();
|
|
5287
5615
|
}
|
|
5288
|
-
},
|
|
5616
|
+
}, _callee55, this, [[30, 44]]);
|
|
5289
5617
|
}));
|
|
5290
5618
|
function commitPaymentMethodPayment(_x44) {
|
|
5291
5619
|
return _commitPaymentMethodPayment.apply(this, arguments);
|
|
@@ -5302,38 +5630,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5302
5630
|
}, {
|
|
5303
5631
|
key: "roundAmount",
|
|
5304
5632
|
value: (function () {
|
|
5305
|
-
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5633
|
+
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
|
|
5306
5634
|
var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
|
|
5307
5635
|
var amount, cashManualPayment;
|
|
5308
|
-
return _regeneratorRuntime().wrap(function
|
|
5309
|
-
while (1) switch (
|
|
5636
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
5637
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
5310
5638
|
case 0:
|
|
5311
5639
|
amount = params.amount;
|
|
5312
5640
|
cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
|
|
5313
5641
|
return paymentMethod.code === 'CASHMANUAL';
|
|
5314
5642
|
});
|
|
5315
5643
|
if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
|
|
5316
|
-
|
|
5644
|
+
_context56.next = 4;
|
|
5317
5645
|
break;
|
|
5318
5646
|
}
|
|
5319
|
-
return
|
|
5647
|
+
return _context56.abrupt("return", {
|
|
5320
5648
|
originalAmount: amount.toString(),
|
|
5321
5649
|
roundedAmount: amount.toString(),
|
|
5322
5650
|
roundingDifference: '0.00'
|
|
5323
5651
|
});
|
|
5324
5652
|
case 4:
|
|
5325
5653
|
if (this.payment) {
|
|
5326
|
-
|
|
5654
|
+
_context56.next = 6;
|
|
5327
5655
|
break;
|
|
5328
5656
|
}
|
|
5329
5657
|
throw new Error('payment 模块未初始化');
|
|
5330
5658
|
case 6:
|
|
5331
|
-
return
|
|
5659
|
+
return _context56.abrupt("return", this.payment.roundAmountAsync(amount, (_this$otherParams$ord2 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord2 === void 0 ? void 0 : _this$otherParams$ord2.interval, (_this$otherParams$ord3 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord3 === void 0 ? void 0 : _this$otherParams$ord3.type));
|
|
5332
5660
|
case 7:
|
|
5333
5661
|
case "end":
|
|
5334
|
-
return
|
|
5662
|
+
return _context56.stop();
|
|
5335
5663
|
}
|
|
5336
|
-
},
|
|
5664
|
+
}, _callee56, this);
|
|
5337
5665
|
}));
|
|
5338
5666
|
function roundAmount(_x45) {
|
|
5339
5667
|
return _roundAmount.apply(this, arguments);
|
|
@@ -5350,47 +5678,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5350
5678
|
}, {
|
|
5351
5679
|
key: "sendCustomerPayLink",
|
|
5352
5680
|
value: (function () {
|
|
5353
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5354
|
-
var orderIds,
|
|
5355
|
-
return _regeneratorRuntime().wrap(function
|
|
5356
|
-
while (1) switch (
|
|
5681
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
|
|
5682
|
+
var orderIds, _ref45, _ref46, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
5683
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
|
5684
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
5357
5685
|
case 0:
|
|
5358
5686
|
if (this.store.order) {
|
|
5359
|
-
|
|
5687
|
+
_context57.next = 2;
|
|
5360
5688
|
break;
|
|
5361
5689
|
}
|
|
5362
5690
|
throw new Error('order 模块未初始化');
|
|
5363
5691
|
case 2:
|
|
5364
5692
|
orderIds = params.order_ids || params.orderIds || [];
|
|
5365
5693
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
5366
|
-
|
|
5694
|
+
_context57.next = 11;
|
|
5367
5695
|
break;
|
|
5368
5696
|
}
|
|
5369
|
-
|
|
5697
|
+
_context57.next = 6;
|
|
5370
5698
|
return this.submitSalesOrder({
|
|
5371
5699
|
smallTicketDataFlag: 1
|
|
5372
5700
|
});
|
|
5373
5701
|
case 6:
|
|
5374
|
-
submitResult =
|
|
5375
|
-
orderId = (
|
|
5702
|
+
submitResult = _context57.sent;
|
|
5703
|
+
orderId = (_ref45 = (_ref46 = (_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 && _ref46 !== void 0 ? _ref46 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref45 !== void 0 ? _ref45 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
5376
5704
|
if (orderId) {
|
|
5377
|
-
|
|
5705
|
+
_context57.next = 10;
|
|
5378
5706
|
break;
|
|
5379
5707
|
}
|
|
5380
5708
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
5381
5709
|
case 10:
|
|
5382
5710
|
orderIds = [orderId];
|
|
5383
5711
|
case 11:
|
|
5384
|
-
return
|
|
5712
|
+
return _context57.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
5385
5713
|
emails: params.emails,
|
|
5386
5714
|
notify_action: params.notify_action,
|
|
5387
5715
|
order_ids: orderIds
|
|
5388
5716
|
}));
|
|
5389
5717
|
case 12:
|
|
5390
5718
|
case "end":
|
|
5391
|
-
return
|
|
5719
|
+
return _context57.stop();
|
|
5392
5720
|
}
|
|
5393
|
-
},
|
|
5721
|
+
}, _callee57, this);
|
|
5394
5722
|
}));
|
|
5395
5723
|
function sendCustomerPayLink(_x46) {
|
|
5396
5724
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
@@ -5405,20 +5733,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5405
5733
|
}, {
|
|
5406
5734
|
key: "calculateProductBookingPrice",
|
|
5407
5735
|
value: function () {
|
|
5408
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5736
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
|
|
5409
5737
|
var _params$customer_id;
|
|
5410
5738
|
var useCustomerUserPricing, quotation, customerId, channel, _yield$this$resolvePr, _yield$this$resolvePr2, authoritativeProduct, product;
|
|
5411
|
-
return _regeneratorRuntime().wrap(function
|
|
5412
|
-
while (1) switch (
|
|
5739
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
|
5740
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
5413
5741
|
case 0:
|
|
5414
5742
|
useCustomerUserPricing = this.isCustomerUserPriceQuery();
|
|
5415
5743
|
quotation = useCustomerUserPricing ? undefined : this.store.quotation;
|
|
5416
5744
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
5417
|
-
|
|
5745
|
+
_context58.next = 5;
|
|
5418
5746
|
return this.prepareProductPriceQueryContext(customerId);
|
|
5419
5747
|
case 5:
|
|
5420
5748
|
channel = this.getPriceQueryChannel(params.channel);
|
|
5421
|
-
|
|
5749
|
+
_context58.next = 8;
|
|
5422
5750
|
return this.resolveProductsForPriceQuery({
|
|
5423
5751
|
priceQueries: [params],
|
|
5424
5752
|
schedule: this.getPriceQuerySchedule(params),
|
|
@@ -5426,22 +5754,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5426
5754
|
channel: channel
|
|
5427
5755
|
});
|
|
5428
5756
|
case 8:
|
|
5429
|
-
_yield$this$resolvePr =
|
|
5757
|
+
_yield$this$resolvePr = _context58.sent;
|
|
5430
5758
|
_yield$this$resolvePr2 = _slicedToArray(_yield$this$resolvePr, 1);
|
|
5431
5759
|
authoritativeProduct = _yield$this$resolvePr2[0];
|
|
5432
5760
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
5433
5761
|
if (useCustomerUserPricing) {
|
|
5434
|
-
|
|
5762
|
+
_context58.next = 15;
|
|
5435
5763
|
break;
|
|
5436
5764
|
}
|
|
5437
|
-
|
|
5765
|
+
_context58.next = 15;
|
|
5438
5766
|
return this.loadQuotationForPriceQuery({
|
|
5439
5767
|
quotation: quotation,
|
|
5440
5768
|
customer_id: customerId,
|
|
5441
5769
|
channel: channel
|
|
5442
5770
|
});
|
|
5443
5771
|
case 15:
|
|
5444
|
-
return
|
|
5772
|
+
return _context58.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
5445
5773
|
channel: channel,
|
|
5446
5774
|
product: product,
|
|
5447
5775
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
@@ -5450,9 +5778,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5450
5778
|
})));
|
|
5451
5779
|
case 16:
|
|
5452
5780
|
case "end":
|
|
5453
|
-
return
|
|
5781
|
+
return _context58.stop();
|
|
5454
5782
|
}
|
|
5455
|
-
},
|
|
5783
|
+
}, _callee58, this);
|
|
5456
5784
|
}));
|
|
5457
5785
|
function calculateProductBookingPrice(_x47) {
|
|
5458
5786
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
@@ -5538,17 +5866,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5538
5866
|
}, {
|
|
5539
5867
|
key: "calculateProductBookingPrices",
|
|
5540
5868
|
value: function () {
|
|
5541
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5869
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(paramsList) {
|
|
5542
5870
|
var _this18 = this;
|
|
5543
5871
|
var useCustomerUserPricing, quotation, currentOrderCustomerId, resolvedChannels, authoritativeProducts, groups, quotationContexts;
|
|
5544
|
-
return _regeneratorRuntime().wrap(function
|
|
5545
|
-
while (1) switch (
|
|
5872
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
|
5873
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
5546
5874
|
case 0:
|
|
5547
5875
|
if (paramsList.length) {
|
|
5548
|
-
|
|
5876
|
+
_context60.next = 2;
|
|
5549
5877
|
break;
|
|
5550
5878
|
}
|
|
5551
|
-
return
|
|
5879
|
+
return _context60.abrupt("return", []);
|
|
5552
5880
|
case 2:
|
|
5553
5881
|
useCustomerUserPricing = this.isCustomerUserPriceQuery();
|
|
5554
5882
|
quotation = useCustomerUserPricing ? undefined : this.store.quotation;
|
|
@@ -5575,20 +5903,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5575
5903
|
group.indices.push(index);
|
|
5576
5904
|
groups.set(groupKey, group);
|
|
5577
5905
|
});
|
|
5578
|
-
|
|
5906
|
+
_context60.next = 11;
|
|
5579
5907
|
return Promise.all(Array.from(groups.values()).map( /*#__PURE__*/function () {
|
|
5580
|
-
var
|
|
5908
|
+
var _ref47 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(group) {
|
|
5581
5909
|
var priceQueries, resolvedProducts;
|
|
5582
|
-
return _regeneratorRuntime().wrap(function
|
|
5583
|
-
while (1) switch (
|
|
5910
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
|
5911
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
5584
5912
|
case 0:
|
|
5585
|
-
|
|
5913
|
+
_context59.next = 2;
|
|
5586
5914
|
return _this18.prepareProductPriceQueryContext(group.customerId);
|
|
5587
5915
|
case 2:
|
|
5588
5916
|
priceQueries = group.indices.map(function (index) {
|
|
5589
5917
|
return paramsList[index];
|
|
5590
5918
|
});
|
|
5591
|
-
|
|
5919
|
+
_context59.next = 5;
|
|
5592
5920
|
return _this18.resolveProductsForPriceQuery({
|
|
5593
5921
|
priceQueries: priceQueries,
|
|
5594
5922
|
schedule: group.schedule,
|
|
@@ -5596,23 +5924,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5596
5924
|
channel: group.channel
|
|
5597
5925
|
});
|
|
5598
5926
|
case 5:
|
|
5599
|
-
resolvedProducts =
|
|
5927
|
+
resolvedProducts = _context59.sent;
|
|
5600
5928
|
group.indices.forEach(function (originalIndex, groupIndex) {
|
|
5601
5929
|
authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
|
|
5602
5930
|
});
|
|
5603
5931
|
case 7:
|
|
5604
5932
|
case "end":
|
|
5605
|
-
return
|
|
5933
|
+
return _context59.stop();
|
|
5606
5934
|
}
|
|
5607
|
-
},
|
|
5935
|
+
}, _callee59);
|
|
5608
5936
|
}));
|
|
5609
5937
|
return function (_x49) {
|
|
5610
|
-
return
|
|
5938
|
+
return _ref47.apply(this, arguments);
|
|
5611
5939
|
};
|
|
5612
5940
|
}()));
|
|
5613
5941
|
case 11:
|
|
5614
5942
|
if (useCustomerUserPricing) {
|
|
5615
|
-
|
|
5943
|
+
_context60.next = 16;
|
|
5616
5944
|
break;
|
|
5617
5945
|
}
|
|
5618
5946
|
quotationContexts = new Map();
|
|
@@ -5626,14 +5954,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5626
5954
|
customer_id: (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId
|
|
5627
5955
|
});
|
|
5628
5956
|
});
|
|
5629
|
-
|
|
5957
|
+
_context60.next = 16;
|
|
5630
5958
|
return Promise.all(Array.from(quotationContexts.values()).map(function (context) {
|
|
5631
5959
|
return _this18.loadQuotationForPriceQuery(_objectSpread({
|
|
5632
5960
|
quotation: quotation
|
|
5633
5961
|
}, context));
|
|
5634
5962
|
}));
|
|
5635
5963
|
case 16:
|
|
5636
|
-
return
|
|
5964
|
+
return _context60.abrupt("return", paramsList.map(function (params, index) {
|
|
5637
5965
|
var _params$customer_id4;
|
|
5638
5966
|
var productInput = params.product || {};
|
|
5639
5967
|
var authoritativeProduct = authoritativeProducts[index];
|
|
@@ -5650,9 +5978,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5650
5978
|
}));
|
|
5651
5979
|
case 17:
|
|
5652
5980
|
case "end":
|
|
5653
|
-
return
|
|
5981
|
+
return _context60.stop();
|
|
5654
5982
|
}
|
|
5655
|
-
},
|
|
5983
|
+
}, _callee60, this);
|
|
5656
5984
|
}));
|
|
5657
5985
|
function calculateProductBookingPrices(_x48) {
|
|
5658
5986
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
@@ -5662,32 +5990,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5662
5990
|
}, {
|
|
5663
5991
|
key: "addProductToOrder",
|
|
5664
5992
|
value: function () {
|
|
5665
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5993
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(product, booking, options) {
|
|
5666
5994
|
var products;
|
|
5667
|
-
return _regeneratorRuntime().wrap(function
|
|
5668
|
-
while (1) switch (
|
|
5995
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
|
5996
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
5669
5997
|
case 0:
|
|
5670
|
-
|
|
5998
|
+
_context61.prev = 0;
|
|
5671
5999
|
if (this.store.order) {
|
|
5672
|
-
|
|
6000
|
+
_context61.next = 3;
|
|
5673
6001
|
break;
|
|
5674
6002
|
}
|
|
5675
6003
|
throw new Error('order 模块未初始化');
|
|
5676
6004
|
case 3:
|
|
5677
|
-
|
|
6005
|
+
_context61.next = 5;
|
|
5678
6006
|
return this.store.order.addProductToOrder(product, booking, options);
|
|
5679
6007
|
case 5:
|
|
5680
|
-
products =
|
|
5681
|
-
return
|
|
6008
|
+
products = _context61.sent;
|
|
6009
|
+
return _context61.abrupt("return", products);
|
|
5682
6010
|
case 9:
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
throw
|
|
6011
|
+
_context61.prev = 9;
|
|
6012
|
+
_context61.t0 = _context61["catch"](0);
|
|
6013
|
+
throw _context61.t0;
|
|
5686
6014
|
case 12:
|
|
5687
6015
|
case "end":
|
|
5688
|
-
return
|
|
6016
|
+
return _context61.stop();
|
|
5689
6017
|
}
|
|
5690
|
-
},
|
|
6018
|
+
}, _callee61, this, [[0, 9]]);
|
|
5691
6019
|
}));
|
|
5692
6020
|
function addProductToOrder(_x50, _x51, _x52) {
|
|
5693
6021
|
return _addProductToOrder.apply(this, arguments);
|
|
@@ -5697,32 +6025,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5697
6025
|
}, {
|
|
5698
6026
|
key: "updateOrderProduct",
|
|
5699
6027
|
value: function () {
|
|
5700
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6028
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(params) {
|
|
5701
6029
|
var products;
|
|
5702
|
-
return _regeneratorRuntime().wrap(function
|
|
5703
|
-
while (1) switch (
|
|
6030
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
|
6031
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
5704
6032
|
case 0:
|
|
5705
|
-
|
|
6033
|
+
_context62.prev = 0;
|
|
5706
6034
|
if (this.store.order) {
|
|
5707
|
-
|
|
6035
|
+
_context62.next = 3;
|
|
5708
6036
|
break;
|
|
5709
6037
|
}
|
|
5710
6038
|
throw new Error('order 模块未初始化');
|
|
5711
6039
|
case 3:
|
|
5712
|
-
|
|
6040
|
+
_context62.next = 5;
|
|
5713
6041
|
return this.store.order.updateOrderProduct(params);
|
|
5714
6042
|
case 5:
|
|
5715
|
-
products =
|
|
5716
|
-
return
|
|
6043
|
+
products = _context62.sent;
|
|
6044
|
+
return _context62.abrupt("return", products);
|
|
5717
6045
|
case 9:
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
throw
|
|
6046
|
+
_context62.prev = 9;
|
|
6047
|
+
_context62.t0 = _context62["catch"](0);
|
|
6048
|
+
throw _context62.t0;
|
|
5721
6049
|
case 12:
|
|
5722
6050
|
case "end":
|
|
5723
|
-
return
|
|
6051
|
+
return _context62.stop();
|
|
5724
6052
|
}
|
|
5725
|
-
},
|
|
6053
|
+
}, _callee62, this, [[0, 9]]);
|
|
5726
6054
|
}));
|
|
5727
6055
|
function updateOrderProduct(_x53) {
|
|
5728
6056
|
return _updateOrderProduct.apply(this, arguments);
|
|
@@ -5732,32 +6060,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5732
6060
|
}, {
|
|
5733
6061
|
key: "updateOrderProducts",
|
|
5734
6062
|
value: function () {
|
|
5735
|
-
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6063
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(paramsList) {
|
|
5736
6064
|
var products;
|
|
5737
|
-
return _regeneratorRuntime().wrap(function
|
|
5738
|
-
while (1) switch (
|
|
6065
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
6066
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
5739
6067
|
case 0:
|
|
5740
|
-
|
|
6068
|
+
_context63.prev = 0;
|
|
5741
6069
|
if (this.store.order) {
|
|
5742
|
-
|
|
6070
|
+
_context63.next = 3;
|
|
5743
6071
|
break;
|
|
5744
6072
|
}
|
|
5745
6073
|
throw new Error('order 模块未初始化');
|
|
5746
6074
|
case 3:
|
|
5747
|
-
|
|
6075
|
+
_context63.next = 5;
|
|
5748
6076
|
return this.store.order.updateOrderProducts(paramsList);
|
|
5749
6077
|
case 5:
|
|
5750
|
-
products =
|
|
5751
|
-
return
|
|
6078
|
+
products = _context63.sent;
|
|
6079
|
+
return _context63.abrupt("return", products);
|
|
5752
6080
|
case 9:
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
throw
|
|
6081
|
+
_context63.prev = 9;
|
|
6082
|
+
_context63.t0 = _context63["catch"](0);
|
|
6083
|
+
throw _context63.t0;
|
|
5756
6084
|
case 12:
|
|
5757
6085
|
case "end":
|
|
5758
|
-
return
|
|
6086
|
+
return _context63.stop();
|
|
5759
6087
|
}
|
|
5760
|
-
},
|
|
6088
|
+
}, _callee63, this, [[0, 9]]);
|
|
5761
6089
|
}));
|
|
5762
6090
|
function updateOrderProducts(_x54) {
|
|
5763
6091
|
return _updateOrderProducts.apply(this, arguments);
|
|
@@ -5767,32 +6095,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5767
6095
|
}, {
|
|
5768
6096
|
key: "updateOrderProductQuantity",
|
|
5769
6097
|
value: function () {
|
|
5770
|
-
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6098
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(params) {
|
|
5771
6099
|
var products;
|
|
5772
|
-
return _regeneratorRuntime().wrap(function
|
|
5773
|
-
while (1) switch (
|
|
6100
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
|
6101
|
+
while (1) switch (_context64.prev = _context64.next) {
|
|
5774
6102
|
case 0:
|
|
5775
|
-
|
|
6103
|
+
_context64.prev = 0;
|
|
5776
6104
|
if (this.store.order) {
|
|
5777
|
-
|
|
6105
|
+
_context64.next = 3;
|
|
5778
6106
|
break;
|
|
5779
6107
|
}
|
|
5780
6108
|
throw new Error('order 模块未初始化');
|
|
5781
6109
|
case 3:
|
|
5782
|
-
|
|
6110
|
+
_context64.next = 5;
|
|
5783
6111
|
return this.store.order.updateOrderProductQuantity(params);
|
|
5784
6112
|
case 5:
|
|
5785
|
-
products =
|
|
5786
|
-
return
|
|
6113
|
+
products = _context64.sent;
|
|
6114
|
+
return _context64.abrupt("return", products);
|
|
5787
6115
|
case 9:
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
throw
|
|
6116
|
+
_context64.prev = 9;
|
|
6117
|
+
_context64.t0 = _context64["catch"](0);
|
|
6118
|
+
throw _context64.t0;
|
|
5791
6119
|
case 12:
|
|
5792
6120
|
case "end":
|
|
5793
|
-
return
|
|
6121
|
+
return _context64.stop();
|
|
5794
6122
|
}
|
|
5795
|
-
},
|
|
6123
|
+
}, _callee64, this, [[0, 9]]);
|
|
5796
6124
|
}));
|
|
5797
6125
|
function updateOrderProductQuantity(_x55) {
|
|
5798
6126
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
@@ -5817,12 +6145,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5817
6145
|
}, {
|
|
5818
6146
|
key: "setOrderProductLineNote",
|
|
5819
6147
|
value: (function () {
|
|
5820
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6148
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(identity, note) {
|
|
5821
6149
|
var params, products;
|
|
5822
|
-
return _regeneratorRuntime().wrap(function
|
|
5823
|
-
while (1) switch (
|
|
6150
|
+
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
6151
|
+
while (1) switch (_context65.prev = _context65.next) {
|
|
5824
6152
|
case 0:
|
|
5825
|
-
|
|
6153
|
+
_context65.prev = 0;
|
|
5826
6154
|
params = {
|
|
5827
6155
|
product_id: identity.product_id,
|
|
5828
6156
|
product_variant_id: identity.product_variant_id,
|
|
@@ -5837,20 +6165,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5837
6165
|
params.product_sku = identity.product_sku;
|
|
5838
6166
|
}
|
|
5839
6167
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
5840
|
-
|
|
6168
|
+
_context65.next = 7;
|
|
5841
6169
|
return this.updateOrderProduct(params);
|
|
5842
6170
|
case 7:
|
|
5843
|
-
products =
|
|
5844
|
-
return
|
|
6171
|
+
products = _context65.sent;
|
|
6172
|
+
return _context65.abrupt("return", products);
|
|
5845
6173
|
case 11:
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
throw
|
|
6174
|
+
_context65.prev = 11;
|
|
6175
|
+
_context65.t0 = _context65["catch"](0);
|
|
6176
|
+
throw _context65.t0;
|
|
5849
6177
|
case 14:
|
|
5850
6178
|
case "end":
|
|
5851
|
-
return
|
|
6179
|
+
return _context65.stop();
|
|
5852
6180
|
}
|
|
5853
|
-
},
|
|
6181
|
+
}, _callee65, this, [[0, 11]]);
|
|
5854
6182
|
}));
|
|
5855
6183
|
function setOrderProductLineNote(_x56, _x57) {
|
|
5856
6184
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
@@ -5867,30 +6195,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5867
6195
|
}, {
|
|
5868
6196
|
key: "removeProductsFromOrder",
|
|
5869
6197
|
value: (function () {
|
|
5870
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5871
|
-
return _regeneratorRuntime().wrap(function
|
|
5872
|
-
while (1) switch (
|
|
6198
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(identities, options) {
|
|
6199
|
+
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
|
6200
|
+
while (1) switch (_context66.prev = _context66.next) {
|
|
5873
6201
|
case 0:
|
|
5874
|
-
|
|
6202
|
+
_context66.prev = 0;
|
|
5875
6203
|
if (this.store.order) {
|
|
5876
|
-
|
|
6204
|
+
_context66.next = 3;
|
|
5877
6205
|
break;
|
|
5878
6206
|
}
|
|
5879
6207
|
throw new Error('order 模块未初始化');
|
|
5880
6208
|
case 3:
|
|
5881
|
-
|
|
6209
|
+
_context66.next = 5;
|
|
5882
6210
|
return this.store.order.removeProductsFromOrder(identities, options);
|
|
5883
6211
|
case 5:
|
|
5884
|
-
return
|
|
6212
|
+
return _context66.abrupt("return", _context66.sent);
|
|
5885
6213
|
case 8:
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
throw
|
|
6214
|
+
_context66.prev = 8;
|
|
6215
|
+
_context66.t0 = _context66["catch"](0);
|
|
6216
|
+
throw _context66.t0;
|
|
5889
6217
|
case 11:
|
|
5890
6218
|
case "end":
|
|
5891
|
-
return
|
|
6219
|
+
return _context66.stop();
|
|
5892
6220
|
}
|
|
5893
|
-
},
|
|
6221
|
+
}, _callee66, this, [[0, 8]]);
|
|
5894
6222
|
}));
|
|
5895
6223
|
function removeProductsFromOrder(_x58, _x59) {
|
|
5896
6224
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
@@ -5900,16 +6228,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5900
6228
|
}, {
|
|
5901
6229
|
key: "removeProductFromOrder",
|
|
5902
6230
|
value: function () {
|
|
5903
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5904
|
-
return _regeneratorRuntime().wrap(function
|
|
5905
|
-
while (1) switch (
|
|
6231
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(identity, options) {
|
|
6232
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
|
6233
|
+
while (1) switch (_context67.prev = _context67.next) {
|
|
5906
6234
|
case 0:
|
|
5907
|
-
return
|
|
6235
|
+
return _context67.abrupt("return", this.removeProductsFromOrder([identity], options));
|
|
5908
6236
|
case 1:
|
|
5909
6237
|
case "end":
|
|
5910
|
-
return
|
|
6238
|
+
return _context67.stop();
|
|
5911
6239
|
}
|
|
5912
|
-
},
|
|
6240
|
+
}, _callee67, this);
|
|
5913
6241
|
}));
|
|
5914
6242
|
function removeProductFromOrder(_x60, _x61) {
|
|
5915
6243
|
return _removeProductFromOrder.apply(this, arguments);
|
|
@@ -5961,23 +6289,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5961
6289
|
}, {
|
|
5962
6290
|
key: "applyPromotion",
|
|
5963
6291
|
value: (function () {
|
|
5964
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5965
|
-
return _regeneratorRuntime().wrap(function
|
|
5966
|
-
while (1) switch (
|
|
6292
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68() {
|
|
6293
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
|
6294
|
+
while (1) switch (_context68.prev = _context68.next) {
|
|
5967
6295
|
case 0:
|
|
5968
6296
|
if (this.store.order) {
|
|
5969
|
-
|
|
6297
|
+
_context68.next = 2;
|
|
5970
6298
|
break;
|
|
5971
6299
|
}
|
|
5972
6300
|
throw new Error('order 模块未初始化');
|
|
5973
6301
|
case 2:
|
|
5974
|
-
|
|
6302
|
+
_context68.next = 4;
|
|
5975
6303
|
return this.store.order.applyPromotion();
|
|
5976
6304
|
case 4:
|
|
5977
6305
|
case "end":
|
|
5978
|
-
return
|
|
6306
|
+
return _context68.stop();
|
|
5979
6307
|
}
|
|
5980
|
-
},
|
|
6308
|
+
}, _callee68, this);
|
|
5981
6309
|
}));
|
|
5982
6310
|
function applyPromotion() {
|
|
5983
6311
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -5987,16 +6315,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5987
6315
|
}, {
|
|
5988
6316
|
key: "getUnfulfilledPromotions",
|
|
5989
6317
|
value: function getUnfulfilledPromotions() {
|
|
5990
|
-
var _this$store$
|
|
5991
|
-
return ((_this$store$
|
|
6318
|
+
var _this$store$order17;
|
|
6319
|
+
return ((_this$store$order17 = this.store.order) === null || _this$store$order17 === void 0 ? void 0 : _this$store$order17.getUnfulfilledPromotions()) || [];
|
|
5992
6320
|
}
|
|
5993
6321
|
|
|
5994
6322
|
/** 最近一次促销计算输出的赠品操作 diff。 */
|
|
5995
6323
|
}, {
|
|
5996
6324
|
key: "getLastGiftActions",
|
|
5997
6325
|
value: function getLastGiftActions() {
|
|
5998
|
-
var _this$store$
|
|
5999
|
-
return ((_this$store$
|
|
6326
|
+
var _this$store$order18;
|
|
6327
|
+
return ((_this$store$order18 = this.store.order) === null || _this$store$order18 === void 0 ? void 0 : _this$store$order18.getLastGiftActions()) || null;
|
|
6000
6328
|
}
|
|
6001
6329
|
|
|
6002
6330
|
// 获取商品列表
|
|
@@ -6004,18 +6332,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6004
6332
|
}, {
|
|
6005
6333
|
key: "getProductList",
|
|
6006
6334
|
value: function () {
|
|
6007
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6008
|
-
var _this$
|
|
6335
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69() {
|
|
6336
|
+
var _this$otherParams36;
|
|
6009
6337
|
var menu_list_ids, _this$store$products, res;
|
|
6010
|
-
return _regeneratorRuntime().wrap(function
|
|
6011
|
-
while (1) switch (
|
|
6338
|
+
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
|
6339
|
+
while (1) switch (_context69.prev = _context69.next) {
|
|
6012
6340
|
case 0:
|
|
6013
6341
|
// 可以直接通过配置里的 menu 读取
|
|
6014
|
-
menu_list_ids = ((_this$
|
|
6342
|
+
menu_list_ids = ((_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 || (_this$otherParams36 = _this$otherParams36.dineInConfig) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36['menu.associated_menus'].map(function (n) {
|
|
6015
6343
|
return Number(n.value);
|
|
6016
6344
|
})) || [];
|
|
6017
|
-
|
|
6018
|
-
|
|
6345
|
+
_context69.prev = 1;
|
|
6346
|
+
_context69.next = 4;
|
|
6019
6347
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
6020
6348
|
menu_list_ids: menu_list_ids,
|
|
6021
6349
|
cacheId: this.cacheId,
|
|
@@ -6023,17 +6351,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6023
6351
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
6024
6352
|
});
|
|
6025
6353
|
case 4:
|
|
6026
|
-
res =
|
|
6027
|
-
return
|
|
6354
|
+
res = _context69.sent;
|
|
6355
|
+
return _context69.abrupt("return", res);
|
|
6028
6356
|
case 8:
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
throw
|
|
6357
|
+
_context69.prev = 8;
|
|
6358
|
+
_context69.t0 = _context69["catch"](1);
|
|
6359
|
+
throw _context69.t0;
|
|
6032
6360
|
case 11:
|
|
6033
6361
|
case "end":
|
|
6034
|
-
return
|
|
6362
|
+
return _context69.stop();
|
|
6035
6363
|
}
|
|
6036
|
-
},
|
|
6364
|
+
}, _callee69, this, [[1, 8]]);
|
|
6037
6365
|
}));
|
|
6038
6366
|
function getProductList() {
|
|
6039
6367
|
return _getProductList.apply(this, arguments);
|
|
@@ -6048,31 +6376,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6048
6376
|
}, {
|
|
6049
6377
|
key: "setOtherParams",
|
|
6050
6378
|
value: function () {
|
|
6051
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6052
|
-
var _this$
|
|
6053
|
-
var
|
|
6054
|
-
|
|
6379
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(params) {
|
|
6380
|
+
var _this$otherParams37;
|
|
6381
|
+
var _ref48,
|
|
6382
|
+
_ref48$cover,
|
|
6055
6383
|
cover,
|
|
6056
|
-
|
|
6057
|
-
return _regeneratorRuntime().wrap(function
|
|
6058
|
-
while (1) switch (
|
|
6384
|
+
_args70 = arguments;
|
|
6385
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
|
6386
|
+
while (1) switch (_context70.prev = _context70.next) {
|
|
6059
6387
|
case 0:
|
|
6060
|
-
|
|
6388
|
+
_ref48 = _args70.length > 1 && _args70[1] !== undefined ? _args70[1] : {}, _ref48$cover = _ref48.cover, cover = _ref48$cover === void 0 ? false : _ref48$cover;
|
|
6061
6389
|
if (cover) {
|
|
6062
6390
|
this.otherParams = _objectSpread({}, params);
|
|
6063
6391
|
} else {
|
|
6064
6392
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
6065
6393
|
}
|
|
6066
|
-
this.cacheId = (_this$
|
|
6067
|
-
|
|
6394
|
+
this.cacheId = (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.cacheId;
|
|
6395
|
+
_context70.next = 5;
|
|
6068
6396
|
return this.syncOtherParamsToSubModules(params, {
|
|
6069
6397
|
cover: cover
|
|
6070
6398
|
});
|
|
6071
6399
|
case 5:
|
|
6072
6400
|
case "end":
|
|
6073
|
-
return
|
|
6401
|
+
return _context70.stop();
|
|
6074
6402
|
}
|
|
6075
|
-
},
|
|
6403
|
+
}, _callee70, this);
|
|
6076
6404
|
}));
|
|
6077
6405
|
function setOtherParams(_x62) {
|
|
6078
6406
|
return _setOtherParams.apply(this, arguments);
|