@pisell/private-materials 3.0.140 → 3.0.142
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 +4 -4
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +8 -8
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +6 -6
- package/es/components/booking/addons/model.d.ts +2 -1
- package/es/components/booking/forms/model.d.ts +2 -1
- package/es/components/booking/info/header/index.js +73 -9
- package/es/components/booking/locales.d.ts +3 -0
- package/es/components/booking/locales.js +3 -0
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +2 -1
- package/es/components/booking/payments/model.d.ts +2 -1
- package/es/components/eftposPay/amount.js +1 -1
- package/es/components/eftposPay/component/fail/failCustom.js +5 -6
- package/es/components/eftposPay/component/fail/index.js +5 -5
- package/es/components/eftposPay/component/manual/index.js +1 -1
- package/es/components/eftposPay/const.d.ts +2 -0
- package/es/components/eftposPay/const.js +1 -0
- package/es/components/eftposPay/device.d.ts +3 -2
- package/es/components/eftposPay/device.js +100 -38
- package/es/components/eftposPay/device.less +37 -4
- package/es/components/eftposPay/helper.d.ts +11 -0
- package/es/components/eftposPay/helper.js +29 -6
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/index.d.ts +4 -1
- package/es/components/eftposPay/index.js +22 -11
- package/es/components/eftposPay/locales.js +45 -45
- package/es/components/eftposPay/payo/config.js +1 -1
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eftposPay/tyro/index.js +8 -2
- package/es/components/eftposPay/windcave/windcave.js +2 -2
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +2 -1
- package/lib/components/booking/addons/model.d.ts +2 -1
- package/lib/components/booking/forms/model.d.ts +2 -1
- package/lib/components/booking/info/header/index.js +52 -7
- package/lib/components/booking/locales.d.ts +3 -0
- package/lib/components/booking/locales.js +3 -0
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +2 -1
- package/lib/components/booking/payments/model.d.ts +2 -1
- package/lib/components/eftposPay/amount.js +2 -6
- package/lib/components/eftposPay/component/fail/failCustom.js +5 -6
- package/lib/components/eftposPay/component/fail/index.js +5 -5
- package/lib/components/eftposPay/component/manual/index.js +1 -1
- package/lib/components/eftposPay/const.d.ts +2 -0
- package/lib/components/eftposPay/const.js +1 -0
- package/lib/components/eftposPay/device.d.ts +3 -2
- package/lib/components/eftposPay/device.js +73 -32
- package/lib/components/eftposPay/device.less +37 -4
- package/lib/components/eftposPay/helper.d.ts +11 -0
- package/lib/components/eftposPay/helper.js +26 -4
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/index.d.ts +4 -1
- package/lib/components/eftposPay/index.js +16 -6
- package/lib/components/eftposPay/locales.js +45 -45
- package/lib/components/eftposPay/payo/config.js +1 -1
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eftposPay/tyro/index.js +9 -8
- package/lib/components/eftposPay/windcave/windcave.js +2 -2
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +2 -1
- package/lowcode/eftpos-pay/meta.ts +11 -0
- package/lowcode/vertical-add-service/meta.ts +71 -0
- package/package.json +4 -4
|
@@ -40,7 +40,7 @@ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContex
|
|
|
40
40
|
var import_index = require("./index.less");
|
|
41
41
|
var import_classnames = __toESM(require("classnames"));
|
|
42
42
|
var header = ({ state, dispatch }) => {
|
|
43
|
-
var _a, _b, _c, _d, _e, _f
|
|
43
|
+
var _a, _b, _c, _d, _e, _f;
|
|
44
44
|
const context = (0, import_useEngineContext.default)();
|
|
45
45
|
const [modalContent, setModalContent] = (0, import_react.useState)({
|
|
46
46
|
open: false,
|
|
@@ -169,14 +169,25 @@ var header = ({ state, dispatch }) => {
|
|
|
169
169
|
)
|
|
170
170
|
);
|
|
171
171
|
}, [(_c = state.service) == null ? void 0 : _c.value]);
|
|
172
|
-
const
|
|
172
|
+
const paymentProcessingPayment = (type) => {
|
|
173
173
|
var _a2;
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
const payments = ((_a2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _a2.payments) || [];
|
|
175
|
+
const status = ["payment_processing"];
|
|
176
|
+
const payment_method = ["BANK_DEPOSIT"];
|
|
177
|
+
if (type === "bank") {
|
|
178
|
+
return !!(payments == null ? void 0 : payments.find(
|
|
179
|
+
(item) => status.includes(item == null ? void 0 : item.status) && payment_method.includes(item == null ? void 0 : item.payment_method)
|
|
180
|
+
));
|
|
181
|
+
}
|
|
182
|
+
return !!(payments == null ? void 0 : payments.find((item) => status.includes(item == null ? void 0 : item.status)));
|
|
183
|
+
};
|
|
176
184
|
const handleCancel = () => {
|
|
177
|
-
if (
|
|
185
|
+
if (paymentProcessingPayment("bank")) {
|
|
178
186
|
return showPaymentModal();
|
|
179
187
|
}
|
|
188
|
+
if (paymentProcessingPayment()) {
|
|
189
|
+
return showCancelCalendarModal();
|
|
190
|
+
}
|
|
180
191
|
return showCancelledModal();
|
|
181
192
|
};
|
|
182
193
|
const handleRefund = () => {
|
|
@@ -235,6 +246,40 @@ var header = ({ state, dispatch }) => {
|
|
|
235
246
|
footer: null
|
|
236
247
|
});
|
|
237
248
|
};
|
|
249
|
+
const showCancelCalendarModal = () => {
|
|
250
|
+
setModalContentState({
|
|
251
|
+
className: "go-payments-modal-wrap",
|
|
252
|
+
open: true,
|
|
253
|
+
width: 480,
|
|
254
|
+
onCancel: () => {
|
|
255
|
+
setModalContentState({ open: false });
|
|
256
|
+
},
|
|
257
|
+
children: /* @__PURE__ */ import_react.default.createElement("div", { className: "go-payments-modal-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "go-payments-modal-content-title" }, import_utils.locales.getText("page.booking.text.cancel-booking")), /* @__PURE__ */ import_react.default.createElement("div", { className: "go-payments-modal-content-desc" }, import_utils.locales.getText("page.booking.text.cancel.calendar.msg")), /* @__PURE__ */ import_react.default.createElement("div", { className: "go-payments-footer" }, /* @__PURE__ */ import_react.default.createElement(
|
|
258
|
+
import_antd.Button,
|
|
259
|
+
{
|
|
260
|
+
className: "go-payments-footer-btn",
|
|
261
|
+
size: "large",
|
|
262
|
+
onClick: () => {
|
|
263
|
+
setModalContentState({ open: false });
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
import_utils.locales.getText("page.booking.text.go-back")
|
|
267
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
268
|
+
import_antd.Button,
|
|
269
|
+
{
|
|
270
|
+
className: "go-payments-footer-btn",
|
|
271
|
+
type: "primary",
|
|
272
|
+
size: "large",
|
|
273
|
+
onClick: () => {
|
|
274
|
+
setBookingStatus("cancelled");
|
|
275
|
+
setModalContentState({ open: false });
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
import_utils.locales.getText("page.booking.text.cancel-booking")
|
|
279
|
+
))),
|
|
280
|
+
footer: null
|
|
281
|
+
});
|
|
282
|
+
};
|
|
238
283
|
const showCancelledModal = () => {
|
|
239
284
|
const cancelBtn = /* @__PURE__ */ import_react.default.createElement(
|
|
240
285
|
import_antd.Button,
|
|
@@ -316,8 +361,8 @@ var header = ({ state, dispatch }) => {
|
|
|
316
361
|
className: "booking-header",
|
|
317
362
|
style: { backgroundColor: currentStatus.color }
|
|
318
363
|
},
|
|
319
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: "booking-order-sales-channel" }, orderSalesChannel[(
|
|
320
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-line-2" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-left" }, import_utils.locales.getText("pisell2.text.status.booking_id"), ":", " ", ((
|
|
364
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "booking-order-sales-channel" }, orderSalesChannel[(_d = state.bookingDetail) == null ? void 0 : _d.order_sales_channel] || ""),
|
|
365
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-line-2" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-left" }, import_utils.locales.getText("pisell2.text.status.booking_id"), ":", " ", ((_f = (_e = state.bookingDetail) == null ? void 0 : _e.bookings) == null ? void 0 : _f.booking_id) || "-"), /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-right" }, /* @__PURE__ */ import_react.default.createElement(
|
|
321
366
|
import_antd.Dropdown,
|
|
322
367
|
{
|
|
323
368
|
menu: { items, onClick: onSelect },
|
|
@@ -181,6 +181,7 @@ declare const _default: {
|
|
|
181
181
|
'page.event.booking.text.duplicate-enrollment-confirm': string;
|
|
182
182
|
'page.booking.text.unconfirmed-payments': string;
|
|
183
183
|
'page.booking.text.unconfirmed-payments.msg': string;
|
|
184
|
+
'page.booking.text.cancel.calendar.msg': string;
|
|
184
185
|
'page.booking.text.go-to-payments': string;
|
|
185
186
|
'page.booking.text.cancel-only': string;
|
|
186
187
|
'page.booking.text.refund': string;
|
|
@@ -376,6 +377,7 @@ declare const _default: {
|
|
|
376
377
|
'page.event.booking.text.duplicate-enrollment-confirm': string;
|
|
377
378
|
'page.booking.text.unconfirmed-payments': string;
|
|
378
379
|
'page.booking.text.unconfirmed-payments.msg': string;
|
|
380
|
+
'page.booking.text.cancel.calendar.msg': string;
|
|
379
381
|
'page.booking.text.go-to-payments': string;
|
|
380
382
|
'page.booking.text.cancel-only': string;
|
|
381
383
|
'page.booking.text.refund': string;
|
|
@@ -571,6 +573,7 @@ declare const _default: {
|
|
|
571
573
|
'page.event.booking.text.duplicate-enrollment-confirm': string;
|
|
572
574
|
'page.booking.text.unconfirmed-payments': string;
|
|
573
575
|
'page.booking.text.unconfirmed-payments.msg': string;
|
|
576
|
+
'page.booking.text.cancel.calendar.msg': string;
|
|
574
577
|
'page.booking.text.go-to-payments': string;
|
|
575
578
|
'page.booking.text.cancel-only': string;
|
|
576
579
|
'page.booking.text.refund': string;
|
|
@@ -237,6 +237,7 @@ var locales_default = {
|
|
|
237
237
|
"page.event.booking.text.duplicate-enrollment-confirm": "Confirm",
|
|
238
238
|
"page.booking.text.unconfirmed-payments": "Unconfirmed payments",
|
|
239
239
|
"page.booking.text.unconfirmed-payments.msg": "There are unconfirmed payments, please confirm or void the payments first.",
|
|
240
|
+
"page.booking.text.cancel.calendar.msg": "Are you sure you want to cancel the appointment? This appointment will be removed from the calendar.",
|
|
240
241
|
"page.booking.text.go-to-payments": "Go to payments",
|
|
241
242
|
"page.booking.text.cancel-only": "Cancel only",
|
|
242
243
|
"page.booking.text.refund": "Refund",
|
|
@@ -458,6 +459,7 @@ var locales_default = {
|
|
|
458
459
|
"page.event.booking.text.duplicate-enrollment-confirm": "确认",
|
|
459
460
|
"page.booking.text.unconfirmed-payments": "未确认的付款",
|
|
460
461
|
"page.booking.text.unconfirmed-payments.msg": "存在未确认的付款,请先确认收款或作废。",
|
|
462
|
+
"page.booking.text.cancel.calendar.msg": "确定要取消预约吗?此预约将从日历中移除。",
|
|
461
463
|
"page.booking.text.go-to-payments": "前往收款界面",
|
|
462
464
|
"page.booking.text.cancel-only": "仅取消",
|
|
463
465
|
"page.booking.text.refund": "退款",
|
|
@@ -679,6 +681,7 @@ var locales_default = {
|
|
|
679
681
|
"page.event.booking.text.duplicate-enrollment-confirm": "確認",
|
|
680
682
|
"page.booking.text.unconfirmed-payments": "未確認的付款",
|
|
681
683
|
"page.booking.text.unconfirmed-payments.msg": "存在未確認的付款,請先確認收款或作廢。",
|
|
684
|
+
"page.booking.text.cancel.calendar.msg": "確定要取消預約嗎?此預約將從日曆中移除。",
|
|
682
685
|
"page.booking.text.go-to-payments": "前往收款界面",
|
|
683
686
|
"page.booking.text.cancel-only": "僅取消",
|
|
684
687
|
"page.booking.text.refund": "退款",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { FormState } from "../model";
|
|
2
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
|
|
3
4
|
state: FormState;
|
|
4
5
|
} & {
|
|
5
6
|
dispatch: (params: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { FormState } from "../model";
|
|
2
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
|
|
3
4
|
state: FormState;
|
|
4
5
|
} & {
|
|
5
6
|
dispatch: (params: {
|
|
@@ -114,12 +114,8 @@ var amount_default = ({
|
|
|
114
114
|
surRateMoney: `${surRateMoney}`,
|
|
115
115
|
totalUnit: formatAmount(total, 2, symbol)
|
|
116
116
|
};
|
|
117
|
-
console.log("
|
|
118
|
-
dispatch(
|
|
119
|
-
(0, import_store.updateState)({
|
|
120
|
-
pay
|
|
121
|
-
})
|
|
122
|
-
);
|
|
117
|
+
console.log("amount pay = ", pay);
|
|
118
|
+
dispatch((0, import_store.updateState)({ pay }));
|
|
123
119
|
dispatch((0, import_store.updateComponent)(""));
|
|
124
120
|
onChange && onChange("page", "pay");
|
|
125
121
|
};
|
|
@@ -124,18 +124,17 @@ var failCustom_default = ({ className = "", isIpad, onChange }) => {
|
|
|
124
124
|
{
|
|
125
125
|
block: true,
|
|
126
126
|
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
127
|
-
onClick:
|
|
127
|
+
onClick: onClose
|
|
128
128
|
},
|
|
129
|
-
import_utils.locales.getText("page.eftpos-pay.text.
|
|
129
|
+
import_utils.locales.getText("page.eftpos-pay.text.cancel")
|
|
130
130
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
131
131
|
import_antd.Button,
|
|
132
132
|
{
|
|
133
133
|
block: true,
|
|
134
|
-
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
135
134
|
type: "primary",
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
136
|
+
onClick: onRetry
|
|
138
137
|
},
|
|
139
|
-
import_utils.locales.getText("page.eftpos-pay.text.
|
|
138
|
+
import_utils.locales.getText("page.eftpos-pay.text.retry")
|
|
140
139
|
)));
|
|
141
140
|
};
|
|
@@ -129,17 +129,17 @@ var fail_default = ({ onChange, className = "", isIpad }) => {
|
|
|
129
129
|
{
|
|
130
130
|
block: true,
|
|
131
131
|
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
132
|
-
onClick:
|
|
132
|
+
onClick: onClose
|
|
133
133
|
},
|
|
134
|
-
import_utils.locales.getText("page.eftpos-pay.text.
|
|
134
|
+
import_utils.locales.getText("page.eftpos-pay.text.cancel")
|
|
135
135
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
136
136
|
import_antd.Button,
|
|
137
137
|
{
|
|
138
138
|
block: true,
|
|
139
|
-
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
140
139
|
type: "primary",
|
|
141
|
-
|
|
140
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
141
|
+
onClick: onRetry
|
|
142
142
|
},
|
|
143
|
-
import_utils.locales.getText("page.eftpos-pay.text.
|
|
143
|
+
import_utils.locales.getText("page.eftpos-pay.text.retry")
|
|
144
144
|
)));
|
|
145
145
|
};
|
|
@@ -87,7 +87,7 @@ var manual_default = ({ onChange, className = "", formatAmount }) => {
|
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
setDisabled(true);
|
|
90
|
-
if (mode
|
|
90
|
+
if (mode === import_const.ModeEnum.Refund || mode === import_const.ModeEnum.Query) {
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
const prevMoneyDeci = new import_decimal.Decimal((pay == null ? void 0 : pay.total) || 0);
|
|
@@ -47,6 +47,7 @@ var StatusEnum = /* @__PURE__ */ ((StatusEnum2) => {
|
|
|
47
47
|
})(StatusEnum || {});
|
|
48
48
|
var ModeEnum = /* @__PURE__ */ ((ModeEnum2) => {
|
|
49
49
|
ModeEnum2["Pay"] = "pay";
|
|
50
|
+
ModeEnum2["FullPay"] = "fullPay";
|
|
50
51
|
ModeEnum2["Refund"] = "refund";
|
|
51
52
|
ModeEnum2["Query"] = "query";
|
|
52
53
|
return ModeEnum2;
|
|
@@ -8,15 +8,16 @@ import './device.less';
|
|
|
8
8
|
* @Author: hongbing.wang
|
|
9
9
|
* @Date: 2024-08-12 11:40
|
|
10
10
|
*/
|
|
11
|
-
declare const _default: ({ api, onChange, onClose, className, device_number, isIpad, net, }: {
|
|
11
|
+
declare const _default: ({ api, onChange, onClose, className, device_number, isIpad, net, formatAmount, }: {
|
|
12
12
|
api: PayProps['api'];
|
|
13
13
|
className?: string | undefined;
|
|
14
|
-
onChange?: ((status: "
|
|
14
|
+
onChange?: ((status: "fail" | "success" | "page", params?: string | {
|
|
15
15
|
[keys: string]: unknown;
|
|
16
16
|
} | undefined) => void) | undefined;
|
|
17
17
|
onClose: () => void;
|
|
18
18
|
device_number?: string | number | undefined;
|
|
19
19
|
isIpad: boolean;
|
|
20
20
|
net: boolean;
|
|
21
|
+
formatAmount(amount: number | string, precision: number, symbol: string): string;
|
|
21
22
|
}) => React.JSX.Element;
|
|
22
23
|
export default _default;
|
|
@@ -38,7 +38,10 @@ var import_antd = require("antd");
|
|
|
38
38
|
var import_react = __toESM(require("react"));
|
|
39
39
|
var import_titlebar = __toESM(require("./component/header/titlebar"));
|
|
40
40
|
var import_const = require("./const");
|
|
41
|
+
var import_helper = require("./helper");
|
|
42
|
+
var import_ChevronRight = __toESM(require("@pisell/icon/es/ChevronRight"));
|
|
41
43
|
var import_store = require("./store");
|
|
44
|
+
var import_manufacturer = require("./manufacturer");
|
|
42
45
|
var import_device = require("./device.less");
|
|
43
46
|
var device_default = ({
|
|
44
47
|
api,
|
|
@@ -47,9 +50,11 @@ var device_default = ({
|
|
|
47
50
|
className = "",
|
|
48
51
|
device_number,
|
|
49
52
|
isIpad,
|
|
50
|
-
net
|
|
53
|
+
net,
|
|
54
|
+
formatAmount = (number, precision, symbol) => `${symbol}${number}`
|
|
51
55
|
}) => {
|
|
52
|
-
const
|
|
56
|
+
const store = (0, import_store.useContextData)();
|
|
57
|
+
const { device, symbol, mode, eftpos } = store;
|
|
53
58
|
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
54
59
|
const [dataStaus, setDataStaus] = (0, import_react.useState)(true);
|
|
55
60
|
const [list, setList] = (0, import_react.useState)([]);
|
|
@@ -64,10 +69,7 @@ var device_default = ({
|
|
|
64
69
|
return;
|
|
65
70
|
}
|
|
66
71
|
const [index] = [Number(event.currentTarget.dataset.index)];
|
|
67
|
-
|
|
68
|
-
if (typeof onChange === "function") {
|
|
69
|
-
onChange("page", mode === import_const.ModeEnum.Pay ? "amount" : "pay");
|
|
70
|
-
}
|
|
72
|
+
setDevice(list[index]);
|
|
71
73
|
};
|
|
72
74
|
(0, import_ahooks.useMount)(() => {
|
|
73
75
|
setLoading(true);
|
|
@@ -86,29 +88,17 @@ var device_default = ({
|
|
|
86
88
|
);
|
|
87
89
|
if (hostDeviceList.length >= 1) {
|
|
88
90
|
setDataStaus(true);
|
|
89
|
-
setList(hostDeviceList);
|
|
91
|
+
setList(setDeviceList(hostDeviceList));
|
|
90
92
|
if (hostDeviceList.length === 1) {
|
|
91
|
-
|
|
92
|
-
if (typeof api.selectDevice === "function") {
|
|
93
|
-
api.selectDevice(hostDeviceList[0]);
|
|
94
|
-
}
|
|
95
|
-
if (typeof onChange === "function") {
|
|
96
|
-
onChange("page", mode === import_const.ModeEnum.Pay ? "amount" : "pay");
|
|
97
|
-
}
|
|
93
|
+
setDevice(hostDeviceList[0]);
|
|
98
94
|
}
|
|
99
95
|
return;
|
|
100
96
|
}
|
|
101
97
|
}
|
|
102
98
|
setDataStaus(true);
|
|
103
|
-
setList(res.list);
|
|
99
|
+
setList(setDeviceList(res.list));
|
|
104
100
|
if (res.list.length === 1) {
|
|
105
|
-
|
|
106
|
-
if (typeof api.selectDevice === "function") {
|
|
107
|
-
api.selectDevice(res.list[0]);
|
|
108
|
-
}
|
|
109
|
-
if (typeof onChange === "function") {
|
|
110
|
-
onChange("page", mode === import_const.ModeEnum.Pay ? "amount" : "pay");
|
|
111
|
-
}
|
|
101
|
+
setDevice(res.list[0]);
|
|
112
102
|
}
|
|
113
103
|
return;
|
|
114
104
|
}
|
|
@@ -120,25 +110,76 @@ var device_default = ({
|
|
|
120
110
|
}
|
|
121
111
|
);
|
|
122
112
|
});
|
|
123
|
-
|
|
113
|
+
const setDevice = (device2) => {
|
|
114
|
+
dispatch((0, import_store.updateDevice)({ device: device2 }));
|
|
115
|
+
if (typeof api.selectDevice === "function") {
|
|
116
|
+
api.selectDevice(device2);
|
|
117
|
+
}
|
|
118
|
+
if (typeof onChange === "function") {
|
|
119
|
+
if (mode === import_const.ModeEnum.Pay) {
|
|
120
|
+
if (device2.pay) {
|
|
121
|
+
dispatch(
|
|
122
|
+
(0, import_store.updateState)({
|
|
123
|
+
pay: device2.pay
|
|
124
|
+
})
|
|
125
|
+
);
|
|
126
|
+
} else {
|
|
127
|
+
const amonunt = (0, import_manufacturer.getAmonunt)({ ...store, device: device2 });
|
|
128
|
+
const pay = (0, import_helper.getPayAmonunt)(
|
|
129
|
+
amonunt,
|
|
130
|
+
(total) => formatAmount(total, 2, symbol)
|
|
131
|
+
);
|
|
132
|
+
dispatch((0, import_store.updateState)({ pay }));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
onChange("page", mode === import_const.ModeEnum.FullPay ? "amount" : "pay");
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const setDeviceList = (list2) => {
|
|
139
|
+
return list2.map((item) => {
|
|
140
|
+
const amonunt = (0, import_manufacturer.getAmonunt)({ ...store, device: item });
|
|
141
|
+
const pay = (0, import_helper.getPayAmonunt)(
|
|
142
|
+
amonunt,
|
|
143
|
+
(total) => formatAmount(total, 2, symbol)
|
|
144
|
+
);
|
|
145
|
+
return { ...item, pay };
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-device-box ${className}` }, isIpad ? null : /* @__PURE__ */ import_react.default.createElement(import_titlebar.default, { type: "left-title-close", onClose }, dataStaus ? import_utils.locales.getText("page.eftpos-pay.text.device") : ""), dataStaus ? /* @__PURE__ */ import_react.default.createElement(
|
|
124
149
|
"div",
|
|
125
150
|
{
|
|
126
151
|
className: "pisell-lowcode__eft-pay-device-list",
|
|
127
152
|
style: isIpad ? { marginTop: "20px" } : {}
|
|
128
153
|
},
|
|
129
|
-
|
|
154
|
+
/* @__PURE__ */ import_react.default.createElement(import_antd.Spin, { spinning: loading, style: { flex: 1, overflow: "auto" } }, /* @__PURE__ */ import_react.default.createElement(
|
|
130
155
|
"div",
|
|
131
156
|
{
|
|
132
|
-
|
|
133
|
-
className: `pisell-lowcode__eft-pay-device ${id === (device == null ? void 0 : device.id) ? "active" : ""}`,
|
|
134
|
-
"data-index": index,
|
|
135
|
-
onClick,
|
|
136
|
-
role: "button",
|
|
137
|
-
tabIndex: index
|
|
157
|
+
style: { display: "flex", flexDirection: "column", gap: "10px" }
|
|
138
158
|
},
|
|
139
|
-
name
|
|
159
|
+
list.map(({ id, name, pay }, index) => /* @__PURE__ */ import_react.default.createElement(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
key: id,
|
|
163
|
+
className: `pisell-lowcode__eft-pay-device ${id === (device == null ? void 0 : device.id) ? "active" : ""}`,
|
|
164
|
+
"data-index": index,
|
|
165
|
+
onClick,
|
|
166
|
+
role: "button",
|
|
167
|
+
tabIndex: index
|
|
168
|
+
},
|
|
169
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-name" }, name), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-money" }, pay.totalUnit), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-sucharge" }, import_utils.locales.getText(
|
|
170
|
+
"page.eftpos-pay.text.surcharge.edit.inc.surcharge"
|
|
171
|
+
), ": ", formatAmount(`${pay.surcharge}`, 2, symbol), " (", import_utils.locales.getText(
|
|
172
|
+
"page.eftpos-pay.text.surcharge.edit.rate"
|
|
173
|
+
), ":", pay.surRate, "% +", " ", formatAmount(`${pay.surMoney}`, 2, symbol), ")")),
|
|
174
|
+
/* @__PURE__ */ import_react.default.createElement("div", { style: { flexShrink: 0 } }, /* @__PURE__ */ import_react.default.createElement(
|
|
175
|
+
import_ChevronRight.default,
|
|
176
|
+
{
|
|
177
|
+
style: { fontWeight: "600", fontSize: "24px" }
|
|
178
|
+
}
|
|
179
|
+
))
|
|
180
|
+
))
|
|
140
181
|
))
|
|
141
|
-
)
|
|
182
|
+
) : /* @__PURE__ */ import_react.default.createElement(
|
|
142
183
|
"div",
|
|
143
184
|
{
|
|
144
185
|
className: "pisell-lowcode__eft-pay-device-error",
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
.pisell-lowcode__eft-pay-device-box {
|
|
2
|
-
max-height: var(--pisel-lc-pos-device-max-height,
|
|
2
|
+
max-height: var(--pisel-lc-pos-device-max-height, 600px);
|
|
3
3
|
width: var(--pisel-lc-pos-device-width, 600px);
|
|
4
4
|
max-width: 100%;
|
|
5
5
|
padding: var(--pisel-lc-pos-device-padding, 0 24px 24px);
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
6
8
|
}
|
|
7
9
|
.pisell-lowcode__eft-pay-device-list,
|
|
8
10
|
.pisell-lowcode__eft-pay-device-error {
|
|
@@ -11,17 +13,16 @@
|
|
|
11
13
|
|
|
12
14
|
overflow: auto;
|
|
13
15
|
min-height: 200px;
|
|
14
|
-
margin:
|
|
16
|
+
margin: 0 0 20px;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
.pisell-lowcode__eft-pay-device-list {
|
|
18
20
|
gap: 10px;
|
|
19
21
|
}
|
|
20
22
|
.pisell-lowcode__eft-pay-device {
|
|
21
|
-
height: 52px;
|
|
22
23
|
display: flex;
|
|
23
24
|
align-items: center;
|
|
24
|
-
padding:
|
|
25
|
+
padding: 16px;
|
|
25
26
|
border-radius: 12px;
|
|
26
27
|
border: 1px solid var(--Gray-200, #eaecf0);
|
|
27
28
|
background: #fff;
|
|
@@ -39,6 +40,14 @@
|
|
|
39
40
|
background: var(--Gray-50, #f9fafb);
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
.pisell-lowcode__eft-pay-device-content{
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
gap: 6px;
|
|
47
|
+
flex: 1;
|
|
48
|
+
overflow: auto;
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
.pisell-lowcode__eft-pay-device-error {
|
|
43
52
|
gap: 20px;
|
|
44
53
|
}
|
|
@@ -59,3 +68,27 @@
|
|
|
59
68
|
font-weight: 400;
|
|
60
69
|
line-height: 20px; /* 142.857% */
|
|
61
70
|
}
|
|
71
|
+
.pisell-lowcode__eft-pay-device-name {
|
|
72
|
+
color: var(--Gray-900, #101828);
|
|
73
|
+
/* Text lg/Semibold */
|
|
74
|
+
font-size: 18px;
|
|
75
|
+
font-style: normal;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
line-height: 28px; /* 155.556% */
|
|
78
|
+
}
|
|
79
|
+
.pisell-lowcode__eft-pay-device-money {
|
|
80
|
+
color: var(--Gray-900, #101828);
|
|
81
|
+
/* Text sm/Semibold */
|
|
82
|
+
font-size: 14px;
|
|
83
|
+
font-style: normal;
|
|
84
|
+
font-weight: 600;
|
|
85
|
+
line-height: 20px; /* 142.857% */
|
|
86
|
+
}
|
|
87
|
+
.pisell-lowcode__eft-pay-device-sucharge {
|
|
88
|
+
color: var(--Gray-500, #667085);
|
|
89
|
+
/* Paragraph/Regular */
|
|
90
|
+
font-size: 14px;
|
|
91
|
+
font-style: normal;
|
|
92
|
+
font-weight: 400;
|
|
93
|
+
line-height: 20px; /* 142.857% */
|
|
94
|
+
}
|
|
@@ -63,4 +63,15 @@ export declare const limitDecimals: (value: any) => any;
|
|
|
63
63
|
* @Date: 2024-08-12 10:24
|
|
64
64
|
*/
|
|
65
65
|
export declare function getAmonunt(store: State): Amount;
|
|
66
|
+
export declare function getPayAmonunt({ money, amount, surRate, surMoney }: Amount, formatAmount: (...agrn: unknown[]) => string): {
|
|
67
|
+
sourceAmount: string;
|
|
68
|
+
amount: string;
|
|
69
|
+
surcharge: string;
|
|
70
|
+
total: string;
|
|
71
|
+
surPercentRate: string;
|
|
72
|
+
surRate: string;
|
|
73
|
+
surMoney: string;
|
|
74
|
+
surRateMoney: string;
|
|
75
|
+
totalUnit: string;
|
|
76
|
+
};
|
|
66
77
|
export {};
|
|
@@ -21,6 +21,7 @@ var helper_exports = {};
|
|
|
21
21
|
__export(helper_exports, {
|
|
22
22
|
cloneDeep: () => cloneDeep,
|
|
23
23
|
getAmonunt: () => getAmonunt,
|
|
24
|
+
getPayAmonunt: () => getPayAmonunt,
|
|
24
25
|
getPayParams: () => getPayParams,
|
|
25
26
|
getUuid: () => getUuid,
|
|
26
27
|
limitDecimals: () => limitDecimals,
|
|
@@ -68,7 +69,7 @@ var getPayParams = (data, statue) => {
|
|
|
68
69
|
order_id: data.order_id
|
|
69
70
|
};
|
|
70
71
|
}
|
|
71
|
-
if (data.mode === import_const.ModeEnum.Pay) {
|
|
72
|
+
if (data.mode === import_const.ModeEnum.Pay || data.mode === import_const.ModeEnum.FullPay) {
|
|
72
73
|
const pay = data.pay;
|
|
73
74
|
const card_reader_surcharge = ((_a = data.custom) == null ? void 0 : _a.card_reader_surcharge) || 0;
|
|
74
75
|
const obj = pay || {};
|
|
@@ -118,9 +119,9 @@ var limitDecimals = (value) => {
|
|
|
118
119
|
return "";
|
|
119
120
|
};
|
|
120
121
|
function getAmonunt(store) {
|
|
121
|
-
const { device, pay,
|
|
122
|
-
if (!device
|
|
123
|
-
throw Error("device
|
|
122
|
+
const { device, pay, name, symbol, amount } = store;
|
|
123
|
+
if (!device) {
|
|
124
|
+
throw Error("device is not defined");
|
|
124
125
|
}
|
|
125
126
|
const setting = device.setting;
|
|
126
127
|
if (pay) {
|
|
@@ -164,10 +165,31 @@ function getAmonunt(store) {
|
|
|
164
165
|
useOriginSurcharge
|
|
165
166
|
};
|
|
166
167
|
}
|
|
168
|
+
function getPayAmonunt({ money, amount, surRate, surMoney }, formatAmount) {
|
|
169
|
+
const surRateDeci = new import_decimal.Decimal(surRate);
|
|
170
|
+
const moneyDeci = new import_decimal.Decimal(amount);
|
|
171
|
+
const surMoneyDeci = new import_decimal.Decimal(surMoney);
|
|
172
|
+
const surRateMoney = moneyDeci.mul(surRateDeci.div(100)).toFixed(2, import_decimal.Decimal.ROUND_HALF_UP);
|
|
173
|
+
const totalSurMoney = moneyDeci.mul(surRateDeci.div(100)).add(surMoneyDeci);
|
|
174
|
+
const rate = new import_decimal.Decimal(surRate).div(100).toFixed(4, import_decimal.Decimal.ROUND_HALF_UP);
|
|
175
|
+
const total = totalSurMoney.add(moneyDeci).toFixed(2, import_decimal.Decimal.ROUND_HALF_UP);
|
|
176
|
+
return {
|
|
177
|
+
sourceAmount: `${money}`,
|
|
178
|
+
amount: `${amount}`,
|
|
179
|
+
surcharge: `${totalSurMoney}`,
|
|
180
|
+
total: `${total}`,
|
|
181
|
+
surPercentRate: `${rate}`,
|
|
182
|
+
surRate: `${surRate}`,
|
|
183
|
+
surMoney: `${surMoney}`,
|
|
184
|
+
surRateMoney: `${surRateMoney}`,
|
|
185
|
+
totalUnit: formatAmount(total)
|
|
186
|
+
};
|
|
187
|
+
}
|
|
167
188
|
// Annotate the CommonJS export names for ESM import in node:
|
|
168
189
|
0 && (module.exports = {
|
|
169
190
|
cloneDeep,
|
|
170
191
|
getAmonunt,
|
|
192
|
+
getPayAmonunt,
|
|
171
193
|
getPayParams,
|
|
172
194
|
getUuid,
|
|
173
195
|
limitDecimals,
|
|
@@ -19,7 +19,7 @@ export declare const useStoreRef: <T extends {
|
|
|
19
19
|
readonly netRef: React.MutableRefObject<boolean | undefined>;
|
|
20
20
|
readonly symbolRef: React.MutableRefObject<string>;
|
|
21
21
|
readonly amountRef: React.MutableRefObject<string | number>;
|
|
22
|
-
readonly eftposRef: React.MutableRefObject<"
|
|
22
|
+
readonly eftposRef: React.MutableRefObject<"windcave" | "tyro" | "payo" | "stripe">;
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
25
|
* @title: 通用失败处理
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PosProps } from './const';
|
|
3
3
|
import './index.less';
|
|
4
|
-
declare const
|
|
4
|
+
export declare const Root: (props: PosProps) => React.JSX.Element;
|
|
5
|
+
declare const _default: ({ key, ...props }: PosProps & {
|
|
6
|
+
key: string | number;
|
|
7
|
+
}) => React.JSX.Element;
|
|
5
8
|
export default _default;
|