@pisell/pisellos 0.0.173 → 0.0.175
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.
|
@@ -328,7 +328,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
328
328
|
// 找到适用于此商品的所有优惠券,仅考虑isSelected不为false的优惠券
|
|
329
329
|
var applicableDiscounts = sortedDiscountList.filter(function (discount) {
|
|
330
330
|
// 如果商品价格为 0,其实不需要使用任何优惠券,直接 return true
|
|
331
|
-
if (Number(product.price) === 0 || !product.price) return false;
|
|
331
|
+
if (Number(product.price) === 0 && discount.tag === 'good_pass' || Number(product.total) === 0 && discount.tag !== 'good_pass' || !product.price) return false;
|
|
332
332
|
// 如果优惠券已被使用,则跳过
|
|
333
333
|
var targetUsedDiscounts = usedDiscounts.get(discount.id);
|
|
334
334
|
if (targetUsedDiscounts && (discount.tag || discount.type) === 'good_pass') return false;
|
|
@@ -420,6 +420,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
420
420
|
|
|
421
421
|
// 记录实际应用了优惠券的商品信息
|
|
422
422
|
var appliedProducts = appliedDiscountProducts.get(_selectedDiscount.id) || [];
|
|
423
|
+
|
|
424
|
+
// 优先从 origin_total拿,可能会拿不到(比如用户端预约在没有配置 original_price 的情况下)
|
|
423
425
|
var productOriginTotal = product.origin_total || product.total || 0;
|
|
424
426
|
|
|
425
427
|
// 计算使用折扣卡/商品券以后,单个商品的总 total
|
|
@@ -504,7 +504,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
504
504
|
return n.id === id;
|
|
505
505
|
});
|
|
506
506
|
var product = (_this3$hooks2 = _this3.hooks) === null || _this3$hooks2 === void 0 ? void 0 : _this3$hooks2.getProduct(targetProduct);
|
|
507
|
-
return Number(product === null || product === void 0 ? void 0 : product.
|
|
507
|
+
return Number(product === null || product === void 0 ? void 0 : product.total) === 0;
|
|
508
508
|
};
|
|
509
509
|
var isAllProductUsedOrFree = (_item$applicableProdu = item.applicableProductIds) === null || _item$applicableProdu === void 0 ? void 0 : _item$applicableProdu.every(function (id) {
|
|
510
510
|
var _item$applicableProdu2;
|
|
@@ -213,7 +213,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
215
|
const applicableDiscounts = sortedDiscountList.filter((discount) => {
|
|
216
|
-
if (Number(product.price) === 0 || !product.price)
|
|
216
|
+
if (Number(product.price) === 0 && discount.tag === "good_pass" || Number(product.total) === 0 && discount.tag !== "good_pass" || !product.price)
|
|
217
217
|
return false;
|
|
218
218
|
const targetUsedDiscounts = usedDiscounts.get(discount.id);
|
|
219
219
|
if (targetUsedDiscounts && (discount.tag || discount.type) === "good_pass")
|
|
@@ -346,7 +346,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
346
346
|
var _a3;
|
|
347
347
|
const targetProduct = productList.find((n) => n.id === id);
|
|
348
348
|
const product = (_a3 = this.hooks) == null ? void 0 : _a3.getProduct(targetProduct);
|
|
349
|
-
return Number(product == null ? void 0 : product.
|
|
349
|
+
return Number(product == null ? void 0 : product.total) === 0;
|
|
350
350
|
};
|
|
351
351
|
const isAllProductUsedOrFree = (_a2 = item.applicableProductIds) == null ? void 0 : _a2.every((id) => {
|
|
352
352
|
var _a3;
|