@pisell/pisellos 0.0.154 → 0.0.156
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.
|
@@ -107,6 +107,18 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// 编辑商品已有商品券
|
|
111
|
+
if (productList.every(function (item) {
|
|
112
|
+
var _item$discount_list;
|
|
113
|
+
return item.booking_id && ((_item$discount_list = item.discount_list) === null || _item$discount_list === void 0 ? void 0 : _item$discount_list.length);
|
|
114
|
+
})) {
|
|
115
|
+
return {
|
|
116
|
+
isAvailable: false,
|
|
117
|
+
discountList: oldDiscountList,
|
|
118
|
+
productList: productList
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
110
122
|
// 合并新旧折扣列表,并计算折扣结果
|
|
111
123
|
var mergedDiscountList = uniqueById(uniqueById([].concat(_toConsumableArray(oldDiscountList), _toConsumableArray(newDiscountList))), 'product_id');
|
|
112
124
|
var result = this.calcDiscount({
|
|
@@ -501,10 +501,10 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
501
501
|
var isAllProductUsed = (_item$applicableProdu = item.applicableProductIds) === null || _item$applicableProdu === void 0 ? void 0 : _item$applicableProdu.every(function (id) {
|
|
502
502
|
return allUsedProductIds === null || allUsedProductIds === void 0 ? void 0 : allUsedProductIds.includes(id);
|
|
503
503
|
});
|
|
504
|
-
var isAllProductFree = (_item$applicableProdu2 = item.applicableProductIds) === null || _item$applicableProdu2 === void 0 ? void 0 : _item$applicableProdu2.every(function (
|
|
504
|
+
var isAllProductFree = (_item$applicableProdu2 = item.applicableProductIds) === null || _item$applicableProdu2 === void 0 ? void 0 : _item$applicableProdu2.every(function (id) {
|
|
505
505
|
var _this3$hooks2;
|
|
506
506
|
var targetProduct = productList.find(function (n) {
|
|
507
|
-
return n.id ===
|
|
507
|
+
return n.id === id;
|
|
508
508
|
});
|
|
509
509
|
var product = (_this3$hooks2 = _this3.hooks) === null || _this3$hooks2 === void 0 ? void 0 : _this3$hooks2.getProduct(targetProduct);
|
|
510
510
|
return Number(product === null || product === void 0 ? void 0 : product.price) === 0;
|
|
@@ -69,6 +69,16 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
69
69
|
productList
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
+
if (productList.every((item) => {
|
|
73
|
+
var _a;
|
|
74
|
+
return item.booking_id && ((_a = item.discount_list) == null ? void 0 : _a.length);
|
|
75
|
+
})) {
|
|
76
|
+
return {
|
|
77
|
+
isAvailable: false,
|
|
78
|
+
discountList: oldDiscountList,
|
|
79
|
+
productList
|
|
80
|
+
};
|
|
81
|
+
}
|
|
72
82
|
const mergedDiscountList = (0, import_utils.uniqueById)((0, import_utils.uniqueById)([
|
|
73
83
|
...oldDiscountList,
|
|
74
84
|
...newDiscountList
|
|
@@ -345,9 +345,9 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
345
345
|
const isAllProductUsed = (_a2 = item.applicableProductIds) == null ? void 0 : _a2.every((id) => {
|
|
346
346
|
return allUsedProductIds == null ? void 0 : allUsedProductIds.includes(id);
|
|
347
347
|
});
|
|
348
|
-
const isAllProductFree = (_b = item.applicableProductIds) == null ? void 0 : _b.every((
|
|
348
|
+
const isAllProductFree = (_b = item.applicableProductIds) == null ? void 0 : _b.every((id) => {
|
|
349
349
|
var _a3;
|
|
350
|
-
const targetProduct = productList.find((
|
|
350
|
+
const targetProduct = productList.find((n) => n.id === id);
|
|
351
351
|
const product = (_a3 = this.hooks) == null ? void 0 : _a3.getProduct(targetProduct);
|
|
352
352
|
return Number(product == null ? void 0 : product.price) === 0;
|
|
353
353
|
});
|