@pisell/private-materials 6.3.123 → 6.3.125
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 +4 -4
- package/build/lowcode/render/default/view.js +4 -4
- package/build/lowcode/view.js +4 -4
- package/es/components/booking/addons/model.d.ts +10 -1
- package/es/components/booking/forms/model.d.ts +10 -1
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
- package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/es/components/booking/info/model.d.ts +10 -1
- 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/eftposPay/amount.js +15 -1
- package/es/components/eftposPay/app.js +2 -1
- package/es/components/eftposPay/component/fail/failCustom.js +12 -4
- package/es/components/eftposPay/component/fail/index.js +14 -6
- package/es/components/eftposPay/component/fail/network.js +3 -0
- package/es/components/eftposPay/component/fail/unknow.js +8 -0
- package/es/components/eftposPay/component/manual/index.js +13 -1
- package/es/components/eftposPay/component/signature/index.js +3 -0
- package/es/components/eftposPay/device.js +33 -22
- package/es/components/eftposPay/index.js +48 -11
- package/es/components/eftposPay/linkly/hooks/normal.js +21 -68
- package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +20 -81
- package/es/components/eftposPay/linkly/index.js +10 -23
- package/es/components/eftposPay/pay.js +14 -7
- package/es/components/eftposPay/payo/config.js +38 -5
- package/es/components/eftposPay/payo/hooks.js +3 -12
- package/es/components/eftposPay/payo/payment.js +69 -136
- package/es/components/eftposPay/tip.js +5 -0
- package/es/components/eftposPay/tyro/hooks.d.ts +0 -1
- package/es/components/eftposPay/tyro/index.js +44 -11
- package/es/components/eftposPay/utils/payLog.d.ts +81 -0
- package/es/components/eftposPay/utils/payLog.js +430 -0
- package/es/components/eftposPay/windcave/receiptAction.js +5 -0
- package/es/components/eftposPay/windcave/windcave.js +28 -29
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +0 -5
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +142 -165
- 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 +31 -65
- 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 +15 -42
- 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/Empty/index.d.ts +0 -1
- package/es/hooks/usePaymentLogger.d.ts +0 -1
- package/es/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/es/pro/Login2.0/components/phoneValidation.js +65 -58
- package/lib/components/booking/addons/model.d.ts +10 -1
- package/lib/components/booking/forms/model.d.ts +10 -1
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
- package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/lib/components/booking/info/model.d.ts +10 -1
- 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/eftposPay/amount.js +13 -1
- package/lib/components/eftposPay/app.js +2 -1
- package/lib/components/eftposPay/component/fail/failCustom.js +10 -2
- package/lib/components/eftposPay/component/fail/index.js +10 -2
- package/lib/components/eftposPay/component/fail/network.js +3 -0
- package/lib/components/eftposPay/component/fail/unknow.js +8 -0
- package/lib/components/eftposPay/component/manual/index.js +10 -0
- package/lib/components/eftposPay/component/signature/index.js +3 -0
- package/lib/components/eftposPay/device.js +11 -10
- package/lib/components/eftposPay/index.js +36 -11
- package/lib/components/eftposPay/linkly/hooks/normal.js +22 -43
- package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +13 -65
- package/lib/components/eftposPay/linkly/index.js +7 -10
- package/lib/components/eftposPay/pay.js +9 -1
- package/lib/components/eftposPay/payo/config.js +15 -8
- package/lib/components/eftposPay/payo/hooks.js +12 -10
- package/lib/components/eftposPay/payo/payment.js +31 -65
- package/lib/components/eftposPay/tip.js +5 -0
- package/lib/components/eftposPay/tyro/hooks.d.ts +0 -1
- package/lib/components/eftposPay/tyro/index.js +21 -17
- package/lib/components/eftposPay/utils/payLog.d.ts +81 -0
- package/lib/components/eftposPay/utils/payLog.js +320 -0
- package/lib/components/eftposPay/windcave/receiptAction.js +5 -0
- package/lib/components/eftposPay/windcave/windcave.js +18 -20
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +0 -5
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +100 -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 +19 -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 +2 -6
- package/lib/components/schedules/model.d.ts +9 -1
- package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/lib/hooks/usePaymentLogger.d.ts +0 -1
- package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/lib/pro/Login2.0/components/phoneValidation.js +4 -2
- package/package.json +2 -2
|
@@ -47,14 +47,10 @@ var import_index = require("./index.less");
|
|
|
47
47
|
var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
|
|
48
48
|
var { Amount } = import_materials.PisellText;
|
|
49
49
|
var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
50
|
-
var _a, _b, _c, _d, _e
|
|
51
|
-
const { onWalletPassChange, walletPass, walletSetting
|
|
50
|
+
var _a, _b, _c, _d, _e;
|
|
51
|
+
const { onWalletPassChange, walletPass, walletSetting } = props;
|
|
52
52
|
const context = (0, import_useEngineContext.default)();
|
|
53
|
-
const
|
|
54
|
-
const { detail } = orderDetail;
|
|
55
|
-
const isWalletCode = (_e = (_d = (_c = (_b = context == null ? void 0 : context.appHelper) == null ? void 0 : _b.utils) == null ? void 0 : _c.businessUtils) == null ? void 0 : _d.getAppByModal) == null ? void 0 : _e.call(_d, "wallet");
|
|
56
|
-
const { cards: recommended, transformList, noApplicableVoucher } = walletPass;
|
|
57
|
-
const [selectedVoucherIds, setSelectedVoucherIds] = (0, import_react.useState)([]);
|
|
53
|
+
const isWalletCode = (_d = (_c = (_b = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.businessUtils) == null ? void 0 : _c.getAppByModal) == null ? void 0 : _d.call(_c, "wallet");
|
|
58
54
|
const [currentWalletPass, setCurrentWalletPass] = (0, import_react.useState)(walletPass);
|
|
59
55
|
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
60
56
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
@@ -67,69 +63,78 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
67
63
|
details: []
|
|
68
64
|
});
|
|
69
65
|
const isAutoSelect = (0, import_react.useRef)(false);
|
|
66
|
+
const listRef = (0, import_react.useRef)(null);
|
|
70
67
|
const searchValRef = (0, import_react.useRef)(null);
|
|
71
68
|
const pinVerifyModalRef = (0, import_react.useRef)(null);
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (!walletPassEvaluator || !allVouchersForCalculation.length || !(order == null ? void 0 : order.total_amount)) {
|
|
80
|
-
return {
|
|
81
|
-
displayVouchers: [...transformList || [], ...noApplicableVoucher || []],
|
|
82
|
-
displayOtherVouchers: addList || [],
|
|
83
|
-
selectedWithDetails: [],
|
|
84
|
-
totalDeduction: 0
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
if (selectedVouchers.length === 0) {
|
|
88
|
-
return {
|
|
89
|
-
displayVouchers: [...transformList || [], ...noApplicableVoucher || []],
|
|
90
|
-
displayOtherVouchers: addList || [],
|
|
91
|
-
selectedWithDetails: [],
|
|
92
|
-
totalDeduction: 0
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
const result = walletPassEvaluator.recalculateVouchers(
|
|
96
|
-
allVouchersForCalculation,
|
|
97
|
-
selectedVouchers,
|
|
98
|
-
order.total_amount,
|
|
99
|
-
detail || []
|
|
100
|
-
);
|
|
101
|
-
const currentCustomerVouchers = [];
|
|
102
|
-
const otherCustomerVouchers = [];
|
|
103
|
-
result.allWithUpdatedStatus.forEach((voucher) => {
|
|
104
|
-
if (voucher.customer_id === (order == null ? void 0 : order.customer_id)) {
|
|
105
|
-
currentCustomerVouchers.push(voucher);
|
|
69
|
+
const { cards: walletPassSelectCards, amount } = currentWalletPass || {};
|
|
70
|
+
const [currentCustomerWalletPass, otherCustomerWalletPass] = (0, import_react.useMemo)(() => {
|
|
71
|
+
const current = [];
|
|
72
|
+
const other = [];
|
|
73
|
+
(walletPassSelectCards || []).forEach((item) => {
|
|
74
|
+
if (item.customer_id === (order == null ? void 0 : order.customer_id)) {
|
|
75
|
+
current.push(item);
|
|
106
76
|
} else {
|
|
107
|
-
|
|
77
|
+
other.push(item);
|
|
108
78
|
}
|
|
109
79
|
});
|
|
110
|
-
return
|
|
111
|
-
|
|
112
|
-
displayOtherVouchers: otherCustomerVouchers,
|
|
113
|
-
selectedWithDetails: result.selectedWithDetails,
|
|
114
|
-
totalDeduction: result.selectedWithDetails.reduce((sum, v) => sum + (v.actualDeduction || 0), 0)
|
|
115
|
-
};
|
|
116
|
-
}, [selectedVouchers, allVouchersForCalculation, transformList, addList, noApplicableVoucher, order == null ? void 0 : order.total_amount, order == null ? void 0 : order.customer_id, detail, walletPassEvaluator]);
|
|
80
|
+
return [current, other];
|
|
81
|
+
}, [walletPassSelectCards, order == null ? void 0 : order.customer_id]);
|
|
117
82
|
const prepare_payments = (0, import_react.useMemo)(() => {
|
|
118
83
|
return (0, import_utils3.formatWalletPassList2PreparePayments)(
|
|
119
84
|
(0, import_utils.uniqueByKey)(
|
|
120
|
-
(
|
|
85
|
+
(walletPassSelectCards || []).concat(searchSelectData.details),
|
|
121
86
|
"id"
|
|
122
87
|
)
|
|
123
88
|
);
|
|
124
|
-
}, [
|
|
89
|
+
}, [walletPassSelectCards, searchSelectData]);
|
|
125
90
|
const selectValue = (0, import_react.useMemo)(() => {
|
|
126
|
-
return
|
|
127
|
-
}, [
|
|
128
|
-
(0, import_react.
|
|
129
|
-
|
|
130
|
-
|
|
91
|
+
return (walletPassSelectCards == null ? void 0 : walletPassSelectCards.map((item) => item.id)) || [];
|
|
92
|
+
}, [walletPassSelectCards]);
|
|
93
|
+
const otherCustomerWalletPassList = (0, import_react.useMemo)(() => {
|
|
94
|
+
return (0, import_utils2.formatMachineCodeServer2CardList)(addList, selectValue);
|
|
95
|
+
}, [addList, selectValue]);
|
|
96
|
+
const other_exact_codes = (0, import_react.useMemo)(() => {
|
|
97
|
+
const codes = [];
|
|
98
|
+
addList.forEach((item) => {
|
|
99
|
+
if (!selectValue.includes(item.id)) {
|
|
100
|
+
codes.push(item.code);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return codes;
|
|
104
|
+
}, [addList, selectValue]);
|
|
105
|
+
const refreshList = (0, import_ahooks.useMemoizedFn)(() => {
|
|
106
|
+
var _a2, _b2;
|
|
107
|
+
if ((order == null ? void 0 : order.order_id) && (order == null ? void 0 : order.customer_id)) {
|
|
108
|
+
(_b2 = listRef.current) == null ? void 0 : _b2.init(
|
|
109
|
+
{
|
|
110
|
+
order_id: order.order_id,
|
|
111
|
+
available: 2,
|
|
112
|
+
prepare_payments,
|
|
113
|
+
filter_prepare_wallet_pass: 1,
|
|
114
|
+
sale_channel: ((_a2 = order._order) == null ? void 0 : _a2.sale_channel) || "online-store",
|
|
115
|
+
other_exact_codes
|
|
116
|
+
},
|
|
117
|
+
// 已选择的卡片接口中不会返回,所以追加进入列表
|
|
118
|
+
(val) => {
|
|
119
|
+
const idMap = val.reduce((pre, cur) => {
|
|
120
|
+
return {
|
|
121
|
+
...pre,
|
|
122
|
+
[cur.id]: cur
|
|
123
|
+
};
|
|
124
|
+
}, {});
|
|
125
|
+
setAddList((prevState) => {
|
|
126
|
+
return prevState.map((item) => {
|
|
127
|
+
if (idMap[item.id]) {
|
|
128
|
+
return idMap[item.id];
|
|
129
|
+
}
|
|
130
|
+
return item;
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
return [...currentCustomerWalletPass || [], ...val];
|
|
134
|
+
}
|
|
135
|
+
);
|
|
131
136
|
}
|
|
132
|
-
}
|
|
137
|
+
});
|
|
133
138
|
(0, import_react.useEffect)(() => {
|
|
134
139
|
if ((order == null ? void 0 : order.order_id) && searchValRef.current) {
|
|
135
140
|
searchList(searchValRef.current, true);
|
|
@@ -140,16 +145,16 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
140
145
|
setOrder(res);
|
|
141
146
|
setOpen(true);
|
|
142
147
|
setCurrentWalletPass(walletPass);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
148
|
+
setTimeout(() => {
|
|
149
|
+
refreshList();
|
|
150
|
+
});
|
|
146
151
|
};
|
|
147
152
|
const searchList = async ({ code, customer_pin_key }, isSelectChange) => {
|
|
148
153
|
var _a2;
|
|
149
154
|
if (!(order == null ? void 0 : order.order_id)) return;
|
|
150
155
|
setLoading(true);
|
|
151
156
|
try {
|
|
152
|
-
const
|
|
157
|
+
const result = await (0, import_serve.searchMachineCodeList)({
|
|
153
158
|
order_id: order.order_id,
|
|
154
159
|
code,
|
|
155
160
|
prepare_payments,
|
|
@@ -157,7 +162,7 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
157
162
|
sale_channel: ((_a2 = order._order) == null ? void 0 : _a2.sale_channel) || "online-store",
|
|
158
163
|
customer_pin_key
|
|
159
164
|
});
|
|
160
|
-
if (!
|
|
165
|
+
if (!result) {
|
|
161
166
|
if (!isSelectChange) {
|
|
162
167
|
(0, import_materials.PisellToast)({
|
|
163
168
|
content: import_utils.locales.getText("tocPay.text.walletSearchEmpty")
|
|
@@ -168,11 +173,6 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
168
173
|
if (isSelectChange && !searchValRef.current) {
|
|
169
174
|
return;
|
|
170
175
|
}
|
|
171
|
-
let result = walletPassEvaluator.searchVoucherFormat({
|
|
172
|
-
vouchers: baseResult,
|
|
173
|
-
orderTotalAmount: order.total_amount,
|
|
174
|
-
products: detail
|
|
175
|
-
});
|
|
176
176
|
setSearchData(
|
|
177
177
|
(0, import_utils2.formatMachineCodeServer2CardList)(
|
|
178
178
|
[...searchSelectData.details, ...result],
|
|
@@ -235,23 +235,23 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
235
235
|
});
|
|
236
236
|
};
|
|
237
237
|
const handleSelectOk = () => {
|
|
238
|
-
|
|
239
|
-
(
|
|
238
|
+
changeWalletPass(
|
|
239
|
+
(0, import_utils.uniqueByKey)(
|
|
240
|
+
[
|
|
241
|
+
...walletPassSelectCards || [],
|
|
242
|
+
...searchSelectData.details
|
|
243
|
+
],
|
|
244
|
+
"id"
|
|
245
|
+
)
|
|
240
246
|
);
|
|
241
247
|
setAddList((prevState) => {
|
|
242
248
|
return (0, import_utils.uniqueByKey)(
|
|
243
|
-
[...prevState, ...
|
|
249
|
+
[...prevState, ...searchSelectData.details],
|
|
244
250
|
"id"
|
|
251
|
+
).filter(
|
|
252
|
+
(item) => !(order == null ? void 0 : order.customer_id) || item.customer_id !== (order == null ? void 0 : order.customer_id)
|
|
245
253
|
);
|
|
246
254
|
});
|
|
247
|
-
const newSelectedIds = (0, import_utils.uniqueByKey)(
|
|
248
|
-
[
|
|
249
|
-
...selectedWithDetails || [],
|
|
250
|
-
...searchSelectData.details
|
|
251
|
-
],
|
|
252
|
-
"id"
|
|
253
|
-
).map((v) => v.id);
|
|
254
|
-
setSelectedVoucherIds(newSelectedIds);
|
|
255
255
|
handleSearchModalClose();
|
|
256
256
|
};
|
|
257
257
|
const handleAddChange = (0, import_ahooks.useMemoizedFn)(
|
|
@@ -263,15 +263,26 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
263
263
|
});
|
|
264
264
|
}
|
|
265
265
|
);
|
|
266
|
+
const changeWalletPass = (cards) => {
|
|
267
|
+
setCurrentWalletPass == null ? void 0 : setCurrentWalletPass({
|
|
268
|
+
cards,
|
|
269
|
+
amount: (0, import_utils3.calcWalletPassListAmount)(cards)
|
|
270
|
+
});
|
|
271
|
+
setTimeout(() => {
|
|
272
|
+
refreshList();
|
|
273
|
+
});
|
|
274
|
+
};
|
|
266
275
|
const handleSelectChange = (val, details, type) => {
|
|
267
|
-
|
|
276
|
+
let cards = details.map((item) => item.originData);
|
|
277
|
+
if (type === "other") {
|
|
278
|
+
cards = currentCustomerWalletPass.concat(cards);
|
|
279
|
+
} else if (type === "current") {
|
|
280
|
+
cards = otherCustomerWalletPass.concat(cards);
|
|
281
|
+
}
|
|
282
|
+
changeWalletPass(cards);
|
|
268
283
|
};
|
|
269
284
|
const handleRedeem = () => {
|
|
270
|
-
onWalletPassChange == null ? void 0 : onWalletPassChange(
|
|
271
|
-
...currentWalletPass,
|
|
272
|
-
cards: selectedWithDetails,
|
|
273
|
-
amount: totalDeduction
|
|
274
|
-
});
|
|
285
|
+
onWalletPassChange == null ? void 0 : onWalletPassChange(currentWalletPass);
|
|
275
286
|
setOpen(false);
|
|
276
287
|
};
|
|
277
288
|
const handleWalletClose = () => {
|
|
@@ -296,16 +307,16 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
296
307
|
onCancel: () => handleWalletClose(),
|
|
297
308
|
cancelVisible: false,
|
|
298
309
|
destroyOnClose: true,
|
|
299
|
-
okText: /* @__PURE__ */ import_react.default.createElement("div", null, import_utils.locales.getText("tocPay.text.redeem"), " ", /* @__PURE__ */ import_react.default.createElement(Amount, { value:
|
|
310
|
+
okText: /* @__PURE__ */ import_react.default.createElement("div", null, import_utils.locales.getText("tocPay.text.redeem"), " ", /* @__PURE__ */ import_react.default.createElement(Amount, { value: amount })),
|
|
300
311
|
onOk: handleRedeem
|
|
301
312
|
},
|
|
302
313
|
/* @__PURE__ */ import_react.default.createElement("div", { className: "", style: { marginTop: 24 } }, /* @__PURE__ */ import_react.default.createElement(import_MultiModeSearch.default, { onChange: handleSearch }), /* @__PURE__ */ import_react.default.createElement("div", { className: "wallet-pass-modal-multi-selection-available" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "wallet-pass-modal-multi-selection-available-title" }, /* @__PURE__ */ import_react.default.createElement(import_icons.InfoCircleOutlined, { className: "wallet-pass-modal-multi-selection-available-title-icon" }), import_utils.locales.getText("tocPay.text.multipleSelectionAvailable")), /* @__PURE__ */ import_react.default.createElement("div", { className: "wallet-pass-modal-multi-selection-available-desc" }, import_utils.locales.getText(
|
|
303
314
|
"tocPay.text.youCanSelectMultipleWalletPassesToCombineForPayment"
|
|
304
|
-
)(walletSetting.name))),
|
|
315
|
+
)(walletSetting.name))), otherCustomerWalletPassList.length > 0 && /* @__PURE__ */ import_react.default.createElement(
|
|
305
316
|
import_List.default,
|
|
306
317
|
{
|
|
307
318
|
walletSetting,
|
|
308
|
-
data:
|
|
319
|
+
data: otherCustomerWalletPassList,
|
|
309
320
|
title: import_utils.locales.getText("tocPay.text.couponCodesAdded"),
|
|
310
321
|
onChange: handleOtherChange,
|
|
311
322
|
value: selectValue,
|
|
@@ -318,10 +329,9 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
318
329
|
walletSetting,
|
|
319
330
|
title: walletSetting.name,
|
|
320
331
|
onChange: handleCurrentChange,
|
|
321
|
-
|
|
332
|
+
ref: listRef,
|
|
322
333
|
value: selectValue,
|
|
323
334
|
onLoadingChange: setLoading,
|
|
324
|
-
loading,
|
|
325
335
|
customer_id: order == null ? void 0 : order.customer_id
|
|
326
336
|
}
|
|
327
337
|
))
|
|
@@ -337,7 +347,7 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
337
347
|
okText: import_utils.locales.getText("tocPay.text.select"),
|
|
338
348
|
onOk: handleSelectOk,
|
|
339
349
|
okButtonProps: {
|
|
340
|
-
disabled: ((
|
|
350
|
+
disabled: ((_e = searchSelectData.ids) == null ? void 0 : _e.length) === 0
|
|
341
351
|
}
|
|
342
352
|
},
|
|
343
353
|
/* @__PURE__ */ import_react.default.createElement("div", { className: "", style: { marginTop: 24 } }, /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -56,12 +56,6 @@ export declare type WalletPassDataType = {
|
|
|
56
56
|
metadata?: {
|
|
57
57
|
validity_type: string;
|
|
58
58
|
};
|
|
59
|
-
/** 前端计算 可用最大金额 */
|
|
60
|
-
_available_max_amount?: number;
|
|
61
|
-
/** 前端计算 统一可用状态 */
|
|
62
|
-
_unified_available_status?: 0 | 1;
|
|
63
|
-
/** 前端计算 禁用原因 */
|
|
64
|
-
reason?: string;
|
|
65
59
|
};
|
|
66
60
|
declare type Shop = {
|
|
67
61
|
id: number;
|
|
@@ -53,8 +53,8 @@ var formatMachineCodeServer2CardList = (data, selectId = []) => {
|
|
|
53
53
|
showDetail: false,
|
|
54
54
|
showQrCode: false,
|
|
55
55
|
code: item.code,
|
|
56
|
-
disabled:
|
|
57
|
-
disabledReason: (
|
|
56
|
+
disabled: !item.unified_available_status,
|
|
57
|
+
disabledReason: (_b = item.unified_messages) == null ? void 0 : _b.title,
|
|
58
58
|
cover: (_c = item.product) == null ? void 0 : _c.cover,
|
|
59
59
|
qrCode: item.code,
|
|
60
60
|
validDate: voucherTime(item),
|
|
@@ -166,9 +166,7 @@ var WalletPassBlock = (props, ref) => {
|
|
|
166
166
|
ref: walletPassRef,
|
|
167
167
|
walletSetting,
|
|
168
168
|
onWalletPassChange,
|
|
169
|
-
walletPass: payGroup == null ? void 0 : payGroup.walletPass
|
|
170
|
-
orderDetail: payGroup == null ? void 0 : payGroup.orderDetail,
|
|
171
|
-
total_amount: payGroup == null ? void 0 : payGroup.total_amount
|
|
169
|
+
walletPass: payGroup == null ? void 0 : payGroup.walletPass
|
|
172
170
|
}
|
|
173
171
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
174
172
|
import_WalletAvailable.default,
|
|
@@ -49,7 +49,6 @@ var import_usePaymentLogger = __toESM(require("../../../hooks/usePaymentLogger")
|
|
|
49
49
|
var import_utils2 = require("../../../utils");
|
|
50
50
|
var import_payGroup = require("./payGroup");
|
|
51
51
|
var import_locales = __toESM(require("./locales"));
|
|
52
|
-
var import_serve2 = require("./PaymentMethods/WalletPass/serve");
|
|
53
52
|
var import_utils3 = require("./utils");
|
|
54
53
|
var import_status = require("./status");
|
|
55
54
|
var import_index = require("./index.less");
|
|
@@ -170,7 +169,7 @@ var ToCPay = (props, ref) => {
|
|
|
170
169
|
}
|
|
171
170
|
};
|
|
172
171
|
const _getPaymentsAndWalletPass = async (order) => {
|
|
173
|
-
var _a2, _b2
|
|
172
|
+
var _a2, _b2;
|
|
174
173
|
paymentLogger.addLog({
|
|
175
174
|
key: "获取支付列表开始",
|
|
176
175
|
value: {
|
|
@@ -178,22 +177,11 @@ var ToCPay = (props, ref) => {
|
|
|
178
177
|
}
|
|
179
178
|
});
|
|
180
179
|
try {
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}),
|
|
187
|
-
(0, import_serve2.getMachineCodeList)({
|
|
188
|
-
order_id: order.order_id,
|
|
189
|
-
available: 2,
|
|
190
|
-
prepare_payments: [],
|
|
191
|
-
filter_prepare_wallet_pass: 1,
|
|
192
|
-
sale_channel: ((_a2 = order._order) == null ? void 0 : _a2.sale_channel) || "online-store",
|
|
193
|
-
other_exact_codes: []
|
|
194
|
-
}),
|
|
195
|
-
(0, import_serve.getOrderBasicDetail)(order.order_id)
|
|
196
|
-
]);
|
|
180
|
+
const data = await (0, import_serve.getPaymentsAndWalletPass)({
|
|
181
|
+
order_id: order.order_id,
|
|
182
|
+
total_amount: order.amount,
|
|
183
|
+
sale_channel: order.sale_channel || "online-store"
|
|
184
|
+
});
|
|
197
185
|
const {
|
|
198
186
|
remain_amount = 0,
|
|
199
187
|
wallet_pass_recommend_list,
|
|
@@ -201,60 +189,39 @@ var ToCPay = (props, ref) => {
|
|
|
201
189
|
payment_list,
|
|
202
190
|
walletPass
|
|
203
191
|
} = data || {};
|
|
204
|
-
const products = (orderBasicDetail.detail || []).map((item) => {
|
|
205
|
-
var _a3;
|
|
206
|
-
return {
|
|
207
|
-
...item,
|
|
208
|
-
is_price_include_tax: orderBasicDetail.is_price_include_tax,
|
|
209
|
-
product_bundle: (_a3 = item.product_bundle || []) == null ? void 0 : _a3.map((bundle) => {
|
|
210
|
-
return {
|
|
211
|
-
...bundle,
|
|
212
|
-
is_price_include_tax: orderBasicDetail.is_price_include_tax
|
|
213
|
-
};
|
|
214
|
-
})
|
|
215
|
-
};
|
|
216
|
-
});
|
|
217
|
-
const res = utils.walletPassEvaluator.getRecommendedVouchers({
|
|
218
|
-
orderTotalAmount: Math.min(orderBasicDetail.product_unpaid_total_pay_amount, order.amount),
|
|
219
|
-
products,
|
|
220
|
-
vouchers: allList || []
|
|
221
|
-
});
|
|
222
|
-
const { recommended, transformList, noApplicableVoucher, recommendedAmount } = res;
|
|
223
192
|
paymentLogger.addLog({
|
|
224
193
|
key: "支付数据获取",
|
|
225
194
|
value: ""
|
|
226
195
|
});
|
|
227
|
-
const
|
|
196
|
+
const withCustomerIdList = (wallet_pass_recommend_list || []).map(
|
|
197
|
+
(item) => {
|
|
198
|
+
return {
|
|
199
|
+
...item,
|
|
200
|
+
customer_id: customer_id || item.customer_id
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
);
|
|
228
204
|
dispatch({
|
|
229
205
|
type: "setPayGroup",
|
|
230
206
|
payload: {
|
|
231
207
|
// ...state.payGroup,
|
|
232
208
|
order_id: order == null ? void 0 : order.order_id,
|
|
233
209
|
// total_amount: order?.amount,
|
|
234
|
-
orderDetail: orderBasicDetail,
|
|
235
210
|
// 原订单信息
|
|
236
211
|
_order: order,
|
|
237
212
|
payment_group_id: order == null ? void 0 : order.payment_group_id,
|
|
238
213
|
// 支付方式没有walletPass时walletPass设置null
|
|
239
214
|
walletPass: walletPass ? {
|
|
240
|
-
...(
|
|
215
|
+
...(_a2 = state.payGroup) == null ? void 0 : _a2.walletPass,
|
|
241
216
|
...walletPass,
|
|
242
|
-
|
|
243
|
-
cards:
|
|
244
|
-
// 推荐金额
|
|
245
|
-
amount: recommendedAmount,
|
|
246
|
-
// 不可用钱包
|
|
247
|
-
noApplicableVoucher,
|
|
248
|
-
// 转换列表
|
|
249
|
-
transformList
|
|
250
|
-
// amount: wallet_pass_amount,
|
|
251
|
-
// cards: wallet_pass_recommend_list,
|
|
217
|
+
amount: wallet_pass_amount,
|
|
218
|
+
cards: withCustomerIdList
|
|
252
219
|
} : null,
|
|
253
220
|
total_amount: order == null ? void 0 : order.amount,
|
|
254
|
-
wait_amount:
|
|
221
|
+
wait_amount: remain_amount
|
|
255
222
|
}
|
|
256
223
|
});
|
|
257
|
-
await ((
|
|
224
|
+
await ((_b2 = paymentListRef.current) == null ? void 0 : _b2.init(payment_list, remain_amount || 0));
|
|
258
225
|
setTimeout(() => {
|
|
259
226
|
setLoading(false);
|
|
260
227
|
}, 100);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export interface FormState {
|
|
2
3
|
platform: 'pc' | 'h5' | '' | undefined;
|
|
3
4
|
order: any;
|
|
@@ -28,6 +29,12 @@ export interface PayGroup {
|
|
|
28
29
|
pay_number?: string;
|
|
29
30
|
_order: any;
|
|
30
31
|
front_order_uuid?: string;
|
|
31
|
-
orderDetail: any;
|
|
32
32
|
}
|
|
33
|
-
export declare const Provider: any, Context:
|
|
33
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
34
|
+
state: FormState;
|
|
35
|
+
} & {
|
|
36
|
+
dispatch: (params: {
|
|
37
|
+
type: string;
|
|
38
|
+
payload: any;
|
|
39
|
+
}) => void;
|
|
40
|
+
}>;
|
|
@@ -62,23 +62,6 @@ export declare const getWalletNameAndPopupStatus: (values: {
|
|
|
62
62
|
* @description: 获取支付结果
|
|
63
63
|
*/
|
|
64
64
|
export declare const getPaymentResult: (values: any) => Promise<any>;
|
|
65
|
-
declare type OrderBasicDetail = {
|
|
66
|
-
id: number;
|
|
67
|
-
status: string;
|
|
68
|
-
payment_status: string;
|
|
69
|
-
order_time: string;
|
|
70
|
-
detail: any[];
|
|
71
|
-
product_unpaid_total_pay_amount: number;
|
|
72
|
-
product_paid_total_pay_amount: number;
|
|
73
|
-
is_price_include_tax: 1 | 0;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* @title: 查询订单基础信息和订单商品信息
|
|
77
|
-
* @description: 查询订单基础信息和订单商品信息
|
|
78
|
-
* @param {string} order_id
|
|
79
|
-
* @return {*}
|
|
80
|
-
*/
|
|
81
|
-
export declare const getOrderBasicDetail: (order_id: string) => Promise<OrderBasicDetail>;
|
|
82
65
|
/**
|
|
83
66
|
* @title: 检测订单是否有正在处理中的交易
|
|
84
67
|
* @param {object} values - { order_id: string }
|
|
@@ -89,4 +72,3 @@ export declare const checkPendingPayment: (values: {
|
|
|
89
72
|
}) => Promise<{
|
|
90
73
|
has_pending: boolean;
|
|
91
74
|
}>;
|
|
92
|
-
export {};
|
|
@@ -20,7 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
var serve_exports = {};
|
|
21
21
|
__export(serve_exports, {
|
|
22
22
|
checkPendingPayment: () => checkPendingPayment,
|
|
23
|
-
getOrderBasicDetail: () => getOrderBasicDetail,
|
|
24
23
|
getPaymentInit: () => getPaymentInit,
|
|
25
24
|
getPaymentList: () => getPaymentList,
|
|
26
25
|
getPaymentResult: () => getPaymentResult,
|
|
@@ -79,10 +78,6 @@ var getWalletNameAndPopupStatus = async (values) => {
|
|
|
79
78
|
return data;
|
|
80
79
|
};
|
|
81
80
|
var getPaymentResult = (values) => import_utils.request.getRequest().get(`/h5/pay/order/payment/result`, values);
|
|
82
|
-
var getOrderBasicDetail = async (order_id) => {
|
|
83
|
-
const { data } = await import_utils.request.getRequest().get(`/h5/order/order/${order_id}/basic-detail`, {});
|
|
84
|
-
return data;
|
|
85
|
-
};
|
|
86
81
|
var checkPendingPayment = async (values) => {
|
|
87
82
|
var _a;
|
|
88
83
|
const { data } = await import_utils.request.getRequest().post(`/h5/pay/payment/check`, values);
|
|
@@ -94,7 +89,6 @@ var checkPendingPayment = async (values) => {
|
|
|
94
89
|
// Annotate the CommonJS export names for ESM import in node:
|
|
95
90
|
0 && (module.exports = {
|
|
96
91
|
checkPendingPayment,
|
|
97
|
-
getOrderBasicDetail,
|
|
98
92
|
getPaymentInit,
|
|
99
93
|
getPaymentList,
|
|
100
94
|
getPaymentResult,
|
|
@@ -22,7 +22,7 @@ export declare const formatWalletPassParams: (payGroup: PayGroup) => {
|
|
|
22
22
|
order_id: string;
|
|
23
23
|
payment_group_id: number;
|
|
24
24
|
payments: {
|
|
25
|
-
amount: string
|
|
25
|
+
amount: string;
|
|
26
26
|
wallet_pass_use_value: any;
|
|
27
27
|
voucher_id: any;
|
|
28
28
|
tag: any;
|
|
@@ -48,7 +48,7 @@ export declare const isFranchiseeShop: (path?: any, history?: any) => any;
|
|
|
48
48
|
*/
|
|
49
49
|
export declare const getFranchiseeShopId: (path?: any, history?: any) => number;
|
|
50
50
|
export declare const formatFranchiseeRoute: (url: string, history?: any) => string;
|
|
51
|
-
export declare const getAvailableMaxAmount: (data: WalletPassDataType) => string
|
|
51
|
+
export declare const getAvailableMaxAmount: (data: WalletPassDataType) => string;
|
|
52
52
|
export declare const clientPayment: (params: {
|
|
53
53
|
order_id: number;
|
|
54
54
|
type: "aliPay" | "wxPay" | 'google_pay';
|
|
@@ -43,9 +43,8 @@ __export(utils_exports, {
|
|
|
43
43
|
module.exports = __toCommonJS(utils_exports);
|
|
44
44
|
var import_decimal = require("decimal.js");
|
|
45
45
|
var import_status = require("./status");
|
|
46
|
-
var import_utils = require("@pisell/utils");
|
|
47
46
|
var import_dayjs = __toESM(require("dayjs"));
|
|
48
|
-
var
|
|
47
|
+
var import_utils = require("@pisell/utils");
|
|
49
48
|
var calcWalletPassListAmount = (list) => {
|
|
50
49
|
return list.reduce((pre, cur) => pre.add(new import_decimal.Decimal(String(getAvailableMaxAmount(cur) || 0))), new import_decimal.Decimal("0")).toNumber();
|
|
51
50
|
};
|
|
@@ -98,9 +97,6 @@ var formatFranchiseeRoute = (url, history) => {
|
|
|
98
97
|
return url;
|
|
99
98
|
};
|
|
100
99
|
var getAvailableMaxAmount = (data) => {
|
|
101
|
-
if ((0, import_utils.isNumber)(data._available_max_amount)) {
|
|
102
|
-
return data._available_max_amount;
|
|
103
|
-
}
|
|
104
100
|
return data.tag !== "point_card" ? data.available_max_amount : data == null ? void 0 : data.recommended_usage_amount;
|
|
105
101
|
};
|
|
106
102
|
var clientPayment = (params) => {
|
|
@@ -117,7 +113,7 @@ var clientPayment = (params) => {
|
|
|
117
113
|
});
|
|
118
114
|
};
|
|
119
115
|
var getUniqueIdempotencyToken = () => {
|
|
120
|
-
return `${(0, import_dayjs.default)().format("YYYYMMDDHHmmssSSS")}-${(0,
|
|
116
|
+
return `${(0, import_dayjs.default)().format("YYYYMMDDHHmmssSSS")}-${(0, import_utils.getUniqueId)()}`;
|
|
121
117
|
};
|
|
122
118
|
// Annotate the CommonJS export names for ESM import in node:
|
|
123
119
|
0 && (module.exports = {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { CalendarDataItem, ScheduleItem } from "./type";
|
|
2
3
|
import dayjs from "dayjs";
|
|
3
4
|
export interface FormState {
|
|
@@ -68,4 +69,11 @@ export interface FormState {
|
|
|
68
69
|
};
|
|
69
70
|
setGlobalState: Function | null;
|
|
70
71
|
}
|
|
71
|
-
export declare const Provider: any, Context:
|
|
72
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
73
|
+
state: FormState;
|
|
74
|
+
} & {
|
|
75
|
+
dispatch: (params: {
|
|
76
|
+
type: string;
|
|
77
|
+
payload: any;
|
|
78
|
+
}) => void;
|
|
79
|
+
}>;
|
|
@@ -68,7 +68,8 @@ var validatePhoneNumber = async (value, getText) => {
|
|
|
68
68
|
}
|
|
69
69
|
break;
|
|
70
70
|
case "1":
|
|
71
|
-
|
|
71
|
+
const usCanadaReg = /^[2-9]\d{2}[2-9]\d{6}$/;
|
|
72
|
+
if (!usCanadaReg.test(phone)) {
|
|
72
73
|
throw new Error(getText("pisell-phone-validation-us-canada"));
|
|
73
74
|
}
|
|
74
75
|
break;
|
|
@@ -78,7 +79,8 @@ var validatePhoneNumber = async (value, getText) => {
|
|
|
78
79
|
}
|
|
79
80
|
break;
|
|
80
81
|
case "61":
|
|
81
|
-
|
|
82
|
+
const auReg = /^0?[2-578]\d{8}$/;
|
|
83
|
+
if (!auReg.test(phone)) {
|
|
82
84
|
throw new Error(getText("pisell-phone-validation-australia"));
|
|
83
85
|
}
|
|
84
86
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.125",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"react-resizable": "^3.0.5",
|
|
78
78
|
"styled-components": "^6.0.0-rc.3",
|
|
79
79
|
"@pisell/utils": "3.0.5",
|
|
80
|
-
"@pisell/materials": "6.3.
|
|
80
|
+
"@pisell/materials": "6.3.27",
|
|
81
81
|
"@pisell/icon": "0.0.11",
|
|
82
82
|
"@pisell/date-picker": "3.0.8"
|
|
83
83
|
},
|