@pisell/private-materials 3.0.139 → 3.0.141

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 (43) 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.js +9 -9
  8. package/build/lowcode/view.js +7 -7
  9. package/es/components/booking/info/header/index.js +73 -9
  10. package/es/components/booking/locales.d.ts +3 -0
  11. package/es/components/booking/locales.js +3 -0
  12. package/es/components/eftpos/deviceList/index.d.ts +3 -0
  13. package/es/components/eftpos/deviceList/index.js +52 -0
  14. package/es/components/eftpos/form/index.js +21 -74
  15. package/es/components/eftpos/group/index.d.ts +7 -0
  16. package/es/components/eftpos/group/index.js +65 -0
  17. package/es/components/eftposPay/component/manual/index.js +15 -15
  18. package/es/components/eftposPay/helper.d.ts +9 -0
  19. package/es/components/eftposPay/helper.js +69 -1
  20. package/es/components/eftposPay/manufacturer.d.ts +1 -1
  21. package/es/components/eftposPay/manufacturer.js +17 -15
  22. package/es/components/eftposPay/payo/const.js +6 -3
  23. package/es/components/eftposPay/payo/hooks.js +31 -2
  24. package/es/components/eftposPay/tyro/const.js +3 -1
  25. package/es/components/eftposPay/windcave/const.js +2 -1
  26. package/lib/components/booking/info/header/index.js +52 -7
  27. package/lib/components/booking/locales.d.ts +3 -0
  28. package/lib/components/booking/locales.js +3 -0
  29. package/lib/components/eftpos/deviceList/index.d.ts +3 -0
  30. package/lib/components/eftpos/deviceList/index.js +70 -0
  31. package/lib/components/eftpos/form/index.js +6 -33
  32. package/lib/components/eftpos/group/index.d.ts +7 -0
  33. package/lib/components/eftpos/group/index.js +75 -0
  34. package/lib/components/eftposPay/component/manual/index.js +4 -15
  35. package/lib/components/eftposPay/helper.d.ts +9 -0
  36. package/lib/components/eftposPay/helper.js +49 -0
  37. package/lib/components/eftposPay/manufacturer.d.ts +1 -1
  38. package/lib/components/eftposPay/manufacturer.js +2 -13
  39. package/lib/components/eftposPay/payo/const.js +3 -3
  40. package/lib/components/eftposPay/payo/hooks.js +17 -0
  41. package/lib/components/eftposPay/tyro/const.js +1 -1
  42. package/lib/components/eftposPay/windcave/const.js +1 -1
  43. package/package.json +2 -2
