@pisell/pisellos 0.0.264 → 0.0.265
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.
|
@@ -316,7 +316,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
316
316
|
|
|
317
317
|
// 判断优惠券是否适用于该商品
|
|
318
318
|
if (isAvailableProduct && isLimitedProduct) {
|
|
319
|
-
var _discountApplicabilit;
|
|
319
|
+
var _discountApplicabilit, _discount$metadata;
|
|
320
320
|
// 记录此优惠券适用的商品
|
|
321
321
|
(_discountApplicabilit = discountApplicability.get(discount.id)) === null || _discountApplicabilit === void 0 || _discountApplicabilit.push(product.id);
|
|
322
322
|
|
|
@@ -328,6 +328,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
328
328
|
type: discountType,
|
|
329
329
|
tag: discountType,
|
|
330
330
|
discount: {
|
|
331
|
+
discount_card_type: discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.discount_card_type,
|
|
331
332
|
resource_id: discount.id,
|
|
332
333
|
title: discount.format_title,
|
|
333
334
|
original_amount: product.origin_total,
|
|
@@ -469,7 +470,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
469
470
|
}));
|
|
470
471
|
}
|
|
471
472
|
for (var _i = 0; _i < splitCount; _i++) {
|
|
472
|
-
var _product$discount_lis12, _originProduct$_produ;
|
|
473
|
+
var _product$discount_lis12, _originProduct$_produ, _selectedDiscount$met;
|
|
473
474
|
// 如果用过折扣卡,也就不存在拆分的情况了,这里直接使用上面计算出来的折扣卡
|
|
474
475
|
var _selectedDiscount = selectedDiscountCard || applicableDiscounts[_i];
|
|
475
476
|
// 标记优惠券为已使用
|
|
@@ -496,6 +497,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
496
497
|
amount: new Decimal(productOriginTotal).minus(new Decimal(targetProductTotal)).toNumber(),
|
|
497
498
|
type: discountType,
|
|
498
499
|
discount: {
|
|
500
|
+
discount_card_type: _selectedDiscount === null || _selectedDiscount === void 0 || (_selectedDiscount$met = _selectedDiscount.metadata) === null || _selectedDiscount$met === void 0 ? void 0 : _selectedDiscount$met.discount_card_type,
|
|
499
501
|
resource_id: _selectedDiscount.id,
|
|
500
502
|
title: _selectedDiscount.format_title,
|
|
501
503
|
original_amount: productOriginTotal,
|
|
@@ -198,7 +198,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
198
198
|
sortedProductList.forEach((originProduct) => {
|
|
199
199
|
const product = this.hooks.getProduct(originProduct);
|
|
200
200
|
addModeDiscount.forEach((discount) => {
|
|
201
|
-
var _a, _b, _c;
|
|
201
|
+
var _a, _b, _c, _d;
|
|
202
202
|
const limitedData = discount == null ? void 0 : discount.limited_relation_product_data;
|
|
203
203
|
const isLimitedProduct = limitedData.type === "product_all" || limitedData.product_ids && limitedData.product_ids.includes(product.id);
|
|
204
204
|
const isAvailableProduct = !((product == null ? void 0 : product.booking_id) && ((_a = product == null ? void 0 : product.discount_list) == null ? void 0 : _a.length) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.every((discount2) => discount2.id && ["good_pass", "discount_card", "product_discount_card"].includes(discount2.tag || discount2.type))));
|
|
@@ -211,6 +211,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
211
211
|
type: discountType,
|
|
212
212
|
tag: discountType,
|
|
213
213
|
discount: {
|
|
214
|
+
discount_card_type: (_d = discount == null ? void 0 : discount.metadata) == null ? void 0 : _d.discount_card_type,
|
|
214
215
|
resource_id: discount.id,
|
|
215
216
|
title: discount.format_title,
|
|
216
217
|
original_amount: product.origin_total,
|
|
@@ -228,7 +229,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
228
229
|
});
|
|
229
230
|
console.log(sortedProductList, "sortedProductListsortedProductList");
|
|
230
231
|
sortedProductList.forEach((originProduct, i) => {
|
|
231
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
232
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
232
233
|
const product = this.hooks.getProduct(originProduct);
|
|
233
234
|
if ((product == null ? void 0 : product.booking_id) && ((_a = product.discount_list) == null ? void 0 : _a.length) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.every((discount) => discount.id && ["good_pass", "discount_card", "product_discount_card"].includes(discount.tag || discount.type)))) {
|
|
234
235
|
processedProductsMap.set(product._id, [originProduct]);
|
|
@@ -344,6 +345,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
344
345
|
amount: new import_decimal.default(productOriginTotal).minus(new import_decimal.default(targetProductTotal)).toNumber(),
|
|
345
346
|
type: discountType,
|
|
346
347
|
discount: {
|
|
348
|
+
discount_card_type: (_j = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _j.discount_card_type,
|
|
347
349
|
resource_id: selectedDiscount2.id,
|
|
348
350
|
title: selectedDiscount2.format_title,
|
|
349
351
|
original_amount: productOriginTotal,
|