@pisell/pisellos 0.0.477 → 0.0.479

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.
@@ -125,13 +125,14 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
125
125
  return ((_usageMap$get = usageMap.get(walletPassProductId)) === null || _usageMap$get === void 0 ? void 0 : _usageMap$get.get(orderItemProductId)) || 0;
126
126
  };
127
127
 
128
- // 更新指定 Wallet Pass 商品对指定订单商品行的已用卡券次数 +1
128
+ // 更新指定 Wallet Pass 商品对指定订单商品行的已用卡券次数
129
129
  var incrementItemPassUsage = function incrementItemPassUsage(usageMap, walletPassProductId, orderItemProductId) {
130
+ var count = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
130
131
  if (!usageMap.has(walletPassProductId)) {
131
132
  usageMap.set(walletPassProductId, new Map());
132
133
  }
133
134
  var innerMap = usageMap.get(walletPassProductId);
134
- innerMap.set(orderItemProductId, (innerMap.get(orderItemProductId) || 0) + 1);
135
+ innerMap.set(orderItemProductId, (innerMap.get(orderItemProductId) || 0) + count);
135
136
  };
136
137
 
137
138
  // 按 maxPassesPerItem 过滤商品:排除已达到单商品可用卡券上限的商品
@@ -222,12 +223,12 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
222
223
  var maxProduct = applicableProducts.reduce(function (max, p) {
223
224
  return p[amountField].greaterThan(max[amountField]) ? p : max;
224
225
  });
225
- // 动态计算当前可抵扣数量
226
- var _currentAvailableQty = Math.ceil(maxProduct[amountField].dividedBy(maxProduct[unitPriceField]).toNumber());
227
- // 非跨商品券也受 applicableProductLimit 限制
228
- var _deductQty = applicableProductLimit > 0 ? Math.min(_currentAvailableQty, applicableProductLimit) : _currentAvailableQty;
229
- // 实际可抵扣金额 = min(数量 * 单价, 剩余金额)
230
- finalApplicableAmount = Decimal.min(maxProduct[unitPriceField].times(_deductQty), maxProduct[amountField]);
226
+ // maxPassesPerItem 限制每张券最多抵扣的单位数
227
+ if (maxPassesPerItem > 0) {
228
+ finalApplicableAmount = Decimal.min(maxProduct[unitPriceField].times(maxPassesPerItem), maxProduct[amountField]);
229
+ } else {
230
+ finalApplicableAmount = maxProduct[amountField];
231
+ }
231
232
  }
232
233
 
233
234
  // 返回最小值
@@ -427,15 +428,16 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
427
428
  }, new Decimal(0));
428
429
  }
429
430
  } else {
430
- // 非跨商品券:单个剩余金额最高的商品,也受 applicableProductLimit 限制
431
+ // 非跨商品券:单个剩余金额最高的商品
431
432
  var maxProduct = applicableProducts.reduce(function (max, p) {
432
433
  return p[amountField].greaterThan(max[amountField]) ? p : max;
433
434
  });
434
- // 动态计算当前可抵扣数量
435
- var _currentAvailableQty2 = Math.ceil(maxProduct[amountField].dividedBy(maxProduct[unitPriceField]).toNumber());
436
- var _deductQty2 = applicableProductLimit > 0 ? Math.min(_currentAvailableQty2, applicableProductLimit) : _currentAvailableQty2;
437
- // 实际可抵扣金额 = min(数量 * 单价, 剩余金额)
438
- calculatedAvailableMaxAmount = Decimal.min(maxProduct[unitPriceField].times(_deductQty2), maxProduct[amountField]);
435
+ // maxPassesPerItem 限制每张券最多抵扣的单位数
436
+ if (maxPassesPerItem > 0) {
437
+ calculatedAvailableMaxAmount = Decimal.min(maxProduct[unitPriceField].times(maxPassesPerItem), maxProduct[amountField]);
438
+ } else {
439
+ calculatedAvailableMaxAmount = maxProduct[amountField];
440
+ }
439
441
  }
440
442
 