@@ -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': '退款',
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: ({ input, ...formItemProps }: any) => React.JSX.Element;
3
+ export default _default;
@@ -0,0 +1,52 @@
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 = ["input"],
3
+ _excluded2 = ["input"];
4
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
5
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
+ 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; }
7
+ 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; }
8
+ 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; }
9
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
+ 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); }
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+ 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."); }
13
+ 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); }
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
16
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
+ import React, { useMemo } from 'react';
18
+ import { Form } from 'antd';
19
+ import { CheckboxGroup } from "../group";
20
+ var DeviceList = function DeviceList(props) {
21
+ var _Form$useForm = Form.useForm(),
22
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
23
+ form = _Form$useForm2[0];
24
+ var list = props.list,
25
+ onChange = props.onChange; //value 是form表单中"name"对应的字段值
26
+ console.log(list);
27
+ var onValuesChange = function onValuesChange() {
28
+ var val = Object.values(form.getFieldsValue()).flat();
29
+ onChange(val);
30
+ };
31
+ var initialValues = useMemo(function () {
32
+ return list.reduce(function (target, item) {
33
+ var _item$input, _item$input2;
34
+ return _objectSpread(_objectSpread({}, target), {}, _defineProperty({}, item.name, (item === null || item === void 0 ? void 0 : (_item$input = item.input) === null || _item$input === void 0 ? void 0 : _item$input.value) || (item === null || item === void 0 ? void 0 : (_item$input2 = item.input) === null || _item$input2 === void 0 ? void 0 : _item$input2.defaultValue)));
35
+ }, {});
36
+ }, [list]);
37
+ return /*#__PURE__*/React.createElement(Form, {
38
+ layout: "vertical",
39
+ onValuesChange: onValuesChange,
40
+ form: form,
41
+ initialValues: initialValues
42
+ }, list.map(function (_ref) {
43
+ var input = _ref.input,
44
+ formItemProps = _objectWithoutProperties(_ref, _excluded);
45
+ return /*#__PURE__*/React.createElement(Form.Item, formItemProps, /*#__PURE__*/React.createElement(CheckboxGroup, input));
46
+ }));
47
+ };
48
+ export default (function (_ref2) {
49
+ var input = _ref2.input,
50
+ formItemProps = _objectWithoutProperties(_ref2, _excluded2);
51
+ return /*#__PURE__*/React.createElement(Form.Item, formItemProps, /*#__PURE__*/React.createElement(DeviceList, input));
52
+ });
@@ -1,78 +1,24 @@
1
- var _excluded = ["direction", "options"],
2
- _excluded2 = ["label", "value"],
3
- _excluded3 = ["direction", "options"],
4
- _excluded4 = ["label", "value"],
5
- _excluded5 = ["__sourceName", "Component"],
6
- _excluded6 = ["input"],
7
- _excluded7 = ["input"];
1
+ var _excluded = ["__sourceName", "Component"],
2
+ _excluded2 = ["input"],
3
+ _excluded3 = ["input"];
8
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); }
9
5
  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); }
10
6
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
11
7
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
8
  import React from 'react';
13
- import { Input, InputNumber, Checkbox, Radio, Cascader, DatePicker, Select, Slider, Switch, TimePicker, Transfer, TreeSelect, Upload, Form, Space } from 'antd';
9
+ import { Input, InputNumber, Checkbox, Radio, Cascader, DatePicker, Select, Slider, Switch, TimePicker, Transfer, TreeSelect, Upload, Form } from 'antd';
10
+ import { CheckboxGroup, RadioGroup } from "../group";
14
11
  import Surcharge, { getCommName, getCommDefaultVal } from "../surcharge";
12
+ import DeviceList from "../deviceList";
15
13
 
16
14
  // 通用表单配置
