@pisell/pisellos 0.0.391 → 0.0.392
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/index.js +1 -1
- package/dist/modules/Rules/index.js +2 -2
- package/dist/modules/Summary/utils.js +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/ShopDiscount/index.js +4 -3
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Rules/index.js +4 -4
- package/lib/modules/Summary/utils.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/ShopDiscount/index.js +6 -6
- package/package.json +1 -1
|
@@ -301,7 +301,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
301
301
|
return discount.appliedProductDetails.reduce(function (total, product) {
|
|
302
302
|
var _product$discount, _product$metadata;
|
|
303
303
|
var price = new Decimal((product === null || product === void 0 || (_product$discount = product.discount) === null || _product$discount === void 0 ? void 0 : _product$discount.fixed_amount) || 0).mul((product === null || product === void 0 ? void 0 : product._num) || 1);
|
|
304
|
-
return new Decimal(total).plus(price).
|
|
304
|
+
return new Decimal(total).plus(price).add((product === null || product === void 0 || (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.product_discount_difference) || 0).toNumber();
|
|
305
305
|
}, 0);
|
|
306
306
|
}
|
|
307
307
|
}
|
|
@@ -1045,7 +1045,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1045
1045
|
metadata: _objectSpread({
|
|
1046
1046
|
num: 1
|
|
1047
1047
|
}, productDiscountDifference !== undefined && {
|
|
1048
|
-
product_discount_difference:
|
|
1048
|
+
product_discount_difference: productDiscountDifference
|
|
1049
1049
|
})
|
|
1050
1050
|
};
|
|
1051
1051
|
appliedProducts.push(discountDetail);
|
|
@@ -1214,7 +1214,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1214
1214
|
custom_product_bundle_map_id: _uniqueId,
|
|
1215
1215
|
num: product.num || 1
|
|
1216
1216
|
}, _productDiscountDifference !== undefined && {
|
|
1217
|
-
product_discount_difference:
|
|
1217
|
+
product_discount_difference: _productDiscountDifference
|
|
1218
1218
|
}),
|
|
1219
1219
|
config: _selectedDiscount3 === null || _selectedDiscount3 === void 0 ? void 0 : _selectedDiscount3.config,
|
|
1220
1220
|
_num: (product.num || 1) * ((flatItem === null || flatItem === void 0 || (_flatItem$parentProdu7 = flatItem.parentProduct) === null || _flatItem$parentProdu7 === void 0 ? void 0 : _flatItem$parentProdu7.num) || 1)
|
|
@@ -69,7 +69,7 @@ export var calculateSubtotal = function calculateSubtotal(items) {
|
|
|
69
69
|
var subtotal = items.reduce(function (sum, item) {
|
|
70
70
|
var cartItemTotalPrice = new Decimal(item.summaryTotal || 0);
|
|
71
71
|
var productDiscountProductDiscountDifference = getProductDiscountProductDiscountDifference(item);
|
|
72
|
-
return sum.plus(cartItemTotalPrice).
|
|
72
|
+
return sum.plus(cartItemTotalPrice).sub(productDiscountProductDiscountDifference);
|
|
73
73
|
}, new Decimal(0));
|
|
74
74
|
return subtotal.toFixed(2);
|
|
75
75
|
};
|
|
@@ -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 |
|
|
311
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
312
312
|
}[]>;
|
|
313
313
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
314
314
|
private getScheduleDataByIds;
|
|
@@ -576,12 +576,13 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
576
576
|
return n.id === (((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id);
|
|
577
577
|
});
|
|
578
578
|
if (index !== -1) {
|
|
579
|
+
var _discount$metadata;
|
|
579
580
|
editModeDiscountList[index] = _objectSpread(_objectSpread({}, editModeDiscountList[index]), {}, {
|
|
580
581
|
amount: new Decimal(discount.amount || 0).plus(new Decimal(editModeDiscountList[index].amount || 0)).toNumber(),
|
|
581
|
-
savedAmount: new Decimal(discount.amount || 0).times((product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.num) || 1).plus(new Decimal(editModeDiscountList[index].savedAmount || 0)).toNumber()
|
|
582
|
+
savedAmount: new Decimal(discount.amount || 0).times((product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.num) || 1).plus((discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.product_discount_difference) || 0).plus(new Decimal(editModeDiscountList[index].savedAmount || 0)).toNumber()
|
|
582
583
|
});
|
|
583
584
|
} else {
|
|
584
|
-
var _discount$discount2, _discount$discount3, _discount$discount4;
|
|
585
|
+
var _discount$metadata2, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
585
586
|
if (discount.type && !discount.tag) {
|
|
586
587
|
discount.tag = discount.type;
|
|
587
588
|
}
|
|
@@ -589,7 +590,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
589
590
|
name: discount.name || discount.discount.title.auto,
|
|
590
591
|
isEditMode: true,
|
|
591
592
|
limited_relation_product_data: {},
|
|
592
|
-
savedAmount: discount.amount
|
|
593
|
+
savedAmount: new Decimal(discount.amount || 0).times((product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.num) || 1).plus((discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.product_discount_difference) || 0).toNumber(),
|
|
593
594
|
isAvailable: true,
|
|
594
595
|
id: ((_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) || discount.id,
|
|
595
596
|
format_title: ((_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.title) || discount.format_title,
|
|
@@ -178,7 +178,7 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
178
178
|
return discount.appliedProductDetails.reduce((total, product) => {
|
|
179
179
|
var _a, _b;
|
|
180
180
|
const price = new import_decimal.default(((_a = product == null ? void 0 : product.discount) == null ? void 0 : _a.fixed_amount) || 0).mul((product == null ? void 0 : product._num) || 1);
|
|
181
|
-
return new import_decimal.default(total).plus(price).
|
|
181
|
+
return new import_decimal.default(total).plus(price).add(((_b = product == null ? void 0 : product.metadata) == null ? void 0 : _b.product_discount_difference) || 0).toNumber();
|
|
182
182
|
}, 0);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -818,8 +818,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
818
818
|
config: selectedDiscount2 == null ? void 0 : selectedDiscount2.config,
|
|
819
819
|
metadata: {
|
|
820
820
|
num: 1,
|
|
821
|
-
// 🔥 order_level 分摊差值
|
|
822
|
-
...productDiscountDifference !== void 0 && { product_discount_difference:
|
|
821
|
+
// 🔥 order_level 分摊差值
|
|
822
|
+
...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
|
|
823
823
|
}
|
|
824
824
|
};
|
|
825
825
|
appliedProducts.push(discountDetail);
|
|
@@ -972,8 +972,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
972
972
|
// 🔥 使用唯一的 _id
|
|
973
973
|
custom_product_bundle_map_id: uniqueId,
|
|
974
974
|
num: product.num || 1,
|
|
975
|
-
// 🔥 order_level 分摊差值
|
|
976
|
-
...productDiscountDifference !== void 0 && { product_discount_difference:
|
|
975
|
+
// 🔥 order_level 分摊差值
|
|
976
|
+
...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
|
|
977
977
|
},
|
|
978
978
|
config: selectedDiscount2 == null ? void 0 : selectedDiscount2.config,
|
|
979
979
|
_num: (product.num || 1) * (((_y = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _y.num) || 1)
|
|
@@ -83,7 +83,7 @@ var calculateSubtotal = (items) => {
|
|
|
83
83
|
const subtotal = items.reduce((sum, item) => {
|
|
84
84
|
const cartItemTotalPrice = new import_decimal.default(item.summaryTotal || 0);
|
|
85
85
|
const productDiscountProductDiscountDifference = getProductDiscountProductDiscountDifference(item);
|
|
86
|
-
return sum.plus(cartItemTotalPrice).
|
|
86
|
+
return sum.plus(cartItemTotalPrice).sub(productDiscountProductDiscountDifference);
|
|
87
87
|
}, new import_decimal.default(0));
|
|
88
88
|
return subtotal.toFixed(2);
|
|
89
89
|
};
|
|
@@ -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 |
|
|
311
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
312
312
|
}[]>;
|
|
313
313
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
314
314
|
private getScheduleDataByIds;
|
|
@@ -375,7 +375,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
375
375
|
if (item.booking_id) {
|
|
376
376
|
const product = (_a2 = this.hooks) == null ? void 0 : _a2.getProduct(item);
|
|
377
377
|
(item.discount_list || []).forEach((discount) => {
|
|
378
|
-
var _a3, _b, _c;
|
|
378
|
+
var _a3, _b, _c, _d, _e;
|
|
379
379
|
if (discount.id && ["good_pass", "discount_card"].includes(discount.type)) {
|
|
380
380
|
const index = editModeDiscountList.findIndex((n) => {
|
|
381
381
|
var _a4;
|
|
@@ -385,7 +385,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
385
385
|
editModeDiscountList[index] = {
|
|
386
386
|
...editModeDiscountList[index],
|
|
387
387
|
amount: new import_decimal.default(discount.amount || 0).plus(new import_decimal.default(editModeDiscountList[index].amount || 0)).toNumber(),
|
|
388
|
-
savedAmount: new import_decimal.default(discount.amount || 0).times((product == null ? void 0 : product.quantity) || (product == null ? void 0 : product.num) || 1).plus(new import_decimal.default(editModeDiscountList[index].savedAmount || 0)).toNumber()
|
|
388
|
+
savedAmount: new import_decimal.default(discount.amount || 0).times((product == null ? void 0 : product.quantity) || (product == null ? void 0 : product.num) || 1).plus(((_a3 = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a3.product_discount_difference) || 0).plus(new import_decimal.default(editModeDiscountList[index].savedAmount || 0)).toNumber()
|
|
389
389
|
};
|
|
390
390
|
} else {
|
|
391
391
|
if (discount.type && !discount.tag) {
|
|
@@ -396,13 +396,13 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
396
396
|
name: discount.name || discount.discount.title.auto,
|
|
397
397
|
isEditMode: true,
|
|
398
398
|
limited_relation_product_data: {},
|
|
399
|
-
savedAmount: discount.amount
|
|
399
|
+
savedAmount: new import_decimal.default(discount.amount || 0).times((product == null ? void 0 : product.quantity) || (product == null ? void 0 : product.num) || 1).plus(((_b = discount == null ? void 0 : discount.metadata) == null ? void 0 : _b.product_discount_difference) || 0).toNumber(),
|
|
400
400
|
isAvailable: true,
|
|
401
|
-
id: ((
|
|
402
|
-
format_title: ((
|
|
401
|
+
id: ((_c = discount.discount) == null ? void 0 : _c.resource_id) || discount.id,
|
|
402
|
+
format_title: ((_d = discount.discount) == null ? void 0 : _d.title) || discount.format_title,
|
|
403
403
|
isDisabled: true,
|
|
404
404
|
isSelected: true,
|
|
405
|
-
product_id: ((
|
|
405
|
+
product_id: ((_e = discount.discount) == null ? void 0 : _e.product_id) || discount.product_id
|
|
406
406
|
});
|
|
407
407
|
}
|
|
408
408
|
}
|