@pisell/pisellos 2.2.256 → 2.2.258
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/promotion/index.js +9 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +17 -13
- package/dist/modules/Order/index.d.ts +29 -1
- package/dist/modules/Order/index.js +508 -241
- package/dist/modules/Order/types.d.ts +20 -2
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils.d.ts +4 -0
- package/dist/modules/Order/utils.js +114 -28
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +6 -0
- package/dist/modules/Rules/index.d.ts +3 -3
- package/dist/modules/Rules/index.js +8 -3
- package/dist/modules/Rules/types.d.ts +2 -1
- package/dist/server/index.d.ts +12 -2
- package/dist/server/index.js +1227 -923
- package/dist/server/modules/order/index.d.ts +22 -3
- package/dist/server/modules/order/index.js +397 -314
- package/dist/solution/BaseSales/index.d.ts +16 -2
- package/dist/solution/BaseSales/index.js +484 -314
- package/dist/solution/BaseSales/types.d.ts +1 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +9 -1
- package/dist/solution/BookingTicket/index.js +162 -6
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +11 -1
- package/lib/modules/Order/index.d.ts +29 -1
- package/lib/modules/Order/index.js +340 -57
- package/lib/modules/Order/types.d.ts +20 -2
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
- package/lib/modules/Order/utils.d.ts +4 -0
- package/lib/modules/Order/utils.js +84 -2
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +6 -0
- package/lib/modules/Rules/index.d.ts +3 -3
- package/lib/modules/Rules/index.js +4 -3
- package/lib/modules/Rules/types.d.ts +2 -1
- package/lib/server/index.d.ts +12 -2
- package/lib/server/index.js +218 -12
- package/lib/server/modules/order/index.d.ts +22 -3
- package/lib/server/modules/order/index.js +102 -51
- package/lib/solution/BaseSales/index.d.ts +16 -2
- package/lib/solution/BaseSales/index.js +143 -31
- package/lib/solution/BaseSales/types.d.ts +1 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -5
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +9 -1
- package/lib/solution/BookingTicket/index.js +112 -0
- package/package.json +1 -1
|
@@ -36,7 +36,7 @@ import { OrderModule } from "../../modules/Order";
|
|
|
36
36
|
import Decimal from 'decimal.js';
|
|
37
37
|
import { cloneDeep, mergeWith } from 'lodash-es';
|
|
38
38
|
import { createModule } from "../BookingByStep/types";
|
|
39
|
-
import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
39
|
+
import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, resolveIsFormSubject, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
40
40
|
import dayjs from 'dayjs';
|
|
41
41
|
export * from "./types";
|
|
42
42
|
import { QuotationModule } from "../../modules/Quotation";
|
|
@@ -153,6 +153,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
153
153
|
_defineProperty(_assertThisInitialized(_this), "hasManualDiscountSelection", false);
|
|
154
154
|
_defineProperty(_assertThisInitialized(_this), "reusedSharedSubModuleNames", new Set());
|
|
155
155
|
_defineProperty(_assertThisInitialized(_this), "paymentMethodsCache", []);
|
|
156
|
+
_defineProperty(_assertThisInitialized(_this), "queuedAutoPaymentSync", false);
|
|
157
|
+
_defineProperty(_assertThisInitialized(_this), "autoPaymentSyncFlushing", false);
|
|
158
|
+
_defineProperty(_assertThisInitialized(_this), "autoPaymentSyncTimer", null);
|
|
156
159
|
return _this;
|
|
157
160
|
}
|
|
158
161
|
|
|
@@ -168,9 +171,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
168
171
|
}, {
|
|
169
172
|
key: "getReusableSharedSubModule",
|
|
170
173
|
value: function getReusableSharedSubModule(moduleName) {
|
|
171
|
-
var _this$core;
|
|
174
|
+
var _this$core, _this$core$getModule;
|
|
172
175
|
if (moduleName !== 'schedule' && moduleName !== 'quotation') return null;
|
|
173
|
-
return ((_this$core = this.core) === null || _this$core === void 0 ? void 0 : _this$core.
|
|
176
|
+
return ((_this$core = this.core) === null || _this$core === void 0 || (_this$core$getModule = _this$core.getModule) === null || _this$core$getModule === void 0 ? void 0 : _this$core$getModule.call(_this$core, moduleName)) || null;
|
|
174
177
|
}
|
|
175
178
|
}, {
|
|
176
179
|
key: "isScheduleListLoaded",
|
|
@@ -1489,7 +1492,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1489
1492
|
value: function () {
|
|
1490
1493
|
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
1491
1494
|
var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
|
|
1492
|
-
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _tempOrder$holder,
|
|
1495
|
+
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _tempOrder$holder, _orderStore$summary, holders, orderTotalAmount, result, _iterator, _step, _product$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
|
|
1493
1496
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1494
1497
|
while (1) switch (_context15.prev = _context15.next) {
|
|
1495
1498
|
case 0:
|
|
@@ -1583,18 +1586,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1583
1586
|
});
|
|
1584
1587
|
case 40:
|
|
1585
1588
|
if (!rulesModule) {
|
|
1586
|
-
_context15.next =
|
|
1589
|
+
_context15.next = 78;
|
|
1587
1590
|
break;
|
|
1588
1591
|
}
|
|
1589
|
-
holders = (_tempOrder$holder = tempOrder.holder)
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
+
holders = ((_tempOrder$holder = tempOrder.holder) === null || _tempOrder$holder === void 0 ? void 0 : _tempOrder$holder.form_record) || [];
|
|
1593
|
+
orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
|
|
1594
|
+
console.log('[BaseSales.applyDiscountConfig.calcDiscount]');
|
|
1592
1595
|
result = rulesModule.calcDiscount({
|
|
1593
1596
|
productList: tempOrder.products,
|
|
1594
1597
|
discountList: nextDiscountList,
|
|
1595
1598
|
holders: holders,
|
|
1596
|
-
isFormSubject:
|
|
1597
|
-
|
|
1599
|
+
isFormSubject: function isFormSubject(product) {
|
|
1600
|
+
return resolveIsFormSubject(tempOrder, product);
|
|
1601
|
+
},
|
|
1602
|
+
orderTotalAmount: orderTotalAmount
|
|
1598
1603
|
}) || {
|
|
1599
1604
|
productList: tempOrder.products,
|
|
1600
1605
|
discountList: nextDiscountList
|
|
@@ -1603,22 +1608,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1603
1608
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
1604
1609
|
}
|
|
1605
1610
|
_iterator = _createForOfIteratorHelper(tempOrder.products || []);
|
|
1606
|
-
_context15.prev =
|
|
1611
|
+
_context15.prev = 47;
|
|
1607
1612
|
_iterator.s();
|
|
1608
|
-
case
|
|
1613
|
+
case 49:
|
|
1609
1614
|
if ((_step = _iterator.n()).done) {
|
|
1610
|
-
_context15.next =
|
|
1615
|
+
_context15.next = 64;
|
|
1611
1616
|
break;
|
|
1612
1617
|
}
|
|
1613
1618
|
product = _step.value;
|
|
1614
1619
|
productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
|
|
1615
1620
|
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;
|
|
1616
1621
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
1617
|
-
_context15.next =
|
|
1622
|
+
_context15.next = 55;
|
|
1618
1623
|
break;
|
|
1619
1624
|
}
|
|
1620
|
-
return _context15.abrupt("continue",
|
|
1621
|
-
case
|
|
1625
|
+
return _context15.abrupt("continue", 62);
|
|
1626
|
+
case 55:
|
|
1622
1627
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
1623
1628
|
return sum + Number(pd.amount || 0);
|
|
1624
1629
|
}, 0);
|
|
@@ -1634,58 +1639,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1634
1639
|
mainPrice: newMainSellingPrice,
|
|
1635
1640
|
bundle: product.product_bundle
|
|
1636
1641
|
});
|
|
1637
|
-
case 60:
|
|
1638
|
-
_context15.next = 47;
|
|
1639
|
-
break;
|
|
1640
1642
|
case 62:
|
|
1641
|
-
_context15.next =
|
|
1643
|
+
_context15.next = 49;
|
|
1642
1644
|
break;
|
|
1643
1645
|
case 64:
|
|
1644
|
-
_context15.
|
|
1645
|
-
|
|
1646
|
+
_context15.next = 69;
|
|
1647
|
+
break;
|
|
1648
|
+
case 66:
|
|
1649
|
+
_context15.prev = 66;
|
|
1650
|
+
_context15.t0 = _context15["catch"](47);
|
|
1646
1651
|
_iterator.e(_context15.t0);
|
|
1647
|
-
case
|
|
1648
|
-
_context15.prev =
|
|
1652
|
+
case 69:
|
|
1653
|
+
_context15.prev = 69;
|
|
1649
1654
|
_iterator.f();
|
|
1650
|
-
return _context15.finish(
|
|
1651
|
-
case
|
|
1655
|
+
return _context15.finish(69);
|
|
1656
|
+
case 72:
|
|
1652
1657
|
if (!result.discountList) {
|
|
1653
|
-
_context15.next =
|
|
1658
|
+
_context15.next = 78;
|
|
1654
1659
|
break;
|
|
1655
1660
|
}
|
|
1656
1661
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
1657
1662
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1658
|
-
_context15.next =
|
|
1663
|
+
_context15.next = 77;
|
|
1659
1664
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1660
|
-
case
|
|
1665
|
+
case 77:
|
|
1661
1666
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
1662
1667
|
return discount.isSelected;
|
|
1663
1668
|
});
|
|
1664
|
-
case
|
|
1665
|
-
_context15.next =
|
|
1669
|
+
case 78:
|
|
1670
|
+
_context15.next = 80;
|
|
1666
1671
|
return this.store.order.recalculateSummary({
|
|
1667
1672
|
createIfMissing: true
|
|
1668
1673
|
});
|
|
1669
|
-
case
|
|
1674
|
+
case 80:
|
|
1670
1675
|
summary = _context15.sent;
|
|
1671
1676
|
this.store.order.persistTempOrder();
|
|
1672
|
-
_context15.next =
|
|
1677
|
+
_context15.next = 84;
|
|
1673
1678
|
return this.effectsEmit('onDiscountApplied', {
|
|
1674
1679
|
productList: tempOrder.products || [],
|
|
1675
1680
|
discountList: nextDiscountList,
|
|
1676
1681
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
1677
1682
|
tempOrder: tempOrder
|
|
1678
1683
|
});
|
|
1679
|
-
case
|
|
1684
|
+
case 84:
|
|
1680
1685
|
return _context15.abrupt("return", {
|
|
1681
1686
|
productList: tempOrder.products || [],
|
|
1682
1687
|
discountList: nextDiscountList
|
|
1683
1688
|
});
|
|
1684
|
-
case
|
|
1689
|
+
case 85:
|
|
1685
1690
|
case "end":
|
|
1686
1691
|
return _context15.stop();
|
|
1687
1692
|
}
|
|
1688
|
-
}, _callee15, this, [[
|
|
1693
|
+
}, _callee15, this, [[47, 66, 69, 72]]);
|
|
1689
1694
|
}));
|
|
1690
1695
|
function loadDiscountConfig(_x10) {
|
|
1691
1696
|
return _loadDiscountConfig.apply(this, arguments);
|
|
@@ -1697,7 +1702,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1697
1702
|
value: function () {
|
|
1698
1703
|
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(cb) {
|
|
1699
1704
|
var _discountModule$getOr2, _discountModule$getDi3;
|
|
1700
|
-
var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _tempOrder$
|
|
1705
|
+
var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _tempOrder$holder2, _orderStore$summary2, holders, orderTotalAmount;
|
|
1701
1706
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1702
1707
|
while (1) switch (_context16.prev = _context16.next) {
|
|
1703
1708
|
case 0:
|
|
@@ -1722,31 +1727,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1722
1727
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1723
1728
|
case 12:
|
|
1724
1729
|
if (!rulesModule) {
|
|
1725
|
-
_context16.next =
|
|
1730
|
+
_context16.next = 25;
|
|
1726
1731
|
break;
|
|
1727
1732
|
}
|
|
1728
|
-
holders = (_tempOrder$
|
|
1729
|
-
|
|
1730
|
-
|
|
1733
|
+
holders = ((_tempOrder$holder2 = tempOrder.holder) === null || _tempOrder$holder2 === void 0 ? void 0 : _tempOrder$holder2.form_record) || [];
|
|
1734
|
+
orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
|
|
1735
|
+
console.log('[BaseSales.bestDiscount.calcDiscount]');
|
|
1731
1736
|
result = rulesModule.calcDiscount({
|
|
1732
1737
|
productList: tempOrder.products,
|
|
1733
1738
|
discountList: nextDiscountList,
|
|
1734
1739
|
holders: holders,
|
|
1735
|
-
isFormSubject:
|
|
1736
|
-
|
|
1740
|
+
isFormSubject: function isFormSubject(product) {
|
|
1741
|
+
return resolveIsFormSubject(tempOrder, product);
|
|
1742
|
+
},
|
|
1743
|
+
orderTotalAmount: orderTotalAmount
|
|
1737
1744
|
}) || result;
|
|
1738
1745
|
if (result.productList) {
|
|
1739
1746
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
1740
1747
|
}
|
|
1741
1748
|
if (!result.discountList) {
|
|
1742
|
-
_context16.next =
|
|
1749
|
+
_context16.next = 25;
|
|
1743
1750
|
break;
|
|
1744
1751
|
}
|
|
1745
1752
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
1746
1753
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1747
|
-
_context16.next =
|
|
1754
|
+
_context16.next = 23;
|
|
1748
1755
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1749
|
-
case
|
|
1756
|
+
case 23:
|
|
1750
1757
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
1751
1758
|
return discount.isSelected;
|
|
1752
1759
|
});
|
|
@@ -1754,16 +1761,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1754
1761
|
productList: tempOrder.products,
|
|
1755
1762
|
discountList: nextDiscountList
|
|
1756
1763
|
};
|
|
1757
|
-
case
|
|
1758
|
-
_context16.next =
|
|
1764
|
+
case 25:
|
|
1765
|
+
_context16.next = 27;
|
|
1759
1766
|
return this.store.order.recalculateSummary({
|
|
1760
1767
|
createIfMissing: true
|
|
1761
1768
|
});
|
|
1762
|
-
case
|
|
1769
|
+
case 27:
|
|
1763
1770
|
this.store.order.persistTempOrder();
|
|
1764
1771
|
cb === null || cb === void 0 || cb(result);
|
|
1765
1772
|
return _context16.abrupt("return", result);
|
|
1766
|
-
case
|
|
1773
|
+
case 30:
|
|
1767
1774
|
case "end":
|
|
1768
1775
|
return _context16.stop();
|
|
1769
1776
|
}
|
|
@@ -1834,7 +1841,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1834
1841
|
key: "setDiscountSelected",
|
|
1835
1842
|
value: function () {
|
|
1836
1843
|
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
1837
|
-
var _tempOrder$
|
|
1844
|
+
var _tempOrder$holder3, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator3, _step3, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
1838
1845
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1839
1846
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1840
1847
|
case 0:
|
|
@@ -1857,19 +1864,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1857
1864
|
orderStore = this.store.order.store || {};
|
|
1858
1865
|
discountModule = orderStore.discount;
|
|
1859
1866
|
rulesModule = orderStore.rules;
|
|
1860
|
-
holders = (_tempOrder$
|
|
1861
|
-
form_record_id: tempOrder.holder.form_record_id
|
|
1862
|
-
}] : [];
|
|
1867
|
+
holders = ((_tempOrder$holder3 = tempOrder.holder) === null || _tempOrder$holder3 === void 0 ? void 0 : _tempOrder$holder3.form_record) || [];
|
|
1863
1868
|
nextDiscountList = updated;
|
|
1864
1869
|
_context18.next = 14;
|
|
1865
1870
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
1866
1871
|
case 14:
|
|
1867
1872
|
if (rulesModule) {
|
|
1873
|
+
orderTotalAmount = Number(((_orderStore$summary3 = orderStore.summary) === null || _orderStore$summary3 === void 0 ? void 0 : _orderStore$summary3.total_amount) || 0);
|
|
1874
|
+
console.log('[BaseSales.setDiscountSelected.calcDiscount]');
|
|
1868
1875
|
result = rulesModule.calcDiscount({
|
|
1869
1876
|
productList: tempOrder.products,
|
|
1870
1877
|
discountList: updated,
|
|
1871
1878
|
holders: holders,
|
|
1872
|
-
isFormSubject:
|
|
1879
|
+
isFormSubject: function isFormSubject(product) {
|
|
1880
|
+
return resolveIsFormSubject(tempOrder, product);
|
|
1881
|
+
},
|
|
1882
|
+
orderTotalAmount: orderTotalAmount
|
|
1873
1883
|
}, {
|
|
1874
1884
|
discountId: params.discountId,
|
|
1875
1885
|
isSelected: params.isSelected
|
|
@@ -1895,6 +1905,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1895
1905
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
1896
1906
|
d.isSelected = false;
|
|
1897
1907
|
d.isManualSelect = true;
|
|
1908
|
+
d.appliedProductDetails = [];
|
|
1898
1909
|
}
|
|
1899
1910
|
}
|
|
1900
1911
|
} catch (err) {
|
|
@@ -1910,28 +1921,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1910
1921
|
}).map(function (d) {
|
|
1911
1922
|
return d.id;
|
|
1912
1923
|
}));
|
|
1924
|
+
filterSelectedDiscountDetails = function filterSelectedDiscountDetails(discountList) {
|
|
1925
|
+
return (discountList || []).filter(function (pd) {
|
|
1926
|
+
var _pd$discount$resource, _pd$discount;
|
|
1927
|
+
var rid = (_pd$discount$resource = (_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) !== null && _pd$discount$resource !== void 0 ? _pd$discount$resource : pd.id;
|
|
1928
|
+
return rid != null && selectedResourceIds.has(rid);
|
|
1929
|
+
});
|
|
1930
|
+
};
|
|
1913
1931
|
_iterator3 = _createForOfIteratorHelper(tempOrder.products);
|
|
1914
|
-
_context18.prev =
|
|
1932
|
+
_context18.prev = 18;
|
|
1915
1933
|
_iterator3.s();
|
|
1916
|
-
case
|
|
1934
|
+
case 20:
|
|
1917
1935
|
if ((_step3 = _iterator3.n()).done) {
|
|
1918
|
-
_context18.next =
|
|
1936
|
+
_context18.next = 37;
|
|
1919
1937
|
break;
|
|
1920
1938
|
}
|
|
1921
1939
|
product = _step3.value;
|
|
1922
1940
|
productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
|
|
1923
1941
|
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;
|
|
1924
1942
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
1925
|
-
_context18.next =
|
|
1943
|
+
_context18.next = 26;
|
|
1926
1944
|
break;
|
|
1927
1945
|
}
|
|
1928
|
-
return _context18.abrupt("continue",
|
|
1929
|
-
case
|
|
1930
|
-
product.discount_list = (product.discount_list
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1946
|
+
return _context18.abrupt("continue", 35);
|
|
1947
|
+
case 26:
|
|
1948
|
+
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
1949
|
+
if (Array.isArray(product.product_bundle)) {
|
|
1950
|
+
product.product_bundle = product.product_bundle.map(function (bundle) {
|
|
1951
|
+
var _ref18, _bundle$original_pric;
|
|
1952
|
+
var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
|
|
1953
|
+
var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
|
|
1954
|
+
var restoredBundlePrice = (_ref18 = (_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 && _ref18 !== void 0 ? _ref18 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
|
|
1955
|
+
return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
|
|
1956
|
+
price: restoredBundlePrice,
|
|
1957
|
+
bundle_selling_price: restoredBundlePrice
|
|
1958
|
+
} : {}), {}, {
|
|
1959
|
+
discount_list: nextBundleDiscountList
|
|
1960
|
+
});
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1935
1963
|
|
|
1936
1964
|
// 券作用于 source(不含 option、不含 bundle);算出新 source 折后价后补回 options
|
|
1937
1965
|
// 写入含 option 的 main_product_selling_price,再合成 composite 回写 selling_price。
|
|
@@ -1950,33 +1978,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1950
1978
|
mainPrice: newMainSellingPrice,
|
|
1951
1979
|
bundle: product.product_bundle
|
|
1952
1980
|
});
|
|
1953
|
-
case 33:
|
|
1954
|
-
_context18.next = 19;
|
|
1955
|
-
break;
|
|
1956
1981
|
case 35:
|
|
1957
|
-
_context18.next =
|
|
1982
|
+
_context18.next = 20;
|
|
1958
1983
|
break;
|
|
1959
1984
|
case 37:
|
|
1960
|
-
_context18.
|
|
1961
|
-
|
|
1985
|
+
_context18.next = 42;
|
|
1986
|
+
break;
|
|
1987
|
+
case 39:
|
|
1988
|
+
_context18.prev = 39;
|
|
1989
|
+
_context18.t0 = _context18["catch"](18);
|
|
1962
1990
|
_iterator3.e(_context18.t0);
|
|
1963
|
-
case
|
|
1964
|
-
_context18.prev =
|
|
1991
|
+
case 42:
|
|
1992
|
+
_context18.prev = 42;
|
|
1965
1993
|
_iterator3.f();
|
|
1966
|
-
return _context18.finish(
|
|
1967
|
-
case
|
|
1994
|
+
return _context18.finish(42);
|
|
1995
|
+
case 45:
|
|
1968
1996
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1969
|
-
_context18.next =
|
|
1997
|
+
_context18.next = 48;
|
|
1970
1998
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1971
|
-
case
|
|
1999
|
+
case 48:
|
|
1972
2000
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1973
2001
|
return d.isSelected;
|
|
1974
2002
|
});
|
|
1975
|
-
_context18.next =
|
|
2003
|
+
_context18.next = 51;
|
|
1976
2004
|
return this.store.order.recalculateSummary({
|
|
1977
2005
|
createIfMissing: true
|
|
1978
2006
|
});
|
|
1979
|
-
case
|
|
2007
|
+
case 51:
|
|
1980
2008
|
this.store.order.persistTempOrder();
|
|
1981
2009
|
this.effectsEmit('onDiscountApplied', {
|
|
1982
2010
|
productList: tempOrder.products,
|
|
@@ -1984,17 +2012,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1984
2012
|
selectedDiscountList: tempOrder.discount_list,
|
|
1985
2013
|
tempOrder: tempOrder
|
|
1986
2014
|
});
|
|
1987
|
-
_context18.next =
|
|
2015
|
+
_context18.next = 58;
|
|
1988
2016
|
break;
|
|
1989
|
-
case
|
|
1990
|
-
_context18.prev =
|
|
2017
|
+
case 55:
|
|
2018
|
+
_context18.prev = 55;
|
|
1991
2019
|
_context18.t1 = _context18["catch"](0);
|
|
1992
2020
|
throw _context18.t1;
|
|
1993
|
-
case
|
|
2021
|
+
case 58:
|
|
1994
2022
|
case "end":
|
|
1995
2023
|
return _context18.stop();
|
|
1996
2024
|
}
|
|
1997
|
-
}, _callee18, this, [[0,
|
|
2025
|
+
}, _callee18, this, [[0, 55], [18, 39, 42, 45]]);
|
|
1998
2026
|
}));
|
|
1999
2027
|
function setDiscountSelected(_x14) {
|
|
2000
2028
|
return _setDiscountSelected.apply(this, arguments);
|
|
@@ -2105,7 +2133,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2105
2133
|
case 2:
|
|
2106
2134
|
// this.store.order.persistTempOrder();
|
|
2107
2135
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
2108
|
-
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2136
|
+
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2109
2137
|
cacheId: this.cacheId,
|
|
2110
2138
|
platform: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform,
|
|
2111
2139
|
businessCode: ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode) || ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.business_code),
|
|
@@ -2118,6 +2146,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2118
2146
|
paymentStatus: inferredPaymentStatus
|
|
2119
2147
|
} : {}), (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined ? {
|
|
2120
2148
|
smallTicketDataFlag: params.smallTicketDataFlag
|
|
2149
|
+
} : {}), (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
2150
|
+
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
2121
2151
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2122
2152
|
enhancePayload: params.enhancePayload
|
|
2123
2153
|
} : {});
|
|
@@ -2149,7 +2179,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2149
2179
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
2150
2180
|
case 2:
|
|
2151
2181
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
2152
|
-
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2182
|
+
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2153
2183
|
cacheId: this.cacheId,
|
|
2154
2184
|
platform: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform,
|
|
2155
2185
|
businessCode: ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.businessCode) || ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.business_code),
|
|
@@ -2161,6 +2191,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2161
2191
|
paymentStatus: inferredPaymentStatus
|
|
2162
2192
|
} : {}), (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined ? {
|
|
2163
2193
|
smallTicketDataFlag: params.smallTicketDataFlag
|
|
2194
|
+
} : {}), (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
2195
|
+
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
2164
2196
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2165
2197
|
enhancePayload: params.enhancePayload
|
|
2166
2198
|
} : {});
|
|
@@ -2260,8 +2292,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2260
2292
|
key: "syncPaymentsToOrder",
|
|
2261
2293
|
value: function () {
|
|
2262
2294
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
2263
|
-
var
|
|
2264
|
-
var businessCode, channel, syncParams, syncState, payments, syncResult;
|
|
2295
|
+
var _ref19, _params$businessCode, _this$otherParams18, _this$otherParams19, _params$channel;
|
|
2296
|
+
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
2265
2297
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2266
2298
|
while (1) switch (_context24.prev = _context24.next) {
|
|
2267
2299
|
case 0:
|
|
@@ -2271,7 +2303,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2271
2303
|
}
|
|
2272
2304
|
throw new Error('order 模块未初始化');
|
|
2273
2305
|
case 2:
|
|
2274
|
-
businessCode = (
|
|
2306
|
+
businessCode = (_ref19 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) !== null && _ref19 !== void 0 ? _ref19 : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code;
|
|
2275
2307
|
channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
|
|
2276
2308
|
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
|
|
2277
2309
|
businessCode: businessCode
|
|
@@ -2280,40 +2312,59 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2280
2312
|
} : {});
|
|
2281
2313
|
syncState = this.store.order.getOrderSyncState();
|
|
2282
2314
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
2283
|
-
_context24.next =
|
|
2315
|
+
_context24.next = 9;
|
|
2284
2316
|
break;
|
|
2285
2317
|
}
|
|
2318
|
+
this.queueLatestAutoPaymentSync();
|
|
2286
2319
|
return _context24.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
2287
|
-
case
|
|
2320
|
+
case 9:
|
|
2288
2321
|
payments = params.payments || [];
|
|
2289
|
-
_context24.next =
|
|
2322
|
+
_context24.next = 12;
|
|
2290
2323
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
2291
2324
|
payments: payments,
|
|
2292
2325
|
params: syncParams,
|
|
2293
2326
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
2294
2327
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2295
2328
|
});
|
|
2296
|
-
case
|
|
2297
|
-
_context24.prev =
|
|
2298
|
-
_context24.next =
|
|
2329
|
+
case 12:
|
|
2330
|
+
_context24.prev = 12;
|
|
2331
|
+
_context24.next = 15;
|
|
2299
2332
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
2300
|
-
case
|
|
2333
|
+
case 15:
|
|
2301
2334
|
syncResult = _context24.sent;
|
|
2302
|
-
|
|
2303
|
-
|
|
2335
|
+
latestPayments = this.store.order.getOrderPayments();
|
|
2336
|
+
amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
2337
|
+
orderSnapshot = this.store.order.getOrderSnapshot();
|
|
2338
|
+
syncPayload = {
|
|
2304
2339
|
ok: true,
|
|
2305
2340
|
syncResult: syncResult,
|
|
2306
|
-
payments:
|
|
2341
|
+
payments: latestPayments,
|
|
2307
2342
|
params: syncParams,
|
|
2308
|
-
amountSnapshot:
|
|
2309
|
-
orderSnapshot:
|
|
2310
|
-
|
|
2311
|
-
|
|
2343
|
+
amountSnapshot: amountSnapshot,
|
|
2344
|
+
orderSnapshot: orderSnapshot,
|
|
2345
|
+
isFullyPaid: syncResult.isFullyPaid,
|
|
2346
|
+
isOrderFullyPaid: syncResult.isOrderFullyPaid,
|
|
2347
|
+
isDepositFullyPaid: syncResult.isDepositFullyPaid,
|
|
2348
|
+
paymentStage: syncResult.paymentStage,
|
|
2349
|
+
depositAmount: syncResult.depositAmount,
|
|
2350
|
+
orderExpectedAmount: syncResult.orderExpectedAmount
|
|
2351
|
+
};
|
|
2352
|
+
_context24.next = 22;
|
|
2353
|
+
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
|
|
2354
|
+
case 22:
|
|
2355
|
+
if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
|
|
2356
|
+
_context24.next = 25;
|
|
2357
|
+
break;
|
|
2358
|
+
}
|
|
2359
|
+
_context24.next = 25;
|
|
2360
|
+
return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
|
|
2361
|
+
case 25:
|
|
2362
|
+
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2312
2363
|
return _context24.abrupt("return", syncResult);
|
|
2313
|
-
case
|
|
2314
|
-
_context24.prev =
|
|
2315
|
-
_context24.t0 = _context24["catch"](
|
|
2316
|
-
_context24.next =
|
|
2364
|
+
case 29:
|
|
2365
|
+
_context24.prev = 29;
|
|
2366
|
+
_context24.t0 = _context24["catch"](12);
|
|
2367
|
+
_context24.next = 33;
|
|
2317
2368
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
2318
2369
|
ok: false,
|
|
2319
2370
|
error: _context24.t0,
|
|
@@ -2322,13 +2373,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2322
2373
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
2323
2374
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2324
2375
|
});
|
|
2325
|
-
case
|
|
2376
|
+
case 33:
|
|
2377
|
+
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2326
2378
|
throw _context24.t0;
|
|
2327
|
-
case
|
|
2379
|
+
case 35:
|
|
2328
2380
|
case "end":
|
|
2329
2381
|
return _context24.stop();
|
|
2330
2382
|
}
|
|
2331
|
-
}, _callee24, this, [[
|
|
2383
|
+
}, _callee24, this, [[12, 29]]);
|
|
2332
2384
|
}));
|
|
2333
2385
|
function syncPaymentsToOrder(_x20) {
|
|
2334
2386
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
@@ -2350,17 +2402,120 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2350
2402
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2351
2403
|
return this.store.order.setOrderPayments(payments);
|
|
2352
2404
|
}
|
|
2353
|
-
|
|
2354
|
-
|
|
2405
|
+
}, {
|
|
2406
|
+
key: "getPaymentStatusForSync",
|
|
2407
|
+
value: function getPaymentStatusForSync(payments) {
|
|
2408
|
+
var order = this.store.order;
|
|
2409
|
+
if (!order) throw new Error('order 模块未初始化');
|
|
2410
|
+
var completion = order.getPaymentCompletion(payments);
|
|
2411
|
+
return completion.isOrderFullyPaid ? 'paid' : 'partially_paid';
|
|
2412
|
+
}
|
|
2413
|
+
}, {
|
|
2414
|
+
key: "queueLatestAutoPaymentSync",
|
|
2415
|
+
value: function queueLatestAutoPaymentSync() {
|
|
2416
|
+
this.queuedAutoPaymentSync = true;
|
|
2417
|
+
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
2418
|
+
}
|
|
2419
|
+
}, {
|
|
2420
|
+
key: "scheduleQueuedAutoPaymentSyncFlush",
|
|
2421
|
+
value: function scheduleQueuedAutoPaymentSyncFlush() {
|
|
2422
|
+
var _this8 = this;
|
|
2423
|
+
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
|
|
2424
|
+
if (!this.queuedAutoPaymentSync) return;
|
|
2425
|
+
if (this.autoPaymentSyncTimer) return;
|
|
2426
|
+
this.autoPaymentSyncTimer = setTimeout(function () {
|
|
2427
|
+
_this8.autoPaymentSyncTimer = null;
|
|
2428
|
+
void _this8.flushQueuedAutoPaymentSync();
|
|
2429
|
+
}, delay);
|
|
2430
|
+
}
|
|
2431
|
+
}, {
|
|
2432
|
+
key: "flushQueuedAutoPaymentSync",
|
|
2433
|
+
value: function () {
|
|
2434
|
+
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
2435
|
+
var payments;
|
|
2436
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2437
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2438
|
+
case 0:
|
|
2439
|
+
if (this.store.order) {
|
|
2440
|
+
_context25.next = 2;
|
|
2441
|
+
break;
|
|
2442
|
+
}
|
|
2443
|
+
return _context25.abrupt("return");
|
|
2444
|
+
case 2:
|
|
2445
|
+
if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
|
|
2446
|
+
_context25.next = 4;
|
|
2447
|
+
break;
|
|
2448
|
+
}
|
|
2449
|
+
return _context25.abrupt("return");
|
|
2450
|
+
case 4:
|
|
2451
|
+
if (!(this.store.order.getOrderSyncState() === 'submitting')) {
|
|
2452
|
+
_context25.next = 7;
|
|
2453
|
+
break;
|
|
2454
|
+
}
|
|
2455
|
+
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
2456
|
+
return _context25.abrupt("return");
|
|
2457
|
+
case 7:
|
|
2458
|
+
this.autoPaymentSyncFlushing = true;
|
|
2459
|
+
_context25.prev = 8;
|
|
2460
|
+
case 9:
|
|
2461
|
+
if (!this.queuedAutoPaymentSync) {
|
|
2462
|
+
_context25.next = 18;
|
|
2463
|
+
break;
|
|
2464
|
+
}
|
|
2465
|
+
this.queuedAutoPaymentSync = false;
|
|
2466
|
+
payments = this.store.order.getOrderPayments();
|
|
2467
|
+
if (payments.length) {
|
|
2468
|
+
_context25.next = 14;
|
|
2469
|
+
break;
|
|
2470
|
+
}
|
|
2471
|
+
return _context25.abrupt("continue", 9);
|
|
2472
|
+
case 14:
|
|
2473
|
+
_context25.next = 16;
|
|
2474
|
+
return this.syncPaymentsToOrder({
|
|
2475
|
+
payments: payments,
|
|
2476
|
+
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
2477
|
+
submitWhenPaid: true,
|
|
2478
|
+
smallTicketDataFlag: 1
|
|
2479
|
+
});
|
|
2480
|
+
case 16:
|
|
2481
|
+
_context25.next = 9;
|
|
2482
|
+
break;
|
|
2483
|
+
case 18:
|
|
2484
|
+
_context25.next = 23;
|
|
2485
|
+
break;
|
|
2486
|
+
case 20:
|
|
2487
|
+
_context25.prev = 20;
|
|
2488
|
+
_context25.t0 = _context25["catch"](8);
|
|
2489
|
+
this.logError('queued auto sync payments failed', {
|
|
2490
|
+
error: _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0)
|
|
2491
|
+
});
|
|
2492
|
+
case 23:
|
|
2493
|
+
_context25.prev = 23;
|
|
2494
|
+
this.autoPaymentSyncFlushing = false;
|
|
2495
|
+
if (this.queuedAutoPaymentSync) {
|
|
2496
|
+
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2497
|
+
}
|
|
2498
|
+
return _context25.finish(23);
|
|
2499
|
+
case 27:
|
|
2500
|
+
case "end":
|
|
2501
|
+
return _context25.stop();
|
|
2502
|
+
}
|
|
2503
|
+
}, _callee25, this, [[8, 20, 23, 27]]);
|
|
2504
|
+
}));
|
|
2505
|
+
function flushQueuedAutoPaymentSync() {
|
|
2506
|
+
return _flushQueuedAutoPaymentSync.apply(this, arguments);
|
|
2507
|
+
}
|
|
2508
|
+
return flushQueuedAutoPaymentSync;
|
|
2509
|
+
}() /** 追加单个支付项到当前订单。 */
|
|
2355
2510
|
}, {
|
|
2356
2511
|
key: "addOrderPayment",
|
|
2357
2512
|
value: function addOrderPayment(payment) {
|
|
2358
2513
|
var _this$otherParams20,
|
|
2359
2514
|
_paymentRecord$paymen,
|
|
2360
2515
|
_paymentRecord$create,
|
|
2361
|
-
|
|
2516
|
+
_ref20,
|
|
2362
2517
|
_paymentRecord$origin,
|
|
2363
|
-
|
|
2518
|
+
_this9 = this;
|
|
2364
2519
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2365
2520
|
var paymentRecord = payment;
|
|
2366
2521
|
var paymentAmount = new Decimal(paymentRecord.amount || 0);
|
|
@@ -2382,7 +2537,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2382
2537
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
2383
2538
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
2384
2539
|
var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
|
|
2385
|
-
var calculatedServiceFee = serviceCharge ? new Decimal((
|
|
2540
|
+
var calculatedServiceFee = serviceCharge ? new Decimal((_ref20 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref20 !== void 0 ? _ref20 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
|
|
2386
2541
|
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, paymentRecord), calculatedServiceFee !== undefined ? {
|
|
2387
2542
|
service_fee: calculatedServiceFee
|
|
2388
2543
|
} : {}), {}, {
|
|
@@ -2392,19 +2547,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2392
2547
|
}));
|
|
2393
2548
|
var amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
2394
2549
|
var syncState = this.store.order.getOrderSyncState();
|
|
2395
|
-
if (amountSnapshot
|
|
2396
|
-
|
|
2550
|
+
if (amountSnapshot) {
|
|
2551
|
+
if (syncState === 'submitting') {
|
|
2552
|
+
this.queueLatestAutoPaymentSync();
|
|
2553
|
+
return payments;
|
|
2554
|
+
}
|
|
2397
2555
|
void this.syncPaymentsToOrder({
|
|
2398
2556
|
payments: payments,
|
|
2399
|
-
paymentStatus:
|
|
2557
|
+
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
2400
2558
|
submitWhenPaid: true,
|
|
2401
2559
|
smallTicketDataFlag: 1
|
|
2402
2560
|
}).catch(function (error) {
|
|
2403
|
-
|
|
2561
|
+
_this9.logError('auto sync payments failed', {
|
|
2404
2562
|
error: error instanceof Error ? error.message : String(error)
|
|
2405
2563
|
});
|
|
2406
2564
|
});
|
|
2407
|
-
}
|
|
2565
|
+
}
|
|
2408
2566
|
return payments;
|
|
2409
2567
|
}
|
|
2410
2568
|
|
|
@@ -2427,9 +2585,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2427
2585
|
/** 覆盖 wallet pass 支付项,同时保留普通支付项。 */
|
|
2428
2586
|
}, {
|
|
2429
2587
|
key: "updateVoucherOrderPayments",
|
|
2430
|
-
value: function updateVoucherOrderPayments(payments) {
|
|
2588
|
+
value: function updateVoucherOrderPayments(payments, options) {
|
|
2589
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2590
|
+
return this.store.order.updateVoucherOrderPayments(payments, options);
|
|
2591
|
+
}
|
|
2592
|
+
}, {
|
|
2593
|
+
key: "confirmPendingVoucherPayments",
|
|
2594
|
+
value: function confirmPendingVoucherPayments() {
|
|
2431
2595
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2432
|
-
return this.store.order.
|
|
2596
|
+
return this.store.order.confirmPendingVoucherPayments();
|
|
2597
|
+
}
|
|
2598
|
+
}, {
|
|
2599
|
+
key: "discardPendingVoucherPayments",
|
|
2600
|
+
value: function discardPendingVoucherPayments() {
|
|
2601
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2602
|
+
return this.store.order.discardPendingVoucherPayments();
|
|
2433
2603
|
}
|
|
2434
2604
|
}, {
|
|
2435
2605
|
key: "getWalletProductList",
|
|
@@ -2492,20 +2662,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2492
2662
|
}, {
|
|
2493
2663
|
key: "initWalletData",
|
|
2494
2664
|
value: function () {
|
|
2495
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2496
|
-
var _params$order_wait_pa,
|
|
2665
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2666
|
+
var _params$order_wait_pa, _ref21, _tempOrder$is_price_i;
|
|
2497
2667
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
2498
|
-
return _regeneratorRuntime().wrap(function
|
|
2499
|
-
while (1) switch (
|
|
2668
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2669
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2500
2670
|
case 0:
|
|
2501
2671
|
if (this.store.order) {
|
|
2502
|
-
|
|
2672
|
+
_context26.next = 2;
|
|
2503
2673
|
break;
|
|
2504
2674
|
}
|
|
2505
2675
|
throw new Error('order 模块未初始化');
|
|
2506
2676
|
case 2:
|
|
2507
2677
|
if (this.store.payment) {
|
|
2508
|
-
|
|
2678
|
+
_context26.next = 4;
|
|
2509
2679
|
break;
|
|
2510
2680
|
}
|
|
2511
2681
|
throw new Error('payment 模块未初始化');
|
|
@@ -2514,10 +2684,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2514
2684
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
2515
2685
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
2516
2686
|
if (!(!tempOrder || !amount)) {
|
|
2517
|
-
|
|
2687
|
+
_context26.next = 9;
|
|
2518
2688
|
break;
|
|
2519
2689
|
}
|
|
2520
|
-
return
|
|
2690
|
+
return _context26.abrupt("return", {
|
|
2521
2691
|
walletRecommendList: [],
|
|
2522
2692
|
userIdentificationCodes: [],
|
|
2523
2693
|
transformList: [],
|
|
@@ -2536,15 +2706,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2536
2706
|
},
|
|
2537
2707
|
products: this.getWalletProductList(),
|
|
2538
2708
|
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),
|
|
2539
|
-
is_price_include_tax: (
|
|
2709
|
+
is_price_include_tax: (_ref21 = (_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 && _ref21 !== void 0 ? _ref21 : 1
|
|
2540
2710
|
}, snapshot.identity.orderId ? {
|
|
2541
2711
|
payment_order_id: String(snapshot.identity.orderId)
|
|
2542
2712
|
} : {});
|
|
2543
|
-
|
|
2713
|
+
_context26.next = 12;
|
|
2544
2714
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
2545
2715
|
case 12:
|
|
2546
|
-
result =
|
|
2547
|
-
|
|
2716
|
+
result = _context26.sent;
|
|
2717
|
+
_context26.next = 15;
|
|
2548
2718
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
2549
2719
|
orderId: snapshot.identity.orderId,
|
|
2550
2720
|
customerId: walletBusinessData.customer_id,
|
|
@@ -2556,12 +2726,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2556
2726
|
timestamp: Date.now()
|
|
2557
2727
|
});
|
|
2558
2728
|
case 15:
|
|
2559
|
-
return
|
|
2729
|
+
return _context26.abrupt("return", result);
|
|
2560
2730
|
case 16:
|
|
2561
2731
|
case "end":
|
|
2562
|
-
return
|
|
2732
|
+
return _context26.stop();
|
|
2563
2733
|
}
|
|
2564
|
-
},
|
|
2734
|
+
}, _callee26, this);
|
|
2565
2735
|
}));
|
|
2566
2736
|
function initWalletData(_x21) {
|
|
2567
2737
|
return _initWalletData.apply(this, arguments);
|
|
@@ -2590,35 +2760,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2590
2760
|
}, {
|
|
2591
2761
|
key: "getPaymentMethodsAsync",
|
|
2592
2762
|
value: (function () {
|
|
2593
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2763
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
2594
2764
|
var response, paymentMethods;
|
|
2595
|
-
return _regeneratorRuntime().wrap(function
|
|
2596
|
-
while (1) switch (
|
|
2765
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2766
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2597
2767
|
case 0:
|
|
2598
|
-
|
|
2599
|
-
|
|
2768
|
+
_context27.prev = 0;
|
|
2769
|
+
_context27.next = 3;
|
|
2600
2770
|
return this.request.get('/pay/custom-payment/all', {
|
|
2601
2771
|
filterPaymentMethods: true
|
|
2602
2772
|
}, {
|
|
2603
2773
|
osServer: true
|
|
2604
2774
|
});
|
|
2605
2775
|
case 3:
|
|
2606
|
-
response =
|
|
2776
|
+
response = _context27.sent;
|
|
2607
2777
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
2608
2778
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
2609
|
-
return
|
|
2779
|
+
return _context27.abrupt("return", this.getPaymentMethods());
|
|
2610
2780
|
case 9:
|
|
2611
|
-
|
|
2612
|
-
|
|
2781
|
+
_context27.prev = 9;
|
|
2782
|
+
_context27.t0 = _context27["catch"](0);
|
|
2613
2783
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
2614
|
-
error:
|
|
2784
|
+
error: _context27.t0 instanceof Error ? _context27.t0.message : String(_context27.t0)
|
|
2615
2785
|
});
|
|
2616
|
-
return
|
|
2786
|
+
return _context27.abrupt("return", this.getPaymentMethods());
|
|
2617
2787
|
case 13:
|
|
2618
2788
|
case "end":
|
|
2619
|
-
return
|
|
2789
|
+
return _context27.stop();
|
|
2620
2790
|
}
|
|
2621
|
-
},
|
|
2791
|
+
}, _callee27, this, [[0, 9]]);
|
|
2622
2792
|
}));
|
|
2623
2793
|
function getPaymentMethodsAsync() {
|
|
2624
2794
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -2666,47 +2836,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2666
2836
|
}, {
|
|
2667
2837
|
key: "sendCustomerPayLink",
|
|
2668
2838
|
value: (function () {
|
|
2669
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2670
|
-
var orderIds,
|
|
2671
|
-
return _regeneratorRuntime().wrap(function
|
|
2672
|
-
while (1) switch (
|
|
2839
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2840
|
+
var orderIds, _ref22, _ref23, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
2841
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2842
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2673
2843
|
case 0:
|
|
2674
2844
|
if (this.store.order) {
|
|
2675
|
-
|
|
2845
|
+
_context28.next = 2;
|
|
2676
2846
|
break;
|
|
2677
2847
|
}
|
|
2678
2848
|
throw new Error('order 模块未初始化');
|
|
2679
2849
|
case 2:
|
|
2680
2850
|
orderIds = params.order_ids || params.orderIds || [];
|
|
2681
2851
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
2682
|
-
|
|
2852
|
+
_context28.next = 11;
|
|
2683
2853
|
break;
|
|
2684
2854
|
}
|
|
2685
|
-
|
|
2855
|
+
_context28.next = 6;
|
|
2686
2856
|
return this.submitSalesOrder({
|
|
2687
2857
|
smallTicketDataFlag: 1
|
|
2688
2858
|
});
|
|
2689
2859
|
case 6:
|
|
2690
|
-
submitResult =
|
|
2691
|
-
orderId = (
|
|
2860
|
+
submitResult = _context28.sent;
|
|
2861
|
+
orderId = (_ref22 = (_ref23 = (_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 && _ref23 !== void 0 ? _ref23 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref22 !== void 0 ? _ref22 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
2692
2862
|
if (orderId) {
|
|
2693
|
-
|
|
2863
|
+
_context28.next = 10;
|
|
2694
2864
|
break;
|
|
2695
2865
|
}
|
|
2696
2866
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
2697
2867
|
case 10:
|
|
2698
2868
|
orderIds = [orderId];
|
|
2699
2869
|
case 11:
|
|
2700
|
-
return
|
|
2870
|
+
return _context28.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
2701
2871
|
emails: params.emails,
|
|
2702
2872
|
notify_action: params.notify_action,
|
|
2703
2873
|
order_ids: orderIds
|
|
2704
2874
|
}));
|
|
2705
2875
|
case 12:
|
|
2706
2876
|
case "end":
|
|
2707
|
-
return
|
|
2877
|
+
return _context28.stop();
|
|
2708
2878
|
}
|
|
2709
|
-
},
|
|
2879
|
+
}, _callee28, this);
|
|
2710
2880
|
}));
|
|
2711
2881
|
function sendCustomerPayLink(_x22) {
|
|
2712
2882
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
@@ -2721,27 +2891,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2721
2891
|
}, {
|
|
2722
2892
|
key: "calculateProductBookingPrice",
|
|
2723
2893
|
value: function () {
|
|
2724
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2894
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
2725
2895
|
var _params$customer_id;
|
|
2726
2896
|
var quotation, customerId, authoritativeProduct, product;
|
|
2727
|
-
return _regeneratorRuntime().wrap(function
|
|
2728
|
-
while (1) switch (
|
|
2897
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2898
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2729
2899
|
case 0:
|
|
2730
2900
|
quotation = this.store.quotation;
|
|
2731
2901
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
2732
|
-
|
|
2902
|
+
_context29.next = 4;
|
|
2733
2903
|
return this.loadProductForPriceQuery(params, customerId);
|
|
2734
2904
|
case 4:
|
|
2735
|
-
authoritativeProduct =
|
|
2905
|
+
authoritativeProduct = _context29.sent;
|
|
2736
2906
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
2737
|
-
|
|
2907
|
+
_context29.next = 8;
|
|
2738
2908
|
return this.loadQuotationForPriceQuery({
|
|
2739
2909
|
quotation: quotation,
|
|
2740
2910
|
customer_id: customerId,
|
|
2741
2911
|
channel: params.channel
|
|
2742
2912
|
});
|
|
2743
2913
|
case 8:
|
|
2744
|
-
return
|
|
2914
|
+
return _context29.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
2745
2915
|
product: product,
|
|
2746
2916
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
2747
2917
|
customer_id: customerId,
|
|
@@ -2749,9 +2919,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2749
2919
|
})));
|
|
2750
2920
|
case 9:
|
|
2751
2921
|
case "end":
|
|
2752
|
-
return
|
|
2922
|
+
return _context29.stop();
|
|
2753
2923
|
}
|
|
2754
|
-
},
|
|
2924
|
+
}, _callee29, this);
|
|
2755
2925
|
}));
|
|
2756
2926
|
function calculateProductBookingPrice(_x23) {
|
|
2757
2927
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
@@ -2761,7 +2931,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2761
2931
|
}, {
|
|
2762
2932
|
key: "getQuotationCustomerScopeInfo",
|
|
2763
2933
|
value: function getQuotationCustomerScopeInfo() {
|
|
2764
|
-
var
|
|
2934
|
+
var _this10 = this;
|
|
2765
2935
|
var quotation = this.store.quotation;
|
|
2766
2936
|
if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
|
|
2767
2937
|
return quotation.getQuotationCustomerScopeInfo();
|
|
@@ -2773,7 +2943,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2773
2943
|
}).map(function (item) {
|
|
2774
2944
|
var localSeen = new Set();
|
|
2775
2945
|
var customers = item.customer.filter(function (customer) {
|
|
2776
|
-
var customerId =
|
|
2946
|
+
var customerId = _this10.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
2777
2947
|
if (!customerId || localSeen.has(customerId)) return false;
|
|
2778
2948
|
localSeen.add(customerId);
|
|
2779
2949
|
if (!customerById.has(customerId)) customerById.set(customerId, customer);
|
|
@@ -2823,32 +2993,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2823
2993
|
}, {
|
|
2824
2994
|
key: "calculateProductBookingPrices",
|
|
2825
2995
|
value: function () {
|
|
2826
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2996
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(paramsList) {
|
|
2827
2997
|
var _paramsList$0$custome,
|
|
2828
2998
|
_paramsList$,
|
|
2829
|
-
|
|
2999
|
+
_this11 = this,
|
|
2830
3000
|
_paramsList$2;
|
|
2831
3001
|
var quotation, customerId, productMapsByGroup, groups;
|
|
2832
|
-
return _regeneratorRuntime().wrap(function
|
|
2833
|
-
while (1) switch (
|
|
3002
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3003
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2834
3004
|
case 0:
|
|
2835
3005
|
if (paramsList.length) {
|
|
2836
|
-
|
|
3006
|
+
_context31.next = 2;
|
|
2837
3007
|
break;
|
|
2838
3008
|
}
|
|
2839
|
-
return
|
|
3009
|
+
return _context31.abrupt("return", []);
|
|
2840
3010
|
case 2:
|
|
2841
3011
|
quotation = this.store.quotation;
|
|
2842
3012
|
customerId = (_paramsList$0$custome = (_paramsList$ = paramsList[0]) === null || _paramsList$ === void 0 ? void 0 : _paramsList$.customer_id) !== null && _paramsList$0$custome !== void 0 ? _paramsList$0$custome : this.getCurrentOrderCustomerId();
|
|
2843
3013
|
productMapsByGroup = new Map();
|
|
2844
3014
|
groups = new Map();
|
|
2845
3015
|
paramsList.forEach(function (params) {
|
|
2846
|
-
var
|
|
3016
|
+
var _this11$otherParams;
|
|
2847
3017
|
var product = params.product || {};
|
|
2848
|
-
var productId =
|
|
3018
|
+
var productId = _this11.getPriceQueryProductId(product);
|
|
2849
3019
|
if (productId === null) return;
|
|
2850
|
-
var schedule =
|
|
2851
|
-
var channel = params.channel || ((
|
|
3020
|
+
var schedule = _this11.getPriceQuerySchedule(params);
|
|
3021
|
+
var channel = params.channel || ((_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams.channel);
|
|
2852
3022
|
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
2853
3023
|
var group = groups.get(groupKey) || {
|
|
2854
3024
|
ids: new Set(),
|
|
@@ -2858,51 +3028,51 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2858
3028
|
group.ids.add(productId);
|
|
2859
3029
|
groups.set(groupKey, group);
|
|
2860
3030
|
});
|
|
2861
|
-
|
|
3031
|
+
_context31.next = 9;
|
|
2862
3032
|
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
2863
|
-
var
|
|
2864
|
-
var
|
|
2865
|
-
return _regeneratorRuntime().wrap(function
|
|
2866
|
-
while (1) switch (
|
|
3033
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(_ref24) {
|
|
3034
|
+
var _ref26, groupKey, group, productsById;
|
|
3035
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3036
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2867
3037
|
case 0:
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
return
|
|
3038
|
+
_ref26 = _slicedToArray(_ref24, 2), groupKey = _ref26[0], group = _ref26[1];
|
|
3039
|
+
_context30.next = 3;
|
|
3040
|
+
return _this11.loadProductsForPriceQuery({
|
|
2871
3041
|
ids: Array.from(group.ids),
|
|
2872
3042
|
schedule: group.schedule,
|
|
2873
3043
|
customerId: customerId,
|
|
2874
3044
|
channel: group.channel
|
|
2875
3045
|
});
|
|
2876
3046
|
case 3:
|
|
2877
|
-
productsById =
|
|
3047
|
+
productsById = _context30.sent;
|
|
2878
3048
|
productMapsByGroup.set(groupKey, productsById);
|
|
2879
3049
|
case 5:
|
|
2880
3050
|
case "end":
|
|
2881
|
-
return
|
|
3051
|
+
return _context30.stop();
|
|
2882
3052
|
}
|
|
2883
|
-
},
|
|
3053
|
+
}, _callee30);
|
|
2884
3054
|
}));
|
|
2885
3055
|
return function (_x25) {
|
|
2886
|
-
return
|
|
3056
|
+
return _ref25.apply(this, arguments);
|
|
2887
3057
|
};
|
|
2888
3058
|
}()));
|
|
2889
3059
|
case 9:
|
|
2890
|
-
|
|
3060
|
+
_context31.next = 11;
|
|
2891
3061
|
return this.loadQuotationForPriceQuery({
|
|
2892
3062
|
quotation: quotation,
|
|
2893
3063
|
customer_id: customerId,
|
|
2894
3064
|
channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
|
|
2895
3065
|
});
|
|
2896
3066
|
case 11:
|
|
2897
|
-
return
|
|
2898
|
-
var
|
|
3067
|
+
return _context31.abrupt("return", paramsList.map(function (params) {
|
|
3068
|
+
var _this11$otherParams2, _productMapsByGroup$g;
|
|
2899
3069
|
var productInput = params.product || {};
|
|
2900
|
-
var productId =
|
|
2901
|
-
var schedule =
|
|
2902
|
-
var channel = params.channel || ((
|
|
3070
|
+
var productId = _this11.getPriceQueryProductId(productInput);
|
|
3071
|
+
var schedule = _this11.getPriceQuerySchedule(params);
|
|
3072
|
+
var channel = params.channel || ((_this11$otherParams2 = _this11.otherParams) === null || _this11$otherParams2 === void 0 ? void 0 : _this11$otherParams2.channel);
|
|
2903
3073
|
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
2904
3074
|
var authoritativeProduct = productId === null ? null : ((_productMapsByGroup$g = productMapsByGroup.get(groupKey)) === null || _productMapsByGroup$g === void 0 ? void 0 : _productMapsByGroup$g.get(productId)) || null;
|
|
2905
|
-
var product =
|
|
3075
|
+
var product = _this11.mergeProductForPriceQuery(productInput, authoritativeProduct);
|
|
2906
3076
|
return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
2907
3077
|
product: product,
|
|
2908
3078
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
@@ -2912,9 +3082,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2912
3082
|
}));
|
|
2913
3083
|
case 12:
|
|
2914
3084
|
case "end":
|
|
2915
|
-
return
|
|
3085
|
+
return _context31.stop();
|
|
2916
3086
|
}
|
|
2917
|
-
},
|
|
3087
|
+
}, _callee31, this);
|
|
2918
3088
|
}));
|
|
2919
3089
|
function calculateProductBookingPrices(_x24) {
|
|
2920
3090
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
@@ -2924,42 +3094,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2924
3094
|
}, {
|
|
2925
3095
|
key: "addProductToOrder",
|
|
2926
3096
|
value: function () {
|
|
2927
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2928
|
-
var products;
|
|
2929
|
-
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2930
|
-
while (1) switch (_context31.prev = _context31.next) {
|
|
2931
|
-
case 0:
|
|
2932
|
-
_context31.prev = 0;
|
|
2933
|
-
if (this.store.order) {
|
|
2934
|
-
_context31.next = 3;
|
|
2935
|
-
break;
|
|
2936
|
-
}
|
|
2937
|
-
throw new Error('order 模块未初始化');
|
|
2938
|
-
case 3:
|
|
2939
|
-
_context31.next = 5;
|
|
2940
|
-
return this.store.order.addProductToOrder(product, booking);
|
|
2941
|
-
case 5:
|
|
2942
|
-
products = _context31.sent;
|
|
2943
|
-
return _context31.abrupt("return", products);
|
|
2944
|
-
case 9:
|
|
2945
|
-
_context31.prev = 9;
|
|
2946
|
-
_context31.t0 = _context31["catch"](0);
|
|
2947
|
-
throw _context31.t0;
|
|
2948
|
-
case 12:
|
|
2949
|
-
case "end":
|
|
2950
|
-
return _context31.stop();
|
|
2951
|
-
}
|
|
2952
|
-
}, _callee31, this, [[0, 9]]);
|
|
2953
|
-
}));
|
|
2954
|
-
function addProductToOrder(_x26, _x27) {
|
|
2955
|
-
return _addProductToOrder.apply(this, arguments);
|
|
2956
|
-
}
|
|
2957
|
-
return addProductToOrder;
|
|
2958
|
-
}()
|
|
2959
|
-
}, {
|
|
2960
|
-
key: "updateOrderProduct",
|
|
2961
|
-
value: function () {
|
|
2962
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3097
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(product, booking) {
|
|
2963
3098
|
var products;
|
|
2964
3099
|
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2965
3100
|
while (1) switch (_context32.prev = _context32.next) {
|
|
@@ -2972,7 +3107,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2972
3107
|
throw new Error('order 模块未初始化');
|
|
2973
3108
|
case 3:
|
|
2974
3109
|
_context32.next = 5;
|
|
2975
|
-
return this.store.order.
|
|
3110
|
+
return this.store.order.addProductToOrder(product, booking);
|
|
2976
3111
|
case 5:
|
|
2977
3112
|
products = _context32.sent;
|
|
2978
3113
|
return _context32.abrupt("return", products);
|
|
@@ -2986,15 +3121,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2986
3121
|
}
|
|
2987
3122
|
}, _callee32, this, [[0, 9]]);
|
|
2988
3123
|
}));
|
|
2989
|
-
function
|
|
2990
|
-
return
|
|
3124
|
+
function addProductToOrder(_x26, _x27) {
|
|
3125
|
+
return _addProductToOrder.apply(this, arguments);
|
|
2991
3126
|
}
|
|
2992
|
-
return
|
|
3127
|
+
return addProductToOrder;
|
|
2993
3128
|
}()
|
|
2994
3129
|
}, {
|
|
2995
|
-
key: "
|
|
3130
|
+
key: "updateOrderProduct",
|
|
2996
3131
|
value: function () {
|
|
2997
|
-
var
|
|
3132
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
2998
3133
|
var products;
|
|
2999
3134
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3000
3135
|
while (1) switch (_context33.prev = _context33.next) {
|
|
@@ -3007,7 +3142,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3007
3142
|
throw new Error('order 模块未初始化');
|
|
3008
3143
|
case 3:
|
|
3009
3144
|
_context33.next = 5;
|
|
3010
|
-
return this.store.order.
|
|
3145
|
+
return this.store.order.updateOrderProduct(params);
|
|
3011
3146
|
case 5:
|
|
3012
3147
|
products = _context33.sent;
|
|
3013
3148
|
return _context33.abrupt("return", products);
|
|
@@ -3021,15 +3156,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3021
3156
|
}
|
|
3022
3157
|
}, _callee33, this, [[0, 9]]);
|
|
3023
3158
|
}));
|
|
3024
|
-
function
|
|
3025
|
-
return
|
|
3159
|
+
function updateOrderProduct(_x28) {
|
|
3160
|
+
return _updateOrderProduct.apply(this, arguments);
|
|
3026
3161
|
}
|
|
3027
|
-
return
|
|
3162
|
+
return updateOrderProduct;
|
|
3028
3163
|
}()
|
|
3029
3164
|
}, {
|
|
3030
|
-
key: "
|
|
3165
|
+
key: "updateOrderProducts",
|
|
3031
3166
|
value: function () {
|
|
3032
|
-
var
|
|
3167
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(paramsList) {
|
|
3033
3168
|
var products;
|
|
3034
3169
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3035
3170
|
while (1) switch (_context34.prev = _context34.next) {
|
|
@@ -3042,7 +3177,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3042
3177
|
throw new Error('order 模块未初始化');
|
|
3043
3178
|
case 3:
|
|
3044
3179
|
_context34.next = 5;
|
|
3045
|
-
return this.store.order.
|
|
3180
|
+
return this.store.order.updateOrderProducts(paramsList);
|
|
3046
3181
|
case 5:
|
|
3047
3182
|
products = _context34.sent;
|
|
3048
3183
|
return _context34.abrupt("return", products);
|
|
@@ -3056,6 +3191,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3056
3191
|
}
|
|
3057
3192
|
}, _callee34, this, [[0, 9]]);
|
|
3058
3193
|
}));
|
|
3194
|
+
function updateOrderProducts(_x29) {
|
|
3195
|
+
return _updateOrderProducts.apply(this, arguments);
|
|
3196
|
+
}
|
|
3197
|
+
return updateOrderProducts;
|
|
3198
|
+
}()
|
|
3199
|
+
}, {
|
|
3200
|
+
key: "updateOrderProductQuantity",
|
|
3201
|
+
value: function () {
|
|
3202
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
3203
|
+
var products;
|
|
3204
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3205
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3206
|
+
case 0:
|
|
3207
|
+
_context35.prev = 0;
|
|
3208
|
+
if (this.store.order) {
|
|
3209
|
+
_context35.next = 3;
|
|
3210
|
+
break;
|
|
3211
|
+
}
|
|
3212
|
+
throw new Error('order 模块未初始化');
|
|
3213
|
+
case 3:
|
|
3214
|
+
_context35.next = 5;
|
|
3215
|
+
return this.store.order.updateOrderProductQuantity(params);
|
|
3216
|
+
case 5:
|
|
3217
|
+
products = _context35.sent;
|
|
3218
|
+
return _context35.abrupt("return", products);
|
|
3219
|
+
case 9:
|
|
3220
|
+
_context35.prev = 9;
|
|
3221
|
+
_context35.t0 = _context35["catch"](0);
|
|
3222
|
+
throw _context35.t0;
|
|
3223
|
+
case 12:
|
|
3224
|
+
case "end":
|
|
3225
|
+
return _context35.stop();
|
|
3226
|
+
}
|
|
3227
|
+
}, _callee35, this, [[0, 9]]);
|
|
3228
|
+
}));
|
|
3059
3229
|
function updateOrderProductQuantity(_x30) {
|
|
3060
3230
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
3061
3231
|
}
|
|
@@ -3079,12 +3249,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3079
3249
|
}, {
|
|
3080
3250
|
key: "setOrderProductLineNote",
|
|
3081
3251
|
value: (function () {
|
|
3082
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3252
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(identity, note) {
|
|
3083
3253
|
var params, products;
|
|
3084
|
-
return _regeneratorRuntime().wrap(function
|
|
3085
|
-
while (1) switch (
|
|
3254
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3255
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3086
3256
|
case 0:
|
|
3087
|
-
|
|
3257
|
+
_context36.prev = 0;
|
|
3088
3258
|
params = {
|
|
3089
3259
|
product_id: identity.product_id,
|
|
3090
3260
|
product_variant_id: identity.product_variant_id,
|
|
@@ -3099,20 +3269,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3099
3269
|
params.product_sku = identity.product_sku;
|
|
3100
3270
|
}
|
|
3101
3271
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
3102
|
-
|
|
3272
|
+
_context36.next = 7;
|
|
3103
3273
|
return this.updateOrderProduct(params);
|
|
3104
3274
|
case 7:
|
|
3105
|
-
products =
|
|
3106
|
-
return
|
|
3275
|
+
products = _context36.sent;
|
|
3276
|
+
return _context36.abrupt("return", products);
|
|
3107
3277
|
case 11:
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
throw
|
|
3278
|
+
_context36.prev = 11;
|
|
3279
|
+
_context36.t0 = _context36["catch"](0);
|
|
3280
|
+
throw _context36.t0;
|
|
3111
3281
|
case 14:
|
|
3112
3282
|
case "end":
|
|
3113
|
-
return
|
|
3283
|
+
return _context36.stop();
|
|
3114
3284
|
}
|
|
3115
|
-
},
|
|
3285
|
+
}, _callee36, this, [[0, 11]]);
|
|
3116
3286
|
}));
|
|
3117
3287
|
function setOrderProductLineNote(_x31, _x32) {
|
|
3118
3288
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
@@ -3129,30 +3299,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3129
3299
|
}, {
|
|
3130
3300
|
key: "removeProductsFromOrder",
|
|
3131
3301
|
value: (function () {
|
|
3132
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3133
|
-
return _regeneratorRuntime().wrap(function
|
|
3134
|
-
while (1) switch (
|
|
3302
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(identities) {
|
|
3303
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3304
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3135
3305
|
case 0:
|
|
3136
|
-
|
|
3306
|
+
_context37.prev = 0;
|
|
3137
3307
|
if (this.store.order) {
|
|
3138
|
-
|
|
3308
|
+
_context37.next = 3;
|
|
3139
3309
|
break;
|
|
3140
3310
|
}
|
|
3141
3311
|
throw new Error('order 模块未初始化');
|
|
3142
3312
|
case 3:
|
|
3143
|
-
|
|
3313
|
+
_context37.next = 5;
|
|
3144
3314
|
return this.store.order.removeProductsFromOrder(identities);
|
|
3145
3315
|
case 5:
|
|
3146
|
-
return
|
|
3316
|
+
return _context37.abrupt("return", _context37.sent);
|
|
3147
3317
|
case 8:
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
throw
|
|
3318
|
+
_context37.prev = 8;
|
|
3319
|
+
_context37.t0 = _context37["catch"](0);
|
|
3320
|
+
throw _context37.t0;
|
|
3151
3321
|
case 11:
|
|
3152
3322
|
case "end":
|
|
3153
|
-
return
|
|
3323
|
+
return _context37.stop();
|
|
3154
3324
|
}
|
|
3155
|
-
},
|
|
3325
|
+
}, _callee37, this, [[0, 8]]);
|
|
3156
3326
|
}));
|
|
3157
3327
|
function removeProductsFromOrder(_x33) {
|
|
3158
3328
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
@@ -3162,16 +3332,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3162
3332
|
}, {
|
|
3163
3333
|
key: "removeProductFromOrder",
|
|
3164
3334
|
value: function () {
|
|
3165
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3166
|
-
return _regeneratorRuntime().wrap(function
|
|
3167
|
-
while (1) switch (
|
|
3335
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(identity) {
|
|
3336
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3337
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3168
3338
|
case 0:
|
|
3169
|
-
return
|
|
3339
|
+
return _context38.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
3170
3340
|
case 1:
|
|
3171
3341
|
case "end":
|
|
3172
|
-
return
|
|
3342
|
+
return _context38.stop();
|
|
3173
3343
|
}
|
|
3174
|
-
},
|
|
3344
|
+
}, _callee38, this);
|
|
3175
3345
|
}));
|
|
3176
3346
|
function removeProductFromOrder(_x34) {
|
|
3177
3347
|
return _removeProductFromOrder.apply(this, arguments);
|
|
@@ -3223,23 +3393,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3223
3393
|
}, {
|
|
3224
3394
|
key: "applyPromotion",
|
|
3225
3395
|
value: (function () {
|
|
3226
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3227
|
-
return _regeneratorRuntime().wrap(function
|
|
3228
|
-
while (1) switch (
|
|
3396
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3397
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3398
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3229
3399
|
case 0:
|
|
3230
3400
|
if (this.store.order) {
|
|
3231
|
-
|
|
3401
|
+
_context39.next = 2;
|
|
3232
3402
|
break;
|
|
3233
3403
|
}
|
|
3234
3404
|
throw new Error('order 模块未初始化');
|
|
3235
3405
|
case 2:
|
|
3236
|
-
|
|
3406
|
+
_context39.next = 4;
|
|
3237
3407
|
return this.store.order.applyPromotion();
|
|
3238
3408
|
case 4:
|
|
3239
3409
|
case "end":
|
|
3240
|
-
return
|
|
3410
|
+
return _context39.stop();
|
|
3241
3411
|
}
|
|
3242
|
-
},
|
|
3412
|
+
}, _callee39, this);
|
|
3243
3413
|
}));
|
|
3244
3414
|
function applyPromotion() {
|
|
3245
3415
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -3266,18 +3436,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3266
3436
|
}, {
|
|
3267
3437
|
key: "getProductList",
|
|
3268
3438
|
value: function () {
|
|
3269
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3439
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3270
3440
|
var _this$otherParams21;
|
|
3271
3441
|
var menu_list_ids, _this$store$products, res;
|
|
3272
|
-
return _regeneratorRuntime().wrap(function
|
|
3273
|
-
while (1) switch (
|
|
3442
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3443
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3274
3444
|
case 0:
|
|
3275
3445
|
// 可以直接通过配置里的 menu 读取
|
|
3276
3446
|
menu_list_ids = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 || (_this$otherParams21 = _this$otherParams21.dineInConfig) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21['menu.associated_menus'].map(function (n) {
|
|
3277
3447
|
return Number(n.value);
|
|
3278
3448
|
})) || [];
|
|
3279
|
-
|
|
3280
|
-
|
|
3449
|
+
_context40.prev = 1;
|
|
3450
|
+
_context40.next = 4;
|
|
3281
3451
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
3282
3452
|
menu_list_ids: menu_list_ids,
|
|
3283
3453
|
cacheId: this.cacheId,
|
|
@@ -3285,17 +3455,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3285
3455
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
3286
3456
|
});
|
|
3287
3457
|
case 4:
|
|
3288
|
-
res =
|
|
3289
|
-
return
|
|
3458
|
+
res = _context40.sent;
|
|
3459
|
+
return _context40.abrupt("return", res);
|
|
3290
3460
|
case 8:
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
throw
|
|
3461
|
+
_context40.prev = 8;
|
|
3462
|
+
_context40.t0 = _context40["catch"](1);
|
|
3463
|
+
throw _context40.t0;
|
|
3294
3464
|
case 11:
|
|
3295
3465
|
case "end":
|
|
3296
|
-
return
|
|
3466
|
+
return _context40.stop();
|
|
3297
3467
|
}
|
|
3298
|
-
},
|
|
3468
|
+
}, _callee40, this, [[1, 8]]);
|
|
3299
3469
|
}));
|
|
3300
3470
|
function getProductList() {
|
|
3301
3471
|
return _getProductList.apply(this, arguments);
|
|
@@ -3310,31 +3480,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3310
3480
|
}, {
|
|
3311
3481
|
key: "setOtherParams",
|
|
3312
3482
|
value: function () {
|
|
3313
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3483
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
3314
3484
|
var _this$otherParams22;
|
|
3315
|
-
var
|
|
3316
|
-
|
|
3485
|
+
var _ref27,
|
|
3486
|
+
_ref27$cover,
|
|
3317
3487
|
cover,
|
|
3318
|
-
|
|
3319
|
-
return _regeneratorRuntime().wrap(function
|
|
3320
|
-
while (1) switch (
|
|
3488
|
+
_args41 = arguments;
|
|
3489
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3490
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3321
3491
|
case 0:
|
|
3322
|
-
|
|
3492
|
+
_ref27 = _args41.length > 1 && _args41[1] !== undefined ? _args41[1] : {}, _ref27$cover = _ref27.cover, cover = _ref27$cover === void 0 ? false : _ref27$cover;
|
|
3323
3493
|
if (cover) {
|
|
3324
3494
|
this.otherParams = _objectSpread({}, params);
|
|
3325
3495
|
} else {
|
|
3326
3496
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3327
3497
|
}
|
|
3328
3498
|
this.cacheId = (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.cacheId;
|
|
3329
|
-
|
|
3499
|
+
_context41.next = 5;
|
|
3330
3500
|
return this.syncOtherParamsToSubModules(params, {
|
|
3331
3501
|
cover: cover
|
|
3332
3502
|
});
|
|
3333
3503
|
case 5:
|
|
3334
3504
|
case "end":
|
|
3335
|
-
return
|
|
3505
|
+
return _context41.stop();
|
|
3336
3506
|
}
|
|
3337
|
-
},
|
|
3507
|
+
}, _callee41, this);
|
|
3338
3508
|
}));
|
|
3339
3509
|
function setOtherParams(_x35) {
|
|
3340
3510
|
return _setOtherParams.apply(this, arguments);
|