@pisell/pisellos 2.3.7 → 2.3.8
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 +18 -2
- package/dist/modules/Order/index.js +252 -115
- 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 +8 -1
- package/dist/solution/BaseSales/index.js +86 -52
- 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 +18 -2
- package/lib/modules/Order/index.js +179 -27
- 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 +8 -1
- package/lib/solution/BaseSales/index.js +38 -9
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -168,9 +168,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
168
168
|
}, {
|
|
169
169
|
key: "getReusableSharedSubModule",
|
|
170
170
|
value: function getReusableSharedSubModule(moduleName) {
|
|
171
|
-
var _this$core;
|
|
171
|
+
var _this$core, _this$core$getModule;
|
|
172
172
|
if (moduleName !== 'schedule' && moduleName !== 'quotation') return null;
|
|
173
|
-
return ((_this$core = this.core) === null || _this$core === void 0 ? void 0 : _this$core.
|
|
173
|
+
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
174
|
}
|
|
175
175
|
}, {
|
|
176
176
|
key: "isScheduleListLoaded",
|
|
@@ -1838,7 +1838,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1838
1838
|
key: "setDiscountSelected",
|
|
1839
1839
|
value: function () {
|
|
1840
1840
|
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;
|
|
1841
|
+
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
1842
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1843
1843
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1844
1844
|
case 0:
|
|
@@ -1902,6 +1902,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1902
1902
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
1903
1903
|
d.isSelected = false;
|
|
1904
1904
|
d.isManualSelect = true;
|
|
1905
|
+
d.appliedProductDetails = [];
|
|
1905
1906
|
}
|
|
1906
1907
|
}
|
|
1907
1908
|
} catch (err) {
|
|
@@ -1917,28 +1918,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1917
1918
|
}).map(function (d) {
|
|
1918
1919
|
return d.id;
|
|
1919
1920
|
}));
|
|
1921
|
+
filterSelectedDiscountDetails = function filterSelectedDiscountDetails(discountList) {
|
|
1922
|
+
return (discountList || []).filter(function (pd) {
|
|
1923
|
+
var _pd$discount$resource, _pd$discount;
|
|
1924
|
+
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;
|
|
1925
|
+
return rid != null && selectedResourceIds.has(rid);
|
|
1926
|
+
});
|
|
1927
|
+
};
|
|
1920
1928
|
_iterator3 = _createForOfIteratorHelper(tempOrder.products);
|
|
1921
|
-
_context18.prev =
|
|
1929
|
+
_context18.prev = 18;
|
|
1922
1930
|
_iterator3.s();
|
|
1923
|
-
case
|
|
1931
|
+
case 20:
|
|
1924
1932
|
if ((_step3 = _iterator3.n()).done) {
|
|
1925
|
-
_context18.next =
|
|
1933
|
+
_context18.next = 37;
|
|
1926
1934
|
break;
|
|
1927
1935
|
}
|
|
1928
1936
|
product = _step3.value;
|
|
1929
1937
|
productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
|
|
1930
1938
|
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
1939
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
1932
|
-
_context18.next =
|
|
1940
|
+
_context18.next = 26;
|
|
1933
1941
|
break;
|
|
1934
1942
|
}
|
|
1935
|
-
return _context18.abrupt("continue",
|
|
1936
|
-
case
|
|
1937
|
-
product.discount_list = (product.discount_list
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1943
|
+
return _context18.abrupt("continue", 35);
|
|
1944
|
+
case 26:
|
|
1945
|
+
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
1946
|
+
if (Array.isArray(product.product_bundle)) {
|
|
1947
|
+
product.product_bundle = product.product_bundle.map(function (bundle) {
|
|
1948
|
+
var _ref18, _bundle$original_pric;
|
|
1949
|
+
var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
|
|
1950
|
+
var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
|
|
1951
|
+
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;
|
|
1952
|
+
return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
|
|
1953
|
+
price: restoredBundlePrice,
|
|
1954
|
+
bundle_selling_price: restoredBundlePrice
|
|
1955
|
+
} : {}), {}, {
|
|
1956
|
+
discount_list: nextBundleDiscountList
|
|
1957
|
+
});
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1942
1960
|
|
|
1943
1961
|
// 券作用于 source(不含 option、不含 bundle);算出新 source 折后价后补回 options
|
|
1944
1962
|
// 写入含 option 的 main_product_selling_price,再合成 composite 回写 selling_price。
|
|
@@ -1957,33 +1975,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1957
1975
|
mainPrice: newMainSellingPrice,
|
|
1958
1976
|
bundle: product.product_bundle
|
|
1959
1977
|
});
|
|
1960
|
-
case 33:
|
|
1961
|
-
_context18.next = 19;
|
|
1962
|
-
break;
|
|
1963
1978
|
case 35:
|
|
1964
|
-
_context18.next =
|
|
1979
|
+
_context18.next = 20;
|
|
1965
1980
|
break;
|
|
1966
1981
|
case 37:
|
|
1967
|
-
_context18.
|
|
1968
|
-
|
|
1982
|
+
_context18.next = 42;
|
|
1983
|
+
break;
|
|
1984
|
+
case 39:
|
|
1985
|
+
_context18.prev = 39;
|
|
1986
|
+
_context18.t0 = _context18["catch"](18);
|
|
1969
1987
|
_iterator3.e(_context18.t0);
|
|
1970
|
-
case
|
|
1971
|
-
_context18.prev =
|
|
1988
|
+
case 42:
|
|
1989
|
+
_context18.prev = 42;
|
|
1972
1990
|
_iterator3.f();
|
|
1973
|
-
return _context18.finish(
|
|
1974
|
-
case
|
|
1991
|
+
return _context18.finish(42);
|
|
1992
|
+
case 45:
|
|
1975
1993
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1976
|
-
_context18.next =
|
|
1994
|
+
_context18.next = 48;
|
|
1977
1995
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1978
|
-
case
|
|
1996
|
+
case 48:
|
|
1979
1997
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1980
1998
|
return d.isSelected;
|
|
1981
1999
|
});
|
|
1982
|
-
_context18.next =
|
|
2000
|
+
_context18.next = 51;
|
|
1983
2001
|
return this.store.order.recalculateSummary({
|
|
1984
2002
|
createIfMissing: true
|
|
1985
2003
|
});
|
|
1986
|
-
case
|
|
2004
|
+
case 51:
|
|
1987
2005
|
this.store.order.persistTempOrder();
|
|
1988
2006
|
this.effectsEmit('onDiscountApplied', {
|
|
1989
2007
|
productList: tempOrder.products,
|
|
@@ -1991,17 +2009,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1991
2009
|
selectedDiscountList: tempOrder.discount_list,
|
|
1992
2010
|
tempOrder: tempOrder
|
|
1993
2011
|
});
|
|
1994
|
-
_context18.next =
|
|
2012
|
+
_context18.next = 58;
|
|
1995
2013
|
break;
|
|
1996
|
-
case
|
|
1997
|
-
_context18.prev =
|
|
2014
|
+
case 55:
|
|
2015
|
+
_context18.prev = 55;
|
|
1998
2016
|
_context18.t1 = _context18["catch"](0);
|
|
1999
2017
|
throw _context18.t1;
|
|
2000
|
-
case
|
|
2018
|
+
case 58:
|
|
2001
2019
|
case "end":
|
|
2002
2020
|
return _context18.stop();
|
|
2003
2021
|
}
|
|
2004
|
-
}, _callee18, this, [[0,
|
|
2022
|
+
}, _callee18, this, [[0, 55], [18, 39, 42, 45]]);
|
|
2005
2023
|
}));
|
|
2006
2024
|
function setDiscountSelected(_x14) {
|
|
2007
2025
|
return _setDiscountSelected.apply(this, arguments);
|
|
@@ -2112,7 +2130,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2112
2130
|
case 2:
|
|
2113
2131
|
// this.store.order.persistTempOrder();
|
|
2114
2132
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
2115
|
-
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2133
|
+
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2116
2134
|
cacheId: this.cacheId,
|
|
2117
2135
|
platform: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform,
|
|
2118
2136
|
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 +2143,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2125
2143
|
paymentStatus: inferredPaymentStatus
|
|
2126
2144
|
} : {}), (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined ? {
|
|
2127
2145
|
smallTicketDataFlag: params.smallTicketDataFlag
|
|
2146
|
+
} : {}), (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
2147
|
+
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
2128
2148
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2129
2149
|
enhancePayload: params.enhancePayload
|
|
2130
2150
|
} : {});
|
|
@@ -2156,7 +2176,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2156
2176
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
2157
2177
|
case 2:
|
|
2158
2178
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
2159
|
-
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2179
|
+
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2160
2180
|
cacheId: this.cacheId,
|
|
2161
2181
|
platform: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform,
|
|
2162
2182
|
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 +2188,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2168
2188
|
paymentStatus: inferredPaymentStatus
|
|
2169
2189
|
} : {}), (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined ? {
|
|
2170
2190
|
smallTicketDataFlag: params.smallTicketDataFlag
|
|
2191
|
+
} : {}), (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
2192
|
+
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
2171
2193
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2172
2194
|
enhancePayload: params.enhancePayload
|
|
2173
2195
|
} : {});
|
|
@@ -2267,7 +2289,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2267
2289
|
key: "syncPaymentsToOrder",
|
|
2268
2290
|
value: function () {
|
|
2269
2291
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
2270
|
-
var
|
|
2292
|
+
var _ref19, _params$businessCode, _this$otherParams18, _this$otherParams19, _params$channel;
|
|
2271
2293
|
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
2272
2294
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2273
2295
|
while (1) switch (_context24.prev = _context24.next) {
|
|
@@ -2278,7 +2300,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2278
2300
|
}
|
|
2279
2301
|
throw new Error('order 模块未初始化');
|
|
2280
2302
|
case 2:
|
|
2281
|
-
businessCode = (
|
|
2303
|
+
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
2304
|
channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
|
|
2283
2305
|
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
|
|
2284
2306
|
businessCode: businessCode
|
|
@@ -2382,7 +2404,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2382
2404
|
var _this$otherParams20,
|
|
2383
2405
|
_paymentRecord$paymen,
|
|
2384
2406
|
_paymentRecord$create,
|
|
2385
|
-
|
|
2407
|
+
_ref20,
|
|
2386
2408
|
_paymentRecord$origin,
|
|
2387
2409
|
_this8 = this;
|
|
2388
2410
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
@@ -2406,7 +2428,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2406
2428
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
2407
2429
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
2408
2430
|
var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
|
|
2409
|
-
var calculatedServiceFee = serviceCharge ? new Decimal((
|
|
2431
|
+
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
2432
|
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, paymentRecord), calculatedServiceFee !== undefined ? {
|
|
2411
2433
|
service_fee: calculatedServiceFee
|
|
2412
2434
|
} : {}), {}, {
|
|
@@ -2452,9 +2474,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2452
2474
|
/** 覆盖 wallet pass 支付项,同时保留普通支付项。 */
|
|
2453
2475
|
}, {
|
|
2454
2476
|
key: "updateVoucherOrderPayments",
|
|
2455
|
-
value: function updateVoucherOrderPayments(payments) {
|
|
2477
|
+
value: function updateVoucherOrderPayments(payments, options) {
|
|
2478
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2479
|
+
return this.store.order.updateVoucherOrderPayments(payments, options);
|
|
2480
|
+
}
|
|
2481
|
+
}, {
|
|
2482
|
+
key: "confirmPendingVoucherPayments",
|
|
2483
|
+
value: function confirmPendingVoucherPayments() {
|
|
2484
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2485
|
+
return this.store.order.confirmPendingVoucherPayments();
|
|
2486
|
+
}
|
|
2487
|
+
}, {
|
|
2488
|
+
key: "discardPendingVoucherPayments",
|
|
2489
|
+
value: function discardPendingVoucherPayments() {
|
|
2456
2490
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2457
|
-
return this.store.order.
|
|
2491
|
+
return this.store.order.discardPendingVoucherPayments();
|
|
2458
2492
|
}
|
|
2459
2493
|
}, {
|
|
2460
2494
|
key: "getWalletProductList",
|
|
@@ -2518,7 +2552,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2518
2552
|
key: "initWalletData",
|
|
2519
2553
|
value: function () {
|
|
2520
2554
|
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
2521
|
-
var _params$order_wait_pa,
|
|
2555
|
+
var _params$order_wait_pa, _ref21, _tempOrder$is_price_i;
|
|
2522
2556
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
2523
2557
|
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2524
2558
|
while (1) switch (_context25.prev = _context25.next) {
|
|
@@ -2561,7 +2595,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2561
2595
|
},
|
|
2562
2596
|
products: this.getWalletProductList(),
|
|
2563
2597
|
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: (
|
|
2598
|
+
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
2599
|
}, snapshot.identity.orderId ? {
|
|
2566
2600
|
payment_order_id: String(snapshot.identity.orderId)
|
|
2567
2601
|
} : {});
|
|
@@ -2692,7 +2726,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2692
2726
|
key: "sendCustomerPayLink",
|
|
2693
2727
|
value: (function () {
|
|
2694
2728
|
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2695
|
-
var orderIds,
|
|
2729
|
+
var orderIds, _ref22, _ref23, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
2696
2730
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2697
2731
|
while (1) switch (_context27.prev = _context27.next) {
|
|
2698
2732
|
case 0:
|
|
@@ -2713,7 +2747,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2713
2747
|
});
|
|
2714
2748
|
case 6:
|
|
2715
2749
|
submitResult = _context27.sent;
|
|
2716
|
-
orderId = (
|
|
2750
|
+
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
2751
|
if (orderId) {
|
|
2718
2752
|
_context27.next = 10;
|
|
2719
2753
|
break;
|
|
@@ -2885,12 +2919,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2885
2919
|
});
|
|
2886
2920
|
_context30.next = 9;
|
|
2887
2921
|
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
2888
|
-
var
|
|
2889
|
-
var
|
|
2922
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(_ref24) {
|
|
2923
|
+
var _ref26, groupKey, group, productsById;
|
|
2890
2924
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2891
2925
|
while (1) switch (_context29.prev = _context29.next) {
|
|
2892
2926
|
case 0:
|
|
2893
|
-
|
|
2927
|
+
_ref26 = _slicedToArray(_ref24, 2), groupKey = _ref26[0], group = _ref26[1];
|
|
2894
2928
|
_context29.next = 3;
|
|
2895
2929
|
return _this10.loadProductsForPriceQuery({
|
|
2896
2930
|
ids: Array.from(group.ids),
|
|
@@ -2908,7 +2942,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2908
2942
|
}, _callee29);
|
|
2909
2943
|
}));
|
|
2910
2944
|
return function (_x25) {
|
|
2911
|
-
return
|
|
2945
|
+
return _ref25.apply(this, arguments);
|
|
2912
2946
|
};
|
|
2913
2947
|
}()));
|
|
2914
2948
|
case 9:
|
|
@@ -3337,14 +3371,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3337
3371
|
value: function () {
|
|
3338
3372
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
|
|
3339
3373
|
var _this$otherParams22;
|
|
3340
|
-
var
|
|
3341
|
-
|
|
3374
|
+
var _ref27,
|
|
3375
|
+
_ref27$cover,
|
|
3342
3376
|
cover,
|
|
3343
3377
|
_args40 = arguments;
|
|
3344
3378
|
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3345
3379
|
while (1) switch (_context40.prev = _context40.next) {
|
|
3346
3380
|
case 0:
|
|
3347
|
-
|
|
3381
|
+
_ref27 = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {}, _ref27$cover = _ref27.cover, cover = _ref27$cover === void 0 ? false : _ref27$cover;
|
|
3348
3382
|
if (cover) {
|
|
3349
3383
|
this.otherParams = _objectSpread({}, params);
|
|
3350
3384
|
} else {
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 1 | 2 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
+
var promotion_exports = {};
|
|
31
|
+
__export(promotion_exports, {
|
|
32
|
+
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
+
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
+
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
+
default: () => import_adapter2.default
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
+
var import_evaluator = require("./evaluator");
|
|
40
|
+
var import_adapter = require("./adapter");
|
|
41
|
+
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
+
var import_examples = require("./examples");
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
+
PromotionAdapter,
|
|
47
|
+
PromotionEvaluator,
|
|
48
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
+
});
|
|
@@ -312,13 +312,27 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
312
312
|
updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>): OrderPaymentData[];
|
|
313
313
|
/** 从当前订单支付项中移除指定支付项。 */
|
|
314
314
|
deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
|
|
315
|
+
private confirmPendingVoucherPaymentsInList;
|
|
316
|
+
private discardPendingVoucherPaymentsFromList;
|
|
317
|
+
private prepareVoucherPaymentsForSubmit;
|
|
318
|
+
private applyPaymentLifecycleChange;
|
|
319
|
+
confirmPendingVoucherPayments(options?: {
|
|
320
|
+
persist?: boolean;
|
|
321
|
+
recalculateSummary?: boolean;
|
|
322
|
+
}): OrderPaymentData[];
|
|
323
|
+
discardPendingVoucherPayments(options?: {
|
|
324
|
+
persist?: boolean;
|
|
325
|
+
recalculateSummary?: boolean;
|
|
326
|
+
}): OrderPaymentData[];
|
|
315
327
|
/**
|
|
316
328
|
* 覆盖当前订单中的 wallet pass 支付项。
|
|
317
329
|
*
|
|
318
330
|
* 判断口径与 PaymentModal 保持一致:voucher_id 存在且不为 0 的支付项
|
|
319
331
|
* 视为 wallet pass;其它支付项保持不变。
|
|
320
332
|
*/
|
|
321
|
-
updateVoucherOrderPayments(payments: OrderPaymentSource[]
|
|
333
|
+
updateVoucherOrderPayments(payments: OrderPaymentSource[], options?: {
|
|
334
|
+
status?: 'paid' | 'payment_pending';
|
|
335
|
+
}): OrderPaymentData[];
|
|
322
336
|
private shouldMergeProductToOrder;
|
|
323
337
|
private hasOrderProductLineNote;
|
|
324
338
|
/**
|
|
@@ -418,6 +432,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
418
432
|
payments?: OrderPaymentSource[];
|
|
419
433
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
420
434
|
smallTicketDataFlag?: number;
|
|
435
|
+
confirmPendingVoucherPayments?: boolean;
|
|
421
436
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
422
437
|
}): Promise<T>;
|
|
423
438
|
submitTempOrderAsync<T = any>(params?: {
|
|
@@ -429,6 +444,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
429
444
|
payments?: OrderPaymentSource[];
|
|
430
445
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
431
446
|
smallTicketDataFlag?: number;
|
|
447
|
+
confirmPendingVoucherPayments?: boolean;
|
|
432
448
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
433
449
|
}): Promise<T>;
|
|
434
450
|
private runSubmitTempOrder;
|
|
@@ -442,7 +458,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
442
458
|
generateIdempotencyToken(): string;
|
|
443
459
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
444
460
|
createOrder(params: CommitOrderParams['query']): {
|
|
445
|
-
type: "
|
|
461
|
+
type: "appointment_booking" | "virtual";
|
|
446
462
|
platform: string;
|
|
447
463
|
sales_channel: string;
|
|
448
464
|
order_sales_channel: string;
|