@pisell/private-materials 6.4.50 → 6.4.52
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 +2 -2
- package/build/lowcode/preview.js +145 -153
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +3 -3
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +5 -5
- package/es/components/appointmentBooking/components/Services/index.js +36 -18
- package/es/components/appointmentBooking/hooks.js +6 -0
- package/es/components/booking/components/footer/index.js +12 -1
- package/es/components/booking/editBookingModal/index.js +8 -2
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/es/components/booking/locales.d.ts +6 -0
- package/es/components/booking/locales.js +12 -0
- package/es/components/checkout/PaymentModal.js +70 -62
- package/es/components/checkout/components/AmountSummary/index.js +4 -4
- package/es/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
- package/es/components/checkout/components/CashPaymentModule/index.js +14 -10
- package/es/components/eftposPay/linkly/hooks/normal.js +3 -3
- package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +60 -17
- package/es/components/eftposPay/payo/config.js +10 -10
- package/es/components/eftposPay/serve.js +1 -1
- package/es/components/index.d.ts +3 -1
- package/es/components/index.js +3 -1
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +6 -3
- package/es/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +112 -24
- package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
- package/es/components/pay/toC/PaymentMethods/WalletPass/serve.js +78 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +9 -0
- package/es/components/pay/toC/utils.js +1 -1
- package/es/components/pinModal/hooks.d.ts +7 -0
- package/es/components/pinModal/hooks.js +65 -0
- package/es/components/pinModal/index.d.ts +4 -0
- package/es/components/pinModal/index.js +98 -0
- package/es/components/pinModal/index.less +44 -0
- package/es/components/pinModal/locales.d.ts +27 -0
- package/es/components/pinModal/locales.js +26 -0
- package/es/components/pinModal/serve.d.ts +6 -0
- package/es/components/pinModal/serve.js +11 -0
- package/es/components/pinModal/types.d.ts +0 -0
- package/es/components/pinModal/types.js +0 -0
- package/es/components/pinVerifyModal/hooks.d.ts +7 -0
- package/es/components/pinVerifyModal/hooks.js +80 -0
- package/es/components/pinVerifyModal/index.d.ts +5 -0
- package/es/components/pinVerifyModal/index.js +218 -0
- package/es/components/pinVerifyModal/index.less +92 -0
- package/es/components/pinVerifyModal/locales.d.ts +24 -0
- package/es/components/pinVerifyModal/locales.js +23 -0
- package/es/components/pinVerifyModal/types.d.ts +33 -0
- package/es/components/pinVerifyModal/types.js +1 -0
- package/es/components/ticketBooking/components/ticketBooking/index.js +56 -10
- package/es/components/ticketBooking/components/timeBar/index.js +2 -1
- package/es/components/walletList/index.js +20 -2
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/lib/components/appointmentBooking/components/Services/index.js +13 -3
- package/lib/components/appointmentBooking/hooks.js +6 -0
- package/lib/components/booking/components/footer/index.js +15 -2
- package/lib/components/booking/editBookingModal/index.js +6 -1
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/locales.d.ts +6 -0
- package/lib/components/booking/locales.js +6 -0
- package/lib/components/checkout/PaymentModal.js +5 -4
- package/lib/components/checkout/components/AmountSummary/index.js +4 -4
- package/lib/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
- package/lib/components/checkout/components/CashPaymentModule/index.js +6 -3
- package/lib/components/eftposPay/linkly/hooks/normal.js +3 -3
- package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +59 -15
- package/lib/components/eftposPay/payo/config.js +9 -9
- package/lib/components/eftposPay/serve.js +1 -1
- package/lib/components/index.d.ts +3 -1
- package/lib/components/index.js +6 -0
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +2 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +84 -36
- package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
- package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.js +18 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +7 -2
- package/lib/components/pay/toC/utils.js +1 -1
- package/lib/components/pinModal/hooks.d.ts +7 -0
- package/lib/components/pinModal/hooks.js +85 -0
- package/lib/components/pinModal/index.d.ts +4 -0
- package/lib/components/pinModal/index.js +88 -0
- package/lib/components/pinModal/index.less +44 -0
- package/lib/components/pinModal/locales.d.ts +27 -0
- package/lib/components/pinModal/locales.js +50 -0
- package/lib/components/pinModal/serve.d.ts +6 -0
- package/lib/components/pinModal/serve.js +37 -0
- package/lib/components/pinModal/types.d.ts +0 -0
- package/lib/components/pinModal/types.js +0 -0
- package/lib/components/pinVerifyModal/hooks.d.ts +7 -0
- package/lib/components/pinVerifyModal/hooks.js +93 -0
- package/lib/components/pinVerifyModal/index.d.ts +5 -0
- package/lib/components/pinVerifyModal/index.js +230 -0
- package/lib/components/pinVerifyModal/index.less +92 -0
- package/lib/components/pinVerifyModal/locales.d.ts +24 -0
- package/lib/components/pinVerifyModal/locales.js +47 -0
- package/lib/components/pinVerifyModal/types.d.ts +33 -0
- package/lib/components/pinVerifyModal/types.js +17 -0
- package/lib/components/ticketBooking/components/ticketBooking/index.js +52 -5
- package/lib/components/ticketBooking/components/timeBar/index.js +2 -1
- package/lib/components/walletList/index.js +19 -2
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -0
- package/lowcode/pin-modal/meta.ts +37 -0
- package/lowcode/pin-verify-modal/meta.ts +80 -0
- package/package.json +4 -4
@@ -4,13 +4,14 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
4
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
5
5
|
import { useRef } from 'react';
|
6
6
|
import { getUniqueId, locales, sendWarningLog } from '@pisell/utils';
|
7
|
+
import dayjs from 'dayjs';
|
7
8
|
import { useDispatch, updateCustom, updateStatus, updateState } from "../../store";
|
8
9
|
import { useFail, useStoreRef } from "../../hooks";
|
9
10
|
import { ModeEnum, PayStatus, StatusEnum } from "../../const";
|
10
11
|
import { LinklyActionStatus } from "../const";
|
11
12
|
|
12
13
|
// 全局超时时间
|
13
|
-
var GlobalTimeout = 1000 * 60;
|
14
|
+
var GlobalTimeout = 1000 * 60 * 2;
|
14
15
|
// 单次请求超时时间
|
15
16
|
var RequestTimeout = 1000 * 5;
|
16
17
|
export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, handleLinklySuccess) {
|
@@ -18,7 +19,8 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
|
|
18
19
|
var _useStoreRef = useStoreRef(),
|
19
20
|
numRef = _useStoreRef.numRef,
|
20
21
|
modeRef = _useStoreRef.modeRef,
|
21
|
-
deviceRef = _useStoreRef.deviceRef
|
22
|
+
deviceRef = _useStoreRef.deviceRef,
|
23
|
+
orderIdRef = _useStoreRef.orderIdRef;
|
22
24
|
var fail = useFail(0);
|
23
25
|
var failRef = useRef(fail);
|
24
26
|
var isPay = modeRef.current === ModeEnum.Pay || modeRef.current === ModeEnum.FullPay;
|
@@ -82,22 +84,31 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
|
|
82
84
|
console.log('Success: 全局超时或不需要处理结果,终止查询');
|
83
85
|
return;
|
84
86
|
}
|
85
|
-
_log("Success", result);
|
86
87
|
isQueryFinishedRef.current = true;
|
87
88
|
var data = (result === null || result === void 0 ? void 0 : result.data) || {};
|
88
89
|
// 交易成功,终止查询
|
89
|
-
if (data.status
|
90
|
+
if (data.status == 1) {
|
90
91
|
console.log('交易成功,终止查询');
|
92
|
+
sendWarningLog({
|
93
|
+
title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u6210\u529F"),
|
94
|
+
content: [{
|
95
|
+
key: 'response',
|
96
|
+
value: JSON.stringify(result)
|
97
|
+
}]
|
98
|
+
});
|
91
99
|
reset();
|
92
100
|
handleLinklySuccess(result);
|
93
101
|
return;
|
94
102
|
}
|
95
103
|
|
96
104
|
// 交易状态为0,且不需要签名,则继续查询
|
97
|
-
if (data.status
|
105
|
+
if ((data === null || data === void 0 ? void 0 : data.status) == 0 && (data === null || data === void 0 ? void 0 : data.signature_flag) != 1) {
|
98
106
|
console.log('交易状态为0需要继续查询');
|
107
|
+
_log("Querying", result);
|
99
108
|
isQueryFinishedRef.current = false;
|
100
|
-
|
109
|
+
setTimeout(function () {
|
110
|
+
_resultQuery();
|
111
|
+
}, 1500);
|
101
112
|
return;
|
102
113
|
}
|
103
114
|
|
@@ -105,6 +116,13 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
|
|
105
116
|
if (data.status < 0) {
|
106
117
|
var _failRef$current;
|
107
118
|
console.log('交易失败,终止查询');
|
119
|
+
sendWarningLog({
|
120
|
+
title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u5931\u8D25"),
|
121
|
+
content: [{
|
122
|
+
key: 'response',
|
123
|
+
value: JSON.stringify(result)
|
124
|
+
}]
|
125
|
+
});
|
108
126
|
reset();
|
109
127
|
// 交易失败,code码转换为支付失败code码
|
110
128
|
result.code = PayStatus.Unknown;
|
@@ -113,8 +131,15 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
|
|
113
131
|
}
|
114
132
|
|
115
133
|
// 需要签名
|
116
|
-
if (data.signature_flag
|
134
|
+
if (data.signature_flag == 1) {
|
117
135
|
console.log('交易需要签名,终止查询');
|
136
|
+
sendWarningLog({
|
137
|
+
title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u9700\u8981\u7B7E\u540D"),
|
138
|
+
content: [{
|
139
|
+
key: 'response',
|
140
|
+
value: JSON.stringify(result)
|
141
|
+
}]
|
142
|
+
});
|
118
143
|
reset();
|
119
144
|
gotoSignature();
|
120
145
|
return;
|
@@ -132,7 +157,20 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
|
|
132
157
|
_log("AbortError");
|
133
158
|
console.log('Error: 请求被取消,将继续查询');
|
134
159
|
isQueryFinishedRef.current = false;
|
135
|
-
|
160
|
+
setTimeout(function () {
|
161
|
+
_resultQuery();
|
162
|
+
}, 1500);
|
163
|
+
return;
|
164
|
+
}
|
165
|
+
|
166
|
+
// 网关类报错,继续查询
|
167
|
+
if (!(error !== null && error !== void 0 && error.code) || "".concat(error.code) === PayStatus.Timeout) {
|
168
|
+
_log("NetworkError");
|
169
|
+
console.log('Error: 网关类报错,将继续查询');
|
170
|
+
isQueryFinishedRef.current = false;
|
171
|
+
setTimeout(function () {
|
172
|
+
_resultQuery();
|
173
|
+
}, 1500);
|
136
174
|
return;
|
137
175
|
}
|
138
176
|
_log("Error", error);
|
@@ -222,33 +260,36 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
|
|
222
260
|
session_id: numRef.current
|
223
261
|
};
|
224
262
|
var content = [{
|
225
|
-
key: '
|
226
|
-
value: JSON.stringify(
|
263
|
+
key: 'description',
|
264
|
+
value: JSON.stringify({
|
265
|
+
queryId: queryIdRef.current,
|
266
|
+
orderId: orderIdRef.current,
|
267
|
+
type: type,
|
268
|
+
date: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
269
|
+
})
|
227
270
|
}, {
|
228
271
|
key: 'params',
|
229
272
|
value: JSON.stringify(params)
|
230
273
|
}];
|
231
|
-
if (type === "
|
274
|
+
if (type === "Error") {
|
232
275
|
content.push({
|
233
|
-
key: '
|
276
|
+
key: 'error',
|
234
277
|
value: JSON.stringify(res)
|
235
278
|
});
|
236
|
-
} else
|
279
|
+
} else {
|
237
280
|
content.push({
|
238
|
-
key: '
|
281
|
+
key: 'response',
|
239
282
|
value: JSON.stringify(res)
|
240
283
|
});
|
241
284
|
}
|
242
285
|
sendWarningLog({
|
243
|
-
title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u7ED3\u679C\
|
286
|
+
title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u7ED3\u679C\u8F6E\u8BE2"),
|
244
287
|
content: content
|
245
288
|
});
|
246
289
|
};
|
247
290
|
var run = function run() {
|
248
291
|
// 重置状态
|
249
292
|
reset();
|
250
|
-
console.log('开始查询linkly结果---->>>>>>>');
|
251
|
-
_log("Start");
|
252
293
|
|
253
294
|
// 设置全局超时定时器
|
254
295
|
globalTimeoutIdRef.current = setTimeout(function () {
|
@@ -264,6 +305,8 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
|
|
264
305
|
startTimeRef.current = Date.now();
|
265
306
|
isQueryFinishedRef.current = false;
|
266
307
|
queryIdRef.current = getUniqueId();
|
308
|
+
console.log('开始查询linkly结果---->>>>>>>');
|
309
|
+
_log("Start");
|
267
310
|
return _resultQuery();
|
268
311
|
};
|
269
312
|
return {
|
@@ -152,15 +152,15 @@ export var POS = function POS(_ref) {
|
|
152
152
|
controllerRef.current = new AbortController();
|
153
153
|
// 支付 or 退款
|
154
154
|
var resultPromise = modeRef.current === ModeEnum.Pay || modeRef.current === ModeEnum.FullPay ? api.pay(_objectSpread(_objectSpread({}, custom !== null && custom !== void 0 && custom.platform ? {
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
155
|
+
operator_id: custom.operator_id,
|
156
|
+
operator_type: custom.operator_type,
|
157
|
+
platform: custom.platform,
|
158
|
+
custom_payment_id: custom.custom_payment_id,
|
159
|
+
service_charge: {
|
160
|
+
amount: payRef.current.surMoney,
|
161
|
+
percentage: payRef.current.surPercentRate
|
162
162
|
},
|
163
|
-
|
163
|
+
original_amount: payRef.current.amount
|
164
164
|
} : {}), {}, {
|
165
165
|
order_id: orderIdRef.current,
|
166
166
|
amount: payRef.current.total,
|
@@ -199,8 +199,8 @@ export var POS = function POS(_ref) {
|
|
199
199
|
if (unloadRef.current || !netRef.current) {
|
200
200
|
return;
|
201
201
|
}
|
202
|
-
// 支付接口超时
|
203
|
-
if (err && "".concat(err.code) === PayStatus.Timeout) {
|
202
|
+
// 支付接口超时 进行支付状态查询(超时或者其它错误)
|
203
|
+
if (!(err !== null && err !== void 0 && err.code) || "".concat(err.code) === PayStatus.Timeout) {
|
204
204
|
checkApi();
|
205
205
|
return;
|
206
206
|
}
|
@@ -232,7 +232,7 @@ export var linklyPayQuery = /*#__PURE__*/function () {
|
|
232
232
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
233
233
|
while (1) switch (_context15.prev = _context15.next) {
|
234
234
|
case 0:
|
235
|
-
return _context15.abrupt("return", request.getRequest().get('/shop/
|
235
|
+
return _context15.abrupt("return", request.getRequest().get('/shop/linkly/pay/query', params, config));
|
236
236
|
case 1:
|
237
237
|
case "end":
|
238
238
|
return _context15.stop();
|
package/es/components/index.d.ts
CHANGED
@@ -17,4 +17,6 @@ import PisellSelectCustomerModal from './pisellSelectCustomerModal';
|
|
17
17
|
import SubTotal from './subTotal';
|
18
18
|
import EditBookingModal from './booking/editBookingModal';
|
19
19
|
import StepController from './stepController';
|
20
|
-
|
20
|
+
import PinModal from './pinModal';
|
21
|
+
import PinVerifyModal from './pinVerifyModal';
|
22
|
+
export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay, PisellSelectCustomerModal, Wallet, WalletList, WorkspaceList, WorkspaceListDetail, SubTotal, EditBookingModal, StepController, PinModal, PinVerifyModal, };
|
package/es/components/index.js
CHANGED
@@ -17,4 +17,6 @@ import PisellSelectCustomerModal from "./pisellSelectCustomerModal";
|
|
17
17
|
import SubTotal from "./subTotal";
|
18
18
|
import EditBookingModal from "./booking/editBookingModal";
|
19
19
|
import StepController from "./stepController";
|
20
|
-
|
20
|
+
import PinModal from "./pinModal";
|
21
|
+
import PinVerifyModal from "./pinVerifyModal";
|
22
|
+
export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay, PisellSelectCustomerModal, Wallet, WalletList, WorkspaceList, WorkspaceListDetail, SubTotal, EditBookingModal, StepController, PinModal, PinVerifyModal };
|
@@ -262,7 +262,9 @@ export var createThreeDSMethodIframe = /*#__PURE__*/function () {
|
|
262
262
|
}
|
263
263
|
return _context3.abrupt("return", defaultReturnParams);
|
264
264
|
case 5:
|
265
|
-
displayBox = document.getElementById('threeds-container'); //
|
265
|
+
displayBox = document.getElementById('threeds-container'); // 清空dom中的内容
|
266
|
+
displayBox.innerHTML = '';
|
267
|
+
// 创建iframe
|
266
268
|
iframe = document.createElement('iframe'); // iframe.src = "about:blank";
|
267
269
|
iframe.classList.add('hidden_TDS_From');
|
268
270
|
iframe.name = 'threeDSMethodIframe';
|
@@ -315,7 +317,7 @@ export var createThreeDSMethodIframe = /*#__PURE__*/function () {
|
|
315
317
|
}
|
316
318
|
}, false);
|
317
319
|
}));
|
318
|
-
case
|
320
|
+
case 28:
|
319
321
|
case "end":
|
320
322
|
return _context3.stop();
|
321
323
|
}
|
@@ -436,7 +438,8 @@ export var checkTDSAuth = /*#__PURE__*/function () {
|
|
436
438
|
*/
|
437
439
|
export var createChallengeIframe = function createChallengeIframe(challengeData, callback) {
|
438
440
|
var displayBox = document.getElementById('threeds-container');
|
439
|
-
|
441
|
+
// 清空dom中的内容
|
442
|
+
displayBox.innerHTML = '';
|
440
443
|
// 创建iframe
|
441
444
|
var iframe = document.createElement('iframe');
|
442
445
|
iframe.classList.add('tdsv2challengeIframe');
|
@@ -11,6 +11,8 @@ export interface WalletPassListProps {
|
|
11
11
|
name: string;
|
12
12
|
};
|
13
13
|
onChangeDebounce?: boolean;
|
14
|
+
loading?: boolean;
|
15
|
+
onLoadingChange?: (loading: boolean) => void;
|
14
16
|
}
|
15
17
|
export declare type WalletPassListRef = {
|
16
18
|
init: (params: MachineCodeListParams, formatList?: (val: WalletPassDataType[]) => WalletPassDataType[]) => void;
|
@@ -22,18 +22,22 @@ import { PisellModal, PisellText, PisellToast } from '@pisell/materials';
|
|
22
22
|
import { locales, uniqueByKey } from '@pisell/utils';
|
23
23
|
import { useMemoizedFn } from 'ahooks';
|
24
24
|
import { InfoCircleOutlined } from '@ant-design/icons';
|
25
|
+
import PinVerifyModal from "../../../../pinVerifyModal";
|
25
26
|
import MultiModeSearch from "./MultiModeSearch";
|
26
27
|
import List from "./List";
|
27
|
-
import { searchMachineCodeList } from "./serve";
|
28
|
-
import { formatMachineCodeServer2CardList } from "./utils";
|
28
|
+
import { searchMachineCodeList, searchWalletCode } from "./serve";
|
29
|
+
import { formatMachineCodeServer2CardList, getIsWalletCode } from "./utils";
|
29
30
|
import { calcWalletPassListAmount, formatWalletPassList2PreparePayments } from "../../utils";
|
30
31
|
import "./index.less";
|
32
|
+
import useEngineContext from "../../../../../hooks/useEngineContext";
|
31
33
|
var Amount = PisellText.Amount;
|
32
34
|
var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
|
33
|
-
var _searchSelectData$ids;
|
35
|
+
var _context$appHelper, _context$appHelper$ge, _searchSelectData$ids;
|
34
36
|
var onWalletPassChange = props.onWalletPassChange,
|
35
37
|
walletPass = props.walletPass,
|
36
38
|
walletSetting = props.walletSetting;
|
39
|
+
var context = useEngineContext();
|
40
|
+
var isWalletCode = context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.businessUtils) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getAppByModal) === null || _context$appHelper$ge === void 0 ? void 0 : _context$appHelper$ge.call(_context$appHelper, 'wallet');
|
37
41
|
|
38
42
|
/** 当前 walletPass信息 弹窗操作时都在内部进行,点击 redeem时同步到外层 */
|
39
43
|
var _useState = useState(walletPass),
|
@@ -87,7 +91,8 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
87
91
|
var listRef = useRef(null);
|
88
92
|
|
89
93
|
/** 当前搜索框搜索值 */
|
90
|
-
var searchValRef = useRef(
|
94
|
+
var searchValRef = useRef(null);
|
95
|
+
var pinVerifyModalRef = useRef(null);
|
91
96
|
var _ref = currentWalletPass || {},
|
92
97
|
walletPassSelectCards = _ref.cards,
|
93
98
|
amount = _ref.amount;
|
@@ -207,30 +212,33 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
207
212
|
* @param val
|
208
213
|
*/
|
209
214
|
var searchList = /*#__PURE__*/function () {
|
210
|
-
var
|
211
|
-
var _order$_order2;
|
212
|
-
var result;
|
215
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3, isSelectChange) {
|
216
|
+
var code, customer_pin_key, _order$_order2, result;
|
213
217
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
214
218
|
while (1) switch (_context2.prev = _context2.next) {
|
215
219
|
case 0:
|
220
|
+
code = _ref3.code, customer_pin_key = _ref3.customer_pin_key;
|
216
221
|
if (order !== null && order !== void 0 && order.order_id) {
|
217
|
-
_context2.next =
|
222
|
+
_context2.next = 3;
|
218
223
|
break;
|
219
224
|
}
|
220
225
|
return _context2.abrupt("return");
|
221
|
-
case
|
222
|
-
|
226
|
+
case 3:
|
227
|
+
setLoading(true);
|
228
|
+
_context2.prev = 4;
|
229
|
+
_context2.next = 7;
|
223
230
|
return searchMachineCodeList({
|
224
231
|
order_id: order.order_id,
|
225
|
-
code:
|
232
|
+
code: code,
|
226
233
|
prepare_payments: prepare_payments,
|
227
|
-
filter_prepare_wallet_pass: 1,
|
228
|
-
sale_channel: ((_order$_order2 = order._order) === null || _order$_order2 === void 0 ? void 0 : _order$_order2.sale_channel) || 'online-store'
|
234
|
+
// filter_prepare_wallet_pass: 1,
|
235
|
+
sale_channel: ((_order$_order2 = order._order) === null || _order$_order2 === void 0 ? void 0 : _order$_order2.sale_channel) || 'online-store',
|
236
|
+
customer_pin_key: customer_pin_key
|
229
237
|
});
|
230
|
-
case
|
238
|
+
case 7:
|
231
239
|
result = _context2.sent;
|
232
240
|
if (result) {
|
233
|
-
_context2.next =
|
241
|
+
_context2.next = 11;
|
234
242
|
break;
|
235
243
|
}
|
236
244
|
if (!isSelectChange) {
|
@@ -239,7 +247,13 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
239
247
|
});
|
240
248
|
}
|
241
249
|
return _context2.abrupt("return");
|
242
|
-
case
|
250
|
+
case 11:
|
251
|
+
if (!(isSelectChange && !searchValRef.current)) {
|
252
|
+
_context2.next = 13;
|
253
|
+
break;
|
254
|
+
}
|
255
|
+
return _context2.abrupt("return");
|
256
|
+
case 13:
|
243
257
|
setSearchData(formatMachineCodeServer2CardList([].concat(_toConsumableArray(searchSelectData.details), _toConsumableArray(result)), searchSelectData.ids));
|
244
258
|
if (result.length) {
|
245
259
|
// 如果搜索结果只有一个并且可用,则直接选中
|
@@ -250,22 +264,88 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
250
264
|
});
|
251
265
|
}
|
252
266
|
setSearchOpen(true);
|
253
|
-
searchValRef.current =
|
267
|
+
searchValRef.current = {
|
268
|
+
code: code,
|
269
|
+
customer_pin_key: customer_pin_key
|
270
|
+
};
|
254
271
|
}
|
255
|
-
case
|
272
|
+
case 15:
|
273
|
+
_context2.prev = 15;
|
274
|
+
setLoading(false);
|
275
|
+
return _context2.finish(15);
|
276
|
+
case 18:
|
256
277
|
case "end":
|
257
278
|
return _context2.stop();
|
258
279
|
}
|
259
|
-
}, _callee2);
|
280
|
+
}, _callee2, null, [[4,, 15, 18]]);
|
260
281
|
}));
|
261
282
|
return function searchList(_x2, _x3) {
|
262
|
-
return
|
283
|
+
return _ref4.apply(this, arguments);
|
284
|
+
};
|
285
|
+
}();
|
286
|
+
var searchWalletCodeFn = /*#__PURE__*/function () {
|
287
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(val) {
|
288
|
+
var _pinVerifyModalRef$cu, result;
|
289
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
290
|
+
while (1) switch (_context3.prev = _context3.next) {
|
291
|
+
case 0:
|
292
|
+
setLoading(true);
|
293
|
+
_context3.prev = 1;
|
294
|
+
_context3.next = 4;
|
295
|
+
return searchWalletCode({
|
296
|
+
code: val,
|
297
|
+
with_customer: 1
|
298
|
+
});
|
299
|
+
case 4:
|
300
|
+
result = _context3.sent;
|
301
|
+
console.log(result, 'result');
|
302
|
+
// 如果搜索不到wallet code则走原始搜索逻辑
|
303
|
+
if (result) {
|
304
|
+
_context3.next = 9;
|
305
|
+
break;
|
306
|
+
}
|
307
|
+
searchList({
|
308
|
+
code: val
|
309
|
+
});
|
310
|
+
return _context3.abrupt("return");
|
311
|
+
case 9:
|
312
|
+
(_pinVerifyModalRef$cu = pinVerifyModalRef.current) === null || _pinVerifyModalRef$cu === void 0 || _pinVerifyModalRef$cu.open({
|
313
|
+
wallet_code: result.code,
|
314
|
+
wallet_detail_id: result.id,
|
315
|
+
failed_count: result.failed_count,
|
316
|
+
check_max_count: result.check_max_count,
|
317
|
+
customer: result.customer
|
318
|
+
});
|
319
|
+
// const pin = await getPin({ wallet_detail_id: result.id });
|
320
|
+
// const pinResult = await verifyPinCode({ wallet_detail_id: result.id, pin: pin.pin });
|
321
|
+
// searchList({ customer_pin_key: pinResult.customer_pin_key });
|
322
|
+
// console.log(pinResult, 'pinResult');
|
323
|
+
case 10:
|
324
|
+
_context3.prev = 10;
|
325
|
+
setLoading(false);
|
326
|
+
return _context3.finish(10);
|
327
|
+
case 13:
|
328
|
+
case "end":
|
329
|
+
return _context3.stop();
|
330
|
+
}
|
331
|
+
}, _callee3, null, [[1,, 10, 13]]);
|
332
|
+
}));
|
333
|
+
return function searchWalletCodeFn(_x4) {
|
334
|
+
return _ref5.apply(this, arguments);
|
263
335
|
};
|
264
336
|
}();
|
265
337
|
var handleSearch = useMemoizedFn(function (val) {
|
266
338
|
if (!val || searchOpen) return;
|
267
339
|
isAutoSelect.current = true;
|
268
|
-
|
340
|
+
|
341
|
+
// 如果是wallet code 并且安装wallet应用 则搜索wallet code
|
342
|
+
if (getIsWalletCode(val) && isWalletCode) {
|
343
|
+
searchWalletCodeFn(val);
|
344
|
+
} else {
|
345
|
+
searchList({
|
346
|
+
code: val
|
347
|
+
});
|
348
|
+
}
|
269
349
|
});
|
270
350
|
useImperativeHandle(ref, function () {
|
271
351
|
return {
|
@@ -274,7 +354,7 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
274
354
|
});
|
275
355
|
var handleSearchModalClose = function handleSearchModalClose() {
|
276
356
|
setSearchOpen(false);
|
277
|
-
searchValRef.current =
|
357
|
+
searchValRef.current = null;
|
278
358
|
setSearchSelectData({
|
279
359
|
ids: [],
|
280
360
|
details: []
|
@@ -398,7 +478,15 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
398
478
|
walletSetting: walletSetting,
|
399
479
|
data: searchData,
|
400
480
|
value: searchSelectData.ids,
|
401
|
-
onChange: handleAddChange
|
402
|
-
|
481
|
+
onChange: handleAddChange,
|
482
|
+
loading: loading
|
483
|
+
}))), /*#__PURE__*/React.createElement(PinVerifyModal, {
|
484
|
+
ref: pinVerifyModalRef,
|
485
|
+
onSuccess: function onSuccess(params) {
|
486
|
+
searchList({
|
487
|
+
customer_pin_key: params === null || params === void 0 ? void 0 : params.customer_pin_key
|
488
|
+
});
|
489
|
+
}
|
490
|
+
}));
|
403
491
|
});
|
404
492
|
export default /*#__PURE__*/memo(WalletPass);
|
@@ -84,14 +84,15 @@ export declare const getRecommendMachineCodeList: (order_id: number) => Promise<
|
|
84
84
|
*/
|
85
85
|
export declare const searchMachineCodeList: (params: {
|
86
86
|
order_id: number | string;
|
87
|
-
code
|
87
|
+
code?: string;
|
88
88
|
sale_channel: string;
|
89
89
|
prepare_payments: {
|
90
90
|
voucher_id: number;
|
91
91
|
amount: number;
|
92
92
|
tag: string;
|
93
93
|
}[];
|
94
|
-
filter_prepare_wallet_pass
|
94
|
+
filter_prepare_wallet_pass?: 1 | 0;
|
95
|
+
customer_pin_key?: string;
|
95
96
|
}) => Promise<WalletPassDataType[]>;
|
96
97
|
/**
|
97
98
|
* walletpass支付
|
@@ -110,4 +111,39 @@ export declare const walletPassPay: (params: {
|
|
110
111
|
};
|
111
112
|
}[];
|
112
113
|
}) => Promise<WalletPassDataType[]>;
|
114
|
+
/**
|
115
|
+
* 搜索wallet code
|
116
|
+
*/
|
117
|
+
export declare const searchWalletCode: (params: {
|
118
|
+
code: string;
|
119
|
+
with_customer: 1 | 0;
|
120
|
+
}) => Promise<{
|
121
|
+
code: string;
|
122
|
+
id: number;
|
123
|
+
status: 'enable' | 'disable' | 'expired';
|
124
|
+
expired_at: string;
|
125
|
+
customer: Record<string, any>;
|
126
|
+
check_max_count: number;
|
127
|
+
failed_count: number;
|
128
|
+
}>;
|
129
|
+
/**
|
130
|
+
* 验证pin码
|
131
|
+
*/
|
132
|
+
export declare const verifyPinCode: (params: {
|
133
|
+
wallet_detail_id: number;
|
134
|
+
pin: string;
|
135
|
+
}) => Promise<{
|
136
|
+
status: number;
|
137
|
+
customer_id: number;
|
138
|
+
msg: string;
|
139
|
+
customer_pin_key: string;
|
140
|
+
}>;
|
141
|
+
/**
|
142
|
+
* 获取pin码
|
143
|
+
*/
|
144
|
+
export declare const getPin: (params: {
|
145
|
+
wallet_detail_id: number;
|
146
|
+
}) => Promise<{
|
147
|
+
pin: string;
|
148
|
+
}>;
|
113
149
|
export {};
|
@@ -111,4 +111,82 @@ export var walletPassPay = /*#__PURE__*/function () {
|
|
111
111
|
return function walletPassPay(_x4) {
|
112
112
|
return _ref4.apply(this, arguments);
|
113
113
|
};
|
114
|
+
}();
|
115
|
+
|
116
|
+
/**
|
117
|
+
* 搜索wallet code
|
118
|
+
*/
|
119
|
+
export var searchWalletCode = /*#__PURE__*/function () {
|
120
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
|
121
|
+
var _yield$request$getReq5, data;
|
122
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
123
|
+
while (1) switch (_context5.prev = _context5.next) {
|
124
|
+
case 0:
|
125
|
+
_context5.next = 2;
|
126
|
+
return request.getRequest().post("/h5/wallet/detail/search", params);
|
127
|
+
case 2:
|
128
|
+
_yield$request$getReq5 = _context5.sent;
|
129
|
+
data = _yield$request$getReq5.data;
|
130
|
+
return _context5.abrupt("return", data);
|
131
|
+
case 5:
|
132
|
+
case "end":
|
133
|
+
return _context5.stop();
|
134
|
+
}
|
135
|
+
}, _callee5);
|
136
|
+
}));
|
137
|
+
return function searchWalletCode(_x5) {
|
138
|
+
return _ref5.apply(this, arguments);
|
139
|
+
};
|
140
|
+
}();
|
141
|
+
|
142
|
+
/**
|
143
|
+
* 验证pin码
|
144
|
+
*/
|
145
|
+
export var verifyPinCode = /*#__PURE__*/function () {
|
146
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
|
147
|
+
var _yield$request$getReq6, data;
|
148
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
149
|
+
while (1) switch (_context6.prev = _context6.next) {
|
150
|
+
case 0:
|
151
|
+
_context6.next = 2;
|
152
|
+
return request.getRequest().post("/h5/wallet/detail/pin/validate", params);
|
153
|
+
case 2:
|
154
|
+
_yield$request$getReq6 = _context6.sent;
|
155
|
+
data = _yield$request$getReq6.data;
|
156
|
+
return _context6.abrupt("return", data);
|
157
|
+
case 5:
|
158
|
+
case "end":
|
159
|
+
return _context6.stop();
|
160
|
+
}
|
161
|
+
}, _callee6);
|
162
|
+
}));
|
163
|
+
return function verifyPinCode(_x6) {
|
164
|
+
return _ref6.apply(this, arguments);
|
165
|
+
};
|
166
|
+
}();
|
167
|
+
|
168
|
+
/**
|
169
|
+
* 获取pin码
|
170
|
+
*/
|
171
|
+
export var getPin = /*#__PURE__*/function () {
|
172
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
|
173
|
+
var _yield$request$getReq7, data;
|
174
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
175
|
+
while (1) switch (_context7.prev = _context7.next) {
|
176
|
+
case 0:
|
177
|
+
_context7.next = 2;
|
178
|
+
return request.getRequest().get("/h5/wallet/detail/pin", params);
|
179
|
+
case 2:
|
180
|
+
_yield$request$getReq7 = _context7.sent;
|
181
|
+
data = _yield$request$getReq7.data;
|
182
|
+
return _context7.abrupt("return", data);
|
183
|
+
case 5:
|
184
|
+
case "end":
|
185
|
+
return _context7.stop();
|
186
|
+
}
|
187
|
+
}, _callee7);
|
188
|
+
}));
|
189
|
+
return function getPin(_x7) {
|
190
|
+
return _ref7.apply(this, arguments);
|
191
|
+
};
|
114
192
|
}();
|
@@ -1,3 +1,9 @@
|
|
1
1
|
import { WalletPassDataType } from './serve';
|
2
2
|
export declare const formatMachineCodeServer2CardList: (data: WalletPassDataType[], selectId?: number[]) => any;
|
3
3
|
export declare const getDataByIds: (arr: any[], ids: number[]) => any[];
|
4
|
+
/**
|
5
|
+
* 判断是否是wallet code
|
6
|
+
* @param val
|
7
|
+
* @returns
|
8
|
+
*/
|
9
|
+
export declare const getIsWalletCode: (val: string) => boolean;
|
@@ -38,4 +38,13 @@ export var getDataByIds = function getDataByIds(arr, ids) {
|
|
38
38
|
return arr.filter(function (item) {
|
39
39
|
return ids.includes(item.id);
|
40
40
|
});
|
41
|
+
};
|
42
|
+
|
43
|
+
/**
|
44
|
+
* 判断是否是wallet code
|
45
|
+
* @param val
|
46
|
+
* @returns
|
47
|
+
*/
|
48
|
+
export var getIsWalletCode = function getIsWalletCode(val) {
|
49
|
+
return val.startsWith('WL');
|
41
50
|
};
|
@@ -41,7 +41,7 @@ export var formatWalletPassParams = function formatWalletPassParams(payGroup) {
|
|
41
41
|
var payments = (walletPass === null || walletPass === void 0 ? void 0 : walletPass.cards.map(function (item) {
|
42
42
|
return {
|
43
43
|
amount: getAvailableMaxAmount(item),
|
44
|
-
wallet_pass_use_value: item.
|
44
|
+
wallet_pass_use_value: item.recommended_usage_par_value,
|
45
45
|
voucher_id: item.id,
|
46
46
|
tag: item.tag,
|
47
47
|
wallet_pass_usage_unit: item.wallet_pass_usage_unit
|