@pisell/pisellos 2.3.7 → 2.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/Order/index.d.ts +17 -1
- package/dist/modules/Order/index.js +282 -121
- package/dist/modules/Order/types.d.ts +15 -2
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils.js +83 -28
- package/dist/solution/BaseSales/index.d.ts +15 -1
- package/dist/solution/BaseSales/index.js +405 -260
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Order/index.d.ts +17 -1
- package/lib/modules/Order/index.js +205 -36
- package/lib/modules/Order/types.d.ts +15 -2
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
- package/lib/modules/Order/utils.js +45 -2
- package/lib/solution/BaseSales/index.d.ts +15 -1
- package/lib/solution/BaseSales/index.js +105 -14
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -153,6 +153,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
153
153
|
_defineProperty(_assertThisInitialized(_this), "hasManualDiscountSelection", false);
|
|
154
154
|
_defineProperty(_assertThisInitialized(_this), "reusedSharedSubModuleNames", new Set());
|
|
155
155
|
_defineProperty(_assertThisInitialized(_this), "paymentMethodsCache", []);
|
|
156
|
+
_defineProperty(_assertThisInitialized(_this), "queuedAutoPaymentSync", false);
|
|
157
|
+
_defineProperty(_assertThisInitialized(_this), "autoPaymentSyncFlushing", false);
|
|
158
|
+
_defineProperty(_assertThisInitialized(_this), "autoPaymentSyncTimer", null);
|
|
156
159
|
return _this;
|
|
157
160
|
}
|
|
158
161
|
|
|
@@ -168,9 +171,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
168
171
|
}, {
|
|
169
172
|
key: "getReusableSharedSubModule",
|
|
170
173
|
value: function getReusableSharedSubModule(moduleName) {
|
|
171
|
-
var _this$core;
|
|
174
|
+
var _this$core, _this$core$getModule;
|
|
172
175
|
if (moduleName !== 'schedule' && moduleName !== 'quotation') return null;
|
|
173
|
-
return ((_this$core = this.core) === null || _this$core === void 0 ? void 0 : _this$core.
|
|
176
|
+
return ((_this$core = this.core) === null || _this$core === void 0 || (_this$core$getModule = _this$core.getModule) === null || _this$core$getModule === void 0 ? void 0 : _this$core$getModule.call(_this$core, moduleName)) || null;
|
|
174
177
|
}
|
|
175
178
|
}, {
|
|
176
179
|
key: "isScheduleListLoaded",
|
|
@@ -1838,7 +1841,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1838
1841
|
key: "setDiscountSelected",
|
|
1839
1842
|
value: function () {
|
|
1840
1843
|
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
1841
|
-
var _tempOrder$holder3, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, _iterator3, _step3, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
1844
|
+
var _tempOrder$holder3, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator3, _step3, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
1842
1845
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1843
1846
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1844
1847
|
case 0:
|
|
@@ -1902,6 +1905,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1902
1905
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
1903
1906
|
d.isSelected = false;
|
|
1904
1907
|
d.isManualSelect = true;
|
|
1908
|
+
d.appliedProductDetails = [];
|
|
1905
1909
|
}
|
|
1906
1910
|
}
|
|
1907
1911
|
} catch (err) {
|
|
@@ -1917,28 +1921,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1917
1921
|
}).map(function (d) {
|
|
1918
1922
|
return d.id;
|
|
1919
1923
|
}));
|
|
1924
|
+
filterSelectedDiscountDetails = function filterSelectedDiscountDetails(discountList) {
|
|
1925
|
+
return (discountList || []).filter(function (pd) {
|
|
1926
|
+
var _pd$discount$resource, _pd$discount;
|
|
1927
|
+
var rid = (_pd$discount$resource = (_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) !== null && _pd$discount$resource !== void 0 ? _pd$discount$resource : pd.id;
|
|
1928
|
+
return rid != null && selectedResourceIds.has(rid);
|
|
1929
|
+
});
|
|
1930
|
+
};
|
|
1920
1931
|
_iterator3 = _createForOfIteratorHelper(tempOrder.products);
|
|
1921
|
-
_context18.prev =
|
|
1932
|
+
_context18.prev = 18;
|
|
1922
1933
|
_iterator3.s();
|
|
1923
|
-
case
|
|
1934
|
+
case 20:
|
|
1924
1935
|
if ((_step3 = _iterator3.n()).done) {
|
|
1925
|
-
_context18.next =
|
|
1936
|
+
_context18.next = 37;
|
|
1926
1937
|
break;
|
|
1927
1938
|
}
|
|
1928
1939
|
product = _step3.value;
|
|
1929
1940
|
productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
|
|
1930
1941
|
runtimeOrigin = productUid ? (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[productUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin : undefined;
|
|
1931
1942
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
1932
|
-
_context18.next =
|
|
1943
|
+
_context18.next = 26;
|
|
1933
1944
|
break;
|
|
1934
1945
|
}
|
|
1935
|
-
return _context18.abrupt("continue",
|
|
1936
|
-
case
|
|
1937
|
-
product.discount_list = (product.discount_list
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1946
|
+
return _context18.abrupt("continue", 35);
|
|
1947
|
+
case 26:
|
|
1948
|
+
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
1949
|
+
if (Array.isArray(product.product_bundle)) {
|
|
1950
|
+
product.product_bundle = product.product_bundle.map(function (bundle) {
|
|
1951
|
+
var _ref18, _bundle$original_pric;
|
|
1952
|
+
var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
|
|
1953
|
+
var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
|
|
1954
|
+
var restoredBundlePrice = (_ref18 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref18 !== void 0 ? _ref18 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
|
|
1955
|
+
return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
|
|
1956
|
+
price: restoredBundlePrice,
|
|
1957
|
+
bundle_selling_price: restoredBundlePrice
|
|
1958
|
+
} : {}), {}, {
|
|
1959
|
+
discount_list: nextBundleDiscountList
|
|
1960
|
+
});
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1942
1963
|
|
|
1943
1964
|
// 券作用于 source(不含 option、不含 bundle);算出新 source 折后价后补回 options
|
|
1944
1965
|
// 写入含 option 的 main_product_selling_price,再合成 composite 回写 selling_price。
|
|
@@ -1957,33 +1978,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1957
1978
|
mainPrice: newMainSellingPrice,
|
|
1958
1979
|
bundle: product.product_bundle
|
|
1959
1980
|
});
|
|
1960
|
-
case 33:
|
|
1961
|
-
_context18.next = 19;
|
|
1962
|
-
break;
|
|
1963
1981
|
case 35:
|
|
1964
|
-
_context18.next =
|
|
1982
|
+
_context18.next = 20;
|
|
1965
1983
|
break;
|
|
1966
1984
|
case 37:
|
|
1967
|
-
_context18.
|
|
1968
|
-
|
|
1985
|
+
_context18.next = 42;
|
|
1986
|
+
break;
|
|
1987
|
+
case 39:
|
|
1988
|
+
_context18.prev = 39;
|
|
1989
|
+
_context18.t0 = _context18["catch"](18);
|
|
1969
1990
|
_iterator3.e(_context18.t0);
|
|
1970
|
-
case
|
|
1971
|
-
_context18.prev =
|
|
1991
|
+
case 42:
|
|
1992
|
+
_context18.prev = 42;
|
|
1972
1993
|
_iterator3.f();
|
|
1973
|
-
return _context18.finish(
|
|
1974
|
-
case
|
|
1994
|
+
return _context18.finish(42);
|
|
1995
|
+
case 45:
|
|
1975
1996
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1976
|
-
_context18.next =
|
|
1997
|
+
_context18.next = 48;
|
|
1977
1998
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1978
|
-
case
|
|
1999
|
+
case 48:
|
|
1979
2000
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1980
2001
|
return d.isSelected;
|
|
1981
2002
|
});
|
|
1982
|
-
_context18.next =
|
|
2003
|
+
_context18.next = 51;
|
|
1983
2004
|
return this.store.order.recalculateSummary({
|
|
1984
2005
|
createIfMissing: true
|
|
1985
2006
|
});
|
|
1986
|
-
case
|
|
2007
|
+
case 51:
|
|
1987
2008
|
this.store.order.persistTempOrder();
|
|
1988
2009
|
this.effectsEmit('onDiscountApplied', {
|
|
1989
2010
|
productList: tempOrder.products,
|
|
@@ -1991,17 +2012,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1991
2012
|
selectedDiscountList: tempOrder.discount_list,
|
|
1992
2013
|
tempOrder: tempOrder
|
|
1993
2014
|
});
|
|
1994
|
-
_context18.next =
|
|
2015
|
+
_context18.next = 58;
|
|
1995
2016
|
break;
|
|
1996
|
-
case
|
|
1997
|
-
_context18.prev =
|
|
2017
|
+
case 55:
|
|
2018
|
+
_context18.prev = 55;
|
|
1998
2019
|
_context18.t1 = _context18["catch"](0);
|
|
1999
2020
|
throw _context18.t1;
|
|
2000
|
-
case
|
|
2021
|
+
case 58:
|
|
2001
2022
|
case "end":
|
|
2002
2023
|
return _context18.stop();
|
|
2003
2024
|
}
|
|
2004
|
-
}, _callee18, this, [[0,
|
|
2025
|
+
}, _callee18, this, [[0, 55], [18, 39, 42, 45]]);
|
|
2005
2026
|
}));
|
|
2006
2027
|
function setDiscountSelected(_x14) {
|
|
2007
2028
|
return _setDiscountSelected.apply(this, arguments);
|
|
@@ -2112,7 +2133,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2112
2133
|
case 2:
|
|
2113
2134
|
// this.store.order.persistTempOrder();
|
|
2114
2135
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
2115
|
-
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2136
|
+
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2116
2137
|
cacheId: this.cacheId,
|
|
2117
2138
|
platform: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform,
|
|
2118
2139
|
businessCode: ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode) || ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.business_code),
|
|
@@ -2125,6 +2146,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2125
2146
|
paymentStatus: inferredPaymentStatus
|
|
2126
2147
|
} : {}), (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined ? {
|
|
2127
2148
|
smallTicketDataFlag: params.smallTicketDataFlag
|
|
2149
|
+
} : {}), (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
2150
|
+
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
2128
2151
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2129
2152
|
enhancePayload: params.enhancePayload
|
|
2130
2153
|
} : {});
|
|
@@ -2156,7 +2179,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2156
2179
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
2157
2180
|
case 2:
|
|
2158
2181
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
2159
|
-
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2182
|
+
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2160
2183
|
cacheId: this.cacheId,
|
|
2161
2184
|
platform: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform,
|
|
2162
2185
|
businessCode: ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.businessCode) || ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.business_code),
|
|
@@ -2168,6 +2191,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2168
2191
|
paymentStatus: inferredPaymentStatus
|
|
2169
2192
|
} : {}), (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined ? {
|
|
2170
2193
|
smallTicketDataFlag: params.smallTicketDataFlag
|
|
2194
|
+
} : {}), (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
2195
|
+
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
2171
2196
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2172
2197
|
enhancePayload: params.enhancePayload
|
|
2173
2198
|
} : {});
|
|
@@ -2267,7 +2292,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2267
2292
|
key: "syncPaymentsToOrder",
|
|
2268
2293
|
value: function () {
|
|
2269
2294
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
2270
|
-
var
|
|
2295
|
+
var _ref19, _params$businessCode, _this$otherParams18, _this$otherParams19, _params$channel;
|
|
2271
2296
|
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
2272
2297
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2273
2298
|
while (1) switch (_context24.prev = _context24.next) {
|
|
@@ -2278,7 +2303,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2278
2303
|
}
|
|
2279
2304
|
throw new Error('order 模块未初始化');
|
|
2280
2305
|
case 2:
|
|
2281
|
-
businessCode = (
|
|
2306
|
+
businessCode = (_ref19 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) !== null && _ref19 !== void 0 ? _ref19 : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code;
|
|
2282
2307
|
channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
|
|
2283
2308
|
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
|
|
2284
2309
|
businessCode: businessCode
|
|
@@ -2287,24 +2312,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2287
2312
|
} : {});
|
|
2288
2313
|
syncState = this.store.order.getOrderSyncState();
|
|
2289
2314
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
2290
|
-
_context24.next =
|
|
2315
|
+
_context24.next = 9;
|
|
2291
2316
|
break;
|
|
2292
2317
|
}
|
|
2318
|
+
this.queueLatestAutoPaymentSync();
|
|
2293
2319
|
return _context24.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
2294
|
-
case
|
|
2320
|
+
case 9:
|
|
2295
2321
|
payments = params.payments || [];
|
|
2296
|
-
_context24.next =
|
|
2322
|
+
_context24.next = 12;
|
|
2297
2323
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
2298
2324
|
payments: payments,
|
|
2299
2325
|
params: syncParams,
|
|
2300
2326
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
2301
2327
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2302
2328
|
});
|
|
2303
|
-
case
|
|
2304
|
-
_context24.prev =
|
|
2305
|
-
_context24.next =
|
|
2329
|
+
case 12:
|
|
2330
|
+
_context24.prev = 12;
|
|
2331
|
+
_context24.next = 15;
|
|
2306
2332
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
2307
|
-
case
|
|
2333
|
+
case 15:
|
|
2308
2334
|
syncResult = _context24.sent;
|
|
2309
2335
|
latestPayments = this.store.order.getOrderPayments();
|
|
2310
2336
|
amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
@@ -2323,21 +2349,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2323
2349
|
depositAmount: syncResult.depositAmount,
|
|
2324
2350
|
orderExpectedAmount: syncResult.orderExpectedAmount
|
|
2325
2351
|
};
|
|
2326
|
-
_context24.next =
|
|
2352
|
+
_context24.next = 22;
|
|
2327
2353
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
|
|
2328
|
-
case
|
|
2354
|
+
case 22:
|
|
2329
2355
|
if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
|
|
2330
|
-
_context24.next =
|
|
2356
|
+
_context24.next = 25;
|
|
2331
2357
|
break;
|
|
2332
2358
|
}
|
|
2333
|
-
_context24.next =
|
|
2359
|
+
_context24.next = 25;
|
|
2334
2360
|
return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
|
|
2335
|
-
case
|
|
2361
|
+
case 25:
|
|
2362
|
+
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2336
2363
|
return _context24.abrupt("return", syncResult);
|
|
2337
|
-
case
|
|
2338
|
-
_context24.prev =
|
|
2339
|
-
_context24.t0 = _context24["catch"](
|
|
2340
|
-
_context24.next =
|
|
2364
|
+
case 29:
|
|
2365
|
+
_context24.prev = 29;
|
|
2366
|
+
_context24.t0 = _context24["catch"](12);
|
|
2367
|
+
_context24.next = 33;
|
|
2341
2368
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
2342
2369
|
ok: false,
|
|
2343
2370
|
error: _context24.t0,
|
|
@@ -2346,13 +2373,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2346
2373
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
2347
2374
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2348
2375
|
});
|
|
2349
|
-
case
|
|
2376
|
+
case 33:
|
|
2377
|
+
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2350
2378
|
throw _context24.t0;
|
|
2351
|
-
case
|
|
2379
|
+
case 35:
|
|
2352
2380
|
case "end":
|
|
2353
2381
|
return _context24.stop();
|
|
2354
2382
|
}
|
|
2355
|
-
}, _callee24, this, [[
|
|
2383
|
+
}, _callee24, this, [[12, 29]]);
|
|
2356
2384
|
}));
|
|
2357
2385
|
function syncPaymentsToOrder(_x20) {
|
|
2358
2386
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
@@ -2374,17 +2402,120 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2374
2402
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2375
2403
|
return this.store.order.setOrderPayments(payments);
|
|
2376
2404
|
}
|
|
2377
|
-
|
|
2378
|
-
|
|
2405
|
+
}, {
|
|
2406
|
+
key: "getPaymentStatusForSync",
|
|
2407
|
+
value: function getPaymentStatusForSync(payments) {
|
|
2408
|
+
var order = this.store.order;
|
|
2409
|
+
if (!order) throw new Error('order 模块未初始化');
|
|
2410
|
+
var completion = order.getPaymentCompletion(payments);
|
|
2411
|
+
return completion.isOrderFullyPaid ? 'paid' : 'partially_paid';
|
|
2412
|
+
}
|
|
2413
|
+
}, {
|
|
2414
|
+
key: "queueLatestAutoPaymentSync",
|
|
2415
|
+
value: function queueLatestAutoPaymentSync() {
|
|
2416
|
+
this.queuedAutoPaymentSync = true;
|
|
2417
|
+
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
2418
|
+
}
|
|
2419
|
+
}, {
|
|
2420
|
+
key: "scheduleQueuedAutoPaymentSyncFlush",
|
|
2421
|
+
value: function scheduleQueuedAutoPaymentSyncFlush() {
|
|
2422
|
+
var _this8 = this;
|
|
2423
|
+
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
|
|
2424
|
+
if (!this.queuedAutoPaymentSync) return;
|
|
2425
|
+
if (this.autoPaymentSyncTimer) return;
|
|
2426
|
+
this.autoPaymentSyncTimer = setTimeout(function () {
|
|
2427
|
+
_this8.autoPaymentSyncTimer = null;
|
|
2428
|
+
void _this8.flushQueuedAutoPaymentSync();
|
|
2429
|
+
}, delay);
|
|
2430
|
+
}
|
|
2431
|
+
}, {
|
|
2432
|
+
key: "flushQueuedAutoPaymentSync",
|
|
2433
|
+
value: function () {
|
|
2434
|
+
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
2435
|
+
var payments;
|
|
2436
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2437
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2438
|
+
case 0:
|
|
2439
|
+
if (this.store.order) {
|
|
2440
|
+
_context25.next = 2;
|
|
2441
|
+
break;
|
|
2442
|
+
}
|
|
2443
|
+
return _context25.abrupt("return");
|
|
2444
|
+
case 2:
|
|
2445
|
+
if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
|
|
2446
|
+
_context25.next = 4;
|
|
2447
|
+
break;
|
|
2448
|
+
}
|
|
2449
|
+
return _context25.abrupt("return");
|
|
2450
|
+
case 4:
|
|
2451
|
+
if (!(this.store.order.getOrderSyncState() === 'submitting')) {
|
|
2452
|
+
_context25.next = 7;
|
|
2453
|
+
break;
|
|
2454
|
+
}
|
|
2455
|
+
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
2456
|
+
return _context25.abrupt("return");
|
|
2457
|
+
case 7:
|
|
2458
|
+
this.autoPaymentSyncFlushing = true;
|
|
2459
|
+
_context25.prev = 8;
|
|
2460
|
+
case 9:
|
|
2461
|
+
if (!this.queuedAutoPaymentSync) {
|
|
2462
|
+
_context25.next = 18;
|
|
2463
|
+
break;
|
|
2464
|
+
}
|
|
2465
|
+
this.queuedAutoPaymentSync = false;
|
|
2466
|
+
payments = this.store.order.getOrderPayments();
|
|
2467
|
+
if (payments.length) {
|
|
2468
|
+
_context25.next = 14;
|
|
2469
|
+
break;
|
|
2470
|
+
}
|
|
2471
|
+
return _context25.abrupt("continue", 9);
|
|
2472
|
+
case 14:
|
|
2473
|
+
_context25.next = 16;
|
|
2474
|
+
return this.syncPaymentsToOrder({
|
|
2475
|
+
payments: payments,
|
|
2476
|
+
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
2477
|
+
submitWhenPaid: true,
|
|
2478
|
+
smallTicketDataFlag: 1
|
|
2479
|
+
});
|
|
2480
|
+
case 16:
|
|
2481
|
+
_context25.next = 9;
|
|
2482
|
+
break;
|
|
2483
|
+
case 18:
|
|
2484
|
+
_context25.next = 23;
|
|
2485
|
+
break;
|
|
2486
|
+
case 20:
|
|
2487
|
+
_context25.prev = 20;
|
|
2488
|
+
_context25.t0 = _context25["catch"](8);
|
|
2489
|
+
this.logError('queued auto sync payments failed', {
|
|
2490
|
+
error: _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0)
|
|
2491
|
+
});
|
|
2492
|
+
case 23:
|
|
2493
|
+
_context25.prev = 23;
|
|
2494
|
+
this.autoPaymentSyncFlushing = false;
|
|
2495
|
+
if (this.queuedAutoPaymentSync) {
|
|
2496
|
+
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2497
|
+
}
|
|
2498
|
+
return _context25.finish(23);
|
|
2499
|
+
case 27:
|
|
2500
|
+
case "end":
|
|
2501
|
+
return _context25.stop();
|
|
2502
|
+
}
|
|
2503
|
+
}, _callee25, this, [[8, 20, 23, 27]]);
|
|
2504
|
+
}));
|
|
2505
|
+
function flushQueuedAutoPaymentSync() {
|
|
2506
|
+
return _flushQueuedAutoPaymentSync.apply(this, arguments);
|
|
2507
|
+
}
|
|
2508
|
+
return flushQueuedAutoPaymentSync;
|
|
2509
|
+
}() /** 追加单个支付项到当前订单。 */
|
|
2379
2510
|
}, {
|
|
2380
2511
|
key: "addOrderPayment",
|
|
2381
2512
|
value: function addOrderPayment(payment) {
|
|
2382
2513
|
var _this$otherParams20,
|
|
2383
2514
|
_paymentRecord$paymen,
|
|
2384
2515
|
_paymentRecord$create,
|
|
2385
|
-
|
|
2516
|
+
_ref20,
|
|
2386
2517
|
_paymentRecord$origin,
|
|
2387
|
-
|
|
2518
|
+
_this9 = this;
|
|
2388
2519
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2389
2520
|
var paymentRecord = payment;
|
|
2390
2521
|
var paymentAmount = new Decimal(paymentRecord.amount || 0);
|
|
@@ -2406,7 +2537,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2406
2537
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
2407
2538
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
2408
2539
|
var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
|
|
2409
|
-
var calculatedServiceFee = serviceCharge ? new Decimal((
|
|
2540
|
+
var calculatedServiceFee = serviceCharge ? new Decimal((_ref20 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref20 !== void 0 ? _ref20 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
|
|
2410
2541
|
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, paymentRecord), calculatedServiceFee !== undefined ? {
|
|
2411
2542
|
service_fee: calculatedServiceFee
|
|
2412
2543
|
} : {}), {}, {
|
|
@@ -2416,20 +2547,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2416
2547
|
}));
|
|
2417
2548
|
var amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
2418
2549
|
var syncState = this.store.order.getOrderSyncState();
|
|
2419
|
-
if (amountSnapshot
|
|
2420
|
-
|
|
2421
|
-
|
|
2550
|
+
if (amountSnapshot) {
|
|
2551
|
+
if (syncState === 'submitting') {
|
|
2552
|
+
this.queueLatestAutoPaymentSync();
|
|
2553
|
+
return payments;
|
|
2554
|
+
}
|
|
2422
2555
|
void this.syncPaymentsToOrder({
|
|
2423
2556
|
payments: payments,
|
|
2424
|
-
paymentStatus:
|
|
2557
|
+
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
2425
2558
|
submitWhenPaid: true,
|
|
2426
2559
|
smallTicketDataFlag: 1
|
|
2427
2560
|
}).catch(function (error) {
|
|
2428
|
-
|
|
2561
|
+
_this9.logError('auto sync payments failed', {
|
|
2429
2562
|
error: error instanceof Error ? error.message : String(error)
|
|
2430
2563
|
});
|
|
2431
2564
|
});
|
|
2432
|
-
}
|
|
2565
|
+
}
|
|
2433
2566
|
return payments;
|
|
2434
2567
|
}
|
|
2435
2568
|
|
|
@@ -2452,9 +2585,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2452
2585
|
/** 覆盖 wallet pass 支付项,同时保留普通支付项。 */
|
|
2453
2586
|
}, {
|
|
2454
2587
|
key: "updateVoucherOrderPayments",
|
|
2455
|
-
value: function updateVoucherOrderPayments(payments) {
|
|
2588
|
+
value: function updateVoucherOrderPayments(payments, options) {
|
|
2589
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2590
|
+
return this.store.order.updateVoucherOrderPayments(payments, options);
|
|
2591
|
+
}
|
|
2592
|
+
}, {
|
|
2593
|
+
key: "confirmPendingVoucherPayments",
|
|
2594
|
+
value: function confirmPendingVoucherPayments() {
|
|
2595
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2596
|
+
return this.store.order.confirmPendingVoucherPayments();
|
|
2597
|
+
}
|
|
2598
|
+
}, {
|
|
2599
|
+
key: "discardPendingVoucherPayments",
|
|
2600
|
+
value: function discardPendingVoucherPayments() {
|
|
2456
2601
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2457
|
-
return this.store.order.
|
|
2602
|
+
return this.store.order.discardPendingVoucherPayments();
|
|
2458
2603
|
}
|
|
2459
2604
|
}, {
|
|
2460
2605
|
key: "getWalletProductList",
|
|
@@ -2517,20 +2662,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2517
2662
|
}, {
|
|
2518
2663
|
key: "initWalletData",
|
|
2519
2664
|
value: function () {
|
|
2520
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2521
|
-
var _params$order_wait_pa,
|
|
2665
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2666
|
+
var _params$order_wait_pa, _ref21, _tempOrder$is_price_i;
|
|
2522
2667
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
2523
|
-
return _regeneratorRuntime().wrap(function
|
|
2524
|
-
while (1) switch (
|
|
2668
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2669
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2525
2670
|
case 0:
|
|
2526
2671
|
if (this.store.order) {
|
|
2527
|
-
|
|
2672
|
+
_context26.next = 2;
|
|
2528
2673
|
break;
|
|
2529
2674
|
}
|
|
2530
2675
|
throw new Error('order 模块未初始化');
|
|
2531
2676
|
case 2:
|
|
2532
2677
|
if (this.store.payment) {
|
|
2533
|
-
|
|
2678
|
+
_context26.next = 4;
|
|
2534
2679
|
break;
|
|
2535
2680
|
}
|
|
2536
2681
|
throw new Error('payment 模块未初始化');
|
|
@@ -2539,10 +2684,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2539
2684
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
2540
2685
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
2541
2686
|
if (!(!tempOrder || !amount)) {
|
|
2542
|
-
|
|
2687
|
+
_context26.next = 9;
|
|
2543
2688
|
break;
|
|
2544
2689
|
}
|
|
2545
|
-
return
|
|
2690
|
+
return _context26.abrupt("return", {
|
|
2546
2691
|
walletRecommendList: [],
|
|
2547
2692
|
userIdentificationCodes: [],
|
|
2548
2693
|
transformList: [],
|
|
@@ -2561,15 +2706,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2561
2706
|
},
|
|
2562
2707
|
products: this.getWalletProductList(),
|
|
2563
2708
|
order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
|
|
2564
|
-
is_price_include_tax: (
|
|
2709
|
+
is_price_include_tax: (_ref21 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref21 !== void 0 ? _ref21 : 1
|
|
2565
2710
|
}, snapshot.identity.orderId ? {
|
|
2566
2711
|
payment_order_id: String(snapshot.identity.orderId)
|
|
2567
2712
|
} : {});
|
|
2568
|
-
|
|
2713
|
+
_context26.next = 12;
|
|
2569
2714
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
2570
2715
|
case 12:
|
|
2571
|
-
result =
|
|
2572
|
-
|
|
2716
|
+
result = _context26.sent;
|
|
2717
|
+
_context26.next = 15;
|
|
2573
2718
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
2574
2719
|
orderId: snapshot.identity.orderId,
|
|
2575
2720
|
customerId: walletBusinessData.customer_id,
|
|
@@ -2581,12 +2726,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2581
2726
|
timestamp: Date.now()
|
|
2582
2727
|
});
|
|
2583
2728
|
case 15:
|
|
2584
|
-
return
|
|
2729
|
+
return _context26.abrupt("return", result);
|
|
2585
2730
|
case 16:
|
|
2586
2731
|
case "end":
|
|
2587
|
-
return
|
|
2732
|
+
return _context26.stop();
|
|
2588
2733
|
}
|
|
2589
|
-
},
|
|
2734
|
+
}, _callee26, this);
|
|
2590
2735
|
}));
|
|
2591
2736
|
function initWalletData(_x21) {
|
|
2592
2737
|
return _initWalletData.apply(this, arguments);
|
|
@@ -2615,35 +2760,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2615
2760
|
}, {
|
|
2616
2761
|
key: "getPaymentMethodsAsync",
|
|
2617
2762
|
value: (function () {
|
|
2618
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2763
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
2619
2764
|
var response, paymentMethods;
|
|
2620
|
-
return _regeneratorRuntime().wrap(function
|
|
2621
|
-
while (1) switch (
|
|
2765
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2766
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2622
2767
|
case 0:
|
|
2623
|
-
|
|
2624
|
-
|
|
2768
|
+
_context27.prev = 0;
|
|
2769
|
+
_context27.next = 3;
|
|
2625
2770
|
return this.request.get('/pay/custom-payment/all', {
|
|
2626
2771
|
filterPaymentMethods: true
|
|
2627
2772
|
}, {
|
|
2628
2773
|
osServer: true
|
|
2629
2774
|
});
|
|
2630
2775
|
case 3:
|
|
2631
|
-
response =
|
|
2776
|
+
response = _context27.sent;
|
|
2632
2777
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
2633
2778
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
2634
|
-
return
|
|
2779
|
+
return _context27.abrupt("return", this.getPaymentMethods());
|
|
2635
2780
|
case 9:
|
|
2636
|
-
|
|
2637
|
-
|
|
2781
|
+
_context27.prev = 9;
|
|
2782
|
+
_context27.t0 = _context27["catch"](0);
|
|
2638
2783
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
2639
|
-
error:
|
|
2784
|
+
error: _context27.t0 instanceof Error ? _context27.t0.message : String(_context27.t0)
|
|
2640
2785
|
});
|
|
2641
|
-
return
|
|
2786
|
+
return _context27.abrupt("return", this.getPaymentMethods());
|
|
2642
2787
|
case 13:
|
|
2643
2788
|
case "end":
|
|
2644
|
-
return
|
|
2789
|
+
return _context27.stop();
|
|
2645
2790
|
}
|
|
2646
|
-
},
|
|
2791
|
+
}, _callee27, this, [[0, 9]]);
|
|
2647
2792
|
}));
|
|
2648
2793
|
function getPaymentMethodsAsync() {
|
|
2649
2794
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -2691,47 +2836,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2691
2836
|
}, {
|
|
2692
2837
|
key: "sendCustomerPayLink",
|
|
2693
2838
|
value: (function () {
|
|
2694
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2695
|
-
var orderIds,
|
|
2696
|
-
return _regeneratorRuntime().wrap(function
|
|
2697
|
-
while (1) switch (
|
|
2839
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2840
|
+
var orderIds, _ref22, _ref23, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
2841
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2842
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2698
2843
|
case 0:
|
|
2699
2844
|
if (this.store.order) {
|
|
2700
|
-
|
|
2845
|
+
_context28.next = 2;
|
|
2701
2846
|
break;
|
|
2702
2847
|
}
|
|
2703
2848
|
throw new Error('order 模块未初始化');
|
|
2704
2849
|
case 2:
|
|
2705
2850
|
orderIds = params.order_ids || params.orderIds || [];
|
|
2706
2851
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
2707
|
-
|
|
2852
|
+
_context28.next = 11;
|
|
2708
2853
|
break;
|
|
2709
2854
|
}
|
|
2710
|
-
|
|
2855
|
+
_context28.next = 6;
|
|
2711
2856
|
return this.submitSalesOrder({
|
|
2712
2857
|
smallTicketDataFlag: 1
|
|
2713
2858
|
});
|
|
2714
2859
|
case 6:
|
|
2715
|
-
submitResult =
|
|
2716
|
-
orderId = (
|
|
2860
|
+
submitResult = _context28.sent;
|
|
2861
|
+
orderId = (_ref22 = (_ref23 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref23 !== void 0 ? _ref23 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref22 !== void 0 ? _ref22 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
2717
2862
|
if (orderId) {
|
|
2718
|
-
|
|
2863
|
+
_context28.next = 10;
|
|
2719
2864
|
break;
|
|
2720
2865
|
}
|
|
2721
2866
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
2722
2867
|
case 10:
|
|
2723
2868
|
orderIds = [orderId];
|
|
2724
2869
|
case 11:
|
|
2725
|
-
return
|
|
2870
|
+
return _context28.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
2726
2871
|
emails: params.emails,
|
|
2727
2872
|
notify_action: params.notify_action,
|
|
2728
2873
|
order_ids: orderIds
|
|
2729
2874
|
}));
|
|
2730
2875
|
case 12:
|
|
2731
2876
|
case "end":
|
|
2732
|
-
return
|
|
2877
|
+
return _context28.stop();
|
|
2733
2878
|
}
|
|
2734
|
-
},
|
|
2879
|
+
}, _callee28, this);
|
|
2735
2880
|
}));
|
|
2736
2881
|
function sendCustomerPayLink(_x22) {
|
|
2737
2882
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
@@ -2746,27 +2891,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2746
2891
|
}, {
|
|
2747
2892
|
key: "calculateProductBookingPrice",
|
|
2748
2893
|
value: function () {
|
|
2749
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2894
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
2750
2895
|
var _params$customer_id;
|
|
2751
2896
|
var quotation, customerId, authoritativeProduct, product;
|
|
2752
|
-
return _regeneratorRuntime().wrap(function
|
|
2753
|
-
while (1) switch (
|
|
2897
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2898
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2754
2899
|
case 0:
|
|
2755
2900
|
quotation = this.store.quotation;
|
|
2756
2901
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
2757
|
-
|
|
2902
|
+
_context29.next = 4;
|
|
2758
2903
|
return this.loadProductForPriceQuery(params, customerId);
|
|
2759
2904
|
case 4:
|
|
2760
|
-
authoritativeProduct =
|
|
2905
|
+
authoritativeProduct = _context29.sent;
|
|
2761
2906
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
2762
|
-
|
|
2907
|
+
_context29.next = 8;
|
|
2763
2908
|
return this.loadQuotationForPriceQuery({
|
|
2764
2909
|
quotation: quotation,
|
|
2765
2910
|
customer_id: customerId,
|
|
2766
2911
|
channel: params.channel
|
|
2767
2912
|
});
|
|
2768
2913
|
case 8:
|
|
2769
|
-
return
|
|
2914
|
+
return _context29.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
2770
2915
|
product: product,
|
|
2771
2916
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
2772
2917
|
customer_id: customerId,
|
|
@@ -2774,9 +2919,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2774
2919
|
})));
|
|
2775
2920
|
case 9:
|
|
2776
2921
|
case "end":
|
|
2777
|
-
return
|
|
2922
|
+
return _context29.stop();
|
|
2778
2923
|
}
|
|
2779
|
-
},
|
|
2924
|
+
}, _callee29, this);
|
|
2780
2925
|
}));
|
|
2781
2926
|
function calculateProductBookingPrice(_x23) {
|
|
2782
2927
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
@@ -2786,7 +2931,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2786
2931
|
}, {
|
|
2787
2932
|
key: "getQuotationCustomerScopeInfo",
|
|
2788
2933
|
value: function getQuotationCustomerScopeInfo() {
|
|
2789
|
-
var
|
|
2934
|
+
var _this10 = this;
|
|
2790
2935
|
var quotation = this.store.quotation;
|
|
2791
2936
|
if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
|
|
2792
2937
|
return quotation.getQuotationCustomerScopeInfo();
|
|
@@ -2798,7 +2943,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2798
2943
|
}).map(function (item) {
|
|
2799
2944
|
var localSeen = new Set();
|
|
2800
2945
|
var customers = item.customer.filter(function (customer) {
|
|
2801
|
-
var customerId =
|
|
2946
|
+
var customerId = _this10.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
2802
2947
|
if (!customerId || localSeen.has(customerId)) return false;
|
|
2803
2948
|
localSeen.add(customerId);
|
|
2804
2949
|
if (!customerById.has(customerId)) customerById.set(customerId, customer);
|
|
@@ -2848,32 +2993,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2848
2993
|
}, {
|
|
2849
2994
|
key: "calculateProductBookingPrices",
|
|
2850
2995
|
value: function () {
|
|
2851
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2996
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(paramsList) {
|
|
2852
2997
|
var _paramsList$0$custome,
|
|
2853
2998
|
_paramsList$,
|
|
2854
|
-
|
|
2999
|
+
_this11 = this,
|
|
2855
3000
|
_paramsList$2;
|
|
2856
3001
|
var quotation, customerId, productMapsByGroup, groups;
|
|
2857
|
-
return _regeneratorRuntime().wrap(function
|
|
2858
|
-
while (1) switch (
|
|
3002
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3003
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2859
3004
|
case 0:
|
|
2860
3005
|
if (paramsList.length) {
|
|
2861
|
-
|
|
3006
|
+
_context31.next = 2;
|
|
2862
3007
|
break;
|
|
2863
3008
|
}
|
|
2864
|
-
return
|
|
3009
|
+
return _context31.abrupt("return", []);
|
|
2865
3010
|
case 2:
|
|
2866
3011
|
quotation = this.store.quotation;
|
|
2867
3012
|
customerId = (_paramsList$0$custome = (_paramsList$ = paramsList[0]) === null || _paramsList$ === void 0 ? void 0 : _paramsList$.customer_id) !== null && _paramsList$0$custome !== void 0 ? _paramsList$0$custome : this.getCurrentOrderCustomerId();
|
|
2868
3013
|
productMapsByGroup = new Map();
|
|
2869
3014
|
groups = new Map();
|
|
2870
3015
|
paramsList.forEach(function (params) {
|
|
2871
|
-
var
|
|
3016
|
+
var _this11$otherParams;
|
|
2872
3017
|
var product = params.product || {};
|
|
2873
|
-
var productId =
|
|
3018
|
+
var productId = _this11.getPriceQueryProductId(product);
|
|
2874
3019
|
if (productId === null) return;
|
|
2875
|
-
var schedule =
|
|
2876
|
-
var channel = params.channel || ((
|
|
3020
|
+
var schedule = _this11.getPriceQuerySchedule(params);
|
|
3021
|
+
var channel = params.channel || ((_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams.channel);
|
|
2877
3022
|
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
2878
3023
|
var group = groups.get(groupKey) || {
|
|
2879
3024
|
ids: new Set(),
|
|
@@ -2883,51 +3028,51 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2883
3028
|
group.ids.add(productId);
|
|
2884
3029
|
groups.set(groupKey, group);
|
|
2885
3030
|
});
|
|
2886
|
-
|
|
3031
|
+
_context31.next = 9;
|
|
2887
3032
|
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
2888
|
-
var
|
|
2889
|
-
var
|
|
2890
|
-
return _regeneratorRuntime().wrap(function
|
|
2891
|
-
while (1) switch (
|
|
3033
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(_ref24) {
|
|
3034
|
+
var _ref26, groupKey, group, productsById;
|
|
3035
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3036
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2892
3037
|
case 0:
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
return
|
|
3038
|
+
_ref26 = _slicedToArray(_ref24, 2), groupKey = _ref26[0], group = _ref26[1];
|
|
3039
|
+
_context30.next = 3;
|
|
3040
|
+
return _this11.loadProductsForPriceQuery({
|
|
2896
3041
|
ids: Array.from(group.ids),
|
|
2897
3042
|
schedule: group.schedule,
|
|
2898
3043
|
customerId: customerId,
|
|
2899
3044
|
channel: group.channel
|
|
2900
3045
|
});
|
|
2901
3046
|
case 3:
|
|
2902
|
-
productsById =
|
|
3047
|
+
productsById = _context30.sent;
|
|
2903
3048
|
productMapsByGroup.set(groupKey, productsById);
|
|
2904
3049
|
case 5:
|
|
2905
3050
|
case "end":
|
|
2906
|
-
return
|
|
3051
|
+
return _context30.stop();
|
|
2907
3052
|
}
|
|
2908
|
-
},
|
|
3053
|
+
}, _callee30);
|
|
2909
3054
|
}));
|
|
2910
3055
|
return function (_x25) {
|
|
2911
|
-
return
|
|
3056
|
+
return _ref25.apply(this, arguments);
|
|
2912
3057
|
};
|
|
2913
3058
|
}()));
|
|
2914
3059
|
case 9:
|
|
2915
|
-
|
|
3060
|
+
_context31.next = 11;
|
|
2916
3061
|
return this.loadQuotationForPriceQuery({
|
|
2917
3062
|
quotation: quotation,
|
|
2918
3063
|
customer_id: customerId,
|
|
2919
3064
|
channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
|
|
2920
3065
|
});
|
|
2921
3066
|
case 11:
|
|
2922
|
-
return
|
|
2923
|
-
var
|
|
3067
|
+
return _context31.abrupt("return", paramsList.map(function (params) {
|
|
3068
|
+
var _this11$otherParams2, _productMapsByGroup$g;
|
|
2924
3069
|
var productInput = params.product || {};
|
|
2925
|
-
var productId =
|
|
2926
|
-
var schedule =
|
|
2927
|
-
var channel = params.channel || ((
|
|
3070
|
+
var productId = _this11.getPriceQueryProductId(productInput);
|
|
3071
|
+
var schedule = _this11.getPriceQuerySchedule(params);
|
|
3072
|
+
var channel = params.channel || ((_this11$otherParams2 = _this11.otherParams) === null || _this11$otherParams2 === void 0 ? void 0 : _this11$otherParams2.channel);
|
|
2928
3073
|
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
2929
3074
|
var authoritativeProduct = productId === null ? null : ((_productMapsByGroup$g = productMapsByGroup.get(groupKey)) === null || _productMapsByGroup$g === void 0 ? void 0 : _productMapsByGroup$g.get(productId)) || null;
|
|
2930
|
-
var product =
|
|
3075
|
+
var product = _this11.mergeProductForPriceQuery(productInput, authoritativeProduct);
|
|
2931
3076
|
return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
2932
3077
|
product: product,
|
|
2933
3078
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
@@ -2937,9 +3082,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2937
3082
|
}));
|
|
2938
3083
|
case 12:
|
|
2939
3084
|
case "end":
|
|
2940
|
-
return
|
|
3085
|
+
return _context31.stop();
|
|
2941
3086
|
}
|
|
2942
|
-
},
|
|
3087
|
+
}, _callee31, this);
|
|
2943
3088
|
}));
|
|
2944
3089
|
function calculateProductBookingPrices(_x24) {
|
|
2945
3090
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
@@ -2949,42 +3094,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2949
3094
|
}, {
|
|
2950
3095
|
key: "addProductToOrder",
|
|
2951
3096
|
value: function () {
|
|
2952
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2953
|
-
var products;
|
|
2954
|
-
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2955
|
-
while (1) switch (_context31.prev = _context31.next) {
|
|
2956
|
-
case 0:
|
|
2957
|
-
_context31.prev = 0;
|
|
2958
|
-
if (this.store.order) {
|
|
2959
|
-
_context31.next = 3;
|
|
2960
|
-
break;
|
|
2961
|
-
}
|
|
2962
|
-
throw new Error('order 模块未初始化');
|
|
2963
|
-
case 3:
|
|
2964
|
-
_context31.next = 5;
|
|
2965
|
-
return this.store.order.addProductToOrder(product, booking);
|
|
2966
|
-
case 5:
|
|
2967
|
-
products = _context31.sent;
|
|
2968
|
-
return _context31.abrupt("return", products);
|
|
2969
|
-
case 9:
|
|
2970
|
-
_context31.prev = 9;
|
|
2971
|
-
_context31.t0 = _context31["catch"](0);
|
|
2972
|
-
throw _context31.t0;
|
|
2973
|
-
case 12:
|
|
2974
|
-
case "end":
|
|
2975
|
-
return _context31.stop();
|
|
2976
|
-
}
|
|
2977
|
-
}, _callee31, this, [[0, 9]]);
|
|
2978
|
-
}));
|
|
2979
|
-
function addProductToOrder(_x26, _x27) {
|
|
2980
|
-
return _addProductToOrder.apply(this, arguments);
|
|
2981
|
-
}
|
|
2982
|
-
return addProductToOrder;
|
|
2983
|
-
}()
|
|
2984
|
-
}, {
|
|
2985
|
-
key: "updateOrderProduct",
|
|
2986
|
-
value: function () {
|
|
2987
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3097
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(product, booking) {
|
|
2988
3098
|
var products;
|
|
2989
3099
|
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2990
3100
|
while (1) switch (_context32.prev = _context32.next) {
|
|
@@ -2997,7 +3107,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2997
3107
|
throw new Error('order 模块未初始化');
|
|
2998
3108
|
case 3:
|
|
2999
3109
|
_context32.next = 5;
|
|
3000
|
-
return this.store.order.
|
|
3110
|
+
return this.store.order.addProductToOrder(product, booking);
|
|
3001
3111
|
case 5:
|
|
3002
3112
|
products = _context32.sent;
|
|
3003
3113
|
return _context32.abrupt("return", products);
|
|
@@ -3011,15 +3121,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3011
3121
|
}
|
|
3012
3122
|
}, _callee32, this, [[0, 9]]);
|
|
3013
3123
|
}));
|
|
3014
|
-
function
|
|
3015
|
-
return
|
|
3124
|
+
function addProductToOrder(_x26, _x27) {
|
|
3125
|
+
return _addProductToOrder.apply(this, arguments);
|
|
3016
3126
|
}
|
|
3017
|
-
return
|
|
3127
|
+
return addProductToOrder;
|
|
3018
3128
|
}()
|
|
3019
3129
|
}, {
|
|
3020
|
-
key: "
|
|
3130
|
+
key: "updateOrderProduct",
|
|
3021
3131
|
value: function () {
|
|
3022
|
-
var
|
|
3132
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
3023
3133
|
var products;
|
|
3024
3134
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3025
3135
|
while (1) switch (_context33.prev = _context33.next) {
|
|
@@ -3032,7 +3142,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3032
3142
|
throw new Error('order 模块未初始化');
|
|
3033
3143
|
case 3:
|
|
3034
3144
|
_context33.next = 5;
|
|
3035
|
-
return this.store.order.
|
|
3145
|
+
return this.store.order.updateOrderProduct(params);
|
|
3036
3146
|
case 5:
|
|
3037
3147
|
products = _context33.sent;
|
|
3038
3148
|
return _context33.abrupt("return", products);
|
|
@@ -3046,15 +3156,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3046
3156
|
}
|
|
3047
3157
|
}, _callee33, this, [[0, 9]]);
|
|
3048
3158
|
}));
|
|
3049
|
-
function
|
|
3050
|
-
return
|
|
3159
|
+
function updateOrderProduct(_x28) {
|
|
3160
|
+
return _updateOrderProduct.apply(this, arguments);
|
|
3051
3161
|
}
|
|
3052
|
-
return
|
|
3162
|
+
return updateOrderProduct;
|
|
3053
3163
|
}()
|
|
3054
3164
|
}, {
|
|
3055
|
-
key: "
|
|
3165
|
+
key: "updateOrderProducts",
|
|
3056
3166
|
value: function () {
|
|
3057
|
-
var
|
|
3167
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(paramsList) {
|
|
3058
3168
|
var products;
|
|
3059
3169
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3060
3170
|
while (1) switch (_context34.prev = _context34.next) {
|
|
@@ -3067,7 +3177,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3067
3177
|
throw new Error('order 模块未初始化');
|
|
3068
3178
|
case 3:
|
|
3069
3179
|
_context34.next = 5;
|
|
3070
|
-
return this.store.order.
|
|
3180
|
+
return this.store.order.updateOrderProducts(paramsList);
|
|
3071
3181
|
case 5:
|
|
3072
3182
|
products = _context34.sent;
|
|
3073
3183
|
return _context34.abrupt("return", products);
|
|
@@ -3081,6 +3191,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3081
3191
|
}
|
|
3082
3192
|
}, _callee34, this, [[0, 9]]);
|
|
3083
3193
|
}));
|
|
3194
|
+
function updateOrderProducts(_x29) {
|
|
3195
|
+
return _updateOrderProducts.apply(this, arguments);
|
|
3196
|
+
}
|
|
3197
|
+
return updateOrderProducts;
|
|
3198
|
+
}()
|
|
3199
|
+
}, {
|
|
3200
|
+
key: "updateOrderProductQuantity",
|
|
3201
|
+
value: function () {
|
|
3202
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
3203
|
+
var products;
|
|
3204
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3205
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3206
|
+
case 0:
|
|
3207
|
+
_context35.prev = 0;
|
|
3208
|
+
if (this.store.order) {
|
|
3209
|
+
_context35.next = 3;
|
|
3210
|
+
break;
|
|
3211
|
+
}
|
|
3212
|
+
throw new Error('order 模块未初始化');
|
|
3213
|
+
case 3:
|
|
3214
|
+
_context35.next = 5;
|
|
3215
|
+
return this.store.order.updateOrderProductQuantity(params);
|
|
3216
|
+
case 5:
|
|
3217
|
+
products = _context35.sent;
|
|
3218
|
+
return _context35.abrupt("return", products);
|
|
3219
|
+
case 9:
|
|
3220
|
+
_context35.prev = 9;
|
|
3221
|
+
_context35.t0 = _context35["catch"](0);
|
|
3222
|
+
throw _context35.t0;
|
|
3223
|
+
case 12:
|
|
3224
|
+
case "end":
|
|
3225
|
+
return _context35.stop();
|
|
3226
|
+
}
|
|
3227
|
+
}, _callee35, this, [[0, 9]]);
|
|
3228
|
+
}));
|
|
3084
3229
|
function updateOrderProductQuantity(_x30) {
|
|
3085
3230
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
3086
3231
|
}
|
|
@@ -3104,12 +3249,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3104
3249
|
}, {
|
|
3105
3250
|
key: "setOrderProductLineNote",
|
|
3106
3251
|
value: (function () {
|
|
3107
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3252
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(identity, note) {
|
|
3108
3253
|
var params, products;
|
|
3109
|
-
return _regeneratorRuntime().wrap(function
|
|
3110
|
-
while (1) switch (
|
|
3254
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3255
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3111
3256
|
case 0:
|
|
3112
|
-
|
|
3257
|
+
_context36.prev = 0;
|
|
3113
3258
|
params = {
|
|
3114
3259
|
product_id: identity.product_id,
|
|
3115
3260
|
product_variant_id: identity.product_variant_id,
|
|
@@ -3124,20 +3269,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3124
3269
|
params.product_sku = identity.product_sku;
|
|
3125
3270
|
}
|
|
3126
3271
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
3127
|
-
|
|
3272
|
+
_context36.next = 7;
|
|
3128
3273
|
return this.updateOrderProduct(params);
|
|
3129
3274
|
case 7:
|
|
3130
|
-
products =
|
|
3131
|
-
return
|
|
3275
|
+
products = _context36.sent;
|
|
3276
|
+
return _context36.abrupt("return", products);
|
|
3132
3277
|
case 11:
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
throw
|
|
3278
|
+
_context36.prev = 11;
|
|
3279
|
+
_context36.t0 = _context36["catch"](0);
|
|
3280
|
+
throw _context36.t0;
|
|
3136
3281
|
case 14:
|
|
3137
3282
|
case "end":
|
|
3138
|
-
return
|
|
3283
|
+
return _context36.stop();
|
|
3139
3284
|
}
|
|
3140
|
-
},
|
|
3285
|
+
}, _callee36, this, [[0, 11]]);
|
|
3141
3286
|
}));
|
|
3142
3287
|
function setOrderProductLineNote(_x31, _x32) {
|
|
3143
3288
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
@@ -3154,30 +3299,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3154
3299
|
}, {
|
|
3155
3300
|
key: "removeProductsFromOrder",
|
|
3156
3301
|
value: (function () {
|
|
3157
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3158
|
-
return _regeneratorRuntime().wrap(function
|
|
3159
|
-
while (1) switch (
|
|
3302
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(identities) {
|
|
3303
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3304
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3160
3305
|
case 0:
|
|
3161
|
-
|
|
3306
|
+
_context37.prev = 0;
|
|
3162
3307
|
if (this.store.order) {
|
|
3163
|
-
|
|
3308
|
+
_context37.next = 3;
|
|
3164
3309
|
break;
|
|
3165
3310
|
}
|
|
3166
3311
|
throw new Error('order 模块未初始化');
|
|
3167
3312
|
case 3:
|
|
3168
|
-
|
|
3313
|
+
_context37.next = 5;
|
|
3169
3314
|
return this.store.order.removeProductsFromOrder(identities);
|
|
3170
3315
|
case 5:
|
|
3171
|
-
return
|
|
3316
|
+
return _context37.abrupt("return", _context37.sent);
|
|
3172
3317
|
case 8:
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
throw
|
|
3318
|
+
_context37.prev = 8;
|
|
3319
|
+
_context37.t0 = _context37["catch"](0);
|
|
3320
|
+
throw _context37.t0;
|
|
3176
3321
|
case 11:
|
|
3177
3322
|
case "end":
|
|
3178
|
-
return
|
|
3323
|
+
return _context37.stop();
|
|
3179
3324
|
}
|
|
3180
|
-
},
|
|
3325
|
+
}, _callee37, this, [[0, 8]]);
|
|
3181
3326
|
}));
|
|
3182
3327
|
function removeProductsFromOrder(_x33) {
|
|
3183
3328
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
@@ -3187,16 +3332,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3187
3332
|
}, {
|
|
3188
3333
|
key: "removeProductFromOrder",
|
|
3189
3334
|
value: function () {
|
|
3190
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3191
|
-
return _regeneratorRuntime().wrap(function
|
|
3192
|
-
while (1) switch (
|
|
3335
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(identity) {
|
|
3336
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3337
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3193
3338
|
case 0:
|
|
3194
|
-
return
|
|
3339
|
+
return _context38.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
3195
3340
|
case 1:
|
|
3196
3341
|
case "end":
|
|
3197
|
-
return
|
|
3342
|
+
return _context38.stop();
|
|
3198
3343
|
}
|
|
3199
|
-
},
|
|
3344
|
+
}, _callee38, this);
|
|
3200
3345
|
}));
|
|
3201
3346
|
function removeProductFromOrder(_x34) {
|
|
3202
3347
|
return _removeProductFromOrder.apply(this, arguments);
|
|
@@ -3248,23 +3393,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3248
3393
|
}, {
|
|
3249
3394
|
key: "applyPromotion",
|
|
3250
3395
|
value: (function () {
|
|
3251
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3252
|
-
return _regeneratorRuntime().wrap(function
|
|
3253
|
-
while (1) switch (
|
|
3396
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3397
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3398
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3254
3399
|
case 0:
|
|
3255
3400
|
if (this.store.order) {
|
|
3256
|
-
|
|
3401
|
+
_context39.next = 2;
|
|
3257
3402
|
break;
|
|
3258
3403
|
}
|
|
3259
3404
|
throw new Error('order 模块未初始化');
|
|
3260
3405
|
case 2:
|
|
3261
|
-
|
|
3406
|
+
_context39.next = 4;
|
|
3262
3407
|
return this.store.order.applyPromotion();
|
|
3263
3408
|
case 4:
|
|
3264
3409
|
case "end":
|
|
3265
|
-
return
|
|
3410
|
+
return _context39.stop();
|
|
3266
3411
|
}
|
|
3267
|
-
},
|
|
3412
|
+
}, _callee39, this);
|
|
3268
3413
|
}));
|
|
3269
3414
|
function applyPromotion() {
|
|
3270
3415
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -3291,18 +3436,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3291
3436
|
}, {
|
|
3292
3437
|
key: "getProductList",
|
|
3293
3438
|
value: function () {
|
|
3294
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3439
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3295
3440
|
var _this$otherParams21;
|
|
3296
3441
|
var menu_list_ids, _this$store$products, res;
|
|
3297
|
-
return _regeneratorRuntime().wrap(function
|
|
3298
|
-
while (1) switch (
|
|
3442
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3443
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3299
3444
|
case 0:
|
|
3300
3445
|
// 可以直接通过配置里的 menu 读取
|
|
3301
3446
|
menu_list_ids = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 || (_this$otherParams21 = _this$otherParams21.dineInConfig) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21['menu.associated_menus'].map(function (n) {
|
|
3302
3447
|
return Number(n.value);
|
|
3303
3448
|
})) || [];
|
|
3304
|
-
|
|
3305
|
-
|
|
3449
|
+
_context40.prev = 1;
|
|
3450
|
+
_context40.next = 4;
|
|
3306
3451
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
3307
3452
|
menu_list_ids: menu_list_ids,
|
|
3308
3453
|
cacheId: this.cacheId,
|
|
@@ -3310,17 +3455,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3310
3455
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
3311
3456
|
});
|
|
3312
3457
|
case 4:
|
|
3313
|
-
res =
|
|
3314
|
-
return
|
|
3458
|
+
res = _context40.sent;
|
|
3459
|
+
return _context40.abrupt("return", res);
|
|
3315
3460
|
case 8:
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
throw
|
|
3461
|
+
_context40.prev = 8;
|
|
3462
|
+
_context40.t0 = _context40["catch"](1);
|
|
3463
|
+
throw _context40.t0;
|
|
3319
3464
|
case 11:
|
|
3320
3465
|
case "end":
|
|
3321
|
-
return
|
|
3466
|
+
return _context40.stop();
|
|
3322
3467
|
}
|
|
3323
|
-
},
|
|
3468
|
+
}, _callee40, this, [[1, 8]]);
|
|
3324
3469
|
}));
|
|
3325
3470
|
function getProductList() {
|
|
3326
3471
|
return _getProductList.apply(this, arguments);
|
|
@@ -3335,31 +3480,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3335
3480
|
}, {
|
|
3336
3481
|
key: "setOtherParams",
|
|
3337
3482
|
value: function () {
|
|
3338
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3483
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
3339
3484
|
var _this$otherParams22;
|
|
3340
|
-
var
|
|
3341
|
-
|
|
3485
|
+
var _ref27,
|
|
3486
|
+
_ref27$cover,
|
|
3342
3487
|
cover,
|
|
3343
|
-
|
|
3344
|
-
return _regeneratorRuntime().wrap(function
|
|
3345
|
-
while (1) switch (
|
|
3488
|
+
_args41 = arguments;
|
|
3489
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3490
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3346
3491
|
case 0:
|
|
3347
|
-
|
|
3492
|
+
_ref27 = _args41.length > 1 && _args41[1] !== undefined ? _args41[1] : {}, _ref27$cover = _ref27.cover, cover = _ref27$cover === void 0 ? false : _ref27$cover;
|
|
3348
3493
|
if (cover) {
|
|
3349
3494
|
this.otherParams = _objectSpread({}, params);
|
|
3350
3495
|
} else {
|
|
3351
3496
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3352
3497
|
}
|
|
3353
3498
|
this.cacheId = (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.cacheId;
|
|
3354
|
-
|
|
3499
|
+
_context41.next = 5;
|
|
3355
3500
|
return this.syncOtherParamsToSubModules(params, {
|
|
3356
3501
|
cover: cover
|
|
3357
3502
|
});
|
|
3358
3503
|
case 5:
|
|
3359
3504
|
case "end":
|
|
3360
|
-
return
|
|
3505
|
+
return _context41.stop();
|
|
3361
3506
|
}
|
|
3362
|
-
},
|
|
3507
|
+
}, _callee41, this);
|
|
3363
3508
|
}));
|
|
3364
3509
|
function setOtherParams(_x35) {
|
|
3365
3510
|
return _setOtherParams.apply(this, arguments);
|