@pisell/pisellos 2.3.43 → 2.3.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Order/index.d.ts +2 -1
- package/dist/modules/Order/index.js +73 -28
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Payment/walletpass.d.ts +10 -3
- package/dist/modules/Payment/walletpass.js +425 -282
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +61 -57
- package/dist/solution/BaseSales/index.js +6 -3
- package/dist/solution/BaseSales/types.d.ts +3 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +6 -3
- package/dist/solution/BookingTicket/types.d.ts +1 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +3 -3
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/lib/model/strategy/adapter/promotion/index.js +51 -0
- package/lib/modules/Order/index.d.ts +2 -1
- package/lib/modules/Order/index.js +46 -7
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Payment/walletpass.d.ts +10 -3
- package/lib/modules/Payment/walletpass.js +218 -56
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +8 -3
- package/lib/solution/BaseSales/index.js +1 -0
- package/lib/solution/BaseSales/types.d.ts +3 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +1 -0
- package/lib/solution/BookingTicket/types.d.ts +1 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -2
- package/lib/solution/VenueBooking/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -27,6 +27,8 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
27
27
|
}): {
|
|
28
28
|
isAvailable: boolean;
|
|
29
29
|
discountList: Discount[];
|
|
30
|
+
/** 完整规则计算后的列表;调用方可用于保留暂时无适用商品的扫码卡券。 */
|
|
31
|
+
evaluatedDiscountList?: Discount[];
|
|
30
32
|
productList: any[];
|
|
31
33
|
unavailableReason?: UnavailableReason;
|
|
32
34
|
};
|
|
@@ -150,7 +150,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// 编辑商品已有商品券
|
|
153
|
-
if (productList.every(function (item) {
|
|
153
|
+
if (productList.length > 0 && productList.every(function (item) {
|
|
154
154
|
var _product$discount_lis;
|
|
155
155
|
var product = _this2.hooks.getProduct(item);
|
|
156
156
|
return product.booking_id && (((_product$discount_lis = product.discount_list) === null || _product$discount_lis === void 0 ? void 0 : _product$discount_lis.length) || product.total == 0);
|
|
@@ -214,6 +214,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
214
214
|
return {
|
|
215
215
|
isAvailable: hasApplicableDiscount,
|
|
216
216
|
discountList: hasApplicableDiscount ? result.discountList : oldDiscountList,
|
|
217
|
+
evaluatedDiscountList: result.discountList,
|
|
217
218
|
productList: hasApplicableDiscount ? result.productList : productList,
|
|
218
219
|
unavailableReason: unavailableReason
|
|
219
220
|
};
|
|
@@ -256,19 +257,22 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
256
257
|
}, {
|
|
257
258
|
key: "getUnavailableReason",
|
|
258
259
|
value: function getUnavailableReason(discountList, productList) {
|
|
260
|
+
var _this3 = this;
|
|
259
261
|
// 检查时间限制
|
|
260
262
|
var _iterator = _createForOfIteratorHelper(discountList),
|
|
261
263
|
_step;
|
|
262
264
|
try {
|
|
263
265
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
264
266
|
var discount = _step.value;
|
|
265
|
-
var
|
|
267
|
+
var bookingTimes = productList.length ? productList.map(function (item) {
|
|
268
|
+
var product = _this3.hooks.getProduct(item);
|
|
269
|
+
return ((product === null || product === void 0 ? void 0 : product.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss');
|
|
270
|
+
}) : [dayjs().format('YYYY-MM-DD HH:mm:ss')];
|
|
271
|
+
var _iterator3 = _createForOfIteratorHelper(bookingTimes),
|
|
266
272
|
_step3;
|
|
267
273
|
try {
|
|
268
274
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
269
|
-
var
|
|
270
|
-
var product = this.hooks.getProduct(item);
|
|
271
|
-
var bookingTime = ((product === null || product === void 0 ? void 0 : product.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss');
|
|
275
|
+
var bookingTime = _step3.value;
|
|
272
276
|
var filteredList = filterDiscountListByBookingTime([discount], bookingTime);
|
|
273
277
|
if (filteredList.length === 0) {
|
|
274
278
|
return UnavailableReason.TimeLimit;
|
|
@@ -299,12 +303,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
299
303
|
try {
|
|
300
304
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
301
305
|
var _limitedData$product_;
|
|
302
|
-
var
|
|
303
|
-
var
|
|
306
|
+
var item = _step4.value;
|
|
307
|
+
var product = this.hooks.getProduct(item);
|
|
304
308
|
if (limitedData.type === 'product_all') {
|
|
305
309
|
hasApplicableProduct = true;
|
|
306
310
|
break;
|
|
307
|
-
} else if ((_limitedData$product_ = limitedData.product_ids) !== null && _limitedData$product_ !== void 0 && _limitedData$product_.includes(
|
|
311
|
+
} else if ((_limitedData$product_ = limitedData.product_ids) !== null && _limitedData$product_ !== void 0 && _limitedData$product_.includes(product.id)) {
|
|
308
312
|
hasApplicableProduct = true;
|
|
309
313
|
break;
|
|
310
314
|
}
|
|
@@ -329,7 +333,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
329
333
|
key: "calcDiscount",
|
|
330
334
|
value: function calcDiscount(_ref2, options) {
|
|
331
335
|
var _options$selectedList,
|
|
332
|
-
|
|
336
|
+
_this4 = this;
|
|
333
337
|
var discountList = _ref2.discountList,
|
|
334
338
|
productList = _ref2.productList,
|
|
335
339
|
holders = _ref2.holders,
|
|
@@ -422,7 +426,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
422
426
|
var flattenProductsWithBundle = function flattenProductsWithBundle(productList) {
|
|
423
427
|
var flattened = [];
|
|
424
428
|
productList.forEach(function (originProduct) {
|
|
425
|
-
var product =
|
|
429
|
+
var product = _this4.hooks.getProduct(originProduct);
|
|
426
430
|
|
|
427
431
|
// 1. 添加主商品
|
|
428
432
|
flattened.push({
|
|
@@ -724,7 +728,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
724
728
|
|
|
725
729
|
// 辅助函数:检查商品是否对某个折扣卡可用
|
|
726
730
|
var checkItemApplicableForDiscount = function checkItemApplicableForDiscount(flatItem, discount) {
|
|
727
|
-
var _product2, _product3,
|
|
731
|
+
var _product, _product2, _product3, _flatItem$bundleItem, _flatItem$bundleItem2, _product4;
|
|
728
732
|
var product;
|
|
729
733
|
if (flatItem.type === 'main') {
|
|
730
734
|
product = flatItem.product;
|
|
@@ -741,12 +745,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
741
745
|
startDate: (_flatItem$parentProdu = flatItem.parentProduct) === null || _flatItem$parentProdu === void 0 ? void 0 : _flatItem$parentProdu.startDate
|
|
742
746
|
};
|
|
743
747
|
}
|
|
744
|
-
if (
|
|
748
|
+
if (_this4.isItemRewardProductDiscount(product)) {
|
|
745
749
|
return false;
|
|
746
750
|
}
|
|
747
751
|
|
|
748
752
|
// 编辑的商品使用了优惠券不可用
|
|
749
|
-
var isAvailableProduct = flatItem.type === 'main' ? !((
|
|
753
|
+
var isAvailableProduct = flatItem.type === 'main' ? !((_product = product) !== null && _product !== void 0 && _product.booking_id && (_product2 = product) !== null && _product2 !== void 0 && (_product2 = _product2.discount_list) !== null && _product2 !== void 0 && _product2.length && (_product3 = product) !== null && _product3 !== void 0 && (_product3 = _product3.discount_list) !== null && _product3 !== void 0 && _product3.every(function (d) {
|
|
750
754
|
return d.id && ['good_pass', 'discount_card', 'product_discount_card'].includes(d.tag || d.type);
|
|
751
755
|
})) : !(flatItem !== null && flatItem !== void 0 && flatItem.booking_id && !!(flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem = flatItem.bundleItem) !== null && _flatItem$bundleItem !== void 0 && (_flatItem$bundleItem = _flatItem$bundleItem.discount_list) !== null && _flatItem$bundleItem !== void 0 && _flatItem$bundleItem.length) && flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem2 = flatItem.bundleItem) !== null && _flatItem$bundleItem2 !== void 0 && (_flatItem$bundleItem2 = _flatItem$bundleItem2.discount_list) !== null && _flatItem$bundleItem2 !== void 0 && _flatItem$bundleItem2.every(function (d) {
|
|
752
756
|
return d.id;
|
|
@@ -767,7 +771,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
767
771
|
var limitedData = discount.limited_relation_product_data;
|
|
768
772
|
|
|
769
773
|
// 时间限制检查
|
|
770
|
-
var timeLimit = !!filterDiscountListByBookingTime([discount], (((
|
|
774
|
+
var timeLimit = !!filterDiscountListByBookingTime([discount], (((_product4 = product) === null || _product4 === void 0 ? void 0 : _product4.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss')).length;
|
|
771
775
|
if (!timeLimit) {
|
|
772
776
|
return false;
|
|
773
777
|
}
|
|
@@ -787,7 +791,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
787
791
|
}
|
|
788
792
|
|
|
789
793
|
// 套餐规则检查
|
|
790
|
-
var isBundleAvailable =
|
|
794
|
+
var isBundleAvailable = _this4.checkPackageSubItemUsageRules(discount, flatItem);
|
|
791
795
|
return isLimitedProduct && isBundleAvailable;
|
|
792
796
|
};
|
|
793
797
|
|
|
@@ -930,30 +934,30 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
930
934
|
};
|
|
931
935
|
originProduct = flatItem.originProduct;
|
|
932
936
|
}
|
|
933
|
-
var isItemRewardProductDiscount =
|
|
937
|
+
var isItemRewardProductDiscount = _this4.isItemRewardProductDiscount(product);
|
|
934
938
|
addModeDiscount.forEach(function (discount) {
|
|
935
|
-
var _product6, _product7, _product8,
|
|
939
|
+
var _product5, _product6, _product7, _product8, _flatItem$bundleItem3, _flatItem$bundleItem4, _discount$config;
|
|
936
940
|
var limitedData = discount === null || discount === void 0 ? void 0 : discount.limited_relation_product_data;
|
|
937
941
|
// 拿到discount配置的holder信息 product信息 product.holder 加在 isLimitedProduct
|
|
938
942
|
var _tempVar = (flatItem === null || flatItem === void 0 ? void 0 : flatItem.type) === 'bundle' ? flatItem === null || flatItem === void 0 ? void 0 : flatItem.parentProduct : flatItem === null || flatItem === void 0 ? void 0 : flatItem.product;
|
|
939
|
-
var isHolderMatch =
|
|
943
|
+
var isHolderMatch = _this4.checkHolderMatch(discount, {
|
|
940
944
|
isNeedHolder: resolveIsFormSubject(_tempVar) && !(_tempVar !== null && _tempVar !== void 0 && _tempVar.isNormalProduct),
|
|
941
945
|
holder_id: (_tempVar === null || _tempVar === void 0 ? void 0 : _tempVar.holder_id) || product.holder_id
|
|
942
946
|
}, holders);
|
|
943
947
|
var timeLimit = true;
|
|
944
|
-
timeLimit = !!filterDiscountListByBookingTime([discount], (((
|
|
948
|
+
timeLimit = !!filterDiscountListByBookingTime([discount], (((_product5 = product) === null || _product5 === void 0 ? void 0 : _product5.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss')).length;
|
|
945
949
|
// 是符合折扣的商品
|
|
946
950
|
var isLimitedProduct = (limitedData.type === 'product_all' && limitedData.filter !== 1 || limitedData.type === 'product_all' && limitedData.filter === 1 && !limitedData.exclude_product_ids.includes(product.id) || limitedData.product_ids && limitedData.product_ids.includes(product.id)) && isHolderMatch;
|
|
947
951
|
|
|
948
952
|
// 编辑的商品 使用了优惠券不可用
|
|
949
|
-
var isAvailableProduct = flatItem.type === 'main' ? !((
|
|
953
|
+
var isAvailableProduct = flatItem.type === 'main' ? !((_product6 = product) !== null && _product6 !== void 0 && _product6.booking_id && (_product7 = product) !== null && _product7 !== void 0 && (_product7 = _product7.discount_list) !== null && _product7 !== void 0 && _product7.length && (_product8 = product) !== null && _product8 !== void 0 && (_product8 = _product8.discount_list) !== null && _product8 !== void 0 && _product8.every(function (discount) {
|
|
950
954
|
return discount.id && ['good_pass', 'discount_card', 'product_discount_card'].includes(discount.tag || discount.type);
|
|
951
955
|
})) : !(flatItem !== null && flatItem !== void 0 && flatItem.booking_id && !!(flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem3 = flatItem.bundleItem) !== null && _flatItem$bundleItem3 !== void 0 && (_flatItem$bundleItem3 = _flatItem$bundleItem3.discount_list) !== null && _flatItem$bundleItem3 !== void 0 && _flatItem$bundleItem3.length) && flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem4 = flatItem.bundleItem) !== null && _flatItem$bundleItem4 !== void 0 && (_flatItem$bundleItem4 = _flatItem$bundleItem4.discount_list) !== null && _flatItem$bundleItem4 !== void 0 && _flatItem$bundleItem4.every(function (discount) {
|
|
952
956
|
return discount.id;
|
|
953
957
|
}));
|
|
954
958
|
|
|
955
959
|
// 套餐是否可用判断
|
|
956
|
-
var isBundleAvailable =
|
|
960
|
+
var isBundleAvailable = _this4.checkPackageSubItemUsageRules(discount, flatItem);
|
|
957
961
|
|
|
958
962
|
// 判断优惠券是否适用于该商品
|
|
959
963
|
if (isAvailableProduct && !isItemRewardProductDiscount && isLimitedProduct && timeLimit && isBundleAvailable && (_discount$config = discount.config) !== null && _discount$config !== void 0 && _discount$config.isAvailable) {
|
|
@@ -1055,7 +1059,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1055
1059
|
// 然后再处理应用哪些优惠券,此时只考虑filteredDiscountList中的优惠券
|
|
1056
1060
|
// 🔥 使用扁平化后的列表进行处理
|
|
1057
1061
|
sortedFlattenedList.forEach(function (flatItem, index) {
|
|
1058
|
-
var
|
|
1062
|
+
var _product9, _originProduct, _originProduct2, _originProduct3, _product$discount_lis2, _product10;
|
|
1059
1063
|
// 获取商品数据
|
|
1060
1064
|
var product, originProduct;
|
|
1061
1065
|
if (flatItem.type === 'main') {
|
|
@@ -1079,8 +1083,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1079
1083
|
};
|
|
1080
1084
|
originProduct = flatItem.originProduct;
|
|
1081
1085
|
}
|
|
1082
|
-
var isPersistedProduct = ((
|
|
1083
|
-
var hasExistingWalletDiscount = ((_product$discount_lis2 = product.discount_list) === null || _product$discount_lis2 === void 0 ? void 0 : _product$discount_lis2.length) && ((
|
|
1086
|
+
var isPersistedProduct = ((_product9 = product) === null || _product9 === void 0 ? void 0 : _product9.booking_id) || ((_originProduct = originProduct) === null || _originProduct === void 0 ? void 0 : _originProduct.order_detail_id) || ((_originProduct2 = originProduct) === null || _originProduct2 === void 0 ? void 0 : _originProduct2.orderDetailId) || ((_originProduct3 = originProduct) === null || _originProduct3 === void 0 ? void 0 : _originProduct3.booking_id);
|
|
1087
|
+
var hasExistingWalletDiscount = ((_product$discount_lis2 = product.discount_list) === null || _product$discount_lis2 === void 0 ? void 0 : _product$discount_lis2.length) && ((_product10 = product) === null || _product10 === void 0 || (_product10 = _product10.discount_list) === null || _product10 === void 0 ? void 0 : _product10.every(function (discount) {
|
|
1084
1088
|
var _discount$id, _discount$discount4;
|
|
1085
1089
|
var discountIdentity = (_discount$id = discount.id) !== null && _discount$id !== void 0 ? _discount$id : (_discount$discount4 = discount.discount) === null || _discount$discount4 === void 0 ? void 0 : _discount$discount4.resource_id;
|
|
1086
1090
|
var discountType = discount.tag || discount.type;
|
|
@@ -1102,7 +1106,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1102
1106
|
// 找到适用于此商品的所有优惠券,仅考虑isSelected不为false的优惠券
|
|
1103
1107
|
var applicableDiscounts = sortedDiscountList.filter(function (discount) {
|
|
1104
1108
|
var _product$discount_lis3, _product$discount_lis4;
|
|
1105
|
-
if (
|
|
1109
|
+
if (_this4.isItemRewardProductDiscount(product)) return false;
|
|
1106
1110
|
// 🔥 检查策略可用性(针对 good_pass 和折扣卡)
|
|
1107
1111
|
var discountType = discount.tag || discount.type;
|
|
1108
1112
|
var currentOriginUid = getOriginProductUid(originProduct);
|
|
@@ -1148,7 +1152,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1148
1152
|
|
|
1149
1153
|
// 拿到discount配置的holder信息 product信息 product.holder 不可用return false
|
|
1150
1154
|
var _tempVar = (flatItem === null || flatItem === void 0 ? void 0 : flatItem.type) === 'bundle' ? flatItem === null || flatItem === void 0 ? void 0 : flatItem.parentProduct : flatItem === null || flatItem === void 0 ? void 0 : flatItem.product;
|
|
1151
|
-
var isHolderMatch =
|
|
1155
|
+
var isHolderMatch = _this4.checkHolderMatch(discount, {
|
|
1152
1156
|
isNeedHolder: resolveIsFormSubject(_tempVar) && !(_tempVar !== null && _tempVar !== void 0 && _tempVar.isNormalProduct),
|
|
1153
1157
|
holder_id: (_tempVar === null || _tempVar === void 0 ? void 0 : _tempVar.holder_id) || product.holder_id
|
|
1154
1158
|
}, holders);
|
|
@@ -1166,13 +1170,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1166
1170
|
return false;
|
|
1167
1171
|
}
|
|
1168
1172
|
// 检查 package_sub_item_usage_rules
|
|
1169
|
-
if (!
|
|
1173
|
+
if (!_this4.checkPackageSubItemUsageRules(discount, flatItem)) {
|
|
1170
1174
|
return false;
|
|
1171
1175
|
}
|
|
1172
1176
|
return true;
|
|
1173
1177
|
} else if (limitedData.product_ids && limitedData.product_ids.includes(product.id)) {
|
|
1174
1178
|
// 检查 package_sub_item_usage_rules
|
|
1175
|
-
if (!
|
|
1179
|
+
if (!_this4.checkPackageSubItemUsageRules(discount, flatItem)) {
|
|
1176
1180
|
return false;
|
|
1177
1181
|
}
|
|
1178
1182
|
return true;
|
|
@@ -1198,17 +1202,17 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1198
1202
|
var isManualDiscount = false;
|
|
1199
1203
|
var isItemRewardProductDiscount = false;
|
|
1200
1204
|
if (flatItem.type === 'main') {
|
|
1201
|
-
var _product$discount_lis5, _product$discount_lis6,
|
|
1205
|
+
var _product$discount_lis5, _product$discount_lis6, _product11, _product11$every;
|
|
1202
1206
|
// 主商品:判断自身是否手动折扣
|
|
1203
1207
|
isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : ((_product$discount_lis5 = product.discount_list) === null || _product$discount_lis5 === void 0 ? void 0 : _product$discount_lis5.some(function (item) {
|
|
1204
1208
|
return item.type === 'product';
|
|
1205
1209
|
})) || product.total != product.origin_total && (product.bundle || []).every(function (item) {
|
|
1206
1210
|
var _ref12;
|
|
1207
1211
|
return !((_ref12 = item.discount_list || []) !== null && _ref12 !== void 0 && _ref12.length);
|
|
1208
|
-
}) && (!((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.length) || ((
|
|
1212
|
+
}) && (!((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.length) || ((_product11 = product) === null || _product11 === void 0 || (_product11 = _product11.discount_list) === null || _product11 === void 0 || (_product11$every = _product11.every) === null || _product11$every === void 0 ? void 0 : _product11$every.call(_product11, function (item) {
|
|
1209
1213
|
return item.type === 'product';
|
|
1210
1214
|
})));
|
|
1211
|
-
isItemRewardProductDiscount =
|
|
1215
|
+
isItemRewardProductDiscount = _this4.isItemRewardProductDiscount(product);
|
|
1212
1216
|
if (product.inPromotion && !isItemRewardProductDiscount) {
|
|
1213
1217
|
isManualDiscount = false;
|
|
1214
1218
|
}
|
|
@@ -1291,7 +1295,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1291
1295
|
// 主商品:保持原有逻辑,还原 option 价格
|
|
1292
1296
|
var restoredOptions = restoreOptionPrices(product.options);
|
|
1293
1297
|
if (product.isClient) {
|
|
1294
|
-
processedProductsMap.set(product._id, [
|
|
1298
|
+
processedProductsMap.set(product._id, [_this4.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {} : {
|
|
1295
1299
|
origin_total: getProductOriginTotalPrice({
|
|
1296
1300
|
product: {
|
|
1297
1301
|
original_price: product.original_price
|
|
@@ -1311,11 +1315,11 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1311
1315
|
price: product.price,
|
|
1312
1316
|
options: restoredOptions
|
|
1313
1317
|
}), {}, {
|
|
1314
|
-
discount_list: isManualDiscount ?
|
|
1318
|
+
discount_list: isManualDiscount ? _this4.resolveDiscountListForManualOverride(product.discount_list) : _this4.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1315
1319
|
}))]);
|
|
1316
1320
|
} else {
|
|
1317
|
-
var _ref14, _product$_promotion$f,
|
|
1318
|
-
var total = product.inPromotion ? (_ref14 = (_product$_promotion$f = (
|
|
1321
|
+
var _ref14, _product$_promotion$f, _product12, _product$origin_total;
|
|
1322
|
+
var total = product.inPromotion ? (_ref14 = (_product$_promotion$f = (_product12 = product) === null || _product12 === void 0 || (_product12 = _product12._promotion) === null || _product12 === void 0 ? void 0 : _product12.finalPrice) !== null && _product$_promotion$f !== void 0 ? _product$_promotion$f : product.origin_total) !== null && _ref14 !== void 0 ? _ref14 : product.total : (_product$origin_total = product.origin_total) !== null && _product$origin_total !== void 0 ? _product$origin_total : product.total;
|
|
1319
1323
|
var main_product_selling_price = product.price;
|
|
1320
1324
|
if ((product.discount_list || []).some(function (item) {
|
|
1321
1325
|
return item.type === 'promotion';
|
|
@@ -1324,7 +1328,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1324
1328
|
total = (_product$total = product.total) !== null && _product$total !== void 0 ? _product$total : product.origin_total;
|
|
1325
1329
|
main_product_selling_price = (_product$main_product = product.main_product_selling_price) !== null && _product$main_product !== void 0 ? _product$main_product : main_product_selling_price;
|
|
1326
1330
|
}
|
|
1327
|
-
processedProductsMap.set(product._id, [
|
|
1331
|
+
processedProductsMap.set(product._id, [_this4.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? _objectSpread({
|
|
1328
1332
|
price: product.price,
|
|
1329
1333
|
main_product_selling_price: isItemRewardProductDiscount ? main_product_selling_price : product.price
|
|
1330
1334
|
}, isItemRewardProductDiscount ? {
|
|
@@ -1336,14 +1340,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1336
1340
|
main_product_selling_price: main_product_selling_price,
|
|
1337
1341
|
options: restoredOptions
|
|
1338
1342
|
}), {}, {
|
|
1339
|
-
discount_list: isManualDiscount ?
|
|
1343
|
+
discount_list: isManualDiscount ? _this4.resolveDiscountListForManualOverride(product.discount_list) : _this4.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1340
1344
|
}))]);
|
|
1341
1345
|
}
|
|
1342
1346
|
} else {
|
|
1343
1347
|
var _flatItem$bundleItem8, _flatItem$bundleItem9;
|
|
1344
1348
|
// bundle子商品:保存到扁平化Map
|
|
1345
1349
|
processedFlatItemsMap.set(flatItem._id, [_objectSpread(_objectSpread({}, flatItem), {}, {
|
|
1346
|
-
discount_list: isManualDiscount ?
|
|
1350
|
+
discount_list: isManualDiscount ? _this4.resolveDiscountListForManualOverride(((_flatItem$bundleItem8 = flatItem.bundleItem) === null || _flatItem$bundleItem8 === void 0 ? void 0 : _flatItem$bundleItem8.discount_list) || []) : _this4.filterDiscountListByType(((_flatItem$bundleItem9 = flatItem.bundleItem) === null || _flatItem$bundleItem9 === void 0 ? void 0 : _flatItem$bundleItem9.discount_list) || [], 'promotion'),
|
|
1347
1351
|
price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
|
|
1348
1352
|
processed: true
|
|
1349
1353
|
})]);
|
|
@@ -1384,8 +1388,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1384
1388
|
var _product$total2;
|
|
1385
1389
|
_total = (_product$total2 = product.total) !== null && _product$total2 !== void 0 ? _product$total2 : product.origin_total;
|
|
1386
1390
|
}
|
|
1387
|
-
arr.push(
|
|
1388
|
-
discount_list:
|
|
1391
|
+
arr.push(_this4.hooks.setProduct(originProduct, {
|
|
1392
|
+
discount_list: _this4.filterDiscountListByType(product.discount_list, 'promotion'),
|
|
1389
1393
|
quantity: totalQuantity - splitCount,
|
|
1390
1394
|
_id: product._id.split('___')[0],
|
|
1391
1395
|
total: _total
|
|
@@ -1409,7 +1413,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1409
1413
|
// 优先从 origin_total拿,可能会拿不到(比如用户端预约在没有配置 original_price 的情况下)
|
|
1410
1414
|
var productOriginTotal = product.origin_total || product.total || 0;
|
|
1411
1415
|
// 如果当前 product 有 discount_list,则先从 origin_total 拿
|
|
1412
|
-
if (
|
|
1416
|
+
if (_this4.filterDiscountListByType(product.discount_list, 'promotion').length && product.origin_total) {
|
|
1413
1417
|
productOriginTotal = product.origin_total;
|
|
1414
1418
|
}
|
|
1415
1419
|
// 如果originProduct?._productInit?.original_price为 0,product.origin_total可能为空,此时取 product.total
|
|
@@ -1497,7 +1501,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1497
1501
|
// 记录应用了优惠券的商品
|
|
1498
1502
|
// 后续更新价格改为 getProductTotalPrice getProductOriginTotalPrice逻辑
|
|
1499
1503
|
if (product.isClient) {
|
|
1500
|
-
arr.push(
|
|
1504
|
+
arr.push(_this4.hooks.setProduct(originProduct, {
|
|
1501
1505
|
discount_list: [discountDetail],
|
|
1502
1506
|
// good_pass:主商品价以折后价为准;勿用 product.price - amount(amount 含 option 优惠时会算错)
|
|
1503
1507
|
price: isGoodPass ? mainProductSellingPrice : product.price,
|
|
@@ -1515,8 +1519,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1515
1519
|
options: discountedOptions
|
|
1516
1520
|
}));
|
|
1517
1521
|
} else {
|
|
1518
|
-
arr.push(
|
|
1519
|
-
discount_list:
|
|
1522
|
+
arr.push(_this4.hooks.setProduct(originProduct, {
|
|
1523
|
+
discount_list: _this4.filterDiscountListByType(product.discount_list, 'promotion').concat([discountDetail]),
|
|
1520
1524
|
_id: product._id.split('___')[0] + '___' + _selectedDiscount.id + index,
|
|
1521
1525
|
price: _selectedDiscount.tag === 'good_pass' ? 0 : product.price,
|
|
1522
1526
|
quantity: isNeedSplit ? 1 : product.quantity,
|
|
@@ -1601,7 +1605,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1601
1605
|
_id: "".concat(flatItem._id, "_split_rest"),
|
|
1602
1606
|
num: normalNum,
|
|
1603
1607
|
quantity: normalNum,
|
|
1604
|
-
discount_list:
|
|
1608
|
+
discount_list: _this4.filterDiscountListByType(flatItem.discount_list, 'promotion'),
|
|
1605
1609
|
processed: true
|
|
1606
1610
|
}));
|
|
1607
1611
|
}
|
|
@@ -1671,7 +1675,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1671
1675
|
processedItems.push(_objectSpread(_objectSpread({}, flatItem), {}, {
|
|
1672
1676
|
total: targetProductTotal,
|
|
1673
1677
|
price: new Decimal(_productOriginTotal || 0).minus(fixedAmountPerItem).toNumber(),
|
|
1674
|
-
discount_list:
|
|
1678
|
+
discount_list: _this4.filterDiscountListByType(flatItem.discount_list, 'promotion').concat([_discountDetail2]),
|
|
1675
1679
|
processed: true
|
|
1676
1680
|
}));
|
|
1677
1681
|
}
|
|
@@ -1683,7 +1687,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1683
1687
|
var reconstructProductsWithBundle = function reconstructProductsWithBundle(processedProductsMap, processedFlatItemsMap, originalProductList) {
|
|
1684
1688
|
var result = [];
|
|
1685
1689
|
originalProductList.forEach(function (originProduct) {
|
|
1686
|
-
var product =
|
|
1690
|
+
var product = _this4.hooks.getProduct(originProduct);
|
|
1687
1691
|
|
|
1688
1692
|
// 获取主商品处理结果
|
|
1689
1693
|
var mainProductArr = processedProductsMap.get(product._id);
|
|
@@ -1692,8 +1696,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1692
1696
|
var getDefaultProduct = function getDefaultProduct() {
|
|
1693
1697
|
var restoredOptions = restoreOptionPrices(product.options);
|
|
1694
1698
|
if (product.isClient) {
|
|
1695
|
-
return
|
|
1696
|
-
discount_list:
|
|
1699
|
+
return _this4.hooks.setProduct(originProduct, {
|
|
1700
|
+
discount_list: _this4.filterDiscountListByType(product.discount_list, 'promotion'),
|
|
1697
1701
|
price: product.price,
|
|
1698
1702
|
origin_total: getProductOriginTotalPrice({
|
|
1699
1703
|
product: {
|
|
@@ -1714,8 +1718,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1714
1718
|
options: restoredOptions
|
|
1715
1719
|
});
|
|
1716
1720
|
} else {
|
|
1717
|
-
return
|
|
1718
|
-
discount_list:
|
|
1721
|
+
return _this4.hooks.setProduct(originProduct, {
|
|
1722
|
+
discount_list: _this4.filterDiscountListByType(product.discount_list, 'promotion'),
|
|
1719
1723
|
total: product.total,
|
|
1720
1724
|
origin_total: product.origin_total,
|
|
1721
1725
|
price: product.price,
|
|
@@ -1763,10 +1767,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1763
1767
|
}
|
|
1764
1768
|
|
|
1765
1769
|
// 🔥 2. 如果有子商品应用了商品券,且主商品数量大于1,需要拆分主商品
|
|
1766
|
-
var mainProductQuantity = mainProductArr[0] ?
|
|
1770
|
+
var mainProductQuantity = mainProductArr[0] ? _this4.hooks.getProduct(mainProductArr[0]).quantity : 1;
|
|
1767
1771
|
if (hasGoodPassApplied && mainProductArr.length === 1 && mainProductQuantity > 1) {
|
|
1768
1772
|
var mainProduct = mainProductArr[0];
|
|
1769
|
-
var mainProductData =
|
|
1773
|
+
var mainProductData = _this4.hooks.getProduct(mainProduct);
|
|
1770
1774
|
|
|
1771
1775
|
// 🔥 方案:拆分成2个主商品
|
|
1772
1776
|
// 1. 一个主商品(qty=1)包含拆分后的bundle
|
|
@@ -1881,7 +1885,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1881
1885
|
}
|
|
1882
1886
|
|
|
1883
1887
|
// 添加第一个主商品:qty=1,包含拆分后的bundle
|
|
1884
|
-
result.push(
|
|
1888
|
+
result.push(_this4.hooks.setProduct(mainProduct, _objectSpread(_objectSpread({}, mainProductData), {}, {
|
|
1885
1889
|
_id: "".concat(mainProductData._id.split('___')[0], "___split_discount"),
|
|
1886
1890
|
quantity: 1,
|
|
1887
1891
|
discount_list: updatedMainDiscountList,
|
|
@@ -1953,7 +1957,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1953
1957
|
newOriginTotalOriginal = new Decimal(newOriginTotalOriginal).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
|
|
1954
1958
|
|
|
1955
1959
|
// 添加第二个主商品:qty=原quantity-1,包含原始bundle
|
|
1956
|
-
result.push(
|
|
1960
|
+
result.push(_this4.hooks.setProduct(mainProduct, _objectSpread(_objectSpread({}, mainProductData), {}, {
|
|
1957
1961
|
_id: "".concat(mainProductData._id.split('___')[0], "___split_normal"),
|
|
1958
1962
|
quantity: mainProductQuantity - 1,
|
|
1959
1963
|
discount_list: updatedMainDiscountListOriginal,
|
|
@@ -1966,7 +1970,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1966
1970
|
// 🔥 没有子商品被拆分,使用原有逻辑
|
|
1967
1971
|
mainProductArr.forEach(function (mainProduct) {
|
|
1968
1972
|
var _ref16, _mainProductData$main, _mainProductData$disc, _mainProductData$disc2, _mainProductData$disc3;
|
|
1969
|
-
var mainProductData =
|
|
1973
|
+
var mainProductData = _this4.hooks.getProduct(mainProduct);
|
|
1970
1974
|
|
|
1971
1975
|
// 重组bundle
|
|
1972
1976
|
var newBundle = [];
|
|
@@ -2053,7 +2057,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2053
2057
|
newOriginTotal = new Decimal(newOriginTotal).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
|
|
2054
2058
|
|
|
2055
2059
|
// 生成最终的主商品
|
|
2056
|
-
result.push(
|
|
2060
|
+
result.push(_this4.hooks.setProduct(mainProduct, _objectSpread(_objectSpread({}, mainProductData), {}, {
|
|
2057
2061
|
bundle: newBundle,
|
|
2058
2062
|
total: newTotal,
|
|
2059
2063
|
origin_total: newOriginTotal
|
|
@@ -2479,12 +2479,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2479
2479
|
tempOrder: tempOrder
|
|
2480
2480
|
});
|
|
2481
2481
|
case 13:
|
|
2482
|
-
return _context23.abrupt("return", {
|
|
2483
|
-
isAvailable: raw.isAvailable
|
|
2482
|
+
return _context23.abrupt("return", _objectSpread(_objectSpread({
|
|
2483
|
+
isAvailable: raw.isAvailable
|
|
2484
|
+
}, raw.isAccepted !== undefined ? {
|
|
2485
|
+
isAccepted: raw.isAccepted
|
|
2486
|
+
} : {}), {}, {
|
|
2484
2487
|
type: raw.type,
|
|
2485
2488
|
unavailableReason: raw.unavailableReason,
|
|
2486
2489
|
scannedDiscountList: raw.scannedDiscountList
|
|
2487
|
-
});
|
|
2490
|
+
}));
|
|
2488
2491
|
case 16:
|
|
2489
2492
|
_context23.prev = 16;
|
|
2490
2493
|
_context23.t0 = _context23["catch"](0);
|
|
@@ -439,8 +439,10 @@ export interface BaseSalesAddLogParams extends BaseSalesLogInput {
|
|
|
439
439
|
/** BaseSales.scanPromotionCode 对外的轻量结果(UI 可用 getDiscountList 或 scannedDiscountList 补 Holder) */
|
|
440
440
|
export interface BaseSalesScanCodeResult {
|
|
441
441
|
isAvailable: boolean;
|
|
442
|
+
/** 卡券已加入 Promotion;false 时可能是无效、过期或已使用。 */
|
|
443
|
+
isAccepted?: boolean;
|
|
442
444
|
type?: 'server' | string;
|
|
443
445
|
unavailableReason?: 'time_limit' | string;
|
|
444
|
-
/** batchSearch 原始结果;
|
|
446
|
+
/** batchSearch 原始结果;Holder 补全等流程可从这里读取原始卡券。 */
|
|
445
447
|
scannedDiscountList?: Discount[];
|
|
446
448
|
}
|
|
@@ -104,7 +104,7 @@ function findVariantById(origin, variantId) {
|
|
|
104
104
|
* 注意:这里不生成 identity,缺省时由 OrderModule 自动补齐。
|
|
105
105
|
*/
|
|
106
106
|
export function transformBaseProductToOrderProduct(params) {
|
|
107
|
-
var _ref10, _ref11, _ref12, _payload$product_id, _ref13, _ref14, _payload$product_vari, _payload$_origin, _payload$_origin2, _ref15, _findVariantById, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _payload$price, _ref23, _payload$line_total, _payload$_extend, _ref24, _ref25, _payload$product_sku$, _payload$product_sku, _payload$bundle, _payload$quantity, _payload$_extend2, _extend, _extend2, _ref26, _ref27, _origin$base_price, _ref28, _ref29, _payload$line_total2, _payload$_extend3, _payload$_extend4, _extend3, _payload$_extend5, _payload$_extend6, _ref30, _ref31, _payload$tax_fee, _ref32, _ref33, _payload$is_charge_ta;
|
|
107
|
+
var _ref10, _ref11, _ref12, _payload$product_id, _ref13, _ref14, _payload$product_vari, _payload$_origin, _payload$_origin2, _ref15, _findVariantById, _ref16, _ref17, _ref18, _ref19, _ref20, _matchedVariant$price, _ref21, _ref22, _payload$price, _ref23, _payload$line_total, _payload$_extend, _ref24, _ref25, _payload$product_sku$, _payload$product_sku, _payload$bundle, _payload$quantity, _payload$_extend2, _extend, _extend2, _ref26, _ref27, _origin$base_price, _ref28, _ref29, _payload$line_total2, _payload$_extend3, _payload$_extend4, _extend3, _payload$_extend5, _payload$_extend6, _ref30, _ref31, _payload$tax_fee, _ref32, _ref33, _payload$is_charge_ta;
|
|
108
108
|
var payload = params.payload,
|
|
109
109
|
_params$fallbackProdu = params.fallbackProductId,
|
|
110
110
|
fallbackProductId = _params$fallbackProdu === void 0 ? null : _params$fallbackProdu;
|
|
@@ -116,11 +116,14 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
116
116
|
var callbackOrigin = payload.origin || ((_payload$_origin = payload._origin) === null || _payload$_origin === void 0 ? void 0 : _payload$_origin.sourceProduct) || ((_payload$_origin2 = payload._origin) === null || _payload$_origin2 === void 0 ? void 0 : _payload$_origin2.sourceItem) || payload._origin || {};
|
|
117
117
|
var origin = _objectSpread(_objectSpread({}, sourceProduct || {}), callbackOrigin || {});
|
|
118
118
|
var matchedVariant = (_ref15 = (_findVariantById = findVariantById(callbackOrigin, productVariantId)) !== null && _findVariantById !== void 0 ? _findVariantById : findVariantById(sourceProduct, productVariantId)) !== null && _ref15 !== void 0 ? _ref15 : findVariantById(origin, productVariantId);
|
|
119
|
-
var
|
|
119
|
+
var hasPriceOverride = payload.price_override !== undefined && payload.price_override !== null && payload.price_override !== '';
|
|
120
|
+
// 手动改价后 payload.price 是分摊后的主商品售价,不能再作为券前 source。
|
|
121
|
+
// 此时优先从商品/variant 快照读取目录价;售价仍由 line_total - bundle 推导。
|
|
122
|
+
var catalogSourcePrice = (_ref16 = (_ref17 = (_ref18 = (_ref19 = (_ref20 = (_matchedVariant$price = matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.price) !== null && _matchedVariant$price !== void 0 ? _matchedVariant$price : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.base_price) !== null && _ref20 !== void 0 ? _ref20 : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref19 !== void 0 ? _ref19 : origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _ref18 !== void 0 ? _ref18 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _ref17 !== void 0 ? _ref17 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.selling_price) !== null && _ref16 !== void 0 ? _ref16 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price;
|
|
123
|
+
var sourceProductPrice = toPriceString(hasPriceOverride ? (_ref21 = catalogSourcePrice !== null && catalogSourcePrice !== void 0 ? catalogSourcePrice : payload.price) !== null && _ref21 !== void 0 ? _ref21 : payload.selling_price : (_ref22 = (_payload$price = payload.price) !== null && _payload$price !== void 0 ? _payload$price : payload.selling_price) !== null && _ref22 !== void 0 ? _ref22 : catalogSourcePrice, '0.00');
|
|
120
124
|
var explicitLineTotal = (_ref23 = (_payload$line_total = payload.line_total) !== null && _payload$line_total !== void 0 ? _payload$line_total : payload.total) !== null && _ref23 !== void 0 ? _ref23 : (_payload$_extend = payload._extend) === null || _payload$_extend === void 0 ? void 0 : _payload$_extend.total;
|
|
121
125
|
var hasExplicitLineTotal = Number.isFinite(Number(explicitLineTotal));
|
|
122
126
|
var lineCompositeTotal = toPriceString(explicitLineTotal, sourceProductPrice);
|
|
123
|
-
var hasPriceOverride = payload.price_override !== undefined && payload.price_override !== null && payload.price_override !== '';
|
|
124
127
|
var productOptionItem = normalizeProductSkuOptions(normalizeOptionItems((_ref24 = (_ref25 = (_payload$product_sku$ = (_payload$product_sku = payload.product_sku) === null || _payload$product_sku === void 0 ? void 0 : _payload$product_sku.option) !== null && _payload$product_sku$ !== void 0 ? _payload$product_sku$ : payload.option) !== null && _ref25 !== void 0 ? _ref25 : payload.options) !== null && _ref24 !== void 0 ? _ref24 : payload.product_option_item));
|
|
125
128
|
var productBundle = normalizeBundleItems((_payload$bundle = payload.bundle) !== null && _payload$bundle !== void 0 ? _payload$bundle : payload.product_bundle, hasPriceOverride);
|
|
126
129
|
// `payload.unique` 是业务侧商品/票务标识,可能在连续加同一商品时重复;
|
|
@@ -326,7 +326,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
326
326
|
* 获取当前的客户搜索条件
|
|
327
327
|
* @returns 当前搜索条件
|
|
328
328
|
*/
|
|
329
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
329
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
330
330
|
/**
|
|
331
331
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
332
332
|
* @returns 客户状态
|
|
@@ -602,12 +602,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
602
602
|
tempOrder: tempOrder
|
|
603
603
|
});
|
|
604
604
|
case 18:
|
|
605
|
-
return _context7.abrupt("return", {
|
|
606
|
-
isAvailable: raw.isAvailable
|
|
605
|
+
return _context7.abrupt("return", _objectSpread(_objectSpread({
|
|
606
|
+
isAvailable: raw.isAvailable
|
|
607
|
+
}, raw.isAccepted !== undefined ? {
|
|
608
|
+
isAccepted: raw.isAccepted
|
|
609
|
+
} : {}), {}, {
|
|
607
610
|
type: raw.type,
|
|
608
611
|
unavailableReason: raw.unavailableReason,
|
|
609
612
|
scannedDiscountList: raw.scannedDiscountList
|
|
610
|
-
});
|
|
613
|
+
}));
|
|
611
614
|
case 19:
|
|
612
615
|
case "end":
|
|
613
616
|
return _context7.stop();
|
|
@@ -192,7 +192,7 @@ export function applyGlobalScan(_x14, _x15, _x16) {
|
|
|
192
192
|
}
|
|
193
193
|
function _applyGlobalScan() {
|
|
194
194
|
_applyGlobalScan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(host, formatted, bridge) {
|
|
195
|
-
var searchType, data, scanCode, _bridge$onNotify2, _bridge$onNotify, _host$refreshWalletAs, _bridge$onNotify5, snapshot, scannedCustomerIsWalkIn, trySelectWalletAsset, _walletSelection, result, walletSelection, _data$id, promotionResult, list, _bridge$onNotify6, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify7, _data$order_id, _data$business_code, orderId, _bridge$onNotify8;
|
|
195
|
+
var searchType, data, scanCode, _bridge$onNotify2, _bridge$onNotify, _host$refreshWalletAs, _bridge$onNotify5, snapshot, scannedCustomerIsWalkIn, trySelectWalletAsset, _result$isAccepted, _walletSelection, result, walletSelection, _data$id, _promotionResult$isAc, promotionResult, list, _bridge$onNotify6, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify7, _data$order_id, _data$business_code, orderId, _bridge$onNotify8;
|
|
196
196
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
197
197
|
while (1) switch (_context5.prev = _context5.next) {
|
|
198
198
|
case 0:
|
|
@@ -309,7 +309,7 @@ function _applyGlobalScan() {
|
|
|
309
309
|
return bridge.applyPromotionCode(scanCode);
|
|
310
310
|
case 22:
|
|
311
311
|
result = _context5.sent;
|
|
312
|
-
if (!(result !== null &&
|
|
312
|
+
if (!((_result$isAccepted = result === null || result === void 0 ? void 0 : result.isAccepted) !== null && _result$isAccepted !== void 0 ? _result$isAccepted : result === null || result === void 0 ? void 0 : result.isAvailable)) {
|
|
313
313
|
_context5.next = 25;
|
|
314
314
|
break;
|
|
315
315
|
}
|
|
@@ -347,7 +347,7 @@ function _applyGlobalScan() {
|
|
|
347
347
|
return bridge.applyPromotionCode(scanCode, Number((_data$id = data === null || data === void 0 ? void 0 : data.id) !== null && _data$id !== void 0 ? _data$id : data === null || data === void 0 ? void 0 : data.customer_id) || undefined);
|
|
348
348
|
case 37:
|
|
349
349
|
promotionResult = _context5.sent;
|
|
350
|
-
if (!(promotionResult !== null &&
|
|
350
|
+
if (!((_promotionResult$isAc = promotionResult === null || promotionResult === void 0 ? void 0 : promotionResult.isAccepted) !== null && _promotionResult$isAc !== void 0 ? _promotionResult$isAc : promotionResult === null || promotionResult === void 0 ? void 0 : promotionResult.isAvailable)) {
|
|
351
351
|
_context5.next = 40;
|
|
352
352
|
break;
|
|
353
353
|
}
|
|
@@ -167,6 +167,7 @@ export declare class VenueBookingImpl extends BaseSalesImpl implements Module {
|
|
|
167
167
|
private recalculateOrderPricesFromQuotation;
|
|
168
168
|
scanCode(code: string, customerId?: number): Promise<{
|
|
169
169
|
isAvailable: boolean;
|
|
170
|
+
isAccepted?: boolean | undefined;
|
|
170
171
|
discountList: import("../../modules/Discount").Discount[];
|
|
171
172
|
type: "server" | "clientCalc";
|
|
172
173
|
unavailableReason?: import("../../modules/Rules/types").UnavailableReason | undefined;
|