@pisell/pisellos 2.2.275 → 2.2.277
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/core/index.js +0 -1
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
- package/dist/modules/Order/index.js +90 -89
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +4 -1
- package/dist/modules/Payment/walletpass.d.ts +11 -0
- package/dist/modules/Payment/walletpass.js +208 -54
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +65 -39
- package/dist/solution/BaseSales/index.d.ts +5 -0
- package/dist/solution/BaseSales/index.js +319 -284
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +1 -4
- package/lib/core/index.js +0 -1
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
- package/lib/modules/Order/index.js +12 -10
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +5 -1
- package/lib/modules/Payment/walletpass.d.ts +11 -0
- package/lib/modules/Payment/walletpass.js +183 -16
- package/lib/server/index.d.ts +5 -0
- package/lib/server/index.js +42 -7
- package/lib/solution/BaseSales/index.d.ts +5 -0
- package/lib/solution/BaseSales/index.js +17 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +1 -4
- package/package.json +1 -1
|
@@ -193,7 +193,7 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
193
193
|
}
|
|
194
194
|
// 从源头补充商品多语言标题
|
|
195
195
|
var productTitle = _objectSpread(_objectSpread({}, (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title_i18n) || {}), {}, {
|
|
196
|
-
original: (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || ''
|
|
196
|
+
original: (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.original_title) || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || ''
|
|
197
197
|
});
|
|
198
198
|
return {
|
|
199
199
|
product_id: productId,
|
|
@@ -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 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -326,7 +326,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
326
326
|
* 获取当前的客户搜索条件
|
|
327
327
|
* @returns 当前搜索条件
|
|
328
328
|
*/
|
|
329
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
329
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
330
330
|
/**
|
|
331
331
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
332
332
|
* @returns 客户状态
|
|
@@ -2620,10 +2620,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2620
2620
|
_context30.next = 11;
|
|
2621
2621
|
break;
|
|
2622
2622
|
}
|
|
2623
|
-
return _context30.abrupt("return", this.store.order.addProductsToOrder(orderLines
|
|
2624
|
-
skipEditDiscountConfigRefresh: true,
|
|
2625
|
-
skipDiscountRecalculation: true
|
|
2626
|
-
}));
|
|
2623
|
+
return _context30.abrupt("return", this.store.order.addProductsToOrder(orderLines));
|
|
2627
2624
|
case 11:
|
|
2628
2625
|
result = [];
|
|
2629
2626
|
_iterator2 = _createForOfIteratorHelper(orderLines);
|
package/lib/core/index.js
CHANGED
|
@@ -214,7 +214,6 @@ var WalletPassEvaluator = class {
|
|
|
214
214
|
}
|
|
215
215
|
const rawText = this.getText(reasonCode);
|
|
216
216
|
const currency = failedField && AMOUNT_FIELDS.has(failedField) ? ((_g = (_f = this.otherParams) == null ? void 0 : _f.getData) == null ? void 0 : _g.call(_f, "shop_symbol")) || "" : "";
|
|
217
|
-
console.log(currency, "currency12345");
|
|
218
217
|
const reason = thresholdValue !== void 0 ? formatReason(rawText, thresholdValue, currency) : rawText;
|
|
219
218
|
results.push({
|
|
220
219
|
voucher,
|
|
@@ -416,7 +415,6 @@ var WalletPassEvaluator = class {
|
|
|
416
415
|
* 计算适用商品的总金额和数量
|
|
417
416
|
*/
|
|
418
417
|
calculateApplicableProducts(products, applicableProductIds, deductTaxAndFee) {
|
|
419
|
-
console.log(products, "products1234");
|
|
420
418
|
let total = 0;
|
|
421
419
|
let count = 0;
|
|
422
420
|
if (applicableProductIds !== null && applicableProductIds.length === 0) {
|
|
@@ -26,6 +26,11 @@ export interface Voucher {
|
|
|
26
26
|
recommended_usage_amount: number;
|
|
27
27
|
/** 后端计算推荐使用金额(仅商品) 不包含税费附加费 */
|
|
28
28
|
recommended_pure_product_usage_amount: number;
|
|
29
|
+
/**
|
|
30
|
+
* 扫码资产自身可供前端重新计算的金额基准。
|
|
31
|
+
* 后端 recommended_usage_amount 会包含当前已选券上下文,取消勾选后不能继续把它当作资产永久上限。
|
|
32
|
+
*/
|
|
33
|
+
_wallet_asset_recalculation_base_amount?: number;
|
|
29
34
|
/** 实际抵扣金额 */
|
|
30
35
|
actualDeduction: number;
|
|
31
36
|
/** 抵扣详情 */
|
|
@@ -43,6 +43,21 @@ __export(utils_exports, {
|
|
|
43
43
|
});
|
|
44
44
|
module.exports = __toCommonJS(utils_exports);
|
|
45
45
|
var import_decimal = __toESM(require("decimal.js"));
|
|
46
|
+
var DEFAULT_WALLET_PASS_CALCULATION_CONFIG = {
|
|
47
|
+
maxDeductionAmount: 99999,
|
|
48
|
+
maxUsagePerOrder: 0,
|
|
49
|
+
allowCrossProduct: true,
|
|
50
|
+
applicableProductLimit: 0,
|
|
51
|
+
deductTaxAndFee: true,
|
|
52
|
+
maxPassesPerItem: 0,
|
|
53
|
+
deductOptionPrice: false
|
|
54
|
+
};
|
|
55
|
+
function getWalletPassCalculationConfig(voucher) {
|
|
56
|
+
return {
|
|
57
|
+
...DEFAULT_WALLET_PASS_CALCULATION_CONFIG,
|
|
58
|
+
...(voucher == null ? void 0 : voucher.config) || {}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
46
61
|
var getProductQuantity = (product) => {
|
|
47
62
|
return product.quantity || product.product_quantity || 1;
|
|
48
63
|
};
|
|
@@ -105,9 +120,15 @@ function applyMaxPassUsageIncrements(usageMap, walletPassProductId, maxPassesPer
|
|
|
105
120
|
});
|
|
106
121
|
}
|
|
107
122
|
var getRecommendedAmount = (voucher) => {
|
|
108
|
-
console.log("voucher312", voucher);
|
|
109
123
|
const { config, recommended_usage_amount, recommended_pure_product_usage_amount } = voucher;
|
|
110
124
|
const deductTaxAndFee = (config == null ? void 0 : config.deductTaxAndFee) ?? true;
|
|
125
|
+
const rawRecalculationBaseAmount = voucher._wallet_asset_recalculation_base_amount;
|
|
126
|
+
if (rawRecalculationBaseAmount !== void 0 && rawRecalculationBaseAmount !== null) {
|
|
127
|
+
const recalculationBaseAmount = Number(rawRecalculationBaseAmount);
|
|
128
|
+
if (Number.isFinite(recalculationBaseAmount) && recalculationBaseAmount >= 0) {
|
|
129
|
+
return recalculationBaseAmount;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
111
132
|
return deductTaxAndFee ? recommended_usage_amount : recommended_pure_product_usage_amount ?? recommended_usage_amount;
|
|
112
133
|
};
|
|
113
134
|
var getApplicableProductIds = (voucher) => {
|
|
@@ -145,7 +166,6 @@ var getApplicableProducts = (voucher, productsData) => {
|
|
|
145
166
|
return productsData.filter((p) => applicableProductIds.includes(p.product_id));
|
|
146
167
|
};
|
|
147
168
|
function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
148
|
-
console.log(products, "products123");
|
|
149
169
|
const productsCopy = expandProductsWithBundleItems(products, true);
|
|
150
170
|
let remainingOrderAmount = new import_decimal.default(orderTotalAmount);
|
|
151
171
|
const getItemPassUsage = (usageMap, walletPassProductId, lineKey) => {
|
|
@@ -218,7 +238,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
|
218
238
|
return import_decimal.default.min(baseAmount, finalApplicableAmount, remainingOrderAmount);
|
|
219
239
|
};
|
|
220
240
|
const isVoucherAvailable = (voucher, productsData, usedVoucherCounts2, itemPassUsage) => {
|
|
221
|
-
const { config,
|
|
241
|
+
const { config, product_id } = voucher;
|
|
222
242
|
const recommendedAmount = getRecommendedAmount(voucher);
|
|
223
243
|
if (recommendedAmount <= 0) {
|
|
224
244
|
return { isAvailable: false, reasonCode: "not_meet_the_required_conditions" };
|
|
@@ -453,6 +473,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
453
473
|
const productsForCalc = expandProductsWithBundleItems(products, true);
|
|
454
474
|
let remainingOrderAmount = new import_decimal.default(orderTotalAmount);
|
|
455
475
|
const selectedWithDetails = [];
|
|
476
|
+
const usedVoucherCounts = /* @__PURE__ */ new Map();
|
|
456
477
|
const itemPassUsageMap = /* @__PURE__ */ new Map();
|
|
457
478
|
const getItemPassUsageRecalc = (walletPassProductId, lineKey) => {
|
|
458
479
|
var _a;
|
|
@@ -469,8 +490,29 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
469
490
|
});
|
|
470
491
|
};
|
|
471
492
|
selectedVouchers.forEach((selectedVoucher) => {
|
|
472
|
-
const {
|
|
473
|
-
const
|
|
493
|
+
const { product_id } = selectedVoucher;
|
|
494
|
+
const config = getWalletPassCalculationConfig(selectedVoucher);
|
|
495
|
+
const {
|
|
496
|
+
maxDeductionAmount,
|
|
497
|
+
maxUsagePerOrder,
|
|
498
|
+
allowCrossProduct,
|
|
499
|
+
applicableProductLimit,
|
|
500
|
+
deductTaxAndFee,
|
|
501
|
+
maxPassesPerItem
|
|
502
|
+
} = config;
|
|
503
|
+
const usedCount = usedVoucherCounts.get(product_id) || 0;
|
|
504
|
+
if (maxUsagePerOrder > 0 && usedCount >= maxUsagePerOrder) {
|
|
505
|
+
selectedWithDetails.push({
|
|
506
|
+
...selectedVoucher,
|
|
507
|
+
config,
|
|
508
|
+
actualDeduction: 0,
|
|
509
|
+
deductionDetails: [],
|
|
510
|
+
_available_max_amount: 0,
|
|
511
|
+
_unified_available_status: 0,
|
|
512
|
+
reasonCode: "usage_limit_reached"
|
|
513
|
+
});
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
474
516
|
const unitPriceField = deductTaxAndFee ? "unitPriceWithTax" : "unitPricePure";
|
|
475
517
|
const amountField = deductTaxAndFee ? "remainingAmountWithTax" : "remainingAmountPure";
|
|
476
518
|
let applicableProducts = getApplicableProducts(
|
|
@@ -481,6 +523,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
481
523
|
if (applicableProducts.length === 0) {
|
|
482
524
|
selectedWithDetails.push({
|
|
483
525
|
...selectedVoucher,
|
|
526
|
+
config,
|
|
484
527
|
actualDeduction: 0,
|
|
485
528
|
deductionDetails: [],
|
|
486
529
|
_available_max_amount: 0,
|
|
@@ -558,6 +601,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
558
601
|
applyMaxPassUsageIncrements(itemPassUsageMap, selectedVoucher.product_id, maxPassesPerItem, deductionDetails);
|
|
559
602
|
selectedWithDetails.push({
|
|
560
603
|
...selectedVoucher,
|
|
604
|
+
config,
|
|
561
605
|
actualDeduction: totalDeducted.toNumber(),
|
|
562
606
|
// 转换为数字
|
|
563
607
|
deductionDetails,
|
|
@@ -565,12 +609,11 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
565
609
|
// 转换为数字
|
|
566
610
|
_unified_available_status: totalDeducted.greaterThan(0) ? 1 : 0
|
|
567
611
|
});
|
|
612
|
+
if (totalDeducted.greaterThan(0)) {
|
|
613
|
+
usedVoucherCounts.set(product_id, usedCount + 1);
|
|
614
|
+
}
|
|
568
615
|
});
|
|
569
616
|
const selectedIds = new Set(selectedVouchers.map((v) => v.id));
|
|
570
|
-
const usedVoucherCounts = /* @__PURE__ */ new Map();
|
|
571
|
-
selectedVouchers.forEach((v) => {
|
|
572
|
-
usedVoucherCounts.set(v.product_id, (usedVoucherCounts.get(v.product_id) || 0) + 1);
|
|
573
|
-
});
|
|
574
617
|
const allWithUpdatedStatus = allVouchers.map((voucher) => {
|
|
575
618
|
if (selectedIds.has(voucher.id)) {
|
|
576
619
|
const selectedDetail = selectedWithDetails.find(
|
|
@@ -578,8 +621,15 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
578
621
|
);
|
|
579
622
|
return selectedDetail || voucher;
|
|
580
623
|
}
|
|
581
|
-
const {
|
|
582
|
-
const
|
|
624
|
+
const { product_id } = voucher;
|
|
625
|
+
const config = getWalletPassCalculationConfig(voucher);
|
|
626
|
+
const {
|
|
627
|
+
maxDeductionAmount,
|
|
628
|
+
allowCrossProduct,
|
|
629
|
+
applicableProductLimit,
|
|
630
|
+
deductTaxAndFee,
|
|
631
|
+
maxPassesPerItem
|
|
632
|
+
} = config;
|
|
583
633
|
const unitPriceField = deductTaxAndFee ? "unitPriceWithTax" : "unitPricePure";
|
|
584
634
|
const amountField = deductTaxAndFee ? "remainingAmountWithTax" : "remainingAmountPure";
|
|
585
635
|
const recommendedAmount = getRecommendedAmount(voucher);
|
|
@@ -663,6 +713,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
663
713
|
}
|
|
664
714
|
return {
|
|
665
715
|
...voucher,
|
|
716
|
+
config,
|
|
666
717
|
_available_max_amount: calculatedMaxAmount.toNumber(),
|
|
667
718
|
// 转换为数字
|
|
668
719
|
_unified_available_status: isAvailable ? 1 : 0,
|
|
@@ -133,7 +133,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
133
133
|
this.draftPersistEnabled = true;
|
|
134
134
|
}
|
|
135
135
|
collectHydratedEditDiscounts(products) {
|
|
136
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
136
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
137
137
|
const discountMap = /* @__PURE__ */ new Map();
|
|
138
138
|
for (const product of (0, import_bundleDiscountHydration.expandHydratedProductsForDiscountCollection)(products)) {
|
|
139
139
|
for (const item of (product == null ? void 0 : product.discount_list) || []) {
|
|
@@ -148,16 +148,18 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
148
148
|
const key = Number.isFinite(id) ? id : String(resourceId);
|
|
149
149
|
const title = ((_b = item == null ? void 0 : item.discount) == null ? void 0 : _b.title) ?? {};
|
|
150
150
|
const amount = Number((item == null ? void 0 : item.amount) || 0);
|
|
151
|
+
const discountCardType = (_c = item == null ? void 0 : item.discount) == null ? void 0 : _c.discount_card_type;
|
|
152
|
+
const parValue = isDiscountCard ? discountCardType === "fixed_amount" ? ((_d = item == null ? void 0 : item.discount) == null ? void 0 : _d.fixed_amount) ?? (item == null ? void 0 : item.amount) : (_e = item == null ? void 0 : item.discount) == null ? void 0 : _e.percent : "0";
|
|
151
153
|
const detail = {
|
|
152
154
|
amount: String((item == null ? void 0 : item.amount) ?? "0"),
|
|
153
155
|
type,
|
|
154
156
|
resource_id: key,
|
|
155
157
|
title,
|
|
156
|
-
original_amount: String(((
|
|
157
|
-
num: Number(((
|
|
158
|
+
original_amount: String(((_f = item == null ? void 0 : item.discount) == null ? void 0 : _f.original_amount) ?? (item == null ? void 0 : item.amount) ?? "0"),
|
|
159
|
+
num: Number(((_g = item == null ? void 0 : item.metadata) == null ? void 0 : _g.num) ?? (product == null ? void 0 : product.num) ?? (product == null ? void 0 : product.product_quantity) ?? 1) || 1,
|
|
158
160
|
metadata: item == null ? void 0 : item.metadata,
|
|
159
161
|
discount: item == null ? void 0 : item.discount,
|
|
160
|
-
_num: Number(((
|
|
162
|
+
_num: Number(((_h = item == null ? void 0 : item.metadata) == null ? void 0 : _h.num) ?? (product == null ? void 0 : product.num) ?? (product == null ? void 0 : product.product_quantity) ?? 1) || 1
|
|
161
163
|
};
|
|
162
164
|
const existed = discountMap.get(key);
|
|
163
165
|
if (existed) {
|
|
@@ -166,7 +168,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
166
168
|
if (!isDiscountCard) {
|
|
167
169
|
existed.balance = String(Number(existed.balance || 0) + amount);
|
|
168
170
|
}
|
|
169
|
-
const productIds = Array.isArray((
|
|
171
|
+
const productIds = Array.isArray((_i = existed.limited_relation_product_data) == null ? void 0 : _i.product_ids) ? existed.limited_relation_product_data.product_ids : [];
|
|
170
172
|
if ((product == null ? void 0 : product.product_id) !== void 0 && (product == null ? void 0 : product.product_id) !== null && !productIds.includes(product.product_id)) {
|
|
171
173
|
existed.limited_relation_product_data = {
|
|
172
174
|
...existed.limited_relation_product_data || {},
|
|
@@ -189,9 +191,9 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
189
191
|
encoded: "",
|
|
190
192
|
code: "",
|
|
191
193
|
tag: type,
|
|
192
|
-
product_id: ((
|
|
194
|
+
product_id: ((_j = item == null ? void 0 : item.discount) == null ? void 0 : _j.discount_product_id) ?? (product == null ? void 0 : product.product_id) ?? 0,
|
|
193
195
|
relation_type: "",
|
|
194
|
-
par_value: String(
|
|
196
|
+
par_value: String(parValue ?? "0"),
|
|
195
197
|
used_par_value: String((item == null ? void 0 : item.amount) ?? "0"),
|
|
196
198
|
limit_status: "enable",
|
|
197
199
|
limited_relation_product_data: {
|
|
@@ -221,8 +223,8 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
221
223
|
discount: {
|
|
222
224
|
...(item == null ? void 0 : item.discount) || {},
|
|
223
225
|
resource_id: key,
|
|
224
|
-
discount_product_id: ((
|
|
225
|
-
discount_calculation_mode: ((
|
|
226
|
+
discount_product_id: ((_k = item == null ? void 0 : item.discount) == null ? void 0 : _k.discount_product_id) ?? (product == null ? void 0 : product.product_id) ?? 0,
|
|
227
|
+
discount_calculation_mode: ((_l = item == null ? void 0 : item.discount) == null ? void 0 : _l.discount_calculation_mode) ?? "item_level"
|
|
226
228
|
},
|
|
227
229
|
applicableProductDetails: [detail],
|
|
228
230
|
appliedProductDetails: [detail]
|
|
@@ -274,7 +276,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
274
276
|
const isPersistedBundleProduct = isPersistedProduct || Boolean(
|
|
275
277
|
(bundle == null ? void 0 : bundle.order_detail_id) || (bundle == null ? void 0 : bundle.orderDetailId) || (bundle == null ? void 0 : bundle.booking_id)
|
|
276
278
|
);
|
|
277
|
-
const bundleQty =
|
|
279
|
+
const bundleQty = Number(qty) || 1;
|
|
278
280
|
for (const pd of (bundle == null ? void 0 : bundle.discount_list) || []) {
|
|
279
281
|
addProductDiscountAmount(pd, bundleQty, isPersistedBundleProduct);
|
|
280
282
|
}
|
|
@@ -486,6 +486,8 @@ export interface WalletPassPayment {
|
|
|
486
486
|
importWalletAssetsSnapshot: (snapshot: WalletAssetsSnapshot) => WalletAssetsState;
|
|
487
487
|
/** 设置单张钱包资产的选择状态并重新计算其实际抵扣额。 */
|
|
488
488
|
selectWalletAsset: (assetId: WalletAssetId, options: SelectWalletAssetOptions) => WalletAssetsState;
|
|
489
|
+
/** 更新已选钱包资产的手动使用金额,并保持原有选择顺序重新计算。 */
|
|
490
|
+
updateWalletAssetAmount: (assetId: WalletAssetId, amount: number) => WalletAssetsState;
|
|
489
491
|
/** 精确搜索钱包资产;仅当前券可用时自动选择。 */
|
|
490
492
|
scanWalletAssetAsync: (code: string) => Promise<ScanWalletAssetResult>;
|
|
491
493
|
/** 清空未确认的钱包资产选择。 */
|
|
@@ -34,7 +34,11 @@ var formatWalletPassList2PreparePayments = (list) => {
|
|
|
34
34
|
const formatted = (list || []).map((item) => {
|
|
35
35
|
return {
|
|
36
36
|
voucher_id: item.id || 0,
|
|
37
|
-
|
|
37
|
+
// 前端策略重算后的 actualDeduction 才是最终可同步金额;
|
|
38
|
+
// edit_current_amount 只是用户请求值,仍可能被策略和订单剩余金额裁剪。
|
|
39
|
+
amount: Number(
|
|
40
|
+
item.actualDeduction ?? item.edit_current_amount ?? getAvailableMaxAmount(item)
|
|
41
|
+
) || 0,
|
|
38
42
|
tag: item.tag || "",
|
|
39
43
|
wallet_pass_usage_unit: item.wallet_pass_usage_unit || {},
|
|
40
44
|
wallet_pass_use_value: item.wallet_pass_use_value || void 0
|
|
@@ -24,6 +24,11 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
24
24
|
private emitEvent;
|
|
25
25
|
private publishWalletAssetsState;
|
|
26
26
|
private recalculateWalletAssets;
|
|
27
|
+
/**
|
|
28
|
+
* 搜索接口只返回后端 Wallet Pass 数据,不包含前端策略 config。
|
|
29
|
+
* 在资产进入共享选择状态前补齐策略结果,避免增量重算回退到接口状态。
|
|
30
|
+
*/
|
|
31
|
+
private formatSearchedWalletPaymentAssets;
|
|
27
32
|
/** 获取当前缓存中所有支付类 Wallet 资产的扫码 code。 */
|
|
28
33
|
private getSearchedWalletAssetCodes;
|
|
29
34
|
/**
|
|
@@ -106,7 +111,13 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
106
111
|
getWalletAssetsState(): WalletAssetsState;
|
|
107
112
|
exportWalletAssetsSnapshot(): WalletAssetsSnapshot;
|
|
108
113
|
importWalletAssetsSnapshot(snapshot: WalletAssetsSnapshot): WalletAssetsState;
|
|
114
|
+
private updateWalletAssetEditAmountInCaches;
|
|
109
115
|
selectWalletAsset(assetId: WalletAssetId, options: SelectWalletAssetOptions): WalletAssetsState;
|
|
116
|
+
/**
|
|
117
|
+
* 更新已选资产的手动金额。只允许在当前实际抵扣额内向下调整,
|
|
118
|
+
* 金额为 0 时沿用 legacy 行为取消选择。
|
|
119
|
+
*/
|
|
120
|
+
updateWalletAssetAmount(assetId: WalletAssetId, amount: number): WalletAssetsState;
|
|
110
121
|
scanWalletAssetAsync(code: string): Promise<ScanWalletAssetResult>;
|
|
111
122
|
clearWalletAssetSelection(): WalletAssetsState;
|
|
112
123
|
setCommittedWalletAssets(committedIds: WalletAssetId[], committedAssets?: any[]): WalletAssetsState;
|