@pisell/pisellos 0.0.430 → 0.0.432
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/evaluator.js +1 -0
- package/dist/model/strategy/adapter/walletPass/type.d.ts +4 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +31 -24
- package/dist/modules/Payment/index.js +2 -0
- package/dist/modules/Payment/types.d.ts +12 -0
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/Checkout/index.js +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +1 -0
- package/lib/model/strategy/adapter/walletPass/type.d.ts +4 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +20 -14
- package/lib/modules/Payment/index.js +2 -0
- package/lib/modules/Payment/types.d.ts +12 -0
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/Checkout/index.js +2 -0
- package/package.json +1 -1
|
@@ -78,6 +78,7 @@ export var WalletPassEvaluator = /*#__PURE__*/function () {
|
|
|
78
78
|
var _item$strategyResult2;
|
|
79
79
|
return _objectSpread(_objectSpread({}, item.voucher), {}, {
|
|
80
80
|
config: _objectSpread({}, item === null || item === void 0 || (_item$strategyResult2 = item.strategyResult) === null || _item$strategyResult2 === void 0 ? void 0 : _item$strategyResult2.config.metadata.custom),
|
|
81
|
+
_unified_available_status: 0,
|
|
81
82
|
reason: item.reason,
|
|
82
83
|
reasonCode: item.reasonCode
|
|
83
84
|
});
|
|
@@ -62,9 +62,12 @@ export interface Product {
|
|
|
62
62
|
main_product_attached_bundle_tax_fee?: number;
|
|
63
63
|
main_product_attached_bundle_surcharge_fee?: number;
|
|
64
64
|
surcharge_rounding_remainder?: number;
|
|
65
|
+
tax_fee_rounding_remainder?: number;
|
|
65
66
|
main_product_selling_price: number;
|
|
66
67
|
};
|
|
68
|
+
is_price_include_tax: 0 | 1;
|
|
67
69
|
product_bundle: {
|
|
70
|
+
is_price_include_tax: 0 | 1;
|
|
68
71
|
bundle_id: number;
|
|
69
72
|
bundle_product_id: number;
|
|
70
73
|
bundle_variant_id: number;
|
|
@@ -77,6 +80,7 @@ export interface Product {
|
|
|
77
80
|
metadata: {
|
|
78
81
|
surcharge_fee: number;
|
|
79
82
|
surcharge_rounding_remainder?: number;
|
|
83
|
+
tax_fee_rounding_remainder?: number;
|
|
80
84
|
};
|
|
81
85
|
}[];
|
|
82
86
|
}
|
|
@@ -154,9 +154,9 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
154
154
|
if (allowCrossProduct) {
|
|
155
155
|
// 跨商品券:可以抵扣多个商品
|
|
156
156
|
if (applicableProductLimit > 0) {
|
|
157
|
-
//
|
|
157
|
+
// 有数量限制:按剩余金额从高到低排序,按动态计算的可抵扣数量累计直到达到 limit
|
|
158
158
|
var sortedProducts = _toConsumableArray(applicableProducts).sort(function (a, b) {
|
|
159
|
-
return a[
|
|
159
|
+
return a[amountField].comparedTo(b[amountField]) > 0 ? -1 : 1;
|
|
160
160
|
});
|
|
161
161
|
var remainingLimit = applicableProductLimit;
|
|
162
162
|
var _iterator = _createForOfIteratorHelper(sortedProducts),
|
|
@@ -185,9 +185,9 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
185
185
|
}, new Decimal(0));
|
|
186
186
|
}
|
|
187
187
|
} else {
|
|
188
|
-
//
|
|
188
|
+
// 非跨商品券:只能抵扣单个商品(剩余金额最高的)
|
|
189
189
|
var maxProduct = applicableProducts.reduce(function (max, p) {
|
|
190
|
-
return p[
|
|
190
|
+
return p[amountField].greaterThan(max[amountField]) ? p : max;
|
|
191
191
|
});
|
|
192
192
|
// 动态计算当前可抵扣数量
|
|
193
193
|
var _currentAvailableQty = Math.ceil(maxProduct[amountField].dividedBy(maxProduct[unitPriceField]).toNumber());
|
|
@@ -337,8 +337,9 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
337
337
|
if (allowCrossProduct) {
|
|
338
338
|
// 跨商品券:按 quantity 限制计算可抵扣金额
|
|
339
339
|
if (applicableProductLimit > 0) {
|
|
340
|
+
// 按剩余金额从高到低排序
|
|
340
341
|
var sortedProducts = _toConsumableArray(applicableProducts).sort(function (a, b) {
|
|
341
|
-
return a[
|
|
342
|
+
return a[amountField].comparedTo(b[amountField]) > 0 ? -1 : 1;
|
|
342
343
|
});
|
|
343
344
|
var remainingLimit = applicableProductLimit;
|
|
344
345
|
var _iterator2 = _createForOfIteratorHelper(sortedProducts),
|
|
@@ -367,9 +368,9 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
367
368
|
}, new Decimal(0));
|
|
368
369
|
}
|
|
369
370
|
} else {
|
|
370
|
-
//
|
|
371
|
+
// 非跨商品券:单个剩余金额最高的商品,也受 applicableProductLimit 限制
|
|
371
372
|
var maxProduct = applicableProducts.reduce(function (max, p) {
|
|
372
|
-
return p[
|
|
373
|
+
return p[amountField].greaterThan(max[amountField]) ? p : max;
|
|
373
374
|
});
|
|
374
375
|
// 动态计算当前可抵扣数量
|
|
375
376
|
var _currentAvailableQty2 = Math.ceil(maxProduct[amountField].dividedBy(maxProduct[unitPriceField]).toNumber());
|
|
@@ -387,9 +388,9 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
387
388
|
var deductionLeft = maxDeduction;
|
|
388
389
|
var deductionDetails = [];
|
|
389
390
|
if (allowCrossProduct) {
|
|
390
|
-
//
|
|
391
|
+
// 跨商品券:按剩余金额从高到低抵扣,受 applicableProductLimit 限制
|
|
391
392
|
var _sortedProducts = _toConsumableArray(applicableProducts).sort(function (a, b) {
|
|
392
|
-
return a[
|
|
393
|
+
return a[amountField].comparedTo(b[amountField]) > 0 ? -1 : 1;
|
|
393
394
|
});
|
|
394
395
|
var _remainingLimit = applicableProductLimit > 0 ? applicableProductLimit : Infinity;
|
|
395
396
|
var _iterator3 = _createForOfIteratorHelper(_sortedProducts),
|
|
@@ -429,9 +430,9 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
429
430
|
_iterator3.f();
|
|
430
431
|
}
|
|
431
432
|
} else {
|
|
432
|
-
//
|
|
433
|
+
// 非跨商品券:只抵扣一个商品(剩余金额最高的),也受 applicableProductLimit 限制
|
|
433
434
|
var targetProduct = applicableProducts.reduce(function (max, p) {
|
|
434
|
-
return p[
|
|
435
|
+
return p[amountField].greaterThan(max[amountField]) ? p : max;
|
|
435
436
|
});
|
|
436
437
|
|
|
437
438
|
// 动态计算当前可抵扣数量
|
|
@@ -583,9 +584,9 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
583
584
|
var deductionLeft = maxDeduction;
|
|
584
585
|
var deductionDetails = [];
|
|
585
586
|
if (allowCrossProduct) {
|
|
586
|
-
//
|
|
587
|
+
// 跨商品券:按剩余金额从高到低抵扣,受 applicableProductLimit 限制
|
|
587
588
|
var sortedProducts = _toConsumableArray(applicableProducts).sort(function (a, b) {
|
|
588
|
-
return a[
|
|
589
|
+
return a[amountField].comparedTo(b[amountField]) > 0 ? -1 : 1;
|
|
589
590
|
});
|
|
590
591
|
var remainingLimit = applicableProductLimit > 0 ? applicableProductLimit : Infinity;
|
|
591
592
|
var _iterator4 = _createForOfIteratorHelper(sortedProducts),
|
|
@@ -625,9 +626,9 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
625
626
|
_iterator4.f();
|
|
626
627
|
}
|
|
627
628
|
} else {
|
|
628
|
-
//
|
|
629
|
+
// 非跨商品券:只抵扣一个商品(剩余金额最高的),也受 applicableProductLimit 限制
|
|
629
630
|
var targetProduct = applicableProducts.reduce(function (max, p) {
|
|
630
|
-
return p[
|
|
631
|
+
return p[amountField].greaterThan(max[amountField]) ? p : max;
|
|
631
632
|
});
|
|
632
633
|
|
|
633
634
|
// 动态计算当前可抵扣数量
|
|
@@ -733,9 +734,9 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
733
734
|
var baseAmount = Decimal.min(new Decimal(recommendedAmount), new Decimal(maxDeductionAmount));
|
|
734
735
|
if (allowCrossProduct) {
|
|
735
736
|
if (applicableProductLimit > 0) {
|
|
736
|
-
//
|
|
737
|
+
// 按剩余金额从高到低排序,按动态计算的可抵扣数量累计直到达到 limit
|
|
737
738
|
var sortedProducts = _toConsumableArray(applicableProducts).sort(function (a, b) {
|
|
738
|
-
return a[
|
|
739
|
+
return a[amountField].comparedTo(b[amountField]) > 0 ? -1 : 1;
|
|
739
740
|
});
|
|
740
741
|
var remainingLimit = applicableProductLimit;
|
|
741
742
|
var _iterator5 = _createForOfIteratorHelper(sortedProducts),
|
|
@@ -764,9 +765,9 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
764
765
|
}, new Decimal(0));
|
|
765
766
|
}
|
|
766
767
|
} else {
|
|
767
|
-
//
|
|
768
|
+
// 非跨商品券:单个剩余金额最高的商品,也受 applicableProductLimit 限制
|
|
768
769
|
var maxProduct = applicableProducts.reduce(function (max, p) {
|
|
769
|
-
return p[
|
|
770
|
+
return p[amountField].greaterThan(max[amountField]) ? p : max;
|
|
770
771
|
});
|
|
771
772
|
// 动态计算当前可抵扣数量
|
|
772
773
|
var _currentAvailableQty6 = Math.ceil(maxProduct[amountField].dividedBy(maxProduct[unitPriceField]).toNumber());
|
|
@@ -803,7 +804,7 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
803
804
|
* @returns 商品价格
|
|
804
805
|
*/
|
|
805
806
|
export var getMainProductPrice = function getMainProductPrice(product, isDeductTaxAndFee) {
|
|
806
|
-
var _product$metadata, _product$metadata2, _product$metadata3, _product$metadata4;
|
|
807
|
+
var _product$metadata, _product$metadata2, _product$metadata3, _product$metadata4, _product$metadata5;
|
|
807
808
|
var mainProductPrice = new Decimal((product === null || product === void 0 ? void 0 : product.main_product_selling_price) || ((_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.main_product_selling_price) || 0);
|
|
808
809
|
var _iterator6 = _createForOfIteratorHelper((product === null || product === void 0 ? void 0 : product.product_bundle) || []),
|
|
809
810
|
_step6;
|
|
@@ -818,16 +819,19 @@ export var getMainProductPrice = function getMainProductPrice(product, isDeductT
|
|
|
818
819
|
mainProductPrice = mainProductPrice.add(bundleItemPrice.times(bundleItem.num));
|
|
819
820
|
}
|
|
820
821
|
}
|
|
821
|
-
|
|
822
|
-
// 税费
|
|
823
822
|
} catch (err) {
|
|
824
823
|
_iterator6.e(err);
|
|
825
824
|
} finally {
|
|
826
825
|
_iterator6.f();
|
|
827
826
|
}
|
|
828
|
-
var taxFee = new Decimal((product === null || product === void 0 ? void 0 : product.tax_fee) || (product === null || product === void 0 || (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.main_product_attached_bundle_tax_fee) || 0);
|
|
827
|
+
var taxFee = new Decimal((product === null || product === void 0 ? void 0 : product.tax_fee) || (product === null || product === void 0 || (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.main_product_attached_bundle_tax_fee) || 0).add((product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.tax_fee_rounding_remainder) || 0);
|
|
828
|
+
if (product.is_price_include_tax === 1) {
|
|
829
|
+
taxFee = new Decimal(0);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
// 税费
|
|
829
833
|
// 附加费
|
|
830
|
-
var surchargeFee = new Decimal((product === null || product === void 0 || (_product$
|
|
834
|
+
var surchargeFee = new Decimal((product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.main_product_attached_bundle_surcharge_fee) || 0).add((product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.surcharge_rounding_remainder) || 0);
|
|
831
835
|
|
|
832
836
|
// 税费附加费总额
|
|
833
837
|
var taxAndFeeTotal = taxFee.add(surchargeFee);
|
|
@@ -857,6 +861,9 @@ export var getBundleItemPrice = function getBundleItemPrice(bundleItem, parentQu
|
|
|
857
861
|
var _bundleItem$tax_fee, _bundleItem$metadata$, _bundleItem$metadata;
|
|
858
862
|
// 税费
|
|
859
863
|
var taxFee = new Decimal((_bundleItem$tax_fee = bundleItem.tax_fee) !== null && _bundleItem$tax_fee !== void 0 ? _bundleItem$tax_fee : 0).times(totalQuantity);
|
|
864
|
+
if (bundleItem.is_price_include_tax === 1) {
|
|
865
|
+
taxFee = new Decimal(0);
|
|
866
|
+
}
|
|
860
867
|
// 附加费
|
|
861
868
|
var surchargeFee = new Decimal((_bundleItem$metadata$ = (_bundleItem$metadata = bundleItem.metadata) === null || _bundleItem$metadata === void 0 ? void 0 : _bundleItem$metadata.surcharge_fee) !== null && _bundleItem$metadata$ !== void 0 ? _bundleItem$metadata$ : 0).times(totalQuantity);
|
|
862
869
|
bundleItemPrice = bundleItemPrice.add(taxFee).add(surchargeFee);
|
|
@@ -1186,6 +1186,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1186
1186
|
// 创建时间
|
|
1187
1187
|
updated_at: currentTime,
|
|
1188
1188
|
// 更新时间
|
|
1189
|
+
wallet_pass_usage_unit: paymentItem === null || paymentItem === void 0 ? void 0 : paymentItem.wallet_pass_usage_unit,
|
|
1190
|
+
wallet_pass_use_value: paymentItem === null || paymentItem === void 0 ? void 0 : paymentItem.wallet_pass_use_value,
|
|
1189
1191
|
metadata: _objectSpread(_objectSpread({}, paymentItem.metadata), {}, {
|
|
1190
1192
|
// 保留传入的所有 metadata 字段
|
|
1191
1193
|
unique_payment_number: paymentUuid // 设置唯一支付号为支付项的 uuid
|
|
@@ -142,6 +142,10 @@ export interface PaymentItem {
|
|
|
142
142
|
created_at?: string;
|
|
143
143
|
/** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
144
144
|
updated_at?: string;
|
|
145
|
+
/** 钱包支付使用金额 */
|
|
146
|
+
wallet_pass_use_value?: any;
|
|
147
|
+
/** 钱包支付使用单位 */
|
|
148
|
+
wallet_pass_usage_unit?: any;
|
|
145
149
|
}
|
|
146
150
|
/**
|
|
147
151
|
* 订单信息
|
|
@@ -258,6 +262,10 @@ export interface PaymentItemInput {
|
|
|
258
262
|
created_at?: string;
|
|
259
263
|
/** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
260
264
|
updated_at?: string;
|
|
265
|
+
/** 钱包支付使用金额 */
|
|
266
|
+
wallet_pass_use_value?: any;
|
|
267
|
+
/** 钱包支付使用单位 */
|
|
268
|
+
wallet_pass_usage_unit?: any;
|
|
261
269
|
}
|
|
262
270
|
/**
|
|
263
271
|
* 推送支付项参数
|
|
@@ -295,6 +303,10 @@ export interface PaymentUpdateFields {
|
|
|
295
303
|
statusCode?: number;
|
|
296
304
|
timestamp: number;
|
|
297
305
|
};
|
|
306
|
+
/** 钱包支付使用金额 */
|
|
307
|
+
wallet_pass_use_value?: any;
|
|
308
|
+
/** 钱包支付使用单位 */
|
|
309
|
+
wallet_pass_usage_unit?: any;
|
|
298
310
|
}
|
|
299
311
|
/**
|
|
300
312
|
* 更新支付项参数
|
|
@@ -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 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -358,7 +358,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
358
358
|
};
|
|
359
359
|
setOtherData(key: string, value: any): void;
|
|
360
360
|
getOtherData(key: string): any;
|
|
361
|
-
getProductTypeById(id: number): Promise<"
|
|
361
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
362
362
|
/**
|
|
363
363
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
364
364
|
*
|
|
@@ -403,6 +403,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
403
403
|
product_id: item.product_id,
|
|
404
404
|
product_variant_id: item.product_variant_id,
|
|
405
405
|
quantity: item.num,
|
|
406
|
+
is_price_include_tax: item.is_price_include_tax,
|
|
406
407
|
// 商品是否含税:1;0
|
|
407
408
|
is_charge_tax: (_item$is_charge_tax = item.is_charge_tax) !== null && _item$is_charge_tax !== void 0 ? _item$is_charge_tax : 0,
|
|
408
409
|
// 若商品不含税,计算得到的税费,单位(元)
|
|
@@ -427,6 +428,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
427
428
|
},
|
|
428
429
|
product_bundle: item.product_bundle.map(function (bundle) {
|
|
429
430
|
return {
|
|
431
|
+
is_price_include_tax: item.is_price_include_tax,
|
|
430
432
|
bundle_id: bundle.bundle_id,
|
|
431
433
|
bundle_product_id: bundle.bundle_product_id,
|
|
432
434
|
bundle_variant_id: bundle.bundle_variant_id,
|
|
@@ -62,9 +62,12 @@ export interface Product {
|
|
|
62
62
|
main_product_attached_bundle_tax_fee?: number;
|
|
63
63
|
main_product_attached_bundle_surcharge_fee?: number;
|
|
64
64
|
surcharge_rounding_remainder?: number;
|
|
65
|
+
tax_fee_rounding_remainder?: number;
|
|
65
66
|
main_product_selling_price: number;
|
|
66
67
|
};
|
|
68
|
+
is_price_include_tax: 0 | 1;
|
|
67
69
|
product_bundle: {
|
|
70
|
+
is_price_include_tax: 0 | 1;
|
|
68
71
|
bundle_id: number;
|
|
69
72
|
bundle_product_id: number;
|
|
70
73
|
bundle_variant_id: number;
|
|
@@ -77,6 +80,7 @@ export interface Product {
|
|
|
77
80
|
metadata: {
|
|
78
81
|
surcharge_fee: number;
|
|
79
82
|
surcharge_rounding_remainder?: number;
|
|
83
|
+
tax_fee_rounding_remainder?: number;
|
|
80
84
|
};
|
|
81
85
|
}[];
|
|
82
86
|
}
|
|
@@ -103,7 +103,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
|
103
103
|
let finalApplicableAmount = new import_decimal.default(0);
|
|
104
104
|
if (allowCrossProduct) {
|
|
105
105
|
if (applicableProductLimit > 0) {
|
|
106
|
-
const sortedProducts = [...applicableProducts].sort((a, b) => a[
|
|
106
|
+
const sortedProducts = [...applicableProducts].sort((a, b) => a[amountField].comparedTo(b[amountField]) > 0 ? -1 : 1);
|
|
107
107
|
let remainingLimit = applicableProductLimit;
|
|
108
108
|
for (const product of sortedProducts) {
|
|
109
109
|
if (remainingLimit <= 0)
|
|
@@ -125,7 +125,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
|
125
125
|
}
|
|
126
126
|
} else {
|
|
127
127
|
const maxProduct = applicableProducts.reduce(
|
|
128
|
-
(max, p) => p[
|
|
128
|
+
(max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
|
|
129
129
|
);
|
|
130
130
|
const currentAvailableQty = Math.ceil(maxProduct[amountField].dividedBy(maxProduct[unitPriceField]).toNumber());
|
|
131
131
|
const deductQty = applicableProductLimit > 0 ? Math.min(currentAvailableQty, applicableProductLimit) : currentAvailableQty;
|
|
@@ -208,7 +208,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
|
208
208
|
let calculatedAvailableMaxAmount = new import_decimal.default(0);
|
|
209
209
|
if (allowCrossProduct) {
|
|
210
210
|
if (applicableProductLimit > 0) {
|
|
211
|
-
const sortedProducts = [...applicableProducts].sort((a, b) => a[
|
|
211
|
+
const sortedProducts = [...applicableProducts].sort((a, b) => a[amountField].comparedTo(b[amountField]) > 0 ? -1 : 1);
|
|
212
212
|
let remainingLimit = applicableProductLimit;
|
|
213
213
|
for (const product of sortedProducts) {
|
|
214
214
|
if (remainingLimit <= 0)
|
|
@@ -230,7 +230,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
|
230
230
|
}
|
|
231
231
|
} else {
|
|
232
232
|
const maxProduct = applicableProducts.reduce(
|
|
233
|
-
(max, p) => p[
|
|
233
|
+
(max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
|
|
234
234
|
);
|
|
235
235
|
const currentAvailableQty = Math.ceil(maxProduct[amountField].dividedBy(maxProduct[unitPriceField]).toNumber());
|
|
236
236
|
const deductQty = applicableProductLimit > 0 ? Math.min(currentAvailableQty, applicableProductLimit) : currentAvailableQty;
|
|
@@ -252,7 +252,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
|
252
252
|
const deductionDetails = [];
|
|
253
253
|
if (allowCrossProduct) {
|
|
254
254
|
const sortedProducts = [...applicableProducts].sort(
|
|
255
|
-
(a, b) => a[
|
|
255
|
+
(a, b) => a[amountField].comparedTo(b[amountField]) > 0 ? -1 : 1
|
|
256
256
|
);
|
|
257
257
|
let remainingLimit = applicableProductLimit > 0 ? applicableProductLimit : Infinity;
|
|
258
258
|
for (const product of sortedProducts) {
|
|
@@ -281,7 +281,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
|
281
281
|
}
|
|
282
282
|
} else {
|
|
283
283
|
const targetProduct = applicableProducts.reduce(
|
|
284
|
-
(max, p) => p[
|
|
284
|
+
(max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
|
|
285
285
|
);
|
|
286
286
|
const currentAvailableQty = Math.ceil(targetProduct[amountField].dividedBy(targetProduct[unitPriceField]).toNumber());
|
|
287
287
|
const availableQty = applicableProductLimit > 0 ? Math.min(currentAvailableQty, applicableProductLimit) : currentAvailableQty;
|
|
@@ -378,7 +378,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
378
378
|
const deductionDetails = [];
|
|
379
379
|
if (allowCrossProduct) {
|
|
380
380
|
const sortedProducts = [...applicableProducts].sort(
|
|
381
|
-
(a, b) => a[
|
|
381
|
+
(a, b) => a[amountField].comparedTo(b[amountField]) > 0 ? -1 : 1
|
|
382
382
|
);
|
|
383
383
|
let remainingLimit = applicableProductLimit > 0 ? applicableProductLimit : Infinity;
|
|
384
384
|
for (const product of sortedProducts) {
|
|
@@ -407,7 +407,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
407
407
|
}
|
|
408
408
|
} else {
|
|
409
409
|
const targetProduct = applicableProducts.reduce(
|
|
410
|
-
(max, p) => p[
|
|
410
|
+
(max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
|
|
411
411
|
);
|
|
412
412
|
const currentAvailableQty = Math.ceil(targetProduct[amountField].dividedBy(targetProduct[unitPriceField]).toNumber());
|
|
413
413
|
const availableQty = applicableProductLimit > 0 ? Math.min(currentAvailableQty, applicableProductLimit) : currentAvailableQty;
|
|
@@ -490,7 +490,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
490
490
|
);
|
|
491
491
|
if (allowCrossProduct) {
|
|
492
492
|
if (applicableProductLimit > 0) {
|
|
493
|
-
const sortedProducts = [...applicableProducts].sort((a, b) => a[
|
|
493
|
+
const sortedProducts = [...applicableProducts].sort((a, b) => a[amountField].comparedTo(b[amountField]) > 0 ? -1 : 1);
|
|
494
494
|
let remainingLimit = applicableProductLimit;
|
|
495
495
|
for (const product of sortedProducts) {
|
|
496
496
|
if (remainingLimit <= 0)
|
|
@@ -512,7 +512,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
512
512
|
}
|
|
513
513
|
} else {
|
|
514
514
|
const maxProduct = applicableProducts.reduce(
|
|
515
|
-
(max, p) => p[
|
|
515
|
+
(max, p) => p[amountField].greaterThan(max[amountField]) ? p : max
|
|
516
516
|
);
|
|
517
517
|
const currentAvailableQty = Math.ceil(maxProduct[amountField].dividedBy(maxProduct[unitPriceField]).toNumber());
|
|
518
518
|
const deductQty = applicableProductLimit > 0 ? Math.min(currentAvailableQty, applicableProductLimit) : currentAvailableQty;
|
|
@@ -547,7 +547,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
547
547
|
};
|
|
548
548
|
}
|
|
549
549
|
var getMainProductPrice = (product, isDeductTaxAndFee) => {
|
|
550
|
-
var _a, _b, _c, _d;
|
|
550
|
+
var _a, _b, _c, _d, _e;
|
|
551
551
|
let mainProductPrice = new import_decimal.default((product == null ? void 0 : product.main_product_selling_price) || ((_a = product.metadata) == null ? void 0 : _a.main_product_selling_price) || 0);
|
|
552
552
|
for (let bundleItem of (product == null ? void 0 : product.product_bundle) || []) {
|
|
553
553
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
@@ -555,8 +555,11 @@ var getMainProductPrice = (product, isDeductTaxAndFee) => {
|
|
|
555
555
|
mainProductPrice = mainProductPrice.add(bundleItemPrice.times(bundleItem.num));
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
-
|
|
559
|
-
|
|
558
|
+
let taxFee = new import_decimal.default((product == null ? void 0 : product.tax_fee) || ((_b = product == null ? void 0 : product.metadata) == null ? void 0 : _b.main_product_attached_bundle_tax_fee) || 0).add(((_c = product == null ? void 0 : product.metadata) == null ? void 0 : _c.tax_fee_rounding_remainder) || 0);
|
|
559
|
+
if (product.is_price_include_tax === 1) {
|
|
560
|
+
taxFee = new import_decimal.default(0);
|
|
561
|
+
}
|
|
562
|
+
const surchargeFee = new import_decimal.default(((_d = product == null ? void 0 : product.metadata) == null ? void 0 : _d.main_product_attached_bundle_surcharge_fee) || 0).add(((_e = product == null ? void 0 : product.metadata) == null ? void 0 : _e.surcharge_rounding_remainder) || 0);
|
|
560
563
|
const taxAndFeeTotal = taxFee.add(surchargeFee);
|
|
561
564
|
if (isDeductTaxAndFee) {
|
|
562
565
|
mainProductPrice = mainProductPrice.add(taxAndFeeTotal);
|
|
@@ -568,7 +571,10 @@ var getBundleItemPrice = (bundleItem, parentQuantity, isDeductTaxAndFee) => {
|
|
|
568
571
|
const totalQuantity = bundleItem.num * parentQuantity;
|
|
569
572
|
let bundleItemPrice = new import_decimal.default(bundleItem.bundle_selling_price ?? 0).times(totalQuantity);
|
|
570
573
|
if (isDeductTaxAndFee) {
|
|
571
|
-
|
|
574
|
+
let taxFee = new import_decimal.default(bundleItem.tax_fee ?? 0).times(totalQuantity);
|
|
575
|
+
if (bundleItem.is_price_include_tax === 1) {
|
|
576
|
+
taxFee = new import_decimal.default(0);
|
|
577
|
+
}
|
|
572
578
|
const surchargeFee = new import_decimal.default(((_a = bundleItem.metadata) == null ? void 0 : _a.surcharge_fee) ?? 0).times(totalQuantity);
|
|
573
579
|
bundleItemPrice = bundleItemPrice.add(taxFee).add(surchargeFee);
|
|
574
580
|
}
|
|
@@ -607,6 +607,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
607
607
|
// 创建时间
|
|
608
608
|
updated_at: currentTime,
|
|
609
609
|
// 更新时间
|
|
610
|
+
wallet_pass_usage_unit: paymentItem == null ? void 0 : paymentItem.wallet_pass_usage_unit,
|
|
611
|
+
wallet_pass_use_value: paymentItem == null ? void 0 : paymentItem.wallet_pass_use_value,
|
|
610
612
|
metadata: {
|
|
611
613
|
...paymentItem.metadata,
|
|
612
614
|
// 保留传入的所有 metadata 字段
|
|
@@ -142,6 +142,10 @@ export interface PaymentItem {
|
|
|
142
142
|
created_at?: string;
|
|
143
143
|
/** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
144
144
|
updated_at?: string;
|
|
145
|
+
/** 钱包支付使用金额 */
|
|
146
|
+
wallet_pass_use_value?: any;
|
|
147
|
+
/** 钱包支付使用单位 */
|
|
148
|
+
wallet_pass_usage_unit?: any;
|
|
145
149
|
}
|
|
146
150
|
/**
|
|
147
151
|
* 订单信息
|
|
@@ -258,6 +262,10 @@ export interface PaymentItemInput {
|
|
|
258
262
|
created_at?: string;
|
|
259
263
|
/** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
260
264
|
updated_at?: string;
|
|
265
|
+
/** 钱包支付使用金额 */
|
|
266
|
+
wallet_pass_use_value?: any;
|
|
267
|
+
/** 钱包支付使用单位 */
|
|
268
|
+
wallet_pass_usage_unit?: any;
|
|
261
269
|
}
|
|
262
270
|
/**
|
|
263
271
|
* 推送支付项参数
|
|
@@ -295,6 +303,10 @@ export interface PaymentUpdateFields {
|
|
|
295
303
|
statusCode?: number;
|
|
296
304
|
timestamp: number;
|
|
297
305
|
};
|
|
306
|
+
/** 钱包支付使用金额 */
|
|
307
|
+
wallet_pass_use_value?: any;
|
|
308
|
+
/** 钱包支付使用单位 */
|
|
309
|
+
wallet_pass_usage_unit?: any;
|
|
298
310
|
}
|
|
299
311
|
/**
|
|
300
312
|
* 更新支付项参数
|
|
@@ -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 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -358,7 +358,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
358
358
|
};
|
|
359
359
|
setOtherData(key: string, value: any): void;
|
|
360
360
|
getOtherData(key: string): any;
|
|
361
|
-
getProductTypeById(id: number): Promise<"
|
|
361
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
362
362
|
/**
|
|
363
363
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
364
364
|
*
|
|
@@ -222,6 +222,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
222
222
|
product_id: item.product_id,
|
|
223
223
|
product_variant_id: item.product_variant_id,
|
|
224
224
|
quantity: item.num,
|
|
225
|
+
is_price_include_tax: item.is_price_include_tax,
|
|
225
226
|
// 商品是否含税:1;0
|
|
226
227
|
is_charge_tax: item.is_charge_tax ?? 0,
|
|
227
228
|
// 若商品不含税,计算得到的税费,单位(元)
|
|
@@ -246,6 +247,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
246
247
|
},
|
|
247
248
|
product_bundle: item.product_bundle.map((bundle) => {
|
|
248
249
|
return {
|
|
250
|
+
is_price_include_tax: item.is_price_include_tax,
|
|
249
251
|
bundle_id: bundle.bundle_id,
|
|
250
252
|
bundle_product_id: bundle.bundle_product_id,
|
|
251
253
|
bundle_variant_id: bundle.bundle_variant_id,
|