@pisell/private-materials 3.0.14-2.gray → 3.0.14-5.gray

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 (52) 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/eftpos/surcharge/index.js +1 -1
  12. package/es/components/eftposPay/amount.d.ts +1 -1
  13. package/es/components/eftposPay/amount.js +4 -1
  14. package/es/components/eftposPay/component/fail/failCustom.js +5 -6
  15. package/es/components/eftposPay/component/fail/index.js +5 -5
  16. package/es/components/eftposPay/component/manual/index.js +2 -1
  17. package/es/components/eftposPay/const.d.ts +2 -0
  18. package/es/components/eftposPay/const.js +1 -0
  19. package/es/components/eftposPay/device.d.ts +3 -2
  20. package/es/components/eftposPay/device.js +100 -38
  21. package/es/components/eftposPay/device.less +37 -4
  22. package/es/components/eftposPay/helper.d.ts +11 -0
  23. package/es/components/eftposPay/helper.js +33 -9
  24. package/es/components/eftposPay/index.js +12 -9
  25. package/es/components/eftposPay/locales.js +45 -45
  26. package/es/components/eftposPay/payo/config.js +1 -1
  27. package/es/components/eftposPay/payo/const.js +1 -1
  28. package/es/components/eftposPay/tyro/index.js +8 -2
  29. package/es/components/eftposPay/windcave/const.js +1 -1
  30. package/es/components/eftposPay/windcave/windcave.js +2 -2
  31. package/lib/components/eftpos/surcharge/index.js +1 -1
  32. package/lib/components/eftposPay/amount.d.ts +1 -1
  33. package/lib/components/eftposPay/amount.js +5 -6
  34. package/lib/components/eftposPay/component/fail/failCustom.js +5 -6
  35. package/lib/components/eftposPay/component/fail/index.js +5 -5
  36. package/lib/components/eftposPay/component/manual/index.js +2 -1
  37. package/lib/components/eftposPay/const.d.ts +2 -0
  38. package/lib/components/eftposPay/const.js +1 -0
  39. package/lib/components/eftposPay/device.d.ts +3 -2
  40. package/lib/components/eftposPay/device.js +73 -32
  41. package/lib/components/eftposPay/device.less +37 -4
  42. package/lib/components/eftposPay/helper.d.ts +11 -0
  43. package/lib/components/eftposPay/helper.js +27 -5
  44. package/lib/components/eftposPay/index.js +8 -5
  45. package/lib/components/eftposPay/locales.js +45 -45
  46. package/lib/components/eftposPay/payo/config.js +1 -1
  47. package/lib/components/eftposPay/payo/const.js +1 -1
  48. package/lib/components/eftposPay/tyro/index.js +9 -8
  49. package/lib/components/eftposPay/windcave/const.js +1 -1
  50. package/lib/components/eftposPay/windcave/windcave.js +2 -2
  51. package/lowcode/eftpos-pay/meta.ts +11 -0
  52. package/package.json +4 -4
@@ -55,7 +55,7 @@ export var getCommDefaultVal = function getCommDefaultVal(commConfig) {
55
55
  var _ref;
56
56
  var top = commConfig.top.input.defaultValue;
57
57
  var origin = commConfig.origin.input.defaultValue;
58
- return _ref = {}, _defineProperty(_ref, commConfig.origin.__sourceName, typeof origin === 'undefined' ? true : origin), _defineProperty(_ref, commConfig.top.__sourceName, typeof top === 'undefined' ? true : top), _defineProperty(_ref, commConfig.left.__sourceName, commConfig.left.input.defaultValue || 0), _defineProperty(_ref, commConfig.right.__sourceName, commConfig.right.input.defaultValue || 0), _ref;
58
+ return _ref = {}, _defineProperty(_ref, commConfig.origin.__sourceName, typeof origin === 'undefined' ? false : origin), _defineProperty(_ref, commConfig.top.__sourceName, typeof top === 'undefined' ? true : top), _defineProperty(_ref, commConfig.left.__sourceName, commConfig.left.input.defaultValue || 0), _defineProperty(_ref, commConfig.right.__sourceName, commConfig.right.input.defaultValue || 0), _ref;
59
59
  };