17
15
  var Mapping = {
18
16
  Input: Input,
19
17
  InputNumber: InputNumber,
20
18
  Checkbox: Checkbox,
21
- 'Checkbox.Group': function CheckboxGroup(_ref) {
22
- var direction = _ref.direction,
23
- options = _ref.options,
24
- props = _objectWithoutProperties(_ref, _excluded);
25
- if (direction === 'vertical') {
26
- return /*#__PURE__*/React.createElement(Checkbox.Group, props, /*#__PURE__*/React.createElement(Space, {
27
- direction: direction
28
- }, options === null || options === void 0 ? void 0 : options.map(function (item) {
29
- if (_typeof(item) === 'object') {
30
- var label = item.label,
31
- value = item.value,
32
- other = _objectWithoutProperties(item, _excluded2);
33
- return /*#__PURE__*/React.createElement(Checkbox, _extends({}, other, {
34
- value: value,
35
- key: "".concat(item.value)
36
- }), label);
37
- }
38
- return /*#__PURE__*/React.createElement(Checkbox, {
39
- value: item,
40
- key: "".concat(item)
41
- }, item);
42
- })));
43
- }
44
- return /*#__PURE__*/React.createElement(Checkbox.Group, _extends({}, props, {
45
- options: options
46
- }));
47
- },
19
+ 'Checkbox.Group': CheckboxGroup,
48
20
  Radio: Radio,
49
- 'Radio.Group': function RadioGroup(_ref2) {
50
- var direction = _ref2.direction,
51
- options = _ref2.options,
52
- props = _objectWithoutProperties(_ref2, _excluded3);
53
- if (direction === 'vertical') {
54
- return /*#__PURE__*/React.createElement(Radio.Group, props, /*#__PURE__*/React.createElement(Space, {
55
- direction: "vertical"
56
- }, options === null || options === void 0 ? void 0 : options.map(function (item) {
57
- if (_typeof(item) === 'object') {
58
- var label = item.label,
59
- value = item.value,
60
- other = _objectWithoutProperties(item, _excluded4);
61
- return /*#__PURE__*/React.createElement(Radio, _extends({}, other, {
62
- value: value,
63
- key: "".concat(item.value)
64
- }), label);
65
- }
66
- return /*#__PURE__*/React.createElement(Radio, {
67
- value: item,
68
- key: "".concat(item)
69
- }, item);
70
- })));
71
- }
72
- return /*#__PURE__*/React.createElement(Radio.Group, _extends({}, props, {
73
- options: options
74
- }));
75
- },
21
+ 'Radio.Group': RadioGroup,
76
22
  'Radio.Button': Radio.Button,
77
23
  Cascader: Cascader,
78
24
  DatePicker: DatePicker,
@@ -85,7 +31,8 @@ var Mapping = {
85
31
  Upload: Upload
86
32
  };
87
33
  var CustomMapping = {
88
- Surcharge: Surcharge
34
+ Surcharge: Surcharge,
35
+ DeviceList: DeviceList
89
36
  };
90
37
 
91
38
  /**
@@ -93,15 +40,15 @@ var CustomMapping = {
93
40
  * @Author: hongbing.wang
94
41
  * @Date: 2024-08-20 13:21
95
42
  */
96
- var CustomFormItem = function CustomFormItem(_ref3) {
97
- var formItemList = _ref3.formItemList,
98
- _ref3$level = _ref3.level,
99
- level = _ref3$level === void 0 ? 0 : _ref3$level,
100
- onChange = _ref3.onChange;
101
- return /*#__PURE__*/React.createElement(React.Fragment, null, formItemList.map(function (_ref4, index) {
102
- var __sourceName = _ref4.__sourceName,
103
- Component = _ref4.Component,
104
- item = _objectWithoutProperties(_ref4, _excluded5);
43
+ var CustomFormItem = function CustomFormItem(_ref) {
44
+ var formItemList = _ref.formItemList,
45
+ _ref$level = _ref.level,
46
+ level = _ref$level === void 0 ? 0 : _ref$level,
47
+ onChange = _ref.onChange;
48
+ return /*#__PURE__*/React.createElement(React.Fragment, null, formItemList.map(function (_ref2, index) {
49
+ var __sourceName = _ref2.__sourceName,
50
+ Component = _ref2.Component,
51
+ item = _objectWithoutProperties(_ref2, _excluded);
105
52
  if (Array.isArray(item.children)) {
106
53
  return /*#__PURE__*/React.createElement(CustomFormItem, {
107
54
  formItemList: item.children,
@@ -118,7 +65,7 @@ var CustomFormItem = function CustomFormItem(_ref3) {
118
65
  if (Mapping[Component]) {
119
66
  var Comm = Mapping[Component];
120
67
  var input = item.input,
121
- formItemProps = _objectWithoutProperties(item, _excluded6);
68
+ formItemProps = _objectWithoutProperties(item, _excluded2);
122
69
  return /*#__PURE__*/React.createElement(Form.Item, _extends({}, formItemProps, {
123
70
  key: item.name + level
124
71
  }), /*#__PURE__*/React.createElement(Comm, input));
@@ -126,7 +73,7 @@ var CustomFormItem = function CustomFormItem(_ref3) {
126
73
  if (Mapping[Component]) {
127
74
  var _Comm = Mapping[Component];
128
75
  var _input = item.input,
129
- _formItemProps = _objectWithoutProperties(item, _excluded7);
76
+ _formItemProps = _objectWithoutProperties(item, _excluded3);
130
77
  return /*#__PURE__*/React.createElement(Form.Item, _extends({}, _formItemProps, {
131
78
  key: item.name + level
132
79
  }), /*#__PURE__*/React.createElement(_Comm, _input));
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { RadioGroupProps } from 'antd';
3
+ export declare const CheckboxGroup: ({ direction, options, ...props }: any) => React.JSX.Element;
4
+ export declare const RadioGroup: ({ direction, options, component, ...props }: RadioGroupProps & {
5
+ direction?: "vertical" | undefined;
6
+ component: string;
7
+ }) => React.JSX.Element;
@@ -0,0 +1,65 @@
1
+ var _excluded = ["direction", "options"],
2
+ _excluded2 = ["label", "value"],
3
+ _excluded3 = ["direction", "options", "component"],
4
+ _excluded4 = ["label", "value"];
5
+ 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); }
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
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
8
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
9
+ import React from 'react';
10
+ import { Checkbox, Radio, Space } from 'antd';
11
+ export var CheckboxGroup = function CheckboxGroup(_ref) {
12
+ var direction = _ref.direction,
13
+ options = _ref.options,
14
+ props = _objectWithoutProperties(_ref, _excluded);
15
+ if (direction === 'vertical') {
16
+ return /*#__PURE__*/React.createElement(Checkbox.Group, props, /*#__PURE__*/React.createElement(Space, {
17
+ direction: direction
18
+ }, options === null || options === void 0 ? void 0 : options.map(function (item) {
19
+ if (_typeof(item) === 'object') {
20
+ var label = item.label,
21
+ value = item.value,
22
+ other = _objectWithoutProperties(item, _excluded2);
23
+ return /*#__PURE__*/React.createElement(Checkbox, _extends({}, other, {
24
+ value: value,
25
+ key: "".concat(item.value)
26
+ }), label);
27
+ }
28
+ return /*#__PURE__*/React.createElement(Checkbox, {
29
+ value: item,
30
+ key: "".concat(item)
31
+ }, item);
32
+ })));
33
+ }
34
+ return /*#__PURE__*/React.createElement(Checkbox.Group, _extends({}, props, {
35
+ options: options
36
+ }));
37
+ };
38
+ export var RadioGroup = function RadioGroup(_ref2) {
39
+ var direction = _ref2.direction,
40
+ options = _ref2.options,
41
+ component = _ref2.component,
42
+ props = _objectWithoutProperties(_ref2, _excluded3);
43
+ if (direction === 'vertical') {
44
+ return /*#__PURE__*/React.createElement(Radio.Group, props, /*#__PURE__*/React.createElement(Space, {
45
+ direction: "vertical"
46
+ }, options === null || options === void 0 ? void 0 : options.map(function (item) {
47
+ if (_typeof(item) === 'object') {
48
+ var label = item.label,
49
+ value = item.value,
50
+ other = _objectWithoutProperties(item, _excluded4);
51
+ return /*#__PURE__*/React.createElement(Radio, _extends({}, other, {
52
+ value: value,
53
+ key: "".concat(item.value)
54
+ }), label);
55
+ }
56
+ return /*#__PURE__*/React.createElement(Radio, {
57
+ value: item,
58
+ key: "".concat(item)
59
+ }, item);
60
+ })));
61
+ }
62
+ return /*#__PURE__*/React.createElement(Radio.Group, _extends({}, props, {
63
+ options: options
64
+ }));
65
+ };
@@ -41,11 +41,11 @@ export default (function (_ref) {
41
41
  pay = _useContextData.pay,
42
42
  amount = _useContextData.amount;
43
43
  var start = useMemo(function () {
44
- if (typeof (manual === null || manual === void 0 ? void 0 : manual.money) === 'number') {
45
- return manual === null || manual === void 0 ? void 0 : manual.money;
44
+ if (typeof (manual === null || manual === void 0 ? void 0 : manual.money) === 'number' || typeof (manual === null || manual === void 0 ? void 0 : manual.money) === 'string') {
45
+ return Number(manual === null || manual === void 0 ? void 0 : manual.money);
46
46
  }
47
- if (typeof (pay === null || pay === void 0 ? void 0 : pay.total) === 'number') {
48
- return pay === null || pay === void 0 ? void 0 : pay.total;
47
+ if (typeof (pay === null || pay === void 0 ? void 0 : pay.total) === 'number' || typeof (pay === null || pay === void 0 ? void 0 : pay.total) === 'string') {
48
+ return Number(pay === null || pay === void 0 ? void 0 : pay.total);
49
49
  }
50
50
  return amount;
51
51
  }, [manual === null || manual === void 0 ? void 0 : manual.money, pay === null || pay === void 0 ? void 0 : pay.total, amount]);
@@ -72,17 +72,17 @@ export default (function (_ref) {
72
72
  if (disabled) {
73
73
  return;
74
74
  }
75
- // 暂时关闭 后期可以放开用于自定义编辑金额
76
- if (mode === ModeEnum.Pay) {
77
- setDisabled(true);
78
- var obj = pay || {};
79
- onChange('success', _objectSpread(_objectSpread({}, obj), {}, {
80
- number: number,
81
- device: device,
82
- order_id: order_id
83
- }));
84
- return;
85
- }
75
+ // if (mode === ModeEnum.Pay) {
76
+ // setDisabled(true);
77
+ // const obj = pay || {};
78
+ // onChange('success', {
79
+ // ...obj,
80
+ // number,
81
+ // device,
82
+ // order_id,
83
+ // } as { [key: string]: unknown });
84
+ // return;
85
+ // }
86
86
  if (mode === ModeEnum.Refund) {
87
87
  setDisabled(true);
88
88
  onChange('success', {
@@ -1,4 +1,5 @@
1
1
  import { State } from './store';
2
+ import { Amount } from './const';
2
3
  export declare function getUuid(): string;
3
4
  /**
4
5
  * @title: Promise化 setTimeout
@@ -54,4 +55,12 @@ export declare const getPayParams: (data: Partial<Omit<State, key>> & Pick<State
54
55
  device?: undefined;
55
56
  };
56
57
  export declare const limitDecimals: (value: any) => any;
58
+ /**
59
+ * @title: 通用获取 金额信息
60
+ * @description: 在 amount 页面设置则使用 pay ,如果有 setting 则使用 setting 信息 ,都没有则设置0
61
+ * @param {State} store : 全局store数据管理
62
+ * @Author: hongbing.wang
63
+ * @Date: 2024-08-12 10:24
64
+ */
65
+ export declare function getAmonunt(store: State): Amount;
57
66
  export {};
@@ -124,4 +124,72 @@ export var limitDecimals = function limitDecimals(value) {
124
124
  return !isNaN(value) ? String(value).replace(reg, '$1$2.$3') : '';
125
125
  }
126
126
  return '';
127
- };
127
+ };
128
+
129
+ /**
130
+ * @title: 通用获取 金额信息
131
+ * @description: 在 amount 页面设置则使用 pay ,如果有 setting 则使用 setting 信息 ,都没有则设置0
132
+ * @param {State} store : 全局store数据管理
133
+ * @Author: hongbing.wang
134
+ * @Date: 2024-08-12 10:24
135
+ */
136
+ export function getAmonunt(store) {
137
+ var device = store.device,
138
+ pay = store.pay,
139
+ custom = store.custom,
140
+ name = store.name,
141
+ symbol = store.symbol,
142
+ amount = store.amount;
143
+ if (!device || !custom) {
144
+ throw Error('device or custom is not defined');
145
+ }
146
+ var setting = device.setting;
147
+
148
+ // 从 金额编辑页 获取到 支付数据
149
+ if (pay) {
150
+ return {
151
+ name: name,
152
+ symbol: symbol,
153
+ // format,
154
+ money: Number(amount),
155
+ amount: Number(pay.amount),
156
+ surRate: Number(pay.surRate),
157
+ surMoney: Number(pay.surMoney),
158
+ surcharge: (setting === null || setting === void 0 ? void 0 : setting.surcharge) || false,
159
+ useOriginSurcharge: (pay === null || pay === void 0 ? void 0 : pay.useOriginSurcharge) || false
160
+ };
161
+ }
162
+ // 原始支付总额
163
+ if (!setting) {
164
+ return {
165
+ name: name,
166
+ symbol: symbol,
167
+ // format,
168
+ money: Number(amount),
169
+ amount: Number(amount),
170
+ surRate: 0,
171
+ surMoney: 0,
172
+ surcharge: false,
173
+ useOriginSurcharge: false
174
+ };
175
+ }
176
+ // 原始手续费 是指 各个pos机厂商跟银行合作直接收取的手续费,一旦设置则清空,配置中设置的手续费
177
+ var useOriginSurcharge = setting.useOriginSurcharge || false;
178
+
179
+ // 直接设备中手续费金额
180
+ var surRate = setting.constant_rate || 0;
181
+ var surMoney = setting.constant_money || 0;
182
+
183
+ // 是否开启手续费
184
+ var surcharge = setting.surcharge;
185
+ return {
186
+ name: name,
187
+ symbol: symbol,
188
+ money: Number(amount),
189
+ amount: Number(amount),
190
+ surRate: useOriginSurcharge ? 0 : surcharge ? surRate : 0,
191
+ surMoney: useOriginSurcharge ? 0 : surcharge ? surMoney : 0,
192
+ surcharge: surcharge,
193
+ useOriginSurcharge: useOriginSurcharge
194
+ };
195
+ }
@@ -1,6 +1,6 @@
1
1
  import { State } from './store';
2
+ export { getAmonunt } from './helper';
2
3
  export { default as Payo } from './payo';
3
4
  export { default as Windcave } from './windcave/windcave';
4
5
  export { default as Tyro } from './tyro';
5
6
  export declare const getInitState: (type: string, params?: any) => State;
6
- export declare const getAmonunt: (store: State) => import("./const").Amount;
@@ -1,7 +1,8 @@
1
1
  import { EftposEnum } from "./const";
2
- import getPayoInitState, { getAmonunt as getPayoAmonunt } from "./payo/const";
3
- import getTyroInitState, { getAmonunt as getTyroAmonunt } from "./tyro/const";
4
- import getWindcaveInitState, { getAmonunt as getWindcaveAmonunt } from "./windcave/const";
2
+ import getPayoInitState from "./payo/const";
3
+ import getTyroInitState from "./tyro/const";
4
+ import getWindcaveInitState from "./windcave/const";
5
+ export { getAmonunt } from "./helper";
5
6
  export { default as Payo } from "./payo";
6
7
  export { default as Windcave } from "./windcave/windcave";
7
8
  export { default as Tyro } from "./tyro";
@@ -17,15 +18,16 @@ export var getInitState = function getInitState(type, params) {
17
18
  throw new Error('未知的厂商类型');
18
19
  }
19
20
  };
20
- export var getAmonunt = function getAmonunt(store) {
21
- if (store.eftpos === EftposEnum.Payo) {
22
- return getPayoAmonunt(store);
23
- }
24
- if (store.eftpos === EftposEnum.Windcave) {
25
- return getWindcaveAmonunt(store);
26
- }
27
- if (store.eftpos === EftposEnum.Tyro) {
28
- return getTyroAmonunt(store);
29
- }
30
- throw new Error('未知的厂商类型');
31
- };
21
+ // 暂无定制业务
22
+ // export const getAmonunt = (store: State) => {
23
+ // if (store.eftpos === EftposEnum.Payo) {
24
+ // return getPayoAmonunt(store);
25
+ // }
26
+ // if (store.eftpos === EftposEnum.Windcave) {
27
+ // return getWindcaveAmonunt(store);
28
+ // }
29
+ // if (store.eftpos === EftposEnum.Tyro) {
30
+ // return getTyroAmonunt(store);
31
+ // }
32
+ // throw new Error('未知的厂商类型');
33
+ // };