@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
@@ -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: {
@@ -21,7 +21,7 @@ import useEngineContext from "../../../../hooks/useEngineContext";
21
21
  import "./index.less";
22
22
  import classNames from 'classnames';
23
23
  var header = function header(_ref) {
24
- var _context$appHelper, _state$bookingDetail2, _state$service2, _state$bookingDetail4, _state$bookingDetail5, _state$bookingDetail6, _state$bookingDetail7, _state$bookingDetail8;
24
+ var _context$appHelper, _state$bookingDetail2, _state$service2, _state$bookingDetail4, _state$bookingDetail5, _state$bookingDetail6;
25
25
  var state = _ref.state,
26
26
  dispatch = _ref.dispatch;
27
27
  var context = useEngineContext();
@@ -292,11 +292,22 @@ var header = function header(_ref) {
292
292
  * @Author: zhiwei.Wang
293
293
  * @Date: 2024-08-22 09:32
294
294
  */
295
- var isPaymentProcessingPayments = useMemo(function () {
295
+ var paymentProcessingPayment = function paymentProcessingPayment(type) {
296
296
  var _state$bookingDetail3;
297
- // 根据订单详情内 待确认支付列表 的长度判断
298
- return !!((_state$bookingDetail3 = state.bookingDetail) !== null && _state$bookingDetail3 !== void 0 && _state$bookingDetail3.payment_processing_payment_nums);
299
- }, [(_state$bookingDetail4 = state.bookingDetail) === null || _state$bookingDetail4 === void 0 ? void 0 : (_state$bookingDetail5 = _state$bookingDetail4.payment_processing_payments) === null || _state$bookingDetail5 === void 0 ? void 0 : _state$bookingDetail5.length]);
297
+ var payments = (state === null || state === void 0 ? void 0 : (_state$bookingDetail3 = state.bookingDetail) === null || _state$bookingDetail3 === void 0 ? void 0 : _state$bookingDetail3.payments) || [];
298
+ var status = ['payment_processing'];
299
+ var payment_method = ['BANK_DEPOSIT'];
300
+
301
+ // 是否有银行转账
302
+ if (type === 'bank') {
303
+ return !!(payments !== null && payments !== void 0 && payments.find(function (item) {
304
+ return status.includes(item === null || item === void 0 ? void 0 : item.status) && payment_method.includes(item === null || item === void 0 ? void 0 : item.payment_method);
305
+ }));
306
+ }
307
+ return !!(payments !== null && payments !== void 0 && payments.find(function (item) {
308
+ return status.includes(item === null || item === void 0 ? void 0 : item.status);
309
+ }));
310
+ };
300
311
 
301
312
  /**
302
313
  * @title: 取消预约
@@ -306,11 +317,16 @@ var header = function header(_ref) {
306
317
  * @Date: 2024-08-22 09:33
307
318
  */
308
319
  var handleCancel = function handleCancel() {
309
- // 存在待确认的支付,则弹窗提示
310
- if (isPaymentProcessingPayments) {
320
+ // 如果支付方式是银行转账,则打开未确认弹窗
321
+ if (paymentProcessingPayment('bank')) {
311
322
  return showPaymentModal();
312
323
  }
313
324
 
325
+ // 存在待确认的支付,则弹窗提示
326
+ if (paymentProcessingPayment()) {
327
+ return showCancelCalendarModal();
328
+ }
329
+
314
330
  // 取消
315
331
  return showCancelledModal();
316
332
  };
@@ -398,6 +414,54 @@ var header = function header(_ref) {
398
414
  });
399
415
  };
400
416
 
417
+ /**
418
+ * @title: 显示去支付的弹窗
419
+ * @description:
420
+ * @return {*}
421
+ * @Author: zhiwei.Wang
422
+ * @Date: 2024-08-22 09:33
423
+ */
424
+ var showCancelCalendarModal = function showCancelCalendarModal() {
425
+ setModalContentState({
426
+ className: 'go-payments-modal-wrap',
427
+ open: true,
428
+ width: 480,
429
+ onCancel: function onCancel() {
430
+ setModalContentState({
431
+ open: false
432
+ });
433
+ },
434
+ children: /*#__PURE__*/React.createElement("div", {
435
+ className: "go-payments-modal-content"
436
+ }, /*#__PURE__*/React.createElement("div", {
437
+ className: "go-payments-modal-content-title"
438
+ }, locales.getText('page.booking.text.cancel-booking')), /*#__PURE__*/React.createElement("div", {
439
+ className: "go-payments-modal-content-desc"
440
+ }, locales.getText('page.booking.text.cancel.calendar.msg')), /*#__PURE__*/React.createElement("div", {
441
+ className: "go-payments-footer"
442
+ }, /*#__PURE__*/React.createElement(Button, {
443
+ className: "go-payments-footer-btn",
444
+ size: "large",
445
+ onClick: function onClick() {
446
+ setModalContentState({
447
+ open: false
448
+ });
449
+ }
450
+ }, locales.getText('page.booking.text.go-back')), /*#__PURE__*/React.createElement(Button, {
451
+ className: "go-payments-footer-btn",
452
+ type: "primary",
453
+ size: "large",
454
+ onClick: function onClick() {
455
+ setBookingStatus('cancelled');
456
+ setModalContentState({
457
+ open: false
458
+ });
459
+ }
460
+ }, locales.getText('page.booking.text.cancel-booking')))),
461
+ footer: null
462
+ });
463
+ };
464
+
401
465
  /**
402
466
  * @title: 显示取消预约弹窗
403
467
  * @description:
@@ -491,11 +555,11 @@ var header = function header(_ref) {
491
555
  }
492
556
  }, /*#__PURE__*/React.createElement("div", {
493
557
  className: "booking-order-sales-channel"
494
- }, orderSalesChannel[(_state$bookingDetail6 = state.bookingDetail) === null || _state$bookingDetail6 === void 0 ? void 0 : _state$bookingDetail6.order_sales_channel] || ''), /*#__PURE__*/React.createElement("div", {
558
+ }, orderSalesChannel[(_state$bookingDetail4 = state.bookingDetail) === null || _state$bookingDetail4 === void 0 ? void 0 : _state$bookingDetail4.order_sales_channel] || ''), /*#__PURE__*/React.createElement("div", {
495
559
  className: "booking-header-line-2"
496
560
  }, /*#__PURE__*/React.createElement("div", {
497
561
  className: "booking-header-left"
498
- }, locales.getText('pisell2.text.status.booking_id'), ":", ' ', ((_state$bookingDetail7 = state.bookingDetail) === null || _state$bookingDetail7 === void 0 ? void 0 : (_state$bookingDetail8 = _state$bookingDetail7.bookings) === null || _state$bookingDetail8 === void 0 ? void 0 : _state$bookingDetail8.booking_id) || '-'), /*#__PURE__*/React.createElement("div", {
562
+ }, locales.getText('pisell2.text.status.booking_id'), ":", ' ', ((_state$bookingDetail5 = state.bookingDetail) === null || _state$bookingDetail5 === void 0 ? void 0 : (_state$bookingDetail6 = _state$bookingDetail5.bookings) === null || _state$bookingDetail6 === void 0 ? void 0 : _state$bookingDetail6.booking_id) || '-'), /*#__PURE__*/React.createElement("div", {
499
563
  className: "booking-header-right"
500
564
  }, /*#__PURE__*/React.createElement(Dropdown, {
501
565
  menu: {
@@ -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;
@@ -208,6 +208,7 @@ export default {
208
208
  'page.event.booking.text.duplicate-enrollment-confirm': 'Confirm',
209
209
  'page.booking.text.unconfirmed-payments': 'Unconfirmed payments',
210
210
  'page.booking.text.unconfirmed-payments.msg': 'There are unconfirmed payments, please confirm or void the payments first.',
211
+ 'page.booking.text.cancel.calendar.msg': 'Are you sure you want to cancel the appointment? This appointment will be removed from the calendar.',
211
212
  'page.booking.text.go-to-payments': 'Go to payments',
212
213
  'page.booking.text.cancel-only': 'Cancel only',
213
214
  'page.booking.text.refund': 'Refund',
@@ -436,6 +437,7 @@ export default {
436
437
  'page.event.booking.text.duplicate-enrollment-confirm': '确认',
437
438
  'page.booking.text.unconfirmed-payments': '未确认的付款',
438
439
  'page.booking.text.unconfirmed-payments.msg': '存在未确认的付款,请先确认收款或作废。',
440
+ 'page.booking.text.cancel.calendar.msg': '确定要取消预约吗?此预约将从日历中移除。',
439
441
  'page.booking.text.go-to-payments': '前往收款界面',
440
442
  'page.booking.text.cancel-only': '仅取消',
441
443
  'page.booking.text.refund': '退款',
@@ -664,6 +666,7 @@ export default {
664
666
  'page.event.booking.text.duplicate-enrollment-confirm': '確認',
665
667
  'page.booking.text.unconfirmed-payments': '未確認的付款',
666
668
  'page.booking.text.unconfirmed-payments.msg': '存在未確認的付款,請先確認收款或作廢。',
669
+ 'page.booking.text.cancel.calendar.msg': '確定要取消預約嗎?此預約將從日曆中移除。',
667
670
  'page.booking.text.go-to-payments': '前往收款界面',
668
671
  'page.booking.text.cancel-only': '僅取消',
669
672
  '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: {
@@ -142,7 +142,7 @@ export default (function (_ref) {
142
142
  surRateMoney: "".concat(surRateMoney),
143
143
  totalUnit: formatAmount(total, 2, symbol)
144
144
  };
145
- console.log('surRateMoney = ', surRateMoney);
145
+ console.log('amount pay = ', pay);
146
146
  dispatch(updateState({
147
147
  pay: pay
148
148
  }));
@@ -133,12 +133,11 @@ export default (function (_ref) {
133
133
  }, /*#__PURE__*/React.createElement(Button, {
134
134
  block: true,
135
135
  className: "pisell-lowcode__eft-pay-step-item-btn",
136
- onClick: onRetry
137
- }, locales.getText('page.eftpos-pay.text.retry')), /*#__PURE__*/React.createElement(Button, {
136
+ onClick: onClose
137
+ }, locales.getText('page.eftpos-pay.text.cancel')), /*#__PURE__*/React.createElement(Button, {
138
138
  block: true,
139
- className: "pisell-lowcode__eft-pay-step-item-btn",
140
139
  type: "primary",
141
- onClick: onModify,
142
- disabled: mode !== ModeEnum.Pay
143
- }, locales.getText('page.eftpos-pay.text.modify.payment.info')(mode))));
140
+ className: "pisell-lowcode__eft-pay-step-item-btn",
141
+ onClick: onRetry
142
+ }, locales.getText('page.eftpos-pay.text.retry'))));
144
143
  });
@@ -129,11 +129,11 @@ export default (function (_ref) {
129
129
  }, /*#__PURE__*/React.createElement(Button, {
130
130
  block: true,
131
131
  className: "pisell-lowcode__eft-pay-step-item-btn",
132
- onClick: onRetry
133
- }, locales.getText('page.eftpos-pay.text.retry')), /*#__PURE__*/React.createElement(Button, {
132
+ onClick: onClose
133
+ }, locales.getText('page.eftpos-pay.text.cancel')), /*#__PURE__*/React.createElement(Button, {
134
134
  block: true,
135
- className: "pisell-lowcode__eft-pay-step-item-btn",
136
135
  type: "primary",
137
- onClick: onModify
138
- }, locales.getText('page.eftpos-pay.text.modify.payment.info')(mode))));
136
+ className: "pisell-lowcode__eft-pay-step-item-btn",
137
+ onClick: onRetry
138
+ }, locales.getText('page.eftpos-pay.text.retry'))));
139
139
  });
