@pisell/private-materials 3.0.141 → 3.0.143

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 (64) 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 +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +12 -12
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  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/notes/index.d.ts +1 -1
  14. package/es/components/booking/notes/model.d.ts +2 -1
  15. package/es/components/booking/payments/model.d.ts +2 -1
  16. package/es/components/eftposPay/amount.js +1 -1
  17. package/es/components/eftposPay/component/fail/failCustom.js +5 -6
  18. package/es/components/eftposPay/component/fail/index.js +5 -5
  19. package/es/components/eftposPay/component/manual/index.js +1 -1
  20. package/es/components/eftposPay/const.d.ts +2 -0
  21. package/es/components/eftposPay/const.js +1 -0
  22. package/es/components/eftposPay/device.d.ts +2 -1
  23. package/es/components/eftposPay/device.js +100 -38
  24. package/es/components/eftposPay/device.less +37 -4
  25. package/es/components/eftposPay/helper.d.ts +11 -0
  26. package/es/components/eftposPay/helper.js +29 -6
  27. package/es/components/eftposPay/hooks.d.ts +1 -1
  28. package/es/components/eftposPay/index.d.ts +4 -1
  29. package/es/components/eftposPay/index.js +22 -11
  30. package/es/components/eftposPay/locales.js +45 -45
  31. package/es/components/eftposPay/payo/config.js +1 -1
  32. package/es/components/eftposPay/store/index.d.ts +1 -1
  33. package/es/components/eftposPay/tyro/index.js +8 -2
  34. package/es/components/eftposPay/windcave/windcave.js +2 -2
  35. package/es/components/schedules/index.d.ts +1 -1
  36. package/es/components/schedules/model.d.ts +2 -1
  37. package/lib/components/booking/addons/model.d.ts +2 -1
  38. package/lib/components/booking/forms/model.d.ts +2 -1
  39. package/lib/components/booking/notes/index.d.ts +1 -1
  40. package/lib/components/booking/notes/model.d.ts +2 -1
  41. package/lib/components/booking/payments/model.d.ts +2 -1
  42. package/lib/components/eftposPay/amount.js +2 -6
  43. package/lib/components/eftposPay/component/fail/failCustom.js +5 -6
  44. package/lib/components/eftposPay/component/fail/index.js +5 -5
  45. package/lib/components/eftposPay/component/manual/index.js +1 -1
  46. package/lib/components/eftposPay/const.d.ts +2 -0
  47. package/lib/components/eftposPay/const.js +1 -0
  48. package/lib/components/eftposPay/device.d.ts +2 -1
  49. package/lib/components/eftposPay/device.js +73 -32
  50. package/lib/components/eftposPay/device.less +37 -4
  51. package/lib/components/eftposPay/helper.d.ts +11 -0
  52. package/lib/components/eftposPay/helper.js +26 -4
  53. package/lib/components/eftposPay/hooks.d.ts +1 -1
  54. package/lib/components/eftposPay/index.d.ts +4 -1
  55. package/lib/components/eftposPay/index.js +16 -6
  56. package/lib/components/eftposPay/locales.js +45 -45
  57. package/lib/components/eftposPay/payo/config.js +1 -1
  58. package/lib/components/eftposPay/store/index.d.ts +1 -1
  59. package/lib/components/eftposPay/tyro/index.js +9 -8
  60. package/lib/components/eftposPay/windcave/windcave.js +2 -2
  61. package/lib/components/schedules/index.d.ts +1 -1
  62. package/lib/components/schedules/model.d.ts +2 -1
  63. package/lowcode/eftpos-pay/meta.ts +11 -0
  64. package/package.json +2 -2
