@pisell/pisellos 2.0.66 → 2.0.67

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.
@@ -297,19 +297,25 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
297
297
 
298
298
  // 记录可抵扣的商品详情
299
299
  var applicableProducts = discountApplicableProducts.get(discount.id) || [];
300
- applicableProducts.push({
300
+ var discountType = discount.tag || discount.type;
301
+ var productData = {
301
302
  amount: product.price,
302
- type: discount.tag || discount.type,
303
- tag: discount.tag || discount.type,
303
+ type: discountType,
304
+ tag: discountType,
304
305
  discount: {
305
306
  resource_id: discount.id,
306
307
  title: discount.format_title,
307
308
  original_amount: product.origin_total,
308
309
  pre_value: discount.par_value,
309
310
  product_id: originProduct.id
310
- },
311
- num: product.num || 1
312
- });
311
+ }
312
+ };
313
+
314
+ // 如果 discount.tag 或者 discount.type 是 good_pass,则不需要添加 num 属性
315
+ if (discountType !== 'good_pass') {
316
+ productData.num = product.num || 1;
317
+ }
318
+ applicableProducts.push(productData);
313
319
  discountApplicableProducts.set(discount.id, applicableProducts);
314
320
  }
315
321
  });
@@ -451,18 +457,23 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
451
457
 
452
458
  // 计算使用折扣卡/商品券以后,单个商品的总 total
453
459
  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();
460
+ var discountType = _selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount.tag;
454
461
  var discountDetail = {
455
462
  amount: new Decimal(productOriginTotal).minus(new Decimal(targetProductTotal)).toNumber(),
456
- type: _selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount.tag,
463
+ type: discountType,
457
464
  discount: {
458
465
  resource_id: _selectedDiscount.id,
459
466
  title: _selectedDiscount.format_title,
460
467
  original_amount: productOriginTotal,
461
468
  product_id: originProduct.id,
462
469
  percent: _selectedDiscount.par_value
463
- },
464
- num: product.num || 1
470
+ }
465
471
  };
472
+
473
+ // 如果 discount.tag 或者 discount.type 是 good_pass,则不需要添加 num 属性
474
+ if ((_selectedDiscount.tag || _selectedDiscount.type) !== 'good_pass') {
475
+ discountDetail.num = product.num || 1;
476
+ }
466
477
  appliedProducts.push(discountDetail);
467
478
  appliedDiscountProducts.set(_selectedDiscount.id, appliedProducts);
468
479
 
@@ -111,7 +111,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
111
111
  * 获取当前的客户搜索条件
112
112
  * @returns 当前搜索条件
113
113
  */
114
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
114
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
115
115
  /**
116
116
  * 获取客户列表状态(包含滚动加载相关状态)
117
117
  * @returns 客户状态
@@ -189,19 +189,23 @@ var RulesModule = class extends import_BaseModule.BaseModule {
189
189
  if (isAvailableProduct && isLimitedProduct) {
190
190
  (_c = discountApplicability.get(discount.id)) == null ? void 0 : _c.push(product.id);
191
191
  const applicableProducts = discountApplicableProducts.get(discount.id) || [];
192
- applicableProducts.push({
192
+ const discountType = discount.tag || discount.type;
193
+ const productData = {
193
194
  amount: product.price,
194
- type: discount.tag || discount.type,
195
- tag: discount.tag || discount.type,
195
+ type: discountType,
196
+ tag: discountType,
196
197
  discount: {
197
198
  resource_id: discount.id,
198
199
  title: discount.format_title,
199
200
  original_amount: product.origin_total,
200
201
  pre_value: discount.par_value,
201
202
  product_id: originProduct.id
202
- },
203
- num: product.num || 1
204
- });
203
+ }
204
+ };
205
+ if (discountType !== "good_pass") {
206
+ productData.num = product.num || 1;
207
+ }
208
+ applicableProducts.push(productData);
205
209
  discountApplicableProducts.set(discount.id, applicableProducts);
206
210
  }
207
211
  });
@@ -310,18 +314,21 @@ var RulesModule = class extends import_BaseModule.BaseModule {
310
314
  productOriginTotal = product.total;
311
315
  }
312
316
  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();
317
+ const discountType = selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag;
313
318
  const discountDetail = {
314
319
  amount: new import_decimal.default(productOriginTotal).minus(new import_decimal.default(targetProductTotal)).toNumber(),
315
- type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
320
+ type: discountType,
316
321
  discount: {
317
322
  resource_id: selectedDiscount2.id,
318
323
  title: selectedDiscount2.format_title,
319
324
  original_amount: productOriginTotal,
320
325
  product_id: originProduct.id,
321
326
  percent: selectedDiscount2.par_value
322
- },
323
- num: product.num || 1
327
+ }
324
328
  };
329
+ if ((selectedDiscount2.tag || selectedDiscount2.type) !== "good_pass") {
330
+ discountDetail.num = product.num || 1;
331
+ }
325
332
  appliedProducts.push(discountDetail);
326
333
  appliedDiscountProducts.set(selectedDiscount2.id, appliedProducts);
327
334
  if (product.isClient) {
@@ -111,7 +111,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
111
111
  * 获取当前的客户搜索条件
112
112
  * @returns 当前搜索条件
113
113
  */
114
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
114
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
115
115
  /**
116
116
  * 获取客户列表状态(包含滚动加载相关状态)
117
117
  * @returns 客户状态
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.0.66",
4
+ "version": "2.0.67",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",