@pisell/private-materials 3.3.19 → 3.3.21

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 (83) 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/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +3 -3
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +3 -3
  9. package/es/components/appointmentBooking/components/ConfirmInformation/index.js +3 -2
  10. package/es/components/appointmentBooking/components/Content/index.js +19 -22
  11. package/es/components/appointmentBooking/components/Date/index.js +66 -42
  12. package/es/components/appointmentBooking/components/Date/state.js +5 -0
  13. package/es/components/appointmentBooking/components/Form/index.js +12 -4
  14. package/es/components/appointmentBooking/components/Guest/index.js +4 -2
  15. package/es/components/appointmentBooking/components/Resource/index.js +7 -4
  16. package/es/components/appointmentBooking/components/Services/index.js +3 -2
  17. package/es/components/appointmentBooking/components/TimeSlicing/index.js +4 -2
  18. package/es/components/appointmentBooking/context.js +63 -6
  19. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.js +35 -11
  20. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.less +9 -0
  21. package/es/components/appointmentBooking/hooks.js +48 -8
  22. package/es/components/appointmentBooking/index.d.ts +0 -1
  23. package/es/components/appointmentBooking/locales.js +6 -0
  24. package/es/components/appointmentBooking/utils.js +10 -4
  25. package/es/components/booking/components/footer/index.d.ts +1 -0
  26. package/es/components/booking/components/footer/utils.js +1 -1
  27. package/es/components/booking/deposit/index.js +1 -1
  28. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  29. package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +1 -0
  30. package/lib/components/appointmentBooking/components/Content/index.js +11 -11
  31. package/lib/components/appointmentBooking/components/Date/index.js +29 -12
  32. package/lib/components/appointmentBooking/components/Date/state.js +7 -0
  33. package/lib/components/appointmentBooking/components/Form/index.js +6 -3
  34. package/lib/components/appointmentBooking/components/Guest/index.js +2 -1
  35. package/lib/components/appointmentBooking/components/Resource/index.js +6 -4
  36. package/lib/components/appointmentBooking/components/Services/index.js +2 -2
  37. package/lib/components/appointmentBooking/components/TimeSlicing/index.js +2 -1
  38. package/lib/components/appointmentBooking/context.js +28 -7
  39. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.js +39 -4
  40. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.less +9 -0
  41. package/lib/components/appointmentBooking/hooks.js +29 -5
  42. package/lib/components/appointmentBooking/index.d.ts +0 -1
  43. package/lib/components/appointmentBooking/locales.js +6 -0
  44. package/lib/components/appointmentBooking/utils.js +8 -4
  45. package/lib/components/booking/components/footer/index.d.ts +1 -0
  46. package/lib/components/booking/components/footer/utils.js +1 -1
  47. package/lib/components/booking/deposit/index.js +1 -1
  48. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  49. package/package.json +2 -2
  50. package/es/components/appointmentBooking/components/ConfirmInformation/index.d.ts +0 -4
  51. package/es/components/appointmentBooking/components/Content/index.d.ts +0 -3
  52. package/es/components/appointmentBooking/components/Date/index.d.ts +0 -4
  53. package/es/components/appointmentBooking/components/Date/state.d.ts +0 -62
  54. package/es/components/appointmentBooking/components/Form/index.d.ts +0 -4
  55. package/es/components/appointmentBooking/components/Guest/index.d.ts +0 -4
  56. package/es/components/appointmentBooking/components/Resource/index.d.ts +0 -7
  57. package/es/components/appointmentBooking/components/Services/index.d.ts +0 -4
  58. package/es/components/appointmentBooking/components/TimeSlicing/index.d.ts +0 -4
  59. package/es/components/appointmentBooking/context.d.ts +0 -33
  60. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -3
  61. package/es/components/appointmentBooking/hooks.d.ts +0 -106
  62. package/es/components/appointmentBooking/locales.d.ts +0 -348
  63. package/es/components/appointmentBooking/utils.d.ts +0 -114
  64. package/es/components/booking/deposit/index.d.ts +0 -3
  65. package/es/components/eftposPay/payo/config.d.ts +0 -12
  66. package/es/components/eftposPay/payo/hooks.d.ts +0 -10
  67. package/lib/components/appointmentBooking/components/ConfirmInformation/index.d.ts +0 -4
  68. package/lib/components/appointmentBooking/components/Content/index.d.ts +0 -3
  69. package/lib/components/appointmentBooking/components/Date/index.d.ts +0 -4
  70. package/lib/components/appointmentBooking/components/Date/state.d.ts +0 -62
  71. package/lib/components/appointmentBooking/components/Form/index.d.ts +0 -4
  72. package/lib/components/appointmentBooking/components/Guest/index.d.ts +0 -4
  73. package/lib/components/appointmentBooking/components/Resource/index.d.ts +0 -7
  74. package/lib/components/appointmentBooking/components/Services/index.d.ts +0 -4
  75. package/lib/components/appointmentBooking/components/TimeSlicing/index.d.ts +0 -4
  76. package/lib/components/appointmentBooking/context.d.ts +0 -33
  77. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -3
  78. package/lib/components/appointmentBooking/hooks.d.ts +0 -106
  79. package/lib/components/appointmentBooking/locales.d.ts +0 -348
  80. package/lib/components/appointmentBooking/utils.d.ts +0 -114
  81. package/lib/components/booking/deposit/index.d.ts +0 -3
  82. package/lib/components/eftposPay/payo/config.d.ts +0 -12
  83. package/lib/components/eftposPay/payo/hooks.d.ts +0 -10
