@pisell/pisellos 0.0.395 → 0.0.396
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/Discount/types.d.ts +2 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/index.js +41 -12
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/ShopDiscount/utils.js +2 -1
- package/lib/modules/Discount/types.d.ts +2 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Rules/index.js +26 -4
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.js +1 -1
- package/package.json +1 -1
|
@@ -98,7 +98,9 @@ export interface Discount {
|
|
|
98
98
|
isEditMode?: boolean;
|
|
99
99
|
isScan?: boolean;
|
|
100
100
|
discount?: {
|
|
101
|
+
discount_product_id: number;
|
|
101
102
|
resource_id: number;
|
|
103
|
+
discount_calculation_mode: 'item_level' | 'order_level';
|
|
102
104
|
};
|
|
103
105
|
isManualSelect?: boolean;
|
|
104
106
|
isDisabled?: boolean;
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -227,6 +227,25 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
229
|
|
|
230
|
+
// 🔥 检查 editModeDiscount 中是否有订单级别的折扣,如果有则禁用 addModeDiscount 中相同 product_id 的折扣卡
|
|
231
|
+
var editModeOrderLevelProductIds = new Set();
|
|
232
|
+
editModeDiscount.forEach(function (discount) {
|
|
233
|
+
var _discount$discount2;
|
|
234
|
+
if (((_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.discount_calculation_mode) === 'order_level') {
|
|
235
|
+
var _discount$discount3;
|
|
236
|
+
editModeOrderLevelProductIds.add(discount === null || discount === void 0 || (_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.discount_product_id);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
// 如果存在订单级别的编辑模式折扣,禁用 addModeDiscount 中相同 product_id 的折扣卡
|
|
241
|
+
if (editModeOrderLevelProductIds.size > 0) {
|
|
242
|
+
addModeDiscount.forEach(function (discount) {
|
|
243
|
+
if (editModeOrderLevelProductIds.has(discount.product_id)) {
|
|
244
|
+
discount.isDisabled = true;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
|
|
230
249
|
// 过滤掉手动取消false的优惠券,但仅用于应用优惠逻辑
|
|
231
250
|
var filteredDiscountList = addModeDiscount.filter(function (discount) {
|
|
232
251
|
return !discount.isManualSelect;
|
|
@@ -562,6 +581,11 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
562
581
|
return;
|
|
563
582
|
}
|
|
564
583
|
|
|
584
|
+
// 🔥 vouchersApplicable 为 false 的商品不参与订单级别折扣均摊
|
|
585
|
+
if (isBoolean(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
|
|
565
589
|
// 商品价格为0时不可用
|
|
566
590
|
if (Number(product.price) <= 0 || !product.price) {
|
|
567
591
|
return;
|
|
@@ -662,7 +686,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
662
686
|
|
|
663
687
|
// 判断优惠券是否适用于该商品
|
|
664
688
|
if (isAvailableProduct && isLimitedProduct && timeLimit && isBundleAvailable && (_discount$config = discount.config) !== null && _discount$config !== void 0 && _discount$config.isAvailable) {
|
|
665
|
-
var _discountApplicabilit, _discount$metadata4;
|
|
689
|
+
var _discountApplicabilit, _discount$metadata4, _discount$metadata5;
|
|
666
690
|
// 记录此优惠券适用的商品
|
|
667
691
|
(_discountApplicabilit = discountApplicability.get(discount.id)) === null || _discountApplicabilit === void 0 || _discountApplicabilit.push(product.id);
|
|
668
692
|
|
|
@@ -680,6 +704,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
680
704
|
discount: {
|
|
681
705
|
discount_card_type: discount === null || discount === void 0 || (_discount$metadata4 = discount.metadata) === null || _discount$metadata4 === void 0 ? void 0 : _discount$metadata4.discount_card_type,
|
|
682
706
|
fixed_amount: product.price,
|
|
707
|
+
discount_calculation_mode: discount === null || discount === void 0 || (_discount$metadata5 = discount.metadata) === null || _discount$metadata5 === void 0 ? void 0 : _discount$metadata5.discount_calculation_mode,
|
|
683
708
|
resource_id: discount.id,
|
|
684
709
|
title: discount.format_title,
|
|
685
710
|
original_amount: product.price || product.origin_total,
|
|
@@ -986,7 +1011,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
986
1011
|
}));
|
|
987
1012
|
}
|
|
988
1013
|
for (var i = 0; i < splitCount; i++) {
|
|
989
|
-
var _product$discount_lis10, _originProduct, _selectedDiscount$met;
|
|
1014
|
+
var _product$discount_lis10, _originProduct, _selectedDiscount$met, _selectedDiscount$met2;
|
|
990
1015
|
// 如果用过折扣卡,也就不存在拆分的情况了,这里直接使用上面计算出来的折扣卡
|
|
991
1016
|
var _selectedDiscount = selectedDiscountCard || applicableDiscounts[i];
|
|
992
1017
|
// 标记优惠券为已使用
|
|
@@ -1040,6 +1065,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1040
1065
|
discount: {
|
|
1041
1066
|
discount_card_type: _selectedDiscount === null || _selectedDiscount === void 0 || (_selectedDiscount$met = _selectedDiscount.metadata) === null || _selectedDiscount$met === void 0 ? void 0 : _selectedDiscount$met.discount_card_type,
|
|
1042
1067
|
fixed_amount: actualDiscountAmount,
|
|
1068
|
+
discount_calculation_mode: _selectedDiscount === null || _selectedDiscount === void 0 || (_selectedDiscount$met2 = _selectedDiscount.metadata) === null || _selectedDiscount$met2 === void 0 ? void 0 : _selectedDiscount$met2.discount_calculation_mode,
|
|
1043
1069
|
resource_id: _selectedDiscount.id,
|
|
1044
1070
|
title: _selectedDiscount.format_title,
|
|
1045
1071
|
original_amount: product.price,
|
|
@@ -1109,6 +1135,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1109
1135
|
|
|
1110
1136
|
// 生成有折扣的商品(每张商品券对应 num: 1)
|
|
1111
1137
|
for (var _i = 0; _i < discountNum; _i++) {
|
|
1138
|
+
var _selectedDiscount2$me;
|
|
1112
1139
|
var _selectedDiscount2 = applicableDiscounts[_i];
|
|
1113
1140
|
usedDiscounts.set(_selectedDiscount2.id, true);
|
|
1114
1141
|
// 🔥 更新 product_id 使用计数
|
|
@@ -1128,6 +1155,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1128
1155
|
type: 'good_pass',
|
|
1129
1156
|
discount: {
|
|
1130
1157
|
fixed_amount: product.origin_total,
|
|
1158
|
+
discount_calculation_mode: _selectedDiscount2 === null || _selectedDiscount2 === void 0 || (_selectedDiscount2$me = _selectedDiscount2.metadata) === null || _selectedDiscount2$me === void 0 ? void 0 : _selectedDiscount2$me.discount_calculation_mode,
|
|
1131
1159
|
resource_id: _selectedDiscount2.id,
|
|
1132
1160
|
title: _selectedDiscount2.format_title,
|
|
1133
1161
|
original_amount: product.origin_total,
|
|
@@ -1173,7 +1201,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1173
1201
|
}));
|
|
1174
1202
|
}
|
|
1175
1203
|
} else {
|
|
1176
|
-
var _selectedDiscount3$me, _flatItem$parentProdu8;
|
|
1204
|
+
var _selectedDiscount3$me, _selectedDiscount3$me2, _flatItem$parentProdu8;
|
|
1177
1205
|
// 折扣卡:不拆分数量,直接应用
|
|
1178
1206
|
var _selectedDiscount3 = selectedDiscountCard || applicableDiscounts[0];
|
|
1179
1207
|
usedDiscounts.set(_selectedDiscount3.id, true);
|
|
@@ -1201,7 +1229,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1201
1229
|
_targetProductTotal = getDiscountAmount(_selectedDiscount3, _productOriginTotal, _productOriginTotal);
|
|
1202
1230
|
fixedAmountPerItem = new Decimal(_productOriginTotal).minus(_targetProductTotal).toNumber();
|
|
1203
1231
|
}
|
|
1204
|
-
|
|
1232
|
+
debugger;
|
|
1205
1233
|
// 🔥 使用当前的 _id 作为唯一标识
|
|
1206
1234
|
var _uniqueId = flatItem._id;
|
|
1207
1235
|
var _discountDetail2 = {
|
|
@@ -1210,6 +1238,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1210
1238
|
discount: {
|
|
1211
1239
|
discount_card_type: _selectedDiscount3 === null || _selectedDiscount3 === void 0 || (_selectedDiscount3$me = _selectedDiscount3.metadata) === null || _selectedDiscount3$me === void 0 ? void 0 : _selectedDiscount3$me.discount_card_type,
|
|
1212
1240
|
fixed_amount: fixedAmountPerItem,
|
|
1241
|
+
discount_calculation_mode: _selectedDiscount3 === null || _selectedDiscount3 === void 0 || (_selectedDiscount3$me2 = _selectedDiscount3.metadata) === null || _selectedDiscount3$me2 === void 0 ? void 0 : _selectedDiscount3$me2.discount_calculation_mode,
|
|
1213
1242
|
resource_id: _selectedDiscount3.id,
|
|
1214
1243
|
title: _selectedDiscount3.format_title,
|
|
1215
1244
|
original_amount: product.original_price,
|
|
@@ -1393,8 +1422,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1393
1422
|
|
|
1394
1423
|
// 🔥 更新主商品自己的 discount_list 中的 num(quantity=1)
|
|
1395
1424
|
var updatedMainDiscountList = mainProductData.discount_list.map(function (discount) {
|
|
1396
|
-
var _discount$
|
|
1397
|
-
if (discount !== null && discount !== void 0 && (_discount$
|
|
1425
|
+
var _discount$metadata6, _discount$metadata7;
|
|
1426
|
+
if (discount !== null && discount !== void 0 && (_discount$metadata6 = discount.metadata) !== null && _discount$metadata6 !== void 0 && _discount$metadata6.custom_product_bundle_map_id) {
|
|
1398
1427
|
// bundle的discount_list保持不变
|
|
1399
1428
|
return discount;
|
|
1400
1429
|
}
|
|
@@ -1402,7 +1431,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1402
1431
|
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
1403
1432
|
// num: 1,
|
|
1404
1433
|
metadata: _objectSpread(_objectSpread({}, discount.metadata), {}, {
|
|
1405
|
-
custom_product_bundle_map_id: discount === null || discount === void 0 || (_discount$
|
|
1434
|
+
custom_product_bundle_map_id: discount === null || discount === void 0 || (_discount$metadata7 = discount.metadata) === null || _discount$metadata7 === void 0 ? void 0 : _discount$metadata7.custom_product_bundle_map_id,
|
|
1406
1435
|
num: 1
|
|
1407
1436
|
})
|
|
1408
1437
|
});
|
|
@@ -1467,8 +1496,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1467
1496
|
|
|
1468
1497
|
// 🔥 更新主商品自己的 discount_list 中的 num(quantity=原quantity-1)
|
|
1469
1498
|
var updatedMainDiscountListOriginal = mainProductData.discount_list.map(function (discount) {
|
|
1470
|
-
var _discount$
|
|
1471
|
-
if (discount !== null && discount !== void 0 && (_discount$
|
|
1499
|
+
var _discount$metadata8, _discount$metadata9;
|
|
1500
|
+
if (discount !== null && discount !== void 0 && (_discount$metadata8 = discount.metadata) !== null && _discount$metadata8 !== void 0 && _discount$metadata8.custom_product_bundle_map_id) {
|
|
1472
1501
|
// bundle的discount_list保持不变
|
|
1473
1502
|
return discount;
|
|
1474
1503
|
}
|
|
@@ -1476,7 +1505,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1476
1505
|
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
1477
1506
|
metadata: _objectSpread(_objectSpread({}, discount.metadata), {}, {
|
|
1478
1507
|
num: mainProductQuantity - 1,
|
|
1479
|
-
custom_product_bundle_map_id: discount === null || discount === void 0 || (_discount$
|
|
1508
|
+
custom_product_bundle_map_id: discount === null || discount === void 0 || (_discount$metadata9 = discount.metadata) === null || _discount$metadata9 === void 0 ? void 0 : _discount$metadata9.custom_product_bundle_map_id
|
|
1480
1509
|
})
|
|
1481
1510
|
// num: mainProductQuantity - 1,
|
|
1482
1511
|
});
|
|
@@ -1541,11 +1570,11 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1541
1570
|
processedBundleItems.forEach(function (item) {
|
|
1542
1571
|
// 🔥 更新 discount_list 中的 num,使其与拆分后的 item.num 一致
|
|
1543
1572
|
var updatedDiscountList = (item.discount_list || []).map(function (discount) {
|
|
1544
|
-
var _discount$
|
|
1573
|
+
var _discount$metadata10;
|
|
1545
1574
|
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
1546
1575
|
metadata: _objectSpread(_objectSpread({}, discount.metadata), {}, {
|
|
1547
1576
|
num: item.num,
|
|
1548
|
-
custom_product_bundle_map_id: discount === null || discount === void 0 || (_discount$
|
|
1577
|
+
custom_product_bundle_map_id: discount === null || discount === void 0 || (_discount$metadata10 = discount.metadata) === null || _discount$metadata10 === void 0 ? void 0 : _discount$metadata10.custom_product_bundle_map_id
|
|
1549
1578
|
})
|
|
1550
1579
|
// num: item.num, // 使用拆分后的 num
|
|
1551
1580
|
});
|
|
@@ -308,7 +308,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
308
308
|
date: string;
|
|
309
309
|
status: string;
|
|
310
310
|
week: string;
|
|
311
|
-
weekNum: 0 | 2 | 1 | 3 |
|
|
311
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
312
312
|
}[]>;
|
|
313
313
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
314
314
|
private getScheduleDataByIds;
|
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|
|
@@ -52,7 +52,8 @@ export var getDiscountAmount = function getDiscountAmount(discount, total, price
|
|
|
52
52
|
|
|
53
53
|
// 固定金额 小于0时返回0
|
|
54
54
|
if (isFixedAmount) {
|
|
55
|
-
|
|
55
|
+
var _discount$amount;
|
|
56
|
+
discountedPrice = Math.max(new Decimal(price).minus(new Decimal(((_discount$amount = discount.amount) !== null && _discount$amount !== void 0 ? _discount$amount : discount.par_value) || 0)).toNumber(), 0);
|
|
56
57
|
} else {
|
|
57
58
|
// 百分比:根据折扣卡金额计算
|
|
58
59
|
discountedPrice = new Decimal(100).minus(discount.par_value || 0).div(100).mul(new Decimal(price)).toNumber();
|
|
@@ -98,7 +98,9 @@ export interface Discount {
|
|
|
98
98
|
isEditMode?: boolean;
|
|
99
99
|
isScan?: boolean;
|
|
100
100
|
discount?: {
|
|
101
|
+
discount_product_id: number;
|
|
101
102
|
resource_id: number;
|
|
103
|
+
discount_calculation_mode: 'item_level' | 'order_level';
|
|
102
104
|
};
|
|
103
105
|
isManualSelect?: boolean;
|
|
104
106
|
isDisabled?: boolean;
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -164,6 +164,20 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
164
164
|
addModeDiscount.push(discount);
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
|
+
const editModeOrderLevelProductIds = /* @__PURE__ */ new Set();
|
|
168
|
+
editModeDiscount.forEach((discount) => {
|
|
169
|
+
var _a, _b;
|
|
170
|
+
if (((_a = discount.discount) == null ? void 0 : _a.discount_calculation_mode) === "order_level") {
|
|
171
|
+
editModeOrderLevelProductIds.add((_b = discount == null ? void 0 : discount.discount) == null ? void 0 : _b.discount_product_id);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
if (editModeOrderLevelProductIds.size > 0) {
|
|
175
|
+
addModeDiscount.forEach((discount) => {
|
|
176
|
+
if (editModeOrderLevelProductIds.has(discount.product_id)) {
|
|
177
|
+
discount.isDisabled = true;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
167
181
|
const filteredDiscountList = addModeDiscount.filter((discount) => {
|
|
168
182
|
return !discount.isManualSelect;
|
|
169
183
|
});
|
|
@@ -393,6 +407,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
393
407
|
if (!isAvailableProduct) {
|
|
394
408
|
return;
|
|
395
409
|
}
|
|
410
|
+
if ((0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
396
413
|
if (Number(product.price) <= 0 || !product.price) {
|
|
397
414
|
return;
|
|
398
415
|
}
|
|
@@ -445,7 +462,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
445
462
|
originProduct = flatItem.originProduct;
|
|
446
463
|
}
|
|
447
464
|
addModeDiscount.forEach((discount) => {
|
|
448
|
-
var _a2, _b, _c, _d, _e, _f, _g;
|
|
465
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
449
466
|
const limitedData = discount == null ? void 0 : discount.limited_relation_product_data;
|
|
450
467
|
const _tempVar = (flatItem == null ? void 0 : flatItem.type) === "bundle" ? flatItem == null ? void 0 : flatItem.parentProduct : flatItem == null ? void 0 : flatItem.product;
|
|
451
468
|
const isHolderMatch = this.checkHolderMatch(
|
|
@@ -480,6 +497,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
480
497
|
discount: {
|
|
481
498
|
discount_card_type: (_g = discount == null ? void 0 : discount.metadata) == null ? void 0 : _g.discount_card_type,
|
|
482
499
|
fixed_amount: product.price,
|
|
500
|
+
discount_calculation_mode: (_h = discount == null ? void 0 : discount.metadata) == null ? void 0 : _h.discount_calculation_mode,
|
|
483
501
|
resource_id: discount.id,
|
|
484
502
|
title: discount.format_title,
|
|
485
503
|
original_amount: product.price || product.origin_total,
|
|
@@ -498,7 +516,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
498
516
|
});
|
|
499
517
|
const processedFlatItemsMap = /* @__PURE__ */ new Map();
|
|
500
518
|
sortedFlattenedList.forEach((flatItem, index) => {
|
|
501
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
519
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
|
|
502
520
|
let product, originProduct;
|
|
503
521
|
if (flatItem.type === "main") {
|
|
504
522
|
product = flatItem.product;
|
|
@@ -811,6 +829,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
811
829
|
discount: {
|
|
812
830
|
discount_card_type: (_w = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _w.discount_card_type,
|
|
813
831
|
fixed_amount: actualDiscountAmount,
|
|
832
|
+
discount_calculation_mode: (_x = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _x.discount_calculation_mode,
|
|
814
833
|
resource_id: selectedDiscount2.id,
|
|
815
834
|
title: selectedDiscount2.format_title,
|
|
816
835
|
original_amount: product.price,
|
|
@@ -891,6 +910,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
891
910
|
type: "good_pass",
|
|
892
911
|
discount: {
|
|
893
912
|
fixed_amount: product.origin_total,
|
|
913
|
+
discount_calculation_mode: (_y = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _y.discount_calculation_mode,
|
|
894
914
|
resource_id: selectedDiscount2.id,
|
|
895
915
|
title: selectedDiscount2.format_title,
|
|
896
916
|
original_amount: product.origin_total,
|
|
@@ -959,13 +979,15 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
959
979
|
);
|
|
960
980
|
fixedAmountPerItem = new import_decimal.default(productOriginTotal).minus(targetProductTotal).toNumber();
|
|
961
981
|
}
|
|
982
|
+
debugger;
|
|
962
983
|
const uniqueId = flatItem._id;
|
|
963
984
|
const discountDetail = {
|
|
964
985
|
amount: fixedAmountPerItem * (product.num || 1),
|
|
965
986
|
type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
|
|
966
987
|
discount: {
|
|
967
|
-
discount_card_type: (
|
|
988
|
+
discount_card_type: (_z = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _z.discount_card_type,
|
|
968
989
|
fixed_amount: fixedAmountPerItem,
|
|
990
|
+
discount_calculation_mode: (_A = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _A.discount_calculation_mode,
|
|
969
991
|
resource_id: selectedDiscount2.id,
|
|
970
992
|
title: selectedDiscount2.format_title,
|
|
971
993
|
original_amount: product.original_price,
|
|
@@ -981,7 +1003,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
981
1003
|
...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
|
|
982
1004
|
},
|
|
983
1005
|
config: selectedDiscount2 == null ? void 0 : selectedDiscount2.config,
|
|
984
|
-
_num: (product.num || 1) * (((
|
|
1006
|
+
_num: (product.num || 1) * (((_B = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _B.num) || 1)
|
|
985
1007
|
};
|
|
986
1008
|
const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
|
|
987
1009
|
appliedProducts.push(discountDetail);
|
|
@@ -308,7 +308,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
308
308
|
date: string;
|
|
309
309
|
status: string;
|
|
310
310
|
week: string;
|
|
311
|
-
weekNum: 0 | 2 | 1 | 3 |
|
|
311
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
312
312
|
}[]>;
|
|
313
313
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
314
314
|
private getScheduleDataByIds;
|
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|
|
@@ -62,7 +62,7 @@ var getDiscountAmount = (discount, total, price) => {
|
|
|
62
62
|
} else {
|
|
63
63
|
const isFixedAmount = ((_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a.discount_card_type) === "fixed_amount";
|
|
64
64
|
if (isFixedAmount) {
|
|
65
|
-
discountedPrice = Math.max(new import_decimal.default(price).minus(new import_decimal.default(discount.amount || 0)).toNumber(), 0);
|
|
65
|
+
discountedPrice = Math.max(new import_decimal.default(price).minus(new import_decimal.default((discount.amount ?? discount.par_value) || 0)).toNumber(), 0);
|
|
66
66
|
} else {
|
|
67
67
|
discountedPrice = new import_decimal.default(100).minus(discount.par_value || 0).div(100).mul(new import_decimal.default(price)).toNumber();
|
|
68
68
|
}
|