@@ -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: {
@@ -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,7 +8,7 @@ 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
14
  onChange?: ((status: "page" | "success" | "fail", params?: string | {
@@ -18,5 +18,6 @@ declare const _default: ({ api, onChange, onClose, className, device_number, isI
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 {};
@@ -65,7 +65,7 @@ export var getPayParams = function getPayParams(data, statue) {
65
65
  order_id: data.order_id
66
66
  };
67
67
  }
68
- if (data.mode === ModeEnum.Pay) {
68
+ if (data.mode === ModeEnum.Pay || data.mode === ModeEnum.FullPay) {
69
69
  var _data$custom;
70
70
  var pay = data.pay;
71
71
  var card_reader_surcharge = ((_data$custom = data.custom) === null || _data$custom === void 0 ? void 0 : _data$custom.card_reader_surcharge) || 0;
@@ -128,7 +128,7 @@ export var limitDecimals = function limitDecimals(value) {
128
128
 
129
129
  /**
130
130
  * @title: 通用获取 金额信息
131
- * @description: 在 amount 页面设置则使用 pay ,如果有 setting 则使用 setting 信息 ,都没有则设置0
131
+ * @description: 在 amount 页面设置则使用 pay ,如果有 setting 则使用 setting 信息 ,都没有则设置0
132
132
  * @param {State} store : 全局store数据管理
133
133
  * @Author: hongbing.wang
134
134
  * @Date: 2024-08-12 10:24
@@ -136,12 +136,11 @@ export var limitDecimals = function limitDecimals(value) {
136
136
  export function getAmonunt(store) {
137
137
  var device = store.device,
138
138
  pay = store.pay,
139
- custom = store.custom,
140
139
  name = store.name,
141
140
  symbol = store.symbol,
142
141
  amount = store.amount;
143
- if (!device || !custom) {
144
- throw Error('device or custom is not defined');
142
+ if (!device) {
143
+ throw Error('device is not defined');
145
144
  }
146
145
  var setting = device.setting;
147
146
 
@@ -176,7 +175,7 @@ export function getAmonunt(store) {
176
175
  // 原始手续费 是指 各个pos机厂商跟银行合作直接收取的手续费,一旦设置则清空,配置中设置的手续费
177
176
  var useOriginSurcharge = setting.useOriginSurcharge || false;
178
177
 
179
- // 直接设备中手续费金额
178
+ // 直接设备中手续费金额
180
179
  var surRate = setting.constant_rate || 0;
181
180
  var surMoney = setting.constant_money || 0;
182
181
 
@@ -192,4 +191,28 @@ export function getAmonunt(store) {
192
191
  surcharge: surcharge,
193
192
  useOriginSurcharge: useOriginSurcharge
194
193
  };
194
+ }
195
+ export function getPayAmonunt(_ref, formatAmount) {
196
+ var money = _ref.money,
197
+ amount = _ref.amount,
198
+ surRate = _ref.surRate,
199
+ surMoney = _ref.surMoney;
200
+ var surRateDeci = new Decimal(surRate);
201
+ var moneyDeci = new Decimal(amount);
202
+ var surMoneyDeci = new Decimal(surMoney);
203
+ var surRateMoney = moneyDeci.mul(surRateDeci.div(100)).toFixed(2, Decimal.ROUND_HALF_UP);
204
+ var totalSurMoney = moneyDeci.mul(surRateDeci.div(100)).add(surMoneyDeci);
205
+ var rate = new Decimal(surRate).div(100).toFixed(4, Decimal.ROUND_HALF_UP);
206
+ var total = totalSurMoney.add(moneyDeci).toFixed(2, Decimal.ROUND_HALF_UP);
207
+ return {
208
+ sourceAmount: "".concat(money),
209
+ amount: "".concat(amount),
210
+ surcharge: "".concat(totalSurMoney),
211
+ total: "".concat(total),
212
+ surPercentRate: "".concat(rate),
213
+ surRate: "".concat(surRate),
214
+ surMoney: "".concat(surMoney),
215
+ surRateMoney: "".concat(surRateMoney),
216
+ totalUnit: formatAmount(total)
217
+ };
195
218
  }
@@ -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;
@@ -1,5 +1,7 @@
1
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
- var _excluded = ["action", "getApi", "device_number", "terminal", "tyroUrl", "tyroVersion", "onChangeParams"];
2
+ var _excluded = ["action", "getApi", "device_number", "terminal", "tyroUrl", "tyroVersion", "onChangeParams"],
3
+ _excluded2 = ["key"];
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
5
  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; }
4
6
  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; }
5
7
  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; }
@@ -155,7 +157,8 @@ var App = function App(_ref) {
155
157
  isIpad: isIpad,
156
158
  className: isIpad ? 'pisell-lowcode__eft-pay-terminal' : '',
157
159
  net: net,
158
- device_number: device_number
160
+ device_number: device_number,
161
+ formatAmount: formatAmount
159
162
  });
160
163
  }
161
164
  if (current === RouteEnum.Amount) {
@@ -180,7 +183,7 @@ var App = function App(_ref) {
180
183
  formatAmount: formatAmount
181
184
  });
182
185
  };
183
- export default (function (props) {
186
+ export var Root = function Root(props) {
184
187
  var _context$appHelper2, _store$getState, _store$getState$call, _store$getState$call$, _props$params, _props$params2;
185
188
  var context = useEngineContext();
186
189
  var _ref3 = ((_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils) || {
@@ -232,7 +235,7 @@ export default (function (props) {
232
235
  if (state.action) {
233
236
  return state.action;
234
237
  }
235
- if (mode === ModeEnum.Pay) {
238
+ if (mode === ModeEnum.Pay || mode === ModeEnum.FullPay) {
236
239
  if (state.device && state.pay) {
237
240
  return RouteEnum.Pay;
238
241
  }
@@ -252,15 +255,16 @@ export default (function (props) {
252
255
  }
253
256
  throw Error('未知模式');
254
257
  }();
255
- if (props.source === 'restore') {
256
- onChangeStatus('page', act);
257
- }
258
+
259
+ // if(props.source === 'restore'){
260
+ onChangeStatus('page', act);
261
+ // }
258
262
  return act;
259
263
  }, [mode, state]);
260
-
261
- // useEffect(() => {
262
- // document.body.id = 'body';
263
- // }, []);
264
+ useEffect(function () {
265
+ // document.body.id = 'body';
266
+ console.log('初始化 ........');
267
+ }, []);
264
268
 
265
269
  // console.log('action = ', action);
266
270
  console.log('props?.params?.device_number = ', props === null || props === void 0 ? void 0 : (_props$params = props.params) === null || _props$params === void 0 ? void 0 : _props$params.device_number);
@@ -276,4 +280,11 @@ export default (function (props) {
276
280
  source: props.source,
277
281
  device_number: props === null || props === void 0 ? void 0 : (_props$params2 = props.params) === null || _props$params2 === void 0 ? void 0 : _props$params2.device_number
278
282
  }));
283
+ };
284
+ export default (function (_ref4) {
285
+ var key = _ref4.key,
286
+ props = _objectWithoutProperties(_ref4, _excluded2);
287
+ return /*#__PURE__*/React.createElement(Root, _extends({}, props, {
288
+ key: key
289
+ }));
279
290
  });