@pisell/private-materials 6.6.48 → 6.6.49
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 +7 -22
- package/es/components/booking/addons/index.js +2 -3
- package/es/components/booking/addons/model.d.ts +10 -1
- 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/forms/model.d.ts +10 -1
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
- package/es/components/booking/hooks/useClearCart.d.ts +1 -1
- package/es/components/booking/hooks/useClearCart.js +39 -9
- package/es/components/booking/info/model.d.ts +10 -1
- package/es/components/booking/info/service/index.less +4 -2
- package/es/components/booking/info2/cartClientCard/index.js +82 -2
- package/es/components/booking/info2/serve.d.ts +8 -0
- package/es/components/booking/info2/serve.js +52 -0
- package/es/components/booking/info2/service/editService/index.js +3 -9
- package/es/components/booking/info2/service/index.js +4 -5
- package/es/components/booking/locales.d.ts +20 -0
- package/es/components/booking/locales.js +20 -0
- package/es/components/booking/model.d.ts +9 -1
- package/es/components/booking/notes/model.d.ts +10 -1
- package/es/components/booking/payments/model.d.ts +10 -1
- 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 +192 -316
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +2 -2
- 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 +9 -2
- 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/schedules/model.d.ts +9 -1
- package/es/components/shoppingCart/components/Cart/index.less +1 -0
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +1 -1
- package/es/components/shoppingCart/hooks/useClearCart.js +41 -11
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +4 -7
- package/es/components/ticketBooking/index.js +5 -2
- package/es/plus/clinetSearch/index.d.ts +1 -0
- package/es/plus/clinetSearch/index.js +9 -3
- package/es/plus/clinetSearch/index.less +13 -0
- package/lib/components/appointmentBooking/components/Voucher/index.js +2 -10
- package/lib/components/booking/addons/index.js +2 -3
- package/lib/components/booking/addons/model.d.ts +10 -1
- 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/forms/model.d.ts +10 -1
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
- package/lib/components/booking/hooks/useClearCart.d.ts +1 -1
- package/lib/components/booking/hooks/useClearCart.js +28 -6
- package/lib/components/booking/info/model.d.ts +10 -1
- package/lib/components/booking/info/service/index.less +4 -2
- package/lib/components/booking/info2/cartClientCard/index.js +46 -2
- package/lib/components/booking/info2/serve.d.ts +8 -0
- package/lib/components/booking/info2/serve.js +12 -0
- package/lib/components/booking/info2/service/editService/index.js +19 -25
- package/lib/components/booking/info2/service/index.js +4 -2
- package/lib/components/booking/locales.d.ts +20 -0
- package/lib/components/booking/locales.js +20 -0
- package/lib/components/booking/model.d.ts +9 -1
- package/lib/components/booking/notes/model.d.ts +10 -1
- package/lib/components/booking/payments/model.d.ts +10 -1
- 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 +108 -157
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- 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 +9 -2
- 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/schedules/model.d.ts +9 -1
- package/lib/components/shoppingCart/components/Cart/index.less +1 -0
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +1 -1
- package/lib/components/shoppingCart/hooks/useClearCart.js +42 -11
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +7 -11
- package/lib/components/ticketBooking/index.js +4 -2
- package/lib/plus/clinetSearch/index.d.ts +1 -0
- package/lib/plus/clinetSearch/index.js +10 -0
- package/lib/plus/clinetSearch/index.less +13 -0
- package/package.json +3 -3
|
@@ -44,27 +44,24 @@ 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
|
|
47
|
+
const { onSelectChange, customAmount, clientId } = 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)([]);
|
|
56
54
|
const initialOrderedDataRef = (0, import_react.useRef)([]);
|
|
57
55
|
const initialDiscountOrderRef = (0, import_react.useRef)([]);
|
|
58
56
|
const confirmedEditAmountIdsRef = (0, import_react.useRef)([]);
|
|
57
|
+
const timeoutRef = (0, import_react.useRef)(null);
|
|
59
58
|
const [searchIdentificationCodeList, setSearchIdentificationCodeList] = (0, import_react.useState)([]);
|
|
60
59
|
const [orderInfo, setOrderInfo] = (0, import_react.useState)({});
|
|
61
60
|
const [selectedWallet, setSelectedWallet] = (0, import_react.useState)([]);
|
|
62
61
|
const selectedWalletRef = (0, import_react.useRef)([]);
|
|
63
|
-
const [selectedVoucherIds, setSelectedVoucherIds] = (0, import_react.useState)([]);
|
|
64
62
|
const [disabledWalletData, setDisabledWalletData] = (0, import_react.useState)([]);
|
|
65
63
|
const notSetWalletSelectRef = (0, import_react.useRef)(false);
|
|
66
64
|
const showBestToastRef = (0, import_react.useRef)(false);
|
|
67
|
-
const [products, setProducts] = (0, import_react.useState)([]);
|
|
68
65
|
const selectedWalletIds = (0, import_react.useMemo)(() => {
|
|
69
66
|
return selectedWallet.map((item) => item.id);
|
|
70
67
|
}, [selectedWallet]);
|
|
@@ -76,10 +73,6 @@ var useWalletPass = (props) => {
|
|
|
76
73
|
const checkoutModule = pisellos.getModule("checkout");
|
|
77
74
|
const shopDiscount = (0, import_useShopDiscountModule.useShopDiscountModule)();
|
|
78
75
|
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
76
|
const setWalletSelect = (0, import_ahooks.useMemoizedFn)((data2) => {
|
|
84
77
|
setSelectedWallet(data2);
|
|
85
78
|
selectedWalletRef.current = data2;
|
|
@@ -170,61 +163,34 @@ var useWalletPass = (props) => {
|
|
|
170
163
|
return orderedResult;
|
|
171
164
|
}
|
|
172
165
|
);
|
|
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
166
|
const data = (0, import_react.useMemo)(() => {
|
|
216
167
|
return (0, import_utils2.formatMachineCodeServer2CardList)(
|
|
217
168
|
(0, import_utils.uniqueByKey)(
|
|
218
169
|
mergeDataWithInitialOrder([
|
|
219
170
|
...selectedWallet,
|
|
220
|
-
...
|
|
221
|
-
...displayOtherVouchers
|
|
171
|
+
...userIdentificationCodes
|
|
222
172
|
]),
|
|
223
173
|
"id"
|
|
224
174
|
),
|
|
225
|
-
|
|
175
|
+
selectedWalletIds
|
|
226
176
|
);
|
|
227
|
-
}, [
|
|
177
|
+
}, [userIdentificationCodes, selectedWalletIds, selectedWallet]);
|
|
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
|
+
});
|
|
228
194
|
const fetchUserIdentificationCodes = (0, import_ahooks.useMemoizedFn)(async (params) => {
|
|
229
195
|
setLoading(true);
|
|
230
196
|
setError(null);
|
|
@@ -267,69 +233,37 @@ var useWalletPass = (props) => {
|
|
|
267
233
|
});
|
|
268
234
|
const handleSearchIdentificationCodeCompleted = (0, import_ahooks.useMemoizedFn)((data2) => {
|
|
269
235
|
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
236
|
let isAvailableData = [];
|
|
291
237
|
let isDisabledData = [];
|
|
292
|
-
if (
|
|
293
|
-
|
|
294
|
-
if (
|
|
238
|
+
if (currentSearchResults.length > 0) {
|
|
239
|
+
currentSearchResults.forEach((item) => {
|
|
240
|
+
if (!!item.unified_available_status) {
|
|
295
241
|
isAvailableData.push(item);
|
|
296
242
|
} else {
|
|
297
243
|
isDisabledData.push(item);
|
|
298
244
|
}
|
|
299
245
|
});
|
|
300
246
|
}
|
|
301
|
-
|
|
302
|
-
const allDisabledData = mergedSearchResults.filter((item) => !(0, import_utils2.getVoucherAvailableStatus)(item));
|
|
303
|
-
setDisabledWalletData(allDisabledData);
|
|
247
|
+
setDisabledWalletData(isDisabledData);
|
|
304
248
|
let newValues = [...selectedWalletRef.current];
|
|
305
249
|
if (isAvailableData.length === 1) {
|
|
306
250
|
newValues = [...selectedWalletRef.current, ...isAvailableData];
|
|
307
251
|
}
|
|
308
|
-
setSearchIdentificationCodeList(
|
|
309
|
-
setNoApplicableVoucher(allDisabledData);
|
|
252
|
+
setSearchIdentificationCodeList(cachedSearchResults);
|
|
310
253
|
setWalletSelect(newValues);
|
|
311
|
-
|
|
254
|
+
handleFetchUserIdentificationCodes(newValues.map((item) => item.id));
|
|
312
255
|
});
|
|
313
256
|
const onOrderCreated = (0, import_ahooks.useMemoizedFn)(() => {
|
|
314
|
-
var _a, _b;
|
|
315
257
|
const orderInfo2 = checkoutModule.getOrderOriginalData();
|
|
316
258
|
setOrderInfo(orderInfo2);
|
|
317
259
|
const recommendList = getCachedWalletRecommendList();
|
|
318
260
|
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
261
|
const initialData = [...recommendList, ...userIdentificationCodes2];
|
|
324
262
|
setWalletRecommendList(recommendList);
|
|
325
|
-
setUserIdentificationCodes(
|
|
326
|
-
setTransformList(transformListData);
|
|
327
|
-
setNoApplicableVoucher(noApplicableVoucherData);
|
|
328
|
-
setProducts(productsData);
|
|
263
|
+
setUserIdentificationCodes(initialData);
|
|
329
264
|
initialOrderedDataRef.current = initialData;
|
|
330
265
|
if (!notSetWalletSelectRef.current) {
|
|
331
266
|
setWalletSelect(recommendList);
|
|
332
|
-
setSelectedVoucherIds(recommendList.map((item) => item.id));
|
|
333
267
|
const select = paymentModule.wallet.formatWalletPassList2PreparePayments(recommendList).map((item) => ({
|
|
334
268
|
code: item.tag,
|
|
335
269
|
voucher_id: item.voucher_id,
|
|
@@ -345,7 +279,6 @@ var useWalletPass = (props) => {
|
|
|
345
279
|
onSelectChange == null ? void 0 : onSelectChange(select);
|
|
346
280
|
} else {
|
|
347
281
|
setWalletSelect([]);
|
|
348
|
-
setSelectedVoucherIds([]);
|
|
349
282
|
notSetWalletSelectRef.current = false;
|
|
350
283
|
onSelectChange == null ? void 0 : onSelectChange([]);
|
|
351
284
|
}
|
|
@@ -383,7 +316,7 @@ var useWalletPass = (props) => {
|
|
|
383
316
|
});
|
|
384
317
|
const handlePaymentStarted = (0, import_ahooks.useMemoizedFn)(
|
|
385
318
|
async (params) => {
|
|
386
|
-
if (params.paymentMethodCode !== "VOUCHER_BATCH"
|
|
319
|
+
if (params.paymentMethodCode !== "VOUCHER_BATCH") {
|
|
387
320
|
notSetWalletSelectRef.current = true;
|
|
388
321
|
await checkoutModule.initWalletData({
|
|
389
322
|
order_wait_pay_amount: Number(customAmount)
|
|
@@ -465,6 +398,14 @@ var useWalletPass = (props) => {
|
|
|
465
398
|
);
|
|
466
399
|
};
|
|
467
400
|
}, [paymentModule]);
|
|
401
|
+
(0, import_react.useEffect)(() => {
|
|
402
|
+
return () => {
|
|
403
|
+
if (timeoutRef.current) {
|
|
404
|
+
clearTimeout(timeoutRef.current);
|
|
405
|
+
timeoutRef.current = null;
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
}, []);
|
|
468
409
|
const allList = (0, import_react.useMemo)(() => {
|
|
469
410
|
const reversedSearchData = [...searchIdentificationCodeList].reverse();
|
|
470
411
|
return [
|
|
@@ -484,22 +425,33 @@ var useWalletPass = (props) => {
|
|
|
484
425
|
)
|
|
485
426
|
).map((item) => item.code);
|
|
486
427
|
});
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
428
|
+
const handleFetchUserIdentificationCodes = (0, import_ahooks.useMemoizedFn)(
|
|
429
|
+
(value, walletRecommendList2) => {
|
|
430
|
+
const val = (0, import_utils.uniqueByKey)(walletRecommendList2 || allList, "id").filter(
|
|
431
|
+
(item) => value.includes(item.id)
|
|
432
|
+
);
|
|
433
|
+
const prepare_payments = paymentModule.wallet.formatWalletPassList2PreparePayments(val);
|
|
434
|
+
const select = prepare_payments.map((item) => ({
|
|
435
|
+
voucher_id: item.voucher_id,
|
|
436
|
+
amount: item.amount,
|
|
437
|
+
code: item.tag,
|
|
438
|
+
wallet_pass_usage_unit: item.wallet_pass_usage_unit,
|
|
439
|
+
wallet_pass_use_value: item.wallet_pass_use_value
|
|
440
|
+
}));
|
|
441
|
+
logger == null ? void 0 : logger.addLog({
|
|
442
|
+
type: "info",
|
|
443
|
+
title: "useWalletPass_handleFetchUserIdentificationCodes onSelectChange 开始调用",
|
|
444
|
+
metadata: {}
|
|
445
|
+
});
|
|
446
|
+
onSelectChange == null ? void 0 : onSelectChange(select);
|
|
447
|
+
fetchUserIdentificationCodes({
|
|
448
|
+
prepare_payments,
|
|
449
|
+
available: 2,
|
|
450
|
+
filter_prepare_wallet_pass: 1,
|
|
451
|
+
other_exact_codes: getOtherExactCodes()
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
);
|
|
503
455
|
const handleSearchIdentificationCode = (0, import_ahooks.useMemoizedFn)((value) => {
|
|
504
456
|
return paymentModule.wallet.searchIdentificationCodeAsync({
|
|
505
457
|
code: value,
|
|
@@ -509,27 +461,11 @@ var useWalletPass = (props) => {
|
|
|
509
461
|
});
|
|
510
462
|
});
|
|
511
463
|
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(
|
|
464
|
+
const val = userIdentificationCodes.filter(
|
|
530
465
|
(item) => value.includes(item.id)
|
|
531
466
|
);
|
|
532
467
|
setWalletSelect(val);
|
|
468
|
+
handleFetchUserIdentificationCodes(value);
|
|
533
469
|
});
|
|
534
470
|
const expiredWalletIds = (0, import_react.useMemo)(() => {
|
|
535
471
|
return (0, import_utils.uniqueByKey)(allList, "id").filter(
|
|
@@ -547,12 +483,12 @@ var useWalletPass = (props) => {
|
|
|
547
483
|
}, [allList]);
|
|
548
484
|
const clearAllSelectedWallet = (0, import_ahooks.useMemoizedFn)(() => {
|
|
549
485
|
var _a;
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
|
|
486
|
+
logger == null ? void 0 : logger.addLog({
|
|
487
|
+
type: "info",
|
|
488
|
+
title: "useWalletPass_clearAllSelectedWallet onSelectChange 开始调用",
|
|
489
|
+
metadata: {}
|
|
490
|
+
});
|
|
491
|
+
onSelectChange == null ? void 0 : onSelectChange([]);
|
|
556
492
|
if (selectedWalletIds.length === 0 && selectedDiscountList.length === 0) {
|
|
557
493
|
return;
|
|
558
494
|
}
|
|
@@ -576,14 +512,7 @@ var useWalletPass = (props) => {
|
|
|
576
512
|
return;
|
|
577
513
|
}
|
|
578
514
|
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);
|
|
515
|
+
handleFetchUserIdentificationCodes([]);
|
|
587
516
|
});
|
|
588
517
|
const isCurrentSelectionBest = (0, import_ahooks.useMemoizedFn)(() => {
|
|
589
518
|
if (walletRecommendList.length === 0) return true;
|
|
@@ -630,9 +559,12 @@ var useWalletPass = (props) => {
|
|
|
630
559
|
import_utils.locales.getText("wallet-pass-module-already-best-combination")
|
|
631
560
|
);
|
|
632
561
|
} else {
|
|
633
|
-
const select = searchIdentificationCodeList.filter((item) =>
|
|
562
|
+
const select = searchIdentificationCodeList.filter((item) => item.unified_available_status);
|
|
634
563
|
setWalletSelect(select);
|
|
635
|
-
|
|
564
|
+
handleFetchUserIdentificationCodes(
|
|
565
|
+
select.map((item) => item.id),
|
|
566
|
+
select
|
|
567
|
+
);
|
|
636
568
|
if (select.length) {
|
|
637
569
|
Toast == null ? void 0 : Toast.success(
|
|
638
570
|
import_utils.locales.getText("wallet-pass-module-best-combination-selected")
|
|
@@ -661,12 +593,14 @@ var useWalletPass = (props) => {
|
|
|
661
593
|
} else {
|
|
662
594
|
if (hasGoodPass && !isBestDiscount) return;
|
|
663
595
|
setWalletSelect(newWalletRecommendList);
|
|
664
|
-
|
|
596
|
+
handleFetchUserIdentificationCodes(
|
|
597
|
+
newWalletRecommendList.map((item) => item.id),
|
|
598
|
+
newWalletRecommendList
|
|
599
|
+
);
|
|
665
600
|
Toast == null ? void 0 : Toast.success(
|
|
666
601
|
import_utils.locales.getText("wallet-pass-module-best-combination-selected")
|
|
667
602
|
);
|
|
668
603
|
}
|
|
669
|
-
setLoading(false);
|
|
670
604
|
});
|
|
671
605
|
const handleSelectDiscount = (0, import_ahooks.useMemoizedFn)((value, option) => {
|
|
672
606
|
var _a, _b, _c;
|
|
@@ -713,12 +647,6 @@ var useWalletPass = (props) => {
|
|
|
713
647
|
updateData
|
|
714
648
|
);
|
|
715
649
|
setUserIdentificationCodes(newUserIdentificationCodes);
|
|
716
|
-
const newTransformList = updateArrayItemById(
|
|
717
|
-
transformList,
|
|
718
|
-
targetId,
|
|
719
|
-
updateData
|
|
720
|
-
);
|
|
721
|
-
setTransformList(newTransformList);
|
|
722
650
|
const newSearchIdentificationCodeList = updateArrayItemById(
|
|
723
651
|
searchIdentificationCodeList,
|
|
724
652
|
targetId,
|
|
@@ -734,7 +662,6 @@ var useWalletPass = (props) => {
|
|
|
734
662
|
return {
|
|
735
663
|
newWalletRecommendList,
|
|
736
664
|
newUserIdentificationCodes,
|
|
737
|
-
newTransformList,
|
|
738
665
|
newSearchIdentificationCodeList,
|
|
739
666
|
newSelectedWallet
|
|
740
667
|
};
|
|
@@ -743,21 +670,44 @@ var useWalletPass = (props) => {
|
|
|
743
670
|
const handleConfirmEditAmount = (0, import_ahooks.useMemoizedFn)(
|
|
744
671
|
(value, id, data2) => {
|
|
745
672
|
if (value === 0) {
|
|
746
|
-
const filteredIds =
|
|
673
|
+
const filteredIds = selectedWalletIds.filter(
|
|
747
674
|
(walletId) => walletId !== data2.id
|
|
748
675
|
);
|
|
749
676
|
handleSelectWallet(filteredIds);
|
|
750
677
|
return;
|
|
751
678
|
}
|
|
752
|
-
setLoading(true);
|
|
753
679
|
if (!confirmedEditAmountIdsRef.current.includes(data2.id)) {
|
|
754
680
|
confirmedEditAmountIdsRef.current.push(data2.id);
|
|
755
681
|
}
|
|
756
682
|
updateWalletDataById(data2.id, { edit_current_amount: value });
|
|
683
|
+
if (timeoutRef.current) {
|
|
684
|
+
clearTimeout(timeoutRef.current);
|
|
685
|
+
}
|
|
686
|
+
timeoutRef.current = setTimeout(() => {
|
|
687
|
+
handleFetchUserIdentificationCodes(selectedWalletIds);
|
|
688
|
+
timeoutRef.current = null;
|
|
689
|
+
});
|
|
757
690
|
}
|
|
758
691
|
);
|
|
759
692
|
const handleBeforeEditAmount = (0, import_ahooks.useMemoizedFn)(
|
|
760
693
|
async (value, index, data2) => {
|
|
694
|
+
const result = await paymentModule.wallet.searchIdentificationCodeAsync(
|
|
695
|
+
{
|
|
696
|
+
code: data2.code,
|
|
697
|
+
prepare_payments: paymentModule.wallet.formatWalletPassList2PreparePayments(
|
|
698
|
+
selectedWalletRef.current.filter(
|
|
699
|
+
(item) => item.id !== data2.id
|
|
700
|
+
)
|
|
701
|
+
)
|
|
702
|
+
},
|
|
703
|
+
{ noCache: true }
|
|
704
|
+
);
|
|
705
|
+
if (result.data && result.data.length > 0) {
|
|
706
|
+
const resultItem = result.data.find((item) => item.id === data2.id);
|
|
707
|
+
if (resultItem) {
|
|
708
|
+
updateWalletDataById(data2.id, resultItem);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
761
711
|
return true;
|
|
762
712
|
}
|
|
763
713
|
);
|
|
@@ -782,6 +732,7 @@ var useWalletPass = (props) => {
|
|
|
782
732
|
selectedDiscountList,
|
|
783
733
|
handleSelectDiscount,
|
|
784
734
|
customerName,
|
|
735
|
+
fetchWalletRecommendList,
|
|
785
736
|
fetchUserIdentificationCodes,
|
|
786
737
|
getCachedWalletRecommendList,
|
|
787
738
|
getCachedUserIdentificationCodes,
|
|
@@ -19,7 +19,7 @@ export declare const useStoreRef: <T extends {
|
|
|
19
19
|
readonly netRef: React.MutableRefObject<boolean | undefined>;
|
|
20
20
|
readonly symbolRef: React.MutableRefObject<string>;
|
|
21
21
|
readonly amountRef: React.MutableRefObject<string | number>;
|
|
22
|
-
readonly eftposRef: React.MutableRefObject<"stripe" | "
|
|
22
|
+
readonly eftposRef: React.MutableRefObject<"stripe" | "tyro" | "windcave" | "payo" | "linkly" | "huifu">;
|
|
23
23
|
readonly clientRef: React.MutableRefObject<ClientEnum>;
|
|
24
24
|
readonly dataRef: React.MutableRefObject<import("./store").State>;
|
|
25
25
|
};
|
|
@@ -301,8 +301,8 @@ export declare const backUpFree: (payload: Partial<State>) => {
|
|
|
301
301
|
amount?: string | number | undefined;
|
|
302
302
|
mode?: "pay" | "refund" | "fullPay" | "query" | undefined;
|
|
303
303
|
order_id?: string | number | undefined;
|
|
304
|
-
eftpos?: "stripe" | "
|
|
305
|
-
action?: "
|
|
304
|
+
eftpos?: "stripe" | "tyro" | "windcave" | "payo" | "linkly" | "huifu" | undefined;
|
|
305
|
+
action?: "amount" | "pay" | "deviceList" | undefined;
|
|
306
306
|
key?: number | undefined;
|
|
307
307
|
step?: number | undefined;
|
|
308
308
|
title?: string | undefined;
|
|
@@ -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;
|