@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.
Files changed (71) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +4 -4
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +8 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +6 -6
  11. package/es/components/booking/addons/model.d.ts +2 -1
  12. package/es/components/booking/forms/model.d.ts +2 -1
  13. package/es/components/booking/info/header/index.js +73 -9
  14. package/es/components/booking/locales.d.ts +3 -0
  15. package/es/components/booking/locales.js +3 -0
  16. package/es/components/booking/notes/index.d.ts +1 -1
  17. package/es/components/booking/notes/model.d.ts +2 -1
  18. package/es/components/booking/payments/model.d.ts +2 -1
  19. package/es/components/eftposPay/amount.js +1 -1
  20. package/es/components/eftposPay/component/fail/failCustom.js +5 -6
  21. package/es/components/eftposPay/component/fail/index.js +5 -5
  22. package/es/components/eftposPay/component/manual/index.js +1 -1
  23. package/es/components/eftposPay/const.d.ts +2 -0
  24. package/es/components/eftposPay/const.js +1 -0
  25. package/es/components/eftposPay/device.d.ts +3 -2
  26. package/es/components/eftposPay/device.js +100 -38
  27. package/es/components/eftposPay/device.less +37 -4
  28. package/es/components/eftposPay/helper.d.ts +11 -0
  29. package/es/components/eftposPay/helper.js +29 -6
  30. package/es/components/eftposPay/hooks.d.ts +1 -1
  31. package/es/components/eftposPay/index.d.ts +4 -1
  32. package/es/components/eftposPay/index.js +22 -11
  33. package/es/components/eftposPay/locales.js +45 -45
  34. package/es/components/eftposPay/payo/config.js +1 -1
  35. package/es/components/eftposPay/store/index.d.ts +1 -1
  36. package/es/components/eftposPay/tyro/index.js +8 -2
  37. package/es/components/eftposPay/windcave/windcave.js +2 -2
  38. package/es/components/schedules/index.d.ts +1 -1
  39. package/es/components/schedules/model.d.ts +2 -1
  40. package/lib/components/booking/addons/model.d.ts +2 -1
  41. package/lib/components/booking/forms/model.d.ts +2 -1
  42. package/lib/components/booking/info/header/index.js +52 -7
  43. package/lib/components/booking/locales.d.ts +3 -0
  44. package/lib/components/booking/locales.js +3 -0
  45. package/lib/components/booking/notes/index.d.ts +1 -1
  46. package/lib/components/booking/notes/model.d.ts +2 -1
  47. package/lib/components/booking/payments/model.d.ts +2 -1
  48. package/lib/components/eftposPay/amount.js +2 -6
  49. package/lib/components/eftposPay/component/fail/failCustom.js +5 -6
  50. package/lib/components/eftposPay/component/fail/index.js +5 -5
  51. package/lib/components/eftposPay/component/manual/index.js +1 -1
  52. package/lib/components/eftposPay/const.d.ts +2 -0
  53. package/lib/components/eftposPay/const.js +1 -0
  54. package/lib/components/eftposPay/device.d.ts +3 -2
  55. package/lib/components/eftposPay/device.js +73 -32
  56. package/lib/components/eftposPay/device.less +37 -4
  57. package/lib/components/eftposPay/helper.d.ts +11 -0
  58. package/lib/components/eftposPay/helper.js +26 -4
  59. package/lib/components/eftposPay/hooks.d.ts +1 -1
  60. package/lib/components/eftposPay/index.d.ts +4 -1
  61. package/lib/components/eftposPay/index.js +16 -6
  62. package/lib/components/eftposPay/locales.js +45 -45
  63. package/lib/components/eftposPay/payo/config.js +1 -1
  64. package/lib/components/eftposPay/store/index.d.ts +1 -1
  65. package/lib/components/eftposPay/tyro/index.js +9 -8
  66. package/lib/components/eftposPay/windcave/windcave.js +2 -2
  67. package/lib/components/schedules/index.d.ts +1 -1
  68. package/lib/components/schedules/model.d.ts +2 -1
  69. package/lowcode/eftpos-pay/meta.ts +11 -0
  70. package/lowcode/vertical-add-service/meta.ts +71 -0
  71. 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, _g, _h;
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 isPaymentProcessingPayments = (0, import_react.useMemo)(() => {
172
+ const paymentProcessingPayment = (type) => {
173
173
  var _a2;
174
- return !!((_a2 = state.bookingDetail) == null ? void 0 : _a2.payment_processing_payment_nums);
175
- }, [(_e = (_d = state.bookingDetail) == null ? void 0 : _d.payment_processing_payments) == null ? void 0 : _e.length]);
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 (isPaymentProcessingPayments) {
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[(_f = state.bookingDetail) == null ? void 0 : _f.order_sales_channel] || ""),
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"), ":", " ", ((_h = (_g = state.bookingDetail) == null ? void 0 : _g.bookings) == null ? void 0 : _h.booking_id) || "-"), /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-right" }, /* @__PURE__ */ import_react.default.createElement(
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": "退款",
@@ -4,5 +4,5 @@ export interface InfoProps {
4
4
  globalState: any;
5
5
  setGlobalState: any;
6
6
  }
7
- declare const Notes: (props: any) => JSX.Element;
7
+ declare const Notes: (props: any) => any;
8
8
  export default Notes;
@@ -1,5 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { FormState } from "../model";
2
- export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
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) => JSX.Element, Context: import("react").Context<{
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("surRateMoney = ", surRateMoney);
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: onRetry
127
+ onClick: onClose
128
128
  },