60
60
 
61
61
  /**
@@ -9,7 +9,7 @@ import { PosProps } from './const';
9
9
  */
10
10
  declare const _default: ({ className, onChange, onClose, formatAmount, isIpad, net, }: {
11
11
  className?: string | undefined;
12
- onChange?: ((status: "page" | "success" | "fail", params?: string | {
12
+ onChange?: ((status: "fail" | "success" | "page", params?: string | {
13
13
  [keys: string]: unknown;
14
14
  } | undefined) => void) | undefined;
15
15
  onClose: () => void;
@@ -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
  }));
@@ -196,6 +196,7 @@ export default (function (_ref) {
196
196
  }, /*#__PURE__*/React.createElement("div", {
197
197
  className: "pisell-lowcode__eft-pay-money-title"
198
198
  }, locales.getText('page.eftpos-pay.text.input.title')(name)), /*#__PURE__*/React.createElement(InputNumber, {
199
+ type: "number",
199
200
  addonBefore: symbol || '$',
200
201
  max: money,
201
202
  precision: 2,
@@ -236,6 +237,7 @@ export default (function (_ref) {
236
237
  }, /*#__PURE__*/React.createElement("div", {
237
238
  className: "pisell-lowcode__eft-pay-amount-item-title"
238
239
  }, locales.getText('page.eftpos-pay.text.surcharge.percentage')), /*#__PURE__*/React.createElement(InputNumber, {
240
+ type: "number",
239
241
  value: tempSurRate,
240
242
  min: 0,
241
243
  max: 100,
@@ -252,6 +254,7 @@ export default (function (_ref) {
252
254
  }, /*#__PURE__*/React.createElement("div", {
253
255
  className: "pisell-lowcode__eft-pay-amount-item-title"
254
256
  }, locales.getText('page.eftpos-pay.text.surcharge.fixed')), /*#__PURE__*/React.createElement(InputNumber, {
257
+ type: "number",
255
258
  value: tempSurMoney,
256
259
  min: 0,
257
260
  max: 100000,
@@ -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);
@@ -179,6 +179,7 @@ export default (function (_ref) {
179
179
  }, /*#__PURE__*/React.createElement("div", {
180
180
  className: "pisell-lowcode__eft-pay-manual-edit-text"
181
181
  }, locales.getText('page.eftpos-pay.text.manual.tip')), /*#__PURE__*/React.createElement(InputNumber, {
182
+ type: "number",
182
183
  addonBefore: symbol || '$',
183
184
  min: pay === null || pay === void 0 ? void 0 : pay.total,
184
185
  precision: 2,
@@ -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 {};
@@ -5,7 +5,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
5
5
  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); }
6
6
  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); }
7
7
  import { Decimal } from 'decimal.js';
8
- import { ModeEnum } from "./const";
8
+ import { ModeEnum, EftposEnum } from "./const";
9
9
  /* eslint-disable no-bitwise */
10
10
  export function getUuid() {
11
11
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxx'.replace(/[xy]/g, function (c) {
@@ -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,12 @@ 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
- amount = store.amount;
143
- if (!device || !custom) {
144
- throw Error('device or custom is not defined');
141
+ amount = store.amount,
142
+ eftpos = store.eftpos;
143
+ if (!device) {
144
+ throw Error('device is not defined');
145
145
  }
146
146
  var setting = device.setting;
147
147
 
@@ -174,9 +174,9 @@ export function getAmonunt(store) {
174
174
  };
175
175
  }
176
176
  // 原始手续费 是指 各个pos机厂商跟银行合作直接收取的手续费,一旦设置则清空,配置中设置的手续费
177
- var useOriginSurcharge = setting.useOriginSurcharge || false;
177
+ var useOriginSurcharge = eftpos === EftposEnum.Tyro ? setting.useOriginSurcharge || false : false;
178
178
 
179
- // 直接设备中手续费金额
179
+ // 直接设备中手续费金额
180
180
  var surRate = setting.constant_rate || 0;
181
181
  var surMoney = setting.constant_money || 0;
182
182
 
@@ -192,4 +192,28 @@ export function getAmonunt(store) {
192
192
  surcharge: surcharge,
193
193
  useOriginSurcharge: useOriginSurcharge
194
194
  };
195
+ }
196
+ export function getPayAmonunt(_ref, formatAmount) {
197
+ var money = _ref.money,
198
+ amount = _ref.amount,
199
+ surRate = _ref.surRate,
200
+ surMoney = _ref.surMoney;
201
+ var surRateDeci = new Decimal(surRate);
202
+ var moneyDeci = new Decimal(amount);
203
+ var surMoneyDeci = new Decimal(surMoney);
204
+ var surRateMoney = moneyDeci.mul(surRateDeci.div(100)).toFixed(2, Decimal.ROUND_HALF_UP);
205
+ var totalSurMoney = moneyDeci.mul(surRateDeci.div(100)).add(surMoneyDeci);
206
+ var rate = new Decimal(surRate).div(100).toFixed(4, Decimal.ROUND_HALF_UP);
207
+ var total = totalSurMoney.add(moneyDeci).toFixed(2, Decimal.ROUND_HALF_UP);
208
+ return {
209
+ sourceAmount: "".concat(money),
210
+ amount: "".concat(amount),
211
+ surcharge: "".concat(totalSurMoney),
212
+ total: "".concat(total),
213
+ surPercentRate: "".concat(rate),
214
+ surRate: "".concat(surRate),
215
+ surMoney: "".concat(surMoney),
216
+ surRateMoney: "".concat(surRateMoney),
217
+ totalUnit: formatAmount(total)
218
+ };
195
219
  }
@@ -45,6 +45,7 @@ var App = function App(_ref) {
45
45
  setCurrent = _useState2[1];
46
46
  var statusRef = useRef(data.status);
47
47
  var context = useEngineContext();
48
+ console.log('context = ', context);
48
49
  var _ref2 = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {
49
50
  formatAmount: function formatAmount(number, precision, symbol) {
50
51
  return "".concat(symbol).concat(number);
@@ -155,7 +156,8 @@ var App = function App(_ref) {
155
156
  isIpad: isIpad,
156
157
  className: isIpad ? 'pisell-lowcode__eft-pay-terminal' : '',
157
158
  net: net,
158
- device_number: device_number
159
+ device_number: device_number,
160
+ formatAmount: formatAmount
159
161
  });
160
162
  }
161
163
  if (current === RouteEnum.Amount) {
@@ -232,7 +234,7 @@ export default (function (props) {
232
234
  if (state.action) {
233
235
  return state.action;
234
236
  }
235
- if (mode === ModeEnum.Pay) {
237
+ if (mode === ModeEnum.Pay || mode === ModeEnum.FullPay) {
236
238
  if (state.device && state.pay) {
237
239
  return RouteEnum.Pay;
238
240
  }
@@ -252,15 +254,16 @@ export default (function (props) {
252
254
  }
253
255
  throw Error('未知模式');
254
256
  }();
255
- if (props.source === 'restore') {
256
- onChangeStatus('page', act);
257
- }
257
+
258
+ // if(props.source === 'restore'){
259
+ onChangeStatus('page', act);
260
+ // }
258
261
  return act;
259
262
  }, [mode, state]);
260
-
261
- // useEffect(() => {
262
- // document.body.id = 'body';
263
- // }, []);
263
+ useEffect(function () {
264
+ // document.body.id = 'body';
265
+ console.log('初始化 ........');
266
+ }, []);
264
267
 
265
268
  // console.log('action = ', action);
266
269
  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);