@@ -122,15 +122,16 @@ var ConfirmInformation = /*#__PURE__*/forwardRef(function (props, ref) {
122
122
  Toast(freeResult === null || freeResult === void 0 ? void 0 : freeResult.message);
123
123
  }
124
124
  case 24:
125
- _context.next = 29;
125
+ _context.next = 30;
126
126
  break;
127
127
  case 26:
128
128
  _context.prev = 26;
129
129
  _context.t0 = _context["catch"](4);
130
+ Toast((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || '');
130
131
  setTimeout(function () {
131
132
  setLoading(false);
132
133
  }, 50);
133
- case 29:
134
+ case 30:
134
135
  case "end":
135
136
  return _context.stop();
136
137
  }
@@ -36,7 +36,9 @@ var Layout = function Layout() {
36
36
  resourceOtherParams = _useAppointmentBookin.resourceOtherParams,
37
37
  setIsAgreeDepositPolicy = _useAppointmentBookin.setIsAgreeDepositPolicy,
38
38
  appointmentBooking = _useAppointmentBookin.appointmentBooking,
39
- setLoading = _useAppointmentBookin.setLoading;
39
+ setLoading = _useAppointmentBookin.setLoading,
40
+ policyParams = _useAppointmentBookin.policyParams,
41
+ closePolicy = _useAppointmentBookin.closePolicy;
40
42
  var _useAppointmentBookin2 = useAppointmentBookingSetting(),
41
43
  getLoadAllSchedule = _useAppointmentBookin2.getLoadAllSchedule,
42
44
  isDateSelectedFirst = _useAppointmentBookin2.isDateSelectedFirst,
@@ -50,22 +52,14 @@ var Layout = function Layout() {
50
52
  stepList = _useAppointmentBookin5.stepList;
51
53
  var _useShopDiscount = useShopDiscount(),
52
54
  shopDiscount = _useShopDiscount.shopDiscount;
53
- var _useState = useState(false),
54
- _useState2 = _slicedToArray(_useState, 2),
55
- showAgreement = _useState2[0],
56
- setShowAgreement = _useState2[1];
57
- var _useState3 = useState({}),
58
- _useState4 = _slicedToArray(_useState3, 2),
59
- agreementContent = _useState4[0],
60
- setAgreementContent = _useState4[1];
61
55
 
62
56
  // 不要删除
63
57
  useAppointmentBookingCart();
64
58
  useAppointmentBookingStep();
65
- var _useState5 = useState({}),
66
- _useState6 = _slicedToArray(_useState5, 2),
67
- params = _useState6[0],
68
- setParams = _useState6[1];
59
+ var _useState = useState({}),
60
+ _useState2 = _slicedToArray(_useState, 2),
61
+ params = _useState2[0],
62
+ setParams = _useState2[1];
69
63
  useEffect(function () {
70
64
  return function () {
71
65
  var _shopDiscount$destroy;
@@ -194,10 +188,6 @@ var Layout = function Layout() {
194
188
  if (isDateSelectedFirst && key === 'select-date') return false;
195
189
  return key !== 'confirm-information';
196
190
  }, [isDateSelectedFirst, currentStep === null || currentStep === void 0 || (_currentStep$step8 = currentStep.step) === null || _currentStep$step8 === void 0 ? void 0 : _currentStep$step8.key]);
197
- var handleAgreementOk = function handleAgreementOk() {
198
- setShowAgreement(false);
199
- // goToNextForm();
200
- };
201
191
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement("div", {
202
192
  className: "parallel-content-wrap ".concat(isMobile() ? 'parallel-content-mobile-wrap' : '')
203
193
  }, /*#__PURE__*/React.createElement("div", {
@@ -209,13 +199,20 @@ var Layout = function Layout() {
209
199
  var _stepRef$current2, _stepRef$current2$nex;
210
200
  return stepRef === null || stepRef === void 0 || (_stepRef$current2 = stepRef.current) === null || _stepRef$current2 === void 0 || (_stepRef$current2$nex = _stepRef$current2.next) === null || _stepRef$current2$nex === void 0 ? void 0 : _stepRef$current2$nex.call(_stepRef$current2);
211
201
  }
212
- }) : null, showAgreement ? /*#__PURE__*/React.createElement(PolicyModal, {
213
- open: showAgreement,
214
- onCancel: handleAgreementOk,
215
- item: agreementContent,
202
+ }) : null, policyParams !== null && policyParams !== void 0 && policyParams.open ? /*#__PURE__*/React.createElement(PolicyModal, {
203
+ key: policyParams === null || policyParams === void 0 ? void 0 : policyParams._ts,
204
+ open: policyParams === null || policyParams === void 0 ? void 0 : policyParams.open,
205
+ onCancel: function onCancel() {
206
+ return closePolicy(false);
207
+ },
208
+ onConfirm: function onConfirm() {
209
+ return closePolicy(true);
210
+ },
211
+ item: policyParams === null || policyParams === void 0 ? void 0 : policyParams.content,
216
212
  onChange: function onChange() {
217
213
  return setLoading(false);
218
- }
214
+ },
215
+ isHideCheckout: false
219
216
  }) : null);
220
217
  };
221
218
  export default Layout;
@@ -13,7 +13,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
13
13
  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; }
14
14
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
- import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'react';
16
+ import React, { useState, useEffect, useMemo, forwardRef, useImperativeHandle } from 'react';
17
17
  import { Skeleton } from 'antd';
18
18
  import Dayjs from 'dayjs';
19
19
  import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
@@ -23,9 +23,12 @@ import { locales, isMobile } from '@pisell/utils';
23
23
  import { CaretLeftOutlined, CaretRightOutlined } from '@ant-design/icons';
24
24
  import { useAppointmentBookingContext } from "../../context";
25
25
  import { Toast } from "../../utils";
26
- import { useAppointmentBookingSetting } from "../../hooks";
26
+ import useEngineContext from "../../../../hooks/useEngineContext";
27
+ import { useAppointmentBookingSetting, useAppointmentBookingStep } from "../../hooks";
28
+ import { localeTypes } from "./state";
27
29
  import "./index.less";
28
30
  var Date = /*#__PURE__*/forwardRef(function (props, ref) {
31
+ var _context$engine2, _Dayjs$locale;
29
32
  var _useState = useState(false),
30
33
  _useState2 = _slicedToArray(_useState, 2),
31
34
  loading = _useState2[0],
@@ -51,44 +54,60 @@ var Date = /*#__PURE__*/forwardRef(function (props, ref) {
51
54
  customPageId = _useAppointmentBookin2.customPageId,
52
55
  getLoadAllSchedule = _useAppointmentBookin2.getLoadAllSchedule,
53
56
  channel = _useAppointmentBookin2.channel;
57
+ var _useAppointmentBookin3 = useAppointmentBookingStep(),
58
+ nextStep = _useAppointmentBookin3.nextStep;
59
+ var context = useEngineContext();
54
60
  useImperativeHandle(ref, function () {
55
61
  return {
56
- next: function () {
57
- var _next2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
58
- var data;
59
- return _regeneratorRuntime().wrap(function _callee$(_context) {
60
- while (1) switch (_context.prev = _context.next) {
61
- case 0:
62
- _context.next = 2;
63
- return appointmentBooking.getDateRange();
64
- case 2:
65
- data = _context.sent;
66
- if (data !== null && data !== void 0 && data.length) {
67
- _context.next = 5;
68
- break;
69
- }
70
- return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.unselect.date')));
71
- case 5:
72
- // 判断选定的日期是否存在可用的预约
73
- // const result = appointmentBooking.checkResourceListForDate();
74
- // if (!result) {
75
- // return Toast(locales.getText('pisell2.appointment.unuse.date'));
76
- // }
62
+ next: handleNext
63
+ };
64
+ });
77
65
 
78
- appointmentBooking.next();
79
- case 6:
80
- case "end":
81
- return _context.stop();
66
+ /**
67
+ * @title: 处理进入下一步的逻辑
68
+ * @description:
69
+ * @return {*}
70
+ * @Author: WangHan
71
+ * @Date: 2025-05-13 15:36
72
+ */
73
+ var handleNext = /*#__PURE__*/function () {
74
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
75
+ var data, result;
76
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
77
+ while (1) switch (_context.prev = _context.next) {
78
+ case 0:
79
+ _context.next = 2;
80
+ return appointmentBooking.getDateRange();
81
+ case 2:
82
+ data = _context.sent;
83
+ if (data !== null && data !== void 0 && data.length) {
84
+ _context.next = 5;
85
+ break;
82
86
  }
83
- }, _callee);
84
- }));
85
- function next() {
86
- return _next2.apply(this, arguments);
87
+ return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.unselect.date')));
88
+ case 5:
89
+ if (isDateSelectedFirst) {
90
+ _context.next = 9;
91
+ break;
92
+ }
93
+ result = appointmentBooking.checkResourceListForDate();
94
+ if (result) {
95
+ _context.next = 9;
96
+ break;
97
+ }
98
+ return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.unuse.date')));
99
+ case 9:
100
+ nextStep();
101
+ case 10:
102
+ case "end":
103
+ return _context.stop();
87
104
  }
88
- return next;
89
- }()
105
+ }, _callee);
106
+ }));
107
+ return function handleNext() {
108
+ return _ref.apply(this, arguments);
90
109
  };
91
- });
110
+ }();
92
111
  var weekListText = [locales.getText('pisell2.appointment.sunday'), locales.getText('pisell2.appointment.monday'), locales.getText('pisell2.appointment.tuesday'), locales.getText('pisell2.appointment.wednesday'), locales.getText('pisell2.appointment.thursday'), locales.getText('pisell2.appointment.friday'), locales.getText('pisell2.appointment.saturday')];
