@pisell/private-materials 3.3.55 → 3.3.57

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 (123) 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 +6 -6
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +6 -6
  11. package/es/components/appointmentBooking/assets/resource.svg +1 -0
  12. package/es/components/appointmentBooking/components/Content/index.d.ts +0 -1
  13. package/es/components/appointmentBooking/components/Header/index.d.ts +0 -1
  14. package/es/components/appointmentBooking/components/Resource/index.js +44 -5
  15. package/es/components/appointmentBooking/hooks.js +218 -177
  16. package/es/components/appointmentBooking/locales.d.ts +3 -0
  17. package/es/components/appointmentBooking/locales.js +9 -0
  18. package/es/components/booking/components/TabProduct/productItem/index.js +14 -2
  19. package/es/components/booking/components/drawer/index.js +4 -2
  20. package/es/components/booking/components/footer/index.js +1 -1
  21. package/es/components/booking/components/voucher/index.js +25 -17
  22. package/es/components/booking/info/client/index.js +2 -1
  23. package/es/components/booking/info/pet/index.js +3 -0
  24. package/es/components/booking/info/service2/utils.js +27 -27
  25. package/es/components/booking/info2/index.js +3 -3
  26. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  27. package/es/components/booking/info2/service/addService/utils.js +5 -2
  28. package/es/components/booking/info2/service/editService/index.js +1 -0
  29. package/es/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
  30. package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.js +23 -4
  31. package/es/components/eventBooking/components/progressBar/index.js +16 -0
  32. package/es/components/eventBooking/index.d.ts +0 -1
  33. package/es/components/pay/toC/PaymentList/index.js +10 -4
  34. package/es/components/pay/toC/PaymentList/serve.d.ts +1 -1
  35. package/es/components/pay/toC/PaymentList/serve.js +7 -1
  36. package/es/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +30 -13
  37. package/es/components/pay/toC/PaymentMethods/SuperPayWxPayH5/index.js +30 -13
  38. package/es/components/pay/toC/PaymentMethods/index.js +29 -2
  39. package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
  40. package/es/components/pay/toC/WalletPassBlock/index.less +4 -0
  41. package/es/components/pay/toC/index.js +38 -30
  42. package/es/components/pay/toC/utils.d.ts +6 -0
  43. package/es/components/pay/toC/utils.js +21 -0
  44. package/es/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +1 -1
  45. package/es/components/productExtension/fields/SelectProducts/ProductItem/index.js +18 -6
  46. package/es/components/productSelect/components/TabProduct/index.js +28 -10
  47. package/es/components/productSelect/components/TabProduct/tabs/index.d.ts +21 -0
  48. package/es/components/productSelect/components/TabProduct/tabs/index.js +243 -0
  49. package/es/components/productSelect/components/TabProduct/tabs/index.less +126 -0
  50. package/es/components/productSelect/components/pisellPriceText/index.d.ts +11 -0
  51. package/es/components/productSelect/components/pisellPriceText/index.js +43 -0
  52. package/es/components/productSelect/components/productGroup/index.js +20 -7
  53. package/es/components/productSelect/components/productGroup/index.less +14 -1
  54. package/es/components/productSelect/index.less +1 -2
  55. package/es/components/ticketBooking/components/addServiceVariant/addService.js +16 -10
  56. package/es/components/ticketBooking/components/addServiceVariant/index.less +10 -0
  57. package/es/components/ticketBooking/components/ticketBooking/index.js +18 -9
  58. package/es/components/ticketBooking/index.js +2 -1
  59. package/es/components/ticketBooking/locales.d.ts +3 -0
  60. package/es/components/ticketBooking/locales.js +12 -3
  61. package/es/components/ticketBooking/serve.d.ts +5 -0
  62. package/es/components/ticketBooking/serve.js +27 -0
  63. package/es/components/ticketBooking/utils/index.d.ts +5 -1
  64. package/es/components/ticketBooking/utils/index.js +35 -3
  65. package/es/components/wallet/index.js +51 -5
  66. package/lib/components/appointmentBooking/assets/resource.svg +1 -0
  67. package/lib/components/appointmentBooking/components/Content/index.d.ts +0 -1
  68. package/lib/components/appointmentBooking/components/Header/index.d.ts +0 -1
  69. package/lib/components/appointmentBooking/components/Resource/index.js +44 -5
  70. package/lib/components/appointmentBooking/hooks.js +12 -3
  71. package/lib/components/appointmentBooking/locales.d.ts +3 -0
  72. package/lib/components/appointmentBooking/locales.js +3 -0
  73. package/lib/components/booking/components/TabProduct/productItem/index.js +8 -1
  74. package/lib/components/booking/components/drawer/index.js +2 -2
  75. package/lib/components/booking/components/footer/index.js +1 -1
  76. package/lib/components/booking/components/voucher/index.js +31 -27
  77. package/lib/components/booking/info/client/index.js +2 -1
  78. package/lib/components/booking/info/pet/index.js +3 -0
  79. package/lib/components/booking/info/service2/utils.js +2 -2
  80. package/lib/components/booking/info2/index.js +7 -4
  81. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  82. package/lib/components/booking/info2/service/addService/utils.js +4 -2
  83. package/lib/components/booking/info2/service/editService/index.js +1 -0
  84. package/lib/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
  85. package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.js +18 -8
  86. package/lib/components/eventBooking/components/progressBar/index.js +15 -0
  87. package/lib/components/eventBooking/index.d.ts +0 -1
  88. package/lib/components/pay/toC/PaymentList/index.js +11 -6
  89. package/lib/components/pay/toC/PaymentList/serve.d.ts +1 -1
  90. package/lib/components/pay/toC/PaymentList/serve.js +5 -2
  91. package/lib/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +10 -1
  92. package/lib/components/pay/toC/PaymentMethods/SuperPayWxPayH5/index.js +10 -1
  93. package/lib/components/pay/toC/PaymentMethods/index.js +28 -4
  94. package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
  95. package/lib/components/pay/toC/WalletPassBlock/index.less +4 -0
  96. package/lib/components/pay/toC/index.js +20 -13
  97. package/lib/components/pay/toC/utils.d.ts +6 -0
  98. package/lib/components/pay/toC/utils.js +15 -0
  99. package/lib/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +1 -1
  100. package/lib/components/productExtension/fields/SelectProducts/ProductItem/index.js +8 -1
  101. package/lib/components/productSelect/components/TabProduct/index.js +19 -6
  102. package/lib/components/productSelect/components/TabProduct/tabs/index.d.ts +21 -0
  103. package/lib/components/productSelect/components/TabProduct/tabs/index.js +202 -0
  104. package/lib/components/productSelect/components/TabProduct/tabs/index.less +126 -0
  105. package/lib/components/productSelect/components/pisellPriceText/index.d.ts +11 -0
  106. package/lib/components/productSelect/components/pisellPriceText/index.js +72 -0
  107. package/lib/components/productSelect/components/productGroup/index.js +24 -4
  108. package/lib/components/productSelect/components/productGroup/index.less +14 -1
  109. package/lib/components/productSelect/index.less +1 -2
  110. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +25 -14
  111. package/lib/components/ticketBooking/components/addServiceVariant/index.less +10 -0
  112. package/lib/components/ticketBooking/components/ticketBooking/index.js +17 -8
  113. package/lib/components/ticketBooking/index.js +2 -1
  114. package/lib/components/ticketBooking/locales.d.ts +3 -0
  115. package/lib/components/ticketBooking/locales.js +6 -3
  116. package/lib/components/ticketBooking/serve.d.ts +5 -0
  117. package/lib/components/ticketBooking/serve.js +8 -2
  118. package/lib/components/ticketBooking/utils/index.d.ts +5 -1
  119. package/lib/components/ticketBooking/utils/index.js +35 -3
  120. package/lib/components/wallet/index.js +26 -1
  121. package/package.json +4 -4
  122. package/es/components/booking/info2/service/editService/Resources/index.d.ts +0 -4
  123. package/lib/components/booking/info2/service/editService/Resources/index.d.ts +0 -4