441
443
  // 取最小值:min(recommended_usage_amount, maxDeductionAmount, 适用商品金额, 订单剩余金额)
@@ -460,8 +462,8 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
460
462
  if (deductionLeft.lessThanOrEqualTo(0) || _remainingLimit <= 0) break;
461
463
 
462
464
  // 动态计算当前可抵扣数量 = ceil(剩余金额 / 单价)
463
- var _currentAvailableQty3 = Math.ceil(_product[amountField].dividedBy(_product[unitPriceField]).toNumber());
464
- var availableQty = Math.min(_currentAvailableQty3, _remainingLimit);
465
+ var _currentAvailableQty = Math.ceil(_product[amountField].dividedBy(_product[unitPriceField]).toNumber());
466
+ var availableQty = Math.min(_currentAvailableQty, _remainingLimit);
465
467
 
466
468
  // 计算本商品最大可抵扣金额 = min(数量 * 单价, 剩余金额)
467
469
  var maxDeductForProduct = Decimal.min(_product[unitPriceField].times(availableQty), _product[amountField]);
@@ -489,17 +491,16 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
489
491
  _iterator3.f();
490
492
  }
491
493
  } else {
492
- // 非跨商品券:只抵扣一个商品(剩余金额最高的),也受 applicableProductLimit 限制
494
+ // 非跨商品券:只抵扣一个商品(剩余金额最高的)
493
495
  var targetProduct = applicableProducts.reduce(function (max, p) {
494
496
  return p[amountField].greaterThan(max[amountField]) ? p : max;
495
497
  });
496
498
 
497
- // 动态计算当前可抵扣数量
498
- var _currentAvailableQty4 = Math.ceil(targetProduct[amountField].dividedBy(targetProduct[unitPriceField]).toNumber());
499
- var _availableQty = applicableProductLimit > 0 ? Math.min(_currentAvailableQty4, applicableProductLimit) : _currentAvailableQty4;
500
-
501
- // 计算本商品最大可抵扣金额 = min(数量 * 单价, 剩余金额)
502
- var _maxDeductForProduct = Decimal.min(targetProduct[unitPriceField].times(_availableQty), targetProduct[amountField]);
499
+ // maxPassesPerItem 限制每张券最多抵扣的单位数
500
+ var _maxDeductForProduct = targetProduct[amountField];
501
+ if (maxPassesPerItem > 0) {
502
+ _maxDeductForProduct = Decimal.min(targetProduct[unitPriceField].times(maxPassesPerItem), targetProduct[amountField]);
503
+ }
503
504
  var _actualDeductAmount = Decimal.min(deductionLeft, _maxDeductForProduct);
504
505
 
505
506
  // 计算实际抵扣的数量
@@ -513,8 +514,7 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
513
514
  parent_product_id: targetProduct.parent_product_id || null,
514
515
  is_bundle_item: targetProduct.is_bundle_item || false,
515
516
  deductAmount: _actualDeductAmount.toNumber(),
516
- // 转换为数字
517
- deductQuantity: _actualDeductQty // 抵扣涉及的数量(用于记录)
517
+ deductQuantity: _actualDeductQty
518
518
  });
519
519
  }
520
520
  var totalDeducted = maxDeduction.minus(deductionLeft);
@@ -525,9 +525,9 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
525
525
  // 更新券使用次数(按 product_id 统计)
526
526
  usedVoucherCounts.set(product_id, (usedVoucherCounts.get(product_id) || 0) + 1);
527
527
 
528
- // 更新 maxPassesPerItem 追踪:记录每个被抵扣的商品行
528
+ // 更新 maxPassesPerItem 追踪:按实际抵扣数量递增
529
529
  deductionDetails.forEach(function (detail) {
530
- incrementItemPassUsage(itemPassUsageMap, product_id, detail.product_id);
530
+ incrementItemPassUsage(itemPassUsageMap, product_id, detail.product_id, detail.deductQuantity);
531
531
  });
532
532
 
533
533
  // 添加到推荐列表(包含基于当前剩余金额计算的 available_max_amount)
