@pisell/private-materials 3.0.139 → 3.0.140
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 +8 -8
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.js +7 -7
- package/es/components/eftpos/deviceList/index.d.ts +3 -0
- package/es/components/eftpos/deviceList/index.js +52 -0
- package/es/components/eftpos/form/index.js +21 -74
- package/es/components/eftpos/group/index.d.ts +7 -0
- package/es/components/eftpos/group/index.js +65 -0
- package/es/components/eftposPay/component/manual/index.js +15 -15
- package/es/components/eftposPay/helper.d.ts +9 -0
- package/es/components/eftposPay/helper.js +69 -1
- package/es/components/eftposPay/manufacturer.d.ts +1 -1
- package/es/components/eftposPay/manufacturer.js +17 -15
- package/es/components/eftposPay/payo/const.js +6 -3
- package/es/components/eftposPay/payo/hooks.js +31 -2
- package/es/components/eftposPay/tyro/const.js +3 -1
- package/es/components/eftposPay/windcave/const.js +2 -1
- package/lib/components/eftpos/deviceList/index.d.ts +3 -0
- package/lib/components/eftpos/deviceList/index.js +70 -0
- package/lib/components/eftpos/form/index.js +6 -33
- package/lib/components/eftpos/group/index.d.ts +7 -0
- package/lib/components/eftpos/group/index.js +75 -0
- package/lib/components/eftposPay/component/manual/index.js +4 -15
- package/lib/components/eftposPay/helper.d.ts +9 -0
- package/lib/components/eftposPay/helper.js +49 -0
- package/lib/components/eftposPay/manufacturer.d.ts +1 -1
- package/lib/components/eftposPay/manufacturer.js +2 -13
- package/lib/components/eftposPay/payo/const.js +3 -3
- package/lib/components/eftposPay/payo/hooks.js +17 -0
- package/lib/components/eftposPay/tyro/const.js +1 -1
- package/lib/components/eftposPay/windcave/const.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
var _excluded = ["input"],
|
|
3
|
+
_excluded2 = ["input"];
|
|
4
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
5
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
+
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); }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
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."); }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
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; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
import React, { useMemo } from 'react';
|
|
18
|
+
import { Form } from 'antd';
|
|
19
|
+
import { CheckboxGroup } from "../group";
|
|
20
|
+
var DeviceList = function DeviceList(props) {
|
|
21
|
+
var _Form$useForm = Form.useForm(),
|
|
22
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
23
|
+
form = _Form$useForm2[0];
|
|
24
|
+
var list = props.list,
|
|
25
|
+
onChange = props.onChange; //value 是form表单中"name"对应的字段值
|
|
26
|
+
console.log(list);
|
|
27
|
+
var onValuesChange = function onValuesChange() {
|
|
28
|
+
var val = Object.values(form.getFieldsValue()).flat();
|
|
29
|
+
onChange(val);
|
|
30
|
+
};
|
|
31
|
+
var initialValues = useMemo(function () {
|
|
32
|
+
return list.reduce(function (target, item) {
|
|
33
|
+
var _item$input, _item$input2;
|
|
34
|
+
return _objectSpread(_objectSpread({}, target), {}, _defineProperty({}, item.name, (item === null || item === void 0 ? void 0 : (_item$input = item.input) === null || _item$input === void 0 ? void 0 : _item$input.value) || (item === null || item === void 0 ? void 0 : (_item$input2 = item.input) === null || _item$input2 === void 0 ? void 0 : _item$input2.defaultValue)));
|
|
35
|
+
}, {});
|
|
36
|
+
}, [list]);
|
|
37
|
+
return /*#__PURE__*/React.createElement(Form, {
|
|
38
|
+
layout: "vertical",
|
|
39
|
+
onValuesChange: onValuesChange,
|
|
40
|
+
form: form,
|
|
41
|
+
initialValues: initialValues
|
|
42
|
+
}, list.map(function (_ref) {
|
|
43
|
+
var input = _ref.input,
|
|
44
|
+
formItemProps = _objectWithoutProperties(_ref, _excluded);
|
|
45
|
+
return /*#__PURE__*/React.createElement(Form.Item, formItemProps, /*#__PURE__*/React.createElement(CheckboxGroup, input));
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
export default (function (_ref2) {
|
|
49
|
+
var input = _ref2.input,
|
|
50
|
+
formItemProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
51
|
+
return /*#__PURE__*/React.createElement(Form.Item, formItemProps, /*#__PURE__*/React.createElement(DeviceList, input));
|
|
52
|
+
});
|
|
@@ -1,78 +1,24 @@
|
|
|
1
|
-
var _excluded = ["
|
|
2
|
-
_excluded2 = ["
|
|
3
|
-
_excluded3 = ["
|
|
4
|
-
_excluded4 = ["label", "value"],
|
|
5
|
-
_excluded5 = ["__sourceName", "Component"],
|
|
6
|
-
_excluded6 = ["input"],
|
|
7
|
-
_excluded7 = ["input"];
|
|
1
|
+
var _excluded = ["__sourceName", "Component"],
|
|
2
|
+
_excluded2 = ["input"],
|
|
3
|
+
_excluded3 = ["input"];
|
|
8
4
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
9
5
|
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); }
|
|
10
6
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
7
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
8
|
import React from 'react';
|
|
13
|
-
import { Input, InputNumber, Checkbox, Radio, Cascader, DatePicker, Select, Slider, Switch, TimePicker, Transfer, TreeSelect, Upload, Form
|
|
9
|
+
import { Input, InputNumber, Checkbox, Radio, Cascader, DatePicker, Select, Slider, Switch, TimePicker, Transfer, TreeSelect, Upload, Form } from 'antd';
|
|
10
|
+
import { CheckboxGroup, RadioGroup } from "../group";
|
|
14
11
|
import Surcharge, { getCommName, getCommDefaultVal } from "../surcharge";
|
|
12
|
+
import DeviceList from "../deviceList";
|
|
15
13
|
|
|
16
14
|
// 通用表单配置
|
|
17
15
|
var Mapping = {
|
|
18
16
|
Input: Input,
|
|
19
17
|
InputNumber: InputNumber,
|
|
20
18
|
Checkbox: Checkbox,
|
|
21
|
-
'Checkbox.Group':
|
|
22
|
-
var direction = _ref.direction,
|
|
23
|
-
options = _ref.options,
|
|
24
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
-
if (direction === 'vertical') {
|
|
26
|
-
return /*#__PURE__*/React.createElement(Checkbox.Group, props, /*#__PURE__*/React.createElement(Space, {
|
|
27
|
-
direction: direction
|
|
28
|
-
}, options === null || options === void 0 ? void 0 : options.map(function (item) {
|
|
29
|
-
if (_typeof(item) === 'object') {
|
|
30
|
-
var label = item.label,
|
|
31
|
-
value = item.value,
|
|
32
|
-
other = _objectWithoutProperties(item, _excluded2);
|
|
33
|
-
return /*#__PURE__*/React.createElement(Checkbox, _extends({}, other, {
|
|
34
|
-
value: value,
|
|
35
|
-
key: "".concat(item.value)
|
|
36
|
-
}), label);
|
|
37
|
-
}
|
|
38
|
-
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
39
|
-
value: item,
|
|
40
|
-
key: "".concat(item)
|
|
41
|
-
}, item);
|
|
42
|
-
})));
|
|
43
|
-
}
|
|
44
|
-
return /*#__PURE__*/React.createElement(Checkbox.Group, _extends({}, props, {
|
|
45
|
-
options: options
|
|
46
|
-
}));
|
|
47
|
-
},
|
|
19
|
+
'Checkbox.Group': CheckboxGroup,
|
|
48
20
|
Radio: Radio,
|
|
49
|
-
'Radio.Group':
|
|
50
|
-
var direction = _ref2.direction,
|
|
51
|
-
options = _ref2.options,
|
|
52
|
-
props = _objectWithoutProperties(_ref2, _excluded3);
|
|
53
|
-
if (direction === 'vertical') {
|
|
54
|
-
return /*#__PURE__*/React.createElement(Radio.Group, props, /*#__PURE__*/React.createElement(Space, {
|
|
55
|
-
direction: "vertical"
|
|
56
|
-
}, options === null || options === void 0 ? void 0 : options.map(function (item) {
|
|
57
|
-
if (_typeof(item) === 'object') {
|
|
58
|
-
var label = item.label,
|
|
59
|
-
value = item.value,
|
|
60
|
-
other = _objectWithoutProperties(item, _excluded4);
|
|
61
|
-
return /*#__PURE__*/React.createElement(Radio, _extends({}, other, {
|
|
62
|
-
value: value,
|
|
63
|
-
key: "".concat(item.value)
|
|
64
|
-
}), label);
|
|
65
|
-
}
|
|
66
|
-
return /*#__PURE__*/React.createElement(Radio, {
|
|
67
|
-
value: item,
|
|
68
|
-
key: "".concat(item)
|
|
69
|
-
}, item);
|
|
70
|
-
})));
|
|
71
|
-
}
|
|
72
|
-
return /*#__PURE__*/React.createElement(Radio.Group, _extends({}, props, {
|
|
73
|
-
options: options
|
|
74
|
-
}));
|
|
75
|
-
},
|
|
21
|
+
'Radio.Group': RadioGroup,
|
|
76
22
|
'Radio.Button': Radio.Button,
|
|
77
23
|
Cascader: Cascader,
|
|
78
24
|
DatePicker: DatePicker,
|
|
@@ -85,7 +31,8 @@ var Mapping = {
|
|
|
85
31
|
Upload: Upload
|
|
86
32
|
};
|
|
87
33
|
var CustomMapping = {
|
|
88
|
-
Surcharge: Surcharge
|
|
34
|
+
Surcharge: Surcharge,
|
|
35
|
+
DeviceList: DeviceList
|
|
89
36
|
};
|
|
90
37
|
|
|
91
38
|
/**
|
|
@@ -93,15 +40,15 @@ var CustomMapping = {
|
|
|
93
40
|
* @Author: hongbing.wang
|
|
94
41
|
* @Date: 2024-08-20 13:21
|
|
95
42
|
*/
|
|
96
|
-
var CustomFormItem = function CustomFormItem(
|
|
97
|
-
var formItemList =
|
|
98
|
-
|
|
99
|
-
level =
|
|
100
|
-
onChange =
|
|
101
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, formItemList.map(function (
|
|
102
|
-
var __sourceName =
|
|
103
|
-
Component =
|
|
104
|
-
item = _objectWithoutProperties(
|
|
43
|
+
var CustomFormItem = function CustomFormItem(_ref) {
|
|
44
|
+
var formItemList = _ref.formItemList,
|
|
45
|
+
_ref$level = _ref.level,
|
|
46
|
+
level = _ref$level === void 0 ? 0 : _ref$level,
|
|
47
|
+
onChange = _ref.onChange;
|
|
48
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, formItemList.map(function (_ref2, index) {
|
|
49
|
+
var __sourceName = _ref2.__sourceName,
|
|
50
|
+
Component = _ref2.Component,
|
|
51
|
+
item = _objectWithoutProperties(_ref2, _excluded);
|
|
105
52
|
if (Array.isArray(item.children)) {
|
|
106
53
|
return /*#__PURE__*/React.createElement(CustomFormItem, {
|
|
107
54
|
formItemList: item.children,
|
|
@@ -118,7 +65,7 @@ var CustomFormItem = function CustomFormItem(_ref3) {
|
|
|
118
65
|
if (Mapping[Component]) {
|
|
119
66
|
var Comm = Mapping[Component];
|
|
120
67
|
var input = item.input,
|
|
121
|
-
formItemProps = _objectWithoutProperties(item,
|
|
68
|
+
formItemProps = _objectWithoutProperties(item, _excluded2);
|
|
122
69
|
return /*#__PURE__*/React.createElement(Form.Item, _extends({}, formItemProps, {
|
|
123
70
|
key: item.name + level
|
|
124
71
|
}), /*#__PURE__*/React.createElement(Comm, input));
|
|
@@ -126,7 +73,7 @@ var CustomFormItem = function CustomFormItem(_ref3) {
|
|
|
126
73
|
if (Mapping[Component]) {
|
|
127
74
|
var _Comm = Mapping[Component];
|
|
128
75
|
var _input = item.input,
|
|
129
|
-
_formItemProps = _objectWithoutProperties(item,
|
|
76
|
+
_formItemProps = _objectWithoutProperties(item, _excluded3);
|
|
130
77
|
return /*#__PURE__*/React.createElement(Form.Item, _extends({}, _formItemProps, {
|
|
131
78
|
key: item.name + level
|
|
132
79
|
}), /*#__PURE__*/React.createElement(_Comm, _input));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RadioGroupProps } from 'antd';
|
|
3
|
+
export declare const CheckboxGroup: ({ direction, options, ...props }: any) => React.JSX.Element;
|
|
4
|
+
export declare const RadioGroup: ({ direction, options, component, ...props }: RadioGroupProps & {
|
|
5
|
+
direction?: "vertical" | undefined;
|
|
6
|
+
component: string;
|
|
7
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var _excluded = ["direction", "options"],
|
|
2
|
+
_excluded2 = ["label", "value"],
|
|
3
|
+
_excluded3 = ["direction", "options", "component"],
|
|
4
|
+
_excluded4 = ["label", "value"];
|
|
5
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
|
+
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); }
|
|
7
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { Checkbox, Radio, Space } from 'antd';
|
|
11
|
+
export var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
12
|
+
var direction = _ref.direction,
|
|
13
|
+
options = _ref.options,
|
|
14
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
+
if (direction === 'vertical') {
|
|
16
|
+
return /*#__PURE__*/React.createElement(Checkbox.Group, props, /*#__PURE__*/React.createElement(Space, {
|
|
17
|
+
direction: direction
|
|
18
|
+
}, options === null || options === void 0 ? void 0 : options.map(function (item) {
|
|
19
|
+
if (_typeof(item) === 'object') {
|
|
20
|
+
var label = item.label,
|
|
21
|
+
value = item.value,
|
|
22
|
+
other = _objectWithoutProperties(item, _excluded2);
|
|
23
|
+
return /*#__PURE__*/React.createElement(Checkbox, _extends({}, other, {
|
|
24
|
+
value: value,
|
|
25
|
+
key: "".concat(item.value)
|
|
26
|
+
}), label);
|
|
27
|
+
}
|
|
28
|
+
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
29
|
+
value: item,
|
|
30
|
+
key: "".concat(item)
|
|
31
|
+
}, item);
|
|
32
|
+
})));
|
|
33
|
+
}
|
|
34
|
+
return /*#__PURE__*/React.createElement(Checkbox.Group, _extends({}, props, {
|
|
35
|
+
options: options
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
export var RadioGroup = function RadioGroup(_ref2) {
|
|
39
|
+
var direction = _ref2.direction,
|
|
40
|
+
options = _ref2.options,
|
|
41
|
+
component = _ref2.component,
|
|
42
|
+
props = _objectWithoutProperties(_ref2, _excluded3);
|
|
43
|
+
if (direction === 'vertical') {
|
|
44
|
+
return /*#__PURE__*/React.createElement(Radio.Group, props, /*#__PURE__*/React.createElement(Space, {
|
|
45
|
+
direction: "vertical"
|
|
46
|
+
}, options === null || options === void 0 ? void 0 : options.map(function (item) {
|
|
47
|
+
if (_typeof(item) === 'object') {
|
|
48
|
+
var label = item.label,
|
|
49
|
+
value = item.value,
|
|
50
|
+
other = _objectWithoutProperties(item, _excluded4);
|
|
51
|
+
return /*#__PURE__*/React.createElement(Radio, _extends({}, other, {
|
|
52
|
+
value: value,
|
|
53
|
+
key: "".concat(item.value)
|
|
54
|
+
}), label);
|
|
55
|
+
}
|
|
56
|
+
return /*#__PURE__*/React.createElement(Radio, {
|
|
57
|
+
value: item,
|
|
58
|
+
key: "".concat(item)
|
|
59
|
+
}, item);
|
|
60
|
+
})));
|
|
61
|
+
}
|
|
62
|
+
return /*#__PURE__*/React.createElement(Radio.Group, _extends({}, props, {
|
|
63
|
+
options: options
|
|
64
|
+
}));
|
|
65
|
+
};
|
|
@@ -41,11 +41,11 @@ export default (function (_ref) {
|
|
|
41
41
|
pay = _useContextData.pay,
|
|
42
42
|
amount = _useContextData.amount;
|
|
43
43
|
var start = useMemo(function () {
|
|
44
|
-
if (typeof (manual === null || manual === void 0 ? void 0 : manual.money) === 'number') {
|
|
45
|
-
return manual === null || manual === void 0 ? void 0 : manual.money;
|
|
44
|
+
if (typeof (manual === null || manual === void 0 ? void 0 : manual.money) === 'number' || typeof (manual === null || manual === void 0 ? void 0 : manual.money) === 'string') {
|
|
45
|
+
return Number(manual === null || manual === void 0 ? void 0 : manual.money);
|
|
46
46
|
}
|
|
47
|
-
if (typeof (pay === null || pay === void 0 ? void 0 : pay.total) === 'number') {
|
|
48
|
-
return pay === null || pay === void 0 ? void 0 : pay.total;
|
|
47
|
+
if (typeof (pay === null || pay === void 0 ? void 0 : pay.total) === 'number' || typeof (pay === null || pay === void 0 ? void 0 : pay.total) === 'string') {
|
|
48
|
+
return Number(pay === null || pay === void 0 ? void 0 : pay.total);
|
|
49
49
|
}
|
|
50
50
|
return amount;
|
|
51
51
|
}, [manual === null || manual === void 0 ? void 0 : manual.money, pay === null || pay === void 0 ? void 0 : pay.total, amount]);
|
|
@@ -72,17 +72,17 @@ export default (function (_ref) {
|
|
|
72
72
|
if (disabled) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
//
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
75
|
+
// if (mode === ModeEnum.Pay) {
|
|
76
|
+
// setDisabled(true);
|
|
77
|
+
// const obj = pay || {};
|
|
78
|
+
// onChange('success', {
|
|
79
|
+
// ...obj,
|
|
80
|
+
// number,
|
|
81
|
+
// device,
|
|
82
|
+
// order_id,
|
|
83
|
+
// } as { [key: string]: unknown });
|
|
84
|
+
// return;
|
|
85
|
+
// }
|
|
86
86
|
if (mode === ModeEnum.Refund) {
|
|
87
87
|
setDisabled(true);
|
|
88
88
|
onChange('success', {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { State } from './store';
|
|
2
|
+
import { Amount } from './const';
|
|
2
3
|
export declare function getUuid(): string;
|
|
3
4
|
/**
|
|
4
5
|
* @title: Promise化 setTimeout
|
|
@@ -54,4 +55,12 @@ export declare const getPayParams: (data: Partial<Omit<State, key>> & Pick<State
|
|
|
54
55
|
device?: undefined;
|
|
55
56
|
};
|
|
56
57
|
export declare const limitDecimals: (value: any) => any;
|
|
58
|
+
/**
|
|
59
|
+
* @title: 通用获取 金额信息
|
|
60
|
+
* @description: 在 amount 页面设置则使用 pay ,如果有 setting 则使用 setting 信息 ,都没有则设置0
|
|
61
|
+
* @param {State} store : 全局store数据管理
|
|
62
|
+
* @Author: hongbing.wang
|
|
63
|
+
* @Date: 2024-08-12 10:24
|
|
64
|
+
*/
|
|
65
|
+
export declare function getAmonunt(store: State): Amount;
|
|
57
66
|
export {};
|
|
@@ -124,4 +124,72 @@ export var limitDecimals = function limitDecimals(value) {
|
|
|
124
124
|
return !isNaN(value) ? String(value).replace(reg, '$1$2.$3') : '';
|
|
125
125
|
}
|
|
126
126
|
return '';
|
|
127
|
-
};
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @title: 通用获取 金额信息
|
|
131
|
+
* @description: 在 amount 页面设置则使用 pay ,如果有 setting 则使用 setting 信息 ,都没有则设置0
|
|
132
|
+
* @param {State} store : 全局store数据管理
|
|
133
|
+
* @Author: hongbing.wang
|
|
134
|
+
* @Date: 2024-08-12 10:24
|
|
135
|
+
*/
|
|
136
|
+
export function getAmonunt(store) {
|
|
137
|
+
var device = store.device,
|
|
138
|
+
pay = store.pay,
|
|
139
|
+
custom = store.custom,
|
|
140
|
+
name = store.name,
|
|
141
|
+
symbol = store.symbol,
|
|
142
|
+
amount = store.amount;
|
|
143
|
+
if (!device || !custom) {
|
|
144
|
+
throw Error('device or custom is not defined');
|
|
145
|
+
}
|
|
146
|
+
var setting = device.setting;
|
|
147
|
+
|
|
148
|
+
// 从 金额编辑页 获取到 支付数据
|
|
149
|
+
if (pay) {
|
|
150
|
+
return {
|
|
151
|
+
name: name,
|
|
152
|
+
symbol: symbol,
|
|
153
|
+
// format,
|
|
154
|
+
money: Number(amount),
|
|
155
|
+
amount: Number(pay.amount),
|
|
156
|
+
surRate: Number(pay.surRate),
|
|
157
|
+
surMoney: Number(pay.surMoney),
|
|
158
|
+
surcharge: (setting === null || setting === void 0 ? void 0 : setting.surcharge) || false,
|
|
159
|
+
useOriginSurcharge: (pay === null || pay === void 0 ? void 0 : pay.useOriginSurcharge) || false
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
// 原始支付总额
|
|
163
|
+
if (!setting) {
|
|
164
|
+
return {
|
|
165
|
+
name: name,
|
|
166
|
+
symbol: symbol,
|
|
167
|
+
// format,
|
|
168
|
+
money: Number(amount),
|
|
169
|
+
amount: Number(amount),
|
|
170
|
+
surRate: 0,
|
|
171
|
+
surMoney: 0,
|
|
172
|
+
surcharge: false,
|
|
173
|
+
useOriginSurcharge: false
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
// 原始手续费 是指 各个pos机厂商跟银行合作直接收取的手续费,一旦设置则清空,配置中设置的手续费
|
|
177
|
+
var useOriginSurcharge = setting.useOriginSurcharge || false;
|
|
178
|
+
|
|
179
|
+
// 直接设备中手续费金额
|
|
180
|
+
var surRate = setting.constant_rate || 0;
|
|
181
|
+
var surMoney = setting.constant_money || 0;
|
|
182
|
+
|
|
183
|
+
// 是否开启手续费
|
|
184
|
+
var surcharge = setting.surcharge;
|
|
185
|
+
return {
|
|
186
|
+
name: name,
|
|
187
|
+
symbol: symbol,
|
|
188
|
+
money: Number(amount),
|
|
189
|
+
amount: Number(amount),
|
|
190
|
+
surRate: useOriginSurcharge ? 0 : surcharge ? surRate : 0,
|
|
191
|
+
surMoney: useOriginSurcharge ? 0 : surcharge ? surMoney : 0,
|
|
192
|
+
surcharge: surcharge,
|
|
193
|
+
useOriginSurcharge: useOriginSurcharge
|
|
194
|
+
};
|
|
195
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { State } from './store';
|
|
2
|
+
export { getAmonunt } from './helper';
|
|
2
3
|
export { default as Payo } from './payo';
|
|
3
4
|
export { default as Windcave } from './windcave/windcave';
|
|
4
5
|
export { default as Tyro } from './tyro';
|
|
5
6
|
export declare const getInitState: (type: string, params?: any) => State;
|
|
6
|
-
export declare const getAmonunt: (store: State) => import("./const").Amount;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EftposEnum } from "./const";
|
|
2
|
-
import getPayoInitState
|
|
3
|
-
import getTyroInitState
|
|
4
|
-
import getWindcaveInitState
|
|
2
|
+
import getPayoInitState from "./payo/const";
|
|
3
|
+
import getTyroInitState from "./tyro/const";
|
|
4
|
+
import getWindcaveInitState from "./windcave/const";
|
|
5
|
+
export { getAmonunt } from "./helper";
|
|
5
6
|
export { default as Payo } from "./payo";
|
|
6
7
|
export { default as Windcave } from "./windcave/windcave";
|
|
7
8
|
export { default as Tyro } from "./tyro";
|
|
@@ -17,15 +18,16 @@ export var getInitState = function getInitState(type, params) {
|
|
|
17
18
|
throw new Error('未知的厂商类型');
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
// 暂无定制业务
|
|
22
|
+
// export const getAmonunt = (store: State) => {
|
|
23
|
+
// if (store.eftpos === EftposEnum.Payo) {
|
|
24
|
+
// return getPayoAmonunt(store);
|
|
25
|
+
// }
|
|
26
|
+
// if (store.eftpos === EftposEnum.Windcave) {
|
|
27
|
+
// return getWindcaveAmonunt(store);
|
|
28
|
+
// }
|
|
29
|
+
// if (store.eftpos === EftposEnum.Tyro) {
|
|
30
|
+
// return getTyroAmonunt(store);
|
|
31
|
+
// }
|
|
32
|
+
// throw new Error('未知的厂商类型');
|
|
33
|
+
// };
|
|
@@ -111,6 +111,7 @@ export function getAmonunt(store) {
|
|
|
111
111
|
useOriginSurcharge: (pay === null || pay === void 0 ? void 0 : pay.useOriginSurcharge) || false
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
+
|
|
114
115
|
// 原始支付总额
|
|
115
116
|
if (!setting) {
|
|
116
117
|
return {
|
|
@@ -125,11 +126,13 @@ export function getAmonunt(store) {
|
|
|
125
126
|
useOriginSurcharge: false
|
|
126
127
|
};
|
|
127
128
|
}
|
|
129
|
+
var useOriginSurcharge = setting.useOriginSurcharge || false;
|
|
130
|
+
|
|
128
131
|
// 直接设备中手续费金额 + 原始支付总额
|
|
129
|
-
|
|
130
|
-
var
|
|
132
|
+
|
|
133
|
+
var surRate = setting.constant_rate || 0;
|
|
134
|
+
var surMoney = setting.constant_money || 0;
|
|
131
135
|
var surcharge = setting.surcharge;
|
|
132
|
-
var useOriginSurcharge = setting.useOriginSurcharge || false;
|
|
133
136
|
return {
|
|
134
137
|
name: name,
|
|
135
138
|
symbol: symbol,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
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
2
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
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); }
|
|
3
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
9
|
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
10
|
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
@@ -16,10 +21,11 @@ import { sleep } from "../helper";
|
|
|
16
21
|
export var useValidate = function useValidate(timeout) {
|
|
17
22
|
var controllerRef = useRef();
|
|
18
23
|
var ref = useRef(true);
|
|
24
|
+
var isTimeoutCloseRef = useRef(false);
|
|
19
25
|
var TimeoutRef = useRef();
|
|
20
26
|
var checkApi = useCallback( /*#__PURE__*/function () {
|
|
21
27
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(check, number, time) {
|
|
22
|
-
var res, start, diff;
|
|
28
|
+
var res, start, diff, _ref2, code;
|
|
23
29
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
24
30
|
while (1) switch (_context.prev = _context.next) {
|
|
25
31
|
case 0:
|
|
@@ -61,8 +67,29 @@ export var useValidate = function useValidate(timeout) {
|
|
|
61
67
|
_context.next = 4;
|
|
62
68
|
break;
|
|
63
69
|
case 16:
|
|
70
|
+
if (!isTimeoutCloseRef.current) {
|
|
71
|
+
_context.next = 22;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
if (res) {
|
|
75
|
+
_context.next = 19;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
return _context.abrupt("return", {
|
|
79
|
+
code: PayStatus.Timeout
|
|
80
|
+
});
|
|
81
|
+
case 19:
|
|
82
|
+
_ref2 = res, code = _ref2.code;
|
|
83
|
+
if (!("".concat(code) === "200")) {
|
|
84
|
+
_context.next = 22;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
return _context.abrupt("return", _objectSpread(_objectSpread({}, res), {}, {
|
|
88
|
+
code: PayStatus.Timeout
|
|
89
|
+
}));
|
|
90
|
+
case 22:
|
|
64
91
|
return _context.abrupt("return", res);
|
|
65
|
-
case
|
|
92
|
+
case 23:
|
|
66
93
|
case "end":
|
|
67
94
|
return _context.stop();
|
|
68
95
|
}
|
|
@@ -84,9 +111,11 @@ export var useValidate = function useValidate(timeout) {
|
|
|
84
111
|
(_controllerRef$curren = controllerRef.current) === null || _controllerRef$curren === void 0 ? void 0 : _controllerRef$curren.abort();
|
|
85
112
|
}, []);
|
|
86
113
|
var run = function run() {
|
|
114
|
+
isTimeoutCloseRef.current = false;
|
|
87
115
|
TimeoutRef.current && clearTimeout(TimeoutRef.current);
|
|
88
116
|
// 开启计时
|
|
89
117
|
TimeoutRef.current = setTimeout(function () {
|
|
118
|
+
isTimeoutCloseRef.current = true;
|
|
90
119
|
close();
|
|
91
120
|
}, timeout);
|
|
92
121
|
return checkApi.apply(void 0, arguments);
|
|
@@ -102,11 +102,13 @@ export function getAmonunt(store) {
|
|
|
102
102
|
useOriginSurcharge: false
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
+
var useOriginSurcharge = setting.useOriginSurcharge || false;
|
|
106
|
+
|
|
105
107
|
// 直接设备中手续费金额
|
|
108
|
+
|
|
106
109
|
var surRate = setting.constant_rate || 0;
|
|
107
110
|
var surMoney = setting.constant_money || 0;
|
|
108
111
|
var surcharge = setting.surcharge;
|
|
109
|
-
var useOriginSurcharge = setting.useOriginSurcharge || false;
|
|
110
112
|
return {
|
|
111
113
|
name: name,
|
|
112
114
|
symbol: symbol,
|
|
@@ -111,11 +111,12 @@ export function getAmonunt(store) {
|
|
|
111
111
|
useOriginSurcharge: false
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
+
var useOriginSurcharge = setting.useOriginSurcharge || false;
|
|
115
|
+
|
|
114
116
|
// 直接设备中手续费金额 + 原始支付总额
|
|
115
117
|
var surRate = setting.constant_rate || 0;
|
|
116
118
|
var surMoney = setting.constant_money || 0;
|
|
117
119
|
var surcharge = setting.surcharge;
|
|
118
|
-
var useOriginSurcharge = setting.useOriginSurcharge || false;
|
|
119
120
|
return {
|
|
120
121
|
name: name,
|
|
121
122
|
symbol: symbol,
|