@@ -15,6 +15,8 @@ import ThreedsLoading from "../MWCreditCard/TDSPay/ThreedsLoading";
15
15
  import { getAliPayUrl } from "./serve";
16
16
  import { getPayGroupParamsFromStorage, setPayNumber } from "../../payGroup";
17
17
  import "./index.less";
18
+ import useEngineContext from "../../../../../hooks/useEngineContext";
19
+ import { clientPayment } from "../../utils";
18
20
  /**
19
21
  * @title: 支付宝支付
20
22
  * @description:
@@ -23,11 +25,15 @@ import "./index.less";
23
25
  * @Date: 2024-08-16 11:18
24
26
  */
25
27
  var SuperPayAliPayH5 = function SuperPayAliPayH5(props, ref) {
28
+ var _context$appHelper;
26
29
  var onChange = props.onChange;
27
30
  var _useState = useState(false),
28
31
  _useState2 = _slicedToArray(_useState, 2),
29
32
  open = _useState2[0],
30
33
  setOpen = _useState2[1];
34
+ var context = useEngineContext();
35
+ var _context$appHelper$ut = (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils,
36
+ interaction = _context$appHelper$ut.interaction;
31
37
 
32
38
  /**
33
39
  * @title: 初始化
@@ -39,26 +45,37 @@ var SuperPayAliPayH5 = function SuperPayAliPayH5(props, ref) {
39
45
  */
40
46
  var init = /*#__PURE__*/function () {
41
47
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
48
+ var _interaction$utils, _interaction$utils$is;
42
49
  var payGroup, values, data;
43
50
  return _regeneratorRuntime().wrap(function _callee$(_context) {
44
51
  while (1) switch (_context.prev = _context.next) {
45
52
  case 0:
46
53
  payGroup = _ref.payGroup;
47
- setOpen(true);
48
-
49
54
  // 交易组
50
55
  values = getPayGroupParamsFromStorage(payGroup.order_id);
56
+ if (!(interaction !== null && interaction !== void 0 && (_interaction$utils = interaction.utils) !== null && _interaction$utils !== void 0 && (_interaction$utils$is = _interaction$utils.isAppEnv) !== null && _interaction$utils$is !== void 0 && _interaction$utils$is.call(_interaction$utils))) {
57
+ _context.next = 4;
58
+ break;
59
+ }
60
+ return _context.abrupt("return", clientPayment({
61
+ order_id: payGroup.order_id,
62
+ type: 'aliPay',
63
+ values: values,
64
+ interaction: interaction
65
+ }));
66
+ case 4:
67
+ setOpen(true);
51
68
  if (values) {
52
- _context.next = 6;
69
+ _context.next = 8;
53
70
  break;
54
71
  }
55
72
  setOpen(false);
56
73
  return _context.abrupt("return");
57
- case 6:
58
- _context.prev = 6;
59
- _context.next = 9;
74
+ case 8:
75
+ _context.prev = 8;
76
+ _context.next = 11;
60
77
  return getAliPayUrl(payGroup.order_id, values);
61
- case 9:
78
+ case 11:
62
79
  data = _context.sent;
63
80
  if (data !== null && data !== void 0 && data.pay_url) {
64
81
  // 设置交易号
@@ -69,17 +86,17 @@ var SuperPayAliPayH5 = function SuperPayAliPayH5(props, ref) {
69
86
  } else {
70
87
  setOpen(false);
71
88
  }
72
- _context.next = 16;
89
+ _context.next = 18;
73
90
  break;
74
- case 13:
75
- _context.prev = 13;
76
- _context.t0 = _context["catch"](6);
91
+ case 15:
92
+ _context.prev = 15;
93
+ _context.t0 = _context["catch"](8);
77
94
  setOpen(false);
78
- case 16:
95
+ case 18:
79
96
  case "end":
80
97
  return _context.stop();
81
98
  }
82
- }, _callee, null, [[6, 13]]);
99
+ }, _callee, null, [[8, 15]]);
83
100
  }));