@@ -619,11 +619,12 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
619
619
  return ((_itemPassUsageMap$get = itemPassUsageMap.get(walletPassProductId)) === null || _itemPassUsageMap$get === void 0 ? void 0 : _itemPassUsageMap$get.get(orderItemProductId)) || 0;
620
620
  };
621
621
  var incrementItemPassUsage = function incrementItemPassUsage(walletPassProductId, orderItemProductId) {
622
+ var count = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
622
623
  if (!itemPassUsageMap.has(walletPassProductId)) {
623
624
  itemPassUsageMap.set(walletPassProductId, new Map());
624
625
  }
625
626
  var innerMap = itemPassUsageMap.get(walletPassProductId);
626
- innerMap.set(orderItemProductId, (innerMap.get(orderItemProductId) || 0) + 1);
627
+ innerMap.set(orderItemProductId, (innerMap.get(orderItemProductId) || 0) + count);
627
628
  };
628
629
  var filterByMaxPassesPerItem = function filterByMaxPassesPerItem(products, walletPassProductId, maxPassesPerItem) {
629
630
  if (maxPassesPerItem <= 0) return products; // 0 = 不限制
@@ -716,17 +717,16 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
716
717
  _iterator4.f();
717
718
  }
718
719
  } else {
719
- // 非跨商品券:只抵扣一个商品(剩余金额最高的),也受 applicableProductLimit 限制
720
+ // 非跨商品券:只抵扣一个商品(剩余金额最高的)
720
721
  var targetProduct = applicableProducts.reduce(function (max, p) {
721
722
  return p[amountField].greaterThan(max[amountField]) ? p : max;
722
723
  });
723
724
 
724
- // 动态计算当前可抵扣数量
725
- var _currentAvailableQty5 = Math.ceil(targetProduct[amountField].dividedBy(targetProduct[unitPriceField]).toNumber());
726
- var _availableQty2 = applicableProductLimit > 0 ? Math.min(_currentAvailableQty5, applicableProductLimit) : _currentAvailableQty5;
727
-
728
- // 计算本商品最大可抵扣金额 = min(数量 * 单价, 剩余金额)
729
- var _maxDeductForProduct2 = Decimal.min(targetProduct[unitPriceField].times(_availableQty2), targetProduct[amountField]);
725
+ // maxPassesPerItem 限制每张券最多抵扣的单位数
726
+ var _maxDeductForProduct2 = targetProduct[amountField];
727
+ if (maxPassesPerItem > 0) {
728
+ _maxDeductForProduct2 = Decimal.min(targetProduct[unitPriceField].times(maxPassesPerItem), targetProduct[amountField]);
729
+ }
730
730
  var _actualDeductAmount2 = Decimal.min(deductionLeft, _maxDeductForProduct2);
731
731
 
732
732
  // 计算实际抵扣的数量
@@ -740,8 +740,7 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
740
740
  parent_product_id: targetProduct.parent_product_id || null,
741
741
  is_bundle_item: targetProduct.is_bundle_item || false,
742
742
  deductAmount: _actualDeductAmount2.toNumber(),
743
- // 转换为数字
744
- deductQuantity: _actualDeductQty2 // 抵扣涉及的数量(用于记录)
743
+ deductQuantity: _actualDeductQty2
745
744
  });
746
745
  }
747
746
  var totalDeducted = maxDeduction.minus(deductionLeft);
@@ -749,9 +748,9 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
749
748
  // 更新订单剩余金额
750
749
  remainingOrderAmount = remainingOrderAmount.minus(totalDeducted);
751
750
 
752
- // 更新 maxPassesPerItem 追踪:记录每个被抵扣的商品行
751
+ // 更新 maxPassesPerItem 追踪:按实际抵扣数量递增
753
752
  deductionDetails.forEach(function (detail) {
754
- incrementItemPassUsage(selectedVoucher.product_id, detail.product_id);
753
+ incrementItemPassUsage(selectedVoucher.product_id, detail.product_id, detail.deductQuantity);
755
754
  });
