@pisell/pisellos 3.0.46 → 3.0.47
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.
|
@@ -429,7 +429,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
429
429
|
}));
|
|
430
430
|
}
|
|
431
431
|
for (var _i = 0; _i < splitCount; _i++) {
|
|
432
|
-
var
|
|
432
|
+
var _product$discount_lis11, _originProduct$_produ;
|
|
433
433
|
// 如果用过折扣卡,也就不存在拆分的情况了,这里直接使用上面计算出来的折扣卡
|
|
434
434
|
var _selectedDiscount = selectedDiscountCard || applicableDiscounts[_i];
|
|
435
435
|
// 标记优惠券为已使用
|
|
@@ -440,14 +440,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
440
440
|
|
|
441
441
|
// 优先从 origin_total拿,可能会拿不到(比如用户端预约在没有配置 original_price 的情况下)
|
|
442
442
|
var productOriginTotal = product.origin_total || product.total || 0;
|
|
443
|
+
// 如果当前 product 有 discount_list,则先从 origin_total 拿
|
|
444
|
+
if ((_product$discount_lis11 = product.discount_list) !== null && _product$discount_lis11 !== void 0 && _product$discount_lis11.length && product.origin_total) {
|
|
445
|
+
productOriginTotal = product.origin_total;
|
|
446
|
+
}
|
|
443
447
|
// 如果originProduct?._productInit?.original_price为 0,product.origin_total可能为空,此时取 product.total
|
|
444
448
|
if (Number((originProduct === null || originProduct === void 0 || (_originProduct$_produ = originProduct._productInit) === null || _originProduct$_produ === void 0 ? void 0 : _originProduct$_produ.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
|
|
445
449
|
productOriginTotal = product.total;
|
|
446
450
|
}
|
|
447
|
-
// 如果当前 product 有 discount_list,则必须从 origin_total 拿
|
|
448
|
-
if ((_product$discount_lis11 = product.discount_list) !== null && _product$discount_lis11 !== void 0 && _product$discount_lis11.length && product.origin_total) {
|
|
449
|
-
productOriginTotal = product.origin_total;
|
|
450
|
-
}
|
|
451
451
|
|
|
452
452
|
// 计算使用折扣卡/商品券以后,单个商品的总 total
|
|
453
453
|
var targetProductTotal = _selectedDiscount.tag === 'good_pass' ? new Decimal(productOriginTotal).minus(new Decimal(product.price || 0)).toNumber() : new Decimal(100).minus(_selectedDiscount.par_value || 0).div(100).mul(new Decimal(productOriginTotal)).toNumber();
|
|
@@ -302,12 +302,12 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
302
302
|
usedDiscounts.set(selectedDiscount2.id, true);
|
|
303
303
|
const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
|
|
304
304
|
let productOriginTotal = product.origin_total || product.total || 0;
|
|
305
|
-
if (
|
|
306
|
-
productOriginTotal = product.total;
|
|
307
|
-
}
|
|
308
|
-
if (((_h = product.discount_list) == null ? void 0 : _h.length) && product.origin_total) {
|
|
305
|
+
if (((_g = product.discount_list) == null ? void 0 : _g.length) && product.origin_total) {
|
|
309
306
|
productOriginTotal = product.origin_total;
|
|
310
307
|
}
|
|
308
|
+
if (Number(((_h = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _h.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
|
|
309
|
+
productOriginTotal = product.total;
|
|
310
|
+
}
|
|
311
311
|
const targetProductTotal = selectedDiscount2.tag === "good_pass" ? new import_decimal.default(productOriginTotal).minus(new import_decimal.default(product.price || 0)).toNumber() : new import_decimal.default(100).minus(selectedDiscount2.par_value || 0).div(100).mul(new import_decimal.default(productOriginTotal)).toNumber();
|
|
312
312
|
const discountDetail = {
|
|
313
313
|
amount: new import_decimal.default(productOriginTotal).minus(new import_decimal.default(targetProductTotal)).toNumber(),
|