93
112
 
94
113
  // 计算开始渲染的列
@@ -101,7 +120,7 @@ var Date = /*#__PURE__*/forwardRef(function (props, ref) {
101
120
  useEffect(function () {
102
121
  // 设置当前显示的月份
103
122
  var getCurrentMonthData = /*#__PURE__*/function () {
104
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
123
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
105
124
  var _data$;
106
125
  var data;
107
126
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -119,11 +138,16 @@ var Date = /*#__PURE__*/forwardRef(function (props, ref) {
119
138
  }, _callee2);
120
139
  }));
121
140
  return function getCurrentMonthData() {
122
- return _ref.apply(this, arguments);
141
+ return _ref2.apply(this, arguments);
123
142
  };
124
143
  }();
125
144
  getCurrentMonthData();
126
145
  }, []);
146
+ var locale = useMemo(function () {
147
+ var _context$engine;
148
+ var currentLocale = context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale;
149
+ return localeTypes[currentLocale] || 'en';
150
+ }, [context === null || context === void 0 || (_context$engine2 = context.engine) === null || _context$engine2 === void 0 || (_context$engine2 = _context$engine2.props) === null || _context$engine2 === void 0 ? void 0 : _context$engine2.locale]);
127
151
 
128
152
  /**
129
153
  * @title: 获取当前月日期
@@ -180,7 +204,7 @@ var Date = /*#__PURE__*/forwardRef(function (props, ref) {
180
204
  * @Date: 2025-04-24 18:31
181
205
  */
182
206
  var getDateData = /*#__PURE__*/function () {
183
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
207
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
184
208
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
185
209
  while (1) switch (_context3.prev = _context3.next) {
186
210
  case 0:
@@ -206,11 +230,11 @@ var Date = /*#__PURE__*/forwardRef(function (props, ref) {
206
230
  }, _callee3);
207
231
  }));
208
232
  return function getDateData(_x) {
209
- return _ref2.apply(this, arguments);
233
+ return _ref3.apply(this, arguments);
210
234
  };
211
235
  }();
