@pisell/private-materials 3.4.51 → 3.4.53
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 +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +10 -10
- package/es/components/booking/addons/model.d.ts +10 -1
- package/es/components/booking/forms/model.d.ts +10 -1
- package/es/components/booking/info/model.d.ts +10 -1
- 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/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/linkly/hooks/useTimeQuery.js +14 -6
- package/es/components/eftposPay/payo/config.js +70 -32
- package/es/components/eftposPay/payo/payment.d.ts +66 -0
- package/es/components/eftposPay/payo/payment.js +579 -0
- package/es/components/eftposPay/utils/log/index.d.ts +110 -0
- package/es/components/eftposPay/utils/log/index.js +371 -0
- package/es/components/index.d.ts +2 -1
- package/es/components/index.js +2 -1
- package/es/components/pay/toC/model.d.ts +9 -1
- package/es/components/schedules/model.d.ts +9 -1
- package/es/components/systemSettings/registry/components/GroupModal.d.ts +4 -0
- package/es/components/systemSettings/registry/components/GroupModal.js +160 -0
- package/es/components/systemSettings/registry/components/ItemModal.d.ts +4 -0
- package/es/components/systemSettings/registry/components/ItemModal.js +547 -0
- package/es/components/systemSettings/registry/components/ModuleList.d.ts +4 -0
- package/es/components/systemSettings/registry/components/ModuleList.js +54 -0
- package/es/components/systemSettings/registry/components/SectionList.d.ts +4 -0
- package/es/components/systemSettings/registry/components/SectionList.js +174 -0
- package/es/components/systemSettings/registry/components/SettingsTable.d.ts +4 -0
- package/es/components/systemSettings/registry/components/SettingsTable.js +765 -0
- package/es/components/systemSettings/registry/components/index.d.ts +4 -0
- package/es/components/systemSettings/registry/components/index.js +4 -0
- package/es/components/systemSettings/registry/index.d.ts +5 -0
- package/es/components/systemSettings/registry/index.js +1059 -0
- package/es/components/systemSettings/registry/index.less +410 -0
- package/es/components/systemSettings/registry/locales.d.ts +272 -0
- package/es/components/systemSettings/registry/locales.js +300 -0
- package/es/components/systemSettings/registry/services.d.ts +77 -0
- package/es/components/systemSettings/registry/services.js +472 -0
- package/es/components/systemSettings/registry/types.d.ts +126 -0
- package/es/components/systemSettings/registry/types.js +1 -0
- package/es/components/systemSettings/registry/utils/typeValidation.d.ts +16 -0
- package/es/components/systemSettings/registry/utils/typeValidation.js +284 -0
- package/es/components/systemSettings/registry/utils/validators.d.ts +8 -0
- package/es/components/systemSettings/registry/utils/validators.js +44 -0
- package/es/components/wallet/Detail/model.d.ts +13 -1
- package/es/components/wallet/DiscountCard/model.d.ts +14 -1
- package/es/components/wallet/PointCard/model.d.ts +13 -1
- package/es/components/wallet/RechargeableCard/model.d.ts +29 -1
- package/es/components/wallet/Voucher/model.d.ts +13 -1
- package/es/components/wallet/model.d.ts +9 -1
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/es/plus/walletPassGallery/components/footerButton/index.js +2 -4
- package/es/plus/walletPassGallery/components/footerButton/index.less +14 -59
- package/es/plus/walletPassGallery/components/passDetail/index.js +5 -1
- package/es/plus/walletPassGallery/components/passDetail/index.less +4 -0
- package/es/plus/walletPassGallery/components/recharge/index.js +19 -8
- package/es/plus/walletPassGallery/index.js +3 -1
- package/es/pro/Login2.0/index.less +15 -8
- package/lib/components/booking/addons/model.d.ts +10 -1
- package/lib/components/booking/forms/model.d.ts +10 -1
- package/lib/components/booking/info/model.d.ts +10 -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/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/linkly/hooks/useTimeQuery.js +12 -6
- package/lib/components/eftposPay/payo/config.js +98 -73
- package/lib/components/eftposPay/payo/payment.d.ts +66 -0
- package/lib/components/eftposPay/payo/payment.js +357 -0
- package/lib/components/eftposPay/utils/log/index.d.ts +110 -0
- package/lib/components/eftposPay/utils/log/index.js +294 -0
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +3 -0
- package/lib/components/pay/toC/model.d.ts +9 -1
- package/lib/components/schedules/model.d.ts +9 -1
- package/lib/components/systemSettings/registry/components/GroupModal.d.ts +4 -0
- package/lib/components/systemSettings/registry/components/GroupModal.js +177 -0
- package/lib/components/systemSettings/registry/components/ItemModal.d.ts +4 -0
- package/lib/components/systemSettings/registry/components/ItemModal.js +508 -0
- package/lib/components/systemSettings/registry/components/ModuleList.d.ts +4 -0
- package/lib/components/systemSettings/registry/components/ModuleList.js +71 -0
- package/lib/components/systemSettings/registry/components/SectionList.d.ts +4 -0
- package/lib/components/systemSettings/registry/components/SectionList.js +181 -0
- package/lib/components/systemSettings/registry/components/SettingsTable.d.ts +4 -0
- package/lib/components/systemSettings/registry/components/SettingsTable.js +575 -0
- package/lib/components/systemSettings/registry/components/index.d.ts +4 -0
- package/lib/components/systemSettings/registry/components/index.js +48 -0
- package/lib/components/systemSettings/registry/index.d.ts +5 -0
- package/lib/components/systemSettings/registry/index.js +529 -0
- package/lib/components/systemSettings/registry/index.less +410 -0
- package/lib/components/systemSettings/registry/locales.d.ts +272 -0
- package/lib/components/systemSettings/registry/locales.js +324 -0
- package/lib/components/systemSettings/registry/services.d.ts +77 -0
- package/lib/components/systemSettings/registry/services.js +290 -0
- package/lib/components/systemSettings/registry/types.d.ts +126 -0
- package/lib/components/systemSettings/registry/types.js +17 -0
- package/lib/components/systemSettings/registry/utils/typeValidation.d.ts +16 -0
- package/lib/components/systemSettings/registry/utils/typeValidation.js +228 -0
- package/lib/components/systemSettings/registry/utils/validators.d.ts +8 -0
- package/lib/components/systemSettings/registry/utils/validators.js +54 -0
- package/lib/components/wallet/Detail/model.d.ts +13 -1
- package/lib/components/wallet/DiscountCard/model.d.ts +14 -1
- package/lib/components/wallet/PointCard/model.d.ts +13 -1
- package/lib/components/wallet/RechargeableCard/model.d.ts +29 -1
- package/lib/components/wallet/Voucher/model.d.ts +13 -1
- package/lib/components/wallet/model.d.ts +9 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -0
- package/lib/plus/walletPassGallery/components/footerButton/index.js +2 -2
- package/lib/plus/walletPassGallery/components/footerButton/index.less +14 -59
- package/lib/plus/walletPassGallery/components/passDetail/index.js +4 -1
- package/lib/plus/walletPassGallery/components/passDetail/index.less +4 -0
- package/lib/plus/walletPassGallery/components/recharge/index.js +7 -1
- package/lib/plus/walletPassGallery/index.js +3 -1
- package/lib/pro/Login2.0/index.less +15 -8
- package/lowcode/settings-registry/meta.ts +29 -0
- package/package.json +4 -4
|
@@ -32,6 +32,10 @@ var Recharge = function Recharge(_ref) {
|
|
|
32
32
|
storage = _ref2.storage;
|
|
33
33
|
var dvaStore = (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 || (_context$appHelper2 = _context$appHelper2.utils) === null || _context$appHelper2 === void 0 || (_context$appHelper2$g = _context$appHelper2.getStore) === null || _context$appHelper2$g === void 0 || (_context$appHelper2$g = _context$appHelper2$g.call(_context$appHelper2)) === null || _context$appHelper2$g === void 0 ? void 0 : _context$appHelper2$g.getState();
|
|
34
34
|
var shop = (dvaStore === null || dvaStore === void 0 || (_dvaStore$core = dvaStore.core) === null || _dvaStore$core === void 0 || (_dvaStore$core = _dvaStore$core.core) === null || _dvaStore$core === void 0 ? void 0 : _dvaStore$core.shop) || {};
|
|
35
|
+
var _useState3 = useState(false),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
loading = _useState4[0],
|
|
38
|
+
setLoading = _useState4[1];
|
|
35
39
|
useEffect(function () {
|
|
36
40
|
if (detailData) {
|
|
37
41
|
setChargeItem(((detailData === null || detailData === void 0 ? void 0 : detailData.gift_option) || [])[0]);
|
|
@@ -44,6 +48,7 @@ var Recharge = function Recharge(_ref) {
|
|
|
44
48
|
while (1) switch (_context.prev = _context.next) {
|
|
45
49
|
case 0:
|
|
46
50
|
_context.prev = 0;
|
|
51
|
+
setLoading(true);
|
|
47
52
|
params = {
|
|
48
53
|
voucher_id: (detailData === null || detailData === void 0 ? void 0 : detailData.id) || '',
|
|
49
54
|
product_id: (detailData === null || detailData === void 0 ? void 0 : detailData.product_id) || '',
|
|
@@ -57,9 +62,9 @@ var Recharge = function Recharge(_ref) {
|
|
|
57
62
|
currency_format: (shop === null || shop === void 0 ? void 0 : shop.currency_format) || ''
|
|
58
63
|
}
|
|
59
64
|
};
|
|
60
|
-
_context.next =
|
|
65
|
+
_context.next = 5;
|
|
61
66
|
return orderRechargeProduct(params);
|
|
62
|
-
case
|
|
67
|
+
case 5:
|
|
63
68
|
data = _context.sent;
|
|
64
69
|
if (data !== null && data !== void 0 && data.order_id) {
|
|
65
70
|
storage === null || storage === void 0 || (_storage$set = storage.set) === null || _storage$set === void 0 || _storage$set.call(storage, 'orderId', data.order_id);
|
|
@@ -69,23 +74,28 @@ var Recharge = function Recharge(_ref) {
|
|
|
69
74
|
callback: function callback() {}
|
|
70
75
|
});
|
|
71
76
|
}
|
|
72
|
-
_context.next =
|
|
77
|
+
_context.next = 12;
|
|
73
78
|
break;
|
|
74
|
-
case
|
|
75
|
-
_context.prev =
|
|
79
|
+
case 9:
|
|
80
|
+
_context.prev = 9;
|
|
76
81
|
_context.t0 = _context["catch"](0);
|
|
77
82
|
console.error(locales.getText('wallet-pass-gallery.log.rechargeOrderFailed'), _context.t0);
|
|
78
|
-
case
|
|
83
|
+
case 12:
|
|
84
|
+
_context.prev = 12;
|
|
85
|
+
setLoading(false);
|
|
86
|
+
return _context.finish(12);
|
|
87
|
+
case 15:
|
|
79
88
|
case "end":
|
|
80
89
|
return _context.stop();
|
|
81
90
|
}
|
|
82
|
-
}, _callee, null, [[0,
|
|
91
|
+
}, _callee, null, [[0, 9, 12, 15]]);
|
|
83
92
|
}));
|
|
84
93
|
return function handleRecharge() {
|
|
85
94
|
return _ref3.apply(this, arguments);
|
|
86
95
|
};
|
|
87
96
|
}();
|
|
88
97
|
return /*#__PURE__*/React.createElement(Drawer, {
|
|
98
|
+
destroyOnClose: true,
|
|
89
99
|
title: locales.getText('wallet-pass-gallery.rechargeOptions'),
|
|
90
100
|
open: open,
|
|
91
101
|
zIndex: 999,
|
|
@@ -97,7 +107,8 @@ var Recharge = function Recharge(_ref) {
|
|
|
97
107
|
block: true,
|
|
98
108
|
size: "large",
|
|
99
109
|
onClick: handleRecharge,
|
|
100
|
-
disabled: !(chargeItem !== null && chargeItem !== void 0 && chargeItem.id)
|
|
110
|
+
disabled: !(chargeItem !== null && chargeItem !== void 0 && chargeItem.id),
|
|
111
|
+
loading: loading
|
|
101
112
|
}, locales.getText('wallet-pass-gallery.recharge'))
|
|
102
113
|
}, /*#__PURE__*/React.createElement("div", {
|
|
103
114
|
className: "pisell-wallet-pass-gallery_recharge"
|
|
@@ -552,7 +552,9 @@ var WalletPassGallery = function WalletPassGallery(props) {
|
|
|
552
552
|
},
|
|
553
553
|
block: true
|
|
554
554
|
}, locales.getText('wallet-pass-gallery.button.add'))), /*#__PURE__*/React.createElement(PisellModal, {
|
|
555
|
-
|
|
555
|
+
zIndex: 997,
|
|
556
|
+
destroyOnClose: true,
|
|
557
|
+
platform: platform,
|
|
556
558
|
visible: !!_currentItem,
|
|
557
559
|
onCancel: function onCancel() {
|
|
558
560
|
return setCurrentItemId('');
|
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
/* 默认底部内边距 */
|
|
17
17
|
padding-bottom: 24px;
|
|
18
|
+
|
|
19
|
+
// 加载状态优化
|
|
20
|
+
.pisell-lowcode-btn-loading-icon {
|
|
21
|
+
.anticon {
|
|
22
|
+
color: #ffffff !important;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
|
|
19
27
|
/* 在弹窗模式下不需要额外的底部内边距,因为使用 sticky 定位 */
|
|
20
28
|
.pisell-lowcode-modal-body & {
|
|
@@ -462,6 +470,13 @@
|
|
|
462
470
|
.login-lm-drawer-popover & {
|
|
463
471
|
padding-bottom: 100px;
|
|
464
472
|
}
|
|
473
|
+
// 加载状态优化
|
|
474
|
+
.pisell-lowcode-btn-loading-icon {
|
|
475
|
+
.anticon {
|
|
476
|
+
color: #ffffff !important;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
465
480
|
}
|
|
466
481
|
|
|
467
482
|
// 错误提示样式优化
|
|
@@ -521,14 +536,6 @@
|
|
|
521
536
|
// }
|
|
522
537
|
// }
|
|
523
538
|
// }
|
|
524
|
-
|
|
525
|
-
// 加载状态优化
|
|
526
|
-
.pisell-lowcode-btn-loading-icon {
|
|
527
|
-
.anticon {
|
|
528
|
-
color: #ffffff !important;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
|
|
532
539
|
// 切换认证方式按钮
|
|
533
540
|
.login2-switch-button {
|
|
534
541
|
margin-top: 0;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from "../model";
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
+
state: FormState;
|
|
5
|
+
} & {
|
|
6
|
+
dispatch: (params: {
|
|
7
|
+
type: string;
|
|
8
|
+
payload: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
}>;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from "../model";
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
+
state: FormState;
|
|
5
|
+
} & {
|
|
6
|
+
dispatch: (params: {
|
|
7
|
+
type: string;
|
|
8
|
+
payload: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
}>;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from '../model';
|
|
1
3
|
export declare const walkInData: {
|
|
2
4
|
id: number;
|
|
3
5
|
nickname: string;
|
|
4
6
|
};
|
|
5
|
-
export declare const Provider: any, Context:
|
|
7
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
8
|
+
state: FormState;
|
|
9
|
+
} & {
|
|
10
|
+
dispatch: (params: {
|
|
11
|
+
type: string;
|
|
12
|
+
payload: any;
|
|
13
|
+
}) => void;
|
|
14
|
+
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export interface FormState {
|
|
2
3
|
amountSymbol: string;
|
|
3
4
|
apis: {
|
|
@@ -108,4 +109,11 @@ export declare const walkInData: {
|
|
|
108
109
|
id: number;
|
|
109
110
|
nickname: string;
|
|
110
111
|
};
|
|
111
|
-
export declare const Provider: any, Context:
|
|
112
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
113
|
+
state: FormState;
|
|
114
|
+
} & {
|
|
115
|
+
dispatch: (params: {
|
|
116
|
+
type: string;
|
|
117
|
+
payload: any;
|
|
118
|
+
}) => void;
|
|
119
|
+
}>;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from "../model";
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
+
state: FormState;
|
|
5
|
+
} & {
|
|
6
|
+
dispatch: (params: {
|
|
7
|
+
type: string;
|
|
8
|
+
payload: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
}>;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from "../model";
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
+
state: FormState;
|
|
5
|
+
} & {
|
|
6
|
+
dispatch: (params: {
|
|
7
|
+
type: string;
|
|
8
|
+
payload: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
}>;
|
|
@@ -41,6 +41,7 @@ var import_const = require("../../const");
|
|
|
41
41
|
var import_const2 = require("../const");
|
|
42
42
|
var GlobalTimeout = 1e3 * 60 * 2;
|
|
43
43
|
var RequestTimeout = 1e3 * 5;
|
|
44
|
+
var QUERY_INTERVAL = 1e3 * 2;
|
|
44
45
|
var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
|
|
45
46
|
const dispatch = (0, import_store.useDispatch)();
|
|
46
47
|
const { numRef, modeRef, deviceRef, orderIdRef } = (0, import_hooks.useStoreRef)();
|
|
@@ -56,6 +57,7 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
|
|
|
56
57
|
const startTimeRef = (0, import_react.useRef)(null);
|
|
57
58
|
const isQueryFinishedRef = (0, import_react.useRef)(true);
|
|
58
59
|
const queryIdRef = (0, import_react.useRef)(null);
|
|
60
|
+
const queryIntervalTimerRef = (0, import_react.useRef)(null);
|
|
59
61
|
const _resultQuery = async () => {
|
|
60
62
|
var _a, _b;
|
|
61
63
|
if (controllerRef.current) {
|
|
@@ -107,9 +109,9 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
|
|
|
107
109
|
console.log("交易状态为0需要继续查询");
|
|
108
110
|
_log("Querying" /* Querying */, result);
|
|
109
111
|
isQueryFinishedRef.current = false;
|
|
110
|
-
setTimeout(() => {
|
|
112
|
+
queryIntervalTimerRef.current = setTimeout(() => {
|
|
111
113
|
_resultQuery();
|
|
112
|
-
},
|
|
114
|
+
}, QUERY_INTERVAL);
|
|
113
115
|
return;
|
|
114
116
|
}
|
|
115
117
|
if (data.status < 0) {
|
|
@@ -145,18 +147,18 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
|
|
|
145
147
|
_log("AbortError" /* AbortError */);
|
|
146
148
|
console.log("Error: 请求被取消,将继续查询");
|
|
147
149
|
isQueryFinishedRef.current = false;
|
|
148
|
-
setTimeout(() => {
|
|
150
|
+
queryIntervalTimerRef.current = setTimeout(() => {
|
|
149
151
|
_resultQuery();
|
|
150
|
-
},
|
|
152
|
+
}, QUERY_INTERVAL);
|
|
151
153
|
return;
|
|
152
154
|
}
|
|
153
155
|
if (!(error == null ? void 0 : error.code) || `${error.code}` === import_const.PayStatus.Timeout) {
|
|
154
156
|
_log("NetworkError" /* NetworkError */);
|
|
155
157
|
console.log("Error: 网关类报错,将继续查询");
|
|
156
158
|
isQueryFinishedRef.current = false;
|
|
157
|
-
setTimeout(() => {
|
|
159
|
+
queryIntervalTimerRef.current = setTimeout(() => {
|
|
158
160
|
_resultQuery();
|
|
159
|
-
},
|
|
161
|
+
}, QUERY_INTERVAL);
|
|
160
162
|
return;
|
|
161
163
|
}
|
|
162
164
|
_log("Error" /* Error */, error);
|
|
@@ -203,6 +205,10 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
|
|
|
203
205
|
clearTimeout(requestTimeoutIdRef.current);
|
|
204
206
|
requestTimeoutIdRef.current = null;
|
|
205
207
|
}
|
|
208
|
+
if (queryIntervalTimerRef.current) {
|
|
209
|
+
clearTimeout(queryIntervalTimerRef.current);
|
|
210
|
+
queryIntervalTimerRef.current = null;
|
|
211
|
+
}
|
|
206
212
|
if (controllerRef.current) {
|
|
207
213
|
controllerRef.current.abort();
|
|
208
214
|
controllerRef.current = null;
|
|
@@ -42,6 +42,7 @@ var import_helper = require("../helper");
|
|
|
42
42
|
var import_hooks = require("../hooks");
|
|
43
43
|
var import_store = require("../store");
|
|
44
44
|
var import_hooks2 = require("./hooks");
|
|
45
|
+
var import_payment = require("./payment");
|
|
45
46
|
var POS = ({
|
|
46
47
|
api,
|
|
47
48
|
onChange
|
|
@@ -68,6 +69,13 @@ var POS = ({
|
|
|
68
69
|
const initRef = (0, import_react.useRef)(false);
|
|
69
70
|
const unloadRef = (0, import_react.useRef)(false);
|
|
70
71
|
const [check] = (0, import_hooks2.useValidate)(1e3 * 60);
|
|
72
|
+
const { run: paymentRun, clean: paymentClean } = (0, import_payment.usePayment)({
|
|
73
|
+
payApi: api.pay,
|
|
74
|
+
checkApi: api.check,
|
|
75
|
+
shouldContinue: () => {
|
|
76
|
+
return !(unloadRef.current || !netRef.current);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
71
79
|
(0, import_react.useEffect)(() => {
|
|
72
80
|
failRef.current = fail;
|
|
73
81
|
}, [fail]);
|
|
@@ -126,7 +134,7 @@ var POS = ({
|
|
|
126
134
|
);
|
|
127
135
|
};
|
|
128
136
|
(0, import_react.useEffect)(() => {
|
|
129
|
-
var _a, _b;
|
|
137
|
+
var _a, _b, _c;
|
|
130
138
|
if (statusRef.current === import_const.StatusEnum.Success || statusRef.current === import_const.StatusEnum.Fail) {
|
|
131
139
|
return;
|
|
132
140
|
}
|
|
@@ -145,82 +153,98 @@ var POS = ({
|
|
|
145
153
|
})
|
|
146
154
|
);
|
|
147
155
|
controllerRef.current = new AbortController();
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
)
|
|
156
|
+
const isPay = modeRef.current === import_const.ModeEnum.Pay || modeRef.current === import_const.ModeEnum.FullPay;
|
|
157
|
+
const apiParams = isPay ? {
|
|
158
|
+
...(custom == null ? void 0 : custom.platform) ? {
|
|
159
|
+
operator_id: custom.operator_id,
|
|
160
|
+
operator_type: custom.operator_type,
|
|
161
|
+
platform: custom.platform,
|
|
162
|
+
custom_payment_id: custom.custom_payment_id
|
|
163
|
+
} : {},
|
|
164
|
+
original_amount: payRef.current.amount,
|
|
165
|
+
service_charge: {
|
|
166
|
+
amount: payRef.current.surMoney,
|
|
167
|
+
percentage: payRef.current.surPercentRate
|
|
168
|
+
},
|
|
169
|
+
order_id: orderIdRef.current,
|
|
170
|
+
amount: payRef.current.total,
|
|
171
|
+
card_reader_type: eftposRef.current,
|
|
172
|
+
card_reader_id: (_a = deviceRef.current) == null ? void 0 : _a.id,
|
|
173
|
+
number: numRef.current,
|
|
174
|
+
pay_param_base64: encodeURIComponent(
|
|
175
|
+
btoa(
|
|
176
|
+
encodeURIComponent(
|
|
177
|
+
JSON.stringify({
|
|
178
|
+
...dataRef.current,
|
|
179
|
+
number: numRef.current
|
|
180
|
+
})
|
|
174
181
|
)
|
|
175
182
|
)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
number: numRef.current
|
|
191
|
-
})
|
|
192
|
-
)
|
|
183
|
+
)
|
|
184
|
+
} : {
|
|
185
|
+
order_id: orderIdRef.current,
|
|
186
|
+
amount: amountRef.current,
|
|
187
|
+
card_reader_type: eftposRef.current,
|
|
188
|
+
card_reader_id: (_b = deviceRef.current) == null ? void 0 : _b.id,
|
|
189
|
+
number: numRef.current,
|
|
190
|
+
pay_param_base64: encodeURIComponent(
|
|
191
|
+
btoa(
|
|
192
|
+
encodeURIComponent(
|
|
193
|
+
JSON.stringify({
|
|
194
|
+
...dataRef.current,
|
|
195
|
+
number: numRef.current
|
|
196
|
+
})
|
|
193
197
|
)
|
|
194
198
|
)
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
)
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
199
|
+
)
|
|
200
|
+
};
|
|
201
|
+
if (isPay) {
|
|
202
|
+
paymentRun({
|
|
203
|
+
paymentType: import_payment.ActionType.Pay,
|
|
204
|
+
paymentNum: numRef.current,
|
|
205
|
+
orderId: orderIdRef.current,
|
|
206
|
+
deviceId: (_c = deviceRef.current) == null ? void 0 : _c.id,
|
|
207
|
+
params: apiParams,
|
|
208
|
+
callbacks: {
|
|
209
|
+
onSuccess: (res) => {
|
|
210
|
+
success(res);
|
|
211
|
+
},
|
|
212
|
+
onError: (err) => {
|
|
213
|
+
console.log("err = >>>>>", err);
|
|
214
|
+
failRef.current(err, true);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
return;
|
|
219
|
+
} else {
|
|
220
|
+
const resultPromise = api.refund(apiParams, { signal: controllerRef.current.signal });
|
|
221
|
+
resultPromise.then((res) => {
|
|
222
|
+
console.log("netRef.current111 = ", netRef.current);
|
|
223
|
+
if (unloadRef.current || !netRef.current) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (res && `${res.code}` === "200") {
|
|
227
|
+
success(res);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
return Promise.reject(res);
|
|
231
|
+
}).catch((err) => {
|
|
232
|
+
console.log(
|
|
233
|
+
"netRef.current222 = ",
|
|
234
|
+
netRef.current,
|
|
235
|
+
unloadRef.current,
|
|
236
|
+
err
|
|
237
|
+
);
|
|
238
|
+
if (unloadRef.current || !netRef.current) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (!(err == null ? void 0 : err.code) || `${err.code}` === import_const.PayStatus.Timeout) {
|
|
242
|
+
checkApi();
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
failRef.current(err, true);
|
|
246
|
+
});
|
|
247
|
+
}
|
|
224
248
|
}, [api, check, dispatch, onChange]);
|
|
225
249
|
(0, import_react.useEffect)(
|
|
226
250
|
() => () => {
|
|
@@ -230,6 +254,7 @@ var POS = ({
|
|
|
230
254
|
if (clearRef.current) {
|
|
231
255
|
clearTimeout(clearRef.current);
|
|
232
256
|
}
|
|
257
|
+
paymentClean();
|
|
233
258
|
},
|
|
234
259
|
[]
|
|
235
260
|
);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
interface RunApiParams {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}
|
|
4
|
+
export declare enum ActionType {
|
|
5
|
+
Pay = "pay",
|
|
6
|
+
Refund = "refund",
|
|
7
|
+
Query = "query"
|
|
8
|
+
}
|
|
9
|
+
interface UsePaymentOptions {
|
|
10
|
+
/**
|
|
11
|
+
* 支付接口
|
|
12
|
+
*/
|
|
13
|
+
payApi: (params: RunApiParams, options?: {
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
}) => Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* 退款接口
|
|
18
|
+
*/
|
|
19
|
+
refundApi?: (params: RunApiParams, options?: {
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
}) => Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* 查询接口
|
|
24
|
+
*/
|
|
25
|
+
checkApi: (params: {
|
|
26
|
+
number: string;
|
|
27
|
+
}, options?: {
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
}) => Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* 检查是否应该继续处理结果(用于处理网络断开、组件卸载等情况)
|
|
32
|
+
*/
|
|
33
|
+
shouldContinue?: () => boolean;
|
|
34
|
+
}
|
|
35
|
+
interface RunParams {
|
|
36
|
+
/** 支付类型 */
|
|
37
|
+
paymentType: ActionType;
|
|
38
|
+
/** 支付交易号 */
|
|
39
|
+
paymentNum: string;
|
|
40
|
+
/** 订单ID */
|
|
41
|
+
orderId?: string | number;
|
|
42
|
+
/** 设备ID */
|
|
43
|
+
deviceId?: string | number;
|
|
44
|
+
/** 支付参数 */
|
|
45
|
+
params: RunApiParams;
|
|
46
|
+
/** 回调方法 */
|
|
47
|
+
callbacks: RunCallbacks;
|
|
48
|
+
}
|
|
49
|
+
interface RunCallbacks {
|
|
50
|
+
/**
|
|
51
|
+
* 成功回调
|
|
52
|
+
*/
|
|
53
|
+
onSuccess: (res: any) => void;
|
|
54
|
+
/**
|
|
55
|
+
* 失败回调
|
|
56
|
+
*/
|
|
57
|
+
onError: (error: any) => void;
|
|
58
|
+
}
|
|
59
|
+
export declare const usePayment: (options: UsePaymentOptions) => {
|
|
60
|
+
run: (options: RunParams) => Promise<void>;
|
|
61
|
+
stop: () => void;
|
|
62
|
+
clean: (params?: {
|
|
63
|
+
clearCallbacks?: boolean;
|
|
64
|
+
}) => void;
|
|
65
|
+
};
|
|
66
|
+
export {};
|