84
101
  return function init(_x) {
85
102
  return _ref2.apply(this, arguments);
@@ -15,6 +15,8 @@ import { getWxPayUrl } from "./serve";
15
15
  import { getPayGroupParamsFromStorage, setPayNumber } from "../../payGroup";
16
16
  import "./index.less";
17
17
  import { locales } from '@pisell/utils';
18
+ import { clientPayment } from "../../utils";
19
+ import useEngineContext from "../../../../../hooks/useEngineContext";
18
20
  /**
19
21
  * @title: 微信支付
20
22
  * @description:
@@ -25,10 +27,14 @@ import { locales } from '@pisell/utils';
25
27
  * @Date: 2024-08-16 11:18
26
28
  */
27
29
  var SuperPayWxPayH5 = function SuperPayWxPayH5(props, ref) {
30
+ var _context$appHelper;
28
31
  var _useState = useState(false),
29
32
  _useState2 = _slicedToArray(_useState, 2),
30
33
  open = _useState2[0],
31
34
  setOpen = _useState2[1];
35
+ var context = useEngineContext();
36
+ var _context$appHelper$ut = (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils,
37
+ interaction = _context$appHelper$ut.interaction;
32
38
 
33
39
  /**
34
40
  * @title: 初始化
@@ -40,26 +46,37 @@ var SuperPayWxPayH5 = function SuperPayWxPayH5(props, ref) {
40
46
  */
41
47
  var init = /*#__PURE__*/function () {
42
48
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
49
+ var _interaction$utils, _interaction$utils$is;
43
50
  var payGroup, values, data;
44
51
  return _regeneratorRuntime().wrap(function _callee$(_context) {
45
52
  while (1) switch (_context.prev = _context.next) {
46
53
  case 0:
47
54
  payGroup = _ref.payGroup;
48
- setOpen(true);
49
-
50
55
  // 获取交易组
51
56
  values = getPayGroupParamsFromStorage(payGroup.order_id);
57
+ if (!(interaction !== null && interaction !== void 0 && (_interaction$utils = interaction.utils) !== null && _interaction$utils !== void 0 && (_interaction$utils$is = _interaction$utils.isAppEnv) !== null && _interaction$utils$is !== void 0 && _interaction$utils$is.call(_interaction$utils))) {
58
+ _context.next = 4;
59
+ break;
60
+ }
61
+ return _context.abrupt("return", clientPayment({
62
+ order_id: payGroup.order_id,
63
+ type: 'wxPay',
64
+ values: values,
65
+ interaction: interaction
66
+ }));
67
+ case 4:
68
+ setOpen(true);
52
69
  if (values) {
53
- _context.next = 6;
70
+ _context.next = 8;
54
71
  break;
55
72
  }
56
73
  setOpen(false);
57
74
  return _context.abrupt("return");
58
- case 6:
59
- _context.prev = 6;
60
- _context.next = 9;
75
+ case 8:
76
+ _context.prev = 8;
77
+ _context.next = 11;
61
78
  return getWxPayUrl(payGroup.order_id, values);
62
- case 9:
79
+ case 11:
63
80
  data = _context.sent;
64
81
  if (data !== null && data !== void 0 && data.pay_url) {
65
82
  // 设置交易号
@@ -70,17 +87,17 @@ var SuperPayWxPayH5 = function SuperPayWxPayH5(props, ref) {
70
87
  } else {
71
88
  setOpen(false);
72
89
  }
73
- _context.next = 16;
90
+ _context.next = 18;
74
91
  break;
75
- case 13:
76
- _context.prev = 13;
77
- _context.t0 = _context["catch"](6);
92
+ case 15:
93
+ _context.prev = 15;
94
+ _context.t0 = _context["catch"](8);
78
95
  setOpen(false);
79
- case 16:
96
+ case 18:
80
97
  case "end":
81
98
  return _context.stop();
82
99
  }
83
- }, _callee, null, [[6, 13]]);
100
+ }, _callee, null, [[8, 15]]);
84
101
  }));