@@ -123,7 +123,7 @@ export default (function (_ref) {
123
123
  return;
124
124
  }
125
125
  setDisabled(true);
126
- if (mode !== ModeEnum.Pay) {
126
+ if (mode === ModeEnum.Refund || mode === ModeEnum.Query) {
127
127
  return;
128
128
  }
129
129
  var prevMoneyDeci = new Decimal((pay === null || pay === void 0 ? 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
  /** 查询 */
@@ -19,6 +19,7 @@ export var StatusEnum;
19
19
  export var ModeEnum;
20
20
  (function (ModeEnum) {
21
21
  ModeEnum["Pay"] = "pay";
22
+ ModeEnum["FullPay"] = "fullPay";
22
23
  ModeEnum["Refund"] = "refund";
23
24
  ModeEnum["Query"] = "query";
24
25
  })(ModeEnum || (ModeEnum = {}));
@@ -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;
@@ -1,3 +1,9 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
8
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
9
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -10,7 +16,10 @@ import { Spin, message } from 'antd';
10
16
  import React, { useState } from 'react';
11
17
  import Titlebar from "./component/header/titlebar";
12
18
  import { ModeEnum } from "./const";
13
- import { useDispatch, useContextData, updateDevice } from "./store";
19
+ import { getPayAmonunt } from "./helper";
20
+ import ChevronRight from '@pisell/icon/es/ChevronRight';
21
+ import { useDispatch, useContextData, updateDevice, updateState } from "./store";
22
+ import { getAmonunt } from "./manufacturer";
14
23
  import "./device.less";
15
24
 
16
25
  /**
@@ -28,11 +37,16 @@ export default (function (_ref) {
28
37
  className = _ref$className === void 0 ? '' : _ref$className,
29
38
  device_number = _ref.device_number,
30
39
  isIpad = _ref.isIpad,
31
- net = _ref.net;
32
- var _useContextData = useContextData(),
33
- device = _useContextData.device,
34
- mode = _useContextData.mode,
35
- eftpos = _useContextData.eftpos;
40
+ net = _ref.net,
41
+ _ref$formatAmount = _ref.formatAmount,
42
+ formatAmount = _ref$formatAmount === void 0 ? function (number, precision, symbol) {
43
+ return "".concat(symbol).concat(number);
44
+ } : _ref$formatAmount;
45
+ var store = useContextData();
46
+ var device = store.device,
47
+ symbol = store.symbol,
48
+ mode = store.mode,
49
+ eftpos = store.eftpos;
36
50
  var _useState = useState(false),
37
51
  _useState2 = _slicedToArray(_useState, 2),
38
52
  loading = _useState2[0],
@@ -64,12 +78,7 @@ export default (function (_ref) {
64
78
  }
65
79
  var _ref2 = [Number(event.currentTarget.dataset.index)],
66
80
  index = _ref2[0];
67
- dispatch(updateDevice({
68
- device: list[index]
69
- }));
70
- if (typeof onChange === 'function') {
71
- onChange('page', mode === ModeEnum.Pay ? 'amount' : 'pay');
72
- }
81
+ setDevice(list[index]);
73
82
  };
74
83
 
75
84
  /**
@@ -95,33 +104,17 @@ export default (function (_ref) {
95
104
  });
96
105
  if (hostDeviceList.length >= 1) {
97
106
  setDataStaus(true);
98
- setList(hostDeviceList);
107
+ setList(setDeviceList(hostDeviceList));
99
108
  if (hostDeviceList.length === 1) {
100
- dispatch(updateDevice({
101
- device: hostDeviceList[0]
102
- }));
103
- if (typeof api.selectDevice === 'function') {
104
- api.selectDevice(hostDeviceList[0]);
105
- }
106
- if (typeof onChange === 'function') {
107
- onChange('page', mode === ModeEnum.Pay ? 'amount' : 'pay');
108
- }
109
+ setDevice(hostDeviceList[0]);
109
110
  }
110
111
  return;
111
112
  }
112
113
  }
113
114
  setDataStaus(true);
114
- setList(res.list);
115
+ setList(setDeviceList(res.list));
115
116
  if (res.list.length === 1) {
116
- dispatch(updateDevice({
117
- device: res.list[0]
118
- }));
119
- if (typeof api.selectDevice === 'function') {
120
- api.selectDevice(res.list[0]);
121
- }
122
- if (typeof onChange === 'function') {
123
- onChange('page', mode === ModeEnum.Pay ? 'amount' : 'pay');
124
- }
117
+ setDevice(res.list[0]);
125
118
  }
126
119
  return;
127
120
  }
@@ -131,21 +124,73 @@ export default (function (_ref) {
131
124
  setLoading(false);
132
125
  });
133
126
  });
127
+ var setDevice = function setDevice(device) {
128
+ dispatch(updateDevice({
129
+ device: device
130
+ }));
131
+ if (typeof api.selectDevice === 'function') {
132
+ api.selectDevice(device);
133
+ }
134
+ if (typeof onChange === 'function') {
135
+ if (mode === ModeEnum.Pay) {
136
+ if (device.pay) {
137
+ dispatch(updateState({
138
+ pay: device.pay
139
+ }));
140
+ } else {
141
+ var amonunt = getAmonunt(_objectSpread(_objectSpread({}, store), {}, {
142
+ device: device
143
+ }));
144
+ var pay = getPayAmonunt(amonunt, function (total) {
145
+ return formatAmount(total, 2, symbol);
146
+ });
147
+ dispatch(updateState({
148
+ pay: pay
149
+ }));
150
+ }
151
+ }
152
+ onChange('page', mode === ModeEnum.FullPay ? 'amount' : 'pay');
153
+ }
154
+ };
155
+ var setDeviceList = function setDeviceList(list) {
156
+ return list.map(function (item) {
157
+ var amonunt = getAmonunt(_objectSpread(_objectSpread({}, store), {}, {
158
+ device: item
159
+ }));
160
+ var pay = getPayAmonunt(amonunt, function (total) {
161
+ return formatAmount(total, 2, symbol);
162
+ });
163
+ return _objectSpread(_objectSpread({}, item), {}, {
164
+ pay: pay
165
+ });
166
+ });
167
+ };
134
168
  return /*#__PURE__*/React.createElement("div", {
135
169
  className: "pisell-lowcode__eft-pay-device-box ".concat(className)
136
170
  }, isIpad ? null : /*#__PURE__*/React.createElement(Titlebar, {
137
171
  type: "left-title-close",
138
172
  onClose: onClose
139
- }, dataStaus ? locales.getText('page.eftpos-pay.text.device') : ''), dataStaus ? /*#__PURE__*/React.createElement(Spin, {
140
- spinning: loading
141
- }, /*#__PURE__*/React.createElement("div", {
173
+ }, dataStaus ? locales.getText('page.eftpos-pay.text.device') : ''), dataStaus ? /*#__PURE__*/React.createElement("div", {
142
174
  className: "pisell-lowcode__eft-pay-device-list",
143
175
  style: isIpad ? {
144
176
  marginTop: '20px'
145
177
  } : {}
178
+ }, /*#__PURE__*/React.createElement(Spin, {
179
+ spinning: loading,
180
+ style: {
181
+ flex: 1,
182
+ overflow: 'auto'
183
+ }
184
+ }, /*#__PURE__*/React.createElement("div", {
185
+ style: {
186
+ display: 'flex',
187
+ flexDirection: 'column',
188
+ gap: '10px'
189
+ }
146
190
  }, list.map(function (_ref3, index) {
147
191
  var id = _ref3.id,
148
- name = _ref3.name;
192
+ name = _ref3.name,
193
+ pay = _ref3.pay;
149
194
  return /*#__PURE__*/React.createElement("div", {
150
195
  key: id,
151
196
  className: "pisell-lowcode__eft-pay-device ".concat(id === (device === null || device === void 0 ? void 0 : device.id) ? 'active' : ''),
@@ -153,8 +198,25 @@ export default (function (_ref) {
153
198
  onClick: onClick,
154
199
  role: "button",
155
200
  tabIndex: index
156
- }, name);
157
- }))) : /*#__PURE__*/React.createElement("div", {
201
+ }, /*#__PURE__*/React.createElement("div", {
202
+ className: "pisell-lowcode__eft-pay-device-content"
203
+ }, /*#__PURE__*/React.createElement("div", {
204
+ className: "pisell-lowcode__eft-pay-device-name"
205
+ }, name), /*#__PURE__*/React.createElement("div", {
206
+ className: "pisell-lowcode__eft-pay-device-money"
207
+ }, pay.totalUnit), /*#__PURE__*/React.createElement("div", {
208
+ className: "pisell-lowcode__eft-pay-device-sucharge"
209
+ }, locales.getText('page.eftpos-pay.text.surcharge.edit.inc.surcharge'), ": ", formatAmount("".concat(pay.surcharge), 2, symbol), " (", locales.getText('page.eftpos-pay.text.surcharge.edit.rate'), ":", pay.surRate, "% +", ' ', formatAmount("".concat(pay.surMoney), 2, symbol), ")")), /*#__PURE__*/React.createElement("div", {
210
+ style: {
211
+ flexShrink: 0
212
+ }
213
+ }, /*#__PURE__*/React.createElement(ChevronRight, {
214
+ style: {
215
+ fontWeight: '600',
216
+ fontSize: '24px'
217
+ }
218
+ })));
219
+ })))) : /*#__PURE__*/React.createElement("div", {
158
220
  className: "pisell-lowcode__eft-pay-device-error",
159
221
  style: isIpad ? {
160
222
  marginTop: '20px'
@@ -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 {};