212
236
  var getDates = /*#__PURE__*/function () {
213
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(date) {
237
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(date) {
214
238
  var startDate, endDate, params, data, selected, _selected$, firstAvailableDate, baseMonthData, updatedDates;
215
239
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
216
240
  while (1) switch (_context4.prev = _context4.next) {
@@ -279,7 +303,7 @@ var Date = /*#__PURE__*/forwardRef(function (props, ref) {
279
303
  }, _callee4, null, [[0, 18]]);
280
304
  }));
281
305
  return function getDates(_x2) {
282
- return _ref3.apply(this, arguments);
306
+ return _ref4.apply(this, arguments);
283
307
  };
284
308
  }();
285
309
  useEffect(function () {
@@ -332,7 +356,7 @@ var Date = /*#__PURE__*/forwardRef(function (props, ref) {
332
356
 
333
357
  // 先选择日期,则点击某一天后,则进入下一步
334
358
  if (isDateSelectedFirst) {
335
- appointmentBooking.next();
359
+ handleNext();
336
360
  }
337
361
  };
338
362
  return /*#__PURE__*/React.createElement("div", {
@@ -353,7 +377,7 @@ var Date = /*#__PURE__*/forwardRef(function (props, ref) {
353
377
  }
354
378
  }, /*#__PURE__*/React.createElement(CaretLeftOutlined, null)), /*#__PURE__*/React.createElement("div", {
355
379
  className: 'calendar-current-month'
356
- }, currentMonth === null || currentMonth === void 0 ? void 0 : currentMonth.format('MMMM YYYY')), /*#__PURE__*/React.createElement("div", {
380
+ }, (_Dayjs$locale = Dayjs(currentMonth).locale(locale)) === null || _Dayjs$locale === void 0 ? void 0 : _Dayjs$locale.format('MMMM YYYY')), /*#__PURE__*/React.createElement("div", {
357
381
  className: 'calendar-next-month',
358
382
  onClick: nextMonth
359
383
  }, /*#__PURE__*/React.createElement(CaretRightOutlined, null))), /*#__PURE__*/React.createElement("div", {
@@ -215,4 +215,9 @@ export var getCallToBookStatus = function getCallToBookStatus(currentDate, dateL
215
215
  // 判断开始时间和结束时间是否大于1天
216
216
  }
217
217
  return isShowCallToBook;
218
+ };
219
+ export var localeTypes = {
220
+ 'en-US': 'en',
221
+ 'zh-CN': 'zh-cn',
222
+ 'zh-TW': 'zh-tw'
218
223
  };
@@ -14,7 +14,7 @@ import React, { useMemo, useRef, useState, useImperativeHandle, forwardRef, useE
14
14
  import useComponents from "../../../../hooks/useComponents";
15
15
  import { formatForms, formatCarts, updateLists, updateBookingFormStorage } from "../../utils";
16
16
  import { useAppointmentBookingContext } from "../../context";
17
- import { useAppointmentBookingResource, useAppointmentBookingSetting } from "../../hooks";
17
+ import { useAppointmentBookingResource, useAppointmentBookingSetting, useAppointmentBookingStep } from "../../hooks";
18
18
  import PolicyModal from "../../deposit/components/PolicyModal";
19
19
  import "./index.less";
20
20
  var Form = /*#__PURE__*/forwardRef(function (props, ref) {
@@ -52,6 +52,8 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
52
52
  var _useAppointmentBookin3 = useAppointmentBookingSetting(),
53
53
  setOtherData = _useAppointmentBookin3.setOtherData,
54
54
  getOtherData = _useAppointmentBookin3.getOtherData;
55
+ var _useAppointmentBookin4 = useAppointmentBookingStep(),
56
+ nextStep = _useAppointmentBookin4.nextStep;
55
57
  useImperativeHandle(ref, function () {
56
58
  return {
57
59
  next: function next() {
@@ -120,7 +122,7 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
120
122
  setLoading(false);
121
123
  }
122
124
  } else {
123
- appointmentBooking.next();
125
+ nextStep();
124
126
  }
125
127
  };
126
128
 
@@ -229,11 +231,17 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
229
231
  }, [currentFormIndex, formId]);
230
232
  return /*#__PURE__*/React.createElement(React.Fragment, null, formCom, showAgreement ? /*#__PURE__*/React.createElement(PolicyModal, {
231
233
  open: showAgreement,
232
- onCancel: handleAgreementOk,
234
+ onCancel: function onCancel() {
235
+ return setShowAgreement(false);
236
+ },
237
+ onConfirm: function onConfirm() {
238
+ return handleAgreementOk();
239
+ },
233
240
  item: agreementContent,
234
241
  onChange: function onChange() {
235
242
  return setLoading(false);
236
- }
243
+ },
244
+ isHideCheckout: false
237
245
  }) : null);
238
246
  });
239
247
  export default Form;
@@ -10,7 +10,7 @@ import { Button, Iconfont, PisellCard, PisellAvatar, PisellToast } from '@pisell
10
10
  import { locales, isMobile, getUniqueId } from '@pisell/utils';
11
11
  import InformationOptionsModal from "./components/InformationOptionsModal";
12
12
  import { useAppointmentBookingContext } from "../../context";
13
- import { useAppointmentBookingAccount } from "../../hooks";
13
+ import { useAppointmentBookingAccount, useAppointmentBookingStep } from "../../hooks";
14
14
  import { formatGuest } from "../../utils";
15
15
  import "./index.less";
16
16
  var Guest = /*#__PURE__*/forwardRef(function (props, ref) {
@@ -28,10 +28,12 @@ var Guest = /*#__PURE__*/forwardRef(function (props, ref) {
28
28
  appointmentBooking = _useAppointmentBookin.appointmentBooking;
29
29
  var _useAppointmentBookin2 = useAppointmentBookingAccount(),
30
30
  accountLists = _useAppointmentBookin2.accountLists;
31
+ var _useAppointmentBookin3 = useAppointmentBookingStep(),
32
+ nextStep = _useAppointmentBookin3.nextStep;
31
33
  useImperativeHandle(ref, function () {
32
34
  return {
33
35
  next: function next() {
34
- appointmentBooking.next();
36
+ nextStep();
35
37
  }
36
38
  };
37
39
  });
@@ -37,7 +37,8 @@ var Resource = /*#__PURE__*/forwardRef(function (props, ref) {
37
37
  setCarts = _useAppointmentBookin.setCarts,
38
38
  currentStep = _useAppointmentBookin.currentStep,
39
39
  setResourceOtherParams = _useAppointmentBookin.setResourceOtherParams,
40
- setIsErrorHolder = _useAppointmentBookin.setIsErrorHolder;
40
+ setIsErrorHolder = _useAppointmentBookin.setIsErrorHolder,
41
+ setPolicyIds = _useAppointmentBookin.setPolicyIds;
41
42
  var _useAppointmentBookin2 = useAppointmentBookingResource(),
42
43
  getResourceList = _useAppointmentBookin2.getResourceList,
43
44
  autoSelectAllProductResources = _useAppointmentBookin2.autoSelectAllProductResources,
@@ -45,7 +46,8 @@ var Resource = /*#__PURE__*/forwardRef(function (props, ref) {
45
46
  var _useIsSkipResourceSte = useIsSkipResourceStep(),
46
47
  checkSkipResourceStep = _useIsSkipResourceSte.checkSkipResourceStep;
47
48
  var _useAppointmentBookin3 = useAppointmentBookingStep(),
48
- updateStep = _useAppointmentBookin3.updateStep;
49
+ updateStep = _useAppointmentBookin3.updateStep,
50
+ nextStep = _useAppointmentBookin3.nextStep;
49
51
  var _useAppointmentBookin4 = useAppointmentBookingLogin(),
50
52
  openLoginModal = _useAppointmentBookin4.openLoginModal,
51
53
  isLogin = _useAppointmentBookin4.isLogin;
@@ -81,13 +83,14 @@ var Resource = /*#__PURE__*/forwardRef(function (props, ref) {
81
83
  scrollToFirstErrorCard();
82
84
  return _context.abrupt("return");
83
85
  case 6:
84
- resultCarts = formatCartsResources(carts, resources);
86
+ resultCarts = formatCartsResources(carts, resources, setPolicyIds);
85
87
  stepList = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s = appointmentBooking.store) === null || _appointmentBooking$s === void 0 || (_appointmentBooking$s = _appointmentBooking$s.step) === null || _appointmentBooking$s === void 0 || (_appointmentBooking$s = _appointmentBooking$s.store) === null || _appointmentBooking$s === void 0 ? void 0 : _appointmentBooking$s.stepList) || [];
86
88
  _context.next = 10;
87
89
  return appointmentBooking.getAccounts();
88
90
  case 10:
89
91
  accountLists = _context.sent;
90
92
  checkResult = checkHasFormStep({
93
+ nextStep: nextStep,
91
94
  hasResourceFormId: (resultCarts === null || resultCarts === void 0 ? void 0 : resultCarts.length) > 0,
92
95
  currentStep: currentStep,
93
96
  stepList: stepList,
@@ -117,7 +120,7 @@ var Resource = /*#__PURE__*/forwardRef(function (props, ref) {
117
120
 
118
121
  // 获取时间切片
119
122
  getResourceTimeSlot();
120
- appointmentBooking.next();
123
+ nextStep();
121
124
  case 17:
122
125
  case "end":
123
126
  return _context.stop();
@@ -33,7 +33,8 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
33
33
  getProducts = _useAppointmentBookin2.getProducts,
34
34
  checkProductType = _useAppointmentBookin2.checkProductType;
35
35
  var _useAppointmentBookin3 = useAppointmentBookingStep(),
36
- removeStep = _useAppointmentBookin3.removeStep;
36
+ removeStep = _useAppointmentBookin3.removeStep,
37
+ nextStep = _useAppointmentBookin3.nextStep;
37
38
  var _useAppointmentBookin4 = useAppointmentBookingContext(),
38
39
  currentStep = _useAppointmentBookin4.currentStep;
39
40
  var _useState = useState(null),
@@ -47,7 +48,7 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
47
48
  useImperativeHandle(ref, function () {
48
49
  return {
49
50
  next: function next() {
50
- appointmentBooking.next();
51
+ nextStep();
51
52
  }
52
53
  };
53
54
  });
@@ -12,7 +12,7 @@ import React, { useEffect, useState, forwardRef, useImperativeHandle } from 'rea
12
12
  import { Iconfont, PisellEmpty } from '@pisell/materials';
13
13
  import { locales } from '@pisell/utils';
14
14
  import { useAppointmentBookingContext } from "../../context";
15
- import { useAppointmentBookingResource } from "../../hooks";
15
+ import { useAppointmentBookingResource, useAppointmentBookingStep } from "../../hooks";
16
16
  import { Toast } from "../../utils";
17
17
  import "./index.less";
18
18
  var TimeSlicing = /*#__PURE__*/forwardRef(function (props, ref) {
@@ -29,6 +29,8 @@ var TimeSlicing = /*#__PURE__*/forwardRef(function (props, ref) {
29
29
  var _useAppointmentBookin2 = useAppointmentBookingResource(),
30
30
  getResourceTimeSlot = _useAppointmentBookin2.getResourceTimeSlot,
31
31
  getResourceList = _useAppointmentBookin2.getResourceList;
32
+ var _useAppointmentBookin3 = useAppointmentBookingStep(),
33
+ nextStep = _useAppointmentBookin3.nextStep;
32
34
  useImperativeHandle(ref, function () {
33
35
  return {
34
36
  next: function next() {
@@ -37,7 +39,7 @@ var TimeSlicing = /*#__PURE__*/forwardRef(function (props, ref) {
37
39
  Toast(locales.getText('pisell2.appointment.unselect.time'));
38
40
  return;
39
41
  }
40
- appointmentBooking.next();
42
+ nextStep();
41
43
  }
42
44
  };
43
45
  });
@@ -4,7 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  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; }
5
5
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import React, { createContext, useContext, useState, useEffect, useMemo } from 'react';
7
+ import React, { createContext, useContext, useState, useEffect, useMemo, useRef } from 'react';
8
8
  import { useAppointmentBooking } from "./hooks";
9
9
  import useEngineContext from "../../hooks/useEngineContext";
10
10
  import { TasksManager } from "../../utils/tasks";
@@ -12,6 +12,7 @@ var AppointmentBookingContext = /*#__PURE__*/createContext(undefined);
12
12
  export var AppointmentBookingProvider = function AppointmentBookingProvider(_ref) {
13
13
  var _appHelper$utils, _currentStep$step2, _appointmentBooking$s;
14
14
  var children = _ref.children;
15
+ var policyIdsRef = useRef([]);
15
16
  var appointmentBooking = useAppointmentBooking();
16
17
  // 总计计算
17
18
  var _useState = useState({}),
@@ -76,6 +77,54 @@ export var AppointmentBookingProvider = function AppointmentBookingProvider(_ref
76
77
  setCurrentStep(currentStep);
77
78
  }, []);
78
79
 
80
+ /**
81
+ * @title: 设置协议数据
82
+ * @description:
83
+ * @param {any} ids
84
+ * @return {*}
85
+ * @Author: WangHan
86
+ * @Date: 2025-05-12 21:55
87
+ */
88
+ var setPolicyIds = function setPolicyIds(ids) {
89
+ policyIdsRef.current = ids;
90
+ };
91
+
92
+ /**
93
+ * @title: 打开协议
94
+ * @description:
95
+ * @param {any} content
96
+ * @param {any} callback
97
+ * @return {*}
98
+ * @Author: WangHan
99
+ * @Date: 2025-05-12 17:56
100
+ */
101
+ var openPolicy = function openPolicy(content, callback) {
102
+ setPolicyParams({
103
+ open: true,
104
+ content: content,
105
+ callback: callback,
106
+ _ts: Date.now()
107
+ });
108
+ };
109
+
110
+ /**
111
+ * @title: 关闭协议
112
+ * @description:
113
+ * @return {*}
114
+ * @Author: WangHan
115
+ * @Date: 2025-05-12 17:57
116
+ */
117
+ var closePolicy = function closePolicy(isCallback) {
118
+ setPolicyParams({
119
+ open: false,
120
+ content: {},
121
+ callback: null
122
+ });
123
+ if (policyParams !== null && policyParams !== void 0 && policyParams.callback && isCallback) {
124
+ policyParams.callback();
125
+ }
126
+ };
127
+
79
128
  /**
80
129
  * @title: 是否是最后一步
81
130
  * @description:
@@ -118,16 +167,24 @@ export var AppointmentBookingProvider = function AppointmentBookingProvider(_ref
118
167
  isLastStep: isLastStep,
119
168
  tasksManager: tasksManager,
120
169
  policyParams: policyParams,
121
- setPolicyParams: setPolicyParams
170
+ setPolicyParams: setPolicyParams,
171
+ policyIdsRef: policyIdsRef,
172
+ setPolicyIds: setPolicyIds,
173
+ openPolicy: openPolicy,
174
+ closePolicy: closePolicy
122
175
  };
123
176
  return /*#__PURE__*/React.createElement(AppointmentBookingContext.Provider, {
124
177
  value: value
125
178
  }, children);
126
179
  };
127
180
  export var useAppointmentBookingContext = function useAppointmentBookingContext() {
128
- var context = useContext(AppointmentBookingContext);
129
- if (context === undefined) {
130
- throw new Error('useAppointmentBookingContext must be used within a AppointmentBookingProvider');
181
+ try {
182
+ var context = useContext(AppointmentBookingContext);
183
+ if (context === undefined) {
184
+ throw new Error('useAppointmentBookingContext must be used within a AppointmentBookingProvider');
185
+ }
186
+ return context;
187
+ } catch (error) {
188
+ console.log(error, 'useAppointmentBookingContext');
131
189
  }
132
- return context;
133
190
  };
@@ -10,7 +10,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import React, { useState, useEffect } from 'react';
12
12
  import { Spin } from 'antd';
13
- import { PisellModal, PisellEmpty } from '@pisell/materials';
13
+ import { PisellModal, PisellEmpty, Button, Checkbox } from '@pisell/materials';
14
14
  import { locales, isMobile } from '@pisell/utils';
15
15
  import { useAppointmentBookingContext } from "../../../context";
16
16
  import "./index.less";
@@ -18,7 +18,10 @@ var DepositModal = function DepositModal(props) {
18
18
  var open = props.open,
19
19
  onCancel = props.onCancel,
20
20
  item = props.item,
21
- onChange = props.onChange;
21
+ onChange = props.onChange,
22
+ onConfirm = props.onConfirm,
23
+ _props$isHideCheckout = props.isHideCheckout,
24
+ isHideCheckout = _props$isHideCheckout === void 0 ? true : _props$isHideCheckout;
22
25
  var _useAppointmentBookin = useAppointmentBookingContext(),
23
26
  appointmentBooking = _useAppointmentBookin.appointmentBooking;
24
27
  var _useState = useState(null),
@@ -29,6 +32,13 @@ var DepositModal = function DepositModal(props) {
29
32
  _useState4 = _slicedToArray(_useState3, 2),
30
33
  loading = _useState4[0],
31
34
  setLoading = _useState4[1];
35
+ var _useState5 = useState(false),
36
+ _useState6 = _slicedToArray(_useState5, 2),
37
+ disabled = _useState6[0],
38
+ setDisabled = _useState6[1];
39
+ useEffect(function () {
40
+ setDisabled(!isHideCheckout);
41
+ }, [isHideCheckout]);
32
42
 
33
43
  /**
34
44
  * @title: 获取协议内容
@@ -52,23 +62,24 @@ var DepositModal = function DepositModal(props) {
52
62
  _yield$appointmentBoo = _context.sent;
53
63
  data = _yield$appointmentBoo.data;
54
64
  setPolicy(data);
55
- onChange(data);
56
- _context.next = 14;
65
+ onChange && onChange(data);
66
+ _context.next = 15;
57
67
  break;
58
68
  case 10:
59
69
  _context.prev = 10;
60
70
  _context.t0 = _context["catch"](1);
61
71
  console.log(_context.t0);
62
- onChange(_context.t0);
63
- case 14:
64
- _context.prev = 14;
72
+ onChange && onChange(_context.t0);
73
+ debugger;
74
+ case 15:
75
+ _context.prev = 15;
65
76
  setLoading(false);
66
- return _context.finish(14);
67
- case 17:
77
+ return _context.finish(15);
78
+ case 18:
68
79
  case "end":
69
80
  return _context.stop();
70
81
  }
71
- }, _callee, null, [[1, 10, 14, 17]]);
82
+ }, _callee, null, [[1, 10, 15, 18]]);
72
83
  }));
73
84
  return function getPolicy(_x) {
74
85
  return _ref.apply(this, arguments);
@@ -93,7 +104,20 @@ var DepositModal = function DepositModal(props) {
93
104
  className: 'policy-modal-wrap',
94
105
  cancelVisible: false,
95
106
  okText: locales.getText('pisell2.appointment.deposit.close'),
96
- onOk: onCancel
107
+ footer: [/*#__PURE__*/React.createElement("div", {
108
+ className: "policy-modal-footer"
109
+ }, !isHideCheckout ? /*#__PURE__*/React.createElement(Checkbox, {
110
+ className: "policy-modal-checkbox",
111
+ onChange: function onChange(e) {
112
+ var _e$target;
113
+ return setDisabled(!((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.checked));
114
+ }
115
+ }, locales.getText('pisell2.appointment.policy')) : null, /*#__PURE__*/React.createElement(Button, {
116
+ type: "primary",
117
+ size: "large",
118
+ onClick: isHideCheckout ? onCancel : onConfirm,
119
+ disabled: disabled
120
+ }, locales.getText(isHideCheckout ? 'pisell2.appointment.deposit.close' : 'pisell2.appointment.policy.confirm')))]
97
121
  }, /*#__PURE__*/React.createElement(Spin, {
98
122
  style: {
99
123
  minHeight: '200px'
@@ -6,4 +6,13 @@
6
6
  .ant-empty-image {
7
7
  height: auto !important;
8
8
  }
9
+
10
+ .policy-modal-footer {
11
+ display: flex;
12
+ flex-direction: column;
13
+ flex: 1;
14
+ .policy-modal-checkbox {
15
+ margin-bottom: 20px;
16
+ }
17
+ }
9
18
  }