@pisell/private-materials 3.0.95 → 3.0.97
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.css +1 -1
- package/build/lowcode/render/default/view.js +16 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +15 -8
- package/es/components/booking/addons/index.d.ts +1 -1
- package/es/components/booking/addons/model.d.ts +1 -2
- package/es/components/booking/forms/forms.d.ts +1 -1
- package/es/components/booking/forms/index.d.ts +1 -1
- package/es/components/booking/forms/model.d.ts +1 -2
- package/es/components/booking/index.d.ts +1 -1
- package/es/components/booking/info/index.d.ts +1 -1
- package/es/components/booking/info/model.d.ts +1 -2
- package/es/components/booking/model.d.ts +1 -2
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +1 -2
- package/es/components/booking/payments/index.d.ts +1 -1
- package/es/components/booking/payments/model.d.ts +1 -2
- package/es/components/eftpos/const.d.ts +38 -0
- package/es/components/eftpos/const.js +79 -0
- package/es/components/eftpos/device.d.ts +8 -0
- package/es/components/eftpos/device.js +30 -0
- package/es/components/eftpos/form/index.d.ts +16 -0
- package/es/components/eftpos/form/index.js +113 -0
- package/es/components/eftpos/index.d.ts +37 -0
- package/es/components/eftpos/index.js +274 -0
- package/es/components/eftpos/index.less +153 -0
- package/es/components/eftpos/locales.d.ts +75 -0
- package/es/components/eftpos/locales.js +98 -0
- package/es/components/eftpos/pos.d.ts +9 -0
- package/es/components/eftpos/pos.js +33 -0
- package/es/components/eftpos/surcharge/index.css +17 -0
- package/es/components/eftpos/surcharge/index.d.ts +8 -0
- package/es/components/eftpos/surcharge/index.js +111 -0
- package/es/components/eftpos/table.d.ts +17 -0
- package/es/components/eftpos/table.js +236 -0
- package/es/components/eftposPay/amount.d.ts +14 -0
- package/es/components/eftposPay/amount.js +253 -0
- package/es/components/eftposPay/component/alert/index.d.ts +6 -0
- package/es/components/eftposPay/component/alert/index.js +11 -0
- package/es/components/eftposPay/component/alert/index.less +29 -0
- package/es/components/eftposPay/component/alert/warn.d.ts +3 -0
- package/es/components/eftposPay/component/alert/warn.js +45 -0
- package/es/components/eftposPay/component/fail/failCustom.d.ts +4 -0
- package/es/components/eftposPay/component/fail/failCustom.js +95 -0
- package/es/components/eftposPay/component/fail/index.d.ts +4 -0
- package/es/components/eftposPay/component/fail/index.js +105 -0
- package/es/components/eftposPay/component/fail/network.d.ts +4 -0
- package/es/components/eftposPay/component/fail/network.js +48 -0
- package/es/components/eftposPay/component/fail/unknow.d.ts +4 -0
- package/es/components/eftposPay/component/fail/unknow.js +43 -0
- package/es/components/eftposPay/component/header/index.d.ts +9 -0
- package/es/components/eftposPay/component/header/index.js +66 -0
- package/es/components/eftposPay/component/header/index.less +44 -0
- package/es/components/eftposPay/component/header/titlebar.d.ts +13 -0
- package/es/components/eftposPay/component/header/titlebar.js +39 -0
- package/es/components/eftposPay/component/header/titlebar.less +17 -0
- package/es/components/eftposPay/component/manual/index.d.ts +5 -0
- package/es/components/eftposPay/component/manual/index.js +91 -0
- package/es/components/eftposPay/component/manual/index.less +96 -0
- package/es/components/eftposPay/component/signature/index.d.ts +4 -0
- package/es/components/eftposPay/component/signature/index.js +63 -0
- package/es/components/eftposPay/component/step/index.d.ts +12 -0
- package/es/components/eftposPay/component/step/index.js +31 -0
- package/es/components/eftposPay/component/step/step.d.ts +9 -0
- package/es/components/eftposPay/component/step/step.js +23 -0
- package/es/components/eftposPay/const.d.ts +131 -0
- package/es/components/eftposPay/const.js +48 -0
- package/es/components/eftposPay/device.d.ts +14 -0
- package/es/components/eftposPay/device.js +124 -0
- package/es/components/eftposPay/device.less +61 -0
- package/es/components/eftposPay/eftpos/config.d.ts +11 -0
- package/es/components/eftposPay/eftpos/config.js +178 -0
- package/es/components/eftposPay/eftpos/const.d.ts +10 -0
- package/es/components/eftposPay/eftpos/const.js +139 -0
- package/es/components/eftposPay/eftpos/index.d.ts +7 -0
- package/es/components/eftposPay/eftpos/index.js +35 -0
- package/es/components/eftposPay/helper.d.ts +3 -0
- package/es/components/eftposPay/helper.js +35 -0
- package/es/components/eftposPay/hooks.d.ts +4 -0
- package/es/components/eftposPay/hooks.js +153 -0
- package/es/components/eftposPay/index.d.ts +7 -0
- package/es/components/eftposPay/index.js +188 -0
- package/es/components/eftposPay/index.less +273 -0
- package/es/components/eftposPay/locales.d.ts +264 -0
- package/es/components/eftposPay/locales.js +384 -0
- package/es/components/eftposPay/manufacturer.d.ts +6 -0
- package/es/components/eftposPay/manufacturer.js +32 -0
- package/es/components/eftposPay/pay.d.ts +10 -0
- package/es/components/eftposPay/pay.js +108 -0
- package/es/components/eftposPay/payo/config.d.ts +11 -0
- package/es/components/eftposPay/payo/config.js +357 -0
- package/es/components/eftposPay/payo/const.d.ts +6 -0
- package/es/components/eftposPay/payo/const.js +93 -0
- package/es/components/eftposPay/payo/hooks.d.ts +5 -0
- package/es/components/eftposPay/payo/hooks.js +84 -0
- package/es/components/eftposPay/payo/index.d.ts +7 -0
- package/es/components/eftposPay/payo/index.js +35 -0
- package/es/components/eftposPay/store/index.d.ts +239 -0
- package/es/components/eftposPay/store/index.js +304 -0
- package/es/components/eftposPay/store/useThunkReducer.d.ts +9 -0
- package/es/components/eftposPay/store/useThunkReducer.js +31 -0
- package/es/components/eftposPay/windcave/action.d.ts +8 -0
- package/es/components/eftposPay/windcave/action.js +104 -0
- package/es/components/eftposPay/windcave/const.d.ts +104 -0
- package/es/components/eftposPay/windcave/const.js +253 -0
- package/es/components/eftposPay/windcave/helper.d.ts +9 -0
- package/es/components/eftposPay/windcave/helper.js +314 -0
- package/es/components/eftposPay/windcave/hook.d.ts +14 -0
- package/es/components/eftposPay/windcave/hook.js +144 -0
- package/es/components/eftposPay/windcave/index.d.ts +8 -0
- package/es/components/eftposPay/windcave/index.js +49 -0
- package/es/components/eftposPay/windcave/pos.d.ts +8 -0
- package/es/components/eftposPay/windcave/pos.js +180 -0
- package/es/components/eftposPay/windcave/pwd.d.ts +8 -0
- package/es/components/eftposPay/windcave/pwd.js +124 -0
- package/es/components/eftposPay/windcave/receipet.d.ts +6 -0
- package/es/components/eftposPay/windcave/receipet.js +67 -0
- package/es/components/eftposPay/windcave/receiptAction.d.ts +11 -0
- package/es/components/eftposPay/windcave/receiptAction.js +326 -0
- package/es/components/eftposPay/windcave/timer.d.ts +17 -0
- package/es/components/eftposPay/windcave/timer.js +181 -0
- package/es/components/eftposPay/windcave/wait.d.ts +12 -0
- package/es/components/eftposPay/windcave/wait.js +139 -0
- package/es/components/eftposPay/windcave/windcave.d.ts +6 -0
- package/es/components/eftposPay/windcave/windcave.js +283 -0
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -2
- package/es/hooks/usePrefix.d.ts +1 -0
- package/es/hooks/usePrefix.js +10 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/lib/components/booking/addons/index.d.ts +1 -1
- package/lib/components/booking/addons/model.d.ts +1 -2
- package/lib/components/booking/forms/forms.d.ts +1 -1
- package/lib/components/booking/forms/index.d.ts +1 -1
- package/lib/components/booking/forms/model.d.ts +1 -2
- package/lib/components/booking/index.d.ts +1 -1
- package/lib/components/booking/info/index.d.ts +1 -1
- package/lib/components/booking/info/model.d.ts +1 -2
- package/lib/components/booking/model.d.ts +1 -2
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +1 -2
- package/lib/components/booking/payments/index.d.ts +1 -1
- package/lib/components/booking/payments/model.d.ts +1 -2
- package/lib/components/eftpos/const.d.ts +38 -0
- package/lib/components/eftpos/const.js +108 -0
- package/lib/components/eftpos/device.d.ts +8 -0
- package/lib/components/eftpos/device.js +55 -0
- package/lib/components/eftpos/form/index.d.ts +16 -0
- package/lib/components/eftpos/form/index.js +124 -0
- package/lib/components/eftpos/index.d.ts +37 -0
- package/lib/components/eftpos/index.js +279 -0
- package/lib/components/eftpos/index.less +153 -0
- package/lib/components/eftpos/locales.d.ts +75 -0
- package/lib/components/eftpos/locales.js +116 -0
- package/lib/components/eftpos/pos.d.ts +9 -0
- package/lib/components/eftpos/pos.js +55 -0
- package/lib/components/eftpos/surcharge/index.css +17 -0
- package/lib/components/eftpos/surcharge/index.d.ts +8 -0
- package/lib/components/eftpos/surcharge/index.js +125 -0
- package/lib/components/eftpos/table.d.ts +17 -0
- package/lib/components/eftpos/table.js +235 -0
- package/lib/components/eftposPay/amount.d.ts +14 -0
- package/lib/components/eftposPay/amount.js +239 -0
- package/lib/components/eftposPay/component/alert/index.d.ts +6 -0
- package/lib/components/eftposPay/component/alert/index.js +38 -0
- package/lib/components/eftposPay/component/alert/index.less +29 -0
- package/lib/components/eftposPay/component/alert/warn.d.ts +3 -0
- package/lib/components/eftposPay/component/alert/warn.js +80 -0
- package/lib/components/eftposPay/component/fail/failCustom.d.ts +4 -0
- package/lib/components/eftposPay/component/fail/failCustom.js +117 -0
- package/lib/components/eftposPay/component/fail/index.d.ts +4 -0
- package/lib/components/eftposPay/component/fail/index.js +121 -0
- package/lib/components/eftposPay/component/fail/network.d.ts +4 -0
- package/lib/components/eftposPay/component/fail/network.js +65 -0
- package/lib/components/eftposPay/component/fail/unknow.d.ts +4 -0
- package/lib/components/eftposPay/component/fail/unknow.js +72 -0
- package/lib/components/eftposPay/component/header/index.d.ts +9 -0
- package/lib/components/eftposPay/component/header/index.js +92 -0
- package/lib/components/eftposPay/component/header/index.less +44 -0
- package/lib/components/eftposPay/component/header/titlebar.d.ts +13 -0
- package/lib/components/eftposPay/component/header/titlebar.js +55 -0
- package/lib/components/eftposPay/component/header/titlebar.less +17 -0
- package/lib/components/eftposPay/component/manual/index.d.ts +5 -0
- package/lib/components/eftposPay/component/manual/index.js +101 -0
- package/lib/components/eftposPay/component/manual/index.less +96 -0
- package/lib/components/eftposPay/component/signature/index.d.ts +4 -0
- package/lib/components/eftposPay/component/signature/index.js +80 -0
- package/lib/components/eftposPay/component/step/index.d.ts +12 -0
- package/lib/components/eftposPay/component/step/index.js +71 -0
- package/lib/components/eftposPay/component/step/step.d.ts +9 -0
- package/lib/components/eftposPay/component/step/step.js +59 -0
- package/lib/components/eftposPay/const.d.ts +131 -0
- package/lib/components/eftposPay/const.js +86 -0
- package/lib/components/eftposPay/device.d.ts +14 -0
- package/lib/components/eftposPay/device.js +127 -0
- package/lib/components/eftposPay/device.less +61 -0
- package/lib/components/eftposPay/eftpos/config.d.ts +11 -0
- package/lib/components/eftposPay/eftpos/config.js +199 -0
- package/lib/components/eftposPay/eftpos/const.d.ts +10 -0
- package/lib/components/eftposPay/eftpos/const.js +165 -0
- package/lib/components/eftposPay/eftpos/index.d.ts +7 -0
- package/lib/components/eftposPay/eftpos/index.js +66 -0
- package/lib/components/eftposPay/helper.d.ts +3 -0
- package/lib/components/eftposPay/helper.js +62 -0
- package/lib/components/eftposPay/hooks.d.ts +4 -0
- package/lib/components/eftposPay/hooks.js +237 -0
- package/lib/components/eftposPay/index.d.ts +7 -0
- package/lib/components/eftposPay/index.js +189 -0
- package/lib/components/eftposPay/index.less +273 -0
- package/lib/components/eftposPay/locales.d.ts +264 -0
- package/lib/components/eftposPay/locales.js +304 -0
- package/lib/components/eftposPay/manufacturer.d.ts +6 -0
- package/lib/components/eftposPay/manufacturer.js +77 -0
- package/lib/components/eftposPay/pay.d.ts +10 -0
- package/lib/components/eftposPay/pay.js +120 -0
- package/lib/components/eftposPay/payo/config.d.ts +11 -0
- package/lib/components/eftposPay/payo/config.js +377 -0
- package/lib/components/eftposPay/payo/const.d.ts +6 -0
- package/lib/components/eftposPay/payo/const.js +112 -0
- package/lib/components/eftposPay/payo/hooks.d.ts +5 -0
- package/lib/components/eftposPay/payo/hooks.js +80 -0
- package/lib/components/eftposPay/payo/index.d.ts +7 -0
- package/lib/components/eftposPay/payo/index.js +63 -0
- package/lib/components/eftposPay/store/index.d.ts +239 -0
- package/lib/components/eftposPay/store/index.js +371 -0
- package/lib/components/eftposPay/store/useThunkReducer.d.ts +9 -0
- package/lib/components/eftposPay/store/useThunkReducer.js +53 -0
- package/lib/components/eftposPay/windcave/action.d.ts +8 -0
- package/lib/components/eftposPay/windcave/action.js +143 -0
- package/lib/components/eftposPay/windcave/const.d.ts +104 -0
- package/lib/components/eftposPay/windcave/const.js +300 -0
- package/lib/components/eftposPay/windcave/helper.d.ts +9 -0
- package/lib/components/eftposPay/windcave/helper.js +378 -0
- package/lib/components/eftposPay/windcave/hook.d.ts +14 -0
- package/lib/components/eftposPay/windcave/hook.js +139 -0
- package/lib/components/eftposPay/windcave/index.d.ts +8 -0
- package/lib/components/eftposPay/windcave/index.js +78 -0
- package/lib/components/eftposPay/windcave/pos.d.ts +8 -0
- package/lib/components/eftposPay/windcave/pos.js +197 -0
- package/lib/components/eftposPay/windcave/pwd.d.ts +8 -0
- package/lib/components/eftposPay/windcave/pwd.js +143 -0
- package/lib/components/eftposPay/windcave/receipet.d.ts +6 -0
- package/lib/components/eftposPay/windcave/receipet.js +93 -0
- package/lib/components/eftposPay/windcave/receiptAction.d.ts +11 -0
- package/lib/components/eftposPay/windcave/receiptAction.js +386 -0
- package/lib/components/eftposPay/windcave/timer.d.ts +17 -0
- package/lib/components/eftposPay/windcave/timer.js +126 -0
- package/lib/components/eftposPay/windcave/wait.d.ts +12 -0
- package/lib/components/eftposPay/windcave/wait.js +163 -0
- package/lib/components/eftposPay/windcave/windcave.d.ts +6 -0
- package/lib/components/eftposPay/windcave/windcave.js +283 -0
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -2
- package/lib/hooks/usePrefix.d.ts +1 -0
- package/lib/hooks/usePrefix.js +44 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -0
- package/lowcode/eftpos/meta.ts +187 -0
- package/lowcode/eftpos-pay/meta.ts +122 -0
- package/package.json +4 -3
|
@@ -0,0 +1,253 @@
|
|
|
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 @typescript-eslint/no-use-before-define */
|
|
14
|
+
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
15
|
+
/* eslint-disable no-useless-escape */
|
|
16
|
+
/* eslint-disable no-restricted-globals */
|
|
17
|
+
import { locales } from '@pisell/utils';
|
|
18
|
+
import { InputNumber, Button, message } from 'antd';
|
|
19
|
+
import { Decimal } from 'decimal.js';
|
|
20
|
+
import React, { useMemo, useState } from 'react';
|
|
21
|
+
import Alert from "./component/alert";
|
|
22
|
+
import Titlebar from "./component/header/titlebar";
|
|
23
|
+
import { getDeviceInfo } from "./manufacturer";
|
|
24
|
+
import { useDispatch, useContextData, updateComponent, updateState } from "./store";
|
|
25
|
+
export default (function (_ref) {
|
|
26
|
+
var _ref$className = _ref.className,
|
|
27
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
28
|
+
onChange = _ref.onChange,
|
|
29
|
+
onClose = _ref.onClose,
|
|
30
|
+
_ref$formatAmount = _ref.formatAmount,
|
|
31
|
+
formatAmount = _ref$formatAmount === void 0 ? function (number, precision, symbol) {
|
|
32
|
+
return "".concat(symbol).concat(number);
|
|
33
|
+
} : _ref$formatAmount,
|
|
34
|
+
isIpad = _ref.isIpad,
|
|
35
|
+
net = _ref.net;
|
|
36
|
+
var dispatch = useDispatch();
|
|
37
|
+
var _useState = useState(true),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
status = _useState2[0],
|
|
40
|
+
setStatus = _useState2[1];
|
|
41
|
+
var store = useContextData();
|
|
42
|
+
var _getDeviceInfo = getDeviceInfo(store),
|
|
43
|
+
name = _getDeviceInfo.name,
|
|
44
|
+
symbol = _getDeviceInfo.symbol,
|
|
45
|
+
money = _getDeviceInfo.money,
|
|
46
|
+
lastMoney = _getDeviceInfo.amount,
|
|
47
|
+
surRate = _getDeviceInfo.surRate,
|
|
48
|
+
surMoney = _getDeviceInfo.surMoney;
|
|
49
|
+
var _useState3 = useState(surRate),
|
|
50
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
51
|
+
curSurRate = _useState4[0],
|
|
52
|
+
setSurRate = _useState4[1];
|
|
53
|
+
var _useState5 = useState(surMoney),
|
|
54
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
55
|
+
curSurMoney = _useState6[0],
|
|
56
|
+
setSurMoney = _useState6[1];
|
|
57
|
+
var _useState7 = useState(lastMoney),
|
|
58
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
59
|
+
currentMoney = _useState8[0],
|
|
60
|
+
setCurrentMoney = _useState8[1];
|
|
61
|
+
var _useState9 = useState(curSurRate),
|
|
62
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
63
|
+
tempSurRate = _useState10[0],
|
|
64
|
+
setTempSurRate = _useState10[1];
|
|
65
|
+
var _useState11 = useState(curSurMoney),
|
|
66
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
67
|
+
tempSurMoney = _useState12[0],
|
|
68
|
+
setTempSurMoney = _useState12[1];
|
|
69
|
+
var surRateMoney = useMemo(function () {
|
|
70
|
+
var surRateDeci = new Decimal(curSurRate);
|
|
71
|
+
var moneyDeci = new Decimal(currentMoney);
|
|
72
|
+
return moneyDeci.mul(surRateDeci.div(100)).toFixed(2, Decimal.ROUND_HALF_UP);
|
|
73
|
+
}, [currentMoney, curSurRate]);
|
|
74
|
+
var totalSurMoney = useMemo(function () {
|
|
75
|
+
var surRateDeci = new Decimal(curSurRate);
|
|
76
|
+
var moneyDeci = new Decimal(currentMoney);
|
|
77
|
+
var surMoneyDeci = new Decimal(curSurMoney);
|
|
78
|
+
return moneyDeci.mul(surRateDeci.div(100)).add(surMoneyDeci).toFixed(2, Decimal.ROUND_HALF_UP);
|
|
79
|
+
}, [currentMoney, curSurRate, curSurMoney]);
|
|
80
|
+
var total = useMemo(function () {
|
|
81
|
+
var totalSurDeci = new Decimal(totalSurMoney);
|
|
82
|
+
var moneyDeci = new Decimal(currentMoney);
|
|
83
|
+
return totalSurDeci.add(moneyDeci).toFixed(2, Decimal.ROUND_HALF_UP);
|
|
84
|
+
}, [currentMoney, totalSurMoney]);
|
|
85
|
+
var subtracted = useMemo(function () {
|
|
86
|
+
var moneyDeci = new Decimal(money);
|
|
87
|
+
var currentMoneyDeci = new Decimal(currentMoney);
|
|
88
|
+
return moneyDeci.sub(currentMoneyDeci).toFixed(2, Decimal.ROUND_HALF_UP);
|
|
89
|
+
}, [currentMoney, money]);
|
|
90
|
+
var onBack = function onBack() {
|
|
91
|
+
setStatus(true);
|
|
92
|
+
};
|
|
93
|
+
var onSubmit = function onSubmit() {
|
|
94
|
+
if (!status) {
|
|
95
|
+
setStatus(true);
|
|
96
|
+
setSurRate(tempSurRate);
|
|
97
|
+
setSurMoney(tempSurMoney);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (!net) {
|
|
101
|
+
message.open({
|
|
102
|
+
key: 'net-warning',
|
|
103
|
+
type: 'warning',
|
|
104
|
+
content: locales.getText('page.eftpos-pay.text.not.connected')
|
|
105
|
+
});
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
var rate = new Decimal(curSurRate).div(100).toFixed(4, Decimal.ROUND_HALF_UP);
|
|
109
|
+
var pay = {
|
|
110
|
+
sourceAmount: "".concat(money),
|
|
111
|
+
amount: "".concat(currentMoney),
|
|
112
|
+
surcharge: "".concat(totalSurMoney),
|
|
113
|
+
total: "".concat(total),
|
|
114
|
+
surPercentRate: "".concat(rate),
|
|
115
|
+
surRate: "".concat(curSurRate),
|
|
116
|
+
surMoney: "".concat(curSurMoney),
|
|
117
|
+
surRateMoney: "".concat(surRateMoney),
|
|
118
|
+
totalUnit: formatAmount(total, 2, symbol)
|
|
119
|
+
};
|
|
120
|
+
console.log('surRateMoney = ', surRateMoney);
|
|
121
|
+
dispatch(updateState({
|
|
122
|
+
custom: store.custom ? _objectSpread(_objectSpread({}, store.custom), {}, {
|
|
123
|
+
pay: pay
|
|
124
|
+
}) : {
|
|
125
|
+
pay: pay
|
|
126
|
+
}
|
|
127
|
+
}));
|
|
128
|
+
dispatch(updateComponent(''));
|
|
129
|
+
onChange && onChange('page', 'pay');
|
|
130
|
+
// 下一步
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
var onCancel = function onCancel() {
|
|
134
|
+
if (!status) {
|
|
135
|
+
setStatus(true);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
onClose();
|
|
139
|
+
};
|
|
140
|
+
var onEdit = function onEdit() {
|
|
141
|
+
setStatus(false);
|
|
142
|
+
setTempSurRate(curSurRate);
|
|
143
|
+
setTempSurMoney(curSurMoney);
|
|
144
|
+
};
|
|
145
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
146
|
+
className: "pisell-lowcode__eft-pay-amount ".concat(className)
|
|
147
|
+
}, isIpad ? null : /*#__PURE__*/React.createElement(Titlebar, {
|
|
148
|
+
type: status ? 'left-title-close' : 'back-title-cancel',
|
|
149
|
+
onBack: onBack,
|
|
150
|
+
onClose: onClose
|
|
151
|
+
}, status ? name : locales.getText('page.eftpos-pay.text.surcharge.edit.title')), status ? /*#__PURE__*/React.createElement("div", {
|
|
152
|
+
className: "pisell-lowcode__eft-pay-amount-body"
|
|
153
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
154
|
+
className: "pisell-lowcode__eft-pay-cash",
|
|
155
|
+
"data-money": formatAmount(money, 2, symbol)
|
|
156
|
+
// format.replace(/{{.+}}/, `${money}`)
|
|
157
|
+
}, locales.getText('page.eftpos-pay.text.amount.to.pay')), /*#__PURE__*/React.createElement("div", {
|
|
158
|
+
className: "pisell-lowcode__eft-pay-money"
|
|
159
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
160
|
+
className: "pisell-lowcode__eft-pay-money-title"
|
|
161
|
+
}, locales.getText('page.eftpos-pay.text.input.title')(name)), /*#__PURE__*/React.createElement(InputNumber, {
|
|
162
|
+
addonBefore: symbol || '$',
|
|
163
|
+
max: money,
|
|
164
|
+
precision: 2,
|
|
165
|
+
min: 0,
|
|
166
|
+
style: {
|
|
167
|
+
width: '100%'
|
|
168
|
+
},
|
|
169
|
+
value: currentMoney,
|
|
170
|
+
formatter: limitDecimals,
|
|
171
|
+
parser: limitDecimals,
|
|
172
|
+
onChange: function onChange(event) {
|
|
173
|
+
if (event !== null && event !== undefined) {
|
|
174
|
+
setCurrentMoney(event || 0);
|
|
175
|
+
} else {
|
|
176
|
+
setCurrentMoney(0);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
180
|
+
className: "pisell-lowcode__eft-pay-money-tip"
|
|
181
|
+
}, locales.getText('page.eftpos-pay.text.amount.cash.left.pay.paid')(formatAmount("".concat(subtracted), 2, symbol)))), /*#__PURE__*/React.createElement("div", {
|
|
182
|
+
className: "pisell-lowcode__eft-pay-surcharge"
|
|
183
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
184
|
+
className: "pisell-lowcode__eft-pay-details"
|
|
185
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
186
|
+
className: "pisell-lowcode__eft-pay-total"
|
|
187
|
+
}, locales.getText('page.eftpos-pay.text.surcharge.edit.actual.pay'), ":", formatAmount("".concat(total), 2, symbol)), /*#__PURE__*/React.createElement("div", {
|
|
188
|
+
className: "pisell-lowcode__eft-pay-money"
|
|
189
|
+
}, locales.getText('page.eftpos-pay.text.surcharge.edit.inc.surcharge'), ": ", formatAmount("".concat(totalSurMoney), 2, symbol), " (", locales.getText('page.eftpos-pay.text.surcharge.edit.rate'), ":", curSurRate, "% + ", formatAmount("".concat(curSurMoney), 2, symbol), ")")), /*#__PURE__*/React.createElement(Button, {
|
|
190
|
+
type: "link",
|
|
191
|
+
onClick: onEdit
|
|
192
|
+
}, locales.getText('page.eftpos-pay.text.surcharge.edit.surcharge')))) : /*#__PURE__*/React.createElement("div", {
|
|
193
|
+
className: "pisell-lowcode__eft-pay-amount-body"
|
|
194
|
+
}, /*#__PURE__*/React.createElement(Alert, null, locales.getText('page.eftpos-pay.text.surcharge.percentage-fixed')), /*#__PURE__*/React.createElement("div", {
|
|
195
|
+
className: "pisell-lowcode__eft-pay-amount-form"
|
|
196
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
197
|
+
className: "pisell-lowcode__eft-pay-amount-item"
|
|
198
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
199
|
+
className: "pisell-lowcode__eft-pay-amount-item-title"
|
|
200
|
+
}, locales.getText('page.eftpos-pay.text.surcharge.percentage')), /*#__PURE__*/React.createElement(InputNumber, {
|
|
201
|
+
value: tempSurRate,
|
|
202
|
+
min: 0,
|
|
203
|
+
max: 100,
|
|
204
|
+
precision: 2,
|
|
205
|
+
addonAfter: "%",
|
|
206
|
+
style: {
|
|
207
|
+
width: '100%'
|
|
208
|
+
},
|
|
209
|
+
onChange: function onChange(e) {
|
|
210
|
+
setTempSurRate(e || 0);
|
|
211
|
+
}
|
|
212
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
213
|
+
className: "pisell-lowcode__eft-pay-amount-item"
|
|
214
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
215
|
+
className: "pisell-lowcode__eft-pay-amount-item-title"
|
|
216
|
+
}, locales.getText('page.eftpos-pay.text.surcharge.fixed')), /*#__PURE__*/React.createElement(InputNumber, {
|
|
217
|
+
value: tempSurMoney,
|
|
218
|
+
min: 0,
|
|
219
|
+
max: 100000,
|
|
220
|
+
precision: 2,
|
|
221
|
+
style: {
|
|
222
|
+
width: '100%'
|
|
223
|
+
},
|
|
224
|
+
addonBefore: symbol || '$',
|
|
225
|
+
onChange: function onChange(e) {
|
|
226
|
+
setTempSurMoney(e || 0);
|
|
227
|
+
}
|
|
228
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
229
|
+
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
230
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
231
|
+
block: true,
|
|
232
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
233
|
+
onClick: onCancel
|
|
234
|
+
}, locales.getText('page.eftpos-pay.text.cancel')), /*#__PURE__*/React.createElement(Button, {
|
|
235
|
+
block: true,
|
|
236
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
237
|
+
type: "primary",
|
|
238
|
+
onClick: onSubmit,
|
|
239
|
+
disabled: currentMoney <= 0 && status
|
|
240
|
+
}, locales.getText('page.eftpos-pay.text.sure'))));
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
// inputNumber过滤
|
|
244
|
+
export var limitDecimals = function limitDecimals(value) {
|
|
245
|
+
var reg = /^(\-)*(\d+)\.(\d\d).*$/;
|
|
246
|
+
if (typeof value === 'string') {
|
|
247
|
+
return !isNaN(Number(value)) ? value.replace(reg, '$1$2.$3') : '';
|
|
248
|
+
}
|
|
249
|
+
if (typeof value === 'number') {
|
|
250
|
+
return !isNaN(value) ? String(value).replace(reg, '$1$2.$3') : '';
|
|
251
|
+
}
|
|
252
|
+
return '';
|
|
253
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Warn from "./warn";
|
|
3
|
+
import "./index.less";
|
|
4
|
+
export default (function (_ref) {
|
|
5
|
+
var children = _ref.children;
|
|
6
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7
|
+
className: "pisell-lowcode__alert-warn-box"
|
|
8
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
className: "pisell-lowcode__alert-warn"
|
|
10
|
+
}, /*#__PURE__*/React.createElement(Warn, null)), children);
|
|
11
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.pisell-lowcode__alert-warn-box{
|
|
2
|
+
align-items: center;
|
|
3
|
+
display: flex;
|
|
4
|
+
padding: 8px 16px;
|
|
5
|
+
gap: 16px;
|
|
6
|
+
align-self: stretch;
|
|
7
|
+
|
|
8
|
+
border-radius: 12px;
|
|
9
|
+
border: 1px solid var(--Warning-300, #fec84b);
|
|
10
|
+
background: var(--Warning-25, #fffcf5);
|
|
11
|
+
|
|
12
|
+
/* Shadow/xs */
|
|
13
|
+
box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
|
|
14
|
+
|
|
15
|
+
color: var(--Warning-700, #b54708);
|
|
16
|
+
font-size: 14px;
|
|
17
|
+
font-style: normal;
|
|
18
|
+
font-weight: 600;
|
|
19
|
+
line-height: 20px; /* 142.857% */
|
|
20
|
+
}
|
|
21
|
+
.pisell-lowcode__alert-warn{
|
|
22
|
+
position: relative;
|
|
23
|
+
font-size: 36px;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
font-size: 36px;
|
|
28
|
+
flex-wrap: wrap;
|
|
29
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default (function () {
|
|
3
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
4
|
+
width: "1em",
|
|
5
|
+
height: "1em",
|
|
6
|
+
viewBox: "0 0 36 36",
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
fill: "none"
|
|
9
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
10
|
+
opacity: "0.3"
|
|
11
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
12
|
+
x: "5.49999",
|
|
13
|
+
y: "5.5013",
|
|
14
|
+
width: "25",
|
|
15
|
+
height: "25",
|
|
16
|
+
rx: "12.5",
|
|
17
|
+
stroke: "#DC6803",
|
|
18
|
+
strokeWidth: "1.66667"
|
|
19
|
+
})), /*#__PURE__*/React.createElement("g", {
|
|
20
|
+
opacity: "0.1"
|
|
21
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
22
|
+
x: "1.33333",
|
|
23
|
+
y: "1.33333",
|
|
24
|
+
width: "33.3333",
|
|
25
|
+
height: "33.3333",
|
|
26
|
+
rx: "16.6667",
|
|
27
|
+
stroke: "#DC6803",
|
|
28
|
+
strokeWidth: "1.66667"
|
|
29
|
+
})), /*#__PURE__*/React.createElement("g", {
|
|
30
|
+
clipPath: "url(#clip0_5109_25282)"
|
|
31
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
32
|
+
d: "M18 14.668V18.0013M18 21.3346H18.0083M26.3333 18.0013C26.3333 22.6037 22.6024 26.3346 18 26.3346C13.3976 26.3346 9.66666 22.6037 9.66666 18.0013C9.66666 13.3989 13.3976 9.66797 18 9.66797C22.6024 9.66797 26.3333 13.3989 26.3333 18.0013Z",
|
|
33
|
+
stroke: "#DC6803",
|
|
34
|
+
strokeWidth: "1.66667",
|
|
35
|
+
strokeLinecap: "round",
|
|
36
|
+
strokeLinejoin: "round"
|
|
37
|
+
})), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
38
|
+
id: "clip0_5109_25282"
|
|
39
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
40
|
+
width: "20",
|
|
41
|
+
height: "20",
|
|
42
|
+
fill: "white",
|
|
43
|
+
transform: "translate(8 8)"
|
|
44
|
+
}))));
|
|
45
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
/* eslint-disable no-nested-ternary */
|
|
8
|
+
import { locales } from '@pisell/utils';
|
|
9
|
+
import { Button } from 'antd';
|
|
10
|
+
import React, { useEffect } from 'react';
|
|
11
|
+
import { ModeEnum } from "../../const";
|
|
12
|
+
import { getInitState } from "../../manufacturer";
|
|
13
|
+
import XClose from '@pisell/icon/es/XClose';
|
|
14
|
+
import { useDispatch, useContextData, updateState, updateComponent } from "../../store";
|
|
15
|
+
import Header from "../header";
|
|
16
|
+
export default (function (_ref) {
|
|
17
|
+
var _ref$className = _ref.className,
|
|
18
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
19
|
+
onChange = _ref.onChange;
|
|
20
|
+
var _useContextData = useContextData(),
|
|
21
|
+
eftpos = _useContextData.eftpos,
|
|
22
|
+
custom = _useContextData.custom,
|
|
23
|
+
mode = _useContextData.mode;
|
|
24
|
+
var failCustom = custom === null || custom === void 0 ? void 0 : custom.failCustom;
|
|
25
|
+
var dispatch = useDispatch();
|
|
26
|
+
var onRetry = function onRetry() {
|
|
27
|
+
onChange('page', 'pay');
|
|
28
|
+
dispatch(updateState(getInitState(eftpos, mode === ModeEnum.Query ? _objectSpread(_objectSpread({}, custom), {}, {
|
|
29
|
+
isPay: true
|
|
30
|
+
}) : _objectSpread(_objectSpread({}, custom), {}, {
|
|
31
|
+
number: undefined,
|
|
32
|
+
isPay: false
|
|
33
|
+
}))));
|
|
34
|
+
};
|
|
35
|
+
var onModify = function onModify() {
|
|
36
|
+
dispatch(updateState(getInitState(eftpos, _objectSpread(_objectSpread({}, custom), {}, {
|
|
37
|
+
number: undefined,
|
|
38
|
+
isPay: false
|
|
39
|
+
}))));
|
|
40
|
+
onChange('page', 'amount');
|
|
41
|
+
};
|
|
42
|
+
var onManually = function onManually() {
|
|
43
|
+
dispatch(updateState({
|
|
44
|
+
manual: {
|
|
45
|
+
title: locales.getText('page.eftpos-pay.text.request.title')(mode),
|
|
46
|
+
text: locales.getText('page.eftpos-pay.text.request.text')(mode)
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
dispatch(updateComponent('Manual'));
|
|
50
|
+
};
|
|
51
|
+
var onClose = function onClose() {
|
|
52
|
+
onChange('fail');
|
|
53
|
+
};
|
|
54
|
+
useEffect(function () {
|
|
55
|
+
onChange('page', 'fail');
|
|
56
|
+
}, []);
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: "pisell-lowcode__eft-pay-box ".concat(className)
|
|
59
|
+
}, /*#__PURE__*/React.createElement(Header, {
|
|
60
|
+
status: failCustom.status
|
|
61
|
+
}, (failCustom === null || failCustom === void 0 ? void 0 : failCustom.status) === 'fail' ? /*#__PURE__*/React.createElement(XClose, {
|
|
62
|
+
size: 20,
|
|
63
|
+
style: {
|
|
64
|
+
fontSize: '24px',
|
|
65
|
+
position: 'absolute',
|
|
66
|
+
top: 0,
|
|
67
|
+
right: 0
|
|
68
|
+
},
|
|
69
|
+
onClick: onClose
|
|
70
|
+
}) : null), /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: "pisell-lowcode__eft-pay-fail-title"
|
|
72
|
+
}, failCustom.title || locales.getText('page.eftpos-pay.text.failed')(mode)), (failCustom === null || failCustom === void 0 ? void 0 : failCustom.status) === 'fail' ? /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "pisell-lowcode__eft-pay-fail-text pisell-lowcode__eft-pay-body"
|
|
74
|
+
}, failCustom === null || failCustom === void 0 ? void 0 : failCustom.fail) : (failCustom === null || failCustom === void 0 ? void 0 : failCustom.status) === 'warn' ? /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body"
|
|
76
|
+
}, failCustom === null || failCustom === void 0 ? void 0 : failCustom.warn) : null, failCustom !== null && failCustom !== void 0 && failCustom.isPosNetworkError ? /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
79
|
+
block: true,
|
|
80
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
81
|
+
onClick: onManually
|
|
82
|
+
}, locales.getText('page.eftpos-pay.text.manual.marking'))) : /*#__PURE__*/React.createElement("div", {
|
|
83
|
+
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
84
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
85
|
+
block: true,
|
|
86
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
87
|
+
onClick: onRetry
|
|
88
|
+
}, locales.getText('page.eftpos-pay.text.retry')), /*#__PURE__*/React.createElement(Button, {
|
|
89
|
+
block: true,
|
|
90
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
91
|
+
type: "primary",
|
|
92
|
+
onClick: onModify,
|
|
93
|
+
disabled: mode !== ModeEnum.Pay
|
|
94
|
+
}, locales.getText('page.eftpos-pay.text.modify.payment.info')(mode))));
|
|
95
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
/* eslint-disable no-nested-ternary */
|
|
8
|
+
import { locales } from '@pisell/utils';
|
|
9
|
+
import { Button } from 'antd';
|
|
10
|
+
import React, { useEffect } from 'react';
|
|
11
|
+
import XClose from '@pisell/icon/es/XClose';
|
|
12
|
+
import { getInitState } from "../../manufacturer";
|
|
13
|
+
import { useDispatch, useContextData, updateState, updateCustomStemItem, updateComponent } from "../../store";
|
|
14
|
+
import Header from "../header";
|
|
15
|
+
export default (function (_ref) {
|
|
16
|
+
var _steps$step, _steps$step$custom;
|
|
17
|
+
var onChange = _ref.onChange,
|
|
18
|
+
_ref$className = _ref.className,
|
|
19
|
+
className = _ref$className === void 0 ? '' : _ref$className;
|
|
20
|
+
var _useContextData = useContextData(),
|
|
21
|
+
eftpos = _useContextData.eftpos,
|
|
22
|
+
step = _useContextData.step,
|
|
23
|
+
steps = _useContextData.steps,
|
|
24
|
+
custom = _useContextData.custom,
|
|
25
|
+
mode = _useContextData.mode;
|
|
26
|
+
var isPosNetworkError = ((_steps$step = steps[step]) === null || _steps$step === void 0 ? void 0 : (_steps$step$custom = _steps$step.custom) === null || _steps$step$custom === void 0 ? void 0 : _steps$step$custom.isPosNetworkError) || false;
|
|
27
|
+
var dispatch = useDispatch();
|
|
28
|
+
var onRetry = function onRetry() {
|
|
29
|
+
onChange('page', 'pay');
|
|
30
|
+
dispatch(updateState(getInitState(eftpos, _objectSpread(_objectSpread({}, custom), {}, {
|
|
31
|
+
number: undefined
|
|
32
|
+
}))));
|
|
33
|
+
dispatch(updateCustomStemItem({
|
|
34
|
+
custom: {
|
|
35
|
+
status: undefined
|
|
36
|
+
},
|
|
37
|
+
step: step
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
var onModify = function onModify() {
|
|
41
|
+
dispatch(updateState(getInitState(eftpos, _objectSpread(_objectSpread({}, custom), {}, {
|
|
42
|
+
number: undefined
|
|
43
|
+
}))));
|
|
44
|
+
dispatch(updateCustomStemItem({
|
|
45
|
+
custom: {
|
|
46
|
+
status: undefined
|
|
47
|
+
},
|
|
48
|
+
step: step
|
|
49
|
+
}));
|
|
50
|
+
onChange('page', 'amount');
|
|
51
|
+
};
|
|
52
|
+
var onManually = function onManually() {
|
|
53
|
+
dispatch(updateState({
|
|
54
|
+
manual: {
|
|
55
|
+
title: locales.getText('page.eftpos-pay.text.timedout.title'),
|
|
56
|
+
text: locales.getText('page.eftpos-pay.text.timedout.text')(mode)
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
dispatch(updateComponent('Manual'));
|
|
60
|
+
};
|
|
61
|
+
var onClose = function onClose() {
|
|
62
|
+
// 支付失败页
|
|
63
|
+
onChange('fail');
|
|
64
|
+
};
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
onChange('page', 'fail');
|
|
67
|
+
}, []);
|
|
68
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: "pisell-lowcode__eft-pay-box ".concat(className)
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Header, {
|
|
71
|
+
status: steps[step].status
|
|
72
|
+
}, steps[step].status === 'fail' ? /*#__PURE__*/React.createElement(XClose, {
|
|
73
|
+
size: 20,
|
|
74
|
+
style: {
|
|
75
|
+
fontSize: '24px',
|
|
76
|
+
position: 'absolute',
|
|
77
|
+
top: 0,
|
|
78
|
+
right: 0
|
|
79
|
+
},
|
|
80
|
+
onClick: onClose
|
|
81
|
+
}) : null), /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: "pisell-lowcode__eft-pay-fail-title"
|
|
83
|
+
}, steps[step].title || locales.getText('page.eftpos-pay.text.failed')(mode)), steps[step].status === 'fail' ? /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: "pisell-lowcode__eft-pay-fail-text pisell-lowcode__eft-pay-body"
|
|
85
|
+
}, steps[step].fail) : steps[step].status === 'warn' ? /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body"
|
|
87
|
+
}, steps[step].warn) : null, isPosNetworkError ? /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
89
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
90
|
+
block: true,
|
|
91
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
92
|
+
onClick: onManually
|
|
93
|
+
}, locales.getText('page.eftpos-pay.text.manual.marking'))) : /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
95
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
96
|
+
block: true,
|
|
97
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
98
|
+
onClick: onRetry
|
|
99
|
+
}, locales.getText('page.eftpos-pay.text.retry')), /*#__PURE__*/React.createElement(Button, {
|
|
100
|
+
block: true,
|
|
101
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
102
|
+
type: "primary",
|
|
103
|
+
onClick: onModify
|
|
104
|
+
}, locales.getText('page.eftpos-pay.text.modify.payment.info')(mode))));
|
|
105
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { locales } from '@pisell/utils';
|
|
8
|
+
import React, { useEffect, useState } from 'react';
|
|
9
|
+
import { Button, message } from 'antd';
|
|
10
|
+
import Header from "../header";
|
|
11
|
+
export default (function (_ref) {
|
|
12
|
+
var _ref$className = _ref.className,
|
|
13
|
+
className = _ref$className === void 0 ? '' : _ref$className;
|
|
14
|
+
var _useState = useState(false),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
hasBtn = _useState2[0],
|
|
17
|
+
setBtn = _useState2[1];
|
|
18
|
+
useEffect(function () {
|
|
19
|
+
var clear = setTimeout(function () {
|
|
20
|
+
setBtn(true);
|
|
21
|
+
}, 1000);
|
|
22
|
+
return function () {
|
|
23
|
+
clearTimeout(clear);
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
26
|
+
var onReconnect = function onReconnect() {
|
|
27
|
+
message.open({
|
|
28
|
+
key: 'net-warning',
|
|
29
|
+
type: 'loading',
|
|
30
|
+
content: locales.getText('page.eftpos-pay.text.reconnecting')
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "pisell-lowcode__eft-pay-box ".concat(className)
|
|
35
|
+
}, /*#__PURE__*/React.createElement(Header, {
|
|
36
|
+
status: "warn"
|
|
37
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: "pisell-lowcode__eft-pay-fail-title"
|
|
39
|
+
}, locales.getText('page.eftpos-pay.text.network.disconnected')), /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body"
|
|
41
|
+
}, locales.getText('page.eftpos-pay.text.waiting.wifi.title'), " ", /*#__PURE__*/React.createElement("br", null), locales.getText('page.eftpos-pay.text.waiting.wifi.connection'), /*#__PURE__*/React.createElement("br", null), locales.getText('page.eftpos-pay.text.waiting.wifi.router'), /*#__PURE__*/React.createElement("br", null), locales.getText('page.eftpos-pay.text.waiting.wifi.forget.reconnect')), hasBtn ? /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
43
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
44
|
+
block: true,
|
|
45
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
46
|
+
onClick: onReconnect
|
|
47
|
+
}, locales.getText('page.eftpos-pay.text.reconnect.network'))) : null);
|
|
48
|
+
});
|