756
755
  selectedWithDetails.push(_objectSpread(_objectSpread({}, selectedVoucher), {}, {
757
756
  actualDeduction: totalDeducted.toNumber(),
@@ -865,15 +864,16 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
865
864
  }, new Decimal(0));
866
865
  }
867
866
  } else {
868
- // 非跨商品券:单个剩余金额最高的商品,也受 applicableProductLimit 限制
867
+ // 非跨商品券:单个剩余金额最高的商品
869
868
  var maxProduct = applicableProducts.reduce(function (max, p) {
870
869
  return p[amountField].greaterThan(max[amountField]) ? p : max;
871
870
  });
872
- // 动态计算当前可抵扣数量
873
- var _currentAvailableQty6 = Math.ceil(maxProduct[amountField].dividedBy(maxProduct[unitPriceField]).toNumber());
874
- var _deductQty3 = applicableProductLimit > 0 ? Math.min(_currentAvailableQty6, applicableProductLimit) : _currentAvailableQty6;
875
- // 实际可抵扣金额 = min(数量 * 单价, 剩余金额)
876
- calculatedMaxAmount = Decimal.min(maxProduct[unitPriceField].times(_deductQty3), maxProduct[amountField]);
871
+ // maxPassesPerItem 限制每张券最多抵扣的单位数
872
+ if (maxPassesPerItem > 0) {
873
+ calculatedMaxAmount = Decimal.min(maxProduct[unitPriceField].times(maxPassesPerItem), maxProduct[amountField]);
874
+ } else {
875
+ calculatedMaxAmount = maxProduct[amountField];
876
+ }
877
877
  }
878
878
  calculatedMaxAmount = Decimal.min(baseAmount, calculatedMaxAmount, remainingOrderAmount);
879
879
  if (calculatedMaxAmount.lessThanOrEqualTo(0)) {
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
314
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
123
  * 获取当前的客户搜索条件
124
124
  * @returns 当前搜索条件
125
125
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
@@ -94,12 +94,12 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
94
94
  var _a;
95
95
  return ((_a = usageMap.get(walletPassProductId)) == null ? void 0 : _a.get(orderItemProductId)) || 0;
96
96
  };
