@pisell/pisellos 0.0.477 → 0.0.478
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.
- package/dist/model/strategy/adapter/walletPass/utils.js +18 -42
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/lib/model/strategy/adapter/walletPass/utils.js +5 -36
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -222,12 +222,8 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
222
222
|
var maxProduct = applicableProducts.reduce(function (max, p) {
|
|
223
223
|
return p[amountField].greaterThan(max[amountField]) ? p : max;
|
|
224
224
|
});
|
|
225
|
-
//
|
|
226
|
-
|
|
227
|
-
// 非跨商品券也受 applicableProductLimit 限制
|
|
228
|
-
var _deductQty = applicableProductLimit > 0 ? Math.min(_currentAvailableQty, applicableProductLimit) : _currentAvailableQty;
|
|
229
|
-
// 实际可抵扣金额 = min(数量 * 单价, 剩余金额)
|
|
230
|
-
finalApplicableAmount = Decimal.min(maxProduct[unitPriceField].times(_deductQty), maxProduct[amountField]);
|
|
225
|
+
// allowCrossProduct=false 时,applicableProductLimit 不生效,直接使用全部可抵扣数量
|
|
226
|
+
finalApplicableAmount = maxProduct[amountField];
|
|
231
227
|
}
|
|
232
228
|
|
|
233
229
|
// 返回最小值
|
|
@@ -427,15 +423,12 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
427
423
|
}, new Decimal(0));
|
|
428
424
|
}
|
|
429
425
|
} else {
|
|
430
|
-
//
|
|
426
|
+
// 非跨商品券:单个剩余金额最高的商品
|
|
431
427
|
var maxProduct = applicableProducts.reduce(function (max, p) {
|
|
432
428
|
return p[amountField].greaterThan(max[amountField]) ? p : max;
|
|
433
429
|
});
|
|
434
|
-
//
|
|
435
|
-
|
|
436
|
-
var _deductQty2 = applicableProductLimit > 0 ? Math.min(_currentAvailableQty2, applicableProductLimit) : _currentAvailableQty2;
|
|
437
|
-
// 实际可抵扣金额 = min(数量 * 单价, 剩余金额)
|
|
438
|
-
calculatedAvailableMaxAmount = Decimal.min(maxProduct[unitPriceField].times(_deductQty2), maxProduct[amountField]);
|
|
430
|
+
// allowCrossProduct=false 时,applicableProductLimit 不生效,直接使用全部剩余金额
|
|
431
|
+
calculatedAvailableMaxAmount = maxProduct[amountField];
|
|
439
432
|
}
|
|
440
433
|
|
|
441
434
|
// 取最小值:min(recommended_usage_amount, maxDeductionAmount, 适用商品金额, 订单剩余金额)
|
|
@@ -460,8 +453,8 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
460
453
|
if (deductionLeft.lessThanOrEqualTo(0) || _remainingLimit <= 0) break;
|
|
461
454
|
|
|
462
455
|
// 动态计算当前可抵扣数量 = ceil(剩余金额 / 单价)
|
|
463
|
-
var
|
|
464
|
-
var availableQty = Math.min(
|
|
456
|
+
var _currentAvailableQty = Math.ceil(_product[amountField].dividedBy(_product[unitPriceField]).toNumber());
|
|
457
|
+
var availableQty = Math.min(_currentAvailableQty, _remainingLimit);
|
|
465
458
|
|
|
466
459
|
// 计算本商品最大可抵扣金额 = min(数量 * 单价, 剩余金额)
|
|
467
460
|
var maxDeductForProduct = Decimal.min(_product[unitPriceField].times(availableQty), _product[amountField]);
|
|
@@ -489,18 +482,12 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
489
482
|
_iterator3.f();
|
|
490
483
|
}
|
|
491
484
|
} else {
|
|
492
|
-
//
|
|
485
|
+
// 非跨商品券:只抵扣一个商品(剩余金额最高的)
|
|
486
|
+
// allowCrossProduct=false 时,applicableProductLimit 不生效
|
|
493
487
|
var targetProduct = applicableProducts.reduce(function (max, p) {
|
|
494
488
|
return p[amountField].greaterThan(max[amountField]) ? p : max;
|
|
495
489
|
});
|
|
496
|
-
|
|
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]);
|
|
503
|
-
var _actualDeductAmount = Decimal.min(deductionLeft, _maxDeductForProduct);
|
|
490
|
+
var _actualDeductAmount = Decimal.min(deductionLeft, targetProduct[amountField]);
|
|
504
491
|
|
|
505
492
|
// 计算实际抵扣的数量
|
|
506
493
|
var _actualDeductQty = Math.ceil(_actualDeductAmount.dividedBy(targetProduct[unitPriceField]).toNumber());
|
|
@@ -513,8 +500,7 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
513
500
|
parent_product_id: targetProduct.parent_product_id || null,
|
|
514
501
|
is_bundle_item: targetProduct.is_bundle_item || false,
|
|
515
502
|
deductAmount: _actualDeductAmount.toNumber(),
|
|
516
|
-
|
|
517
|
-
deductQuantity: _actualDeductQty // 抵扣涉及的数量(用于记录)
|
|
503
|
+
deductQuantity: _actualDeductQty
|
|
518
504
|
});
|
|
519
505
|
}
|
|
520
506
|
var totalDeducted = maxDeduction.minus(deductionLeft);
|
|
@@ -716,18 +702,12 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
716
702
|
_iterator4.f();
|
|
717
703
|
}
|
|
718
704
|
} else {
|
|
719
|
-
//
|
|
705
|
+
// 非跨商品券:只抵扣一个商品(剩余金额最高的)
|
|
706
|
+
// allowCrossProduct=false 时,applicableProductLimit 不生效
|
|
720
707
|
var targetProduct = applicableProducts.reduce(function (max, p) {
|
|
721
708
|
return p[amountField].greaterThan(max[amountField]) ? p : max;
|
|
722
709
|
});
|
|
723
|
-
|
|
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]);
|
|
730
|
-
var _actualDeductAmount2 = Decimal.min(deductionLeft, _maxDeductForProduct2);
|
|
710
|
+
var _actualDeductAmount2 = Decimal.min(deductionLeft, targetProduct[amountField]);
|
|
731
711
|
|
|
732
712
|
// 计算实际抵扣的数量
|
|
733
713
|
var _actualDeductQty2 = Math.ceil(_actualDeductAmount2.dividedBy(targetProduct[unitPriceField]).toNumber());
|
|
@@ -740,8 +720,7 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
740
720
|
parent_product_id: targetProduct.parent_product_id || null,
|
|
741
721
|
is_bundle_item: targetProduct.is_bundle_item || false,
|
|
742
722
|
deductAmount: _actualDeductAmount2.toNumber(),
|
|
743
|
-
|
|
744
|
-
deductQuantity: _actualDeductQty2 // 抵扣涉及的数量(用于记录)
|
|
723
|
+
deductQuantity: _actualDeductQty2
|
|
745
724
|
});
|
|
746
725
|
}
|
|
747
726
|
var totalDeducted = maxDeduction.minus(deductionLeft);
|
|
@@ -865,15 +844,12 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
865
844
|
}, new Decimal(0));
|
|
866
845
|
}
|
|
867
846
|
} else {
|
|
868
|
-
//
|
|
847
|
+
// 非跨商品券:单个剩余金额最高的商品
|
|
848
|
+
// allowCrossProduct=false 时,applicableProductLimit 不生效
|
|
869
849
|
var maxProduct = applicableProducts.reduce(function (max, p) {
|
|
870
850
|
return p[amountField].greaterThan(max[amountField]) ? p : max;
|
|
871
851
|
});
|
|
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]);
|
|
852
|
+
calculatedMaxAmount = maxProduct[amountField];
|
|
877
853
|
}
|
|
878
854
|
calculatedMaxAmount = Decimal.min(baseAmount, calculatedMaxAmount, remainingOrderAmount);
|
|
879
855
|
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 |
|
|
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, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|
|
@@ -152,12 +152,7 @@ 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
|
-
|
|
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
|
+
finalApplicableAmount = maxProduct[amountField];
|
|
161
156
|
}
|
|
162
157
|
return import_decimal.default.min(baseAmount, finalApplicableAmount, remainingOrderAmount);
|
|
163
158
|
};
|
|
@@ -269,12 +264,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
|
269
264
|
const maxProduct = applicableProducts.reduce(
|
|
270
265
|
(max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
|
|
271
266
|
);
|
|
272
|
-
|
|
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
|
-
);
|
|
267
|
+
calculatedAvailableMaxAmount = maxProduct[amountField];
|
|
278
268
|
}
|
|
279
269
|
const availableMaxAmount = import_decimal.default.min(
|
|
280
270
|
baseAmount,
|
|
@@ -320,13 +310,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
|
320
310
|
const targetProduct = applicableProducts.reduce(
|
|
321
311
|
(max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
|
|
322
312
|
);
|
|
323
|
-
const
|
|
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
|
-
);
|
|
329
|
-
const actualDeductAmount = import_decimal.default.min(deductionLeft, maxDeductForProduct);
|
|
313
|
+
const actualDeductAmount = import_decimal.default.min(deductionLeft, targetProduct[amountField]);
|
|
330
314
|
const actualDeductQty = Math.ceil(actualDeductAmount.dividedBy(targetProduct[unitPriceField]).toNumber());
|
|
331
315
|
targetProduct[amountField] = targetProduct[amountField].minus(actualDeductAmount);
|
|
332
316
|
deductionLeft = deductionLeft.minus(actualDeductAmount);
|
|
@@ -335,9 +319,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
|
335
319
|
parent_product_id: targetProduct.parent_product_id || null,
|
|
336
320
|
is_bundle_item: targetProduct.is_bundle_item || false,
|
|
337
321
|
deductAmount: actualDeductAmount.toNumber(),
|
|
338
|
-
// 转换为数字
|
|
339
322
|
deductQuantity: actualDeductQty
|
|
340
|
-
// 抵扣涉及的数量(用于记录)
|
|
341
323
|
});
|
|
342
324
|
}
|
|
343
325
|
const totalDeducted = maxDeduction.minus(deductionLeft);
|
|
@@ -469,13 +451,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
469
451
|
const targetProduct = applicableProducts.reduce(
|
|
470
452
|
(max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
|
|
471
453
|
);
|
|
472
|
-
const
|
|
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
|
-
);
|
|
478
|
-
const actualDeductAmount = import_decimal.default.min(deductionLeft, maxDeductForProduct);
|
|
454
|
+
const actualDeductAmount = import_decimal.default.min(deductionLeft, targetProduct[amountField]);
|
|
479
455
|
const actualDeductQty = Math.ceil(actualDeductAmount.dividedBy(targetProduct[unitPriceField]).toNumber());
|
|
480
456
|
targetProduct[amountField] = targetProduct[amountField].minus(actualDeductAmount);
|
|
481
457
|
deductionLeft = deductionLeft.minus(actualDeductAmount);
|
|
@@ -484,9 +460,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
484
460
|
parent_product_id: targetProduct.parent_product_id || null,
|
|
485
461
|
is_bundle_item: targetProduct.is_bundle_item || false,
|
|
486
462
|
deductAmount: actualDeductAmount.toNumber(),
|
|
487
|
-
// 转换为数字
|
|
488
463
|
deductQuantity: actualDeductQty
|
|
489
|
-
// 抵扣涉及的数量(用于记录)
|
|
490
464
|
});
|
|
491
465
|
}
|
|
492
466
|
const totalDeducted = maxDeduction.minus(deductionLeft);
|
|
@@ -578,12 +552,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
578
552
|
const maxProduct = applicableProducts.reduce(
|
|
579
553
|
(max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
|
|
580
554
|
);
|
|
581
|
-
|
|
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
|
-
);
|
|
555
|
+
calculatedMaxAmount = maxProduct[amountField];
|
|
587
556
|
}
|
|
588
557
|
calculatedMaxAmount = import_decimal.default.min(
|
|
589
558
|
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 |
|
|
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, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|