@pisell/private-materials 3.0.202 → 3.0.204
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +27 -12
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +33 -18
- package/es/components/booking/components/customSelect/index.d.ts +0 -1
- package/es/components/booking/components/customSelect/index.js +2 -6
- package/es/components/booking/components/footer/amount.js +22 -46
- package/es/components/booking/components/footer/index.js +40 -84
- package/es/components/booking/components/footer/utils.js +35 -266
- package/es/components/booking/forms/model.d.ts +1 -1
- package/es/components/booking/info/addServiceVariant/index.js +1 -8
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +0 -1
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +13 -14
- package/es/components/booking/info/clientVariant/vertical/index.js +9 -124
- package/es/components/booking/info/main.js +15 -28
- package/es/components/booking/info/model.js +0 -3
- package/es/components/booking/info/pet/index.js +5 -54
- package/es/components/booking/info/service/addService/index.js +96 -187
- package/es/components/booking/info/service/addService/index.less +3 -13
- package/es/components/booking/info/service/addService/utils.d.ts +2 -12
- package/es/components/booking/info/service/addService/utils.js +26 -103
- package/es/components/booking/info/service/editService/index.js +132 -435
- package/es/components/booking/info/service/editService/index.less +13 -18
- package/es/components/booking/info/service/serve.d.ts +0 -10
- package/es/components/booking/info/service/serve.js +0 -28
- package/es/components/booking/info/utils.d.ts +0 -20
- package/es/components/booking/info/utils.js +0 -37
- package/es/components/booking/locales.d.ts +0 -66
- package/es/components/booking/locales.js +3 -81
- package/es/components/booking/model.d.ts +1 -5
- package/es/components/booking/model.js +2 -4
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +1 -1
- package/es/components/booking/payments/model.d.ts +1 -1
- package/es/components/booking/utils.d.ts +3 -12
- package/es/components/booking/utils.js +26 -143
- package/es/components/eftpos/form/index.js +12 -6
- package/es/components/eftpos/group/index.d.ts +1 -2
- package/es/components/eftpos/group/index.js +1 -2
- package/es/components/eftpos/hooks.d.ts +4 -4
- package/es/components/eftpos/index.js +2 -2
- package/es/components/eftpos/receipt/index.d.ts +24 -0
- package/es/components/eftpos/receipt/index.js +96 -0
- package/es/components/eftposPay/app.d.ts +11 -0
- package/es/components/eftposPay/app.js +173 -0
- package/es/components/eftposPay/component/fail/failCustom.js +1 -0
- package/es/components/eftposPay/component/fail/index.js +1 -0
- package/es/components/eftposPay/component/manual/index.js +4 -1
- package/es/components/eftposPay/component/step/index.d.ts +6 -6
- package/es/components/eftposPay/component/step/step.d.ts +4 -4
- package/es/components/eftposPay/const.d.ts +27 -1
- package/es/components/eftposPay/const.js +22 -0
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/device.js +2 -2
- package/es/components/eftposPay/helper.d.ts +6 -0
- package/es/components/eftposPay/helper.js +24 -4
- package/es/components/eftposPay/hooks.d.ts +2 -1
- package/es/components/eftposPay/hooks.js +22 -16
- package/es/components/eftposPay/index.d.ts +1 -1
- package/es/components/eftposPay/index.js +130 -179
- package/es/components/eftposPay/locales.d.ts +15 -0
- package/es/components/eftposPay/locales.js +15 -0
- package/es/components/eftposPay/payo/config.js +20 -8
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eftposPay/tip.d.ts +10 -0
- package/es/components/eftposPay/tip.js +177 -0
- package/es/components/eftposPay/tip.less +9 -0
- package/es/components/eftposPay/tyro/hooks.d.ts +2 -2
- package/es/components/eftposPay/tyro/index.js +55 -22
- package/es/components/eftposPay/windcave/helper.d.ts +1 -1
- package/es/components/eftposPay/windcave/windcave.js +17 -6
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -1
- package/es/index.d.ts +0 -1
- package/es/index.js +1 -2
- package/lib/components/booking/components/customSelect/index.d.ts +0 -1
- package/lib/components/booking/components/customSelect/index.js +2 -6
- package/lib/components/booking/components/footer/amount.js +8 -27
- package/lib/components/booking/components/footer/index.js +4 -25
- package/lib/components/booking/components/footer/utils.js +35 -161
- package/lib/components/booking/forms/model.d.ts +1 -1
- package/lib/components/booking/info/addServiceVariant/index.js +0 -5
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +0 -1
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +7 -8
- package/lib/components/booking/info/clientVariant/vertical/index.js +11 -87
- package/lib/components/booking/info/main.js +9 -17
- package/lib/components/booking/info/model.js +0 -3
- package/lib/components/booking/info/pet/index.js +25 -61
- package/lib/components/booking/info/service/addService/index.js +84 -115
- package/lib/components/booking/info/service/addService/index.less +3 -13
- package/lib/components/booking/info/service/addService/utils.d.ts +2 -12
- package/lib/components/booking/info/service/addService/utils.js +10 -58
- package/lib/components/booking/info/service/editService/index.js +182 -425
- package/lib/components/booking/info/service/editService/index.less +13 -18
- package/lib/components/booking/info/service/serve.d.ts +0 -10
- package/lib/components/booking/info/service/serve.js +2 -7
- package/lib/components/booking/info/utils.d.ts +0 -20
- package/lib/components/booking/info/utils.js +0 -41
- package/lib/components/booking/locales.d.ts +0 -66
- package/lib/components/booking/locales.js +3 -69
- package/lib/components/booking/model.d.ts +1 -5
- package/lib/components/booking/model.js +2 -4
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +1 -1
- package/lib/components/booking/payments/model.d.ts +1 -1
- package/lib/components/booking/utils.d.ts +3 -12
- package/lib/components/booking/utils.js +18 -89
- package/lib/components/eftpos/form/index.js +12 -6
- package/lib/components/eftpos/group/index.d.ts +1 -2
- package/lib/components/eftpos/group/index.js +0 -1
- package/lib/components/eftpos/hooks.d.ts +4 -4
- package/lib/components/eftpos/index.js +2 -2
- package/lib/components/eftpos/receipt/index.d.ts +24 -0
- package/lib/components/eftpos/receipt/index.js +88 -0
- package/lib/components/eftposPay/app.d.ts +11 -0
- package/lib/components/eftposPay/app.js +166 -0
- package/lib/components/eftposPay/component/fail/failCustom.js +1 -1
- package/lib/components/eftposPay/component/fail/index.js +1 -1
- package/lib/components/eftposPay/component/manual/index.js +19 -5
- package/lib/components/eftposPay/component/step/index.d.ts +6 -6
- package/lib/components/eftposPay/component/step/step.d.ts +4 -4
- package/lib/components/eftposPay/const.d.ts +27 -1
- package/lib/components/eftposPay/const.js +18 -0
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/device.js +2 -2
- package/lib/components/eftposPay/helper.d.ts +6 -0
- package/lib/components/eftposPay/helper.js +29 -4
- package/lib/components/eftposPay/hooks.d.ts +2 -1
- package/lib/components/eftposPay/hooks.js +8 -2
- package/lib/components/eftposPay/index.d.ts +1 -1
- package/lib/components/eftposPay/index.js +106 -144
- package/lib/components/eftposPay/locales.d.ts +15 -0
- package/lib/components/eftposPay/locales.js +15 -0
- package/lib/components/eftposPay/payo/config.js +33 -9
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eftposPay/tip.d.ts +10 -0
- package/lib/components/eftposPay/tip.js +159 -0
- package/lib/components/eftposPay/tip.less +9 -0
- package/lib/components/eftposPay/tyro/hooks.d.ts +2 -2
- package/lib/components/eftposPay/tyro/index.js +40 -9
- package/lib/components/eftposPay/windcave/helper.d.ts +1 -1
- package/lib/components/eftposPay/windcave/windcave.js +29 -6
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -3
- package/package.json +4 -4
- package/es/components/booking/components/footer/AppointmentProductModal/index.d.ts +0 -3
- package/es/components/booking/components/footer/AppointmentProductModal/index.js +0 -38
- package/es/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/es/components/booking/info/Provider.d.ts +0 -0
- package/es/components/booking/info/Provider.js +0 -54
- package/es/components/booking/info/dateRange/index.d.ts +0 -5
- package/es/components/booking/info/dateRange/index.js +0 -98
- package/es/components/booking/info/dateRange/index.less +0 -21
- package/es/components/booking/info/pet/ChangePetModal/index.d.ts +0 -4
- package/es/components/booking/info/pet/ChangePetModal/index.js +0 -134
- package/es/components/booking/info/pet/ChangePetModal/index.less +0 -4
- package/es/components/booking/info/service/editService/BookingList/index.d.ts +0 -5
- package/es/components/booking/info/service/editService/BookingList/index.js +0 -39
- package/es/components/booking/info/service/editService/EditTabs/index.d.ts +0 -3
- package/es/components/booking/info/service/editService/EditTabs/index.js +0 -35
- package/es/components/booking/info/service/serviceManager/distributeDiscount.d.ts +0 -11
- package/es/components/booking/info/service/serviceManager/distributeDiscount.js +0 -55
- package/es/components/booking/info/service/serviceManager/index.d.ts +0 -20
- package/es/components/booking/info/service/serviceManager/index.js +0 -277
- package/es/components/booking/info/service/serviceManager/utils.d.ts +0 -0
- package/es/components/booking/info/service/serviceManager/utils.js +0 -0
- package/es/components/booking/info/service2/Group/utils.d.ts +0 -14
- package/es/components/booking/info/service2/Group/utils.js +0 -146
- package/es/components/booking/info/service2/Lists.d.ts +0 -3
- package/es/components/booking/info/service2/Lists.js +0 -152
- package/es/components/booking/info/service2/hooks/useSelectPet.d.ts +0 -6
- package/es/components/booking/info/service2/hooks/useSelectPet.js +0 -54
- package/es/components/booking/info/service2/index.d.ts +0 -6
- package/es/components/booking/info/service2/index.js +0 -57
- package/es/components/booking/info/service2/status.d.ts +0 -31
- package/es/components/booking/info/service2/status.js +0 -78
- package/es/components/booking/info/service2/utils.d.ts +0 -237
- package/es/components/booking/info/service2/utils.js +0 -1062
- package/es/components/booking/materiels/holder/index.d.ts +0 -7
- package/es/components/booking/materiels/holder/index.js +0 -51
- package/es/components/shoppingCart/Provider.d.ts +0 -3
- package/es/components/shoppingCart/Provider.js +0 -86
- package/es/components/shoppingCart/components/Cart/Product.d.ts +0 -4
- package/es/components/shoppingCart/components/Cart/Product.js +0 -68
- package/es/components/shoppingCart/components/Cart/index.d.ts +0 -4
- package/es/components/shoppingCart/components/Cart/index.js +0 -72
- package/es/components/shoppingCart/components/Cart/index.less +0 -68
- package/es/components/shoppingCart/components/Empty/index.d.ts +0 -4
- package/es/components/shoppingCart/components/Empty/index.js +0 -14
- package/es/components/shoppingCart/components/Empty/index.less +0 -19
- package/es/components/shoppingCart/components/Render/index.d.ts +0 -4
- package/es/components/shoppingCart/components/Render/index.js +0 -69
- package/es/components/shoppingCart/components/Render/index.less +0 -2
- package/es/components/shoppingCart/components/SelectHolderModal/index.d.ts +0 -4
- package/es/components/shoppingCart/components/SelectHolderModal/index.js +0 -132
- package/es/components/shoppingCart/components/SelectHolderModal/index.less +0 -32
- package/es/components/shoppingCart/hooks/useAddService.d.ts +0 -3
- package/es/components/shoppingCart/hooks/useAddService.js +0 -23
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +0 -3
- package/es/components/shoppingCart/hooks/useClearCart.js +0 -59
- package/es/components/shoppingCart/hooks/useContext.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useContext.js +0 -5
- package/es/components/shoppingCart/index.d.ts +0 -4
- package/es/components/shoppingCart/index.js +0 -24
- package/es/components/shoppingCart/locales.d.ts +0 -33
- package/es/components/shoppingCart/locales.js +0 -38
- package/es/components/shoppingCart/mock.d.ts +0 -40
- package/es/components/shoppingCart/mock.js +0 -40
- package/es/components/shoppingCart/status.d.ts +0 -2
- package/es/components/shoppingCart/status.js +0 -22
- package/es/components/shoppingCart/type.d.ts +0 -39
- package/es/components/shoppingCart/type.js +0 -1
- package/es/components/shoppingCart/utils.d.ts +0 -63
- package/es/components/shoppingCart/utils.js +0 -116
- package/lib/components/booking/components/footer/AppointmentProductModal/index.d.ts +0 -3
- package/lib/components/booking/components/footer/AppointmentProductModal/index.js +0 -60
- package/lib/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/lib/components/booking/info/Provider.d.ts +0 -0
- package/lib/components/booking/info/Provider.js +0 -0
- package/lib/components/booking/info/dateRange/index.d.ts +0 -5
- package/lib/components/booking/info/dateRange/index.js +0 -111
- package/lib/components/booking/info/dateRange/index.less +0 -21
- package/lib/components/booking/info/pet/ChangePetModal/index.d.ts +0 -4
- package/lib/components/booking/info/pet/ChangePetModal/index.js +0 -121
- package/lib/components/booking/info/pet/ChangePetModal/index.less +0 -4
- package/lib/components/booking/info/service/editService/BookingList/index.d.ts +0 -5
- package/lib/components/booking/info/service/editService/BookingList/index.js +0 -55
- package/lib/components/booking/info/service/editService/EditTabs/index.d.ts +0 -3
- package/lib/components/booking/info/service/editService/EditTabs/index.js +0 -75
- package/lib/components/booking/info/service/serviceManager/distributeDiscount.d.ts +0 -11
- package/lib/components/booking/info/service/serviceManager/distributeDiscount.js +0 -70
- package/lib/components/booking/info/service/serviceManager/index.d.ts +0 -20
- package/lib/components/booking/info/service/serviceManager/index.js +0 -207
- package/lib/components/booking/info/service/serviceManager/utils.d.ts +0 -0
- package/lib/components/booking/info/service/serviceManager/utils.js +0 -0
- package/lib/components/booking/info/service2/Group/utils.d.ts +0 -14
- package/lib/components/booking/info/service2/Group/utils.js +0 -142
- package/lib/components/booking/info/service2/Lists.d.ts +0 -3
- package/lib/components/booking/info/service2/Lists.js +0 -115
- package/lib/components/booking/info/service2/hooks/useSelectPet.d.ts +0 -6
- package/lib/components/booking/info/service2/hooks/useSelectPet.js +0 -50
- package/lib/components/booking/info/service2/index.d.ts +0 -6
- package/lib/components/booking/info/service2/index.js +0 -75
- package/lib/components/booking/info/service2/status.d.ts +0 -31
- package/lib/components/booking/info/service2/status.js +0 -81
- package/lib/components/booking/info/service2/utils.d.ts +0 -237
- package/lib/components/booking/info/service2/utils.js +0 -675
- package/lib/components/booking/materiels/holder/index.d.ts +0 -7
- package/lib/components/booking/materiels/holder/index.js +0 -65
- package/lib/components/shoppingCart/Provider.d.ts +0 -3
- package/lib/components/shoppingCart/Provider.js +0 -110
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +0 -4
- package/lib/components/shoppingCart/components/Cart/Product.js +0 -73
- package/lib/components/shoppingCart/components/Cart/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/Cart/index.js +0 -77
- package/lib/components/shoppingCart/components/Cart/index.less +0 -68
- package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/Empty/index.js +0 -43
- package/lib/components/shoppingCart/components/Empty/index.less +0 -19
- package/lib/components/shoppingCart/components/Render/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/Render/index.js +0 -75
- package/lib/components/shoppingCart/components/Render/index.less +0 -2
- package/lib/components/shoppingCart/components/SelectHolderModal/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/SelectHolderModal/index.js +0 -124
- package/lib/components/shoppingCart/components/SelectHolderModal/index.less +0 -32
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +0 -3
- package/lib/components/shoppingCart/hooks/useAddService.js +0 -55
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +0 -3
- package/lib/components/shoppingCart/hooks/useClearCart.js +0 -66
- package/lib/components/shoppingCart/hooks/useContext.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useContext.js +0 -31
- package/lib/components/shoppingCart/index.d.ts +0 -4
- package/lib/components/shoppingCart/index.js +0 -60
- package/lib/components/shoppingCart/locales.d.ts +0 -33
- package/lib/components/shoppingCart/locales.js +0 -56
- package/lib/components/shoppingCart/mock.d.ts +0 -40
- package/lib/components/shoppingCart/mock.js +0 -76
- package/lib/components/shoppingCart/status.d.ts +0 -2
- package/lib/components/shoppingCart/status.js +0 -60
- package/lib/components/shoppingCart/type.d.ts +0 -39
- package/lib/components/shoppingCart/type.js +0 -17
- package/lib/components/shoppingCart/utils.d.ts +0 -63
- package/lib/components/shoppingCart/utils.js +0 -86
- package/lowcode/shopping-cart/meta.ts +0 -98
|
@@ -34,67 +34,33 @@ __export(eftposPay_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(eftposPay_exports);
|
|
35
35
|
var import_utils = require("@pisell/utils");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
|
-
var import_ahooks = require("ahooks");
|
|
38
37
|
var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
|
|
39
|
-
var
|
|
38
|
+
var import_app = __toESM(require("./app"));
|
|
39
|
+
var import_tip = __toESM(require("./tip"));
|
|
40
40
|
var import_const = require("./const");
|
|
41
|
-
var import_device = __toESM(require("./device"));
|
|
42
41
|
var import_locales = __toESM(require("./locales"));
|
|
43
42
|
var import_manufacturer = require("./manufacturer");
|
|
44
|
-
var import_pay = __toESM(require("./pay"));
|
|
45
43
|
var import_store = require("./store");
|
|
46
44
|
var import_index = require("./index.less");
|
|
47
45
|
import_utils.locales.init(import_locales.default, localStorage.getItem("umi_locale") || "en");
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
tyroUrl,
|
|
54
|
-
tyroVersion,
|
|
55
|
-
onChangeParams,
|
|
56
|
-
...props
|
|
57
|
-
}) => {
|
|
58
|
-
var _a;
|
|
59
|
-
const data = (0, import_store.useContextData)();
|
|
60
|
-
const dispatch = (0, import_store.useDispatch)();
|
|
61
|
-
const [current, setCurrent] = (0, import_react.useState)(action);
|
|
62
|
-
const statusRef = (0, import_react.useRef)(data.status);
|
|
46
|
+
var eftposPay_default = (props) => {
|
|
47
|
+
var _a, _b, _c, _d, _e, _f;
|
|
48
|
+
const [check, setCheckStatus] = (0, import_react.useState)(
|
|
49
|
+
props.type === import_const.EftposEnum.Tyro ? import_const.OrderEumn.Null : props.source === import_const.RestoreEumn.Restore ? import_const.OrderEumn.Restore : import_const.OrderEumn.Normal
|
|
50
|
+
);
|
|
63
51
|
const context = (0, import_useEngineContext.default)();
|
|
52
|
+
const [cardSurcharge, setCardSurcharge] = (0, import_react.useState)(0);
|
|
53
|
+
const [receipt, setReceipt] = (0, import_react.useState)([]);
|
|
54
|
+
const [updateTime, setTime] = (0, import_react.useState)("");
|
|
64
55
|
console.log("context = ", context);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
formatAmount: (number, precision, symbol) => `${symbol}${number}`,
|
|
56
|
+
const [historyData, setHistory] = (0, import_react.useState)();
|
|
57
|
+
const { formatAmount, storage, store } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {
|
|
58
|
+
store: {},
|
|
59
|
+
formatAmount: (number, precision, symbol2) => `${symbol2}${number}`,
|
|
70
60
|
storage: () => ({
|
|
71
61
|
get: () => ""
|
|
72
62
|
})
|
|
73
63
|
};
|
|
74
|
-
const network = (0, import_react.useMemo)(
|
|
75
|
-
() => typeof terminal.network === "boolean" ? terminal.network : true,
|
|
76
|
-
[terminal == null ? void 0 : terminal.network]
|
|
77
|
-
);
|
|
78
|
-
const { online } = (0, import_ahooks.useNetwork)();
|
|
79
|
-
const netRef = (0, import_react.useRef)([network, online]);
|
|
80
|
-
const net = (0, import_react.useMemo)(() => {
|
|
81
|
-
let networkChange = false, onlineChange = false;
|
|
82
|
-
if (netRef.current[0] !== network) {
|
|
83
|
-
netRef.current[0] = network;
|
|
84
|
-
networkChange = true;
|
|
85
|
-
}
|
|
86
|
-
if (netRef.current[1] !== online) {
|
|
87
|
-
netRef.current[1] = online;
|
|
88
|
-
onlineChange = true;
|
|
89
|
-
}
|
|
90
|
-
if (networkChange) {
|
|
91
|
-
return network;
|
|
92
|
-
}
|
|
93
|
-
return online;
|
|
94
|
-
}, [network, online]);
|
|
95
|
-
(0, import_react.useEffect)(() => {
|
|
96
|
-
statusRef.current = data.status;
|
|
97
|
-
}, [data.status]);
|
|
98
64
|
const channel = (0, import_react.useMemo)(() => {
|
|
99
65
|
var _a2;
|
|
100
66
|
const channel2 = ((_a2 = storage == null ? void 0 : storage.get) == null ? void 0 : _a2.call(storage, "channel")) || "";
|
|
@@ -106,99 +72,10 @@ var App = ({
|
|
|
106
72
|
}
|
|
107
73
|
return "";
|
|
108
74
|
}, []);
|
|
109
|
-
const client = (0, import_react.useMemo)(() => {
|
|
110
|
-
if (channel === "kiosk") {
|
|
111
|
-
return import_const.ClientEnum.User;
|
|
112
|
-
}
|
|
113
|
-
return import_const.ClientEnum.Merchant;
|
|
114
|
-
}, [channel]);
|
|
115
|
-
(0, import_react.useEffect)(() => {
|
|
116
|
-
dispatch((0, import_store.updateClient)(client));
|
|
117
|
-
}, [client]);
|
|
118
75
|
const isMobile = (0, import_react.useMemo)(() => Boolean(channel), [channel]);
|
|
119
|
-
const api = (0, import_react.useMemo)(() => {
|
|
120
|
-
if (typeof getApi === "function") {
|
|
121
|
-
return getApi();
|
|
122
|
-
}
|
|
123
|
-
return {};
|
|
124
|
-
}, [getApi]);
|
|
125
|
-
(0, import_react.useEffect)(() => {
|
|
126
|
-
onChangeParams && onChangeParams({
|
|
127
|
-
...data,
|
|
128
|
-
...data.eftpos === "tyro" ? { custom: { ...data.custom, btnList: [], list: [] } } : {},
|
|
129
|
-
form: "restore"
|
|
130
|
-
});
|
|
131
|
-
}, [data, onChangeParams]);
|
|
132
|
-
const onChange = (0, import_react.useCallback)((status, params, other) => {
|
|
133
|
-
if (status === "page" && typeof params === "string") {
|
|
134
|
-
if (["amount", "deviceList", "pay"].includes(params)) {
|
|
135
|
-
setCurrent(params);
|
|
136
|
-
dispatch((0, import_store.updateState)({ action: params }));
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
console.log("状态切换 = ", status, params, other);
|
|
140
|
-
props.onChangeStatus(status, params, other);
|
|
141
|
-
}, []);
|
|
142
|
-
const onClose = () => {
|
|
143
|
-
onChange("fail", {
|
|
144
|
-
number: data.number,
|
|
145
|
-
device: data.device,
|
|
146
|
-
order_id: data.order_id
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
if (current === import_const.RouteEnum.DeviceList) {
|
|
150
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
151
|
-
import_device.default,
|
|
152
|
-
{
|
|
153
|
-
api,
|
|
154
|
-
onChange,
|
|
155
|
-
onClose,
|
|
156
|
-
isMobile,
|
|
157
|
-
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
|
|
158
|
-
net,
|
|
159
|
-
device_number,
|
|
160
|
-
formatAmount,
|
|
161
|
-
client
|
|
162
|
-
}
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
if (current === import_const.RouteEnum.Amount) {
|
|
166
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
167
|
-
import_amount.default,
|
|
168
|
-
{
|
|
169
|
-
onChange,
|
|
170
|
-
onClose,
|
|
171
|
-
formatAmount,
|
|
172
|
-
isMobile,
|
|
173
|
-
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
|
|
174
|
-
net,
|
|
175
|
-
client
|
|
176
|
-
}
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
180
|
-
import_pay.default,
|
|
181
|
-
{
|
|
182
|
-
api,
|
|
183
|
-
tyroUrl,
|
|
184
|
-
tyroVersion,
|
|
185
|
-
onChange,
|
|
186
|
-
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
|
|
187
|
-
terminal,
|
|
188
|
-
isMobile,
|
|
189
|
-
net,
|
|
190
|
-
formatAmount,
|
|
191
|
-
client
|
|
192
|
-
}
|
|
193
|
-
);
|
|
194
|
-
};
|
|
195
|
-
var eftposPay_default = (props) => {
|
|
196
|
-
var _a, _b, _c, _d, _e, _f;
|
|
197
|
-
const context = (0, import_useEngineContext.default)();
|
|
198
|
-
const { store } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || { store: {} };
|
|
199
76
|
const symbol = ((_d = (_c = (_b = store == null ? void 0 : store.getState) == null ? void 0 : _b.call(store)) == null ? void 0 : _c.global) == null ? void 0 : _d.symbol) || "$";
|
|
200
77
|
const mode = (0, import_react.useMemo)(() => {
|
|
201
|
-
if (props.source ===
|
|
78
|
+
if (props.source === import_const.RestoreEumn.Restore) {
|
|
202
79
|
if (props.params) {
|
|
203
80
|
if (props.params.mode) {
|
|
204
81
|
return props.params.mode;
|
|
@@ -213,7 +90,7 @@ var eftposPay_default = (props) => {
|
|
|
213
90
|
}, [props.mode, props.source, props.params]);
|
|
214
91
|
const state = (0, import_react.useMemo)(() => {
|
|
215
92
|
const current = props.params && props.params.symbol ? props.params.symbol : symbol;
|
|
216
|
-
if (props.source ===
|
|
93
|
+
if (props.source === import_const.RestoreEumn.Restore) {
|
|
217
94
|
return props.params;
|
|
218
95
|
}
|
|
219
96
|
return (0, import_manufacturer.getInitState)(
|
|
@@ -221,6 +98,10 @@ var eftposPay_default = (props) => {
|
|
|
221
98
|
props.params ? { mode, ...props.params, symbol: current } : { mode, symbol: current }
|
|
222
99
|
);
|
|
223
100
|
}, [mode, props.params, props.type, symbol]);
|
|
101
|
+
const stateRef = (0, import_react.useRef)(state);
|
|
102
|
+
(0, import_react.useEffect)(() => {
|
|
103
|
+
stateRef.current = state;
|
|
104
|
+
}, [state]);
|
|
224
105
|
const onChangeStatus = (0, import_react.useCallback)(
|
|
225
106
|
(status, params, other) => {
|
|
226
107
|
props.onChangeStatus(status, params, other);
|
|
@@ -256,22 +137,103 @@ var eftposPay_default = (props) => {
|
|
|
256
137
|
return act;
|
|
257
138
|
}, [mode, state]);
|
|
258
139
|
(0, import_react.useEffect)(() => {
|
|
140
|
+
document.body.id = "body";
|
|
259
141
|
console.log("初始化 ........11221801");
|
|
260
142
|
}, []);
|
|
261
143
|
console.log("props?.params?.device_number = ", (_e = props == null ? void 0 : props.params) == null ? void 0 : _e.device_number);
|
|
262
|
-
|
|
263
|
-
|
|
144
|
+
const api = (0, import_react.useMemo)(() => {
|
|
145
|
+
if (typeof props.getApi === "function") {
|
|
146
|
+
return props.getApi();
|
|
147
|
+
}
|
|
148
|
+
return {};
|
|
149
|
+
}, [props.getApi]);
|
|
150
|
+
(0, import_react.useEffect)(() => {
|
|
151
|
+
if (props.source === import_const.RestoreEumn.Restore || props.type === import_const.EftposEnum.Tyro) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
api.getTransaction({
|
|
155
|
+
order_id: stateRef.current.order_id,
|
|
156
|
+
card_reader_type: stateRef.current.eftpos,
|
|
157
|
+
receive_status: "unprocessed"
|
|
158
|
+
}).then((res) => {
|
|
159
|
+
if (!Array.isArray(res.data) || res.data.length === 0) {
|
|
160
|
+
setCheckStatus(import_const.OrderEumn.Null);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const currentMode = stateRef.current.mode === import_const.ModeEnum.FullPay ? import_const.ModeEnum.Pay : stateRef.current.mode;
|
|
164
|
+
const list = res.data.filter(
|
|
165
|
+
(item) => item.action === currentMode
|
|
166
|
+
);
|
|
167
|
+
if (list.length === 0) {
|
|
168
|
+
setCheckStatus(import_const.OrderEumn.Null);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const latest = list.pop();
|
|
172
|
+
const numberList = list.map((item) => item.number);
|
|
173
|
+
if (latest.status === import_const.OrderEumn.Failed) {
|
|
174
|
+
setCheckStatus(latest.status);
|
|
175
|
+
onChangeStatus("mark_tx_processed", [
|
|
176
|
+
...numberList,
|
|
177
|
+
latest.number
|
|
178
|
+
]);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (list.length > 0) {
|
|
182
|
+
onChangeStatus("mark_tx_processed", numberList);
|
|
183
|
+
}
|
|
184
|
+
const { pay_param_base64, card_reader_surcharge, receipt: receipt2 } = (latest == null ? void 0 : latest.metadata) || {};
|
|
185
|
+
setTime(latest.updated_at);
|
|
186
|
+
setCardSurcharge(card_reader_surcharge || 0);
|
|
187
|
+
setReceipt(receipt2 || []);
|
|
188
|
+
if (!pay_param_base64) {
|
|
189
|
+
setCheckStatus(import_const.OrderEumn.Failed);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
const data = JSON.parse(
|
|
194
|
+
decodeURIComponent(atob(decodeURIComponent(pay_param_base64)))
|
|
195
|
+
);
|
|
196
|
+
setHistory(data);
|
|
197
|
+
setCheckStatus(latest.status);
|
|
198
|
+
} catch (e) {
|
|
199
|
+
setCheckStatus(import_const.OrderEumn.Failed);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}, []);
|
|
204
|
+
if (check === import_const.OrderEumn.Normal) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
if (check === import_const.OrderEumn.Succeed) {
|
|
208
|
+
return /* @__PURE__ */ import_react.default.createElement(import_store.Provider, { state: historyData }, /* @__PURE__ */ import_react.default.createElement(
|
|
209
|
+
import_tip.default,
|
|
210
|
+
{
|
|
211
|
+
cardSurcharge,
|
|
212
|
+
receipts: receipt,
|
|
213
|
+
onChangeStatus,
|
|
214
|
+
onChangeParams: props.onChangeParams,
|
|
215
|
+
formatAmount,
|
|
216
|
+
successTime: updateTime,
|
|
217
|
+
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : ""
|
|
218
|
+
}
|
|
219
|
+
));
|
|
220
|
+
}
|
|
221
|
+
return /* @__PURE__ */ import_react.default.createElement(import_store.Provider, { state: check === import_const.OrderEumn.Pending ? historyData : state }, /* @__PURE__ */ import_react.default.createElement(
|
|
222
|
+
import_app.default,
|
|
264
223
|
{
|
|
265
|
-
|
|
224
|
+
api,
|
|
225
|
+
channel,
|
|
266
226
|
params: props.params,
|
|
267
227
|
onChangeStatus,
|
|
268
228
|
terminal: props.terminal,
|
|
269
229
|
onChangeParams: props.onChangeParams,
|
|
270
|
-
action,
|
|
230
|
+
action: check === import_const.OrderEumn.Pending ? import_const.ModeEnum.Pay : action,
|
|
271
231
|
source: props.source,
|
|
272
232
|
tyroUrl: props.tyroUrl,
|
|
273
233
|
tyroVersion: props.tyroVersion,
|
|
274
|
-
device_number: (_f = props == null ? void 0 : props.params) == null ? void 0 : _f.device_number
|
|
234
|
+
device_number: (_f = props == null ? void 0 : props.params) == null ? void 0 : _f.device_number,
|
|
235
|
+
isMobile,
|
|
236
|
+
formatAmount
|
|
275
237
|
}
|
|
276
238
|
));
|
|
277
239
|
};
|
|
@@ -54,6 +54,11 @@ declare const _default: {
|
|
|
54
54
|
'page.eftpos-pay.text.sure': string;
|
|
55
55
|
'page.eftpos-pay.text.device': string;
|
|
56
56
|
'page.eftpos-pay.text.leave': string;
|
|
57
|
+
'page.eftpos-pay.text.latest.success': string;
|
|
58
|
+
'page.eftpos-pay.text.latest.amount': string;
|
|
59
|
+
'page.eftpos-pay.text.latest.surcharge': string;
|
|
60
|
+
'page.eftpos-pay.text.latest.time': string;
|
|
61
|
+
'page.eftpos-pay.text.latest.confirm': string;
|
|
57
62
|
'page.eftpos-pay.text.amount.to.pay': string;
|
|
58
63
|
'page.eftpos-pay.text.surcharge.percentage': string;
|
|
59
64
|
'page.eftpos-pay.text.surcharge.fixed': string;
|
|
@@ -158,6 +163,11 @@ declare const _default: {
|
|
|
158
163
|
'page.eftpos-pay.text.sure': string;
|
|
159
164
|
'page.eftpos-pay.text.device': string;
|
|
160
165
|
'page.eftpos-pay.text.leave': string;
|
|
166
|
+
'page.eftpos-pay.text.latest.success': string;
|
|
167
|
+
'page.eftpos-pay.text.latest.amount': string;
|
|
168
|
+
'page.eftpos-pay.text.latest.surcharge': string;
|
|
169
|
+
'page.eftpos-pay.text.latest.time': string;
|
|
170
|
+
'page.eftpos-pay.text.latest.confirm': string;
|
|
161
171
|
'page.eftpos-pay.text.amount.to.pay': string;
|
|
162
172
|
'page.eftpos-pay.text.surcharge.percentage': string;
|
|
163
173
|
'page.eftpos-pay.text.surcharge.fixed': string;
|
|
@@ -262,6 +272,11 @@ declare const _default: {
|
|
|
262
272
|
'page.eftpos-pay.text.sure': string;
|
|
263
273
|
'page.eftpos-pay.text.device': string;
|
|
264
274
|
'page.eftpos-pay.text.leave': string;
|
|
275
|
+
'page.eftpos-pay.text.latest.success': string;
|
|
276
|
+
'page.eftpos-pay.text.latest.amount': string;
|
|
277
|
+
'page.eftpos-pay.text.latest.surcharge': string;
|
|
278
|
+
'page.eftpos-pay.text.latest.time': string;
|
|
279
|
+
'page.eftpos-pay.text.latest.confirm': string;
|
|
265
280
|
'page.eftpos-pay.text.amount.to.pay': string;
|
|
266
281
|
'page.eftpos-pay.text.surcharge.percentage': string;
|
|
267
282
|
'page.eftpos-pay.text.surcharge.fixed': string;
|
|
@@ -78,6 +78,11 @@ var locales_default = {
|
|
|
78
78
|
"page.eftpos-pay.text.sure": "Sure",
|
|
79
79
|
"page.eftpos-pay.text.device": "Please select device",
|
|
80
80
|
"page.eftpos-pay.text.leave": "Please do not leave this page",
|
|
81
|
+
"page.eftpos-pay.text.latest.success": "A Successful Payment Detected for This Order!",
|
|
82
|
+
"page.eftpos-pay.text.latest.amount": "Amount",
|
|
83
|
+
"page.eftpos-pay.text.latest.surcharge": "Surcharge",
|
|
84
|
+
"page.eftpos-pay.text.latest.time": "Time",
|
|
85
|
+
"page.eftpos-pay.text.latest.confirm": "Confirm",
|
|
81
86
|
"page.eftpos-pay.text.amount.to.pay": "Amount to pay",
|
|
82
87
|
"page.eftpos-pay.text.surcharge.percentage": "Percentage",
|
|
83
88
|
"page.eftpos-pay.text.surcharge.fixed": "Fixed",
|
|
@@ -187,6 +192,11 @@ var locales_default = {
|
|
|
187
192
|
"page.eftpos-pay.text.sure": "确定",
|
|
188
193
|
"page.eftpos-pay.text.device": "请选择设备",
|
|
189
194
|
"page.eftpos-pay.text.leave": "请不要离开此页面",
|
|
195
|
+
"page.eftpos-pay.text.latest.success": "检测到此订单有一笔交易已支付成功!",
|
|
196
|
+
"page.eftpos-pay.text.latest.amount": "交易金额",
|
|
197
|
+
"page.eftpos-pay.text.latest.surcharge": "手续费",
|
|
198
|
+
"page.eftpos-pay.text.latest.time": "交易时间",
|
|
199
|
+
"page.eftpos-pay.text.latest.confirm": "确认",
|
|
190
200
|
"page.eftpos-pay.text.amount.to.pay": "剩余待支付金额",
|
|
191
201
|
"page.eftpos-pay.text.surcharge.percentage": "百分比",
|
|
192
202
|
// Percentage
|
|
@@ -449,6 +459,11 @@ var locales_default = {
|
|
|
449
459
|
"page.eftpos-pay.text.sure": "確定",
|
|
450
460
|
"page.eftpos-pay.text.device": "請選擇設備",
|
|
451
461
|
"page.eftpos-pay.text.leave": "請不要離開此頁面",
|
|
462
|
+
"page.eftpos-pay.text.latest.success": "檢測到此訂單有一筆交易已支付成功!",
|
|
463
|
+
"page.eftpos-pay.text.latest.amount": "交易金額",
|
|
464
|
+
"page.eftpos-pay.text.latest.surcharge": "手續費",
|
|
465
|
+
"page.eftpos-pay.text.latest.time": "交易時間",
|
|
466
|
+
"page.eftpos-pay.text.latest.confirm": "確認",
|
|
452
467
|
"page.eftpos-pay.text.amount.to.pay": "剩餘待支付金額",
|
|
453
468
|
"page.eftpos-pay.text.surcharge.percentage": "百分比",
|
|
454
469
|
// Percentage
|
|
@@ -56,7 +56,8 @@ var POS = ({
|
|
|
56
56
|
netRef,
|
|
57
57
|
orderIdRef,
|
|
58
58
|
amountRef,
|
|
59
|
-
eftposRef
|
|
59
|
+
eftposRef,
|
|
60
|
+
dataRef
|
|
60
61
|
} = (0, import_hooks.useStoreRef)();
|
|
61
62
|
const dispatch = (0, import_store.useDispatch)();
|
|
62
63
|
const { key, ...props } = steps[0];
|
|
@@ -71,15 +72,18 @@ var POS = ({
|
|
|
71
72
|
failRef.current = fail;
|
|
72
73
|
}, [fail]);
|
|
73
74
|
const success = (res) => {
|
|
74
|
-
var _a;
|
|
75
|
+
var _a, _b, _c, _d;
|
|
76
|
+
let receipt = Array.isArray((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.receipt) ? (_b = res == null ? void 0 : res.data) == null ? void 0 : _b.receipt : [(_c = res == null ? void 0 : res.data) == null ? void 0 : _c.receipt];
|
|
77
|
+
receipt = receipt.filter((item) => typeof item === "string").filter(Boolean);
|
|
75
78
|
dispatch((0, import_store.updateNextStep)());
|
|
76
79
|
dispatch(
|
|
77
80
|
(0, import_store.updateCustom)({
|
|
78
|
-
card_reader_surcharge: ((
|
|
81
|
+
card_reader_surcharge: ((_d = res == null ? void 0 : res.data) == null ? void 0 : _d.card_reader_surcharge) || 0,
|
|
82
|
+
receipt
|
|
79
83
|
})
|
|
80
84
|
);
|
|
81
85
|
clearRef.current = setTimeout(() => {
|
|
82
|
-
var _a2,
|
|
86
|
+
var _a2, _b2, _c2;
|
|
83
87
|
const params = (0, import_helper.getPayParams)(
|
|
84
88
|
{
|
|
85
89
|
mode: modeRef.current,
|
|
@@ -89,15 +93,15 @@ var POS = ({
|
|
|
89
93
|
device: deviceRef.current,
|
|
90
94
|
pay: payRef.current,
|
|
91
95
|
custom: {
|
|
92
|
-
card_reader_surcharge: ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.card_reader_surcharge) || 0
|
|
96
|
+
card_reader_surcharge: ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.card_reader_surcharge) || 0,
|
|
97
|
+
receipt
|
|
93
98
|
}
|
|
94
99
|
},
|
|
95
100
|
"success"
|
|
96
101
|
);
|
|
97
|
-
const receipt = Array.isArray(res.receipt) ? res.receipt : [res.receipt];
|
|
98
102
|
onChange("success", {
|
|
99
103
|
...params,
|
|
100
|
-
receipt: ((
|
|
104
|
+
receipt: ((_c2 = (_b2 = deviceRef.current) == null ? void 0 : _b2.setting) == null ? void 0 : _c2.receipts) ? [] : receipt
|
|
101
105
|
});
|
|
102
106
|
}, 1e3);
|
|
103
107
|
};
|
|
@@ -147,7 +151,17 @@ var POS = ({
|
|
|
147
151
|
amount: payRef.current.total,
|
|
148
152
|
card_reader_type: eftposRef.current,
|
|
149
153
|
card_reader_id: (_a = deviceRef.current) == null ? void 0 : _a.id,
|
|
150
|
-
number: numRef.current
|
|
154
|
+
number: numRef.current,
|
|
155
|
+
pay_param_base64: encodeURIComponent(
|
|
156
|
+
btoa(
|
|
157
|
+
encodeURIComponent(
|
|
158
|
+
JSON.stringify({
|
|
159
|
+
...dataRef.current,
|
|
160
|
+
number: numRef.current
|
|
161
|
+
})
|
|
162
|
+
)
|
|
163
|
+
)
|
|
164
|
+
)
|
|
151
165
|
},
|
|
152
166
|
{ signal: controllerRef.current.signal }
|
|
153
167
|
) : api.refund(
|
|
@@ -156,7 +170,17 @@ var POS = ({
|
|
|
156
170
|
amount: amountRef.current,
|
|
157
171
|
card_reader_type: eftposRef.current,
|
|
158
172
|
card_reader_id: (_b = deviceRef.current) == null ? void 0 : _b.id,
|
|
159
|
-
number: numRef.current
|
|
173
|
+
number: numRef.current,
|
|
174
|
+
pay_param_base64: encodeURIComponent(
|
|
175
|
+
btoa(
|
|
176
|
+
encodeURIComponent(
|
|
177
|
+
JSON.stringify({
|
|
178
|
+
...dataRef.current,
|
|
179
|
+
number: numRef.current
|
|
180
|
+
})
|
|
181
|
+
)
|
|
182
|
+
)
|
|
183
|
+
)
|
|
160
184
|
},
|
|
161
185
|
{ signal: controllerRef.current.signal }
|
|
162
186
|
);
|
|
@@ -297,7 +297,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
|
|
|
297
297
|
amount?: string | number | undefined;
|
|
298
298
|
mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
|
|
299
299
|
order_id?: string | number | undefined;
|
|
300
|
-
eftpos?: "
|
|
300
|
+
eftpos?: "windcave" | "tyro" | "payo" | "stripe" | undefined;
|
|
301
301
|
action?: "amount" | "deviceList" | "pay" | undefined;
|
|
302
302
|
key?: number | undefined;
|
|
303
303
|
step?: number | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './tip.less';
|
|
3
|
+
/**
|
|
4
|
+
* @title: 支付状态未知页面
|
|
5
|
+
* @description:
|
|
6
|
+
* @Author: hongbing.wang
|
|
7
|
+
* @Date: 2024-08-20 11:42
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: ({ onChangeStatus, className, formatAmount, cardSurcharge, receipts, successTime, onChangeParams, }: any) => React.JSX.Element;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/eftposPay/tip.tsx
|
|
30
|
+
var tip_exports = {};
|
|
31
|
+
__export(tip_exports, {
|
|
32
|
+
default: () => tip_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(tip_exports);
|
|
35
|
+
var import_utils = require("@pisell/utils");
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_react = __toESM(require("react"));
|
|
38
|
+
var import_helper = require("./helper");
|
|
39
|
+
var import_const = require("./const");
|
|
40
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
41
|
+
var import_store = require("./store");
|
|
42
|
+
var import_hooks = require("./hooks");
|
|
43
|
+
var import_tip = require("./tip.less");
|
|
44
|
+
function formatDateUtils(date, format) {
|
|
45
|
+
if (!date) {
|
|
46
|
+
return date;
|
|
47
|
+
}
|
|
48
|
+
if (date.includes("undefined")) {
|
|
49
|
+
return "";
|
|
50
|
+
}
|
|
51
|
+
const lang = localStorage.getItem("umi_locale") || "en-US";
|
|
52
|
+
let _format = format || ["HH:mm:ss DD/MM/YYYY", "YYYY年MM月DD日 HH:mm:ss"];
|
|
53
|
+
let type = lang === "en-US" || lang === "en" ? _format[0] : _format[1];
|
|
54
|
+
return (0, import_dayjs.default)(date).locale(lang).format(type);
|
|
55
|
+
}
|
|
56
|
+
var tip_default = ({
|
|
57
|
+
onChangeStatus,
|
|
58
|
+
className = "",
|
|
59
|
+
formatAmount,
|
|
60
|
+
cardSurcharge,
|
|
61
|
+
receipts,
|
|
62
|
+
successTime,
|
|
63
|
+
onChangeParams
|
|
64
|
+
}) => {
|
|
65
|
+
const [disabled, setDisabled] = (0, import_react.useState)(true);
|
|
66
|
+
const [amount, setAmount] = (0, import_react.useState)("");
|
|
67
|
+
const [surcharge, setSurcharge] = (0, import_react.useState)("");
|
|
68
|
+
const [surMoney, setSurMoney] = (0, import_react.useState)("");
|
|
69
|
+
const [rate, setRate] = (0, import_react.useState)("");
|
|
70
|
+
const [total, setTotal] = (0, import_react.useState)("");
|
|
71
|
+
const [time, setTime] = (0, import_react.useState)("");
|
|
72
|
+
const data = (0, import_store.useContextData)();
|
|
73
|
+
const { symbol, custom } = data;
|
|
74
|
+
const ref = (0, import_react.useRef)();
|
|
75
|
+
const dispatch = (0, import_store.useDispatch)();
|
|
76
|
+
const listRef = (0, import_react.useRef)(custom == null ? void 0 : custom.list);
|
|
77
|
+
const {
|
|
78
|
+
deviceRef,
|
|
79
|
+
payRef,
|
|
80
|
+
numRef,
|
|
81
|
+
orderIdRef,
|
|
82
|
+
modeRef,
|
|
83
|
+
amountRef,
|
|
84
|
+
eftposRef
|
|
85
|
+
} = (0, import_hooks.useStoreRef)();
|
|
86
|
+
const onConfirm = () => {
|
|
87
|
+
onChangeStatus("success", { ...ref.current || {} });
|
|
88
|
+
};
|
|
89
|
+
(0, import_react.useEffect)(() => {
|
|
90
|
+
if (eftposRef.current === import_const.EftposEnum.Payo) {
|
|
91
|
+
dispatch((0, import_store.updateNextStep)());
|
|
92
|
+
dispatch(
|
|
93
|
+
(0, import_store.updateCustom)({
|
|
94
|
+
card_reader_surcharge: cardSurcharge || 0,
|
|
95
|
+
receipt: receipts
|
|
96
|
+
})
|
|
97
|
+
);
|
|
98
|
+
} else if (eftposRef.current === import_const.EftposEnum.Windcave) {
|
|
99
|
+
dispatch(
|
|
100
|
+
(0, import_store.updateCustom)({
|
|
101
|
+
list: listRef.current.map((item) => ({
|
|
102
|
+
...item,
|
|
103
|
+
status: "resolve"
|
|
104
|
+
})),
|
|
105
|
+
card_reader_surcharge: cardSurcharge || 0,
|
|
106
|
+
receipt: receipts
|
|
107
|
+
})
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
const params = (0, import_helper.getPayParams)(
|
|
111
|
+
{
|
|
112
|
+
mode: modeRef.current,
|
|
113
|
+
amount: amountRef.current,
|
|
114
|
+
order_id: orderIdRef.current,
|
|
115
|
+
number: numRef.current,
|
|
116
|
+
device: deviceRef.current,
|
|
117
|
+
pay: payRef.current,
|
|
118
|
+
custom: {
|
|
119
|
+
card_reader_surcharge: cardSurcharge,
|
|
120
|
+
receipt: receipts
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"success"
|
|
124
|
+
);
|
|
125
|
+
ref.current = params;
|
|
126
|
+
setAmount(`${(params == null ? void 0 : params.amount) || ""}`);
|
|
127
|
+
setSurcharge(`${(params == null ? void 0 : params.surcharge) || ""}`);
|
|
128
|
+
setSurMoney(`${(params == null ? void 0 : params.surMoney) || ""}`);
|
|
129
|
+
setRate(`${(params == null ? void 0 : params.surRate) || ""}`);
|
|
130
|
+
setTotal(`${(params == null ? void 0 : params.total) || ""}`);
|
|
131
|
+
setTime(formatDateUtils(successTime));
|
|
132
|
+
setDisabled(false);
|
|
133
|
+
dispatch(
|
|
134
|
+
(0, import_store.updateState)({
|
|
135
|
+
status: "success",
|
|
136
|
+
title: import_utils.locales.getText("page.eftpos-pay.text.successful")(
|
|
137
|
+
modeRef.current
|
|
138
|
+
)
|
|
139
|
+
})
|
|
140
|
+
);
|
|
141
|
+
}, []);
|
|
142
|
+
(0, import_react.useEffect)(() => {
|
|
143
|
+
onChangeParams && onChangeParams({
|
|
144
|
+
...data,
|
|
145
|
+
form: import_const.RestoreEumn.Restore
|
|
146
|
+
});
|
|
147
|
+
}, [data, onChangeParams]);
|
|
148
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-box ${className}` }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-fail-title" }, import_utils.locales.getText("page.eftpos-pay.text.latest.success")), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-body pisell-lowcode__eft-pay-tip-body" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-tip-text" }, import_utils.locales.getText("page.eftpos-pay.text.latest.amount"), ":", " ", formatAmount(`${amount}`, 2, symbol)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-tip-text" }, import_utils.locales.getText("page.eftpos-pay.text.latest.surcharge"), ":", " ", formatAmount(`${surcharge}`, 2, symbol), " (", rate, "% +", " ", formatAmount(`${surMoney}`, 2, symbol), ")"), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-tip-text" }, import_utils.locales.getText("page.eftpos-pay.text.surcharge.edit.actual.pay"), ":", " ", formatAmount(`${total}`, 2, symbol)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-tip-text" }, import_utils.locales.getText("page.eftpos-pay.text.latest.time"), ": ", time)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
|
|
149
|
+
import_antd.Button,
|
|
150
|
+
{
|
|
151
|
+
disabled,
|
|
152
|
+
block: true,
|
|
153
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
154
|
+
type: "primary",
|
|
155
|
+
onClick: onConfirm
|
|
156
|
+
},
|
|
157
|
+
import_utils.locales.getText("page.eftpos-pay.text.latest.confirm")
|
|
158
|
+
)));
|
|
159
|
+
};
|