@pisell/pisellos 1.0.18 → 1.0.20
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.
|
@@ -424,14 +424,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
424
424
|
var appliedProducts = appliedDiscountProducts.get(_selectedDiscount.id) || [];
|
|
425
425
|
|
|
426
426
|
// 计算使用折扣卡/商品券以后,单个商品的总 total
|
|
427
|
-
var targetProductTotal = _selectedDiscount.tag === 'good_pass' ? new Decimal(product.
|
|
427
|
+
var targetProductTotal = _selectedDiscount.tag === 'good_pass' ? new Decimal(product.origin_total || 0).minus(new Decimal(product.price || 0)).toNumber() : new Decimal(100).minus(_selectedDiscount.par_value || 0).div(100).mul(new Decimal(product.origin_total || 0)).toNumber();
|
|
428
428
|
var discountDetail = {
|
|
429
|
-
amount: new Decimal(product.
|
|
429
|
+
amount: new Decimal(product.origin_total || 0).minus(new Decimal(targetProductTotal)).toNumber(),
|
|
430
430
|
type: _selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount.tag,
|
|
431
431
|
discount: {
|
|
432
432
|
resource_id: _selectedDiscount.id,
|
|
433
433
|
title: _selectedDiscount.format_title,
|
|
434
|
-
original_amount: product.
|
|
434
|
+
original_amount: product.origin_total,
|
|
435
435
|
product_id: originProduct.id,
|
|
436
436
|
percent: _selectedDiscount.par_value
|
|
437
437
|
},
|
|
@@ -293,14 +293,14 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
293
293
|
const selectedDiscount2 = applicableDiscounts[i2];
|
|
294
294
|
usedDiscounts.set(selectedDiscount2.id, true);
|
|
295
295
|
const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
|
|
296
|
-
const targetProductTotal = selectedDiscount2.tag === "good_pass" ? new import_decimal.default(product.
|
|
296
|
+
const targetProductTotal = selectedDiscount2.tag === "good_pass" ? new import_decimal.default(product.origin_total || 0).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(product.origin_total || 0)).toNumber();
|
|
297
297
|
const discountDetail = {
|
|
298
|
-
amount: new import_decimal.default(product.
|
|
298
|
+
amount: new import_decimal.default(product.origin_total || 0).minus(new import_decimal.default(targetProductTotal)).toNumber(),
|
|
299
299
|
type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
|
|
300
300
|
discount: {
|
|
301
301
|
resource_id: selectedDiscount2.id,
|
|
302
302
|
title: selectedDiscount2.format_title,
|
|
303
|
-
original_amount: product.
|
|
303
|
+
original_amount: product.origin_total,
|
|
304
304
|
product_id: originProduct.id,
|
|
305
305
|
percent: selectedDiscount2.par_value
|
|
306
306
|
},
|