@pisell/private-materials 3.0.206 → 3.0.207
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +8 -8
- package/es/components/booking/forms/model.d.ts +1 -1
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +1 -1
- package/es/components/booking/payments/model.d.ts +1 -1
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/app.d.ts +11 -0
- package/es/components/eftposPay/app.js +173 -0
- package/es/components/eftposPay/component/fail/failCustom.js +1 -0
- package/es/components/eftposPay/component/fail/index.js +1 -0
- package/es/components/eftposPay/component/manual/index.js +4 -1
- package/es/components/eftposPay/const.d.ts +27 -1
- package/es/components/eftposPay/const.js +22 -0
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/device.js +2 -2
- package/es/components/eftposPay/helper.d.ts +5 -0
- package/es/components/eftposPay/helper.js +10 -4
- package/es/components/eftposPay/hooks.d.ts +2 -1
- package/es/components/eftposPay/hooks.js +22 -16
- package/es/components/eftposPay/index.d.ts +1 -1
- package/es/components/eftposPay/index.js +130 -179
- package/es/components/eftposPay/locales.d.ts +15 -0
- package/es/components/eftposPay/locales.js +15 -0
- package/es/components/eftposPay/payo/config.js +20 -8
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eftposPay/tip.d.ts +10 -0
- package/es/components/eftposPay/tip.js +177 -0
- package/es/components/eftposPay/tip.less +9 -0
- package/es/components/eftposPay/tyro/index.js +4 -2
- package/es/components/eftposPay/windcave/windcave.js +17 -6
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -1
- package/lib/components/booking/forms/model.d.ts +1 -1
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +1 -1
- package/lib/components/booking/payments/model.d.ts +1 -1
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/app.d.ts +11 -0
- package/lib/components/eftposPay/app.js +166 -0
- package/lib/components/eftposPay/component/fail/failCustom.js +1 -1
- package/lib/components/eftposPay/component/fail/index.js +1 -1
- package/lib/components/eftposPay/component/manual/index.js +19 -5
- package/lib/components/eftposPay/const.d.ts +27 -1
- package/lib/components/eftposPay/const.js +18 -0
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/device.js +2 -2
- package/lib/components/eftposPay/helper.d.ts +5 -0
- package/lib/components/eftposPay/helper.js +8 -4
- package/lib/components/eftposPay/hooks.d.ts +2 -1
- package/lib/components/eftposPay/hooks.js +8 -2
- package/lib/components/eftposPay/index.d.ts +1 -1
- package/lib/components/eftposPay/index.js +106 -144
- package/lib/components/eftposPay/locales.d.ts +15 -0
- package/lib/components/eftposPay/locales.js +15 -0
- package/lib/components/eftposPay/payo/config.js +33 -9
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eftposPay/tip.d.ts +10 -0
- package/lib/components/eftposPay/tip.js +159 -0
- package/lib/components/eftposPay/tip.less +9 -0
- package/lib/components/eftposPay/tyro/index.js +4 -2
- package/lib/components/eftposPay/windcave/windcave.js +29 -6
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
/* eslint-disable no-nested-ternary */
|
|
14
|
+
import { locales } from '@pisell/utils';
|
|
15
|
+
import { Button } from 'antd';
|
|
16
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
17
|
+
import { getPayParams } from "./helper";
|
|
18
|
+
import { RestoreEumn, EftposEnum } from "./const";
|
|
19
|
+
import dayjs from 'dayjs';
|
|
20
|
+
import { useDispatch, useContextData, updateState, updateCustom, updateNextStep } from "./store";
|
|
21
|
+
import { useStoreRef } from "./hooks";
|
|
22
|
+
import "./tip.less";
|
|
23
|
+
function formatDateUtils(date, format) {
|
|
24
|
+
if (!date) {
|
|
25
|
+
return date;
|
|
26
|
+
}
|
|
27
|
+
if (date.includes('undefined')) {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
var lang = localStorage.getItem('umi_locale') || 'en-US';
|
|
31
|
+
var _format = format || ['HH:mm:ss DD/MM/YYYY', 'YYYY年MM月DD日 HH:mm:ss'];
|
|
32
|
+
var type = lang === 'en-US' || lang === 'en' ? _format[0] : _format[1];
|
|
33
|
+
return dayjs(date).locale(lang).format(type);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @title: 支付状态未知页面
|
|
38
|
+
* @description:
|
|
39
|
+
* @Author: hongbing.wang
|
|
40
|
+
* @Date: 2024-08-20 11:42
|
|
41
|
+
*/
|
|
42
|
+
export default (function (_ref) {
|
|
43
|
+
var onChangeStatus = _ref.onChangeStatus,
|
|
44
|
+
_ref$className = _ref.className,
|
|
45
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
46
|
+
formatAmount = _ref.formatAmount,
|
|
47
|
+
cardSurcharge = _ref.cardSurcharge,
|
|
48
|
+
receipts = _ref.receipts,
|
|
49
|
+
successTime = _ref.successTime,
|
|
50
|
+
onChangeParams = _ref.onChangeParams;
|
|
51
|
+
var _useState = useState(true),
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
disabled = _useState2[0],
|
|
54
|
+
setDisabled = _useState2[1];
|
|
55
|
+
var _useState3 = useState(''),
|
|
56
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
57
|
+
amount = _useState4[0],
|
|
58
|
+
setAmount = _useState4[1];
|
|
59
|
+
var _useState5 = useState(''),
|
|
60
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
61
|
+
surcharge = _useState6[0],
|
|
62
|
+
setSurcharge = _useState6[1];
|
|
63
|
+
var _useState7 = useState(''),
|
|
64
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
65
|
+
surMoney = _useState8[0],
|
|
66
|
+
setSurMoney = _useState8[1];
|
|
67
|
+
var _useState9 = useState(''),
|
|
68
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
69
|
+
rate = _useState10[0],
|
|
70
|
+
setRate = _useState10[1];
|
|
71
|
+
var _useState11 = useState(''),
|
|
72
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
73
|
+
total = _useState12[0],
|
|
74
|
+
setTotal = _useState12[1];
|
|
75
|
+
var _useState13 = useState(''),
|
|
76
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
77
|
+
time = _useState14[0],
|
|
78
|
+
setTime = _useState14[1];
|
|
79
|
+
var data = useContextData();
|
|
80
|
+
var symbol = data.symbol,
|
|
81
|
+
custom = data.custom;
|
|
82
|
+
var ref = useRef();
|
|
83
|
+
var dispatch = useDispatch();
|
|
84
|
+
var listRef = useRef(custom === null || custom === void 0 ? void 0 : custom.list);
|
|
85
|
+
var _useStoreRef = useStoreRef(),
|
|
86
|
+
deviceRef = _useStoreRef.deviceRef,
|
|
87
|
+
payRef = _useStoreRef.payRef,
|
|
88
|
+
numRef = _useStoreRef.numRef,
|
|
89
|
+
orderIdRef = _useStoreRef.orderIdRef,
|
|
90
|
+
modeRef = _useStoreRef.modeRef,
|
|
91
|
+
amountRef = _useStoreRef.amountRef,
|
|
92
|
+
eftposRef = _useStoreRef.eftposRef;
|
|
93
|
+
var onConfirm = function onConfirm() {
|
|
94
|
+
onChangeStatus('success', _objectSpread({}, ref.current || {}));
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @title: 手动标记
|
|
99
|
+
* @description: 前往手动标记
|
|
100
|
+
* @Author: hongbing.wang
|
|
101
|
+
* @Date: 2024-08-20 11:31
|
|
102
|
+
*/
|
|
103
|
+
useEffect(function () {
|
|
104
|
+
// 将所有步骤状态设为完成 resolve
|
|
105
|
+
if (eftposRef.current === EftposEnum.Payo) {
|
|
106
|
+
dispatch(updateNextStep());
|
|
107
|
+
dispatch(updateCustom({
|
|
108
|
+
card_reader_surcharge: cardSurcharge || 0,
|
|
109
|
+
receipt: receipts
|
|
110
|
+
}));
|
|
111
|
+
} else if (eftposRef.current === EftposEnum.Windcave) {
|
|
112
|
+
dispatch(updateCustom({
|
|
113
|
+
list: listRef.current.map(function (item) {
|
|
114
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
115
|
+
status: 'resolve'
|
|
116
|
+
});
|
|
117
|
+
}),
|
|
118
|
+
card_reader_surcharge: cardSurcharge || 0,
|
|
119
|
+
receipt: receipts
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
var params = getPayParams({
|
|
123
|
+
mode: modeRef.current,
|
|
124
|
+
amount: amountRef.current,
|
|
125
|
+
order_id: orderIdRef.current,
|
|
126
|
+
number: numRef.current,
|
|
127
|
+
device: deviceRef.current,
|
|
128
|
+
pay: payRef.current,
|
|
129
|
+
custom: {
|
|
130
|
+
card_reader_surcharge: cardSurcharge,
|
|
131
|
+
receipt: receipts
|
|
132
|
+
}
|
|
133
|
+
}, 'success');
|
|
134
|
+
ref.current = params;
|
|
135
|
+
setAmount("".concat((params === null || params === void 0 ? void 0 : params.amount) || ''));
|
|
136
|
+
setSurcharge("".concat((params === null || params === void 0 ? void 0 : params.surcharge) || ''));
|
|
137
|
+
setSurMoney("".concat((params === null || params === void 0 ? void 0 : params.surMoney) || ''));
|
|
138
|
+
setRate("".concat((params === null || params === void 0 ? void 0 : params.surRate) || ''));
|
|
139
|
+
setTotal("".concat((params === null || params === void 0 ? void 0 : params.total) || ''));
|
|
140
|
+
setTime(formatDateUtils(successTime));
|
|
141
|
+
setDisabled(false);
|
|
142
|
+
|
|
143
|
+
// 更新支付状态与文案
|
|
144
|
+
dispatch(updateState({
|
|
145
|
+
status: 'success',
|
|
146
|
+
title: locales.getText('page.eftpos-pay.text.successful')(modeRef.current)
|
|
147
|
+
}));
|
|
148
|
+
}, []);
|
|
149
|
+
useEffect(function () {
|
|
150
|
+
onChangeParams && onChangeParams(_objectSpread(_objectSpread({}, data), {}, {
|
|
151
|
+
form: RestoreEumn.Restore
|
|
152
|
+
}));
|
|
153
|
+
}, [data, onChangeParams]);
|
|
154
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
155
|
+
className: "pisell-lowcode__eft-pay-box ".concat(className)
|
|
156
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
className: "pisell-lowcode__eft-pay-fail-title"
|
|
158
|
+
}, locales.getText('page.eftpos-pay.text.latest.success')), /*#__PURE__*/React.createElement("div", {
|
|
159
|
+
className: "pisell-lowcode__eft-pay-body pisell-lowcode__eft-pay-tip-body"
|
|
160
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
161
|
+
className: "pisell-lowcode__eft-pay-tip-text"
|
|
162
|
+
}, locales.getText('page.eftpos-pay.text.latest.amount'), ":", ' ', formatAmount("".concat(amount), 2, symbol)), /*#__PURE__*/React.createElement("div", {
|
|
163
|
+
className: "pisell-lowcode__eft-pay-tip-text"
|
|
164
|
+
}, locales.getText('page.eftpos-pay.text.latest.surcharge'), ":", ' ', formatAmount("".concat(surcharge), 2, symbol), " (", rate, "% +", ' ', formatAmount("".concat(surMoney), 2, symbol), ")"), /*#__PURE__*/React.createElement("div", {
|
|
165
|
+
className: "pisell-lowcode__eft-pay-tip-text"
|
|
166
|
+
}, locales.getText('page.eftpos-pay.text.surcharge.edit.actual.pay'), ":", ' ', formatAmount("".concat(total), 2, symbol)), /*#__PURE__*/React.createElement("div", {
|
|
167
|
+
className: "pisell-lowcode__eft-pay-tip-text"
|
|
168
|
+
}, locales.getText('page.eftpos-pay.text.latest.time'), ": ", time)), /*#__PURE__*/React.createElement("div", {
|
|
169
|
+
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
170
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
171
|
+
disabled: disabled,
|
|
172
|
+
block: true,
|
|
173
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
174
|
+
type: "primary",
|
|
175
|
+
onClick: onConfirm
|
|
176
|
+
}, locales.getText('page.eftpos-pay.text.latest.confirm'))));
|
|
177
|
+
});
|
|
@@ -440,7 +440,8 @@ export default (function (_ref) {
|
|
|
440
440
|
subTitle: ''
|
|
441
441
|
}));
|
|
442
442
|
dispatch(updateCustom({
|
|
443
|
-
card_reader_surcharge: response.surchargeAmount || 0
|
|
443
|
+
card_reader_surcharge: response.surchargeAmount || 0,
|
|
444
|
+
receipt: receipt
|
|
444
445
|
}));
|
|
445
446
|
clearRef.current = setTimeout(function () {
|
|
446
447
|
var params = getPayParams({
|
|
@@ -451,7 +452,8 @@ export default (function (_ref) {
|
|
|
451
452
|
device: deviceRef.current,
|
|
452
453
|
pay: payRef.current,
|
|
453
454
|
custom: {
|
|
454
|
-
card_reader_surcharge: response.surchargeAmount || 0
|
|
455
|
+
card_reader_surcharge: response.surchargeAmount || 0,
|
|
456
|
+
receipt: receipt
|
|
455
457
|
}
|
|
456
458
|
}, 'success');
|
|
457
459
|
onChange('success', _objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -51,7 +51,7 @@ export default (function (_ref) {
|
|
|
51
51
|
symbolRef = _useStoreRef.symbolRef,
|
|
52
52
|
amountRef = _useStoreRef.amountRef,
|
|
53
53
|
eftposRef = _useStoreRef.eftposRef,
|
|
54
|
-
|
|
54
|
+
dataRef = _useStoreRef.dataRef;
|
|
55
55
|
var dispatch = useDispatch();
|
|
56
56
|
var fail = useFail();
|
|
57
57
|
var failRef = useRef(fail);
|
|
@@ -92,6 +92,10 @@ export default (function (_ref) {
|
|
|
92
92
|
* @Date: 2024-08-12 11:02
|
|
93
93
|
*/
|
|
94
94
|
var _useValidate = useValidate(api.check, Minute, function (res) {
|
|
95
|
+
var receipt = Array.isArray(res === null || res === void 0 ? void 0 : res.receipt) ? res.receipt : [res.receipt];
|
|
96
|
+
receipt = receipt.filter(function (item) {
|
|
97
|
+
return typeof item === 'string';
|
|
98
|
+
}).filter(Boolean);
|
|
95
99
|
// 将所有步骤状态设为完成 resolve
|
|
96
100
|
dispatch(updateCustom({
|
|
97
101
|
list: listRef.current.map(function (item) {
|
|
@@ -99,7 +103,8 @@ export default (function (_ref) {
|
|
|
99
103
|
status: 'resolve'
|
|
100
104
|
});
|
|
101
105
|
}),
|
|
102
|
-
card_reader_surcharge: (res === null || res === void 0 ? void 0 : res.card_reader_surcharge) || 0
|
|
106
|
+
card_reader_surcharge: (res === null || res === void 0 ? void 0 : res.card_reader_surcharge) || 0,
|
|
107
|
+
receipt: receipt
|
|
103
108
|
}));
|
|
104
109
|
|
|
105
110
|
// 更新支付状态与文案
|
|
@@ -117,10 +122,10 @@ export default (function (_ref) {
|
|
|
117
122
|
device: deviceRef.current,
|
|
118
123
|
pay: payRef.current,
|
|
119
124
|
custom: {
|
|
120
|
-
card_reader_surcharge: (res === null || res === void 0 ? void 0 : res.card_reader_surcharge) || 0
|
|
125
|
+
card_reader_surcharge: (res === null || res === void 0 ? void 0 : res.card_reader_surcharge) || 0,
|
|
126
|
+
receipt: receipt
|
|
121
127
|
}
|
|
122
128
|
}, 'success');
|
|
123
|
-
var receipt = Array.isArray(res.receipt) ? res.receipt : [res.receipt];
|
|
124
129
|
onChange('success', _objectSpread(_objectSpread({}, params), {}, {
|
|
125
130
|
receipt: (_deviceRef$current = deviceRef.current) !== null && _deviceRef$current !== void 0 && (_deviceRef$current$se = _deviceRef$current.setting) !== null && _deviceRef$current$se !== void 0 && _deviceRef$current$se.receipts ? [] : receipt
|
|
126
131
|
}));
|
|
@@ -170,7 +175,10 @@ export default (function (_ref) {
|
|
|
170
175
|
amount: payRef.current.total,
|
|
171
176
|
card_reader_type: eftposRef.current,
|
|
172
177
|
card_reader_id: (_deviceRef$current2 = deviceRef.current) === null || _deviceRef$current2 === void 0 ? void 0 : _deviceRef$current2.id,
|
|
173
|
-
number: numRef.current
|
|
178
|
+
number: numRef.current,
|
|
179
|
+
pay_param_base64: encodeURIComponent(btoa(encodeURIComponent(JSON.stringify(_objectSpread(_objectSpread({}, dataRef.current), {}, {
|
|
180
|
+
number: numRef.current
|
|
181
|
+
})))))
|
|
174
182
|
}, {
|
|
175
183
|
signal: controllerRef.current.signal
|
|
176
184
|
}) : api.refund({
|
|
@@ -178,7 +186,10 @@ export default (function (_ref) {
|
|
|
178
186
|
amount: amountRef.current,
|
|
179
187
|
card_reader_type: eftposRef.current,
|
|
180
188
|
card_reader_id: (_deviceRef$current3 = deviceRef.current) === null || _deviceRef$current3 === void 0 ? void 0 : _deviceRef$current3.id,
|
|
181
|
-
number: numRef.current
|
|
189
|
+
number: numRef.current,
|
|
190
|
+
pay_param_base64: encodeURIComponent(btoa(encodeURIComponent(JSON.stringify(_objectSpread(_objectSpread({}, dataRef.current), {}, {
|
|
191
|
+
number: numRef.current
|
|
192
|
+
})))))
|
|
182
193
|
}, {
|
|
183
194
|
signal: controllerRef.current.signal
|
|
184
195
|
});
|
|
@@ -69,7 +69,7 @@ export interface FormState {
|
|
|
69
69
|
};
|
|
70
70
|
setGlobalState: Function | null;
|
|
71
71
|
}
|
|
72
|
-
export declare const Provider: (ComponentUi: any) =>
|
|
72
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
73
73
|
state: FormState;
|
|
74
74
|
} & {
|
|
75
75
|
dispatch: (params: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) =>
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
4
|
state: FormState;
|
|
5
5
|
} & {
|
|
6
6
|
dispatch: (params: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) =>
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
4
|
state: FormState;
|
|
5
5
|
} & {
|
|
6
6
|
dispatch: (params: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) =>
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
4
|
state: FormState;
|
|
5
5
|
} & {
|
|
6
6
|
dispatch: (params: {
|
|
@@ -9,7 +9,7 @@ import { PosProps } from './const';
|
|
|
9
9
|
*/
|
|
10
10
|
declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
|
|
11
11
|
className?: string | undefined;
|
|
12
|
-
onChange?: ((status: "page" | "success" | "
|
|
12
|
+
onChange?: ((status: "page" | "success" | "fail", params?: string | {
|
|
13
13
|
[keys: string]: unknown;
|
|
14
14
|
} | undefined, other?: any) => void) | undefined;
|
|
15
15
|
onClose: () => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PosProps, RouteType } from './const';
|
|
3
|
+
declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "mode" | "type" | "getApi"> & {
|
|
4
|
+
action: RouteType;
|
|
5
|
+
device_number: string | number;
|
|
6
|
+
api: ReturnType<PosProps['getApi']>;
|
|
7
|
+
isMobile: boolean;
|
|
8
|
+
channel?: string | undefined;
|
|
9
|
+
formatAmount(amount: number | string, precision: number, symbol: string): string;
|
|
10
|
+
}) => React.JSX.Element;
|
|
11
|
+
export default App;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/eftposPay/app.tsx
|
|
30
|
+
var app_exports = {};
|
|
31
|
+
__export(app_exports, {
|
|
32
|
+
default: () => app_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(app_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_ahooks = require("ahooks");
|
|
37
|
+
var import_amount = __toESM(require("./amount"));
|
|
38
|
+
var import_const = require("./const");
|
|
39
|
+
var import_device = __toESM(require("./device"));
|
|
40
|
+
var import_pay = __toESM(require("./pay"));
|
|
41
|
+
var import_store = require("./store");
|
|
42
|
+
var App = ({
|
|
43
|
+
action,
|
|
44
|
+
api,
|
|
45
|
+
device_number,
|
|
46
|
+
terminal,
|
|
47
|
+
tyroUrl,
|
|
48
|
+
tyroVersion,
|
|
49
|
+
onChangeParams,
|
|
50
|
+
isMobile,
|
|
51
|
+
channel,
|
|
52
|
+
formatAmount = (number, precision, symbol) => `${symbol}${number}`,
|
|
53
|
+
...props
|
|
54
|
+
}) => {
|
|
55
|
+
const data = (0, import_store.useContextData)();
|
|
56
|
+
const dispatch = (0, import_store.useDispatch)();
|
|
57
|
+
const [current, setCurrent] = (0, import_react.useState)(action);
|
|
58
|
+
const statusRef = (0, import_react.useRef)(data.status);
|
|
59
|
+
const network = (0, import_react.useMemo)(
|
|
60
|
+
() => typeof terminal.network === "boolean" ? terminal.network : true,
|
|
61
|
+
[terminal == null ? void 0 : terminal.network]
|
|
62
|
+
);
|
|
63
|
+
const { online } = (0, import_ahooks.useNetwork)();
|
|
64
|
+
const netRef = (0, import_react.useRef)([network, online]);
|
|
65
|
+
const net = (0, import_react.useMemo)(() => {
|
|
66
|
+
let networkChange = false, onlineChange = false;
|
|
67
|
+
if (netRef.current[0] !== network) {
|
|
68
|
+
netRef.current[0] = network;
|
|
69
|
+
networkChange = true;
|
|
70
|
+
}
|
|
71
|
+
if (netRef.current[1] !== online) {
|
|
72
|
+
netRef.current[1] = online;
|
|
73
|
+
onlineChange = true;
|
|
74
|
+
}
|
|
75
|
+
if (networkChange) {
|
|
76
|
+
return network;
|
|
77
|
+
}
|
|
78
|
+
return online;
|
|
79
|
+
}, [network, online]);
|
|
80
|
+
(0, import_react.useEffect)(() => {
|
|
81
|
+
statusRef.current = data.status;
|
|
82
|
+
}, [data.status]);
|
|
83
|
+
const client = (0, import_react.useMemo)(() => {
|
|
84
|
+
if (channel === "kiosk") {
|
|
85
|
+
return import_const.ClientEnum.User;
|
|
86
|
+
}
|
|
87
|
+
return import_const.ClientEnum.Merchant;
|
|
88
|
+
}, [channel]);
|
|
89
|
+
(0, import_react.useEffect)(() => {
|
|
90
|
+
dispatch((0, import_store.updateClient)(client));
|
|
91
|
+
}, [client]);
|
|
92
|
+
(0, import_react.useEffect)(() => {
|
|
93
|
+
onChangeParams && onChangeParams({
|
|
94
|
+
...data,
|
|
95
|
+
...data.eftpos === "tyro" ? { custom: { ...data.custom, btnList: [], list: [] } } : {},
|
|
96
|
+
form: import_const.RestoreEumn.Restore
|
|
97
|
+
});
|
|
98
|
+
}, [data, onChangeParams]);
|
|
99
|
+
const onChange = (0, import_react.useCallback)(
|
|
100
|
+
(status, params, other) => {
|
|
101
|
+
if (status === "page" && typeof params === "string") {
|
|
102
|
+
if (["amount", "deviceList", "pay"].includes(params)) {
|
|
103
|
+
setCurrent(params);
|
|
104
|
+
dispatch((0, import_store.updateState)({ action: params }));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
console.log("状态切换 = ", status, params, other);
|
|
108
|
+
props.onChangeStatus(status, params, other);
|
|
109
|
+
},
|
|
110
|
+
[]
|
|
111
|
+
);
|
|
112
|
+
const onClose = () => {
|
|
113
|
+
onChange("fail", {
|
|
114
|
+
number: data.number,
|
|
115
|
+
uniquePaymentNumber: data.number,
|
|
116
|
+
device: data.device,
|
|
117
|
+
order_id: data.order_id
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
if (current === import_const.RouteEnum.DeviceList) {
|
|
121
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
122
|
+
import_device.default,
|
|
123
|
+
{
|
|
124
|
+
api,
|
|
125
|
+
onChange,
|
|
126
|
+
onClose,
|
|
127
|
+
isMobile,
|
|
128
|
+
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
|
|
129
|
+
net,
|
|
130
|
+
device_number,
|
|
131
|
+
formatAmount,
|
|
132
|
+
client
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
if (current === import_const.RouteEnum.Amount) {
|
|
137
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
138
|
+
import_amount.default,
|
|
139
|
+
{
|
|
140
|
+
onChange,
|
|
141
|
+
onClose,
|
|
142
|
+
formatAmount,
|
|
143
|
+
isMobile,
|
|
144
|
+
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
|
|
145
|
+
net,
|
|
146
|
+
client
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
151
|
+
import_pay.default,
|
|
152
|
+
{
|
|
153
|
+
api,
|
|
154
|
+
tyroUrl,
|
|
155
|
+
tyroVersion,
|
|
156
|
+
onChange,
|
|
157
|
+
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
|
|
158
|
+
terminal,
|
|
159
|
+
isMobile,
|
|
160
|
+
net,
|
|
161
|
+
formatAmount,
|
|
162
|
+
client
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
var app_default = App;
|
|
@@ -101,7 +101,7 @@ var failCustom_default = ({ className = "", isMobile, onChange }) => {
|
|
|
101
101
|
onChange("print", [], "print_on_timeout");
|
|
102
102
|
};
|
|
103
103
|
const onClose = () => {
|
|
104
|
-
onChange("fail", { number, device, order_id });
|
|
104
|
+
onChange("fail", { number, uniquePaymentNumber: number, device, order_id });
|
|
105
105
|
};
|
|
106
106
|
(0, import_ahooks.useMount)(() => {
|
|
107
107
|
if ((failCustom == null ? void 0 : failCustom.status) === "fail") {
|
|
@@ -107,7 +107,7 @@ var fail_default = ({ onChange, className = "", isMobile }) => {
|
|
|
107
107
|
onChange("print", [], "print_on_timeout");
|
|
108
108
|
};
|
|
109
109
|
const onClose = () => {
|
|
110
|
-
onChange("fail", { number, device, order_id });
|
|
110
|
+
onChange("fail", { number, uniquePaymentNumber: number, device, order_id });
|
|
111
111
|
};
|
|
112
112
|
(0, import_ahooks.useMount)(() => {
|
|
113
113
|
if (steps[step].status === "fail") {
|
|
@@ -67,6 +67,7 @@ var manual_default = ({ onChange, className = "", formatAmount }) => {
|
|
|
67
67
|
amount,
|
|
68
68
|
total: amount,
|
|
69
69
|
number,
|
|
70
|
+
uniquePaymentNumber: number,
|
|
70
71
|
device,
|
|
71
72
|
order_id
|
|
72
73
|
});
|
|
@@ -80,7 +81,7 @@ var manual_default = ({ onChange, className = "", formatAmount }) => {
|
|
|
80
81
|
return;
|
|
81
82
|
}
|
|
82
83
|
setDisabled(true);
|
|
83
|
-
onChange("fail", { number, device, order_id });
|
|
84
|
+
onChange("fail", { number, uniquePaymentNumber: number, device, order_id });
|
|
84
85
|
};
|
|
85
86
|
const onSubmit = () => {
|
|
86
87
|
if (disabled) {
|
|
@@ -110,8 +111,13 @@ var manual_default = ({ onChange, className = "", formatAmount }) => {
|
|
|
110
111
|
surMoney: surMoneyDeci.toFixed(2, import_decimal.Decimal.ROUND_HALF_UP),
|
|
111
112
|
surcharge: surchargeDeci.toFixed(2, import_decimal.Decimal.ROUND_HALF_UP),
|
|
112
113
|
total: moneyDeci.toFixed(2, import_decimal.Decimal.ROUND_HALF_UP),
|
|
113
|
-
totalUnit: formatAmount(
|
|
114
|
+
totalUnit: formatAmount(
|
|
115
|
+
moneyDeci.toFixed(2, import_decimal.Decimal.ROUND_HALF_UP),
|
|
116
|
+
2,
|
|
117
|
+
symbol
|
|
118
|
+
),
|
|
114
119
|
number,
|
|
120
|
+
uniquePaymentNumber: number,
|
|
115
121
|
device,
|
|
116
122
|
order_id
|
|
117
123
|
});
|
|
@@ -120,9 +126,15 @@ var manual_default = ({ onChange, className = "", formatAmount }) => {
|
|
|
120
126
|
const onCancel = () => {
|
|
121
127
|
updateAmountStatus(false);
|
|
122
128
|
setMoney(pay == null ? void 0 : pay.total);
|
|
123
|
-
dispatch(
|
|
129
|
+
dispatch(
|
|
130
|
+
(0, import_store.updateState)({
|
|
131
|
+
manual: { ...manual, status: true, money: pay == null ? void 0 : pay.total }
|
|
132
|
+
})
|
|
133
|
+
);
|
|
124
134
|
};
|
|
125
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-manual ${className}` }, isUpdateAmount ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-manual-edit-title" }, import_utils.locales.getText("page.eftpos-pay.text.manual.title")), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-manual-edit-body" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-manual-edit-text" }, import_utils.locales.getText("page.eftpos-pay.text.manual.subtitle")(
|
|
135
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-manual ${className}` }, isUpdateAmount ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-manual-edit-title" }, import_utils.locales.getText("page.eftpos-pay.text.manual.title")), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-manual-edit-body" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-manual-edit-text" }, import_utils.locales.getText("page.eftpos-pay.text.manual.subtitle")(
|
|
136
|
+
formatAmount(pay == null ? void 0 : pay.total, 2, symbol)
|
|
137
|
+
), " ", /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText("page.eftpos-pay.text.manual.confirm"), /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText("page.eftpos-pay.text.manual.diff")), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-manual-edit-act" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-manual-edit-text" }, import_utils.locales.getText("page.eftpos-pay.text.manual.tip")), /* @__PURE__ */ import_react.default.createElement(
|
|
126
138
|
import_antd.InputNumber,
|
|
127
139
|
{
|
|
128
140
|
type: "number",
|
|
@@ -161,7 +173,9 @@ var manual_default = ({ onChange, className = "", formatAmount }) => {
|
|
|
161
173
|
type: "primary",
|
|
162
174
|
onClick: onSubmit
|
|
163
175
|
},
|
|
164
|
-
import_utils.locales.getText("page.eftpos-pay.text.manual.btn.confirm")(
|
|
176
|
+
import_utils.locales.getText("page.eftpos-pay.text.manual.btn.confirm")(
|
|
177
|
+
formatAmount(money, 2, symbol)
|
|
178
|
+
)
|
|
165
179
|
))) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-manual-title" }, manual == null ? void 0 : manual.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-manual-txt" }, manual == null ? void 0 : manual.text), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-manual-card-box" }, /* @__PURE__ */ import_react.default.createElement(
|
|
166
180
|
"div",
|
|
167
181
|
{
|
|
@@ -27,6 +27,32 @@ export declare enum ModeEnum {
|
|
|
27
27
|
/** 查询 */
|
|
28
28
|
Query = "query"
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* 崩溃恢复
|
|
32
|
+
*/
|
|
33
|
+
export declare enum RestoreEumn {
|
|
34
|
+
/** 常规 */
|
|
35
|
+
Normal = "normal",
|
|
36
|
+
/** 恢复 */
|
|
37
|
+
Restore = "restore"
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 订单状态
|
|
41
|
+
*/
|
|
42
|
+
export declare enum OrderEumn {
|
|
43
|
+
/** 恢复 */
|
|
44
|
+
Restore = "restore",
|
|
45
|
+
/** 常规 */
|
|
46
|
+
Normal = "normal",
|
|
47
|
+
/** 成功 */
|
|
48
|
+
Succeed = "succeed",
|
|
49
|
+
/** 失败 */
|
|
50
|
+
Failed = "failed",
|
|
51
|
+
/** 等待 */
|
|
52
|
+
Pending = "pending",
|
|
53
|
+
/** 没有订单状态 */
|
|
54
|
+
Null = "null"
|
|
55
|
+
}
|
|
30
56
|
export declare enum ClientEnum {
|
|
31
57
|
/** 用户端 */
|
|
32
58
|
User = "user",
|
|
@@ -60,7 +86,7 @@ export interface PosProps {
|
|
|
60
86
|
[key: string]: unknown;
|
|
61
87
|
};
|
|
62
88
|
/** 回调 */
|
|
63
|
-
onChangeStatus: (status: `${StatusEnum.Success}` | `${StatusEnum.Fail}` | 'page', params?: {
|
|
89
|
+
onChangeStatus: (status: `${StatusEnum.Success}` | `${StatusEnum.Fail}` | 'page' | 'print' | 'mark_tx_processed', params?: {
|
|
64
90
|
[keys: string]: unknown;
|
|
65
91
|
} | string, other?: any) => void;
|
|
66
92
|
onChangeParams(...agrn: unknown[]): void;
|