97
- const incrementItemPassUsage = (usageMap, walletPassProductId, orderItemProductId) => {
97
+ const incrementItemPassUsage = (usageMap, walletPassProductId, orderItemProductId, count = 1) => {
98
98
  if (!usageMap.has(walletPassProductId)) {
99
99
  usageMap.set(walletPassProductId, /* @__PURE__ */ new Map());
100
100
  }
101
101
  const innerMap = usageMap.get(walletPassProductId);
102
- innerMap.set(orderItemProductId, (innerMap.get(orderItemProductId) || 0) + 1);
102
+ innerMap.set(orderItemProductId, (innerMap.get(orderItemProductId) || 0) + count);
103
103
  };
104
104
  const filterByMaxPassesPerItem = (products2, usageMap, walletPassProductId, maxPassesPerItem) => {
105
105
  if (maxPassesPerItem <= 0)
@@ -152,12 +152,14 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
152
152
  const maxProduct = applicableProducts.reduce(
153
153
  (max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
154
154
  );
155
- const currentAvailableQty = Math.ceil(maxProduct[amountField].dividedBy(maxProduct[unitPriceField]).toNumber());
156
- const deductQty = applicableProductLimit > 0 ? Math.min(currentAvailableQty, applicableProductLimit) : currentAvailableQty;
157
- finalApplicableAmount = import_decimal.default.min(
158
- maxProduct[unitPriceField].times(deductQty),
159
- maxProduct[amountField]
160
- );
155
+ if (maxPassesPerItem > 0) {
156
+ finalApplicableAmount = import_decimal.default.min(
157
+ maxProduct[unitPriceField].times(maxPassesPerItem),
158
+ maxProduct[amountField]
159
+ );
160
+ } else {
161
+ finalApplicableAmount = maxProduct[amountField];
162
+ }
161
163
  }
162
164
  return import_decimal.default.min(baseAmount, finalApplicableAmount, remainingOrderAmount);
163
165
  };
@@ -269,12 +271,14 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
269
271
  const maxProduct = applicableProducts.reduce(
270
272
  (max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
271
273
  );
272
- const currentAvailableQty = Math.ceil(maxProduct[amountField].dividedBy(maxProduct[unitPriceField]).toNumber());
273
- const deductQty = applicableProductLimit > 0 ? Math.min(currentAvailableQty, applicableProductLimit) : currentAvailableQty;
274
- calculatedAvailableMaxAmount = import_decimal.default.min(
275
- maxProduct[unitPriceField].times(deductQty),
276
- maxProduct[amountField]
277
- );
274
+ if (maxPassesPerItem > 0) {
275
+ calculatedAvailableMaxAmount = import_decimal.default.min(
276
+ maxProduct[unitPriceField].times(maxPassesPerItem),
277
+ maxProduct[amountField]
278
+ );
279
+ } else {
280
+ calculatedAvailableMaxAmount = maxProduct[amountField];
281
+ }
278
282
  }
279
283
  const availableMaxAmount = import_decimal.default.min(
280
284
  baseAmount,
@@ -320,12 +324,13 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
320
324
  const targetProduct = applicableProducts.reduce(
321
325
  (max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
322
326
  );
323
- const currentAvailableQty = Math.ceil(targetProduct[amountField].dividedBy(targetProduct[unitPriceField]).toNumber());
324
- const availableQty = applicableProductLimit > 0 ? Math.min(currentAvailableQty, applicableProductLimit) : currentAvailableQty;
325
- const maxDeductForProduct = import_decimal.default.min(
326
- targetProduct[unitPriceField].times(availableQty),
327
- targetProduct[amountField]
328
- );
327
+ let maxDeductForProduct = targetProduct[amountField];
328
+ if (maxPassesPerItem > 0) {
329
+ maxDeductForProduct = import_decimal.default.min(
330
+ targetProduct[unitPriceField].times(maxPassesPerItem),
331
+ targetProduct[amountField]
332
+ );
333
+ }
329
334
  const actualDeductAmount = import_decimal.default.min(deductionLeft, maxDeductForProduct);
330
335
  const actualDeductQty = Math.ceil(actualDeductAmount.dividedBy(targetProduct[unitPriceField]).toNumber());
331
336
  targetProduct[amountField] = targetProduct[amountField].minus(actualDeductAmount);
@@ -335,9 +340,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
335
340
  parent_product_id: targetProduct.parent_product_id || null,
336
341
  is_bundle_item: targetProduct.is_bundle_item || false,
337
342
  deductAmount: actualDeductAmount.toNumber(),
338
- // 转换为数字
339
343
  deductQuantity: actualDeductQty
340
- // 抵扣涉及的数量(用于记录)
341
344
  });
342
345
  }
343
346
  const totalDeducted = maxDeduction.minus(deductionLeft);
@@ -345,7 +348,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
345
348
  remainingOrderAmount = remainingOrderAmount.minus(totalDeducted);
346
349
  usedVoucherCounts.set(product_id, (usedVoucherCounts.get(product_id) || 0) + 1);
347
350
  deductionDetails.forEach((detail) => {
348
- incrementItemPassUsage(itemPassUsageMap, product_id, detail.product_id);
351
+ incrementItemPassUsage(itemPassUsageMap, product_id, detail.product_id, detail.deductQuantity);
349
352
  });
