@pisell/private-materials 6.6.55 → 6.6.57
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/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +7 -7
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +8 -8
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/es/components/appointmentBooking/components/Voucher/index.js +7 -22
- package/es/components/booking/addons/index.js +2 -3
- package/es/components/booking/components/footer/amount.js +1 -1
- package/es/components/booking/components/footer/index.js +0 -7
- package/es/components/booking/components/footer/utils.d.ts +1 -1
- package/es/components/booking/components/footer/utils.js +5 -7
- package/es/components/booking/components/voucher/index.js +0 -6
- package/es/components/booking/components/voucher/index.less +1 -4
- package/es/components/booking/components/voucherModal/index.less +0 -1
- package/es/components/booking/dashboard/index.js +3 -3
- package/es/components/booking/info/service2/utils.d.ts +219 -0
- package/es/components/booking/info2/service/editService/index.js +2 -8
- package/es/components/checkout/components/WalletPassModule/index.js +0 -1
- package/es/components/checkout/components/WalletPassModule/utils.d.ts +0 -1
- package/es/components/checkout/components/WalletPassModule/utils.js +3 -17
- package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/es/components/checkout/hooks/useWalletPass.js +215 -331
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +0 -5
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +145 -166
- package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +0 -6
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +3 -3
- package/es/components/pay/toC/WalletPassBlock/index.js +1 -3
- package/es/components/pay/toC/index.js +27 -66
- package/es/components/pay/toC/model.d.ts +0 -1
- package/es/components/pay/toC/serve.d.ts +0 -18
- package/es/components/pay/toC/serve.js +1 -29
- package/es/components/pay/toC/utils.d.ts +2 -2
- package/es/components/pay/toC/utils.js +0 -4
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +4 -7
- package/es/pro/Login2.0/components/phoneValidation.js +65 -58
- package/lib/components/appointmentBooking/components/Voucher/index.js +2 -10
- package/lib/components/booking/addons/index.js +2 -3
- package/lib/components/booking/components/footer/amount.js +1 -1
- package/lib/components/booking/components/footer/index.js +0 -9
- package/lib/components/booking/components/footer/utils.d.ts +1 -1
- package/lib/components/booking/components/footer/utils.js +3 -5
- package/lib/components/booking/components/voucher/index.js +0 -6
- package/lib/components/booking/components/voucher/index.less +1 -4
- package/lib/components/booking/components/voucherModal/index.less +0 -1
- package/lib/components/booking/dashboard/index.js +3 -3
- package/lib/components/booking/info/service2/utils.d.ts +219 -0
- package/lib/components/booking/info2/service/editService/index.js +18 -24
- package/lib/components/checkout/components/WalletPassModule/index.js +0 -1
- package/lib/components/checkout/components/WalletPassModule/utils.d.ts +0 -1
- package/lib/components/checkout/components/WalletPassModule/utils.js +2 -18
- package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/lib/components/checkout/hooks/useWalletPass.js +131 -173
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +0 -5
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +103 -90
- package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +0 -6
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +2 -2
- package/lib/components/pay/toC/WalletPassBlock/index.js +1 -3
- package/lib/components/pay/toC/index.js +11 -52
- package/lib/components/pay/toC/model.d.ts +0 -1
- package/lib/components/pay/toC/serve.d.ts +0 -18
- package/lib/components/pay/toC/serve.js +0 -6
- package/lib/components/pay/toC/utils.d.ts +2 -2
- package/lib/components/pay/toC/utils.js +0 -4
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +7 -11
- package/lib/pro/Login2.0/components/phoneValidation.js +4 -2
- package/package.json +1 -1
|
@@ -43,28 +43,29 @@ var import_usePaymentLogger = __toESM(require("./usePaymentLogger"));
|
|
|
43
43
|
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
|
+
var import_context = require("../../ticketBooking/context");
|
|
47
|
+
var import_utils4 = require("../../ticketBooking/utils");
|
|
46
48
|
var useWalletPass = (props) => {
|
|
47
|
-
const { onSelectChange, customAmount, clientId
|
|
49
|
+
const { onSelectChange, customAmount, clientId } = props;
|
|
48
50
|
const logger = (0, import_usePaymentLogger.default)();
|
|
49
51
|
const { executeIfActive } = (0, import_pisellos.useActiveExecute)();
|
|
52
|
+
const osKey = (0, import_context.useOsKey)();
|
|
53
|
+
const moduleKey = (0, import_utils4.getShopDiscountKey)(osKey || "ticket");
|
|
50
54
|
const [walletRecommendList, setWalletRecommendList] = (0, import_react.useState)([]);
|
|
51
55
|
const [userIdentificationCodes, setUserIdentificationCodes] = (0, import_react.useState)(
|
|
52
56
|
[]
|
|
53
57
|
);
|
|
54
|
-
const [transformList, setTransformList] = (0, import_react.useState)([]);
|
|
55
|
-
const [noApplicableVoucher, setNoApplicableVoucher] = (0, import_react.useState)([]);
|
|
56
58
|
const initialOrderedDataRef = (0, import_react.useRef)([]);
|
|
57
59
|
const initialDiscountOrderRef = (0, import_react.useRef)([]);
|
|
58
60
|
const confirmedEditAmountIdsRef = (0, import_react.useRef)([]);
|
|
61
|
+
const timeoutRef = (0, import_react.useRef)(null);
|
|
59
62
|
const [searchIdentificationCodeList, setSearchIdentificationCodeList] = (0, import_react.useState)([]);
|
|
60
63
|
const [orderInfo, setOrderInfo] = (0, import_react.useState)({});
|
|
61
64
|
const [selectedWallet, setSelectedWallet] = (0, import_react.useState)([]);
|
|
62
65
|
const selectedWalletRef = (0, import_react.useRef)([]);
|
|
63
|
-
const [selectedVoucherIds, setSelectedVoucherIds] = (0, import_react.useState)([]);
|
|
64
66
|
const [disabledWalletData, setDisabledWalletData] = (0, import_react.useState)([]);
|
|
65
67
|
const notSetWalletSelectRef = (0, import_react.useRef)(false);
|
|
66
68
|
const showBestToastRef = (0, import_react.useRef)(false);
|
|
67
|
-
const [products, setProducts] = (0, import_react.useState)([]);
|
|
68
69
|
const selectedWalletIds = (0, import_react.useMemo)(() => {
|
|
69
70
|
return selectedWallet.map((item) => item.id);
|
|
70
71
|
}, [selectedWallet]);
|
|
@@ -76,10 +77,6 @@ var useWalletPass = (props) => {
|
|
|
76
77
|
const checkoutModule = pisellos.getModule("checkout");
|
|
77
78
|
const shopDiscount = (0, import_useShopDiscountModule.useShopDiscountModule)();
|
|
78
79
|
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
|
-
}, []);
|
|
83
80
|
const setWalletSelect = (0, import_ahooks.useMemoizedFn)((data2) => {
|
|
84
81
|
setSelectedWallet(data2);
|
|
85
82
|
selectedWalletRef.current = data2;
|
|
@@ -170,61 +167,34 @@ var useWalletPass = (props) => {
|
|
|
170
167
|
return orderedResult;
|
|
171
168
|
}
|
|
172
169
|
);
|
|
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]);
|
|
215
170
|
const data = (0, import_react.useMemo)(() => {
|
|
216
171
|
return (0, import_utils2.formatMachineCodeServer2CardList)(
|
|
217
172
|
(0, import_utils.uniqueByKey)(
|
|
218
173
|
mergeDataWithInitialOrder([
|
|
219
174
|
...selectedWallet,
|
|
220
|
-
...
|
|
221
|
-
...displayOtherVouchers
|
|
175
|
+
...userIdentificationCodes
|
|
222
176
|
]),
|
|
223
177
|
"id"
|
|
224
178
|
),
|
|
225
|
-
|
|
179
|
+
selectedWalletIds
|
|
226
180
|
);
|
|
227
|
-
}, [
|
|
181
|
+
}, [userIdentificationCodes, selectedWalletIds, selectedWallet]);
|
|
182
|
+
const fetchWalletRecommendList = (0, import_ahooks.useMemoizedFn)(async (params) => {
|
|
183
|
+
setLoading(true);
|
|
184
|
+
setError(null);
|
|
185
|
+
try {
|
|
186
|
+
const result = await paymentModule.wallet.getWalletPassRecommendListAsync(
|
|
187
|
+
params
|
|
188
|
+
);
|
|
189
|
+
setWalletRecommendList(result);
|
|
190
|
+
return result;
|
|
191
|
+
} catch (err) {
|
|
192
|
+
setError(err instanceof Error ? err.message : "获取钱包推荐列表失败");
|
|
193
|
+
throw err;
|
|
194
|
+
} finally {
|
|
195
|
+
setLoading(false);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
228
198
|
const fetchUserIdentificationCodes = (0, import_ahooks.useMemoizedFn)(async (params) => {
|
|
229
199
|
setLoading(true);
|
|
230
200
|
setError(null);
|
|
@@ -267,69 +237,37 @@ var useWalletPass = (props) => {
|
|
|
267
237
|
});
|
|
268
238
|
const handleSearchIdentificationCodeCompleted = (0, import_ahooks.useMemoizedFn)((data2) => {
|
|
269
239
|
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
|
-
);
|
|
290
240
|
let isAvailableData = [];
|
|
291
241
|
let isDisabledData = [];
|
|
292
|
-
if (
|
|
293
|
-
|
|
294
|
-
if (
|
|
242
|
+
if (currentSearchResults.length > 0) {
|
|
243
|
+
currentSearchResults.forEach((item) => {
|
|
244
|
+
if (!!item.unified_available_status) {
|
|
295
245
|
isAvailableData.push(item);
|
|
296
246
|
} else {
|
|
297
247
|
isDisabledData.push(item);
|
|
298
248
|
}
|
|
299
249
|
});
|
|
300
250
|
}
|
|
301
|
-
|
|
302
|
-
const allDisabledData = mergedSearchResults.filter((item) => !(0, import_utils2.getVoucherAvailableStatus)(item));
|
|
303
|
-
setDisabledWalletData(allDisabledData);
|
|
251
|
+
setDisabledWalletData(isDisabledData);
|
|
304
252
|
let newValues = [...selectedWalletRef.current];
|
|
305
253
|
if (isAvailableData.length === 1) {
|
|
306
254
|
newValues = [...selectedWalletRef.current, ...isAvailableData];
|
|
307
255
|
}
|
|
308
|
-
setSearchIdentificationCodeList(
|
|
309
|
-
setNoApplicableVoucher(allDisabledData);
|
|
256
|
+
setSearchIdentificationCodeList(cachedSearchResults);
|
|
310
257
|
setWalletSelect(newValues);
|
|
311
|
-
|
|
258
|
+
handleFetchUserIdentificationCodes(newValues.map((item) => item.id));
|
|
312
259
|
});
|
|
313
260
|
const onOrderCreated = (0, import_ahooks.useMemoizedFn)(() => {
|
|
314
|
-
var _a, _b;
|
|
315
261
|
const orderInfo2 = checkoutModule.getOrderOriginalData();
|
|
316
262
|
setOrderInfo(orderInfo2);
|
|
317
263
|
const recommendList = getCachedWalletRecommendList();
|
|
318
264
|
const userIdentificationCodes2 = getCachedUserIdentificationCodes();
|
|
319
|
-
const walletInitData = ((_b = (_a = paymentModule == null ? void 0 : paymentModule.wallet) == null ? void 0 : _a.getStoredWalletInitData) == null ? void 0 : _b.call(_a)) || {};
|
|
320
|
-
const transformListData = walletInitData.transformList || userIdentificationCodes2;
|
|
321
|
-
const noApplicableVoucherData = walletInitData.noApplicableVoucher || [];
|
|
322
|
-
const productsData = walletInitData.products || [];
|
|
323
265
|
const initialData = [...recommendList, ...userIdentificationCodes2];
|
|
324
266
|
setWalletRecommendList(recommendList);
|
|
325
|
-
setUserIdentificationCodes(
|
|
326
|
-
setTransformList(transformListData);
|
|
327
|
-
setNoApplicableVoucher(noApplicableVoucherData);
|
|
328
|
-
setProducts(productsData);
|
|
267
|
+
setUserIdentificationCodes(initialData);
|
|
329
268
|
initialOrderedDataRef.current = initialData;
|
|
330
269
|
if (!notSetWalletSelectRef.current) {
|
|
331
270
|
setWalletSelect(recommendList);
|
|
332
|
-
setSelectedVoucherIds(recommendList.map((item) => item.id));
|
|
333
271
|
const select = paymentModule.wallet.formatWalletPassList2PreparePayments(recommendList).map((item) => ({
|
|
334
272
|
code: item.tag,
|
|
335
273
|
voucher_id: item.voucher_id,
|
|
@@ -345,7 +283,6 @@ var useWalletPass = (props) => {
|
|
|
345
283
|
onSelectChange == null ? void 0 : onSelectChange(select);
|
|
346
284
|
} else {
|
|
347
285
|
setWalletSelect([]);
|
|
348
|
-
setSelectedVoucherIds([]);
|
|
349
286
|
notSetWalletSelectRef.current = false;
|
|
350
287
|
onSelectChange == null ? void 0 : onSelectChange([]);
|
|
351
288
|
}
|
|
@@ -383,7 +320,7 @@ var useWalletPass = (props) => {
|
|
|
383
320
|
});
|
|
384
321
|
const handlePaymentStarted = (0, import_ahooks.useMemoizedFn)(
|
|
385
322
|
async (params) => {
|
|
386
|
-
if (params.paymentMethodCode !== "VOUCHER_BATCH"
|
|
323
|
+
if (params.paymentMethodCode !== "VOUCHER_BATCH") {
|
|
387
324
|
notSetWalletSelectRef.current = true;
|
|
388
325
|
await checkoutModule.initWalletData({
|
|
389
326
|
order_wait_pay_amount: Number(customAmount)
|
|
@@ -465,6 +402,14 @@ var useWalletPass = (props) => {
|
|
|
465
402
|
);
|
|
466
403
|
};
|
|
467
404
|
}, [paymentModule]);
|
|
405
|
+
(0, import_react.useEffect)(() => {
|
|
406
|
+
return () => {
|
|
407
|
+
if (timeoutRef.current) {
|
|
408
|
+
clearTimeout(timeoutRef.current);
|
|
409
|
+
timeoutRef.current = null;
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
}, []);
|
|
468
413
|
const allList = (0, import_react.useMemo)(() => {
|
|
469
414
|
const reversedSearchData = [...searchIdentificationCodeList].reverse();
|
|
470
415
|
return [
|
|
@@ -484,22 +429,33 @@ var useWalletPass = (props) => {
|
|
|
484
429
|
)
|
|
485
430
|
).map((item) => item.code);
|
|
486
431
|
});
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
432
|
+
const handleFetchUserIdentificationCodes = (0, import_ahooks.useMemoizedFn)(
|
|
433
|
+
(value, walletRecommendList2) => {
|
|
434
|
+
const val = (0, import_utils.uniqueByKey)(walletRecommendList2 || allList, "id").filter(
|
|
435
|
+
(item) => value.includes(item.id)
|
|
436
|
+
);
|
|
437
|
+
const prepare_payments = paymentModule.wallet.formatWalletPassList2PreparePayments(val);
|
|
438
|
+
const select = prepare_payments.map((item) => ({
|
|
439
|
+
voucher_id: item.voucher_id,
|
|
440
|
+
amount: item.amount,
|
|
441
|
+
code: item.tag,
|
|
442
|
+
wallet_pass_usage_unit: item.wallet_pass_usage_unit,
|
|
443
|
+
wallet_pass_use_value: item.wallet_pass_use_value
|
|
444
|
+
}));
|
|
445
|
+
logger == null ? void 0 : logger.addLog({
|
|
446
|
+
type: "info",
|
|
447
|
+
title: "useWalletPass_handleFetchUserIdentificationCodes onSelectChange 开始调用",
|
|
448
|
+
metadata: {}
|
|
449
|
+
});
|
|
450
|
+
onSelectChange == null ? void 0 : onSelectChange(select);
|
|
451
|
+
fetchUserIdentificationCodes({
|
|
452
|
+
prepare_payments,
|
|
453
|
+
available: 2,
|
|
454
|
+
filter_prepare_wallet_pass: 1,
|
|
455
|
+
other_exact_codes: getOtherExactCodes()
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
);
|
|
503
459
|
const handleSearchIdentificationCode = (0, import_ahooks.useMemoizedFn)((value) => {
|
|
504
460
|
return paymentModule.wallet.searchIdentificationCodeAsync({
|
|
505
461
|
code: value,
|
|
@@ -509,27 +465,11 @@ var useWalletPass = (props) => {
|
|
|
509
465
|
});
|
|
510
466
|
});
|
|
511
467
|
const handleSelectWallet = (0, import_ahooks.useMemoizedFn)((value) => {
|
|
512
|
-
|
|
513
|
-
const deselectedIds = selectedVoucherIds.filter(
|
|
514
|
-
(id) => !value.includes(id)
|
|
515
|
-
);
|
|
516
|
-
if (deselectedIds.length > 0) {
|
|
517
|
-
const needResetIds = deselectedIds.filter((id) => {
|
|
518
|
-
const voucher = allVouchersForCalculation.find((v) => v.id === id);
|
|
519
|
-
return (voucher == null ? void 0 : voucher.edit_current_amount) !== void 0;
|
|
520
|
-
});
|
|
521
|
-
if (needResetIds.length > 0) {
|
|
522
|
-
updateWalletDataById(needResetIds, { edit_current_amount: void 0 });
|
|
523
|
-
confirmedEditAmountIdsRef.current = confirmedEditAmountIdsRef.current.filter(
|
|
524
|
-
(id) => !needResetIds.includes(id)
|
|
525
|
-
);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
setSelectedVoucherIds(value);
|
|
529
|
-
const val = allVouchersForCalculation.filter(
|
|
468
|
+
const val = userIdentificationCodes.filter(
|
|
530
469
|
(item) => value.includes(item.id)
|
|
531
470
|
);
|
|
532
471
|
setWalletSelect(val);
|
|
472
|
+
handleFetchUserIdentificationCodes(value);
|
|
533
473
|
});
|
|
534
474
|
const expiredWalletIds = (0, import_react.useMemo)(() => {
|
|
535
475
|
return (0, import_utils.uniqueByKey)(allList, "id").filter(
|
|
@@ -547,12 +487,12 @@ var useWalletPass = (props) => {
|
|
|
547
487
|
}, [allList]);
|
|
548
488
|
const clearAllSelectedWallet = (0, import_ahooks.useMemoizedFn)(() => {
|
|
549
489
|
var _a;
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
|
|
490
|
+
logger == null ? void 0 : logger.addLog({
|
|
491
|
+
type: "info",
|
|
492
|
+
title: "useWalletPass_clearAllSelectedWallet onSelectChange 开始调用",
|
|
493
|
+
metadata: {}
|
|
494
|
+
});
|
|
495
|
+
onSelectChange == null ? void 0 : onSelectChange([]);
|
|
556
496
|
if (selectedWalletIds.length === 0 && selectedDiscountList.length === 0) {
|
|
557
497
|
return;
|
|
558
498
|
}
|
|
@@ -570,20 +510,13 @@ var useWalletPass = (props) => {
|
|
|
570
510
|
);
|
|
571
511
|
setDiscountList(sortedDiscountList);
|
|
572
512
|
(_a = pisellos == null ? void 0 : pisellos.effects) == null ? void 0 : _a.emit(
|
|
573
|
-
|
|
513
|
+
`${moduleKey}:onSelectedDiscountListChange`,
|
|
574
514
|
detail
|
|
575
515
|
);
|
|
576
516
|
return;
|
|
577
517
|
}
|
|
578
518
|
setWalletSelect([]);
|
|
579
|
-
|
|
580
|
-
logger == null ? void 0 : logger.addLog({
|
|
581
|
-
type: "info",
|
|
582
|
-
title: "useWalletPass_clearAllSelectedWallet 立即通知外部清空",
|
|
583
|
-
metadata: {}
|
|
584
|
-
});
|
|
585
|
-
onSelectChange == null ? void 0 : onSelectChange([]);
|
|
586
|
-
setLoading(false);
|
|
519
|
+
handleFetchUserIdentificationCodes([]);
|
|
587
520
|
});
|
|
588
521
|
const isCurrentSelectionBest = (0, import_ahooks.useMemoizedFn)(() => {
|
|
589
522
|
if (walletRecommendList.length === 0) return true;
|
|
@@ -630,9 +563,12 @@ var useWalletPass = (props) => {
|
|
|
630
563
|
import_utils.locales.getText("wallet-pass-module-already-best-combination")
|
|
631
564
|
);
|
|
632
565
|
} else {
|
|
633
|
-
const select = searchIdentificationCodeList.filter((item) =>
|
|
566
|
+
const select = searchIdentificationCodeList.filter((item) => item.unified_available_status);
|
|
634
567
|
setWalletSelect(select);
|
|
635
|
-
|
|
568
|
+
handleFetchUserIdentificationCodes(
|
|
569
|
+
select.map((item) => item.id),
|
|
570
|
+
select
|
|
571
|
+
);
|
|
636
572
|
if (select.length) {
|
|
637
573
|
Toast == null ? void 0 : Toast.success(
|
|
638
574
|
import_utils.locales.getText("wallet-pass-module-best-combination-selected")
|
|
@@ -661,32 +597,37 @@ var useWalletPass = (props) => {
|
|
|
661
597
|
} else {
|
|
662
598
|
if (hasGoodPass && !isBestDiscount) return;
|
|
663
599
|
setWalletSelect(newWalletRecommendList);
|
|
664
|
-
|
|
600
|
+
handleFetchUserIdentificationCodes(
|
|
601
|
+
newWalletRecommendList.map((item) => item.id),
|
|
602
|
+
newWalletRecommendList
|
|
603
|
+
);
|
|
665
604
|
Toast == null ? void 0 : Toast.success(
|
|
666
605
|
import_utils.locales.getText("wallet-pass-module-best-combination-selected")
|
|
667
606
|
);
|
|
668
607
|
}
|
|
669
|
-
setLoading(false);
|
|
670
608
|
});
|
|
671
609
|
const handleSelectDiscount = (0, import_ahooks.useMemoizedFn)((value, option) => {
|
|
672
|
-
var _a
|
|
610
|
+
var _a;
|
|
673
611
|
setLoading(true);
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
612
|
+
try {
|
|
613
|
+
const isSelected = value.includes(option.id);
|
|
614
|
+
const detail = shopDiscount.setDiscountSelected({
|
|
615
|
+
discountId: option.id,
|
|
616
|
+
isSelected
|
|
617
|
+
});
|
|
618
|
+
const sortedDiscountList = sortDiscountListWithInitialOrder(
|
|
619
|
+
detail.discountList
|
|
620
|
+
);
|
|
621
|
+
setDiscountList(sortedDiscountList);
|
|
622
|
+
(_a = pisellos == null ? void 0 : pisellos.effects) == null ? void 0 : _a.emit(
|
|
623
|
+
`${moduleKey}:onSelectedDiscountListChange`,
|
|
624
|
+
detail
|
|
625
|
+
);
|
|
626
|
+
} catch (err) {
|
|
627
|
+
console.log(err, "1234err");
|
|
628
|
+
} finally {
|
|
680
629
|
setLoading(false);
|
|
681
630
|
}
|
|
682
|
-
const sortedDiscountList = sortDiscountListWithInitialOrder(
|
|
683
|
-
detail.discountList
|
|
684
|
-
);
|
|
685
|
-
setDiscountList(sortedDiscountList);
|
|
686
|
-
(_c = pisellos == null ? void 0 : pisellos.effects) == null ? void 0 : _c.emit(
|
|
687
|
-
"shopDiscount:onSelectedDiscountListChange",
|
|
688
|
-
detail
|
|
689
|
-
);
|
|
690
631
|
});
|
|
691
632
|
const clearDisabledWalletData = (0, import_ahooks.useMemoizedFn)(() => {
|
|
692
633
|
setDisabledWalletData([]);
|
|
@@ -713,12 +654,6 @@ var useWalletPass = (props) => {
|
|
|
713
654
|
updateData
|
|
714
655
|
);
|
|
715
656
|
setUserIdentificationCodes(newUserIdentificationCodes);
|
|
716
|
-
const newTransformList = updateArrayItemById(
|
|
717
|
-
transformList,
|
|
718
|
-
targetId,
|
|
719
|
-
updateData
|
|
720
|
-
);
|
|
721
|
-
setTransformList(newTransformList);
|
|
722
657
|
const newSearchIdentificationCodeList = updateArrayItemById(
|
|
723
658
|
searchIdentificationCodeList,
|
|
724
659
|
targetId,
|
|
@@ -734,7 +669,6 @@ var useWalletPass = (props) => {
|
|
|
734
669
|
return {
|
|
735
670
|
newWalletRecommendList,
|
|
736
671
|
newUserIdentificationCodes,
|
|
737
|
-
newTransformList,
|
|
738
672
|
newSearchIdentificationCodeList,
|
|
739
673
|
newSelectedWallet
|
|
740
674
|
};
|
|
@@ -743,21 +677,44 @@ var useWalletPass = (props) => {
|
|
|
743
677
|
const handleConfirmEditAmount = (0, import_ahooks.useMemoizedFn)(
|
|
744
678
|
(value, id, data2) => {
|
|
745
679
|
if (value === 0) {
|
|
746
|
-
const filteredIds =
|
|
680
|
+
const filteredIds = selectedWalletIds.filter(
|
|
747
681
|
(walletId) => walletId !== data2.id
|
|
748
682
|
);
|
|
749
683
|
handleSelectWallet(filteredIds);
|
|
750
684
|
return;
|
|
751
685
|
}
|
|
752
|
-
setLoading(true);
|
|
753
686
|
if (!confirmedEditAmountIdsRef.current.includes(data2.id)) {
|
|
754
687
|
confirmedEditAmountIdsRef.current.push(data2.id);
|
|
755
688
|
}
|
|
756
689
|
updateWalletDataById(data2.id, { edit_current_amount: value });
|
|
690
|
+
if (timeoutRef.current) {
|
|
691
|
+
clearTimeout(timeoutRef.current);
|
|
692
|
+
}
|
|
693
|
+
timeoutRef.current = setTimeout(() => {
|
|
694
|
+
handleFetchUserIdentificationCodes(selectedWalletIds);
|
|
695
|
+
timeoutRef.current = null;
|
|
696
|
+
});
|
|
757
697
|
}
|
|
758
698
|
);
|
|
759
699
|
const handleBeforeEditAmount = (0, import_ahooks.useMemoizedFn)(
|
|
760
700
|
async (value, index, data2) => {
|
|
701
|
+
const result = await paymentModule.wallet.searchIdentificationCodeAsync(
|
|
702
|
+
{
|
|
703
|
+
code: data2.code,
|
|
704
|
+
prepare_payments: paymentModule.wallet.formatWalletPassList2PreparePayments(
|
|
705
|
+
selectedWalletRef.current.filter(
|
|
706
|
+
(item) => item.id !== data2.id
|
|
707
|
+
)
|
|
708
|
+
)
|
|
709
|
+
},
|
|
710
|
+
{ noCache: true }
|
|
711
|
+
);
|
|
712
|
+
if (result.data && result.data.length > 0) {
|
|
713
|
+
const resultItem = result.data.find((item) => item.id === data2.id);
|
|
714
|
+
if (resultItem) {
|
|
715
|
+
updateWalletDataById(data2.id, resultItem);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
761
718
|
return true;
|
|
762
719
|
}
|
|
763
720
|
);
|
|
@@ -782,6 +739,7 @@ var useWalletPass = (props) => {
|
|
|
782
739
|
selectedDiscountList,
|
|
783
740
|
handleSelectDiscount,
|
|
784
741
|
customerName,
|
|
742
|
+
fetchWalletRecommendList,
|
|
785
743
|
fetchUserIdentificationCodes,
|
|
786
744
|
getCachedWalletRecommendList,
|
|
787
745
|
getCachedUserIdentificationCodes,
|
|
@@ -15,16 +15,11 @@ export interface WalletPassProps {
|
|
|
15
15
|
walletPass: {
|
|
16
16
|
cards: WalletPassDataType[];
|
|
17
17
|
amount: number;
|
|
18
|
-
recommended?: WalletPassDataType[];
|
|
19
|
-
transformList?: WalletPassDataType[];
|
|
20
|
-
noApplicableVoucher?: WalletPassDataType[];
|
|
21
18
|
};
|
|
22
19
|
walletSetting: {
|
|
23
20
|
name: string;
|
|
24
21
|
popup_status: 0 | 1;
|
|
25
22
|
};
|
|
26
|
-
orderDetail: any;
|
|
27
|
-
total_amount: number;
|
|
28
23
|
}
|
|
29
24
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<WalletPassProps & React.RefAttributes<WalletPassRef>>>;
|
|
30
25
|
export default _default;
|