85
102
  return function init(_x) {
86
103
  return _ref2.apply(this, arguments);
@@ -7,7 +7,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
7
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
8
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
9
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
10
- import React, { useImperativeHandle, forwardRef, useRef } from 'react';
10
+ import React, { useImperativeHandle, forwardRef, useRef, useEffect } from 'react';
11
11
  import MWCreditCard from "./MWCreditCard";
12
12
  import SuperPayAliPayH5 from "./SuperPayAliPayH5";
13
13
  import StripePay from "./StripePay";
@@ -18,7 +18,7 @@ import CustomPayment from "./CustomPayment";
18
18
  import { isCustomPayment } from "../PaymentList/status";
19
19
  import CashManual from "./CashManual";
20
20
  import GooglePay from "./GooglePay";
21
- import { removePayGroupFromStorage, syncPayGroupToStorage } from "../payGroup";
21
+ import { removePayGroupFromStorage, setPayNumber, syncPayGroupToStorage } from "../payGroup";
22
22
  import ApplePay from "./ApplePay";
23
23
  import GlobePayAliPayH5 from "./GlobePayAliPayH5";
24
24
  import GlobePayPaypalH5 from "./GlobePayPaypalH5";
@@ -26,6 +26,9 @@ import GlobePayWxH5 from "./GlobePayWxH5";
26
26
  import GlobePayQrcode from "./GlobePayQrcode";
27
27
  import { walletPassPay } from "./WalletPass/serve";
28
28
  import { formatWalletPassParams } from "../utils";
29
+ import useEngineContext from "../../../../hooks/useEngineContext";
30
+ import { isJson } from "@pisell/utils";
31
+ import { getReturnUrl } from "./GlobePayQrcode/serve";
29
32
  var isOfflinePayment = function isOfflinePayment(type) {
30
33
  if (isCustomPayment(type)) {
31
34
  return true;
@@ -33,6 +36,7 @@ var isOfflinePayment = function isOfflinePayment(type) {
33
36
  return ['pisell.bank_deposit', 'pisell.offline_payment', 'pisell.other.cashmanual', 'pisell.custom_bank_transfer'].includes(type);
34
37
  };
35
38
  var PaymentMethods = function PaymentMethods(props, ref) {
39
+ var _context$appHelper;
36
40
  var MWCreditCardRef = useRef(null);
37
41
  var SuperPayAliPayH5Ref = useRef(null);
38
42
  var StripePayRef = useRef(null);
@@ -47,6 +51,9 @@ var PaymentMethods = function PaymentMethods(props, ref) {
47
51
  var GlobePayPaypalH5Ref = useRef(null);
48
52
  var GlobePayWxH5Ref = useRef(null);
49
53
  var GlobePayQrcodeRef = useRef(null);
54
+ var context = useEngineContext();
55
+ var _context$appHelper$ut = (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils,
56
+ interaction = _context$appHelper$ut.interaction;
50
57
  var init = /*#__PURE__*/function () {
51
58
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
52
59
  var _payGroup$walletPass;
@@ -112,6 +119,26 @@ var PaymentMethods = function PaymentMethods(props, ref) {
112
119
  return _ref2.apply(this, arguments);
113
120
  };
114
121
  }();
122
+ useEffect(function () {
123
+ var _interaction$utils, _interaction$utils$is, _interaction$utils2, _interaction$utils2$i;
124
+ console.log('paymentResult isAppEnv', interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$is = _interaction$utils.isAppEnv) === null || _interaction$utils$is === void 0 ? void 0 : _interaction$utils$is.call(_interaction$utils));
125
+ if (interaction !== null && interaction !== void 0 && (_interaction$utils2 = interaction.utils) !== null && _interaction$utils2 !== void 0 && (_interaction$utils2$i = _interaction$utils2.isAppEnv) !== null && _interaction$utils2$i !== void 0 && _interaction$utils2$i.call(_interaction$utils2)) {
126
+ interaction.utils.mountFunction('global', 'paymentResult', function (strResult) {
127
+ console.log('paymentResult', strResult);
128
+ if (!isJson(strResult)) return;
129
+ var result = JSON.parse(strResult);
130
+ var type = result.type,
131
+ pay_number = result.pay_number,
132
+ order_id = result.order_id;
133
+ if (type && order_id && pay_number) {
134
+ setPayNumber(order_id, pay_number);
135
+ }
136
+ var url = "".concat(getReturnUrl(), "?order_id=").concat(order_id, "&status=success");
137
+ console.log(url, 'paymentResult');
138
+ window.location.href = url;
139
+ });
140
+ }
141
+ }, []);
115
142
  var onPayByType = /*#__PURE__*/function () {
116
143
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
117
144
  var type, payGroup, _ApplePayRef$current, _GooglePayRef$current, _MWCreditCardRef$curr, _SuperPayAliPayH5Ref$, _SuperPayWxPayH5Ref$c, _StripePayRef$current, _OfflinePaymentRef$cu, _BankDepositRef$curre, _CashManualRef$curren, _GlobePayAliPayH5Ref$, _GlobePayPaypalH5Ref$, _GlobePayWxH5Ref$curr, _GlobePayQrcodeRef$cu, _CustomPaymentRef$cur;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { WalletPassDataType } from '../../../PaymentMethods/WalletPass/serve';
3
2
  import './index.less';
4
3
  interface WalletUseListProps {
@@ -10,6 +10,10 @@
10
10
  display: flex;
11
11
  align-items: center;
12
12
  justify-content: center;
13
+ & > span:first-child {
14
+ text-overflow: ellipsis;
15
+ overflow: hidden;
16
+ }
13
17
  }
14
18
  }
15
19
 
@@ -41,7 +41,7 @@ import "./index.less";
41
41
  * @Date: 2024-08-16 10:43
42
42
  */
43
43
  var ToCPay = function ToCPay(props, ref) {
44
- var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _dvaStore$core, _dvaStore$core2, _state$payGroup6, _state$payGroup16, _state$order, _state$order2, _state$payGroup21, _state$payGroup22, _state$payGroup23;
44
+ var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _dvaStore$core, _dvaStore$core2, _state$payGroup6, _state$payGroup17, _state$order, _state$order2, _state$payGroup22, _state$payGroup23, _state$payGroup24;
45
45
  //@ts-ignore
46
46
  var _useContext = useContext(Context),
47
47
  state = _useContext.state,
@@ -107,33 +107,33 @@ var ToCPay = function ToCPay(props, ref) {
107
107
  * @Date: 2024-08-15 14:02
108
108
  */
109
109
  var _initStore = function _initStore(initProps) {
110
- var _context$appHelper$ut5, _initProps$order, _initProps$order2, _initProps$order3;
110
+ var _context$appHelper$ut5;
111
111
  dispatch({
112
112
  type: 'init',
113
113
  payload: _objectSpread(_objectSpread({}, initProps), {}, {
114
114
  status: 'init',
115
115
  // 将支付回调储存在store, 方便其他模块调用
116
116
  payCallback: props.callback,
117
- history: (_context$appHelper$ut5 = context.appHelper.utils) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.history,
117
+ history: (_context$appHelper$ut5 = context.appHelper.utils) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.history
118
118
  // 支付组
119
- payGroup: {
120
- order_id: initProps === null || initProps === void 0 || (_initProps$order = initProps.order) === null || _initProps$order === void 0 ? void 0 : _initProps$order.order_id,
121
- total_amount: initProps === null || initProps === void 0 || (_initProps$order2 = initProps.order) === null || _initProps$order2 === void 0 ? void 0 : _initProps$order2.amount,
122
- // 原订单信息
123
- _order: initProps === null || initProps === void 0 ? void 0 : initProps.order,
124
- payment_group_id: initProps === null || initProps === void 0 || (_initProps$order3 = initProps.order) === null || _initProps$order3 === void 0 ? void 0 : _initProps$order3.payment_group_id
125
- }
119
+ // payGroup: {
120
+ // order_id: initProps?.order?.order_id,
121
+ // total_amount: initProps?.order?.amount,
122
+ // // 原订单信息
123
+ // _order: initProps?.order,
124
+ // payment_group_id: initProps?.order?.payment_group_id,
125
+ // },
126
126
  })
127
127
  });
128
128
  };
129
129
  var getWalletSetting = /*#__PURE__*/function () {
130
130
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(initProps) {
131
- var _initProps$order4, _utils$translation, _wallet_setting$popup;
131
+ var _initProps$order, _utils$translation, _wallet_setting$popup;
132
132
  var sale_channel, _yield$getWalletNameA, wallet, wallet_setting, setting;
133
133
  return _regeneratorRuntime().wrap(function _callee$(_context) {
134
134
  while (1) switch (_context.prev = _context.next) {
135
135
  case 0:
136
- sale_channel = (initProps === null || initProps === void 0 || (_initProps$order4 = initProps.order) === null || _initProps$order4 === void 0 ? void 0 : _initProps$order4.sale_channel) || 'online-store';
136
+ sale_channel = (initProps === null || initProps === void 0 || (_initProps$order = initProps.order) === null || _initProps$order === void 0 ? void 0 : _initProps$order.sale_channel) || 'online-store';
137
137
  _context.next = 3;
138
138
  return getWalletNameAndPopupStatus({
139
139
  setting_type: "".concat(sale_channel, "-wallet-setting")
@@ -241,15 +241,21 @@ var ToCPay = function ToCPay(props, ref) {
241
241
  _ref4 = data || {}, _ref4$remain_amount = _ref4.remain_amount, remain_amount = _ref4$remain_amount === void 0 ? 0 : _ref4$remain_amount, wallet_pass_recommend_list = _ref4.wallet_pass_recommend_list, wallet_pass_amount = _ref4.wallet_pass_amount, payment_list = _ref4.payment_list, walletPass = _ref4.walletPass; // 设置交易组
242
242
  dispatch({
243
243
  type: 'setPayGroup',
244
- payload: _objectSpread(_objectSpread({}, state.payGroup), {}, {
244
+ payload: {
245
+ // ...state.payGroup,
246
+ order_id: order === null || order === void 0 ? void 0 : order.order_id,
247
+ // total_amount: order?.amount,
248
+ // 原订单信息
249
+ _order: order,
250
+ payment_group_id: order === null || order === void 0 ? void 0 : order.payment_group_id,
245
251
  // 支付方式没有walletPass时walletPass设置null
246
252
  walletPass: walletPass ? _objectSpread(_objectSpread(_objectSpread({}, (_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.walletPass), walletPass), {}, {
247
253
  amount: wallet_pass_amount,
248
254
  cards: wallet_pass_recommend_list
249
255
  }) : null,
250
- total_amount: order.amount,
256
+ total_amount: order === null || order === void 0 ? void 0 : order.amount,
251
257
  wait_amount: remain_amount
252
- })
258
+ }
253
259
  });
254
260
 
255
261
  // 初始化支付列表
@@ -596,7 +602,7 @@ var ToCPay = function ToCPay(props, ref) {
596
602
  * @Date: 2024-08-08 16:34
597
603
  */
598
604
  var onCancel = function onCancel() {
599
- var _state$payGroup14;
605
+ var _state$payGroup14, _state$payGroup15;
600
606
  // 删除交易组
601
607
  removePayGroupFromStorage((_state$payGroup14 = state.payGroup) === null || _state$payGroup14 === void 0 ? void 0 : _state$payGroup14.order_id);
602
608
 
@@ -609,15 +615,17 @@ var ToCPay = function ToCPay(props, ref) {
609
615
  // 回调外部
610
616
  payCallback({
611
617
  key: 'cancel',
612
- data: {}
618
+ data: {
619
+ order_id: (_state$payGroup15 = state.payGroup) === null || _state$payGroup15 === void 0 ? void 0 : _state$payGroup15.order_id
620
+ }
613
621
  });
614
622
  };
615
623
 
616
624
  // 待支付金额变化时, 重新计算附加费
617
625
  useUpdateEffect(function () {
618
- var _paymentListRef$curre2, _state$payGroup15;
619
- (_paymentListRef$curre2 = paymentListRef.current) === null || _paymentListRef$curre2 === void 0 || _paymentListRef$curre2.calculateSurcharge(((_state$payGroup15 = state.payGroup) === null || _state$payGroup15 === void 0 ? void 0 : _state$payGroup15.wait_amount) || 0);
620
- }, [(_state$payGroup16 = state.payGroup) === null || _state$payGroup16 === void 0 ? void 0 : _state$payGroup16.wait_amount]);
626
+ var _paymentListRef$curre2, _state$payGroup16;
627
+ (_paymentListRef$curre2 = paymentListRef.current) === null || _paymentListRef$curre2 === void 0 || _paymentListRef$curre2.calculateSurcharge(((_state$payGroup16 = state.payGroup) === null || _state$payGroup16 === void 0 ? void 0 : _state$payGroup16.wait_amount) || 0);
628
+ }, [(_state$payGroup17 = state.payGroup) === null || _state$payGroup17 === void 0 ? void 0 : _state$payGroup17.wait_amount]);
621
629
  useImperativeHandle(ref, function () {
622
630
  return {
623
631
  init: init,
@@ -634,7 +642,7 @@ var ToCPay = function ToCPay(props, ref) {
634
642
  * @Date: 2024-08-16 10:49
635
643
  */
636
644
  var renderPaymentListTitle = function renderPaymentListTitle() {
637
- var _state$payGroup17;
645
+ var _state$payGroup18;
638
646
  // 待支付金额为0 展示无需选择支付方式
639
647
  if (waitAmount == 0) {
640
648
  return /*#__PURE__*/React.createElement("div", {
@@ -647,13 +655,13 @@ var ToCPay = function ToCPay(props, ref) {
647
655
  }
648
656
 
649
657
  // 有剩余金额, 展示继续支付
650
- if (((_state$payGroup17 = state.payGroup) === null || _state$payGroup17 === void 0 ? void 0 : _state$payGroup17.total_amount) !== waitAmount) {
651
- var _state$payGroup18;
658
+ if (((_state$payGroup18 = state.payGroup) === null || _state$payGroup18 === void 0 ? void 0 : _state$payGroup18.total_amount) !== waitAmount) {
659
+ var _state$payGroup19;
652
660
  return /*#__PURE__*/React.createElement("div", {
653
661
  className: "custom-payment-list-title"
654
662
  }, locales.getText('tocPay.text.continuePayment'), ' ', /*#__PURE__*/React.createElement(PisellText.Amount, {
655
663
  className: "custom-payment-list-title-price",
656
- value: ((_state$payGroup18 = state.payGroup) === null || _state$payGroup18 === void 0 ? void 0 : _state$payGroup18.wait_amount) || 0.0
664
+ value: ((_state$payGroup19 = state.payGroup) === null || _state$payGroup19 === void 0 ? void 0 : _state$payGroup19.wait_amount) || 0.0
657
665
  }));
658
666
  }
659
667
 
@@ -669,12 +677,12 @@ var ToCPay = function ToCPay(props, ref) {
669
677
  * @Date: 2024-08-16 10:50
670
678
  */
671
679
  var onWalletPassChange = useMemoizedFn(function (walletPass) {
672
- var _state$payGroup19, _state$payGroup20;
673
- var _waitAmount = new Decimal(String(((_state$payGroup19 = state.payGroup) === null || _state$payGroup19 === void 0 ? void 0 : _state$payGroup19.total_amount) || 0)).minus(new Decimal(String(walletPass.amount || 0))).toNumber();
680
+ var _state$payGroup20, _state$payGroup21;
681
+ var _waitAmount = new Decimal(String(((_state$payGroup20 = state.payGroup) === null || _state$payGroup20 === void 0 ? void 0 : _state$payGroup20.total_amount) || 0)).minus(new Decimal(String(walletPass.amount || 0))).toNumber();
674
682
  dispatch({
675
683
  type: 'setPayGroup',
676
684
  payload: {
677
- walletPass: _objectSpread(_objectSpread({}, (_state$payGroup20 = state.payGroup) === null || _state$payGroup20 === void 0 ? void 0 : _state$payGroup20.walletPass), walletPass),
685
+ walletPass: _objectSpread(_objectSpread({}, (_state$payGroup21 = state.payGroup) === null || _state$payGroup21 === void 0 ? void 0 : _state$payGroup21.walletPass), walletPass),
678
686
  wait_amount: _waitAmount
679
687
  }
680
688
  });
@@ -753,8 +761,8 @@ var ToCPay = function ToCPay(props, ref) {
753
761
  }, ((_state$order = state.order) === null || _state$order === void 0 ? void 0 : _state$order.countdown) && /*#__PURE__*/React.createElement(PayCountdown, {
754
762
  time: (_state$order2 = state.order) === null || _state$order2 === void 0 ? void 0 : _state$order2.countdown
755
763
  }), /*#__PURE__*/React.createElement(PayAmount, {
756
- amount: ((_state$payGroup21 = state.payGroup) === null || _state$payGroup21 === void 0 ? void 0 : _state$payGroup21.total_amount) || 0
757
- }), ((_state$payGroup22 = state.payGroup) === null || _state$payGroup22 === void 0 ? void 0 : _state$payGroup22.walletPass) && /*#__PURE__*/React.createElement(WalletPassBlock, {
764
+ amount: ((_state$payGroup22 = state.payGroup) === null || _state$payGroup22 === void 0 ? void 0 : _state$payGroup22.total_amount) || 0
765
+ }), ((_state$payGroup23 = state.payGroup) === null || _state$payGroup23 === void 0 ? void 0 : _state$payGroup23.walletPass) && /*#__PURE__*/React.createElement(WalletPassBlock, {
758
766
  customer_id: customer_id,
759
767
  payGroup: state.payGroup,
760
768
  onWalletPassChange: onWalletPassChange,
@@ -766,7 +774,7 @@ var ToCPay = function ToCPay(props, ref) {
766
774
  handlePaymentByType(detail === null || detail === void 0 ? void 0 : detail.service);
767
775
  },
768
776
  paymentTypeChange: paymentTypeChange,
769
- hide: ((_state$payGroup23 = state.payGroup) === null || _state$payGroup23 === void 0 ? void 0 : _state$payGroup23.wait_amount) == 0,
777
+ hide: ((_state$payGroup24 = state.payGroup) === null || _state$payGroup24 === void 0 ? void 0 : _state$payGroup24.wait_amount) == 0,
770
778
  renderTitle: renderPaymentListTitle
771
779
  })), /*#__PURE__*/React.createElement(PaymentMethods, {
772
780
  ref: paymentMethodsRef,
@@ -49,3 +49,9 @@ export declare const isFranchiseeShop: (path?: any, history?: any) => any;
49
49
  export declare const getFranchiseeShopId: (path?: any, history?: any) => number;
50
50
  export declare const formatFranchiseeRoute: (url: string, history?: any) => string;
51
51
  export declare const getAvailableMaxAmount: (data: WalletPassDataType) => string;
52
+ export declare const clientPayment: (params: {
53
+ order_id: number;
54
+ type: "aliPay" | "wxPay";
55
+ values: any;
56
+ interaction?: any;
57
+ }) => void;
@@ -1,3 +1,9 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
7
  import { Decimal } from 'decimal.js';
2
8
  import { isTripartitePayment } from "./status";
3
9
  /**
@@ -90,4 +96,19 @@ export var formatFranchiseeRoute = function formatFranchiseeRoute(url, history)
90
96
  // 获取walletPass可用最大金额
91
97
  export var getAvailableMaxAmount = function getAvailableMaxAmount(data) {
92
98
  return data.tag !== 'point_card' ? data.available_max_amount : data === null || data === void 0 ? void 0 : data.recommended_usage_amount;
99
+ };
100
+ export var clientPayment = function clientPayment(params) {
101
+ var _interaction$utils, _interaction$utils$po;
102
+ var interaction = params.interaction,
103
+ type = params.type,
104
+ order_id = params.order_id,
105
+ values = params.values;
106
+ interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 || _interaction$utils$po.call(_interaction$utils, {
107
+ module: 'global',
108
+ key: 'paymentClient',
109
+ data: _objectSpread({
110
+ type: type,
111
+ order_id: order_id
112
+ }, values)
113
+ });
93
114
  };
@@ -1,3 +1,3 @@
1
- import "./index.less";
1
+ import './index.less';
2
2
  declare const ProductItem: ({ item, onClick, amountSymbol, style, className, }: any) => JSX.Element;
3
3
  export default ProductItem;
@@ -1,18 +1,27 @@
1
- import React from "react";
2
- import { formatAmount, image } from "@pisell/utils";
3
- import classNames from "classnames";
1
+ import React from 'react';
2
+ import { image } from '@pisell/utils';
3
+ import classNames from 'classnames';
4
+ import Decimal from 'decimal.js';
5
+ import PisellPriceText from "../../../../productSelect/components/pisellPriceText";
4
6
  import "./index.less";
5
7
  var ProductItem = function ProductItem(_ref) {
6
8
  var _ref$item = _ref.item,
7
9
  item = _ref$item === void 0 ? {} : _ref$item,
8
10
  _onClick = _ref.onClick,
9
11
  _ref$amountSymbol = _ref.amountSymbol,
10
- amountSymbol = _ref$amountSymbol === void 0 ? "$" : _ref$amountSymbol,
12
+ amountSymbol = _ref$amountSymbol === void 0 ? '$' : _ref$amountSymbol,
11
13
  style = _ref.style,
12
14
  className = _ref.className;
15
+ var price = item.price,
16
+ is_bundle = item.is_bundle,
17
+ minimum_markup_price = item.minimum_markup_price;
18
+ var _price = price;
19
+ if (is_bundle) {
20
+ _price = new Decimal(price).plus(new Decimal(minimum_markup_price)).toFixed(2);
21
+ }
13
22
  return /*#__PURE__*/React.createElement("div", {
14
23
  style: style,
15
- className: classNames("product-item-card", className),
24
+ className: classNames('product-item-card', className),
16
25
  onClick: function onClick() {
17
26
  _onClick(item);
18
27
  }
@@ -25,6 +34,9 @@ var ProductItem = function ProductItem(_ref) {
25
34
  className: "product-item-card-title"
26
35
  }, item.title), /*#__PURE__*/React.createElement("div", {
27
36
  className: "product-item-card-price"
28
- }, formatAmount(item.price, 2, amountSymbol))));
37
+ }, /*#__PURE__*/React.createElement(PisellPriceText, {
38
+ value: _price,
39
+ isMini: is_bundle
40
+ }))));
29
41
  };
30
42
  export default ProductItem;
@@ -12,9 +12,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
12
12
  import React, { useEffect, useMemo, useRef, useState } from 'react';
13
13
  import { Skeleton } from 'antd';
14
14
  import { PisellEmpty } from '@pisell/materials';
15
- import { useMemoizedFn } from 'ahooks';
15
+ import { useMemoizedFn, useDebounceFn } from 'ahooks';
16
16
  import { locales } from '@pisell/utils';
17
- import Tabs from "../../../booking/components/TabProduct/tabs";
17
+ import Tabs from "./tabs";
18
18
  import ProductGroup, { ProductGroupSkeleton } from "../productGroup";
19
19
  var io = null;
20
20
  var TabProduct = function TabProduct(props) {
@@ -43,19 +43,37 @@ var TabProduct = function TabProduct(props) {
43
43
  });
44
44
  }
45
45
  }, [list]);
46
+
47
+ // 添加防抖的scroll函数
48
+ var debouncedScroll = useDebounceFn(function (id) {
49
+ var _tabsRef$current;
50
+ tabsRef === null || tabsRef === void 0 || (_tabsRef$current = tabsRef.current) === null || _tabsRef$current === void 0 || _tabsRef$current.scroll(id);
51
+ }, {
52
+ wait: 100
53
+ } // 100ms防抖
54
+ );
46
55
  var handleObserver = useMemoizedFn(function () {
47
56
  var _marginTop = 270;
48
57
  var _marginBottom = window.innerHeight - 70 - 200 - 70;
49
58
  var _rootMargin = "".concat(_marginTop * -1, "px 0px ").concat(_marginBottom * -1, "px 0px");
50
59
  io = new IntersectionObserver(function (entries) {
51
- if (entries[0].isIntersecting) {
52
- var _entries$, _tabsRef$current;
53
- var _entries$0$target$id$ = (_entries$ = entries[0]) === null || _entries$ === void 0 || (_entries$ = _entries$.target) === null || _entries$ === void 0 || (_entries$ = _entries$.id) === null || _entries$ === void 0 ? void 0 : _entries$.split('-'),
54
- _entries$0$target$id$2 = _slicedToArray(_entries$0$target$id$, 2),
55
- name = _entries$0$target$id$2[0],
56
- id = _entries$0$target$id$2[1];
57
- setCurrentGroupId(Number(id));
58
- tabsRef === null || tabsRef === void 0 || (_tabsRef$current = tabsRef.current) === null || _tabsRef$current === void 0 || _tabsRef$current.scroll(id);
60
+ var enteringEntries = entries.filter(function (entry) {
61
+ return entry.isIntersecting;
62
+ });
63
+ if (enteringEntries.length > 0) {
64
+ var _topMostEntry$target;
65
+ // 选择最靠近顶部的元素
66
+ var topMostEntry = enteringEntries.reduce(function (top, current) {
67
+ return current.boundingClientRect.top < top.boundingClientRect.top ? current : top;
68
+ });
69
+ var _topMostEntry$target$ = topMostEntry === null || topMostEntry === void 0 || (_topMostEntry$target = topMostEntry.target) === null || _topMostEntry$target === void 0 || (_topMostEntry$target = _topMostEntry$target.id) === null || _topMostEntry$target === void 0 ? void 0 : _topMostEntry$target.split('-'),
70
+ _topMostEntry$target$2 = _slicedToArray(_topMostEntry$target$, 2),
71
+ name = _topMostEntry$target$2[0],
72
+ id = _topMostEntry$target$2[1];
73
+ var newGroupId = Number(id);
74
+ setCurrentGroupId(newGroupId);
75
+ debouncedScroll.run(id);
76
+ // tabsRef?.current?.scroll(id);
59
77
  }
60
78
  }, {
61
79
  root: null,
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface Com<T> extends React.FC<T> {
4
+ }
5
+ export declare type RowKey = string | number;
6
+ export interface Option {
7
+ id: number | string;
8
+ name: React.ReactNode;
9
+ }
10
+ export interface TabsProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onChange'> {
11
+ renderTab: (item: any) => React.ReactNode;
12
+ rowKey: RowKey;
13
+ name: RowKey;
14
+ onChange: (key: RowKey, _item: any) => void;
15
+ tab: RowKey;
16
+ className: string;
17
+ tabsRef: any;
18
+ options: Option[];
19
+ }
20
+ declare const _default: React.ForwardRefExoticComponent<Omit<Partial<TabsProps>, "ref"> & React.RefAttributes<unknown>>;
21
+ export default _default;