350
353
  recommendedVouchers.push({
351
354
  ...voucher,
@@ -393,12 +396,12 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
393
396
  var _a;
394
397
  return ((_a = itemPassUsageMap.get(walletPassProductId)) == null ? void 0 : _a.get(orderItemProductId)) || 0;
395
398
  };
396
- const incrementItemPassUsage = (walletPassProductId, orderItemProductId) => {
399
+ const incrementItemPassUsage = (walletPassProductId, orderItemProductId, count = 1) => {
397
400
  if (!itemPassUsageMap.has(walletPassProductId)) {
398
401
  itemPassUsageMap.set(walletPassProductId, /* @__PURE__ */ new Map());
399
402
  }
400
403
  const innerMap = itemPassUsageMap.get(walletPassProductId);
401
- innerMap.set(orderItemProductId, (innerMap.get(orderItemProductId) || 0) + 1);
404
+ innerMap.set(orderItemProductId, (innerMap.get(orderItemProductId) || 0) + count);
402
405
  };
403
406
  const filterByMaxPassesPerItem = (products2, walletPassProductId, maxPassesPerItem) => {
404
407
  if (maxPassesPerItem <= 0)
@@ -469,12 +472,13 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
469
472
  const targetProduct = applicableProducts.reduce(
470
473
  (max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
471
474
  );
472
- const currentAvailableQty = Math.ceil(targetProduct[amountField].dividedBy(targetProduct[unitPriceField]).toNumber());
473
- const availableQty = applicableProductLimit > 0 ? Math.min(currentAvailableQty, applicableProductLimit) : currentAvailableQty;
474
- const maxDeductForProduct = import_decimal.default.min(
475
- targetProduct[unitPriceField].times(availableQty),
476
- targetProduct[amountField]
477
- );
475
+ let maxDeductForProduct = targetProduct[amountField];
476
+ if (maxPassesPerItem > 0) {
477
+ maxDeductForProduct = import_decimal.default.min(
478
+ targetProduct[unitPriceField].times(maxPassesPerItem),
479
+ targetProduct[amountField]
480
+ );
481
+ }
478
482
  const actualDeductAmount = import_decimal.default.min(deductionLeft, maxDeductForProduct);
479
483
  const actualDeductQty = Math.ceil(actualDeductAmount.dividedBy(targetProduct[unitPriceField]).toNumber());
480
484
  targetProduct[amountField] = targetProduct[amountField].minus(actualDeductAmount);
@@ -484,15 +488,13 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
484
488
  parent_product_id: targetProduct.parent_product_id || null,
485
489
  is_bundle_item: targetProduct.is_bundle_item || false,
486
490
  deductAmount: actualDeductAmount.toNumber(),
487
- // 转换为数字
488
491
  deductQuantity: actualDeductQty
489
- // 抵扣涉及的数量(用于记录)
490
492
  });
491
493
  }
492
494
  const totalDeducted = maxDeduction.minus(deductionLeft);
493
495
  remainingOrderAmount = remainingOrderAmount.minus(totalDeducted);
494
496
  deductionDetails.forEach((detail) => {
495
- incrementItemPassUsage(selectedVoucher.product_id, detail.product_id);
497
+ incrementItemPassUsage(selectedVoucher.product_id, detail.product_id, detail.deductQuantity);
496
498
  });
497
499
  selectedWithDetails.push({
498
500
  ...selectedVoucher,
@@ -578,12 +580,14 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
578
580
  const maxProduct = applicableProducts.reduce(
579
581
  (max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
580
582
  );
581
- const currentAvailableQty = Math.ceil(maxProduct[amountField].dividedBy(maxProduct[unitPriceField]).toNumber());
582
- const deductQty = applicableProductLimit > 0 ? Math.min(currentAvailableQty, applicableProductLimit) : currentAvailableQty;
583
- calculatedMaxAmount = import_decimal.default.min(
584
- maxProduct[unitPriceField].times(deductQty),
585
- maxProduct[amountField]
586
- );
583
+ if (maxPassesPerItem > 0) {
584
+ calculatedMaxAmount = import_decimal.default.min(
585
+ maxProduct[unitPriceField].times(maxPassesPerItem),
586
+ maxProduct[amountField]
587
+ );
588
+ } else {
589
+ calculatedMaxAmount = maxProduct[amountField];
590
+ }
587
591
  }
588
592
  calculatedMaxAmount = import_decimal.default.min(
589
593
  baseAmount,
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
314
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
123
  * 获取当前的客户搜索条件
124
124
  * @returns 当前搜索条件
125
125
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.477",
4
+ "version": "0.0.479",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",