@pisell/private-materials 6.6.47 → 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/components/footer/amount.js +6 -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/hooks/useClearCart.d.ts +1 -1
- package/es/components/booking/hooks/useClearCart.js +39 -9
- 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/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 +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/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/components/footer/amount.js +6 -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/hooks/useClearCart.d.ts +1 -1
- package/lib/components/booking/hooks/useClearCart.js +28 -6
- 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/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 +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/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 +2 -2
- package/lowcode/eco-cup-list/meta.ts +0 -63
- package/lowcode/eco-customer-list/meta.ts +0 -63
|
@@ -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,80 @@ 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].filter(
|
|
134
|
+
(item) => !(order == null ? void 0 : order.customer_id) || item.customer_id === (order == null ? void 0 : order.customer_id)
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
);
|
|
131
138
|
}
|
|
132
|
-
}
|
|
139
|
+
});
|
|
133
140
|
(0, import_react.useEffect)(() => {
|
|
134
141
|
if ((order == null ? void 0 : order.order_id) && searchValRef.current) {
|
|
135
142
|
searchList(searchValRef.current, true);
|
|
@@ -140,16 +147,16 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
140
147
|
setOrder(res);
|
|
141
148
|
setOpen(true);
|
|
142
149
|
setCurrentWalletPass(walletPass);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
150
|
+
setTimeout(() => {
|
|
151
|
+
refreshList();
|
|
152
|
+
});
|
|
146
153
|
};
|
|
147
154
|
const searchList = async ({ code, customer_pin_key }, isSelectChange) => {
|
|
148
155
|
var _a2;
|
|
149
156
|
if (!(order == null ? void 0 : order.order_id)) return;
|
|
150
157
|
setLoading(true);
|
|
151
158
|
try {
|
|
152
|
-
const
|
|
159
|
+
const result = await (0, import_serve.searchMachineCodeList)({
|
|
153
160
|
order_id: order.order_id,
|
|
154
161
|
code,
|
|
155
162
|
prepare_payments,
|
|
@@ -157,7 +164,7 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
157
164
|
sale_channel: ((_a2 = order._order) == null ? void 0 : _a2.sale_channel) || "online-store",
|
|
158
165
|
customer_pin_key
|
|
159
166
|
});
|
|
160
|
-
if (!
|
|
167
|
+
if (!result) {
|
|
161
168
|
if (!isSelectChange) {
|
|
162
169
|
(0, import_materials.PisellToast)({
|
|
163
170
|
content: import_utils.locales.getText("tocPay.text.walletSearchEmpty")
|
|
@@ -168,11 +175,6 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
168
175
|
if (isSelectChange && !searchValRef.current) {
|
|
169
176
|
return;
|
|
170
177
|
}
|
|
171
|
-
let result = walletPassEvaluator.searchVoucherFormat({
|
|
172
|
-
vouchers: baseResult,
|
|
173
|
-
orderTotalAmount: order.total_amount,
|
|
174
|
-
products: detail
|
|
175
|
-
});
|
|
176
178
|
setSearchData(
|
|
177
179
|
(0, import_utils2.formatMachineCodeServer2CardList)(
|
|
178
180
|
[...searchSelectData.details, ...result],
|
|
@@ -235,23 +237,23 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
235
237
|
});
|
|
236
238
|
};
|
|
237
239
|
const handleSelectOk = () => {
|
|
238
|
-
|
|
239
|
-
(
|
|
240
|
+
changeWalletPass(
|
|
241
|
+
(0, import_utils.uniqueByKey)(
|
|
242
|
+
[
|
|
243
|
+
...walletPassSelectCards || [],
|
|
244
|
+
...searchSelectData.details
|
|
245
|
+
],
|
|
246
|
+
"id"
|
|
247
|
+
)
|
|
240
248
|
);
|
|
241
249
|
setAddList((prevState) => {
|
|
242
250
|
return (0, import_utils.uniqueByKey)(
|
|
243
|
-
[...prevState, ...
|
|
251
|
+
[...prevState, ...searchSelectData.details],
|
|
244
252
|
"id"
|
|
253
|
+
).filter(
|
|
254
|
+
(item) => !(order == null ? void 0 : order.customer_id) || item.customer_id !== (order == null ? void 0 : order.customer_id)
|
|
245
255
|
);
|
|
246
256
|
});
|
|
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
257
|
handleSearchModalClose();
|
|
256
258
|
};
|
|
257
259
|
const handleAddChange = (0, import_ahooks.useMemoizedFn)(
|
|
@@ -263,15 +265,26 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
263
265
|
});
|
|
264
266
|
}
|
|
265
267
|
);
|
|
268
|
+
const changeWalletPass = (cards) => {
|
|
269
|
+
setCurrentWalletPass == null ? void 0 : setCurrentWalletPass({
|
|
270
|
+
cards,
|
|
271
|
+
amount: (0, import_utils3.calcWalletPassListAmount)(cards)
|
|
272
|
+
});
|
|
273
|
+
setTimeout(() => {
|
|
274
|
+
refreshList();
|
|
275
|
+
});
|
|
276
|
+
};
|
|
266
277
|
const handleSelectChange = (val, details, type) => {
|
|
267
|
-
|
|
278
|
+
let cards = details.map((item) => item.originData);
|
|
279
|
+
if (type === "other") {
|
|
280
|
+
cards = currentCustomerWalletPass.concat(cards);
|
|
281
|
+
} else if (type === "current") {
|
|
282
|
+
cards = otherCustomerWalletPass.concat(cards);
|
|
283
|
+
}
|
|
284
|
+
changeWalletPass(cards);
|
|
268
285
|
};
|
|
269
286
|
const handleRedeem = () => {
|
|
270
|
-
onWalletPassChange == null ? void 0 : onWalletPassChange(
|
|
271
|
-
...currentWalletPass,
|
|
272
|
-
cards: selectedWithDetails,
|
|
273
|
-
amount: totalDeduction
|
|
274
|
-
});
|
|
287
|
+
onWalletPassChange == null ? void 0 : onWalletPassChange(currentWalletPass);
|
|
275
288
|
setOpen(false);
|
|
276
289
|
};
|
|
277
290
|
const handleWalletClose = () => {
|
|
@@ -296,16 +309,16 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
296
309
|
onCancel: () => handleWalletClose(),
|
|
297
310
|
cancelVisible: false,
|
|
298
311
|
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:
|
|
312
|
+
okText: /* @__PURE__ */ import_react.default.createElement("div", null, import_utils.locales.getText("tocPay.text.redeem"), " ", /* @__PURE__ */ import_react.default.createElement(Amount, { value: amount })),
|
|
300
313
|
onOk: handleRedeem
|
|
301
314
|
},
|
|
302
315
|
/* @__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
316
|
"tocPay.text.youCanSelectMultipleWalletPassesToCombineForPayment"
|
|
304
|
-
)(walletSetting.name))),
|
|
317
|
+
)(walletSetting.name))), otherCustomerWalletPassList.length > 0 && /* @__PURE__ */ import_react.default.createElement(
|
|
305
318
|
import_List.default,
|
|
306
319
|
{
|
|
307
320
|
walletSetting,
|
|
308
|
-
data:
|
|
321
|
+
data: otherCustomerWalletPassList,
|
|
309
322
|
title: import_utils.locales.getText("tocPay.text.couponCodesAdded"),
|
|
310
323
|
onChange: handleOtherChange,
|
|
311
324
|
value: selectValue,
|
|
@@ -318,9 +331,9 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
318
331
|
walletSetting,
|
|
319
332
|
title: walletSetting.name,
|
|
320
333
|
onChange: handleCurrentChange,
|
|
321
|
-
|
|
334
|
+
ref: listRef,
|
|
322
335
|
value: selectValue,
|
|
323
|
-
|
|
336
|
+
onLoadingChange: setLoading
|
|
324
337
|
}
|
|
325
338
|
))
|
|
326
339
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -335,7 +348,7 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
335
348
|
okText: import_utils.locales.getText("tocPay.text.select"),
|
|
336
349
|
onOk: handleSelectOk,
|
|
337
350
|
okButtonProps: {
|
|
338
|
-
disabled: ((
|
|
351
|
+
disabled: ((_e = searchSelectData.ids) == null ? void 0 : _e.length) === 0
|
|
339
352
|
}
|
|
340
353
|
},
|
|
341
354
|
/* @__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");
|
|
@@ -155,7 +154,7 @@ var ToCPay = (props, ref) => {
|
|
|
155
154
|
}
|
|
156
155
|
};
|
|
157
156
|
const _getPaymentsAndWalletPass = async (order) => {
|
|
158
|
-
var _a2, _b2
|
|
157
|
+
var _a2, _b2;
|
|
159
158
|
paymentLogger.addLog({
|
|
160
159
|
key: "获取支付列表开始",
|
|
161
160
|
value: {
|
|
@@ -163,22 +162,11 @@ var ToCPay = (props, ref) => {
|
|
|
163
162
|
}
|
|
164
163
|
});
|
|
165
164
|
try {
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}),
|
|
172
|
-
(0, import_serve2.getMachineCodeList)({
|
|
173
|
-
order_id: order.order_id,
|
|
174
|
-
available: 2,
|
|
175
|
-
prepare_payments: [],
|
|
176
|
-
filter_prepare_wallet_pass: 1,
|
|
177
|
-
sale_channel: ((_a2 = order._order) == null ? void 0 : _a2.sale_channel) || "online-store",
|
|
178
|
-
other_exact_codes: []
|
|
179
|
-
}),
|
|
180
|
-
(0, import_serve.getOrderBasicDetail)(order.order_id)
|
|
181
|
-
]);
|
|
165
|
+
const data = await (0, import_serve.getPaymentsAndWalletPass)({
|
|
166
|
+
order_id: order.order_id,
|
|
167
|
+
total_amount: order.amount,
|
|
168
|
+
sale_channel: order.sale_channel || "online-store"
|
|
169
|
+
});
|
|
182
170
|
const {
|
|
183
171
|
remain_amount = 0,
|
|
184
172
|
wallet_pass_recommend_list,
|
|
@@ -186,25 +174,6 @@ var ToCPay = (props, ref) => {
|
|
|
186
174
|
payment_list,
|
|
187
175
|
walletPass
|
|
188
176
|
} = data || {};
|
|
189
|
-
const products = (orderBasicDetail.detail || []).map((item) => {
|
|
190
|
-
var _a3;
|
|
191
|
-
return {
|
|
192
|
-
...item,
|
|
193
|
-
is_price_include_tax: orderBasicDetail.is_price_include_tax,
|
|
194
|
-
product_bundle: (_a3 = item.product_bundle || []) == null ? void 0 : _a3.map((bundle) => {
|
|
195
|
-
return {
|
|
196
|
-
...bundle,
|
|
197
|
-
is_price_include_tax: orderBasicDetail.is_price_include_tax
|
|
198
|
-
};
|
|
199
|
-
})
|
|
200
|
-
};
|
|
201
|
-
});
|
|
202
|
-
const res = utils.walletPassEvaluator.getRecommendedVouchers({
|
|
203
|
-
orderTotalAmount: Math.min(orderBasicDetail.product_unpaid_total_pay_amount, order.amount),
|
|
204
|
-
products,
|
|
205
|
-
vouchers: allList || []
|
|
206
|
-
});
|
|
207
|
-
const { recommended, transformList, noApplicableVoucher, recommendedAmount } = res;
|
|
208
177
|
paymentLogger.addLog({
|
|
209
178
|
key: "支付数据获取",
|
|
210
179
|
value: ""
|
|
@@ -217,37 +186,27 @@ var ToCPay = (props, ref) => {
|
|
|
217
186
|
};
|
|
218
187
|
}
|
|
219
188
|
);
|
|
220
|
-
const waitAmount2 = new import_decimal.Decimal((order == null ? void 0 : order.amount) || 0).minus(new import_decimal.Decimal(recommendedAmount)).toNumber();
|
|
221
189
|
dispatch({
|
|
222
190
|
type: "setPayGroup",
|
|
223
191
|
payload: {
|
|
224
192
|
// ...state.payGroup,
|
|
225
193
|
order_id: order == null ? void 0 : order.order_id,
|
|
226
194
|
// total_amount: order?.amount,
|
|
227
|
-
orderDetail: orderBasicDetail,
|
|
228
195
|
// 原订单信息
|
|
229
196
|
_order: order,
|
|
230
197
|
payment_group_id: order == null ? void 0 : order.payment_group_id,
|
|
231
198
|
// 支付方式没有walletPass时walletPass设置null
|
|
232
199
|
walletPass: walletPass ? {
|
|
233
|
-
...(
|
|
200
|
+
...(_a2 = state.payGroup) == null ? void 0 : _a2.walletPass,
|
|
234
201
|
...walletPass,
|
|
235
|
-
|
|
236
|
-
cards:
|
|
237
|
-
// 推荐金额
|
|
238
|
-
amount: recommendedAmount,
|
|
239
|
-
// 不可用钱包
|
|
240
|
-
noApplicableVoucher,
|
|
241
|
-
// 转换列表
|
|
242
|
-
transformList
|
|
243
|
-
// amount: wallet_pass_amount,
|
|
244
|
-
// cards: wallet_pass_recommend_list,
|
|
202
|
+
amount: wallet_pass_amount,
|
|
203
|
+
cards: withCustomerIdList
|
|
245
204
|
} : null,
|
|
246
205
|
total_amount: order == null ? void 0 : order.amount,
|
|
247
|
-
wait_amount:
|
|
206
|
+
wait_amount: remain_amount
|
|
248
207
|
}
|
|
249
208
|
});
|
|
250
|
-
await ((
|
|
209
|
+
await ((_b2 = paymentListRef.current) == null ? void 0 : _b2.init(payment_list, remain_amount || 0));
|
|
251
210
|
setTimeout(() => {
|
|
252
211
|
setLoading(false);
|
|
253
212
|
}, 100);
|
|
@@ -62,21 +62,3 @@ 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
|
-
export {};
|
|
@@ -19,7 +19,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/components/pay/toC/serve.ts
|
|
20
20
|
var serve_exports = {};
|
|
21
21
|
__export(serve_exports, {
|
|
22
|
-
getOrderBasicDetail: () => getOrderBasicDetail,
|
|
23
22
|
getPaymentInit: () => getPaymentInit,
|
|
24
23
|
getPaymentList: () => getPaymentList,
|
|
25
24
|
getPaymentResult: () => getPaymentResult,
|
|
@@ -78,13 +77,8 @@ var getWalletNameAndPopupStatus = async (values) => {
|
|
|
78
77
|
return data;
|
|
79
78
|
};
|
|
80
79
|
var getPaymentResult = (values) => import_utils.request.getRequest().get(`/h5/pay/order/payment/result`, values);
|
|
81
|
-
var getOrderBasicDetail = async (order_id) => {
|
|
82
|
-
const { data } = await import_utils.request.getRequest().get(`/h5/order/order/${order_id}/basic-detail`, {});
|
|
83
|
-
return data;
|
|
84
|
-
};
|
|
85
80
|
// Annotate the CommonJS export names for ESM import in node:
|
|
86
81
|
0 && (module.exports = {
|
|
87
|
-
getOrderBasicDetail,
|
|
88
82
|
getPaymentInit,
|
|
89
83
|
getPaymentList,
|
|
90
84
|
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';
|
|
@@ -32,7 +32,6 @@ __export(utils_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(utils_exports);
|
|
33
33
|
var import_decimal = require("decimal.js");
|
|
34
34
|
var import_status = require("./status");
|
|
35
|
-
var import_utils = require("@pisell/utils");
|
|
36
35
|
var calcWalletPassListAmount = (list) => {
|
|
37
36
|
return list.reduce((pre, cur) => pre.add(new import_decimal.Decimal(String(getAvailableMaxAmount(cur) || 0))), new import_decimal.Decimal("0")).toNumber();
|
|
38
37
|
};
|
|
@@ -85,9 +84,6 @@ var formatFranchiseeRoute = (url, history) => {
|
|
|
85
84
|
return url;
|
|
86
85
|
};
|
|
87
86
|
var getAvailableMaxAmount = (data) => {
|
|
88
|
-
if ((0, import_utils.isNumber)(data._available_max_amount)) {
|
|
89
|
-
return data._available_max_amount;
|
|
90
|
-
}
|
|
91
87
|
return data.tag !== "point_card" ? data.available_max_amount : data == null ? void 0 : data.recommended_usage_amount;
|
|
92
88
|
};
|
|
93
89
|
var clientPayment = (params) => {
|
|
@@ -38,6 +38,7 @@ var import_materials = require("@pisell/materials");
|
|
|
38
38
|
var import_useContext = require("./useContext");
|
|
39
39
|
var import_utils = require("@pisell/utils");
|
|
40
40
|
var useClearCart = (key) => {
|
|
41
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
41
42
|
const { state, onChange } = (0, import_useContext.useContext)();
|
|
42
43
|
const { isProductList, disabledEdit, holders, isHideClearCart } = state;
|
|
43
44
|
const handleClear = () => {
|
|
@@ -47,20 +48,50 @@ var useClearCart = (key) => {
|
|
|
47
48
|
} else {
|
|
48
49
|
const ids = products == null ? void 0 : products.map((item) => item == null ? void 0 : item._id);
|
|
49
50
|
onChange(ids, "delete_holders", key);
|
|
51
|
+
setOpen(false);
|
|
50
52
|
return;
|
|
51
53
|
products = products.filter((item) => (item == null ? void 0 : item.holder_id) !== key);
|
|
52
54
|
}
|
|
53
55
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
const handleOpenModal = (0, import_react.useCallback)(() => {
|
|
57
|
+
setOpen(true);
|
|
58
|
+
}, []);
|
|
59
|
+
const handleCancel = (0, import_react.useCallback)(() => {
|
|
60
|
+
setOpen(false);
|
|
61
|
+
}, []);
|
|
62
|
+
return (0, import_react.useMemo)(() => {
|
|
63
|
+
const showClearBtn = !disabledEdit && (holders == null ? void 0 : holders.length) > 0 && !isHideClearCart;
|
|
64
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, showClearBtn ? /* @__PURE__ */ import_react.default.createElement(
|
|
65
|
+
"span",
|
|
66
|
+
{
|
|
67
|
+
className: (0, import_classnames.default)("pisell-lowcode__shopping-cart-clear-btn", {
|
|
68
|
+
"pisell-lowcode__shopping-cart-clear-btn-empty": isProductList
|
|
69
|
+
}),
|
|
70
|
+
onClick: handleOpenModal
|
|
71
|
+
},
|
|
72
|
+
/* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-trash-01" }),
|
|
73
|
+
/* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.booking.info.text.clear-cart"))
|
|
74
|
+
) : null, /* @__PURE__ */ import_react.default.createElement(
|
|
75
|
+
import_materials.PisellModal,
|
|
76
|
+
{
|
|
77
|
+
open,
|
|
78
|
+
title: import_utils.locales.getText(
|
|
79
|
+
"pisell2.booking.info.text.clear-cart-modal.title"
|
|
80
|
+
),
|
|
81
|
+
onOk: handleClear,
|
|
82
|
+
onCancel: handleCancel,
|
|
83
|
+
okText: import_utils.locales.getText(
|
|
84
|
+
"pisell2.booking.info.text.clear-cart-modal.confirm"
|
|
85
|
+
),
|
|
86
|
+
cancelText: import_utils.locales.getText(
|
|
87
|
+
"pisell2.booking.info.text.clear-cart-modal.cancel"
|
|
88
|
+
),
|
|
89
|
+
destroyOnClose: true
|
|
90
|
+
},
|
|
91
|
+
/* @__PURE__ */ import_react.default.createElement("div", { style: { margin: "24px 0" } }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText(
|
|
92
|
+
"pisell2.booking.info.text.clear-cart-modal.content"
|
|
93
|
+
)))
|
|
94
|
+
));
|
|
95
|
+
}, [open, disabledEdit, holders == null ? void 0 : holders.length, isHideClearCart, isProductList]);
|
|
65
96
|
};
|
|
66
97
|
var useClearCart_default = useClearCart;
|