@pisell/pisellos 1.0.30 → 1.0.31
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.
|
@@ -432,7 +432,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
432
432
|
|
|
433
433
|
// 记录实际应用了优惠券的商品信息
|
|
434
434
|
var appliedProducts = appliedDiscountProducts.get(_selectedDiscount.id) || [];
|
|
435
|
+
|
|
436
|
+
// 优先从 origin_total拿,可能会拿不到(比如用户端预约在没有配置 original_price 的情况下)
|
|
435
437
|
var productOriginTotal = product.origin_total || product.total || 0;
|
|
438
|
+
// 如果 origin_total 有值,并且 product.total 有值,并且他俩还不一样,则优先使用 product.total
|
|
439
|
+
// 因为用户端会涉及到划线价的概念
|
|
440
|
+
if (product.origin_total && product.total && product.origin_total !== product.total) {
|
|
441
|
+
productOriginTotal = product.total;
|
|
442
|
+
}
|
|
436
443
|
|
|
437
444
|
// 计算使用折扣卡/商品券以后,单个商品的总 total
|
|
438
445
|
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();
|
|
@@ -297,7 +297,10 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
297
297
|
const selectedDiscount2 = selectedDiscountCard || applicableDiscounts[i2];
|
|
298
298
|
usedDiscounts.set(selectedDiscount2.id, true);
|
|
299
299
|
const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
|
|
300
|
-
|
|
300
|
+
let productOriginTotal = product.origin_total || product.total || 0;
|
|
301
|
+
if (product.origin_total && product.total && product.origin_total !== product.total) {
|
|
302
|
+
productOriginTotal = product.total;
|
|
303
|
+
}
|
|
301
304
|
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();
|
|
302
305
|
const discountDetail = {
|
|
303
306
|
amount: new import_decimal.default(productOriginTotal).minus(new import_decimal.default(targetProductTotal)).toNumber(),
|