@pisell/private-materials 6.6.11 → 6.6.12
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/appointmentBooking/components/Voucher/index.js +22 -7
- package/es/components/booking/addons/index.js +3 -2
- package/es/components/booking/components/footer/amount.js +2 -2
- package/es/components/booking/components/footer/index.js +7 -0
- package/es/components/booking/components/footer/utils.d.ts +1 -1
- package/es/components/booking/components/footer/utils.js +5 -3
- package/es/components/booking/components/voucher/index.js +6 -0
- package/es/components/booking/components/voucher/index.less +4 -1
- package/es/components/booking/components/voucherModal/index.less +1 -0
- package/es/components/booking/info2/service/editService/index.js +33 -2
- package/es/components/checkout/components/WalletPassModule/index.js +1 -0
- package/es/components/checkout/components/WalletPassModule/utils.js +14 -3
- package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/es/components/checkout/hooks/useWalletPass.js +310 -189
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +5 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +166 -145
- package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +6 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +3 -3
- package/es/components/pay/toC/WalletPassBlock/index.js +3 -1
- package/es/components/pay/toC/index.js +66 -27
- package/es/components/pay/toC/model.d.ts +1 -0
- package/es/components/pay/toC/serve.d.ts +18 -0
- package/es/components/pay/toC/serve.js +29 -1
- package/es/components/pay/toC/utils.d.ts +2 -2
- package/es/components/pay/toC/utils.js +4 -0
- package/es/components/systemSettings/registry/components/SectionList.js +5 -1
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +7 -4
- package/es/plus/walletPassGallery/serve.js +2 -0
- package/es/pro/Login2.0/AuthModal.js +12 -4
- package/es/pro/Login2.0/index.less +7 -7
- package/lib/components/appointmentBooking/components/Voucher/index.js +10 -2
- package/lib/components/booking/addons/index.js +3 -2
- package/lib/components/booking/components/footer/amount.js +1 -1
- package/lib/components/booking/components/footer/index.js +9 -0
- package/lib/components/booking/components/footer/utils.d.ts +1 -1
- package/lib/components/booking/components/footer/utils.js +5 -3
- package/lib/components/booking/components/voucher/index.js +6 -0
- package/lib/components/booking/components/voucher/index.less +4 -1
- package/lib/components/booking/components/voucherModal/index.less +1 -0
- package/lib/components/booking/info2/service/editService/index.js +48 -24
- package/lib/components/checkout/components/WalletPassModule/index.js +1 -0
- package/lib/components/checkout/components/WalletPassModule/utils.js +13 -2
- package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/lib/components/checkout/hooks/useWalletPass.js +151 -104
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +5 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +90 -103
- package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +6 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +2 -2
- package/lib/components/pay/toC/WalletPassBlock/index.js +3 -1
- package/lib/components/pay/toC/index.js +52 -11
- package/lib/components/pay/toC/model.d.ts +1 -0
- package/lib/components/pay/toC/serve.d.ts +18 -0
- package/lib/components/pay/toC/serve.js +6 -0
- package/lib/components/pay/toC/utils.d.ts +2 -2
- package/lib/components/pay/toC/utils.js +4 -0
- package/lib/components/systemSettings/registry/components/SectionList.js +4 -1
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +11 -7
- package/lib/plus/walletPassGallery/serve.js +2 -0
- package/lib/pro/Login2.0/AuthModal.js +15 -7
- package/lib/pro/Login2.0/index.less +7 -7
- package/package.json +2 -2
- package/es/components/checkout/PaymentModal.d.ts +0 -31
- package/lib/components/checkout/PaymentModal.d.ts +0 -31
|
@@ -44,24 +44,27 @@ var import_utils3 = require("../../booking/utils");
|
|
|
44
44
|
var import_pisellos = require("../../ticketBooking/hooks/pisellos");
|
|
45
45
|
var import_useShopDiscountModule = require("../../ticketBooking/hooks/pisellos/useShopDiscountModule");
|
|
46
46
|
var useWalletPass = (props) => {
|
|
47
|
-
const { onSelectChange, customAmount, clientId } = props;
|
|
47
|
+
const { onSelectChange, customAmount, clientId, totalAmount } = props;
|
|
48
48
|
const logger = (0, import_usePaymentLogger.default)();
|
|
49
49
|
const { executeIfActive } = (0, import_pisellos.useActiveExecute)();
|
|
50
50
|
const [walletRecommendList, setWalletRecommendList] = (0, import_react.useState)([]);
|
|
51
51
|
const [userIdentificationCodes, setUserIdentificationCodes] = (0, import_react.useState)(
|
|
52
52
|
[]
|
|
53
53
|
);
|
|
54
|
+
const [transformList, setTransformList] = (0, import_react.useState)([]);
|
|
55
|
+
const [noApplicableVoucher, setNoApplicableVoucher] = (0, import_react.useState)([]);
|
|
54
56
|
const initialOrderedDataRef = (0, import_react.useRef)([]);
|
|
55
57
|
const initialDiscountOrderRef = (0, import_react.useRef)([]);
|
|
56
58
|
const confirmedEditAmountIdsRef = (0, import_react.useRef)([]);
|
|
57
|
-
const timeoutRef = (0, import_react.useRef)(null);
|
|
58
59
|
const [searchIdentificationCodeList, setSearchIdentificationCodeList] = (0, import_react.useState)([]);
|
|
59
60
|
const [orderInfo, setOrderInfo] = (0, import_react.useState)({});
|
|
60
61
|
const [selectedWallet, setSelectedWallet] = (0, import_react.useState)([]);
|
|
61
62
|
const selectedWalletRef = (0, import_react.useRef)([]);
|
|
63
|
+
const [selectedVoucherIds, setSelectedVoucherIds] = (0, import_react.useState)([]);
|
|
62
64
|
const [disabledWalletData, setDisabledWalletData] = (0, import_react.useState)([]);
|
|
63
65
|
const notSetWalletSelectRef = (0, import_react.useRef)(false);
|
|
64
66
|
const showBestToastRef = (0, import_react.useRef)(false);
|
|
67
|
+
const [products, setProducts] = (0, import_react.useState)([]);
|
|
65
68
|
const selectedWalletIds = (0, import_react.useMemo)(() => {
|
|
66
69
|
return selectedWallet.map((item) => item.id);
|
|
67
70
|
}, [selectedWallet]);
|
|
@@ -73,6 +76,10 @@ var useWalletPass = (props) => {
|
|
|
73
76
|
const checkoutModule = pisellos.getModule("checkout");
|
|
74
77
|
const shopDiscount = (0, import_useShopDiscountModule.useShopDiscountModule)();
|
|
75
78
|
const paymentModule = checkoutModule == null ? void 0 : checkoutModule.payment;
|
|
79
|
+
const walletPassEvaluator = (0, import_react.useMemo)(() => {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
return (_b = (_a = paymentModule == null ? void 0 : paymentModule.window) == null ? void 0 : _a.getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
|
|
82
|
+
}, []);
|
|
76
83
|
const setWalletSelect = (0, import_ahooks.useMemoizedFn)((data2) => {
|
|
77
84
|
setSelectedWallet(data2);
|
|
78
85
|
selectedWalletRef.current = data2;
|
|
@@ -163,34 +170,61 @@ var useWalletPass = (props) => {
|
|
|
163
170
|
return orderedResult;
|
|
164
171
|
}
|
|
165
172
|
);
|
|
173
|
+
const allVouchersForCalculation = (0, import_react.useMemo)(() => {
|
|
174
|
+
return [...transformList || [], ...searchIdentificationCodeList || []];
|
|
175
|
+
}, [transformList, searchIdentificationCodeList]);
|
|
176
|
+
const selectedVouchers = (0, import_react.useMemo)(() => {
|
|
177
|
+
return selectedVoucherIds.map((id) => allVouchersForCalculation.find((v) => v.id === id)).filter(Boolean);
|
|
178
|
+
}, [selectedVoucherIds, allVouchersForCalculation]);
|
|
179
|
+
const { displayVouchers, displayOtherVouchers, selectedWithDetails, totalDeduction } = (0, import_react.useMemo)(() => {
|
|
180
|
+
if (!walletPassEvaluator || !allVouchersForCalculation.length || !totalAmount) {
|
|
181
|
+
return {
|
|
182
|
+
displayVouchers: [...transformList || [], ...noApplicableVoucher || []],
|
|
183
|
+
displayOtherVouchers: searchIdentificationCodeList || [],
|
|
184
|
+
selectedWithDetails: [],
|
|
185
|
+
totalDeduction: 0
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const result = walletPassEvaluator.recalculateVouchers(
|
|
189
|
+
allVouchersForCalculation,
|
|
190
|
+
selectedVouchers,
|
|
191
|
+
totalAmount,
|
|
192
|
+
products || []
|
|
193
|
+
);
|
|
194
|
+
const currentCustomerVouchers = [];
|
|
195
|
+
const otherCustomerVouchers = [];
|
|
196
|
+
result.allWithUpdatedStatus.forEach((voucher) => {
|
|
197
|
+
const isSearchVoucher = searchIdentificationCodeList.some((item) => item.id === voucher.id);
|
|
198
|
+
if (isSearchVoucher) {
|
|
199
|
+
otherCustomerVouchers.push(voucher);
|
|
200
|
+
} else {
|
|
201
|
+
currentCustomerVouchers.push(voucher);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
return {
|
|
205
|
+
displayVouchers: [...currentCustomerVouchers, ...noApplicableVoucher || []],
|
|
206
|
+
displayOtherVouchers: otherCustomerVouchers,
|
|
207
|
+
selectedWithDetails: result.selectedWithDetails,
|
|
208
|
+
totalDeduction: result.selectedWithDetails.reduce((sum, v) => sum + (v.actualDeduction || 0), 0)
|
|
209
|
+
};
|
|
210
|
+
}, [selectedVouchers, allVouchersForCalculation, transformList, searchIdentificationCodeList, noApplicableVoucher, totalAmount, products]);
|
|
211
|
+
(0, import_ahooks.useUpdateEffect)(() => {
|
|
212
|
+
notifySelectChange(selectedWithDetails);
|
|
213
|
+
setLoading(false);
|
|
214
|
+
}, [selectedWithDetails]);
|
|
166
215
|
const data = (0, import_react.useMemo)(() => {
|
|
167
216
|
return (0, import_utils2.formatMachineCodeServer2CardList)(
|
|
168
217
|
(0, import_utils.uniqueByKey)(
|
|
169
218
|
mergeDataWithInitialOrder([
|
|
170
219
|
...selectedWallet,
|
|
171
|
-
...
|
|
220
|
+
...displayVouchers,
|
|
221
|
+
...displayOtherVouchers
|
|
172
222
|
]),
|
|
173
223
|
"id"
|
|
174
224
|
),
|
|
175
|
-
|
|
225
|
+
selectedVoucherIds
|
|
176
226
|
);
|
|
177
|
-
}, [
|
|
178
|
-
const fetchWalletRecommendList = (0, import_ahooks.useMemoizedFn)(async (params) => {
|
|
179
|
-
setLoading(true);
|
|
180
|
-
setError(null);
|
|
181
|
-
try {
|
|
182
|
-
const result = await paymentModule.wallet.getWalletPassRecommendListAsync(
|
|
183
|
-
params
|
|
184
|
-
);
|
|
185
|
-
setWalletRecommendList(result);
|
|
186
|
-
return result;
|
|
187
|
-
} catch (err) {
|
|
188
|
-
setError(err instanceof Error ? err.message : "获取钱包推荐列表失败");
|
|
189
|
-
throw err;
|
|
190
|
-
} finally {
|
|
191
|
-
setLoading(false);
|
|
192
|
-
}
|
|
193
|
-
});
|
|
227
|
+
}, [displayVouchers, displayOtherVouchers, selectedVoucherIds, selectedWallet]);
|
|
194
228
|
const fetchUserIdentificationCodes = (0, import_ahooks.useMemoizedFn)(async (params) => {
|
|
195
229
|
setLoading(true);
|
|
196
230
|
setError(null);
|
|
@@ -233,10 +267,30 @@ var useWalletPass = (props) => {
|
|
|
233
267
|
});
|
|
234
268
|
const handleSearchIdentificationCodeCompleted = (0, import_ahooks.useMemoizedFn)((data2) => {
|
|
235
269
|
const { currentSearchResults, cachedSearchResults } = data2;
|
|
270
|
+
let formattedResults = currentSearchResults;
|
|
271
|
+
if (walletPassEvaluator && currentSearchResults.length > 0 && totalAmount) {
|
|
272
|
+
formattedResults = walletPassEvaluator.searchVoucherFormat({
|
|
273
|
+
vouchers: currentSearchResults,
|
|
274
|
+
orderTotalAmount: totalAmount,
|
|
275
|
+
products: products || []
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
let formattedCachedResults = cachedSearchResults || [];
|
|
279
|
+
if (walletPassEvaluator && cachedSearchResults && cachedSearchResults.length > 0 && totalAmount) {
|
|
280
|
+
formattedCachedResults = walletPassEvaluator.searchVoucherFormat({
|
|
281
|
+
vouchers: cachedSearchResults,
|
|
282
|
+
orderTotalAmount: totalAmount,
|
|
283
|
+
products: products || []
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
const mergedSearchResults = (0, import_utils.uniqueByKey)(
|
|
287
|
+
[...formattedCachedResults || [], ...formattedResults],
|
|
288
|
+
"id"
|
|
289
|
+
);
|
|
236
290
|
let isAvailableData = [];
|
|
237
291
|
let isDisabledData = [];
|
|
238
|
-
if (
|
|
239
|
-
|
|
292
|
+
if (formattedResults.length > 0) {
|
|
293
|
+
formattedResults.forEach((item) => {
|
|
240
294
|
if (!!item.unified_available_status) {
|
|
241
295
|
isAvailableData.push(item);
|
|
242
296
|
} else {
|
|
@@ -244,26 +298,36 @@ var useWalletPass = (props) => {
|
|
|
244
298
|
}
|
|
245
299
|
});
|
|
246
300
|
}
|
|
247
|
-
|
|
301
|
+
const allDisabledData = mergedSearchResults.filter((item) => !item.unified_available_status);
|
|
302
|
+
setDisabledWalletData(allDisabledData);
|
|
248
303
|
let newValues = [...selectedWalletRef.current];
|
|
249
304
|
if (isAvailableData.length === 1) {
|
|
250
305
|
newValues = [...selectedWalletRef.current, ...isAvailableData];
|
|
251
306
|
}
|
|
252
|
-
setSearchIdentificationCodeList(
|
|
307
|
+
setSearchIdentificationCodeList(mergedSearchResults);
|
|
253
308
|
setWalletSelect(newValues);
|
|
254
|
-
|
|
309
|
+
setSelectedVoucherIds(newValues.map((item) => item.id));
|
|
255
310
|
});
|
|
256
311
|
const onOrderCreated = (0, import_ahooks.useMemoizedFn)(() => {
|
|
312
|
+
var _a, _b;
|
|
257
313
|
const orderInfo2 = checkoutModule.getOrderOriginalData();
|
|
258
314
|
setOrderInfo(orderInfo2);
|
|
259
315
|
const recommendList = getCachedWalletRecommendList();
|
|
260
316
|
const userIdentificationCodes2 = getCachedUserIdentificationCodes();
|
|
317
|
+
const walletInitData = ((_b = (_a = paymentModule == null ? void 0 : paymentModule.wallet) == null ? void 0 : _a.getStoredWalletInitData) == null ? void 0 : _b.call(_a)) || {};
|
|
318
|
+
const transformListData = walletInitData.transformList || userIdentificationCodes2;
|
|
319
|
+
const noApplicableVoucherData = walletInitData.noApplicableVoucher || [];
|
|
320
|
+
const productsData = walletInitData.products || [];
|
|
261
321
|
const initialData = [...recommendList, ...userIdentificationCodes2];
|
|
262
322
|
setWalletRecommendList(recommendList);
|
|
263
|
-
setUserIdentificationCodes(
|
|
323
|
+
setUserIdentificationCodes(userIdentificationCodes2);
|
|
324
|
+
setTransformList(transformListData);
|
|
325
|
+
setNoApplicableVoucher(noApplicableVoucherData);
|
|
326
|
+
setProducts(productsData);
|
|
264
327
|
initialOrderedDataRef.current = initialData;
|
|
265
328
|
if (!notSetWalletSelectRef.current) {
|
|
266
329
|
setWalletSelect(recommendList);
|
|
330
|
+
setSelectedVoucherIds(recommendList.map((item) => item.id));
|
|
267
331
|
const select = paymentModule.wallet.formatWalletPassList2PreparePayments(recommendList).map((item) => ({
|
|
268
332
|
code: item.tag,
|
|
269
333
|
voucher_id: item.voucher_id,
|
|
@@ -277,6 +341,7 @@ var useWalletPass = (props) => {
|
|
|
277
341
|
onSelectChange == null ? void 0 : onSelectChange(select);
|
|
278
342
|
} else {
|
|
279
343
|
setWalletSelect([]);
|
|
344
|
+
setSelectedVoucherIds([]);
|
|
280
345
|
notSetWalletSelectRef.current = false;
|
|
281
346
|
onSelectChange == null ? void 0 : onSelectChange([]);
|
|
282
347
|
}
|
|
@@ -314,7 +379,7 @@ var useWalletPass = (props) => {
|
|
|
314
379
|
});
|
|
315
380
|
const handlePaymentStarted = (0, import_ahooks.useMemoizedFn)(
|
|
316
381
|
async (params) => {
|
|
317
|
-
if (params.paymentMethodCode !== "VOUCHER_BATCH") {
|
|
382
|
+
if (params.paymentMethodCode !== "VOUCHER_BATCH" && Number(customAmount || 0) > 0) {
|
|
318
383
|
notSetWalletSelectRef.current = true;
|
|
319
384
|
await checkoutModule.initWalletData({
|
|
320
385
|
order_wait_pay_amount: Number(customAmount)
|
|
@@ -396,14 +461,6 @@ var useWalletPass = (props) => {
|
|
|
396
461
|
);
|
|
397
462
|
};
|
|
398
463
|
}, [paymentModule]);
|
|
399
|
-
(0, import_react.useEffect)(() => {
|
|
400
|
-
return () => {
|
|
401
|
-
if (timeoutRef.current) {
|
|
402
|
-
clearTimeout(timeoutRef.current);
|
|
403
|
-
timeoutRef.current = null;
|
|
404
|
-
}
|
|
405
|
-
};
|
|
406
|
-
}, []);
|
|
407
464
|
const allList = (0, import_react.useMemo)(() => {
|
|
408
465
|
const reversedSearchData = [...searchIdentificationCodeList].reverse();
|
|
409
466
|
return [
|
|
@@ -423,31 +480,20 @@ var useWalletPass = (props) => {
|
|
|
423
480
|
)
|
|
424
481
|
).map((item) => item.code);
|
|
425
482
|
});
|
|
426
|
-
const
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
metadata: {}
|
|
441
|
-
});
|
|
442
|
-
onSelectChange == null ? void 0 : onSelectChange(select);
|
|
443
|
-
fetchUserIdentificationCodes({
|
|
444
|
-
prepare_payments,
|
|
445
|
-
available: 2,
|
|
446
|
-
filter_prepare_wallet_pass: 1,
|
|
447
|
-
other_exact_codes: getOtherExactCodes()
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
);
|
|
483
|
+
const notifySelectChange = (0, import_ahooks.useMemoizedFn)((selectedDetails) => {
|
|
484
|
+
const prepare_payments = paymentModule.wallet.formatWalletPassList2PreparePayments(selectedDetails);
|
|
485
|
+
const select = prepare_payments.map((item) => ({
|
|
486
|
+
voucher_id: item.voucher_id,
|
|
487
|
+
amount: item.amount,
|
|
488
|
+
code: item.tag
|
|
489
|
+
}));
|
|
490
|
+
logger == null ? void 0 : logger.addLog({
|
|
491
|
+
type: "info",
|
|
492
|
+
title: "useWalletPass_notifySelectChange 通知外部选择变化",
|
|
493
|
+
metadata: { selectedDetails, select }
|
|
494
|
+
});
|
|
495
|
+
onSelectChange == null ? void 0 : onSelectChange(select);
|
|
496
|
+
});
|
|
451
497
|
const handleSearchIdentificationCode = (0, import_ahooks.useMemoizedFn)((value) => {
|
|
452
498
|
return paymentModule.wallet.searchIdentificationCodeAsync({
|
|
453
499
|
code: value,
|
|
@@ -457,11 +503,27 @@ var useWalletPass = (props) => {
|
|
|
457
503
|
});
|
|
458
504
|
});
|
|
459
505
|
const handleSelectWallet = (0, import_ahooks.useMemoizedFn)((value) => {
|
|
460
|
-
|
|
506
|
+
setLoading(true);
|
|
507
|
+
const deselectedIds = selectedVoucherIds.filter(
|
|
508
|
+
(id) => !value.includes(id)
|
|
509
|
+
);
|
|
510
|
+
if (deselectedIds.length > 0) {
|
|
511
|
+
const needResetIds = deselectedIds.filter((id) => {
|
|
512
|
+
const voucher = allVouchersForCalculation.find((v) => v.id === id);
|
|
513
|
+
return (voucher == null ? void 0 : voucher.edit_current_amount) !== void 0;
|
|
514
|
+
});
|
|
515
|
+
if (needResetIds.length > 0) {
|
|
516
|
+
updateWalletDataById(needResetIds, { edit_current_amount: void 0 });
|
|
517
|
+
confirmedEditAmountIdsRef.current = confirmedEditAmountIdsRef.current.filter(
|
|
518
|
+
(id) => !needResetIds.includes(id)
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
setSelectedVoucherIds(value);
|
|
523
|
+
const val = allVouchersForCalculation.filter(
|
|
461
524
|
(item) => value.includes(item.id)
|
|
462
525
|
);
|
|
463
526
|
setWalletSelect(val);
|
|
464
|
-
handleFetchUserIdentificationCodes(value);
|
|
465
527
|
});
|
|
466
528
|
const expiredWalletIds = (0, import_react.useMemo)(() => {
|
|
467
529
|
return (0, import_utils.uniqueByKey)(allList, "id").filter(
|
|
@@ -479,12 +541,12 @@ var useWalletPass = (props) => {
|
|
|
479
541
|
}, [allList]);
|
|
480
542
|
const clearAllSelectedWallet = (0, import_ahooks.useMemoizedFn)(() => {
|
|
481
543
|
var _a;
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
544
|
+
if (confirmedEditAmountIdsRef.current.length > 0) {
|
|
545
|
+
updateWalletDataById(confirmedEditAmountIdsRef.current, {
|
|
546
|
+
edit_current_amount: void 0
|
|
547
|
+
});
|
|
548
|
+
confirmedEditAmountIdsRef.current = [];
|
|
549
|
+
}
|
|
488
550
|
if (selectedWalletIds.length === 0 && selectedDiscountList.length === 0) {
|
|
489
551
|
return;
|
|
490
552
|
}
|
|
@@ -508,7 +570,14 @@ var useWalletPass = (props) => {
|
|
|
508
570
|
return;
|
|
509
571
|
}
|
|
510
572
|
setWalletSelect([]);
|
|
511
|
-
|
|
573
|
+
setSelectedVoucherIds([]);
|
|
574
|
+
logger == null ? void 0 : logger.addLog({
|
|
575
|
+
type: "info",
|
|
576
|
+
title: "useWalletPass_clearAllSelectedWallet 立即通知外部清空",
|
|
577
|
+
metadata: {}
|
|
578
|
+
});
|
|
579
|
+
onSelectChange == null ? void 0 : onSelectChange([]);
|
|
580
|
+
setLoading(false);
|
|
512
581
|
});
|
|
513
582
|
const isCurrentSelectionBest = (0, import_ahooks.useMemoizedFn)(() => {
|
|
514
583
|
if (walletRecommendList.length === 0) return true;
|
|
@@ -557,10 +626,7 @@ var useWalletPass = (props) => {
|
|
|
557
626
|
} else {
|
|
558
627
|
const select = searchIdentificationCodeList.filter((item) => item.unified_available_status);
|
|
559
628
|
setWalletSelect(select);
|
|
560
|
-
|
|
561
|
-
select.map((item) => item.id),
|
|
562
|
-
select
|
|
563
|
-
);
|
|
629
|
+
setSelectedVoucherIds(select.map((item) => item.id));
|
|
564
630
|
if (select.length) {
|
|
565
631
|
Toast == null ? void 0 : Toast.success(
|
|
566
632
|
import_utils.locales.getText("wallet-pass-module-best-combination-selected")
|
|
@@ -589,14 +655,12 @@ var useWalletPass = (props) => {
|
|
|
589
655
|
} else {
|
|
590
656
|
if (hasGoodPass && !isBestDiscount) return;
|
|
591
657
|
setWalletSelect(newWalletRecommendList);
|
|
592
|
-
|
|
593
|
-
newWalletRecommendList.map((item) => item.id),
|
|
594
|
-
newWalletRecommendList
|
|
595
|
-
);
|
|
658
|
+
setSelectedVoucherIds(newWalletRecommendList.map((item) => item.id));
|
|
596
659
|
Toast == null ? void 0 : Toast.success(
|
|
597
660
|
import_utils.locales.getText("wallet-pass-module-best-combination-selected")
|
|
598
661
|
);
|
|
599
662
|
}
|
|
663
|
+
setLoading(false);
|
|
600
664
|
});
|
|
601
665
|
const handleSelectDiscount = (0, import_ahooks.useMemoizedFn)((value, option) => {
|
|
602
666
|
var _a, _b, _c;
|
|
@@ -643,6 +707,12 @@ var useWalletPass = (props) => {
|
|
|
643
707
|
updateData
|
|
644
708
|
);
|
|
645
709
|
setUserIdentificationCodes(newUserIdentificationCodes);
|
|
710
|
+
const newTransformList = updateArrayItemById(
|
|
711
|
+
transformList,
|
|
712
|
+
targetId,
|
|
713
|
+
updateData
|
|
714
|
+
);
|
|
715
|
+
setTransformList(newTransformList);
|
|
646
716
|
const newSearchIdentificationCodeList = updateArrayItemById(
|
|
647
717
|
searchIdentificationCodeList,
|
|
648
718
|
targetId,
|
|
@@ -658,6 +728,7 @@ var useWalletPass = (props) => {
|
|
|
658
728
|
return {
|
|
659
729
|
newWalletRecommendList,
|
|
660
730
|
newUserIdentificationCodes,
|
|
731
|
+
newTransformList,
|
|
661
732
|
newSearchIdentificationCodeList,
|
|
662
733
|
newSelectedWallet
|
|
663
734
|
};
|
|
@@ -666,44 +737,21 @@ var useWalletPass = (props) => {
|
|
|
666
737
|
const handleConfirmEditAmount = (0, import_ahooks.useMemoizedFn)(
|
|
667
738
|
(value, id, data2) => {
|
|
668
739
|
if (value === 0) {
|
|
669
|
-
const filteredIds =
|
|
740
|
+
const filteredIds = selectedVoucherIds.filter(
|
|
670
741
|
(walletId) => walletId !== data2.id
|
|
671
742
|
);
|
|
672
743
|
handleSelectWallet(filteredIds);
|
|
673
744
|
return;
|
|
674
745
|
}
|
|
746
|
+
setLoading(true);
|
|
675
747
|
if (!confirmedEditAmountIdsRef.current.includes(data2.id)) {
|
|
676
748
|
confirmedEditAmountIdsRef.current.push(data2.id);
|
|
677
749
|
}
|
|
678
750
|
updateWalletDataById(data2.id, { edit_current_amount: value });
|
|
679
|
-
if (timeoutRef.current) {
|
|
680
|
-
clearTimeout(timeoutRef.current);
|
|
681
|
-
}
|
|
682
|
-
timeoutRef.current = setTimeout(() => {
|
|
683
|
-
handleFetchUserIdentificationCodes(selectedWalletIds);
|
|
684
|
-
timeoutRef.current = null;
|
|
685
|
-
});
|
|
686
751
|
}
|
|
687
752
|
);
|
|
688
753
|
const handleBeforeEditAmount = (0, import_ahooks.useMemoizedFn)(
|
|
689
754
|
async (value, index, data2) => {
|
|
690
|
-
const result = await paymentModule.wallet.searchIdentificationCodeAsync(
|
|
691
|
-
{
|
|
692
|
-
code: data2.code,
|
|
693
|
-
prepare_payments: paymentModule.wallet.formatWalletPassList2PreparePayments(
|
|
694
|
-
selectedWalletRef.current.filter(
|
|
695
|
-
(item) => item.id !== data2.id
|
|
696
|
-
)
|
|
697
|
-
)
|
|
698
|
-
},
|
|
699
|
-
{ noCache: true }
|
|
700
|
-
);
|
|
701
|
-
if (result.data && result.data.length > 0) {
|
|
702
|
-
const resultItem = result.data.find((item) => item.id === data2.id);
|
|
703
|
-
if (resultItem) {
|
|
704
|
-
updateWalletDataById(data2.id, resultItem);
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
755
|
return true;
|
|
708
756
|
}
|
|
709
757
|
);
|
|
@@ -728,7 +776,6 @@ var useWalletPass = (props) => {
|
|
|
728
776
|
selectedDiscountList,
|
|
729
777
|
handleSelectDiscount,
|
|
730
778
|
customerName,
|
|
731
|
-
fetchWalletRecommendList,
|
|
732
779
|
fetchUserIdentificationCodes,
|
|
733
780
|
getCachedWalletRecommendList,
|
|
734
781
|
getCachedUserIdentificationCodes,
|
|
@@ -15,11 +15,16 @@ export interface WalletPassProps {
|
|
|
15
15
|
walletPass: {
|
|
16
16
|
cards: WalletPassDataType[];
|
|
17
17
|
amount: number;
|
|
18
|
+
recommended?: WalletPassDataType[];
|
|
19
|
+
transformList?: WalletPassDataType[];
|
|
20
|
+
noApplicableVoucher?: WalletPassDataType[];
|
|
18
21
|
};
|
|
19
22
|
walletSetting: {
|
|
20
23
|
name: string;
|
|
21
24
|
popup_status: 0 | 1;
|
|
22
25
|
};
|
|
26
|
+
orderDetail: any;
|
|
27
|
+
total_amount: number;
|
|
23
28
|
}
|
|
24
29
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<WalletPassProps & React.RefAttributes<WalletPassRef>>>;
|
|
25
30
|
export default _default;
|