@pisell/pisellos 2.2.273 → 2.2.275
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 +12 -10
- package/dist/modules/Order/index.d.ts +7 -6
- package/dist/modules/Order/index.js +217 -115
- package/dist/modules/Order/types.d.ts +23 -3
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Payment/index.js +1 -1
- package/dist/modules/Payment/types.d.ts +81 -4
- package/dist/modules/Payment/types.js +18 -3
- package/dist/modules/Payment/walletpass.d.ts +38 -1
- package/dist/modules/Payment/walletpass.js +917 -114
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +78 -64
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.js +27 -18
- package/dist/server/modules/index.d.ts +1 -1
- package/dist/server/modules/order/index.d.ts +16 -0
- package/dist/server/modules/order/index.js +964 -776
- package/dist/server/modules/order/types.d.ts +14 -0
- package/dist/server/modules/order/types.js +6 -0
- package/dist/solution/BaseSales/index.d.ts +80 -15
- package/dist/solution/BaseSales/index.js +1498 -444
- package/dist/solution/BaseSales/types.d.ts +55 -1
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +8 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +12 -3
- package/dist/solution/BookingTicket/types.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +173 -83
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
- package/lib/modules/Order/index.d.ts +7 -6
- package/lib/modules/Order/index.js +127 -20
- package/lib/modules/Order/types.d.ts +23 -3
- package/lib/modules/Payment/index.js +1 -1
- package/lib/modules/Payment/types.d.ts +81 -4
- package/lib/modules/Payment/types.js +4 -3
- package/lib/modules/Payment/walletpass.d.ts +38 -1
- package/lib/modules/Payment/walletpass.js +730 -21
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +24 -14
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/server/index.d.ts +4 -0
- package/lib/server/index.js +14 -6
- package/lib/server/modules/index.d.ts +1 -1
- package/lib/server/modules/order/index.d.ts +16 -0
- package/lib/server/modules/order/index.js +140 -4
- package/lib/server/modules/order/types.d.ts +14 -0
- package/lib/server/modules/order/types.js +1 -0
- package/lib/solution/BaseSales/index.d.ts +80 -15
- package/lib/solution/BaseSales/index.js +712 -48
- package/lib/solution/BaseSales/types.d.ts +55 -1
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +8 -2
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +4 -1
- package/lib/solution/BookingTicket/types.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +37 -5
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/VenueBooking/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -46,6 +46,89 @@ import { QuotationModule } from "../../modules/Quotation";
|
|
|
46
46
|
import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
|
|
47
47
|
import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
|
|
48
48
|
var SERVER_ORDER_CHANGED_EVENT = 'order:onOrdersChanged';
|
|
49
|
+
var WALLET_PAYMENT_CODE_BY_TAG = {
|
|
50
|
+
product_voucher: 'PRODUCTVOUCHER',
|
|
51
|
+
gift_card: 'GIFTCARD',
|
|
52
|
+
point_card: 'POINTCARD'
|
|
53
|
+
};
|
|
54
|
+
function getSharedWalletAssetId(asset) {
|
|
55
|
+
var _ref, _asset$id;
|
|
56
|
+
return (_ref = (_asset$id = asset === null || asset === void 0 ? void 0 : asset.id) !== null && _asset$id !== void 0 ? _asset$id : asset === null || asset === void 0 ? void 0 : asset.voucher_id) !== null && _ref !== void 0 ? _ref : asset === null || asset === void 0 ? void 0 : asset.code;
|
|
57
|
+
}
|
|
58
|
+
function getSharedWalletAssetAmount(asset) {
|
|
59
|
+
var _ref2, _ref3, _ref4, _ref5, _asset$edit_current_a;
|
|
60
|
+
var value = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_asset$edit_current_a = asset === null || asset === void 0 ? void 0 : asset.edit_current_amount) !== null && _asset$edit_current_a !== void 0 ? _asset$edit_current_a : asset === null || asset === void 0 ? void 0 : asset._available_max_amount) !== null && _ref5 !== void 0 ? _ref5 : (asset === null || asset === void 0 ? void 0 : asset.tag) === 'point_card' ? asset === null || asset === void 0 ? void 0 : asset.recommended_usage_amount : asset === null || asset === void 0 ? void 0 : asset.available_max_amount) !== null && _ref4 !== void 0 ? _ref4 : asset === null || asset === void 0 ? void 0 : asset.actualDeduction) !== null && _ref3 !== void 0 ? _ref3 : asset === null || asset === void 0 ? void 0 : asset.amount) !== null && _ref2 !== void 0 ? _ref2 : 0;
|
|
61
|
+
var amount = Number(value);
|
|
62
|
+
return Number.isFinite(amount) && amount > 0 ? amount : 0;
|
|
63
|
+
}
|
|
64
|
+
function isRejectedSalesSubmitResult(result) {
|
|
65
|
+
var _result$response, _result$response2;
|
|
66
|
+
var candidates = [result, result === null || result === void 0 ? void 0 : result.data, result === null || result === void 0 || (_result$response = result.response) === null || _result$response === void 0 ? void 0 : _result$response.data, result === null || result === void 0 || (_result$response2 = result.response) === null || _result$response2 === void 0 ? void 0 : _result$response2.body];
|
|
67
|
+
return candidates.some(function (candidate) {
|
|
68
|
+
var _candidate$code;
|
|
69
|
+
if (!candidate || _typeof(candidate) !== 'object') return false;
|
|
70
|
+
var responseCode = Number((_candidate$code = candidate.code) !== null && _candidate$code !== void 0 ? _candidate$code : candidate.statusCode);
|
|
71
|
+
if (Number.isFinite(responseCode) && responseCode >= 400) return true;
|
|
72
|
+
if (candidate.status === false || candidate.success === false || candidate.result === false) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
return ['failed', 'error'].includes(String(candidate.status || '').toLowerCase());
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function getSalesSubmitErrorMessage(result) {
|
|
79
|
+
var _result$data, _result$data2;
|
|
80
|
+
return (result === null || result === void 0 ? void 0 : result.message) || (result === null || result === void 0 ? void 0 : result.msg) || (result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.message) || (result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.msg) || 'Wallet 支付确认失败';
|
|
81
|
+
}
|
|
82
|
+
function toWalletFundValue(value) {
|
|
83
|
+
try {
|
|
84
|
+
return new Decimal(value || 0).toDecimalPlaces(2).toFixed(2);
|
|
85
|
+
} catch (_unused) {
|
|
86
|
+
return '0.00';
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function subtractWalletFundValue(left, right) {
|
|
90
|
+
try {
|
|
91
|
+
return new Decimal(left || 0).minus(right || 0).toDecimalPlaces(2).toFixed(2);
|
|
92
|
+
} catch (_unused2) {
|
|
93
|
+
return '0.00';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function getSharedWalletPassUseValue(params) {
|
|
97
|
+
var asset = params.asset,
|
|
98
|
+
amount = params.amount,
|
|
99
|
+
paymentMethod = params.paymentMethod;
|
|
100
|
+
var configuredValue = Number(asset === null || asset === void 0 ? void 0 : asset.wallet_pass_use_value);
|
|
101
|
+
if (Number.isFinite(configuredValue) && configuredValue > 0) {
|
|
102
|
+
return configuredValue;
|
|
103
|
+
}
|
|
104
|
+
var isPointCard = (asset === null || asset === void 0 ? void 0 : asset.tag) === 'point_card' || paymentMethod.code === 'POINTCARD';
|
|
105
|
+
var usageUnit = asset === null || asset === void 0 ? void 0 : asset.wallet_pass_usage_unit;
|
|
106
|
+
if (isPointCard && usageUnit !== null && usageUnit !== void 0 && usageUnit.points && usageUnit !== null && usageUnit !== void 0 && usageUnit.price) {
|
|
107
|
+
return new Decimal(amount).div(usageUnit.price).mul(usageUnit.points).toDecimalPlaces(2, Decimal.ROUND_DOWN).toNumber();
|
|
108
|
+
}
|
|
109
|
+
return amount;
|
|
110
|
+
}
|
|
111
|
+
function buildSharedWalletFundRecord(params) {
|
|
112
|
+
var _ref6, _ref7, _asset$balance_par_va, _asset$voucher_id;
|
|
113
|
+
var asset = params.asset,
|
|
114
|
+
amount = params.amount,
|
|
115
|
+
paymentMethod = params.paymentMethod;
|
|
116
|
+
var isPointCard = (asset === null || asset === void 0 ? void 0 : asset.tag) === 'point_card' || paymentMethod.code === 'POINTCARD';
|
|
117
|
+
var usingBeforeValue = (_ref6 = (_ref7 = (_asset$balance_par_va = asset === null || asset === void 0 ? void 0 : asset.balance_par_value) !== null && _asset$balance_par_va !== void 0 ? _asset$balance_par_va : asset === null || asset === void 0 ? void 0 : asset.balance) !== null && _ref7 !== void 0 ? _ref7 : asset === null || asset === void 0 ? void 0 : asset.using_before_value) !== null && _ref6 !== void 0 ? _ref6 : 0;
|
|
118
|
+
var walletPassUseValue = getSharedWalletPassUseValue(params);
|
|
119
|
+
var usingValue = isPointCard ? walletPassUseValue : amount;
|
|
120
|
+
var walletPassName = (asset === null || asset === void 0 ? void 0 : asset.wallet_pass_name) || (asset === null || asset === void 0 ? void 0 : asset.format_title) || (asset === null || asset === void 0 ? void 0 : asset.product_name) || (asset === null || asset === void 0 ? void 0 : asset.name) || paymentMethod.name;
|
|
121
|
+
return {
|
|
122
|
+
voucher_id: (_asset$voucher_id = asset === null || asset === void 0 ? void 0 : asset.voucher_id) !== null && _asset$voucher_id !== void 0 ? _asset$voucher_id : asset === null || asset === void 0 ? void 0 : asset.id,
|
|
123
|
+
wallet_pass_name: walletPassName && _typeof(walletPassName) === 'object' ? walletPassName : {
|
|
124
|
+
default: walletPassName || ''
|
|
125
|
+
},
|
|
126
|
+
code: (asset === null || asset === void 0 ? void 0 : asset.code) || (asset === null || asset === void 0 ? void 0 : asset.tag),
|
|
127
|
+
encoded: asset === null || asset === void 0 ? void 0 : asset.encoded,
|
|
128
|
+
using_before_value: toWalletFundValue(usingBeforeValue),
|
|
129
|
+
using_after_value: subtractWalletFundValue(usingBeforeValue, usingValue)
|
|
130
|
+
};
|
|
131
|
+
}
|
|
49
132
|
function isBaseSalesManualProductDiscountProduct(product) {
|
|
50
133
|
var _product$metadata, _product$metadata2;
|
|
51
134
|
return (product === null || product === void 0 || (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.is_manual_discount) === true || (product === null || product === void 0 || (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.is_manual_discount) === 1 || ((product === null || product === void 0 ? void 0 : product.discount_list) || []).some(function (item) {
|
|
@@ -326,6 +409,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
326
409
|
_defineProperty(_assertThisInitialized(_this), "autoPaymentSyncTimer", null);
|
|
327
410
|
_defineProperty(_assertThisInitialized(_this), "salesDetailLoadInFlightCount", 0);
|
|
328
411
|
_defineProperty(_assertThisInitialized(_this), "salesDetailLoadSequence", 0);
|
|
412
|
+
_defineProperty(_assertThisInitialized(_this), "walletAssetsRefreshSequence", 0);
|
|
329
413
|
_defineProperty(_assertThisInitialized(_this), "salesDetailHydrateQueue", Promise.resolve());
|
|
330
414
|
_defineProperty(_assertThisInitialized(_this), "serverOrderChangeUnsubscribe", null);
|
|
331
415
|
_defineProperty(_assertThisInitialized(_this), "serverOrderChangeHydrateInFlight", null);
|
|
@@ -518,12 +602,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
518
602
|
return _context3.abrupt("return");
|
|
519
603
|
case 14:
|
|
520
604
|
this.serverOrderChangeHydrateInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
521
|
-
var _getTempOrder,
|
|
605
|
+
var _getTempOrder, _ref9;
|
|
522
606
|
var currentTempOrder, record, sales;
|
|
523
607
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
524
608
|
while (1) switch (_context2.prev = _context2.next) {
|
|
525
609
|
case 0:
|
|
526
|
-
currentTempOrder = (_getTempOrder = (
|
|
610
|
+
currentTempOrder = (_getTempOrder = (_ref9 = _this2.store.order).getTempOrder) === null || _getTempOrder === void 0 ? void 0 : _getTempOrder.call(_ref9);
|
|
527
611
|
record = mergeSalesDetailRecordWithTempOrder(currentTempOrder, changedOrder, 'authoritative-incoming');
|
|
528
612
|
_context2.next = 4;
|
|
529
613
|
return _this2.store.order.hydrateTempOrderFromRecord(record, {
|
|
@@ -592,7 +676,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
592
676
|
hydratedSales = null;
|
|
593
677
|
skippedBeforeHydrate = false;
|
|
594
678
|
hydrateTask = /*#__PURE__*/function () {
|
|
595
|
-
var
|
|
679
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
596
680
|
var sales;
|
|
597
681
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
598
682
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -637,7 +721,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
637
721
|
}, _callee4);
|
|
638
722
|
}));
|
|
639
723
|
return function hydrateTask() {
|
|
640
|
-
return
|
|
724
|
+
return _ref10.apply(this, arguments);
|
|
641
725
|
};
|
|
642
726
|
}();
|
|
643
727
|
queuedTask = this.salesDetailHydrateQueue.then(hydrateTask, hydrateTask);
|
|
@@ -731,10 +815,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
731
815
|
});
|
|
732
816
|
}
|
|
733
817
|
quotation.setScheduleResolver(function (id) {
|
|
734
|
-
var _scheduleModule$getSc, _getScheduleByIds,
|
|
818
|
+
var _scheduleModule$getSc, _getScheduleByIds, _ref11;
|
|
735
819
|
var scheduleId = String(id);
|
|
736
820
|
if (scheduleById.has(scheduleId)) return scheduleById.get(scheduleId);
|
|
737
|
-
var schedules = ((_scheduleModule$getSc = scheduleModule.getScheduleListByIds) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule, [id])) || ((_getScheduleByIds = (
|
|
821
|
+
var schedules = ((_scheduleModule$getSc = scheduleModule.getScheduleListByIds) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule, [id])) || ((_getScheduleByIds = (_ref11 = scheduleModule).getScheduleByIds) === null || _getScheduleByIds === void 0 ? void 0 : _getScheduleByIds.call(_ref11, [id])) || [];
|
|
738
822
|
if (schedules[0]) scheduleById.set(scheduleId, schedules[0]);
|
|
739
823
|
return schedules[0];
|
|
740
824
|
});
|
|
@@ -778,6 +862,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
778
862
|
if (!Number.isFinite(productId)) return null;
|
|
779
863
|
return productId;
|
|
780
864
|
}
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Change Time / customer reprice 必须沿用商品列表的渠道口径。
|
|
868
|
+
* SalesSdk Provider 通常将渠道存为 platform,因此不能只读取 otherParams.channel。
|
|
869
|
+
*/
|
|
870
|
+
}, {
|
|
871
|
+
key: "getPriceQueryChannel",
|
|
872
|
+
value: function getPriceQueryChannel(channel) {
|
|
873
|
+
var _this$otherParams2, _ref12, _ref13, _this$otherParams3, _this$otherParams4;
|
|
874
|
+
var strategyContext = (_this$otherParams2 = this.otherParams) !== null && _this$otherParams2 !== void 0 && _this$otherParams2.strategy_context && _typeof(this.otherParams.strategy_context) === 'object' ? this.otherParams.strategy_context : {};
|
|
875
|
+
var value = (_ref12 = (_ref13 = channel !== null && channel !== void 0 ? channel : strategyContext.channel) !== null && _ref13 !== void 0 ? _ref13 : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.channel) !== null && _ref12 !== void 0 ? _ref12 : (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform;
|
|
876
|
+
if (value === undefined || value === null || String(value).trim() === '') {
|
|
877
|
+
return undefined;
|
|
878
|
+
}
|
|
879
|
+
return String(value).trim();
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* /product/query 的智能定价评估只读取 strategy_context;
|
|
883
|
+
* application_code 仅作为接口兼容字段,不能替代 channel / business_code。
|
|
884
|
+
*/
|
|
885
|
+
}, {
|
|
886
|
+
key: "getPriceQueryStrategyContext",
|
|
887
|
+
value: function getPriceQueryStrategyContext(channel) {
|
|
888
|
+
var _this$otherParams5, _ref14, _strategyContext$busi, _this$otherParams6, _this$otherParams7;
|
|
889
|
+
var inherited = (_this$otherParams5 = this.otherParams) !== null && _this$otherParams5 !== void 0 && _this$otherParams5.strategy_context && _typeof(this.otherParams.strategy_context) === 'object' ? this.otherParams.strategy_context : {};
|
|
890
|
+
var strategyContext = _objectSpread({}, inherited);
|
|
891
|
+
var resolvedChannel = this.getPriceQueryChannel(channel);
|
|
892
|
+
var businessCode = (_ref14 = (_strategyContext$busi = strategyContext.business_code) !== null && _strategyContext$busi !== void 0 ? _strategyContext$busi : (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) !== null && _ref14 !== void 0 ? _ref14 : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.business_code;
|
|
893
|
+
if (resolvedChannel) strategyContext.channel = resolvedChannel;
|
|
894
|
+
if (businessCode !== undefined && businessCode !== null && String(businessCode).trim() !== '') {
|
|
895
|
+
strategyContext.business_code = String(businessCode).trim();
|
|
896
|
+
}
|
|
897
|
+
return strategyContext;
|
|
898
|
+
}
|
|
781
899
|
}, {
|
|
782
900
|
key: "getPriceQuerySchedule",
|
|
783
901
|
value: function getPriceQuerySchedule(params) {
|
|
@@ -810,7 +928,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
810
928
|
key: "loadProductsForPriceQuery",
|
|
811
929
|
value: function () {
|
|
812
930
|
var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
|
|
813
|
-
var ids, productsById,
|
|
931
|
+
var ids, productsById, channel, strategyContext, _response$data, response, list;
|
|
814
932
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
815
933
|
while (1) switch (_context7.prev = _context7.next) {
|
|
816
934
|
case 0:
|
|
@@ -824,9 +942,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
824
942
|
}
|
|
825
943
|
return _context7.abrupt("return", productsById);
|
|
826
944
|
case 4:
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
945
|
+
channel = this.getPriceQueryChannel(params.channel);
|
|
946
|
+
strategyContext = this.getPriceQueryStrategyContext(channel);
|
|
947
|
+
_context7.prev = 6;
|
|
948
|
+
_context7.next = 9;
|
|
949
|
+
return this.request.post('/product/query', _objectSpread({
|
|
830
950
|
ids: ids,
|
|
831
951
|
open_quotation: 1,
|
|
832
952
|
open_bundle: 1,
|
|
@@ -836,39 +956,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
836
956
|
customer_id: params.customerId,
|
|
837
957
|
schedule_date: params.schedule.schedule_date,
|
|
838
958
|
schedule_datetime: params.schedule.schedule_datetime,
|
|
839
|
-
application_code:
|
|
840
|
-
}, {
|
|
959
|
+
application_code: channel
|
|
960
|
+
}, Object.keys(strategyContext).length ? {
|
|
961
|
+
strategy_context: strategyContext
|
|
962
|
+
} : {}), {
|
|
841
963
|
osServer: true,
|
|
842
964
|
customToast: function customToast() {}
|
|
843
965
|
});
|
|
844
|
-
case
|
|
966
|
+
case 9:
|
|
845
967
|
response = _context7.sent;
|
|
846
968
|
list = (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list) || (response === null || response === void 0 ? void 0 : response.list) || [];
|
|
847
969
|
if (Array.isArray(list)) {
|
|
848
|
-
_context7.next =
|
|
970
|
+
_context7.next = 13;
|
|
849
971
|
break;
|
|
850
972
|
}
|
|
851
973
|
return _context7.abrupt("return", productsById);
|
|
852
|
-
case
|
|
974
|
+
case 13:
|
|
853
975
|
list.forEach(function (item) {
|
|
854
976
|
var _item$id;
|
|
855
977
|
var productId = Number((_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : item === null || item === void 0 ? void 0 : item.product_id);
|
|
856
978
|
if (Number.isFinite(productId)) productsById.set(productId, item);
|
|
857
979
|
});
|
|
858
980
|
return _context7.abrupt("return", productsById);
|
|
859
|
-
case
|
|
860
|
-
_context7.prev =
|
|
861
|
-
_context7.t0 = _context7["catch"](
|
|
981
|
+
case 17:
|
|
982
|
+
_context7.prev = 17;
|
|
983
|
+
_context7.t0 = _context7["catch"](6);
|
|
862
984
|
this.logWarning('loadProductsForPriceQuery: 商品批量重查失败,使用入参 fallback', {
|
|
863
985
|
ids: ids,
|
|
864
986
|
error: _context7.t0 instanceof Error ? _context7.t0.message : String(_context7.t0)
|
|
865
987
|
});
|
|
866
988
|
return _context7.abrupt("return", productsById);
|
|
867
|
-
case
|
|
989
|
+
case 21:
|
|
868
990
|
case "end":
|
|
869
991
|
return _context7.stop();
|
|
870
992
|
}
|
|
871
|
-
}, _callee7, this, [[
|
|
993
|
+
}, _callee7, this, [[6, 17]]);
|
|
872
994
|
}));
|
|
873
995
|
function loadProductsForPriceQuery(_x5) {
|
|
874
996
|
return _loadProductsForPriceQuery.apply(this, arguments);
|
|
@@ -921,10 +1043,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
921
1043
|
return groups.flatMap(function (group) {
|
|
922
1044
|
var items = Array.isArray(group === null || group === void 0 ? void 0 : group.bundle_item) ? group.bundle_item : Array.isArray(group === null || group === void 0 ? void 0 : group.bundleItem) ? group.bundleItem : [];
|
|
923
1045
|
return items.map(function (item) {
|
|
924
|
-
var _item$group_id,
|
|
1046
|
+
var _item$group_id, _ref15, _item$bundle_group_id;
|
|
925
1047
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
926
1048
|
group_id: (_item$group_id = item === null || item === void 0 ? void 0 : item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : group === null || group === void 0 ? void 0 : group.id,
|
|
927
|
-
bundle_group_id: (
|
|
1049
|
+
bundle_group_id: (_ref15 = (_item$bundle_group_id = item === null || item === void 0 ? void 0 : item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item === null || item === void 0 ? void 0 : item.group_id) !== null && _ref15 !== void 0 ? _ref15 : group === null || group === void 0 ? void 0 : group.id
|
|
928
1050
|
});
|
|
929
1051
|
});
|
|
930
1052
|
});
|
|
@@ -955,21 +1077,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
955
1077
|
}, {
|
|
956
1078
|
key: "getAuthoritativeBundleUnitPrice",
|
|
957
1079
|
value: function getAuthoritativeBundleUnitPrice(bundle) {
|
|
958
|
-
var
|
|
959
|
-
return (
|
|
1080
|
+
var _ref16, _ref17, _ref18, _bundle$price;
|
|
1081
|
+
return (_ref16 = (_ref17 = (_ref18 = (_bundle$price = bundle.price) !== null && _bundle$price !== void 0 ? _bundle$price : bundle.bundle_selling_price) !== null && _ref18 !== void 0 ? _ref18 : bundle.custom_price) !== null && _ref17 !== void 0 ? _ref17 : bundle.product_price) !== null && _ref16 !== void 0 ? _ref16 : bundle.base_price;
|
|
960
1082
|
}
|
|
961
1083
|
}, {
|
|
962
1084
|
key: "mergeProductForPriceQuery",
|
|
963
1085
|
value: function mergeProductForPriceQuery(product, authoritativeProduct) {
|
|
964
1086
|
var _this5 = this,
|
|
965
1087
|
_product$id,
|
|
966
|
-
|
|
1088
|
+
_ref19,
|
|
967
1089
|
_product$product_id2,
|
|
968
|
-
|
|
1090
|
+
_ref20,
|
|
969
1091
|
_product$product_vari,
|
|
970
|
-
|
|
1092
|
+
_ref21,
|
|
971
1093
|
_product$num,
|
|
972
|
-
|
|
1094
|
+
_ref22,
|
|
973
1095
|
_product$quantity,
|
|
974
1096
|
_product$metadata4;
|
|
975
1097
|
if (!authoritativeProduct) return product;
|
|
@@ -989,10 +1111,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
989
1111
|
});
|
|
990
1112
|
return _objectSpread(_objectSpread(_objectSpread({}, product), authoritativeProduct), {}, {
|
|
991
1113
|
id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : authoritativeProduct.id,
|
|
992
|
-
product_id: (
|
|
993
|
-
product_variant_id: (
|
|
994
|
-
num: (
|
|
995
|
-
quantity: (
|
|
1114
|
+
product_id: (_ref19 = (_product$product_id2 = product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : authoritativeProduct.product_id) !== null && _ref19 !== void 0 ? _ref19 : authoritativeProduct.id,
|
|
1115
|
+
product_variant_id: (_ref20 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : authoritativeProduct.product_variant_id) !== null && _ref20 !== void 0 ? _ref20 : 0,
|
|
1116
|
+
num: (_ref21 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity) !== null && _ref21 !== void 0 ? _ref21 : authoritativeProduct.num,
|
|
1117
|
+
quantity: (_ref22 = (_product$quantity = product.quantity) !== null && _product$quantity !== void 0 ? _product$quantity : product.num) !== null && _ref22 !== void 0 ? _ref22 : authoritativeProduct.quantity,
|
|
996
1118
|
product_sku: function () {
|
|
997
1119
|
var authoritativeSku = ensureProductSku(authoritativeProduct);
|
|
998
1120
|
var productSku = ensureProductSku(product);
|
|
@@ -1008,8 +1130,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1008
1130
|
}, {
|
|
1009
1131
|
key: "getSubmitOrderSalesChannel",
|
|
1010
1132
|
value: function getSubmitOrderSalesChannel() {
|
|
1011
|
-
var _this$
|
|
1012
|
-
return (_this$
|
|
1133
|
+
var _this$otherParams8;
|
|
1134
|
+
return (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.channel;
|
|
1013
1135
|
}
|
|
1014
1136
|
|
|
1015
1137
|
/**
|
|
@@ -1068,24 +1190,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1068
1190
|
value: (function () {
|
|
1069
1191
|
var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(changedParams) {
|
|
1070
1192
|
var _this6 = this;
|
|
1071
|
-
var
|
|
1072
|
-
|
|
1193
|
+
var _ref23,
|
|
1194
|
+
_ref23$cover,
|
|
1073
1195
|
cover,
|
|
1074
1196
|
nextSubModuleOtherParams,
|
|
1075
1197
|
_args10 = arguments;
|
|
1076
1198
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1077
1199
|
while (1) switch (_context10.prev = _context10.next) {
|
|
1078
1200
|
case 0:
|
|
1079
|
-
|
|
1201
|
+
_ref23 = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {}, _ref23$cover = _ref23.cover, cover = _ref23$cover === void 0 ? false : _ref23$cover;
|
|
1080
1202
|
nextSubModuleOtherParams = this.buildSubModuleOtherParams();
|
|
1081
1203
|
_context10.next = 4;
|
|
1082
1204
|
return Promise.all(Object.entries(this.store).map( /*#__PURE__*/function () {
|
|
1083
|
-
var
|
|
1084
|
-
var
|
|
1205
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref24) {
|
|
1206
|
+
var _ref26, moduleName, subModule, targetModule;
|
|
1085
1207
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1086
1208
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1087
1209
|
case 0:
|
|
1088
|
-
|
|
1210
|
+
_ref26 = _slicedToArray(_ref24, 2), moduleName = _ref26[0], subModule = _ref26[1];
|
|
1089
1211
|
if (!_this6.reusedSharedSubModuleNames.has(moduleName)) {
|
|
1090
1212
|
_context9.next = 3;
|
|
1091
1213
|
break;
|
|
@@ -1111,7 +1233,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1111
1233
|
}, _callee9);
|
|
1112
1234
|
}));
|
|
1113
1235
|
return function (_x9) {
|
|
1114
|
-
return
|
|
1236
|
+
return _ref25.apply(this, arguments);
|
|
1115
1237
|
};
|
|
1116
1238
|
}()));
|
|
1117
1239
|
case 4:
|
|
@@ -1139,7 +1261,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1139
1261
|
if (!sessionData) return {};
|
|
1140
1262
|
var data = JSON.parse(sessionData);
|
|
1141
1263
|
return data && data[this.cacheId] || {};
|
|
1142
|
-
} catch (
|
|
1264
|
+
} catch (_unused3) {
|
|
1143
1265
|
return {};
|
|
1144
1266
|
}
|
|
1145
1267
|
}
|
|
@@ -1227,9 +1349,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1227
1349
|
key: "initialize",
|
|
1228
1350
|
value: function () {
|
|
1229
1351
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(core) {
|
|
1230
|
-
var _this$
|
|
1352
|
+
var _this$otherParams9,
|
|
1231
1353
|
_this9 = this,
|
|
1232
|
-
_this$
|
|
1354
|
+
_this$otherParams10;
|
|
1233
1355
|
var options,
|
|
1234
1356
|
app,
|
|
1235
1357
|
targetCacheData,
|
|
@@ -1244,7 +1366,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1244
1366
|
this.paymentNumberDevicePrefix = null;
|
|
1245
1367
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
1246
1368
|
this.otherParams = options.otherParams || {};
|
|
1247
|
-
this.cacheId = (_this$
|
|
1369
|
+
this.cacheId = (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.cacheId;
|
|
1248
1370
|
this.reusedSharedSubModuleNames.clear();
|
|
1249
1371
|
this.window = core.getPlugin('window');
|
|
1250
1372
|
this.request = core.getPlugin('request');
|
|
@@ -1289,7 +1411,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1289
1411
|
_context11.next = 20;
|
|
1290
1412
|
return this.store.schedule.loadAllSchedule();
|
|
1291
1413
|
case 20:
|
|
1292
|
-
if (this.store.order && typeof ((_this$
|
|
1414
|
+
if (this.store.order && typeof ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.enableTempOrderPersist) === 'boolean') {
|
|
1293
1415
|
this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
|
|
1294
1416
|
}
|
|
1295
1417
|
_context11.next = 23;
|
|
@@ -1334,11 +1456,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1334
1456
|
this.paymentNumberDevicePrefix = null;
|
|
1335
1457
|
this.queuedServerOrderChanges = [];
|
|
1336
1458
|
this.salesDetailLoadSequence += 1;
|
|
1337
|
-
|
|
1459
|
+
this.walletAssetsRefreshSequence += 1;
|
|
1460
|
+
_context12.next = 10;
|
|
1338
1461
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
1339
|
-
case 9:
|
|
1340
|
-
_get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
|
|
1341
1462
|
case 10:
|
|
1463
|
+
_get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
|
|
1464
|
+
case 11:
|
|
1342
1465
|
case "end":
|
|
1343
1466
|
return _context12.stop();
|
|
1344
1467
|
}
|
|
@@ -1360,7 +1483,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1360
1483
|
key: "loadSalesDetail",
|
|
1361
1484
|
value: (function () {
|
|
1362
1485
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(orderIdOrParams) {
|
|
1363
|
-
var loadSequence,
|
|
1486
|
+
var loadSequence, _ref27, _ref28, _ref29, _ref30, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, remoteRecord, currentTempOrder, mergedRecord, record;
|
|
1364
1487
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1365
1488
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1366
1489
|
case 0:
|
|
@@ -1378,7 +1501,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1378
1501
|
};
|
|
1379
1502
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
1380
1503
|
preloadedSalesDetail = params.preloadedSalesDetail;
|
|
1381
|
-
lookup = (
|
|
1504
|
+
lookup = (_ref27 = (_ref28 = (_ref29 = (_ref30 = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : externalSaleNumber) !== null && _ref30 !== void 0 ? _ref30 : params.orderNumber) !== null && _ref29 !== void 0 ? _ref29 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_id) !== null && _ref28 !== void 0 ? _ref28 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.external_sale_number) !== null && _ref27 !== void 0 ? _ref27 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_number;
|
|
1382
1505
|
if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
|
|
1383
1506
|
_context13.next = 11;
|
|
1384
1507
|
break;
|
|
@@ -1524,7 +1647,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1524
1647
|
}, {
|
|
1525
1648
|
key: "replaceTempOrder",
|
|
1526
1649
|
value: function () {
|
|
1527
|
-
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(tempOrder) {
|
|
1650
|
+
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(tempOrder, options) {
|
|
1528
1651
|
var nextTempOrder;
|
|
1529
1652
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1530
1653
|
while (1) switch (_context14.prev = _context14.next) {
|
|
@@ -1536,7 +1659,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1536
1659
|
throw new Error('order 模块未初始化');
|
|
1537
1660
|
case 2:
|
|
1538
1661
|
_context14.next = 4;
|
|
1539
|
-
return this.store.order.replaceTempOrder(tempOrder);
|
|
1662
|
+
return this.store.order.replaceTempOrder(tempOrder, options);
|
|
1540
1663
|
case 4:
|
|
1541
1664
|
nextTempOrder = _context14.sent;
|
|
1542
1665
|
_context14.next = 7;
|
|
@@ -1551,7 +1674,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1551
1674
|
}
|
|
1552
1675
|
}, _callee14, this);
|
|
1553
1676
|
}));
|
|
1554
|
-
function replaceTempOrder(_x12) {
|
|
1677
|
+
function replaceTempOrder(_x12, _x13) {
|
|
1555
1678
|
return _replaceTempOrder.apply(this, arguments);
|
|
1556
1679
|
}
|
|
1557
1680
|
return replaceTempOrder;
|
|
@@ -1719,7 +1842,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1719
1842
|
key: "restoreOrder",
|
|
1720
1843
|
value: function () {
|
|
1721
1844
|
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1722
|
-
var tempOrder;
|
|
1845
|
+
var _this$store$payment, tempOrder, wallet;
|
|
1723
1846
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1724
1847
|
while (1) switch (_context17.prev = _context17.next) {
|
|
1725
1848
|
case 0:
|
|
@@ -1735,29 +1858,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1735
1858
|
this.currentSalesDetail = null;
|
|
1736
1859
|
this.discountConfigCacheKey = null;
|
|
1737
1860
|
this.hasManualDiscountSelection = false;
|
|
1738
|
-
|
|
1861
|
+
wallet = (_this$store$payment = this.store.payment) === null || _this$store$payment === void 0 ? void 0 : _this$store$payment.wallet;
|
|
1862
|
+
if (!wallet) {
|
|
1863
|
+
_context17.next = 13;
|
|
1864
|
+
break;
|
|
1865
|
+
}
|
|
1866
|
+
this.walletAssetsRefreshSequence += 1;
|
|
1867
|
+
wallet.clearAllCache();
|
|
1868
|
+
_context17.next = 13;
|
|
1869
|
+
return this.publishWalletAssetsState(wallet.getWalletAssetsState());
|
|
1870
|
+
case 13:
|
|
1871
|
+
_context17.next = 15;
|
|
1739
1872
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1740
1873
|
tempOrder: tempOrder
|
|
1741
1874
|
});
|
|
1742
|
-
case
|
|
1875
|
+
case 15:
|
|
1743
1876
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
1744
|
-
_context17.next =
|
|
1877
|
+
_context17.next = 19;
|
|
1745
1878
|
break;
|
|
1746
1879
|
}
|
|
1747
1880
|
this.store.order.persistTempOrder();
|
|
1748
|
-
_context17.next =
|
|
1881
|
+
_context17.next = 19;
|
|
1749
1882
|
return this.store.order.saveDraft();
|
|
1750
|
-
case
|
|
1883
|
+
case 19:
|
|
1751
1884
|
return _context17.abrupt("return", tempOrder);
|
|
1752
|
-
case
|
|
1753
|
-
_context17.prev =
|
|
1885
|
+
case 22:
|
|
1886
|
+
_context17.prev = 22;
|
|
1754
1887
|
_context17.t0 = _context17["catch"](0);
|
|
1755
1888
|
throw _context17.t0;
|
|
1756
|
-
case
|
|
1889
|
+
case 25:
|
|
1757
1890
|
case "end":
|
|
1758
1891
|
return _context17.stop();
|
|
1759
1892
|
}
|
|
1760
|
-
}, _callee17, this, [[0,
|
|
1893
|
+
}, _callee17, this, [[0, 22]]);
|
|
1761
1894
|
}));
|
|
1762
1895
|
function restoreOrder() {
|
|
1763
1896
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -2181,7 +2314,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2181
2314
|
}
|
|
2182
2315
|
}, _callee20, this, [[46, 65, 68, 71]]);
|
|
2183
2316
|
}));
|
|
2184
|
-
function loadDiscountConfig(
|
|
2317
|
+
function loadDiscountConfig(_x14) {
|
|
2185
2318
|
return _loadDiscountConfig.apply(this, arguments);
|
|
2186
2319
|
}
|
|
2187
2320
|
return loadDiscountConfig;
|
|
@@ -2279,7 +2412,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2279
2412
|
}
|
|
2280
2413
|
}, _callee21, this);
|
|
2281
2414
|
}));
|
|
2282
|
-
function bestDiscount(
|
|
2415
|
+
function bestDiscount(_x15) {
|
|
2283
2416
|
return _bestDiscount.apply(this, arguments);
|
|
2284
2417
|
}
|
|
2285
2418
|
return bestDiscount;
|
|
@@ -2342,7 +2475,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2342
2475
|
}
|
|
2343
2476
|
}, _callee22, this);
|
|
2344
2477
|
}));
|
|
2345
|
-
function replaceDiscountStoreLists(
|
|
2478
|
+
function replaceDiscountStoreLists(_x16) {
|
|
2346
2479
|
return _replaceDiscountStoreLists.apply(this, arguments);
|
|
2347
2480
|
}
|
|
2348
2481
|
return replaceDiscountStoreLists;
|
|
@@ -2385,12 +2518,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2385
2518
|
tempOrder: tempOrder
|
|
2386
2519
|
});
|
|
2387
2520
|
case 13:
|
|
2388
|
-
return _context23.abrupt("return", {
|
|
2389
|
-
isAvailable: raw.isAvailable
|
|
2521
|
+
return _context23.abrupt("return", _objectSpread(_objectSpread({
|
|
2522
|
+
isAvailable: raw.isAvailable
|
|
2523
|
+
}, raw.isAccepted !== undefined ? {
|
|
2524
|
+
isAccepted: raw.isAccepted
|
|
2525
|
+
} : {}), {}, {
|
|
2390
2526
|
type: raw.type,
|
|
2391
2527
|
unavailableReason: raw.unavailableReason,
|
|
2392
2528
|
scannedDiscountList: raw.scannedDiscountList
|
|
2393
|
-
});
|
|
2529
|
+
}));
|
|
2394
2530
|
case 16:
|
|
2395
2531
|
_context23.prev = 16;
|
|
2396
2532
|
_context23.t0 = _context23["catch"](0);
|
|
@@ -2401,7 +2537,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2401
2537
|
}
|
|
2402
2538
|
}, _callee23, this, [[0, 16]]);
|
|
2403
2539
|
}));
|
|
2404
|
-
function scanPromotionCode(
|
|
2540
|
+
function scanPromotionCode(_x17, _x18) {
|
|
2405
2541
|
return _scanPromotionCode.apply(this, arguments);
|
|
2406
2542
|
}
|
|
2407
2543
|
return scanPromotionCode;
|
|
@@ -2516,10 +2652,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2516
2652
|
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
2517
2653
|
if (Array.isArray(product.product_bundle)) {
|
|
2518
2654
|
product.product_bundle = product.product_bundle.map(function (bundle) {
|
|
2519
|
-
var
|
|
2655
|
+
var _ref31, _bundle$original_pric;
|
|
2520
2656
|
var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
|
|
2521
2657
|
var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
|
|
2522
|
-
var restoredBundlePrice = (
|
|
2658
|
+
var restoredBundlePrice = (_ref31 = (_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 && _ref31 !== void 0 ? _ref31 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
|
|
2523
2659
|
return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
|
|
2524
2660
|
price: restoredBundlePrice,
|
|
2525
2661
|
bundle_selling_price: restoredBundlePrice
|
|
@@ -2592,7 +2728,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2592
2728
|
}
|
|
2593
2729
|
}, _callee24, this, [[0, 54], [17, 38, 41, 44]]);
|
|
2594
2730
|
}));
|
|
2595
|
-
function setDiscountSelected(
|
|
2731
|
+
function setDiscountSelected(_x19) {
|
|
2596
2732
|
return _setDiscountSelected.apply(this, arguments);
|
|
2597
2733
|
}
|
|
2598
2734
|
return setDiscountSelected;
|
|
@@ -2662,7 +2798,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2662
2798
|
}
|
|
2663
2799
|
}, _callee25, this, [[0, 21]]);
|
|
2664
2800
|
}));
|
|
2665
|
-
function applyDiscountCalculationResult(
|
|
2801
|
+
function applyDiscountCalculationResult(_x20) {
|
|
2666
2802
|
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
2667
2803
|
}
|
|
2668
2804
|
return applyDiscountCalculationResult;
|
|
@@ -2681,7 +2817,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2681
2817
|
}
|
|
2682
2818
|
}, _callee26, this);
|
|
2683
2819
|
}));
|
|
2684
|
-
function submitScanOrder(
|
|
2820
|
+
function submitScanOrder(_x21) {
|
|
2685
2821
|
return _submitScanOrder.apply(this, arguments);
|
|
2686
2822
|
}
|
|
2687
2823
|
return submitScanOrder;
|
|
@@ -2696,7 +2832,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2696
2832
|
key: "submitSalesOrder",
|
|
2697
2833
|
value: (function () {
|
|
2698
2834
|
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2699
|
-
var _this$
|
|
2835
|
+
var _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14;
|
|
2700
2836
|
var inferredPaymentStatus, submitParams;
|
|
2701
2837
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2702
2838
|
while (1) switch (_context27.prev = _context27.next) {
|
|
@@ -2711,10 +2847,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2711
2847
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
2712
2848
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2713
2849
|
cacheId: this.cacheId,
|
|
2714
|
-
platform: (_this$
|
|
2715
|
-
businessCode: ((_this$
|
|
2850
|
+
platform: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.platform,
|
|
2851
|
+
businessCode: ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode) || ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.business_code),
|
|
2716
2852
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2717
|
-
type: (_this$
|
|
2853
|
+
type: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.type,
|
|
2718
2854
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
2719
2855
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
2720
2856
|
payments: params.payments
|
|
@@ -2734,7 +2870,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2734
2870
|
}
|
|
2735
2871
|
}, _callee27, this);
|
|
2736
2872
|
}));
|
|
2737
|
-
function submitSalesOrder(
|
|
2873
|
+
function submitSalesOrder(_x22) {
|
|
2738
2874
|
return _submitSalesOrder.apply(this, arguments);
|
|
2739
2875
|
}
|
|
2740
2876
|
return submitSalesOrder;
|
|
@@ -2743,7 +2879,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2743
2879
|
key: "saveSalesOrderDraft",
|
|
2744
2880
|
value: function () {
|
|
2745
2881
|
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2746
|
-
var _params$platform, _this$
|
|
2882
|
+
var _params$platform, _this$otherParams15, _this$otherParams16, _this$otherParams17, _params$channel, _params$type, _this$otherParams18;
|
|
2747
2883
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2748
2884
|
while (1) switch (_context28.prev = _context28.next) {
|
|
2749
2885
|
case 0:
|
|
@@ -2755,10 +2891,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2755
2891
|
case 2:
|
|
2756
2892
|
return _context28.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
|
|
2757
2893
|
cacheId: this.cacheId,
|
|
2758
|
-
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$
|
|
2759
|
-
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$
|
|
2894
|
+
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.platform,
|
|
2895
|
+
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.businessCode) || ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.business_code),
|
|
2760
2896
|
channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
|
|
2761
|
-
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$
|
|
2897
|
+
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.type
|
|
2762
2898
|
}, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2763
2899
|
enhancePayload: params.enhancePayload
|
|
2764
2900
|
} : {})));
|
|
@@ -2768,7 +2904,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2768
2904
|
}
|
|
2769
2905
|
}, _callee28, this);
|
|
2770
2906
|
}));
|
|
2771
|
-
function saveSalesOrderDraft(
|
|
2907
|
+
function saveSalesOrderDraft(_x23) {
|
|
2772
2908
|
return _saveSalesOrderDraft.apply(this, arguments);
|
|
2773
2909
|
}
|
|
2774
2910
|
return saveSalesOrderDraft;
|
|
@@ -2777,7 +2913,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2777
2913
|
key: "submitTempOrderAsync",
|
|
2778
2914
|
value: function () {
|
|
2779
2915
|
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
2780
|
-
var _this$
|
|
2916
|
+
var _this$otherParams19, _this$otherParams20, _this$otherParams21, _this$otherParams22;
|
|
2781
2917
|
var inferredPaymentStatus, submitParams;
|
|
2782
2918
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2783
2919
|
while (1) switch (_context29.prev = _context29.next) {
|
|
@@ -2791,10 +2927,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2791
2927
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
2792
2928
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2793
2929
|
cacheId: this.cacheId,
|
|
2794
|
-
platform: (_this$
|
|
2795
|
-
businessCode: ((_this$
|
|
2930
|
+
platform: (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.platform,
|
|
2931
|
+
businessCode: ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.businessCode) || ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.business_code),
|
|
2796
2932
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2797
|
-
type: (_this$
|
|
2933
|
+
type: (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.type
|
|
2798
2934
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
2799
2935
|
payments: params.payments
|
|
2800
2936
|
} : {}), inferredPaymentStatus !== undefined ? {
|
|
@@ -2813,7 +2949,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2813
2949
|
}
|
|
2814
2950
|
}, _callee29, this);
|
|
2815
2951
|
}));
|
|
2816
|
-
function submitTempOrderAsync(
|
|
2952
|
+
function submitTempOrderAsync(_x24) {
|
|
2817
2953
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
2818
2954
|
}
|
|
2819
2955
|
return submitTempOrderAsync;
|
|
@@ -2822,7 +2958,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2822
2958
|
key: "printLocalOrderReceipt",
|
|
2823
2959
|
value: function () {
|
|
2824
2960
|
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(lookup) {
|
|
2825
|
-
var _this$
|
|
2961
|
+
var _this$otherParams23, _this$otherParams24, _this$otherParams25, _this$otherParams26;
|
|
2826
2962
|
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order5, _data;
|
|
2827
2963
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2828
2964
|
while (1) switch (_context30.prev = _context30.next) {
|
|
@@ -2840,10 +2976,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2840
2976
|
external_sale_number: lookup
|
|
2841
2977
|
};
|
|
2842
2978
|
context = {
|
|
2843
|
-
platform: (_this$
|
|
2844
|
-
businessCode: ((_this$
|
|
2979
|
+
platform: (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.platform,
|
|
2980
|
+
businessCode: ((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.businessCode) || ((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.business_code),
|
|
2845
2981
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2846
|
-
type: (_this$
|
|
2982
|
+
type: (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.type
|
|
2847
2983
|
};
|
|
2848
2984
|
payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
|
|
2849
2985
|
lookup_order_from_db: 1,
|
|
@@ -2880,7 +3016,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2880
3016
|
}
|
|
2881
3017
|
}, _callee30, this);
|
|
2882
3018
|
}));
|
|
2883
|
-
function printLocalOrderReceipt(
|
|
3019
|
+
function printLocalOrderReceipt(_x25) {
|
|
2884
3020
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
2885
3021
|
}
|
|
2886
3022
|
return printLocalOrderReceipt;
|
|
@@ -2894,7 +3030,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2894
3030
|
if (!amountSnapshot) return undefined;
|
|
2895
3031
|
try {
|
|
2896
3032
|
return new Decimal(amountSnapshot.amountGap || 0).lte(0) ? 'paid' : undefined;
|
|
2897
|
-
} catch (
|
|
3033
|
+
} catch (_unused4) {
|
|
2898
3034
|
return undefined;
|
|
2899
3035
|
}
|
|
2900
3036
|
}
|
|
@@ -2902,7 +3038,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2902
3038
|
key: "syncPaymentsToOrder",
|
|
2903
3039
|
value: function () {
|
|
2904
3040
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
2905
|
-
var
|
|
3041
|
+
var _ref32, _params$businessCode, _this$otherParams27, _this$otherParams28, _params$channel2;
|
|
2906
3042
|
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
2907
3043
|
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2908
3044
|
while (1) switch (_context31.prev = _context31.next) {
|
|
@@ -2913,7 +3049,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2913
3049
|
}
|
|
2914
3050
|
throw new Error('order 模块未初始化');
|
|
2915
3051
|
case 2:
|
|
2916
|
-
businessCode = (
|
|
3052
|
+
businessCode = (_ref32 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.businessCode) !== null && _ref32 !== void 0 ? _ref32 : (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.business_code;
|
|
2917
3053
|
channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
|
|
2918
3054
|
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
|
|
2919
3055
|
businessCode: businessCode
|
|
@@ -2992,7 +3128,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2992
3128
|
}
|
|
2993
3129
|
}, _callee31, this, [[12, 29]]);
|
|
2994
3130
|
}));
|
|
2995
|
-
function syncPaymentsToOrder(
|
|
3131
|
+
function syncPaymentsToOrder(_x26) {
|
|
2996
3132
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
2997
3133
|
}
|
|
2998
3134
|
return syncPaymentsToOrder;
|
|
@@ -3162,7 +3298,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3162
3298
|
}
|
|
3163
3299
|
}, _callee33, this);
|
|
3164
3300
|
}));
|
|
3165
|
-
function addOrderPaymentAsync(
|
|
3301
|
+
function addOrderPaymentAsync(_x27) {
|
|
3166
3302
|
return _addOrderPaymentAsync.apply(this, arguments);
|
|
3167
3303
|
}
|
|
3168
3304
|
return addOrderPaymentAsync;
|
|
@@ -3170,10 +3306,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3170
3306
|
}, {
|
|
3171
3307
|
key: "addOrderPaymentWithDevicePrefix",
|
|
3172
3308
|
value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
|
|
3173
|
-
var _this$
|
|
3309
|
+
var _this$otherParams29,
|
|
3174
3310
|
_paymentRecord$paymen,
|
|
3175
3311
|
_paymentRecord$create,
|
|
3176
|
-
|
|
3312
|
+
_ref33,
|
|
3177
3313
|
_paymentRecord$origin,
|
|
3178
3314
|
_this14 = this;
|
|
3179
3315
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
@@ -3186,7 +3322,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3186
3322
|
return this.store.order.getOrderPayments();
|
|
3187
3323
|
}
|
|
3188
3324
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
3189
|
-
var shopWalletPassId = (_this$
|
|
3325
|
+
var shopWalletPassId = (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.shop_wallet_pass_id;
|
|
3190
3326
|
if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
|
|
3191
3327
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
3192
3328
|
}
|
|
@@ -3195,7 +3331,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3195
3331
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
3196
3332
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
3197
3333
|
var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
|
|
3198
|
-
var calculatedServiceFee = serviceCharge ? new Decimal((
|
|
3334
|
+
var calculatedServiceFee = serviceCharge ? new Decimal((_ref33 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref33 !== void 0 ? _ref33 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
|
|
3199
3335
|
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, normalizedPaymentRecord), calculatedServiceFee !== undefined ? {
|
|
3200
3336
|
service_fee: calculatedServiceFee
|
|
3201
3337
|
} : {}), {}, {
|
|
@@ -3350,7 +3486,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3350
3486
|
}
|
|
3351
3487
|
}, _callee34, this, [[17, 23]]);
|
|
3352
3488
|
}));
|
|
3353
|
-
function updateOrderPayment(
|
|
3489
|
+
function updateOrderPayment(_x28, _x29) {
|
|
3354
3490
|
return _updateOrderPayment.apply(this, arguments);
|
|
3355
3491
|
}
|
|
3356
3492
|
return updateOrderPayment;
|
|
@@ -3389,7 +3525,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3389
3525
|
}
|
|
3390
3526
|
}, _callee35, this);
|
|
3391
3527
|
}));
|
|
3392
|
-
function updateVoucherOrderPaymentsAsync(
|
|
3528
|
+
function updateVoucherOrderPaymentsAsync(_x30, _x31) {
|
|
3393
3529
|
return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
|
|
3394
3530
|
}
|
|
3395
3531
|
return updateVoucherOrderPaymentsAsync;
|
|
@@ -3398,7 +3534,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3398
3534
|
key: "confirmPendingVoucherPayments",
|
|
3399
3535
|
value: function confirmPendingVoucherPayments() {
|
|
3400
3536
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
3401
|
-
|
|
3537
|
+
var payments = this.store.order.confirmPendingVoucherPayments();
|
|
3538
|
+
if (this.store.payment) {
|
|
3539
|
+
var committed = this.getCommittedWalletAssets();
|
|
3540
|
+
var state = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
3541
|
+
void this.publishWalletAssetsState(state);
|
|
3542
|
+
}
|
|
3543
|
+
return payments;
|
|
3402
3544
|
}
|
|
3403
3545
|
}, {
|
|
3404
3546
|
key: "discardPendingVoucherPayments",
|
|
@@ -3467,12 +3609,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3467
3609
|
});
|
|
3468
3610
|
return walletProducts;
|
|
3469
3611
|
}
|
|
3612
|
+
}, {
|
|
3613
|
+
key: "buildWalletInitBusinessData",
|
|
3614
|
+
value: function buildWalletInitBusinessData(params) {
|
|
3615
|
+
var _this$store$order8, _params$order_wait_pa, _ref34, _tempOrder$is_price_i;
|
|
3616
|
+
var snapshot = (_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 ? void 0 : _this$store$order8.getOrderSnapshot();
|
|
3617
|
+
var tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
3618
|
+
var amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
3619
|
+
if (!tempOrder || !amount) return null;
|
|
3620
|
+
return _objectSpread({
|
|
3621
|
+
customer_id: tempOrder.customer_id ? Number(tempOrder.customer_id) : undefined,
|
|
3622
|
+
holder: tempOrder.holder,
|
|
3623
|
+
amountInfo: {
|
|
3624
|
+
totalAmount: amount.totalAmount,
|
|
3625
|
+
subTotal: amount.summary.product_amount || amount.summary.product_expect_amount || amount.totalAmount,
|
|
3626
|
+
depositAmount: amount.depositAmount,
|
|
3627
|
+
isDeposit: tempOrder.is_deposit
|
|
3628
|
+
},
|
|
3629
|
+
products: this.getWalletProductList(),
|
|
3630
|
+
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),
|
|
3631
|
+
is_price_include_tax: (_ref34 = (_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 && _ref34 !== void 0 ? _ref34 : 1
|
|
3632
|
+
}, snapshot.identity.orderId ? {
|
|
3633
|
+
payment_order_id: String(snapshot.identity.orderId)
|
|
3634
|
+
} : {});
|
|
3635
|
+
}
|
|
3470
3636
|
}, {
|
|
3471
3637
|
key: "initWalletData",
|
|
3472
3638
|
value: function () {
|
|
3473
3639
|
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
3474
|
-
var
|
|
3475
|
-
var snapshot,
|
|
3640
|
+
var _snapshot$identity;
|
|
3641
|
+
var snapshot, walletBusinessData, result;
|
|
3476
3642
|
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3477
3643
|
while (1) switch (_context36.prev = _context36.next) {
|
|
3478
3644
|
case 0:
|
|
@@ -3489,10 +3655,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3489
3655
|
throw new Error('payment 模块未初始化');
|
|
3490
3656
|
case 4:
|
|
3491
3657
|
snapshot = this.store.order.getOrderSnapshot();
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
_context36.next = 9;
|
|
3658
|
+
walletBusinessData = this.buildWalletInitBusinessData(params);
|
|
3659
|
+
if (walletBusinessData) {
|
|
3660
|
+
_context36.next = 8;
|
|
3496
3661
|
break;
|
|
3497
3662
|
}
|
|
3498
3663
|
return _context36.abrupt("return", {
|
|
@@ -3502,29 +3667,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3502
3667
|
noApplicableVoucher: [],
|
|
3503
3668
|
products: []
|
|
3504
3669
|
});
|
|
3505
|
-
case
|
|
3506
|
-
|
|
3507
|
-
customer_id: tempOrder.customer_id ? Number(tempOrder.customer_id) : undefined,
|
|
3508
|
-
holder: tempOrder.holder,
|
|
3509
|
-
amountInfo: {
|
|
3510
|
-
totalAmount: amount.totalAmount,
|
|
3511
|
-
subTotal: amount.summary.product_amount || amount.summary.product_expect_amount || amount.totalAmount,
|
|
3512
|
-
depositAmount: amount.depositAmount,
|
|
3513
|
-
isDeposit: tempOrder.is_deposit
|
|
3514
|
-
},
|
|
3515
|
-
products: this.getWalletProductList(),
|
|
3516
|
-
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),
|
|
3517
|
-
is_price_include_tax: (_ref24 = (_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 && _ref24 !== void 0 ? _ref24 : 1
|
|
3518
|
-
}, snapshot.identity.orderId ? {
|
|
3519
|
-
payment_order_id: String(snapshot.identity.orderId)
|
|
3520
|
-
} : {});
|
|
3521
|
-
_context36.next = 12;
|
|
3670
|
+
case 8:
|
|
3671
|
+
_context36.next = 10;
|
|
3522
3672
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
3523
|
-
case
|
|
3673
|
+
case 10:
|
|
3524
3674
|
result = _context36.sent;
|
|
3525
|
-
_context36.next =
|
|
3675
|
+
_context36.next = 13;
|
|
3526
3676
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
3527
|
-
orderId: snapshot.identity.orderId,
|
|
3677
|
+
orderId: snapshot === null || snapshot === void 0 || (_snapshot$identity = snapshot.identity) === null || _snapshot$identity === void 0 ? void 0 : _snapshot$identity.orderId,
|
|
3528
3678
|
customerId: walletBusinessData.customer_id,
|
|
3529
3679
|
walletBusinessData: {
|
|
3530
3680
|
customer_id: walletBusinessData.customer_id,
|
|
@@ -3533,223 +3683,1127 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3533
3683
|
},
|
|
3534
3684
|
timestamp: Date.now()
|
|
3535
3685
|
});
|
|
3536
|
-
case
|
|
3686
|
+
case 13:
|
|
3537
3687
|
return _context36.abrupt("return", result);
|
|
3538
|
-
case
|
|
3688
|
+
case 14:
|
|
3539
3689
|
case "end":
|
|
3540
3690
|
return _context36.stop();
|
|
3541
3691
|
}
|
|
3542
3692
|
}, _callee36, this);
|
|
3543
3693
|
}));
|
|
3544
|
-
function initWalletData(
|
|
3694
|
+
function initWalletData(_x32) {
|
|
3545
3695
|
return _initWalletData.apply(this, arguments);
|
|
3546
3696
|
}
|
|
3547
3697
|
return initWalletData;
|
|
3548
3698
|
}()
|
|
3549
|
-
/**
|
|
3550
|
-
* 更新当前订单客户字段。
|
|
3551
|
-
*
|
|
3552
|
-
* 这是 PaymentModal 客户切换的订单事实入口;外部客户模块同步应由
|
|
3553
|
-
* 调用方通过 onCustomerChange 回调完成。
|
|
3554
|
-
*/
|
|
3555
3699
|
}, {
|
|
3556
|
-
key: "
|
|
3557
|
-
value: function
|
|
3558
|
-
|
|
3559
|
-
var
|
|
3560
|
-
|
|
3561
|
-
|
|
3700
|
+
key: "getCommittedWalletAssets",
|
|
3701
|
+
value: function getCommittedWalletAssets() {
|
|
3702
|
+
var _this$store$order9, _this$store$order9$ge;
|
|
3703
|
+
var payments = ((_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 || (_this$store$order9$ge = _this$store$order9.getOrderPayments) === null || _this$store$order9$ge === void 0 ? void 0 : _this$store$order9$ge.call(_this$store$order9)) || [];
|
|
3704
|
+
var committed = payments.filter(function (payment) {
|
|
3705
|
+
var voucherId = payment === null || payment === void 0 ? void 0 : payment.voucher_id;
|
|
3706
|
+
if (voucherId === undefined || voucherId === null || voucherId === 0) {
|
|
3707
|
+
return false;
|
|
3708
|
+
}
|
|
3709
|
+
return (payment === null || payment === void 0 ? void 0 : payment.status) === 'paid' || (payment === null || payment === void 0 ? void 0 : payment.isSynced) === true || (payment === null || payment === void 0 ? void 0 : payment.order_payment_id) !== undefined && (payment === null || payment === void 0 ? void 0 : payment.order_payment_id) !== null && (payment === null || payment === void 0 ? void 0 : payment.order_payment_id) !== '';
|
|
3562
3710
|
});
|
|
3563
|
-
|
|
3564
|
-
|
|
3711
|
+
return {
|
|
3712
|
+
ids: committed.map(function (payment) {
|
|
3713
|
+
return payment.voucher_id;
|
|
3714
|
+
}),
|
|
3715
|
+
assets: committed.map(function (payment) {
|
|
3716
|
+
var _Object$entries$find;
|
|
3717
|
+
var fundRecord = (payment === null || payment === void 0 ? void 0 : payment.fund_record) || {};
|
|
3718
|
+
var walletPassName = fundRecord.wallet_pass_name;
|
|
3719
|
+
var title = walletPassName && _typeof(walletPassName) === 'object' ? walletPassName.default || Object.values(walletPassName)[0] : walletPassName;
|
|
3720
|
+
var code = String((payment === null || payment === void 0 ? void 0 : payment.code) || '').toUpperCase();
|
|
3721
|
+
var tag = ((_Object$entries$find = Object.entries(WALLET_PAYMENT_CODE_BY_TAG).find(function (_ref35) {
|
|
3722
|
+
var _ref36 = _slicedToArray(_ref35, 2),
|
|
3723
|
+
paymentCode = _ref36[1];
|
|
3724
|
+
return paymentCode === code;
|
|
3725
|
+
})) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[0]) || fundRecord.tag;
|
|
3726
|
+
return {
|
|
3727
|
+
id: payment.voucher_id,
|
|
3728
|
+
voucher_id: payment.voucher_id,
|
|
3729
|
+
code: fundRecord.code,
|
|
3730
|
+
tag: tag,
|
|
3731
|
+
product_name: title || payment.name,
|
|
3732
|
+
name: title || payment.name,
|
|
3733
|
+
amount: Number(payment.amount || 0),
|
|
3734
|
+
_available_max_amount: Number(payment.amount || 0),
|
|
3735
|
+
unified_available_status: 1,
|
|
3736
|
+
_unified_available_status: 1,
|
|
3737
|
+
_committed_payment: payment
|
|
3738
|
+
};
|
|
3739
|
+
})
|
|
3740
|
+
};
|
|
3565
3741
|
}
|
|
3566
|
-
|
|
3567
|
-
/** 获取可用支付方式列表,供 PaymentModal 渲染支付选项。 */
|
|
3568
3742
|
}, {
|
|
3569
|
-
key: "
|
|
3570
|
-
value:
|
|
3571
|
-
var
|
|
3572
|
-
var response, paymentMethods;
|
|
3743
|
+
key: "publishWalletAssetsState",
|
|
3744
|
+
value: function () {
|
|
3745
|
+
var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(state) {
|
|
3573
3746
|
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3574
3747
|
while (1) switch (_context37.prev = _context37.next) {
|
|
3575
3748
|
case 0:
|
|
3576
|
-
_context37.
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
filterPaymentMethods: true
|
|
3580
|
-
}, {
|
|
3581
|
-
osServer: true
|
|
3749
|
+
_context37.next = 2;
|
|
3750
|
+
return this.effectsEmit(BaseSalesHookNames.onWalletAssetsStateChanged, {
|
|
3751
|
+
state: state
|
|
3582
3752
|
});
|
|
3753
|
+
case 2:
|
|
3754
|
+
return _context37.abrupt("return", state);
|
|
3583
3755
|
case 3:
|
|
3584
|
-
response = _context37.sent;
|
|
3585
|
-
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
3586
|
-
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
3587
|
-
return _context37.abrupt("return", this.getPaymentMethods());
|
|
3588
|
-
case 9:
|
|
3589
|
-
_context37.prev = 9;
|
|
3590
|
-
_context37.t0 = _context37["catch"](0);
|
|
3591
|
-
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
3592
|
-
error: _context37.t0 instanceof Error ? _context37.t0.message : String(_context37.t0)
|
|
3593
|
-
});
|
|
3594
|
-
return _context37.abrupt("return", this.getPaymentMethods());
|
|
3595
|
-
case 13:
|
|
3596
3756
|
case "end":
|
|
3597
3757
|
return _context37.stop();
|
|
3598
3758
|
}
|
|
3599
|
-
}, _callee37, this
|
|
3759
|
+
}, _callee37, this);
|
|
3600
3760
|
}));
|
|
3601
|
-
function
|
|
3602
|
-
return
|
|
3603
|
-
}
|
|
3604
|
-
return getPaymentMethodsAsync;
|
|
3605
|
-
}() /** 同步读取初始化时缓存的支付方式列表。 */)
|
|
3606
|
-
}, {
|
|
3607
|
-
key: "getPaymentMethods",
|
|
3608
|
-
value: function getPaymentMethods() {
|
|
3609
|
-
return _toConsumableArray(this.paymentMethodsCache);
|
|
3610
|
-
}
|
|
3611
|
-
|
|
3612
|
-
/** 轻量舍入能力,供现金支付 UI 计算 rounding_amount。 */
|
|
3613
|
-
}, {
|
|
3614
|
-
key: "roundAmount",
|
|
3615
|
-
value: function roundAmount(params) {
|
|
3616
|
-
var amount = new Decimal(params.amount || 0);
|
|
3617
|
-
var interval = new Decimal(params.interval || 0.05);
|
|
3618
|
-
var rule = params.rule || 'standard_rounding';
|
|
3619
|
-
var quotient = amount.div(interval);
|
|
3620
|
-
var roundedQuotient;
|
|
3621
|
-
if (rule === 'always_up') {
|
|
3622
|
-
roundedQuotient = quotient.ceil();
|
|
3623
|
-
} else if (rule === 'always_down') {
|
|
3624
|
-
roundedQuotient = quotient.floor();
|
|
3625
|
-
} else if (rule === 'standard_down') {
|
|
3626
|
-
roundedQuotient = quotient.toDecimalPlaces(0, Decimal.ROUND_HALF_DOWN);
|
|
3627
|
-
} else {
|
|
3628
|
-
roundedQuotient = quotient.toDecimalPlaces(0, Decimal.ROUND_HALF_UP);
|
|
3761
|
+
function publishWalletAssetsState(_x33) {
|
|
3762
|
+
return _publishWalletAssetsState.apply(this, arguments);
|
|
3629
3763
|
}
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
originalAmount: amount.toFixed(2),
|
|
3633
|
-
roundedAmount: roundedAmount.toFixed(2),
|
|
3634
|
-
roundingDifference: roundedAmount.minus(amount).toFixed(2)
|
|
3635
|
-
};
|
|
3636
|
-
}
|
|
3637
|
-
|
|
3638
|
-
/**
|
|
3639
|
-
* 发送支付链接。
|
|
3640
|
-
*
|
|
3641
|
-
* 如果没有 orderIds 或显式 submitBeforeSend,会先提交当前本地订单到云端;
|
|
3642
|
-
* 只有成功拿到远端 order_id 后才调用 OrderModule 发送邮件。
|
|
3643
|
-
*/
|
|
3764
|
+
return publishWalletAssetsState;
|
|
3765
|
+
}()
|
|
3644
3766
|
}, {
|
|
3645
|
-
key: "
|
|
3646
|
-
value:
|
|
3647
|
-
var
|
|
3648
|
-
var
|
|
3767
|
+
key: "syncSelectedWalletAssets",
|
|
3768
|
+
value: function () {
|
|
3769
|
+
var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(state) {
|
|
3770
|
+
var paymentMethods, methodByCode, preparePayments, selectedAssetById, voucherPayments, payments;
|
|
3649
3771
|
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3650
3772
|
while (1) switch (_context38.prev = _context38.next) {
|
|
3651
3773
|
case 0:
|
|
3652
|
-
if (this.store.order) {
|
|
3774
|
+
if (!(!this.store.order || !this.store.payment)) {
|
|
3653
3775
|
_context38.next = 2;
|
|
3654
3776
|
break;
|
|
3655
3777
|
}
|
|
3656
|
-
throw new Error('
|
|
3778
|
+
throw new Error('订单或支付模块未初始化');
|
|
3657
3779
|
case 2:
|
|
3658
|
-
|
|
3659
|
-
if (!(!
|
|
3660
|
-
_context38.next =
|
|
3780
|
+
paymentMethods = this.getPaymentMethods();
|
|
3781
|
+
if (!(!paymentMethods.length && state.selectedItems.length)) {
|
|
3782
|
+
_context38.next = 7;
|
|
3661
3783
|
break;
|
|
3662
3784
|
}
|
|
3663
3785
|
_context38.next = 6;
|
|
3664
|
-
return this.
|
|
3665
|
-
smallTicketDataFlag: 1
|
|
3666
|
-
});
|
|
3786
|
+
return this.getPaymentMethodsAsync();
|
|
3667
3787
|
case 6:
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
break;
|
|
3673
|
-
}
|
|
3674
|
-
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
3675
|
-
case 10:
|
|
3676
|
-
orderIds = [orderId];
|
|
3677
|
-
case 11:
|
|
3678
|
-
return _context38.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
3679
|
-
emails: params.emails,
|
|
3680
|
-
notify_action: params.notify_action,
|
|
3681
|
-
order_ids: orderIds
|
|
3788
|
+
paymentMethods = _context38.sent;
|
|
3789
|
+
case 7:
|
|
3790
|
+
methodByCode = new Map(paymentMethods.map(function (method) {
|
|
3791
|
+
return [String(method.code || '').toUpperCase(), method];
|
|
3682
3792
|
}));
|
|
3683
|
-
|
|
3793
|
+
preparePayments = this.store.payment.wallet.formatWalletPassList2PreparePayments(state.selectedItems);
|
|
3794
|
+
selectedAssetById = new Map(state.selectedItems.map(function (asset) {
|
|
3795
|
+
return [String(getSharedWalletAssetId(asset)), asset];
|
|
3796
|
+
}));
|
|
3797
|
+
voucherPayments = preparePayments.flatMap(function (item) {
|
|
3798
|
+
var asset = selectedAssetById.get(String(item.voucher_id));
|
|
3799
|
+
var paymentCode = WALLET_PAYMENT_CODE_BY_TAG[String(item.tag || (asset === null || asset === void 0 ? void 0 : asset.tag) || '')] || String(item.tag || (asset === null || asset === void 0 ? void 0 : asset.tag) || '').toUpperCase();
|
|
3800
|
+
var paymentMethod = methodByCode.get(paymentCode);
|
|
3801
|
+
var formattedAmount = Number(item.amount);
|
|
3802
|
+
var amount = Number.isFinite(formattedAmount) && formattedAmount > 0 ? formattedAmount : getSharedWalletAssetAmount(asset);
|
|
3803
|
+
if (!asset || !paymentMethod || !Number.isFinite(amount) || amount <= 0) {
|
|
3804
|
+
return [];
|
|
3805
|
+
}
|
|
3806
|
+
var walletPassUseValue = getSharedWalletPassUseValue({
|
|
3807
|
+
asset: asset,
|
|
3808
|
+
amount: amount,
|
|
3809
|
+
paymentMethod: paymentMethod
|
|
3810
|
+
});
|
|
3811
|
+
return [{
|
|
3812
|
+
amount: amount.toFixed(2),
|
|
3813
|
+
code: paymentMethod.code,
|
|
3814
|
+
custom_payment_id: paymentMethod.id,
|
|
3815
|
+
name: paymentMethod.name,
|
|
3816
|
+
type: paymentMethod.type,
|
|
3817
|
+
voucher_id: item.voucher_id,
|
|
3818
|
+
wallet_pass_usage_unit: item.wallet_pass_usage_unit,
|
|
3819
|
+
wallet_pass_use_value: walletPassUseValue,
|
|
3820
|
+
fund_record: buildSharedWalletFundRecord({
|
|
3821
|
+
asset: asset,
|
|
3822
|
+
amount: amount,
|
|
3823
|
+
paymentMethod: paymentMethod
|
|
3824
|
+
})
|
|
3825
|
+
}];
|
|
3826
|
+
});
|
|
3827
|
+
payments = this.updateVoucherOrderPayments(voucherPayments, {
|
|
3828
|
+
status: 'payment_pending'
|
|
3829
|
+
});
|
|
3830
|
+
_context38.next = 14;
|
|
3831
|
+
return this.store.order.recalculateSummary({
|
|
3832
|
+
createIfMissing: true
|
|
3833
|
+
});
|
|
3834
|
+
case 14:
|
|
3835
|
+
return _context38.abrupt("return", payments);
|
|
3836
|
+
case 15:
|
|
3684
3837
|
case "end":
|
|
3685
3838
|
return _context38.stop();
|
|
3686
3839
|
}
|
|
3687
3840
|
}, _callee38, this);
|
|
3688
3841
|
}));
|
|
3689
|
-
function
|
|
3690
|
-
return
|
|
3842
|
+
function syncSelectedWalletAssets(_x34) {
|
|
3843
|
+
return _syncSelectedWalletAssets.apply(this, arguments);
|
|
3691
3844
|
}
|
|
3692
|
-
return
|
|
3693
|
-
}()
|
|
3845
|
+
return syncSelectedWalletAssets;
|
|
3846
|
+
}() /** 读取购物车与 Shared Checkout 共用的钱包资产状态。 */
|
|
3694
3847
|
}, {
|
|
3695
|
-
key: "
|
|
3696
|
-
value: function
|
|
3697
|
-
|
|
3848
|
+
key: "getWalletAssetsState",
|
|
3849
|
+
value: function getWalletAssetsState() {
|
|
3850
|
+
if (!this.store.payment) throw new Error('payment 模块未初始化');
|
|
3851
|
+
return this.store.payment.wallet.getWalletAssetsState();
|
|
3698
3852
|
}
|
|
3853
|
+
|
|
3854
|
+
/** 导出 Shared Checkout 跨运行时恢复所需的钱包状态与搜索缓存。 */
|
|
3699
3855
|
}, {
|
|
3700
|
-
key: "
|
|
3701
|
-
value: function () {
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3856
|
+
key: "exportWalletAssetsSnapshot",
|
|
3857
|
+
value: function exportWalletAssetsSnapshot() {
|
|
3858
|
+
if (!this.store.payment) throw new Error('payment 模块未初始化');
|
|
3859
|
+
return this.store.payment.wallet.exportWalletAssetsSnapshot();
|
|
3860
|
+
}
|
|
3861
|
+
|
|
3862
|
+
/** 配置仅影响 Wallet Assets,不改变 Promotion/Voucher 选择流程。 */
|
|
3863
|
+
}, {
|
|
3864
|
+
key: "configureWalletAssetsBehavior",
|
|
3865
|
+
value: function configureWalletAssetsBehavior(options) {
|
|
3866
|
+
if (!this.store.payment) throw new Error('payment 模块未初始化');
|
|
3867
|
+
this.store.payment.wallet.configureWalletAssetsBehavior(options);
|
|
3868
|
+
}
|
|
3869
|
+
|
|
3870
|
+
/**
|
|
3871
|
+
* 恢复 Shared Checkout 钱包快照,并把选择重新同步为订单 pending payment。
|
|
3872
|
+
*/
|
|
3873
|
+
}, {
|
|
3874
|
+
key: "importWalletAssetsSnapshot",
|
|
3875
|
+
value: (function () {
|
|
3876
|
+
var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(snapshot) {
|
|
3877
|
+
var state;
|
|
3705
3878
|
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3706
3879
|
while (1) switch (_context39.prev = _context39.next) {
|
|
3707
3880
|
case 0:
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
_context39.next =
|
|
3716
|
-
return this.
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
});
|
|
3721
|
-
case 8:
|
|
3722
|
-
return _context39.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
3723
|
-
product: product,
|
|
3724
|
-
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
3725
|
-
customer_id: customerId,
|
|
3726
|
-
quotation: quotation
|
|
3727
|
-
})));
|
|
3728
|
-
case 9:
|
|
3881
|
+
if (this.store.payment) {
|
|
3882
|
+
_context39.next = 2;
|
|
3883
|
+
break;
|
|
3884
|
+
}
|
|
3885
|
+
throw new Error('payment 模块未初始化');
|
|
3886
|
+
case 2:
|
|
3887
|
+
state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
|
|
3888
|
+
_context39.next = 5;
|
|
3889
|
+
return this.syncSelectedWalletAssets(state);
|
|
3890
|
+
case 5:
|
|
3891
|
+
return _context39.abrupt("return", this.publishWalletAssetsState(state));
|
|
3892
|
+
case 6:
|
|
3729
3893
|
case "end":
|
|
3730
3894
|
return _context39.stop();
|
|
3731
3895
|
}
|
|
3732
3896
|
}, _callee39, this);
|
|
3733
3897
|
}));
|
|
3734
|
-
function
|
|
3735
|
-
return
|
|
3898
|
+
function importWalletAssetsSnapshot(_x35) {
|
|
3899
|
+
return _importWalletAssetsSnapshot.apply(this, arguments);
|
|
3736
3900
|
}
|
|
3737
|
-
return
|
|
3901
|
+
return importWalletAssetsSnapshot;
|
|
3738
3902
|
}()
|
|
3903
|
+
/**
|
|
3904
|
+
* 基于当前订单快照刷新钱包资产。商品变化保留并重验选择;客户变化强制清空。
|
|
3905
|
+
*/
|
|
3906
|
+
)
|
|
3739
3907
|
}, {
|
|
3740
|
-
key: "
|
|
3741
|
-
value: function
|
|
3742
|
-
var
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
return
|
|
3908
|
+
key: "refreshWalletAssets",
|
|
3909
|
+
value: (function () {
|
|
3910
|
+
var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
|
|
3911
|
+
var _previousState$custom, _businessData$custome;
|
|
3912
|
+
var refreshSequence, wallet, businessData, emptyState, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, committed;
|
|
3913
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3914
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3915
|
+
case 0:
|
|
3916
|
+
if (this.store.order) {
|
|
3917
|
+
_context40.next = 2;
|
|
3918
|
+
break;
|
|
3919
|
+
}
|
|
3920
|
+
throw new Error('order 模块未初始化');
|
|
3921
|
+
case 2:
|
|
3922
|
+
if (this.store.payment) {
|
|
3923
|
+
_context40.next = 4;
|
|
3924
|
+
break;
|
|
3925
|
+
}
|
|
3926
|
+
throw new Error('payment 模块未初始化');
|
|
3927
|
+
case 4:
|
|
3928
|
+
refreshSequence = ++this.walletAssetsRefreshSequence;
|
|
3929
|
+
wallet = this.store.payment.wallet;
|
|
3930
|
+
businessData = this.buildWalletInitBusinessData(params);
|
|
3931
|
+
if (businessData) {
|
|
3932
|
+
_context40.next = 12;
|
|
3933
|
+
break;
|
|
3934
|
+
}
|
|
3935
|
+
wallet.clearAllCache();
|
|
3936
|
+
emptyState = wallet.getWalletAssetsState();
|
|
3937
|
+
this.updateVoucherOrderPayments([], {
|
|
3938
|
+
status: 'payment_pending'
|
|
3939
|
+
});
|
|
3940
|
+
return _context40.abrupt("return", this.publishWalletAssetsState(emptyState));
|
|
3941
|
+
case 12:
|
|
3942
|
+
previousState = wallet.getWalletAssetsState();
|
|
3943
|
+
hasPreviousWalletContext = previousState.status !== 'idle' || previousState.items.length > 0 || previousState.selectedIds.length > 0 || previousState.customerId !== undefined;
|
|
3944
|
+
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 : '');
|
|
3945
|
+
if (!customerChanged) {
|
|
3946
|
+
_context40.next = 20;
|
|
3947
|
+
break;
|
|
3948
|
+
}
|
|
3949
|
+
clearedState = wallet.clearWalletAssetSelection();
|
|
3950
|
+
this.updateVoucherOrderPayments([], {
|
|
3951
|
+
status: 'payment_pending'
|
|
3952
|
+
});
|
|
3953
|
+
_context40.next = 20;
|
|
3954
|
+
return this.publishWalletAssetsState(clearedState);
|
|
3955
|
+
case 20:
|
|
3956
|
+
refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
|
|
3957
|
+
preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged
|
|
3958
|
+
});
|
|
3959
|
+
_context40.next = 23;
|
|
3960
|
+
return this.publishWalletAssetsState(wallet.getWalletAssetsState());
|
|
3961
|
+
case 23:
|
|
3962
|
+
_context40.next = 25;
|
|
3963
|
+
return refreshTask;
|
|
3964
|
+
case 25:
|
|
3965
|
+
state = _context40.sent;
|
|
3966
|
+
if (!(refreshSequence !== this.walletAssetsRefreshSequence)) {
|
|
3967
|
+
_context40.next = 28;
|
|
3968
|
+
break;
|
|
3969
|
+
}
|
|
3970
|
+
return _context40.abrupt("return", wallet.getWalletAssetsState());
|
|
3971
|
+
case 28:
|
|
3972
|
+
if (state.status !== 'error') {
|
|
3973
|
+
committed = this.getCommittedWalletAssets();
|
|
3974
|
+
state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
3975
|
+
}
|
|
3976
|
+
_context40.next = 31;
|
|
3977
|
+
return this.syncSelectedWalletAssets(state);
|
|
3978
|
+
case 31:
|
|
3979
|
+
return _context40.abrupt("return", this.publishWalletAssetsState(state));
|
|
3980
|
+
case 32:
|
|
3981
|
+
case "end":
|
|
3982
|
+
return _context40.stop();
|
|
3983
|
+
}
|
|
3984
|
+
}, _callee40, this);
|
|
3985
|
+
}));
|
|
3986
|
+
function refreshWalletAssets(_x36) {
|
|
3987
|
+
return _refreshWalletAssets.apply(this, arguments);
|
|
3746
3988
|
}
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3989
|
+
return refreshWalletAssets;
|
|
3990
|
+
}() /** 选择或取消单张钱包资产,并立即同步 pending wallet payments。 */)
|
|
3991
|
+
}, {
|
|
3992
|
+
key: "selectWalletAsset",
|
|
3993
|
+
value: (function () {
|
|
3994
|
+
var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
3995
|
+
var state;
|
|
3996
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3997
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3998
|
+
case 0:
|
|
3999
|
+
if (this.store.payment) {
|
|
4000
|
+
_context41.next = 2;
|
|
4001
|
+
break;
|
|
4002
|
+
}
|
|
4003
|
+
throw new Error('payment 模块未初始化');
|
|
4004
|
+
case 2:
|
|
4005
|
+
state = this.store.payment.wallet.selectWalletAsset(params.assetId, {
|
|
4006
|
+
selected: params.selected,
|
|
4007
|
+
source: params.source
|
|
4008
|
+
});
|
|
4009
|
+
_context41.next = 5;
|
|
4010
|
+
return this.syncSelectedWalletAssets(state);
|
|
4011
|
+
case 5:
|
|
4012
|
+
return _context41.abrupt("return", this.publishWalletAssetsState(state));
|
|
4013
|
+
case 6:
|
|
4014
|
+
case "end":
|
|
4015
|
+
return _context41.stop();
|
|
4016
|
+
}
|
|
4017
|
+
}, _callee41, this);
|
|
4018
|
+
}));
|
|
4019
|
+
function selectWalletAsset(_x37) {
|
|
4020
|
+
return _selectWalletAsset.apply(this, arguments);
|
|
4021
|
+
}
|
|
4022
|
+
return selectWalletAsset;
|
|
4023
|
+
}() /** 扫码精确查券;仅可用资产会被自动选中。 */)
|
|
4024
|
+
}, {
|
|
4025
|
+
key: "scanWalletAsset",
|
|
4026
|
+
value: (function () {
|
|
4027
|
+
var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(code) {
|
|
4028
|
+
var result;
|
|
4029
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4030
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4031
|
+
case 0:
|
|
4032
|
+
if (this.store.payment) {
|
|
4033
|
+
_context42.next = 2;
|
|
4034
|
+
break;
|
|
4035
|
+
}
|
|
4036
|
+
throw new Error('payment 模块未初始化');
|
|
4037
|
+
case 2:
|
|
4038
|
+
_context42.next = 4;
|
|
4039
|
+
return this.store.payment.wallet.scanWalletAssetAsync(code);
|
|
4040
|
+
case 4:
|
|
4041
|
+
result = _context42.sent;
|
|
4042
|
+
if (!(result.type === 'normalCode')) {
|
|
4043
|
+
_context42.next = 10;
|
|
4044
|
+
break;
|
|
4045
|
+
}
|
|
4046
|
+
_context42.next = 8;
|
|
4047
|
+
return this.syncSelectedWalletAssets(result.state);
|
|
4048
|
+
case 8:
|
|
4049
|
+
_context42.next = 10;
|
|
4050
|
+
return this.publishWalletAssetsState(result.state);
|
|
4051
|
+
case 10:
|
|
4052
|
+
return _context42.abrupt("return", result);
|
|
4053
|
+
case 11:
|
|
4054
|
+
case "end":
|
|
4055
|
+
return _context42.stop();
|
|
4056
|
+
}
|
|
4057
|
+
}, _callee42, this);
|
|
4058
|
+
}));
|
|
4059
|
+
function scanWalletAsset(_x38) {
|
|
4060
|
+
return _scanWalletAsset.apply(this, arguments);
|
|
4061
|
+
}
|
|
4062
|
+
return scanWalletAsset;
|
|
4063
|
+
}() /** 清空全部未确认钱包选择,已支付钱包项由 Order 模块继续保留。 */)
|
|
4064
|
+
}, {
|
|
4065
|
+
key: "clearWalletAssetSelection",
|
|
4066
|
+
value: (function () {
|
|
4067
|
+
var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
|
|
4068
|
+
var state;
|
|
4069
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4070
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4071
|
+
case 0:
|
|
4072
|
+
if (this.store.payment) {
|
|
4073
|
+
_context43.next = 2;
|
|
4074
|
+
break;
|
|
4075
|
+
}
|
|
4076
|
+
throw new Error('payment 模块未初始化');
|
|
4077
|
+
case 2:
|
|
4078
|
+
state = this.store.payment.wallet.clearWalletAssetSelection();
|
|
4079
|
+
_context43.next = 5;
|
|
4080
|
+
return this.syncSelectedWalletAssets(state);
|
|
4081
|
+
case 5:
|
|
4082
|
+
return _context43.abrupt("return", this.publishWalletAssetsState(state));
|
|
4083
|
+
case 6:
|
|
4084
|
+
case "end":
|
|
4085
|
+
return _context43.stop();
|
|
4086
|
+
}
|
|
4087
|
+
}, _callee43, this);
|
|
4088
|
+
}));
|
|
4089
|
+
function clearWalletAssetSelection() {
|
|
4090
|
+
return _clearWalletAssetSelection.apply(this, arguments);
|
|
4091
|
+
}
|
|
4092
|
+
return clearWalletAssetSelection;
|
|
4093
|
+
}()
|
|
4094
|
+
/**
|
|
4095
|
+
* 更新当前订单客户字段。
|
|
4096
|
+
*
|
|
4097
|
+
* 这是 PaymentModal 客户切换的订单事实入口;外部客户模块同步应由
|
|
4098
|
+
* 调用方通过 onCustomerChange 回调完成。
|
|
4099
|
+
*/
|
|
4100
|
+
)
|
|
4101
|
+
}, {
|
|
4102
|
+
key: "updateOrderCustomer",
|
|
4103
|
+
value: function updateOrderCustomer(customer) {
|
|
4104
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
4105
|
+
var result = this.store.order.updateTempOrderCustomer(customer);
|
|
4106
|
+
this.store.order.recalculateSummary({
|
|
4107
|
+
createIfMissing: true
|
|
4108
|
+
});
|
|
4109
|
+
this.store.order.persistTempOrder();
|
|
4110
|
+
return result;
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
/** 获取可用支付方式列表,供 PaymentModal 渲染支付选项。 */
|
|
4114
|
+
}, {
|
|
4115
|
+
key: "getPaymentMethodsAsync",
|
|
4116
|
+
value: (function () {
|
|
4117
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
4118
|
+
var response, paymentMethods;
|
|
4119
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4120
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4121
|
+
case 0:
|
|
4122
|
+
_context44.prev = 0;
|
|
4123
|
+
_context44.next = 3;
|
|
4124
|
+
return this.request.get('/pay/custom-payment/all', {
|
|
4125
|
+
filterPaymentMethods: true
|
|
4126
|
+
}, {
|
|
4127
|
+
osServer: true
|
|
4128
|
+
});
|
|
4129
|
+
case 3:
|
|
4130
|
+
response = _context44.sent;
|
|
4131
|
+
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
4132
|
+
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
4133
|
+
return _context44.abrupt("return", this.getPaymentMethods());
|
|
4134
|
+
case 9:
|
|
4135
|
+
_context44.prev = 9;
|
|
4136
|
+
_context44.t0 = _context44["catch"](0);
|
|
4137
|
+
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
4138
|
+
error: _context44.t0 instanceof Error ? _context44.t0.message : String(_context44.t0)
|
|
4139
|
+
});
|
|
4140
|
+
return _context44.abrupt("return", this.getPaymentMethods());
|
|
4141
|
+
case 13:
|
|
4142
|
+
case "end":
|
|
4143
|
+
return _context44.stop();
|
|
4144
|
+
}
|
|
4145
|
+
}, _callee44, this, [[0, 9]]);
|
|
4146
|
+
}));
|
|
4147
|
+
function getPaymentMethodsAsync() {
|
|
4148
|
+
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
4149
|
+
}
|
|
4150
|
+
return getPaymentMethodsAsync;
|
|
4151
|
+
}() /** 同步读取初始化时缓存的支付方式列表。 */)
|
|
4152
|
+
}, {
|
|
4153
|
+
key: "getPaymentMethods",
|
|
4154
|
+
value: function getPaymentMethods() {
|
|
4155
|
+
return _toConsumableArray(this.paymentMethodsCache);
|
|
4156
|
+
}
|
|
4157
|
+
}, {
|
|
4158
|
+
key: "findCashPaymentMethod",
|
|
4159
|
+
value: function findCashPaymentMethod(paymentMethods) {
|
|
4160
|
+
return paymentMethods.find(function (method) {
|
|
4161
|
+
var identifiers = [method === null || method === void 0 ? void 0 : method.code, method === null || method === void 0 ? void 0 : method.type, method === null || method === void 0 ? void 0 : method.tag].map(function (value) {
|
|
4162
|
+
return String(value || '').toUpperCase();
|
|
4163
|
+
});
|
|
4164
|
+
return identifiers.includes('CASHMANUAL') && (method === null || method === void 0 ? void 0 : method.enabled) !== false && (method === null || method === void 0 ? void 0 : method.enable) !== false;
|
|
4165
|
+
});
|
|
4166
|
+
}
|
|
4167
|
+
}, {
|
|
4168
|
+
key: "getPendingWalletPaymentAmount",
|
|
4169
|
+
value: function getPendingWalletPaymentAmount() {
|
|
4170
|
+
var _this$store$order10, _this$store$order10$g;
|
|
4171
|
+
var payments = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ((_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)) || [];
|
|
4172
|
+
return payments.reduce(function (total, payment) {
|
|
4173
|
+
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) {
|
|
4174
|
+
return total;
|
|
4175
|
+
}
|
|
4176
|
+
try {
|
|
4177
|
+
return total.plus(payment.amount || 0).plus(payment.rounding_amount || 0);
|
|
4178
|
+
} catch (_unused5) {
|
|
4179
|
+
return total;
|
|
4180
|
+
}
|
|
4181
|
+
}, new Decimal(0));
|
|
4182
|
+
}
|
|
4183
|
+
|
|
4184
|
+
/** 读取现金 action 所需的支付方式、待付金额和快捷金额。 */
|
|
4185
|
+
}, {
|
|
4186
|
+
key: "getCashPaymentConfig",
|
|
4187
|
+
value: (function () {
|
|
4188
|
+
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
|
|
4189
|
+
var _this$store$order11, _this$store$order11$g, _this$store$order12, _this$store$order12$g, _this$otherParams30;
|
|
4190
|
+
var paymentMethods, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, currency, recommendedAmounts;
|
|
4191
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
4192
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4193
|
+
case 0:
|
|
4194
|
+
if (this.store.payment) {
|
|
4195
|
+
_context45.next = 2;
|
|
4196
|
+
break;
|
|
4197
|
+
}
|
|
4198
|
+
throw new Error('payment 模块未初始化');
|
|
4199
|
+
case 2:
|
|
4200
|
+
paymentMethods = this.getPaymentMethods();
|
|
4201
|
+
paymentMethod = this.findCashPaymentMethod(paymentMethods);
|
|
4202
|
+
if (paymentMethod) {
|
|
4203
|
+
_context45.next = 9;
|
|
4204
|
+
break;
|
|
4205
|
+
}
|
|
4206
|
+
_context45.next = 7;
|
|
4207
|
+
return this.getPaymentMethodsAsync();
|
|
4208
|
+
case 7:
|
|
4209
|
+
paymentMethods = _context45.sent;
|
|
4210
|
+
paymentMethod = this.findCashPaymentMethod(paymentMethods);
|
|
4211
|
+
case 9:
|
|
4212
|
+
amountSnapshot = (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$g = _this$store$order11.getOrderAmountSnapshot) === null || _this$store$order11$g === void 0 ? void 0 : _this$store$order11$g.call(_this$store$order11);
|
|
4213
|
+
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
4214
|
+
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
|
|
4215
|
+
currency = ((_this$store$order12 = this.store.order) === null || _this$store$order12 === void 0 || (_this$store$order12$g = _this$store$order12.getTempOrder) === null || _this$store$order12$g === void 0 || (_this$store$order12$g = _this$store$order12$g.call(_this$store$order12)) === null || _this$store$order12$g === void 0 ? void 0 : _this$store$order12$g.currency_code) || ((_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.currency) || 'USD';
|
|
4216
|
+
recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
|
|
4217
|
+
return _context45.abrupt("return", {
|
|
4218
|
+
available: Boolean(paymentMethod && amountDue > 0),
|
|
4219
|
+
paymentMethod: paymentMethod,
|
|
4220
|
+
amountDue: amountDue,
|
|
4221
|
+
recommendedAmounts: recommendedAmounts
|
|
4222
|
+
});
|
|
4223
|
+
case 15:
|
|
4224
|
+
case "end":
|
|
4225
|
+
return _context45.stop();
|
|
4226
|
+
}
|
|
4227
|
+
}, _callee45, this);
|
|
4228
|
+
}));
|
|
4229
|
+
function getCashPaymentConfig() {
|
|
4230
|
+
return _getCashPaymentConfig.apply(this, arguments);
|
|
4231
|
+
}
|
|
4232
|
+
return getCashPaymentConfig;
|
|
4233
|
+
}()
|
|
4234
|
+
/**
|
|
4235
|
+
* 确认足额覆盖订单的 pending Wallet 支付并提交订单。
|
|
4236
|
+
*
|
|
4237
|
+
* Order 模块在构造提交参数时将 pending voucher 转为 paid;只有提交成功后
|
|
4238
|
+
* 才同步 Wallet committed 状态。失败时恢复调用前 payments,允许用户重试。
|
|
4239
|
+
*/
|
|
4240
|
+
)
|
|
4241
|
+
}, {
|
|
4242
|
+
key: "confirmWalletPayment",
|
|
4243
|
+
value: (function () {
|
|
4244
|
+
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
|
|
4245
|
+
var _this$store$order$get3, _this$store$order13, _this$store$order$get4, _this$store$order$get5, _this$store$order14;
|
|
4246
|
+
var beforePayments, pendingWalletAmount, amountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
|
|
4247
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
4248
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4249
|
+
case 0:
|
|
4250
|
+
if (this.store.order) {
|
|
4251
|
+
_context46.next = 2;
|
|
4252
|
+
break;
|
|
4253
|
+
}
|
|
4254
|
+
throw new Error('order 模块未初始化');
|
|
4255
|
+
case 2:
|
|
4256
|
+
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
4257
|
+
pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
|
|
4258
|
+
if (!pendingWalletAmount.lte(0)) {
|
|
4259
|
+
_context46.next = 6;
|
|
4260
|
+
break;
|
|
4261
|
+
}
|
|
4262
|
+
throw new Error('当前订单没有待确认的 Wallet 支付');
|
|
4263
|
+
case 6:
|
|
4264
|
+
amountSnapshot = (_this$store$order$get3 = (_this$store$order13 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order13);
|
|
4265
|
+
effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
4266
|
+
if (!effectiveAmountDue.gt(0.01)) {
|
|
4267
|
+
_context46.next = 10;
|
|
4268
|
+
break;
|
|
4269
|
+
}
|
|
4270
|
+
throw new Error('Wallet 支付尚未覆盖全部待支付金额');
|
|
4271
|
+
case 10:
|
|
4272
|
+
beforePaymentStatus = (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.payment_status;
|
|
4273
|
+
_context46.prev = 11;
|
|
4274
|
+
_context46.next = 14;
|
|
4275
|
+
return this.submitSalesOrder({
|
|
4276
|
+
smallTicketDataFlag: 1,
|
|
4277
|
+
confirmPendingVoucherPayments: true
|
|
4278
|
+
});
|
|
4279
|
+
case 14:
|
|
4280
|
+
submitResult = _context46.sent;
|
|
4281
|
+
if (!isRejectedSalesSubmitResult(submitResult)) {
|
|
4282
|
+
_context46.next = 17;
|
|
4283
|
+
break;
|
|
4284
|
+
}
|
|
4285
|
+
throw new Error(getSalesSubmitErrorMessage(submitResult));
|
|
4286
|
+
case 17:
|
|
4287
|
+
_context46.next = 27;
|
|
4288
|
+
break;
|
|
4289
|
+
case 19:
|
|
4290
|
+
_context46.prev = 19;
|
|
4291
|
+
_context46.t0 = _context46["catch"](11);
|
|
4292
|
+
this.store.order.setOrderPayments(beforePayments);
|
|
4293
|
+
restoredTempOrder = this.store.order.getTempOrder();
|
|
4294
|
+
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
4295
|
+
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4296
|
+
this.store.order.persistTempOrder();
|
|
4297
|
+
}
|
|
4298
|
+
_context46.next = 26;
|
|
4299
|
+
return this.store.order.recalculateSummary({
|
|
4300
|
+
createIfMissing: true
|
|
4301
|
+
});
|
|
4302
|
+
case 26:
|
|
4303
|
+
throw _context46.t0;
|
|
4304
|
+
case 27:
|
|
4305
|
+
if (!this.store.payment) {
|
|
4306
|
+
_context46.next = 38;
|
|
4307
|
+
break;
|
|
4308
|
+
}
|
|
4309
|
+
_context46.prev = 28;
|
|
4310
|
+
committed = this.getCommittedWalletAssets();
|
|
4311
|
+
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4312
|
+
_context46.next = 33;
|
|
4313
|
+
return this.publishWalletAssetsState(walletState);
|
|
4314
|
+
case 33:
|
|
4315
|
+
_context46.next = 38;
|
|
4316
|
+
break;
|
|
4317
|
+
case 35:
|
|
4318
|
+
_context46.prev = 35;
|
|
4319
|
+
_context46.t1 = _context46["catch"](28);
|
|
4320
|
+
this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
|
|
4321
|
+
error: _context46.t1 instanceof Error ? _context46.t1.message : String(_context46.t1)
|
|
4322
|
+
});
|
|
4323
|
+
case 38:
|
|
4324
|
+
latestAmountSnapshot = (_this$store$order$get5 = (_this$store$order14 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.call(_this$store$order14);
|
|
4325
|
+
return _context46.abrupt("return", {
|
|
4326
|
+
submitResult: submitResult,
|
|
4327
|
+
payments: this.store.order.getOrderPayments(),
|
|
4328
|
+
isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
|
|
4329
|
+
});
|
|
4330
|
+
case 40:
|
|
4331
|
+
case "end":
|
|
4332
|
+
return _context46.stop();
|
|
4333
|
+
}
|
|
4334
|
+
}, _callee46, this, [[11, 19], [28, 35]]);
|
|
4335
|
+
}));
|
|
4336
|
+
function confirmWalletPayment() {
|
|
4337
|
+
return _confirmWalletPayment.apply(this, arguments);
|
|
4338
|
+
}
|
|
4339
|
+
return confirmWalletPayment;
|
|
4340
|
+
}()
|
|
4341
|
+
/**
|
|
4342
|
+
* 购物车现金直付:写入现金记录并等待支付同步完成。
|
|
4343
|
+
* 同步失败会恢复调用前 payments(包含 Wallet pending 状态)。
|
|
4344
|
+
*/
|
|
4345
|
+
)
|
|
4346
|
+
}, {
|
|
4347
|
+
key: "payCash",
|
|
4348
|
+
value: (function () {
|
|
4349
|
+
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
4350
|
+
var _this$store$order$get6, _params$actualPaidAmo, _this$otherParams31, _this$window, _this$window$postMess;
|
|
4351
|
+
var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
4352
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4353
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4354
|
+
case 0:
|
|
4355
|
+
if (this.store.order) {
|
|
4356
|
+
_context47.next = 2;
|
|
4357
|
+
break;
|
|
4358
|
+
}
|
|
4359
|
+
throw new Error('order 模块未初始化');
|
|
4360
|
+
case 2:
|
|
4361
|
+
amount = Number(params.amount || 0);
|
|
4362
|
+
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
4363
|
+
_context47.next = 5;
|
|
4364
|
+
break;
|
|
4365
|
+
}
|
|
4366
|
+
throw new Error('现金支付金额必须大于 0');
|
|
4367
|
+
case 5:
|
|
4368
|
+
_context47.next = 7;
|
|
4369
|
+
return this.getCashPaymentConfig();
|
|
4370
|
+
case 7:
|
|
4371
|
+
config = _context47.sent;
|
|
4372
|
+
paymentMethod = config.paymentMethod;
|
|
4373
|
+
if (paymentMethod) {
|
|
4374
|
+
_context47.next = 11;
|
|
4375
|
+
break;
|
|
4376
|
+
}
|
|
4377
|
+
throw new Error('未找到可用的 CASHMANUAL 支付方式');
|
|
4378
|
+
case 11:
|
|
4379
|
+
if (!(config.amountDue <= 0)) {
|
|
4380
|
+
_context47.next = 13;
|
|
4381
|
+
break;
|
|
4382
|
+
}
|
|
4383
|
+
throw new Error('当前订单没有待支付金额');
|
|
4384
|
+
case 13:
|
|
4385
|
+
roundingAmount = Number(params.roundingAmount || 0);
|
|
4386
|
+
effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
|
|
4387
|
+
if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
|
|
4388
|
+
_context47.next = 17;
|
|
4389
|
+
break;
|
|
4390
|
+
}
|
|
4391
|
+
throw new Error('现金支付金额超过当前待支付金额');
|
|
4392
|
+
case 17:
|
|
4393
|
+
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
4394
|
+
beforePaymentStatus = (_this$store$order$get6 = this.store.order.getTempOrder()) === null || _this$store$order$get6 === void 0 ? void 0 : _this$store$order$get6.payment_status;
|
|
4395
|
+
uniquePaymentNumber = createUuidV4();
|
|
4396
|
+
paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
4397
|
+
actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
|
|
4398
|
+
changeAmount = Number(params.changeAmount || 0);
|
|
4399
|
+
shopWalletPassId = (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.shop_wallet_pass_id;
|
|
4400
|
+
if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
|
|
4401
|
+
_context47.next = 26;
|
|
4402
|
+
break;
|
|
4403
|
+
}
|
|
4404
|
+
throw new Error('顾客实收现金不能小于支付金额');
|
|
4405
|
+
case 26:
|
|
4406
|
+
(_this$window = this.window) === null || _this$window === void 0 || (_this$window = _this$window.interaction) === null || _this$window === void 0 || (_this$window = _this$window.utils) === null || _this$window === void 0 || (_this$window$postMess = _this$window.postMessageToApp) === null || _this$window$postMess === void 0 || _this$window$postMess.call(_this$window, {
|
|
4407
|
+
module: 'till',
|
|
4408
|
+
key: 'open_till',
|
|
4409
|
+
data: {
|
|
4410
|
+
type: 'cash'
|
|
4411
|
+
}
|
|
4412
|
+
});
|
|
4413
|
+
payments = this.store.order.addOrderPayment({
|
|
4414
|
+
amount: amount.toFixed(2),
|
|
4415
|
+
code: paymentMethod.code,
|
|
4416
|
+
custom_payment_id: paymentMethod.id,
|
|
4417
|
+
name: paymentMethod.name,
|
|
4418
|
+
custom_payment_type: paymentMethod.type,
|
|
4419
|
+
voucher_id: 0,
|
|
4420
|
+
rounding_amount: roundingAmount.toFixed(2),
|
|
4421
|
+
metadata: _objectSpread(_objectSpread({
|
|
4422
|
+
unique_payment_number: uniquePaymentNumber
|
|
4423
|
+
}, shopWalletPassId !== undefined && shopWalletPassId !== null ? {
|
|
4424
|
+
shop_wallet_pass_id: shopWalletPassId
|
|
4425
|
+
} : {}), {}, {
|
|
4426
|
+
actual_paid_amount: Number.isFinite(actualPaidAmount) ? actualPaidAmount : amount,
|
|
4427
|
+
change_given_amount: Number.isFinite(changeAmount) ? changeAmount : 0
|
|
4428
|
+
}),
|
|
4429
|
+
payment_time: paymentTimestamp,
|
|
4430
|
+
created_at: paymentTimestamp
|
|
4431
|
+
});
|
|
4432
|
+
payment = payments.find(function (item) {
|
|
4433
|
+
var _item$metadata2;
|
|
4434
|
+
return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
|
|
4435
|
+
});
|
|
4436
|
+
_context47.prev = 29;
|
|
4437
|
+
_context47.next = 32;
|
|
4438
|
+
return this.syncPaymentsToOrder({
|
|
4439
|
+
payments: payments,
|
|
4440
|
+
submitWhenPaid: true,
|
|
4441
|
+
smallTicketDataFlag: 1,
|
|
4442
|
+
confirmPendingVoucherPayments: true
|
|
4443
|
+
});
|
|
4444
|
+
case 32:
|
|
4445
|
+
syncResult = _context47.sent;
|
|
4446
|
+
if (!this.store.payment) {
|
|
4447
|
+
_context47.next = 38;
|
|
4448
|
+
break;
|
|
4449
|
+
}
|
|
4450
|
+
committed = this.getCommittedWalletAssets();
|
|
4451
|
+
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4452
|
+
_context47.next = 38;
|
|
4453
|
+
return this.publishWalletAssetsState(walletState);
|
|
4454
|
+
case 38:
|
|
4455
|
+
return _context47.abrupt("return", {
|
|
4456
|
+
payment: payment || {},
|
|
4457
|
+
payments: this.store.order.getOrderPayments(),
|
|
4458
|
+
syncResult: syncResult,
|
|
4459
|
+
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
4460
|
+
});
|
|
4461
|
+
case 41:
|
|
4462
|
+
_context47.prev = 41;
|
|
4463
|
+
_context47.t0 = _context47["catch"](29);
|
|
4464
|
+
this.store.order.setOrderPayments(beforePayments);
|
|
4465
|
+
restoredTempOrder = this.store.order.getTempOrder();
|
|
4466
|
+
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
4467
|
+
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4468
|
+
this.store.order.persistTempOrder();
|
|
4469
|
+
}
|
|
4470
|
+
_context47.next = 48;
|
|
4471
|
+
return this.store.order.recalculateSummary({
|
|
4472
|
+
createIfMissing: true
|
|
4473
|
+
});
|
|
4474
|
+
case 48:
|
|
4475
|
+
throw _context47.t0;
|
|
4476
|
+
case 49:
|
|
4477
|
+
case "end":
|
|
4478
|
+
return _context47.stop();
|
|
4479
|
+
}
|
|
4480
|
+
}, _callee47, this, [[29, 41]]);
|
|
4481
|
+
}));
|
|
4482
|
+
function payCash(_x39) {
|
|
4483
|
+
return _payCash.apply(this, arguments);
|
|
4484
|
+
}
|
|
4485
|
+
return payCash;
|
|
4486
|
+
}()
|
|
4487
|
+
/**
|
|
4488
|
+
* 提交一次已由支付设备确认成功的非 Wallet 支付。
|
|
4489
|
+
*
|
|
4490
|
+
* 与 addOrderPayment 不同,本入口不会启动后台 fire-and-forget 同步;调用方会等待
|
|
4491
|
+
* 本次 payment、当前 pending Wallet 以及订单提交共同完成。任何同步失败都会恢复
|
|
4492
|
+
* 调用前的 payments 与 payment_status,便于 UI 安全解锁并重试。
|
|
4493
|
+
*/
|
|
4494
|
+
)
|
|
4495
|
+
}, {
|
|
4496
|
+
key: "commitPaymentMethodPayment",
|
|
4497
|
+
value: (function () {
|
|
4498
|
+
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
|
|
4499
|
+
var _this$store$order$get7, _this$store$order15, _this$store$order$get8, _params$metadata, _params$originAmount;
|
|
4500
|
+
var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
4501
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
4502
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4503
|
+
case 0:
|
|
4504
|
+
if (this.store.order) {
|
|
4505
|
+
_context48.next = 2;
|
|
4506
|
+
break;
|
|
4507
|
+
}
|
|
4508
|
+
throw new Error('order 模块未初始化');
|
|
4509
|
+
case 2:
|
|
4510
|
+
amount = Number(params.amount || 0);
|
|
4511
|
+
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
4512
|
+
_context48.next = 5;
|
|
4513
|
+
break;
|
|
4514
|
+
}
|
|
4515
|
+
throw new Error('支付金额必须大于 0');
|
|
4516
|
+
case 5:
|
|
4517
|
+
paymentMethods = this.getPaymentMethods();
|
|
4518
|
+
findPaymentMethod = function findPaymentMethod() {
|
|
4519
|
+
var methodCode = String(params.paymentMethodCode || '').toUpperCase();
|
|
4520
|
+
return paymentMethods.find(function (method) {
|
|
4521
|
+
var idMatched = params.paymentMethodId !== undefined && String(method.id) === String(params.paymentMethodId);
|
|
4522
|
+
var codeMatched = Boolean(methodCode) && String(method.code || '').toUpperCase() === methodCode;
|
|
4523
|
+
return (idMatched || codeMatched) && method.enabled !== false && method.enable !== false;
|
|
4524
|
+
});
|
|
4525
|
+
};
|
|
4526
|
+
paymentMethod = findPaymentMethod();
|
|
4527
|
+
if (paymentMethod) {
|
|
4528
|
+
_context48.next = 13;
|
|
4529
|
+
break;
|
|
4530
|
+
}
|
|
4531
|
+
_context48.next = 11;
|
|
4532
|
+
return this.getPaymentMethodsAsync();
|
|
4533
|
+
case 11:
|
|
4534
|
+
paymentMethods = _context48.sent;
|
|
4535
|
+
paymentMethod = findPaymentMethod();
|
|
4536
|
+
case 13:
|
|
4537
|
+
if (paymentMethod) {
|
|
4538
|
+
_context48.next = 15;
|
|
4539
|
+
break;
|
|
4540
|
+
}
|
|
4541
|
+
throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
|
|
4542
|
+
case 15:
|
|
4543
|
+
amountSnapshot = (_this$store$order$get7 = (_this$store$order15 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get7 === void 0 ? void 0 : _this$store$order$get7.call(_this$store$order15);
|
|
4544
|
+
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
4545
|
+
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
4546
|
+
if (!amountDue.lte(0)) {
|
|
4547
|
+
_context48.next = 20;
|
|
4548
|
+
break;
|
|
4549
|
+
}
|
|
4550
|
+
throw new Error('当前订单没有待支付金额');
|
|
4551
|
+
case 20:
|
|
4552
|
+
if (!new Decimal(amount).gt(amountDue.plus(0.01))) {
|
|
4553
|
+
_context48.next = 22;
|
|
4554
|
+
break;
|
|
4555
|
+
}
|
|
4556
|
+
throw new Error('支付金额超过当前待支付金额');
|
|
4557
|
+
case 22:
|
|
4558
|
+
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
4559
|
+
beforePaymentStatus = (_this$store$order$get8 = this.store.order.getTempOrder()) === null || _this$store$order$get8 === void 0 ? void 0 : _this$store$order$get8.payment_status;
|
|
4560
|
+
paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
4561
|
+
metadata = _objectSpread(_objectSpread({}, params.metadata || {}), {}, {
|
|
4562
|
+
unique_payment_number: ((_params$metadata = params.metadata) === null || _params$metadata === void 0 ? void 0 : _params$metadata.unique_payment_number) || createUuidV4()
|
|
4563
|
+
});
|
|
4564
|
+
serviceCharge = params.serviceCharge ? {
|
|
4565
|
+
amount: String(params.serviceCharge.amount || 0),
|
|
4566
|
+
percentage: String(params.serviceCharge.percentage || 0)
|
|
4567
|
+
} : undefined;
|
|
4568
|
+
serviceFee = serviceCharge ? new Decimal((_params$originAmount = params.originAmount) !== null && _params$originAmount !== void 0 ? _params$originAmount : amount).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
|
|
4569
|
+
payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, params.paymentData || {}), {}, {
|
|
4570
|
+
amount: amount.toFixed(2)
|
|
4571
|
+
}, params.originAmount !== undefined ? {
|
|
4572
|
+
origin_amount: Number(params.originAmount).toFixed(2)
|
|
4573
|
+
} : {}), {}, {
|
|
4574
|
+
code: paymentMethod.code,
|
|
4575
|
+
custom_payment_id: paymentMethod.id,
|
|
4576
|
+
name: paymentMethod.name,
|
|
4577
|
+
custom_payment_type: paymentMethod.type,
|
|
4578
|
+
voucher_id: 0
|
|
4579
|
+
}, serviceCharge ? {
|
|
4580
|
+
service_charge: serviceCharge
|
|
4581
|
+
} : {}), serviceFee !== undefined ? {
|
|
4582
|
+
service_fee: serviceFee
|
|
4583
|
+
} : {}), {}, {
|
|
4584
|
+
metadata: metadata,
|
|
4585
|
+
payment_time: paymentTimestamp,
|
|
4586
|
+
created_at: paymentTimestamp
|
|
4587
|
+
}));
|
|
4588
|
+
payment = payments.find(function (item) {
|
|
4589
|
+
var _item$metadata3;
|
|
4590
|
+
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;
|
|
4591
|
+
});
|
|
4592
|
+
_context48.prev = 30;
|
|
4593
|
+
_context48.next = 33;
|
|
4594
|
+
return this.syncPaymentsToOrder({
|
|
4595
|
+
payments: payments,
|
|
4596
|
+
submitWhenPaid: true,
|
|
4597
|
+
smallTicketDataFlag: 1,
|
|
4598
|
+
confirmPendingVoucherPayments: true
|
|
4599
|
+
});
|
|
4600
|
+
case 33:
|
|
4601
|
+
syncResult = _context48.sent;
|
|
4602
|
+
if (!this.store.payment) {
|
|
4603
|
+
_context48.next = 39;
|
|
4604
|
+
break;
|
|
4605
|
+
}
|
|
4606
|
+
committed = this.getCommittedWalletAssets();
|
|
4607
|
+
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4608
|
+
_context48.next = 39;
|
|
4609
|
+
return this.publishWalletAssetsState(walletState);
|
|
4610
|
+
case 39:
|
|
4611
|
+
return _context48.abrupt("return", {
|
|
4612
|
+
payment: payment || {},
|
|
4613
|
+
payments: this.store.order.getOrderPayments(),
|
|
4614
|
+
syncResult: syncResult,
|
|
4615
|
+
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
4616
|
+
});
|
|
4617
|
+
case 42:
|
|
4618
|
+
_context48.prev = 42;
|
|
4619
|
+
_context48.t0 = _context48["catch"](30);
|
|
4620
|
+
this.store.order.setOrderPayments(beforePayments);
|
|
4621
|
+
restoredTempOrder = this.store.order.getTempOrder();
|
|
4622
|
+
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
4623
|
+
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4624
|
+
this.store.order.persistTempOrder();
|
|
4625
|
+
}
|
|
4626
|
+
_context48.next = 49;
|
|
4627
|
+
return this.store.order.recalculateSummary({
|
|
4628
|
+
createIfMissing: true
|
|
4629
|
+
});
|
|
4630
|
+
case 49:
|
|
4631
|
+
throw _context48.t0;
|
|
4632
|
+
case 50:
|
|
4633
|
+
case "end":
|
|
4634
|
+
return _context48.stop();
|
|
4635
|
+
}
|
|
4636
|
+
}, _callee48, this, [[30, 42]]);
|
|
4637
|
+
}));
|
|
4638
|
+
function commitPaymentMethodPayment(_x40) {
|
|
4639
|
+
return _commitPaymentMethodPayment.apply(this, arguments);
|
|
4640
|
+
}
|
|
4641
|
+
return commitPaymentMethodPayment;
|
|
4642
|
+
}()
|
|
4643
|
+
/**
|
|
4644
|
+
* 按当前店铺的现金舍入配置计算金额,供现金支付 UI 使用。
|
|
4645
|
+
*
|
|
4646
|
+
* 舍入开关取自 CASHMANUAL 支付方式;舍入规则取自
|
|
4647
|
+
* otherParams.order_rounding_setting,金额算法统一由 PaymentModule 维护。
|
|
4648
|
+
*/
|
|
4649
|
+
)
|
|
4650
|
+
}, {
|
|
4651
|
+
key: "roundAmount",
|
|
4652
|
+
value: (function () {
|
|
4653
|
+
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
4654
|
+
var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
|
|
4655
|
+
var amount, cashManualPayment;
|
|
4656
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4657
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
4658
|
+
case 0:
|
|
4659
|
+
amount = params.amount;
|
|
4660
|
+
cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
|
|
4661
|
+
return paymentMethod.code === 'CASHMANUAL';
|
|
4662
|
+
});
|
|
4663
|
+
if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
|
|
4664
|
+
_context49.next = 4;
|
|
4665
|
+
break;
|
|
4666
|
+
}
|
|
4667
|
+
return _context49.abrupt("return", {
|
|
4668
|
+
originalAmount: amount.toString(),
|
|
4669
|
+
roundedAmount: amount.toString(),
|
|
4670
|
+
roundingDifference: '0.00'
|
|
4671
|
+
});
|
|
4672
|
+
case 4:
|
|
4673
|
+
if (this.payment) {
|
|
4674
|
+
_context49.next = 6;
|
|
4675
|
+
break;
|
|
4676
|
+
}
|
|
4677
|
+
throw new Error('payment 模块未初始化');
|
|
4678
|
+
case 6:
|
|
4679
|
+
return _context49.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));
|
|
4680
|
+
case 7:
|
|
4681
|
+
case "end":
|
|
4682
|
+
return _context49.stop();
|
|
4683
|
+
}
|
|
4684
|
+
}, _callee49, this);
|
|
4685
|
+
}));
|
|
4686
|
+
function roundAmount(_x41) {
|
|
4687
|
+
return _roundAmount.apply(this, arguments);
|
|
4688
|
+
}
|
|
4689
|
+
return roundAmount;
|
|
4690
|
+
}()
|
|
4691
|
+
/**
|
|
4692
|
+
* 发送支付链接。
|
|
4693
|
+
*
|
|
4694
|
+
* 如果没有 orderIds 或显式 submitBeforeSend,会先提交当前本地订单到云端;
|
|
4695
|
+
* 只有成功拿到远端 order_id 后才调用 OrderModule 发送邮件。
|
|
4696
|
+
*/
|
|
4697
|
+
)
|
|
4698
|
+
}, {
|
|
4699
|
+
key: "sendCustomerPayLink",
|
|
4700
|
+
value: (function () {
|
|
4701
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
|
|
4702
|
+
var orderIds, _ref37, _ref38, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
4703
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
4704
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
4705
|
+
case 0:
|
|
4706
|
+
if (this.store.order) {
|
|
4707
|
+
_context50.next = 2;
|
|
4708
|
+
break;
|
|
4709
|
+
}
|
|
4710
|
+
throw new Error('order 模块未初始化');
|
|
4711
|
+
case 2:
|
|
4712
|
+
orderIds = params.order_ids || params.orderIds || [];
|
|
4713
|
+
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
4714
|
+
_context50.next = 11;
|
|
4715
|
+
break;
|
|
4716
|
+
}
|
|
4717
|
+
_context50.next = 6;
|
|
4718
|
+
return this.submitSalesOrder({
|
|
4719
|
+
smallTicketDataFlag: 1
|
|
4720
|
+
});
|
|
4721
|
+
case 6:
|
|
4722
|
+
submitResult = _context50.sent;
|
|
4723
|
+
orderId = (_ref37 = (_ref38 = (_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 && _ref38 !== void 0 ? _ref38 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref37 !== void 0 ? _ref37 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
4724
|
+
if (orderId) {
|
|
4725
|
+
_context50.next = 10;
|
|
4726
|
+
break;
|
|
4727
|
+
}
|
|
4728
|
+
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
4729
|
+
case 10:
|
|
4730
|
+
orderIds = [orderId];
|
|
4731
|
+
case 11:
|
|
4732
|
+
return _context50.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
4733
|
+
emails: params.emails,
|
|
4734
|
+
notify_action: params.notify_action,
|
|
4735
|
+
order_ids: orderIds
|
|
4736
|
+
}));
|
|
4737
|
+
case 12:
|
|
4738
|
+
case "end":
|
|
4739
|
+
return _context50.stop();
|
|
4740
|
+
}
|
|
4741
|
+
}, _callee50, this);
|
|
4742
|
+
}));
|
|
4743
|
+
function sendCustomerPayLink(_x42) {
|
|
4744
|
+
return _sendCustomerPayLink.apply(this, arguments);
|
|
4745
|
+
}
|
|
4746
|
+
return sendCustomerPayLink;
|
|
4747
|
+
}())
|
|
4748
|
+
}, {
|
|
4749
|
+
key: "transformBaseProductToOrderProduct",
|
|
4750
|
+
value: function transformBaseProductToOrderProduct(params) {
|
|
4751
|
+
return _transformBaseProductToOrderProduct(params);
|
|
4752
|
+
}
|
|
4753
|
+
}, {
|
|
4754
|
+
key: "calculateProductBookingPrice",
|
|
4755
|
+
value: function () {
|
|
4756
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
|
|
4757
|
+
var _params$customer_id;
|
|
4758
|
+
var quotation, customerId, authoritativeProduct, product;
|
|
4759
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
4760
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
4761
|
+
case 0:
|
|
4762
|
+
quotation = this.store.quotation;
|
|
4763
|
+
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
4764
|
+
_context51.next = 4;
|
|
4765
|
+
return this.loadProductForPriceQuery(params, customerId);
|
|
4766
|
+
case 4:
|
|
4767
|
+
authoritativeProduct = _context51.sent;
|
|
4768
|
+
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
4769
|
+
_context51.next = 8;
|
|
4770
|
+
return this.loadQuotationForPriceQuery({
|
|
4771
|
+
quotation: quotation,
|
|
4772
|
+
customer_id: customerId,
|
|
4773
|
+
channel: params.channel
|
|
4774
|
+
});
|
|
4775
|
+
case 8:
|
|
4776
|
+
return _context51.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
4777
|
+
product: product,
|
|
4778
|
+
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
4779
|
+
customer_id: customerId,
|
|
4780
|
+
quotation: quotation
|
|
4781
|
+
})));
|
|
4782
|
+
case 9:
|
|
4783
|
+
case "end":
|
|
4784
|
+
return _context51.stop();
|
|
4785
|
+
}
|
|
4786
|
+
}, _callee51, this);
|
|
4787
|
+
}));
|
|
4788
|
+
function calculateProductBookingPrice(_x43) {
|
|
4789
|
+
return _calculateProductBookingPrice.apply(this, arguments);
|
|
4790
|
+
}
|
|
4791
|
+
return calculateProductBookingPrice;
|
|
4792
|
+
}()
|
|
4793
|
+
}, {
|
|
4794
|
+
key: "getQuotationCustomerScopeInfo",
|
|
4795
|
+
value: function getQuotationCustomerScopeInfo() {
|
|
4796
|
+
var _this15 = this;
|
|
4797
|
+
var quotation = this.store.quotation;
|
|
4798
|
+
if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
|
|
4799
|
+
return quotation.getQuotationCustomerScopeInfo();
|
|
4800
|
+
}
|
|
4801
|
+
var list = typeof (quotation === null || quotation === void 0 ? void 0 : quotation.getQuotationList) === 'function' ? quotation.getQuotationList() : [];
|
|
4802
|
+
var customerById = new Map();
|
|
4803
|
+
var quotationScopes = (Array.isArray(list) ? list : []).filter(function (item) {
|
|
4804
|
+
return Array.isArray(item === null || item === void 0 ? void 0 : item.customer) && item.customer.length > 0;
|
|
4805
|
+
}).map(function (item) {
|
|
4806
|
+
var localSeen = new Set();
|
|
3753
4807
|
var customers = item.customer.filter(function (customer) {
|
|
3754
4808
|
var customerId = _this15.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
3755
4809
|
if (!customerId || localSeen.has(customerId)) return false;
|
|
@@ -3801,20 +4855,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3801
4855
|
}, {
|
|
3802
4856
|
key: "calculateProductBookingPrices",
|
|
3803
4857
|
value: function () {
|
|
3804
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4858
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(paramsList) {
|
|
3805
4859
|
var _paramsList$0$custome,
|
|
3806
4860
|
_paramsList$,
|
|
3807
4861
|
_this16 = this,
|
|
3808
4862
|
_paramsList$2;
|
|
3809
4863
|
var quotation, customerId, productMapsByGroup, groups;
|
|
3810
|
-
return _regeneratorRuntime().wrap(function
|
|
3811
|
-
while (1) switch (
|
|
4864
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
4865
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
3812
4866
|
case 0:
|
|
3813
4867
|
if (paramsList.length) {
|
|
3814
|
-
|
|
4868
|
+
_context53.next = 2;
|
|
3815
4869
|
break;
|
|
3816
4870
|
}
|
|
3817
|
-
return
|
|
4871
|
+
return _context53.abrupt("return", []);
|
|
3818
4872
|
case 2:
|
|
3819
4873
|
quotation = this.store.quotation;
|
|
3820
4874
|
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();
|
|
@@ -3836,15 +4890,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3836
4890
|
group.ids.add(productId);
|
|
3837
4891
|
groups.set(groupKey, group);
|
|
3838
4892
|
});
|
|
3839
|
-
|
|
4893
|
+
_context53.next = 9;
|
|
3840
4894
|
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
3841
|
-
var
|
|
3842
|
-
var
|
|
3843
|
-
return _regeneratorRuntime().wrap(function
|
|
3844
|
-
while (1) switch (
|
|
4895
|
+
var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(_ref39) {
|
|
4896
|
+
var _ref41, groupKey, group, productsById;
|
|
4897
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
4898
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
3845
4899
|
case 0:
|
|
3846
|
-
|
|
3847
|
-
|
|
4900
|
+
_ref41 = _slicedToArray(_ref39, 2), groupKey = _ref41[0], group = _ref41[1];
|
|
4901
|
+
_context52.next = 3;
|
|
3848
4902
|
return _this16.loadProductsForPriceQuery({
|
|
3849
4903
|
ids: Array.from(group.ids),
|
|
3850
4904
|
schedule: group.schedule,
|
|
@@ -3852,27 +4906,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3852
4906
|
channel: group.channel
|
|
3853
4907
|
});
|
|
3854
4908
|
case 3:
|
|
3855
|
-
productsById =
|
|
4909
|
+
productsById = _context52.sent;
|
|
3856
4910
|
productMapsByGroup.set(groupKey, productsById);
|
|
3857
4911
|
case 5:
|
|
3858
4912
|
case "end":
|
|
3859
|
-
return
|
|
4913
|
+
return _context52.stop();
|
|
3860
4914
|
}
|
|
3861
|
-
},
|
|
4915
|
+
}, _callee52);
|
|
3862
4916
|
}));
|
|
3863
|
-
return function (
|
|
3864
|
-
return
|
|
4917
|
+
return function (_x45) {
|
|
4918
|
+
return _ref40.apply(this, arguments);
|
|
3865
4919
|
};
|
|
3866
4920
|
}()));
|
|
3867
4921
|
case 9:
|
|
3868
|
-
|
|
4922
|
+
_context53.next = 11;
|
|
3869
4923
|
return this.loadQuotationForPriceQuery({
|
|
3870
4924
|
quotation: quotation,
|
|
3871
4925
|
customer_id: customerId,
|
|
3872
4926
|
channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
|
|
3873
4927
|
});
|
|
3874
4928
|
case 11:
|
|
3875
|
-
return
|
|
4929
|
+
return _context53.abrupt("return", paramsList.map(function (params) {
|
|
3876
4930
|
var _this16$otherParams2, _productMapsByGroup$g;
|
|
3877
4931
|
var productInput = params.product || {};
|
|
3878
4932
|
var productId = _this16.getPriceQueryProductId(productInput);
|
|
@@ -3890,11 +4944,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3890
4944
|
}));
|
|
3891
4945
|
case 12:
|
|
3892
4946
|
case "end":
|
|
3893
|
-
return
|
|
4947
|
+
return _context53.stop();
|
|
3894
4948
|
}
|
|
3895
|
-
},
|
|
4949
|
+
}, _callee53, this);
|
|
3896
4950
|
}));
|
|
3897
|
-
function calculateProductBookingPrices(
|
|
4951
|
+
function calculateProductBookingPrices(_x44) {
|
|
3898
4952
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
3899
4953
|
}
|
|
3900
4954
|
return calculateProductBookingPrices;
|
|
@@ -3902,34 +4956,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3902
4956
|
}, {
|
|
3903
4957
|
key: "addProductToOrder",
|
|
3904
4958
|
value: function () {
|
|
3905
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4959
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(product, booking, options) {
|
|
3906
4960
|
var products;
|
|
3907
|
-
return _regeneratorRuntime().wrap(function
|
|
3908
|
-
while (1) switch (
|
|
4961
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
4962
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
3909
4963
|
case 0:
|
|
3910
|
-
|
|
4964
|
+
_context54.prev = 0;
|
|
3911
4965
|
if (this.store.order) {
|
|
3912
|
-
|
|
4966
|
+
_context54.next = 3;
|
|
3913
4967
|
break;
|
|
3914
4968
|
}
|
|
3915
4969
|
throw new Error('order 模块未初始化');
|
|
3916
4970
|
case 3:
|
|
3917
|
-
|
|
3918
|
-
return this.store.order.addProductToOrder(product, booking);
|
|
4971
|
+
_context54.next = 5;
|
|
4972
|
+
return this.store.order.addProductToOrder(product, booking, options);
|
|
3919
4973
|
case 5:
|
|
3920
|
-
products =
|
|
3921
|
-
return
|
|
4974
|
+
products = _context54.sent;
|
|
4975
|
+
return _context54.abrupt("return", products);
|
|
3922
4976
|
case 9:
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
throw
|
|
4977
|
+
_context54.prev = 9;
|
|
4978
|
+
_context54.t0 = _context54["catch"](0);
|
|
4979
|
+
throw _context54.t0;
|
|
3926
4980
|
case 12:
|
|
3927
4981
|
case "end":
|
|
3928
|
-
return
|
|
4982
|
+
return _context54.stop();
|
|
3929
4983
|
}
|
|
3930
|
-
},
|
|
4984
|
+
}, _callee54, this, [[0, 9]]);
|
|
3931
4985
|
}));
|
|
3932
|
-
function addProductToOrder(
|
|
4986
|
+
function addProductToOrder(_x46, _x47, _x48) {
|
|
3933
4987
|
return _addProductToOrder.apply(this, arguments);
|
|
3934
4988
|
}
|
|
3935
4989
|
return addProductToOrder;
|
|
@@ -3937,34 +4991,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3937
4991
|
}, {
|
|
3938
4992
|
key: "updateOrderProduct",
|
|
3939
4993
|
value: function () {
|
|
3940
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4994
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
|
|
3941
4995
|
var products;
|
|
3942
|
-
return _regeneratorRuntime().wrap(function
|
|
3943
|
-
while (1) switch (
|
|
4996
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
4997
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
3944
4998
|
case 0:
|
|
3945
|
-
|
|
4999
|
+
_context55.prev = 0;
|
|
3946
5000
|
if (this.store.order) {
|
|
3947
|
-
|
|
5001
|
+
_context55.next = 3;
|
|
3948
5002
|
break;
|
|
3949
5003
|
}
|
|
3950
5004
|
throw new Error('order 模块未初始化');
|
|
3951
5005
|
case 3:
|
|
3952
|
-
|
|
5006
|
+
_context55.next = 5;
|
|
3953
5007
|
return this.store.order.updateOrderProduct(params);
|
|
3954
5008
|
case 5:
|
|
3955
|
-
products =
|
|
3956
|
-
return
|
|
5009
|
+
products = _context55.sent;
|
|
5010
|
+
return _context55.abrupt("return", products);
|
|
3957
5011
|
case 9:
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
throw
|
|
5012
|
+
_context55.prev = 9;
|
|
5013
|
+
_context55.t0 = _context55["catch"](0);
|
|
5014
|
+
throw _context55.t0;
|
|
3961
5015
|
case 12:
|
|
3962
5016
|
case "end":
|
|
3963
|
-
return
|
|
5017
|
+
return _context55.stop();
|
|
3964
5018
|
}
|
|
3965
|
-
},
|
|
5019
|
+
}, _callee55, this, [[0, 9]]);
|
|
3966
5020
|
}));
|
|
3967
|
-
function updateOrderProduct(
|
|
5021
|
+
function updateOrderProduct(_x49) {
|
|
3968
5022
|
return _updateOrderProduct.apply(this, arguments);
|
|
3969
5023
|
}
|
|
3970
5024
|
return updateOrderProduct;
|
|
@@ -3972,34 +5026,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3972
5026
|
}, {
|
|
3973
5027
|
key: "updateOrderProducts",
|
|
3974
5028
|
value: function () {
|
|
3975
|
-
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5029
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(paramsList) {
|
|
3976
5030
|
var products;
|
|
3977
|
-
return _regeneratorRuntime().wrap(function
|
|
3978
|
-
while (1) switch (
|
|
5031
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
5032
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
3979
5033
|
case 0:
|
|
3980
|
-
|
|
5034
|
+
_context56.prev = 0;
|
|
3981
5035
|
if (this.store.order) {
|
|
3982
|
-
|
|
5036
|
+
_context56.next = 3;
|
|
3983
5037
|
break;
|
|
3984
5038
|
}
|
|
3985
5039
|
throw new Error('order 模块未初始化');
|
|
3986
5040
|
case 3:
|
|
3987
|
-
|
|
5041
|
+
_context56.next = 5;
|
|
3988
5042
|
return this.store.order.updateOrderProducts(paramsList);
|
|
3989
5043
|
case 5:
|
|
3990
|
-
products =
|
|
3991
|
-
return
|
|
5044
|
+
products = _context56.sent;
|
|
5045
|
+
return _context56.abrupt("return", products);
|
|
3992
5046
|
case 9:
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
throw
|
|
5047
|
+
_context56.prev = 9;
|
|
5048
|
+
_context56.t0 = _context56["catch"](0);
|
|
5049
|
+
throw _context56.t0;
|
|
3996
5050
|
case 12:
|
|
3997
5051
|
case "end":
|
|
3998
|
-
return
|
|
5052
|
+
return _context56.stop();
|
|
3999
5053
|
}
|
|
4000
|
-
},
|
|
5054
|
+
}, _callee56, this, [[0, 9]]);
|
|
4001
5055
|
}));
|
|
4002
|
-
function updateOrderProducts(
|
|
5056
|
+
function updateOrderProducts(_x50) {
|
|
4003
5057
|
return _updateOrderProducts.apply(this, arguments);
|
|
4004
5058
|
}
|
|
4005
5059
|
return updateOrderProducts;
|
|
@@ -4007,34 +5061,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4007
5061
|
}, {
|
|
4008
5062
|
key: "updateOrderProductQuantity",
|
|
4009
5063
|
value: function () {
|
|
4010
|
-
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5064
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
|
|
4011
5065
|
var products;
|
|
4012
|
-
return _regeneratorRuntime().wrap(function
|
|
4013
|
-
while (1) switch (
|
|
5066
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
|
5067
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
4014
5068
|
case 0:
|
|
4015
|
-
|
|
5069
|
+
_context57.prev = 0;
|
|
4016
5070
|
if (this.store.order) {
|
|
4017
|
-
|
|
5071
|
+
_context57.next = 3;
|
|
4018
5072
|
break;
|
|
4019
5073
|
}
|
|
4020
5074
|
throw new Error('order 模块未初始化');
|
|
4021
5075
|
case 3:
|
|
4022
|
-
|
|
5076
|
+
_context57.next = 5;
|
|
4023
5077
|
return this.store.order.updateOrderProductQuantity(params);
|
|
4024
5078
|
case 5:
|
|
4025
|
-
products =
|
|
4026
|
-
return
|
|
5079
|
+
products = _context57.sent;
|
|
5080
|
+
return _context57.abrupt("return", products);
|
|
4027
5081
|
case 9:
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
throw
|
|
5082
|
+
_context57.prev = 9;
|
|
5083
|
+
_context57.t0 = _context57["catch"](0);
|
|
5084
|
+
throw _context57.t0;
|
|
4031
5085
|
case 12:
|
|
4032
5086
|
case "end":
|
|
4033
|
-
return
|
|
5087
|
+
return _context57.stop();
|
|
4034
5088
|
}
|
|
4035
|
-
},
|
|
5089
|
+
}, _callee57, this, [[0, 9]]);
|
|
4036
5090
|
}));
|
|
4037
|
-
function updateOrderProductQuantity(
|
|
5091
|
+
function updateOrderProductQuantity(_x51) {
|
|
4038
5092
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
4039
5093
|
}
|
|
4040
5094
|
return updateOrderProductQuantity;
|
|
@@ -4057,12 +5111,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4057
5111
|
}, {
|
|
4058
5112
|
key: "setOrderProductLineNote",
|
|
4059
5113
|
value: (function () {
|
|
4060
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5114
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(identity, note) {
|
|
4061
5115
|
var params, products;
|
|
4062
|
-
return _regeneratorRuntime().wrap(function
|
|
4063
|
-
while (1) switch (
|
|
5116
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
|
5117
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
4064
5118
|
case 0:
|
|
4065
|
-
|
|
5119
|
+
_context58.prev = 0;
|
|
4066
5120
|
params = {
|
|
4067
5121
|
product_id: identity.product_id,
|
|
4068
5122
|
product_variant_id: identity.product_variant_id,
|
|
@@ -4077,22 +5131,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4077
5131
|
params.product_sku = identity.product_sku;
|
|
4078
5132
|
}
|
|
4079
5133
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
4080
|
-
|
|
5134
|
+
_context58.next = 7;
|
|
4081
5135
|
return this.updateOrderProduct(params);
|
|
4082
5136
|
case 7:
|
|
4083
|
-
products =
|
|
4084
|
-
return
|
|
5137
|
+
products = _context58.sent;
|
|
5138
|
+
return _context58.abrupt("return", products);
|
|
4085
5139
|
case 11:
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
throw
|
|
5140
|
+
_context58.prev = 11;
|
|
5141
|
+
_context58.t0 = _context58["catch"](0);
|
|
5142
|
+
throw _context58.t0;
|
|
4089
5143
|
case 14:
|
|
4090
5144
|
case "end":
|
|
4091
|
-
return
|
|
5145
|
+
return _context58.stop();
|
|
4092
5146
|
}
|
|
4093
|
-
},
|
|
5147
|
+
}, _callee58, this, [[0, 11]]);
|
|
4094
5148
|
}));
|
|
4095
|
-
function setOrderProductLineNote(
|
|
5149
|
+
function setOrderProductLineNote(_x52, _x53) {
|
|
4096
5150
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
4097
5151
|
}
|
|
4098
5152
|
return setOrderProductLineNote;
|
|
@@ -4107,32 +5161,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4107
5161
|
}, {
|
|
4108
5162
|
key: "removeProductsFromOrder",
|
|
4109
5163
|
value: (function () {
|
|
4110
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4111
|
-
return _regeneratorRuntime().wrap(function
|
|
4112
|
-
while (1) switch (
|
|
5164
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(identities, options) {
|
|
5165
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
|
5166
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
4113
5167
|
case 0:
|
|
4114
|
-
|
|
5168
|
+
_context59.prev = 0;
|
|
4115
5169
|
if (this.store.order) {
|
|
4116
|
-
|
|
5170
|
+
_context59.next = 3;
|
|
4117
5171
|
break;
|
|
4118
5172
|
}
|
|
4119
5173
|
throw new Error('order 模块未初始化');
|
|
4120
5174
|
case 3:
|
|
4121
|
-
|
|
4122
|
-
return this.store.order.removeProductsFromOrder(identities);
|
|
5175
|
+
_context59.next = 5;
|
|
5176
|
+
return this.store.order.removeProductsFromOrder(identities, options);
|
|
4123
5177
|
case 5:
|
|
4124
|
-
return
|
|
5178
|
+
return _context59.abrupt("return", _context59.sent);
|
|
4125
5179
|
case 8:
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
throw
|
|
5180
|
+
_context59.prev = 8;
|
|
5181
|
+
_context59.t0 = _context59["catch"](0);
|
|
5182
|
+
throw _context59.t0;
|
|
4129
5183
|
case 11:
|
|
4130
5184
|
case "end":
|
|
4131
|
-
return
|
|
5185
|
+
return _context59.stop();
|
|
4132
5186
|
}
|
|
4133
|
-
},
|
|
5187
|
+
}, _callee59, this, [[0, 8]]);
|
|
4134
5188
|
}));
|
|
4135
|
-
function removeProductsFromOrder(
|
|
5189
|
+
function removeProductsFromOrder(_x54, _x55) {
|
|
4136
5190
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
4137
5191
|
}
|
|
4138
5192
|
return removeProductsFromOrder;
|
|
@@ -4140,18 +5194,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4140
5194
|
}, {
|
|
4141
5195
|
key: "removeProductFromOrder",
|
|
4142
5196
|
value: function () {
|
|
4143
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4144
|
-
return _regeneratorRuntime().wrap(function
|
|
4145
|
-
while (1) switch (
|
|
5197
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(identity, options) {
|
|
5198
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
|
5199
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
4146
5200
|
case 0:
|
|
4147
|
-
return
|
|
5201
|
+
return _context60.abrupt("return", this.removeProductsFromOrder([identity], options));
|
|
4148
5202
|
case 1:
|
|
4149
5203
|
case "end":
|
|
4150
|
-
return
|
|
5204
|
+
return _context60.stop();
|
|
4151
5205
|
}
|
|
4152
|
-
},
|
|
5206
|
+
}, _callee60, this);
|
|
4153
5207
|
}));
|
|
4154
|
-
function removeProductFromOrder(
|
|
5208
|
+
function removeProductFromOrder(_x56, _x57) {
|
|
4155
5209
|
return _removeProductFromOrder.apply(this, arguments);
|
|
4156
5210
|
}
|
|
4157
5211
|
return removeProductFromOrder;
|
|
@@ -4201,23 +5255,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4201
5255
|
}, {
|
|
4202
5256
|
key: "applyPromotion",
|
|
4203
5257
|
value: (function () {
|
|
4204
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4205
|
-
return _regeneratorRuntime().wrap(function
|
|
4206
|
-
while (1) switch (
|
|
5258
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61() {
|
|
5259
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
|
5260
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
4207
5261
|
case 0:
|
|
4208
5262
|
if (this.store.order) {
|
|
4209
|
-
|
|
5263
|
+
_context61.next = 2;
|
|
4210
5264
|
break;
|
|
4211
5265
|
}
|
|
4212
5266
|
throw new Error('order 模块未初始化');
|
|
4213
5267
|
case 2:
|
|
4214
|
-
|
|
5268
|
+
_context61.next = 4;
|
|
4215
5269
|
return this.store.order.applyPromotion();
|
|
4216
5270
|
case 4:
|
|
4217
5271
|
case "end":
|
|
4218
|
-
return
|
|
5272
|
+
return _context61.stop();
|
|
4219
5273
|
}
|
|
4220
|
-
},
|
|
5274
|
+
}, _callee61, this);
|
|
4221
5275
|
}));
|
|
4222
5276
|
function applyPromotion() {
|
|
4223
5277
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -4227,16 +5281,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4227
5281
|
}, {
|
|
4228
5282
|
key: "getUnfulfilledPromotions",
|
|
4229
5283
|
value: function getUnfulfilledPromotions() {
|
|
4230
|
-
var _this$store$
|
|
4231
|
-
return ((_this$store$
|
|
5284
|
+
var _this$store$order16;
|
|
5285
|
+
return ((_this$store$order16 = this.store.order) === null || _this$store$order16 === void 0 ? void 0 : _this$store$order16.getUnfulfilledPromotions()) || [];
|
|
4232
5286
|
}
|
|
4233
5287
|
|
|
4234
5288
|
/** 最近一次促销计算输出的赠品操作 diff。 */
|
|
4235
5289
|
}, {
|
|
4236
5290
|
key: "getLastGiftActions",
|
|
4237
5291
|
value: function getLastGiftActions() {
|
|
4238
|
-
var _this$store$
|
|
4239
|
-
return ((_this$store$
|
|
5292
|
+
var _this$store$order17;
|
|
5293
|
+
return ((_this$store$order17 = this.store.order) === null || _this$store$order17 === void 0 ? void 0 : _this$store$order17.getLastGiftActions()) || null;
|
|
4240
5294
|
}
|
|
4241
5295
|
|
|
4242
5296
|
// 获取商品列表
|
|
@@ -4244,18 +5298,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4244
5298
|
}, {
|
|
4245
5299
|
key: "getProductList",
|
|
4246
5300
|
value: function () {
|
|
4247
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4248
|
-
var _this$
|
|
5301
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62() {
|
|
5302
|
+
var _this$otherParams32;
|
|
4249
5303
|
var menu_list_ids, _this$store$products, res;
|
|
4250
|
-
return _regeneratorRuntime().wrap(function
|
|
4251
|
-
while (1) switch (
|
|
5304
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
|
5305
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
4252
5306
|
case 0:
|
|
4253
5307
|
// 可以直接通过配置里的 menu 读取
|
|
4254
|
-
menu_list_ids = ((_this$
|
|
5308
|
+
menu_list_ids = ((_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 || (_this$otherParams32 = _this$otherParams32.dineInConfig) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32['menu.associated_menus'].map(function (n) {
|
|
4255
5309
|
return Number(n.value);
|
|
4256
5310
|
})) || [];
|
|
4257
|
-
|
|
4258
|
-
|
|
5311
|
+
_context62.prev = 1;
|
|
5312
|
+
_context62.next = 4;
|
|
4259
5313
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
4260
5314
|
menu_list_ids: menu_list_ids,
|
|
4261
5315
|
cacheId: this.cacheId,
|
|
@@ -4263,17 +5317,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4263
5317
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
4264
5318
|
});
|
|
4265
5319
|
case 4:
|
|
4266
|
-
res =
|
|
4267
|
-
return
|
|
5320
|
+
res = _context62.sent;
|
|
5321
|
+
return _context62.abrupt("return", res);
|
|
4268
5322
|
case 8:
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
throw
|
|
5323
|
+
_context62.prev = 8;
|
|
5324
|
+
_context62.t0 = _context62["catch"](1);
|
|
5325
|
+
throw _context62.t0;
|
|
4272
5326
|
case 11:
|
|
4273
5327
|
case "end":
|
|
4274
|
-
return
|
|
5328
|
+
return _context62.stop();
|
|
4275
5329
|
}
|
|
4276
|
-
},
|
|
5330
|
+
}, _callee62, this, [[1, 8]]);
|
|
4277
5331
|
}));
|
|
4278
5332
|
function getProductList() {
|
|
4279
5333
|
return _getProductList.apply(this, arguments);
|
|
@@ -4288,33 +5342,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4288
5342
|
}, {
|
|
4289
5343
|
key: "setOtherParams",
|
|
4290
5344
|
value: function () {
|
|
4291
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4292
|
-
var _this$
|
|
4293
|
-
var
|
|
4294
|
-
|
|
5345
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
|
|
5346
|
+
var _this$otherParams33;
|
|
5347
|
+
var _ref42,
|
|
5348
|
+
_ref42$cover,
|
|
4295
5349
|
cover,
|
|
4296
|
-
|
|
4297
|
-
return _regeneratorRuntime().wrap(function
|
|
4298
|
-
while (1) switch (
|
|
5350
|
+
_args63 = arguments;
|
|
5351
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
5352
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
4299
5353
|
case 0:
|
|
4300
|
-
|
|
5354
|
+
_ref42 = _args63.length > 1 && _args63[1] !== undefined ? _args63[1] : {}, _ref42$cover = _ref42.cover, cover = _ref42$cover === void 0 ? false : _ref42$cover;
|
|
4301
5355
|
if (cover) {
|
|
4302
5356
|
this.otherParams = _objectSpread({}, params);
|
|
4303
5357
|
} else {
|
|
4304
5358
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
4305
5359
|
}
|
|
4306
|
-
this.cacheId = (_this$
|
|
4307
|
-
|
|
5360
|
+
this.cacheId = (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.cacheId;
|
|
5361
|
+
_context63.next = 5;
|
|
4308
5362
|
return this.syncOtherParamsToSubModules(params, {
|
|
4309
5363
|
cover: cover
|
|
4310
5364
|
});
|
|
4311
5365
|
case 5:
|
|
4312
5366
|
case "end":
|
|
4313
|
-
return
|
|
5367
|
+
return _context63.stop();
|
|
4314
5368
|
}
|
|
4315
|
-
},
|
|
5369
|
+
}, _callee63, this);
|
|
4316
5370
|
}));
|
|
4317
|
-
function setOtherParams(
|
|
5371
|
+
function setOtherParams(_x58) {
|
|
4318
5372
|
return _setOtherParams.apply(this, arguments);
|
|
4319
5373
|
}
|
|
4320
5374
|
return setOtherParams;
|