129
- import_utils.locales.getText("page.eftpos-pay.text.retry")
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
- onClick: onModify,
137
- disabled: mode !== import_const.ModeEnum.Pay
135
+ className: "pisell-lowcode__eft-pay-step-item-btn",
136
+ onClick: onRetry
138
137
  },
139
- import_utils.locales.getText("page.eftpos-pay.text.modify.payment.info")(mode)
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: onRetry
132
+ onClick: onClose
133
133
  },
134
- import_utils.locales.getText("page.eftpos-pay.text.retry")
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
- onClick: onModify
140
+ className: "pisell-lowcode__eft-pay-step-item-btn",
141
+ onClick: onRetry
142
142
  },
143
- import_utils.locales.getText("page.eftpos-pay.text.modify.payment.info")(mode)
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 !== import_const.ModeEnum.Pay) {
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);
@@ -20,6 +20,8 @@ export declare enum StatusEnum {
20
20
  export declare enum ModeEnum {
21
21
  /** 支付 */
22
22
  Pay = "pay",
23
+ /** 完整支付 */
24
+ FullPay = "fullPay",
23
25
  /** 退款 */
24
26
  Refund = "refund",
25
27
  /** 查询 */
@@ -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: "page" | "success" | "fail", params?: string | {
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 { device, mode, eftpos } = (0, import_store.useContextData)();
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
- dispatch((0, import_store.updateDevice)({ device: list[index] }));
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
- dispatch((0, import_store.updateDevice)({ device: hostDeviceList[0] }));
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
- dispatch((0, import_store.updateDevice)({ device: res.list[0] }));
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
- 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(import_antd.Spin, { spinning: loading }, /* @__PURE__ */ import_react.default.createElement(
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
- list.map(({ id, name }, index) => /* @__PURE__ */ import_react.default.createElement(
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
- key: id,
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
- )) : /* @__PURE__ */ import_react.default.createElement(
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, unset);
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: 0 0 20px;
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: 0 16px;
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, custom, name, symbol, amount } = store;
122
- if (!device || !custom) {
123
- throw Error("device or custom is not defined");
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<"tyro" | "windcave" | "payo" | "stripe">;
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 _default: (props: PosProps) => React.JSX.Element;
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;