@pisell/private-materials 3.3.19 → 3.3.20

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 (59) 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.d.ts +1 -0
  13. package/es/components/appointmentBooking/components/Date/state.js +5 -0
  14. package/es/components/appointmentBooking/components/Form/index.js +12 -4
  15. package/es/components/appointmentBooking/components/Guest/index.js +4 -2
  16. package/es/components/appointmentBooking/components/Resource/index.js +7 -4
  17. package/es/components/appointmentBooking/components/Services/index.js +3 -2
  18. package/es/components/appointmentBooking/components/TimeSlicing/index.js +4 -2
  19. package/es/components/appointmentBooking/context.d.ts +3 -1
  20. package/es/components/appointmentBooking/context.js +63 -6
  21. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.js +35 -11
  22. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.less +9 -0
  23. package/es/components/appointmentBooking/hooks.d.ts +1 -0
  24. package/es/components/appointmentBooking/hooks.js +48 -8
  25. package/es/components/appointmentBooking/index.d.ts +0 -1
  26. package/es/components/appointmentBooking/locales.d.ts +6 -0
  27. package/es/components/appointmentBooking/locales.js +6 -0
  28. package/es/components/appointmentBooking/utils.d.ts +2 -2
  29. package/es/components/appointmentBooking/utils.js +10 -4
  30. package/es/components/booking/components/footer/index.d.ts +1 -0
  31. package/es/components/booking/deposit/index.d.ts +0 -1
  32. package/es/components/booking/deposit/index.js +1 -1
  33. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  34. package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +1 -0
  35. package/lib/components/appointmentBooking/components/Content/index.js +11 -11
  36. package/lib/components/appointmentBooking/components/Date/index.js +29 -12
  37. package/lib/components/appointmentBooking/components/Date/state.d.ts +1 -0
  38. package/lib/components/appointmentBooking/components/Date/state.js +7 -0
  39. package/lib/components/appointmentBooking/components/Form/index.js +6 -3
  40. package/lib/components/appointmentBooking/components/Guest/index.js +2 -1
  41. package/lib/components/appointmentBooking/components/Resource/index.js +6 -4
  42. package/lib/components/appointmentBooking/components/Services/index.js +2 -2
  43. package/lib/components/appointmentBooking/components/TimeSlicing/index.js +2 -1
  44. package/lib/components/appointmentBooking/context.d.ts +3 -1
  45. package/lib/components/appointmentBooking/context.js +28 -7
  46. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.js +39 -4
  47. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.less +9 -0
  48. package/lib/components/appointmentBooking/hooks.d.ts +1 -0
  49. package/lib/components/appointmentBooking/hooks.js +29 -5
  50. package/lib/components/appointmentBooking/index.d.ts +0 -1
  51. package/lib/components/appointmentBooking/locales.d.ts +6 -0
  52. package/lib/components/appointmentBooking/locales.js +6 -0
  53. package/lib/components/appointmentBooking/utils.d.ts +2 -2
  54. package/lib/components/appointmentBooking/utils.js +8 -4
  55. package/lib/components/booking/components/footer/index.d.ts +1 -0
  56. package/lib/components/booking/deposit/index.d.ts +0 -1
  57. package/lib/components/booking/deposit/index.js +1 -1
  58. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  59. package/package.json +4 -4
@@ -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
  }
@@ -14,6 +14,7 @@ export declare const useAppointmentBookingStep: () => {
14
14
  removeStep: (key: string) => any;
15
15
  addStep: (props: any, stepKey?: string) => any;
16
16
  updateStep: (key: string, step: any) => void;
17
+ nextStep: () => void;
17
18
  };
18
19
  /**
19
20
  * @title: 获取商品数据
@@ -47,7 +47,9 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
47
47
  var pisellOS = usePisellOS();
48
48
  var _useAppointmentBookin = useAppointmentBookingContext(),
49
49
  appointmentBooking = _useAppointmentBookin.appointmentBooking,
50
- setCurrentStep = _useAppointmentBookin.setCurrentStep;
50
+ setCurrentStep = _useAppointmentBookin.setCurrentStep,
51
+ policyIdsRef = _useAppointmentBookin.policyIdsRef,
52
+ openPolicy = _useAppointmentBookin.openPolicy;
51
53
  var 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) || [];
52
54
 
53
55
  // 判断是否是最后一步
@@ -117,12 +119,46 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
117
119
  isSkip: (step === null || step === void 0 ? void 0 : step.isSkip) || false
118
120
  });
119
121
  };
122
+
123
+ // 下一步
124
+ var nextStep = function nextStep() {
125
+ var _appointmentBooking$s2;
126
+ var currentStep = appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.getCurrentStep();
127
+ var stepList = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s2 = appointmentBooking.store) === null || _appointmentBooking$s2 === void 0 || (_appointmentBooking$s2 = _appointmentBooking$s2.step) === null || _appointmentBooking$s2 === void 0 || (_appointmentBooking$s2 = _appointmentBooking$s2.store) === null || _appointmentBooking$s2 === void 0 ? void 0 : _appointmentBooking$s2.stepList) || [];
128
+
129
+ // 倒数第二步
130
+ if ((currentStep === null || currentStep === void 0 ? void 0 : currentStep.index) + 2 === (stepList === null || stepList === void 0 ? void 0 : stepList.length)) {
131
+ var _policyIdsRef$current;
132
+ // 如果没有同意资源上挂接的协议,则打开协议弹窗
133
+ if (policyIdsRef !== null && policyIdsRef !== void 0 && (_policyIdsRef$current = policyIdsRef.current) !== null && _policyIdsRef$current !== void 0 && _policyIdsRef$current.length) {
134
+ // 依次弹出所有协议
135
+ var idx = 0;
136
+ var showNextPolicy = function showNextPolicy() {
137
+ if (idx < policyIdsRef.current.length) {
138
+ openPolicy({
139
+ id: policyIdsRef.current[idx]
140
+ }, function () {
141
+ idx++;
142
+ showNextPolicy();
143
+ });
144
+ } else {
145
+ // 全部同意后,进入下一步
146
+ appointmentBooking.next();
147
+ }
148
+ };
149
+ showNextPolicy();
150
+ return;
151
+ }
152
+ }
153
+ appointmentBooking.next();
154
+ };
120
155
  return {
121
156
  getStepIndex: getStepIndex,
122
157
  stepList: stepList,
123
158
  removeStep: removeStep,
124
159
  addStep: addStep,
125
- updateStep: updateStep
160
+ updateStep: updateStep,
161
+ nextStep: nextStep
126
162
  };
127
163
  };
128
164
 
@@ -575,23 +611,26 @@ export var useAppointmentBookingResource = function useAppointmentBookingResourc
575
611
  * @Date: 2025-04-21 11:47
576
612
  */
577
613
  export var useIsSkipResourceStep = function useIsSkipResourceStep() {
578
- var _appointmentBooking$s2;
614
+ var _appointmentBooking$s3;
579
615
  var _useAppointmentBookin5 = useAppointmentBookingContext(),
580
616
  currentStep = _useAppointmentBookin5.currentStep,
581
- setCarts = _useAppointmentBookin5.setCarts;
617
+ setCarts = _useAppointmentBookin5.setCarts,
618
+ setPolicyIds = _useAppointmentBookin5.setPolicyIds;
582
619
  var _useAppointmentBookin6 = useAppointmentBookingResource(),
583
620
  getResourceList = _useAppointmentBookin6.getResourceList,
584
621
  autoSelectAllProductResources = _useAppointmentBookin6.autoSelectAllProductResources;
585
622
  var _useAppointmentBookin7 = useAppointmentBookingSetting(),
586
623
  isFormSubject = _useAppointmentBookin7.isFormSubject;
587
624
  var appointmentBooking = useAppointmentBooking();
588
- var stepList = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s2 = appointmentBooking.store) === null || _appointmentBooking$s2 === void 0 || (_appointmentBooking$s2 = _appointmentBooking$s2.step) === null || _appointmentBooking$s2 === void 0 || (_appointmentBooking$s2 = _appointmentBooking$s2.store) === null || _appointmentBooking$s2 === void 0 ? void 0 : _appointmentBooking$s2.stepList) || [];
625
+ var stepList = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s3 = appointmentBooking.store) === null || _appointmentBooking$s3 === void 0 || (_appointmentBooking$s3 = _appointmentBooking$s3.step) === null || _appointmentBooking$s3 === void 0 || (_appointmentBooking$s3 = _appointmentBooking$s3.store) === null || _appointmentBooking$s3 === void 0 ? void 0 : _appointmentBooking$s3.stepList) || [];
589
626
  var _useAppointmentBookin8 = useAppointmentBookingLogin(),
590
627
  isLogin = _useAppointmentBookin8.isLogin,
591
628
  openLoginModal = _useAppointmentBookin8.openLoginModal;
592
629
  var _useAppointmentBookin9 = useAppointmentBookingAccount(),
593
630
  getHolders = _useAppointmentBookin9.getHolders,
594
631
  checkAccount = _useAppointmentBookin9.checkAccount;
632
+ var _useAppointmentBookin10 = useAppointmentBookingStep(),
633
+ nextStep = _useAppointmentBookin10.nextStep;
595
634
  var utils = contextUtils();
596
635
  var checkSkipResourceStep = /*#__PURE__*/function () {
597
636
  var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(isSkipUpdateFormStep) {
@@ -622,8 +661,9 @@ export var useIsSkipResourceStep = function useIsSkipResourceStep() {
622
661
  break;
623
662
  }
624
663
  if (!isSkipUpdateFormStep) {
625
- resultCarts = formatCartsResources(carts, resources); // 如果当前资源有表单,则添加表单步骤,否则删除表单步骤
664
+ resultCarts = formatCartsResources(carts, resources, setPolicyIds); // 如果当前资源有表单,则添加表单步骤,否则删除表单步骤
626
665
  checkHasFormStep({
666
+ nextStep: nextStep,
627
667
  isSkip: true,
628
668
  openLoginModal: openLoginModal,
629
669
  utils: utils,
@@ -683,8 +723,8 @@ export var useIsSkipResourceStep = function useIsSkipResourceStep() {
683
723
  export var useAppointmentBookingSetting = function useAppointmentBookingSetting() {
684
724
  var _appointmentBooking$o3;
685
725
  var utils = contextUtils();
686
- var _useAppointmentBookin10 = useAppointmentBookingContext(),
687
- appointmentBooking = _useAppointmentBookin10.appointmentBooking;
726
+ var _useAppointmentBookin11 = useAppointmentBookingContext(),
727
+ appointmentBooking = _useAppointmentBookin11.appointmentBooking;
688
728
  var _ref21 = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o3 = appointmentBooking.otherParams) === null || _appointmentBooking$o3 === void 0 ? void 0 : _appointmentBooking$o3.productModuleParams) || {},
689
729
  bookingProcess = _ref21.bookingProcess,
690
730
  bookingSubject = _ref21.bookingSubject,
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const AppointmentBooking: () => JSX.Element;
4
3
  export default AppointmentBooking;
@@ -104,6 +104,8 @@ declare const _default: {
104
104
  'pisell2.appointment.unselect.date': string;
105
105
  'pisell2.appointment.unuse.date': string;
106
106
  'pisell2.appointment.add-guests': string;
107
+ 'pisell2.appointment.policy': string;
108
+ 'pisell2.appointment.policy.confirm': string;
107
109
  'pisell2.text.apply': string;
108
110
  'pisell2.text.goodpass': string;
109
111
  'pisell2.text.goodpass.product-vouchers': string;
@@ -219,6 +221,8 @@ declare const _default: {
219
221
  'pisell2.appointment.unselect.date': string;
220
222
  'pisell2.appointment.unuse.date': string;
221
223
  'pisell2.appointment.add-guests': string;
224
+ 'pisell2.appointment.policy': string;
225
+ 'pisell2.appointment.policy.confirm': string;
222
226
  'pisell2.text.apply': string;
223
227
  'pisell2.text.goodpass': string;
224
228
  'pisell2.text.goodpass.product-vouchers': string;
@@ -334,6 +338,8 @@ declare const _default: {
334
338
  'pisell2.appointment.unselect.date': string;
335
339
  'pisell2.appointment.unuse.date': string;
336
340
  'pisell2.appointment.add-guests': string;
341
+ 'pisell2.appointment.policy': string;
342
+ 'pisell2.appointment.policy.confirm': string;
337
343
  'pisell2.text.apply': string;
338
344
  'pisell2.text.goodpass': string;
339
345
  'pisell2.text.goodpass.product-vouchers': string;
@@ -120,6 +120,8 @@ export default {
120
120
  'pisell2.appointment.unselect.date': 'Please select date',
121
121
  'pisell2.appointment.unuse.date': 'This date is not available, please change the date.',
122
122
  'pisell2.appointment.add-guests': 'Add guests',
123
+ 'pisell2.appointment.policy': 'You have read and agreed to this policy',
124
+ 'pisell2.appointment.policy.confirm': 'Confirm',
123
125
  'pisell2.text.apply': 'Apply',
124
126
  'pisell2.text.goodpass': 'GoodPass',
125
127
  'pisell2.text.goodpass.product-vouchers': 'Product Vouchers',
@@ -251,6 +253,8 @@ export default {
251
253
  'pisell2.appointment.unselect.date': '请选择日期',
252
254
  'pisell2.appointment.unuse.date': '此日期不可用,请更换日期。',
253
255
  'pisell2.appointment.add-guests': '添加预约人',
256
+ 'pisell2.appointment.policy': '您已仔细阅读并同意此协议',
257
+ 'pisell2.appointment.policy.confirm': '确定',
254
258
  'pisell2.text.apply': '应用',
255
259
  'pisell2.text.goodpass': '商品券',
256
260
  'pisell2.text.goodpass.product-vouchers': '商品兑换券',
@@ -382,6 +386,8 @@ export default {
382
386
  'pisell2.appointment.unselect.date': '請選擇日期',
383
387
  'pisell2.appointment.unuse.date': '此日期不可用,請更換日期。',
384
388
  'pisell2.appointment.add-guests': '添加預約人',
389
+ 'pisell2.appointment.policy': '您已仔細閱讀並同意此協議',
390
+ 'pisell2.appointment.policy.confirm': '確定',
385
391
  'pisell2.text.apply': '應用',
386
392
  'pisell2.text.goodpass': '商品券',
387
393
  'pisell2.text.goodpass.product-vouchers': '商品兌換券',
@@ -17,7 +17,7 @@ export declare const formatGuest: (data: any[], products: any) => any[];
17
17
  * @Author: WangHan
18
18
  * @Date: 2025-05-06 22:22
19
19
  */
20
- export declare const formatCartsResources: (carts: any[], resources: any[]) => any[];
20
+ export declare const formatCartsResources: (carts: any[], resources: any[], setPolicyIds: any) => any[];
21
21
  /**
22
22
  * @title: 格式化购物车数据
23
23
  * @description:
@@ -111,4 +111,4 @@ export declare const Toast: (text: string) => void;
111
111
  * @Author: WangHan
112
112
  * @Date: 2025-05-06 21:51
113
113
  */
114
- export declare const checkHasFormStep: ({ isSkip, checkHolder, checkAccount, carts, setCarts, hasResourceFormId, currentStep, stepList, appointmentBooking, locales, isLogin, openLoginModal, isFormSubject, utils, accountLists, getHolders }: any) => true | undefined;
114
+ export declare const checkHasFormStep: ({ nextStep, isSkip, checkHolder, checkAccount, carts, setCarts, hasResourceFormId, currentStep, stepList, appointmentBooking, locales, isLogin, openLoginModal, isFormSubject, utils, accountLists, getHolders }: any) => true | undefined;
@@ -57,8 +57,9 @@ export var formatGuest = function formatGuest(data, products) {
57
57
  * @Author: WangHan
58
58
  * @Date: 2025-05-06 22:22
59
59
  */
60
- export var formatCartsResources = function formatCartsResources(carts, resources) {
60
+ export var formatCartsResources = function formatCartsResources(carts, resources, setPolicyIds) {
61
61
  try {
62
+ var policyIds = [];
62
63
  var newCarts = carts === null || carts === void 0 ? void 0 : carts.map(function (d) {
63
64
  var _currentResource$reso;
64
65
  var currentResource = resources === null || resources === void 0 ? void 0 : resources.find(function (r) {
@@ -77,9 +78,13 @@ export var formatCartsResources = function formatCartsResources(carts, resources
77
78
  return _objectSpread(_objectSpread({}, d), {}, {
78
79
  resource_form_id: foundResource === null || foundResource === void 0 ? void 0 : foundResource.resource_form_id
79
80
  });
81
+ } else if (foundResource !== null && foundResource !== void 0 && foundResource.policy_id && !policyIds.includes(foundResource === null || foundResource === void 0 ? void 0 : foundResource.policy_id)) {
82
+ // 资源上没有挂接表单,但是有协议,则在触发按钮的时候需要同意协议才能继续
83
+ policyIds.push(foundResource === null || foundResource === void 0 ? void 0 : foundResource.policy_id);
80
84
  }
81
85
  return false;
82
86
  }).filter(Boolean);
87
+ setPolicyIds(policyIds);
83
88
  return newCarts || [];
84
89
  } catch (error) {
85
90
  console.log(error, 'formatCarts');
@@ -371,7 +376,8 @@ export var Toast = function Toast(text) {
371
376
  */
372
377
  export var checkHasFormStep = function checkHasFormStep(_ref2) {
373
378
  var _appointmentBooking$s;
374
- var isSkip = _ref2.isSkip,
379
+ var nextStep = _ref2.nextStep,
380
+ isSkip = _ref2.isSkip,
375
381
  checkHolder = _ref2.checkHolder,
376
382
  checkAccount = _ref2.checkAccount,
377
383
  carts = _ref2.carts,
@@ -453,14 +459,14 @@ export var checkHasFormStep = function checkHasFormStep(_ref2) {
453
459
  isNext = true;
454
460
  }
455
461
  if (isNext && !_checkHolder()) {
456
- appointmentBooking.next();
462
+ nextStep();
457
463
  } else {
458
464
  return true;
459
465
  }
460
466
  } else {
461
467
  // 如果只有一个资源执行跳过
462
468
  if (isSkip) {
463
- appointmentBooking.next();
469
+ nextStep();
464
470
  }
465
471
  }
466
472
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  /**
3
4
  * @title: 底部
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const Deposit: (props: any) => JSX.Element;
3
2
  export default Deposit;
@@ -97,7 +97,7 @@ var Deposit = function Deposit(props) {
97
97
  }, [globalState]);
98
98
  var depositList = useMemo(function () {
99
99
  if (!bookingId) return [];
100
- if (Number(bookingDetail === null || bookingDetail === void 0 ? void 0 : bookingDetail.deposit_amount) === 0) return [];
100
+ if ((bookingDetail === null || bookingDetail === void 0 ? void 0 : bookingDetail.is_deposit) === 0) return [];
101
101
  return [{
102
102
  customer: bookingDetail === null || bookingDetail === void 0 ? void 0 : bookingDetail.customer,
103
103
  status: bookingDetail === null || bookingDetail === void 0 ? void 0 : bookingDetail.deposit_payment_status,
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const TicketBooking: () => JSX.Element;
3
4
  export default TicketBooking;
@@ -95,6 +95,7 @@ var ConfirmInformation = (0, import_react.forwardRef)((props, ref) => {
95
95
  }
96
96
  }
97
97
  } catch (error) {
98
+ (0, import_utils2.Toast)((error == null ? void 0 : error.message) || "");
98
99
  setTimeout(() => {
99
100
  setLoading(false);
100
101
  }, 50);
@@ -58,15 +58,15 @@ var Layout = () => {
58
58
  resourceOtherParams,
59
59
  setIsAgreeDepositPolicy,
60
60
  appointmentBooking,
61
- setLoading
61
+ setLoading,
62
+ policyParams,
63
+ closePolicy
62
64
  } = (0, import_context.useAppointmentBookingContext)();
63
65
  const { getLoadAllSchedule, isDateSelectedFirst, isFormSubject } = (0, import_hooks.useAppointmentBookingSetting)();
64
66
  const { isLogin } = (0, import_hooks.useAppointmentBookingLogin)();
65
67
  const { getHolders } = (0, import_hooks.useAppointmentBookingAccount)();
66
68
  const { removeStep, stepList } = (0, import_hooks.useAppointmentBookingStep)();
67
69
  const { shopDiscount } = (0, import_hooks.useShopDiscount)();
68
- const [showAgreement, setShowAgreement] = (0, import_react.useState)(false);
69
- const [agreementContent, setAgreementContent] = (0, import_react.useState)({});
70
70
  (0, import_hooks.useAppointmentBookingCart)();
71
71
  (0, import_hooks.useAppointmentBookingStep)();
72
72
  const [params, setParams] = (0, import_react.useState)({});
@@ -172,9 +172,6 @@ var Layout = () => {
172
172
  if (isDateSelectedFirst && key === "select-date") return false;
173
173
  return key !== "confirm-information";
174
174
  }, [isDateSelectedFirst, (_e = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _e.key]);
175
- const handleAgreementOk = () => {
176
- setShowAgreement(false);
177
- };
178
175
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_Header.default, null), /* @__PURE__ */ import_react.default.createElement(
179
176
  "div",
180
177
  {
@@ -190,13 +187,16 @@ var Layout = () => {
190
187
  return (_b2 = (_a2 = stepRef == null ? void 0 : stepRef.current) == null ? void 0 : _a2.next) == null ? void 0 : _b2.call(_a2);
191
188
  }
192
189
  }
193
- ) : null, showAgreement ? /* @__PURE__ */ import_react.default.createElement(
190
+ ) : null, (policyParams == null ? void 0 : policyParams.open) ? /* @__PURE__ */ import_react.default.createElement(
194
191
  import_PolicyModal.default,
195
192
  {
196
- open: showAgreement,
197
- onCancel: handleAgreementOk,
198
- item: agreementContent,
199
- onChange: () => setLoading(false)
193
+ key: policyParams == null ? void 0 : policyParams._ts,
194
+ open: policyParams == null ? void 0 : policyParams.open,
195
+ onCancel: () => closePolicy(false),
196
+ onConfirm: () => closePolicy(true),
197
+ item: policyParams == null ? void 0 : policyParams.content,
198
+ onChange: () => setLoading(false),
199
+ isHideCheckout: false
200
200
  }
201
201
  ) : null);
202
202
  };
@@ -41,25 +41,37 @@ var import_utils = require("@pisell/utils");
41
41
  var import_icons = require("@ant-design/icons");
42
42
  var import_context = require("../../context");
43
43
  var import_utils2 = require("../../utils");
44
+ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
44
45
  var import_hooks = require("../../hooks");
46
+ var import_state = require("./state");
45
47
  var import_index = require("./index.less");
46
48
  import_dayjs.default.extend(import_isSameOrBefore.default);
47
49
  var Date = (0, import_react.forwardRef)((props, ref) => {
50
+ var _a, _b, _c;
48
51
  const [loading, setLoading] = (0, import_react.useState)(false);
49
52
  const [currentDate, setCurrentDate] = (0, import_react.useState)();
50
53
  const [dateMonthList, setDateMonthList] = (0, import_react.useState)([]);
51
54
  const [currentMonth, setCurrentMonth] = (0, import_react.useState)();
52
55
  const { appointmentBooking } = (0, import_context.useAppointmentBookingContext)();
53
56
  const { isDateSelectedFirst, customPageId, getLoadAllSchedule, channel } = (0, import_hooks.useAppointmentBookingSetting)();
57
+ const { nextStep } = (0, import_hooks.useAppointmentBookingStep)();
58
+ const context = (0, import_useEngineContext.default)();
54
59
  (0, import_react.useImperativeHandle)(ref, () => ({
55
- next: async () => {
56
- const data = await appointmentBooking.getDateRange();
57
- if (!(data == null ? void 0 : data.length)) {
58
- return (0, import_utils2.Toast)(import_utils.locales.getText("pisell2.appointment.unselect.date"));
60
+ next: handleNext
61
+ }));
62
+ const handleNext = async () => {
63
+ const data = await appointmentBooking.getDateRange();
64
+ if (!(data == null ? void 0 : data.length)) {
65
+ return (0, import_utils2.Toast)(import_utils.locales.getText("pisell2.appointment.unselect.date"));
66
+ }
67
+ if (!isDateSelectedFirst) {
68
+ const result = appointmentBooking.checkResourceListForDate();
69
+ if (!result) {
70
+ return (0, import_utils2.Toast)(import_utils.locales.getText("pisell2.appointment.unuse.date"));
59
71
  }
60
- appointmentBooking.next();
61
72
  }
62
- }));
73
+ nextStep();
74
+ };
63
75
  const weekListText = [
64
76
  import_utils.locales.getText("pisell2.appointment.sunday"),
65
77
  import_utils.locales.getText("pisell2.appointment.monday"),
@@ -76,12 +88,17 @@ var Date = (0, import_react.forwardRef)((props, ref) => {
76
88
  );
77
89
  (0, import_react.useEffect)(() => {
78
90
  const getCurrentMonthData = async () => {
79
- var _a;
91
+ var _a2;
80
92
  const data = await appointmentBooking.getDateRange();
81
- setCurrentMonth((0, import_dayjs.default)((_a = data == null ? void 0 : data[0]) == null ? void 0 : _a.date) || (0, import_dayjs.default)());
93
+ setCurrentMonth((0, import_dayjs.default)((_a2 = data == null ? void 0 : data[0]) == null ? void 0 : _a2.date) || (0, import_dayjs.default)());
82
94
  };
83
95
  getCurrentMonthData();
84
96
  }, []);
97
+ const locale = (0, import_react.useMemo)(() => {
98
+ var _a2, _b2;
99
+ const currentLocale = (_b2 = (_a2 = context == null ? void 0 : context.engine) == null ? void 0 : _a2.props) == null ? void 0 : _b2.locale;
100
+ return import_state.localeTypes[currentLocale] || "en";
101
+ }, [(_b = (_a = context == null ? void 0 : context.engine) == null ? void 0 : _a.props) == null ? void 0 : _b.locale]);
85
102
  const getMonthData = (date) => {
86
103
  const firstDay = (0, import_dayjs.default)(`${date}-01`);
87
104
  const startDay = firstDay.day();
@@ -119,7 +136,7 @@ var Date = (0, import_react.forwardRef)((props, ref) => {
119
136
  return await appointmentBooking.getAvailableDate(params);
120
137
  };
121
138
  const getDates = async (date) => {
122
- var _a;
139
+ var _a2;
123
140
  try {
124
141
  const startDate = (0, import_dayjs.default)(date).startOf("month").format("YYYY-MM-DD");
125
142
  const endDate = (0, import_dayjs.default)(date).endOf("month").format("YYYY-MM-DD");
@@ -131,7 +148,7 @@ var Date = (0, import_react.forwardRef)((props, ref) => {
131
148
  const selected = await appointmentBooking.getDateRange();
132
149
  console.log(data, selected, customPageId, "getDates");
133
150
  if ((selected == null ? void 0 : selected.length) > 0) {
134
- setCurrentDate((_a = selected == null ? void 0 : selected[0]) == null ? void 0 : _a.date);
151
+ setCurrentDate((_a2 = selected == null ? void 0 : selected[0]) == null ? void 0 : _a2.date);
135
152
  } else if (!isDateSelectedFirst) {
136
153
  if (date.format("YYYY-MM") === (0, import_dayjs.default)().format("YYYY-MM")) {
137
154
  const firstAvailableDate = (data || []).find(
@@ -183,7 +200,7 @@ var Date = (0, import_react.forwardRef)((props, ref) => {
183
200
  setCurrentDate(date);
184
201
  appointmentBooking.setDateRange([day]);
185
202
  if (isDateSelectedFirst) {
186
- appointmentBooking.next();
203
+ handleNext();
187
204
  }
188
205
  };
189
206
  return /* @__PURE__ */ import_react.default.createElement(
@@ -203,7 +220,7 @@ var Date = (0, import_react.forwardRef)((props, ref) => {
203
220
  }
204
221
  },
205
222
  /* @__PURE__ */ import_react.default.createElement(import_icons.CaretLeftOutlined, null)
206
- ), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-current-month" }, currentMonth == null ? void 0 : currentMonth.format("MMMM YYYY")), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-next-month", onClick: nextMonth }, /* @__PURE__ */ import_react.default.createElement(import_icons.CaretRightOutlined, null))), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-weeks" }, columns.map((col) => /* @__PURE__ */ import_react.default.createElement("div", { key: col, className: "calendar-weeks-items" }, weekListText[Number(col)]))), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-days" }, dateMonthList.map((day, index) => {
223
+ ), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-current-month" }, (_c = (0, import_dayjs.default)(currentMonth).locale(locale)) == null ? void 0 : _c.format("MMMM YYYY")), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-next-month", onClick: nextMonth }, /* @__PURE__ */ import_react.default.createElement(import_icons.CaretRightOutlined, null))), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-weeks" }, columns.map((col) => /* @__PURE__ */ import_react.default.createElement("div", { key: col, className: "calendar-weeks-items" }, weekListText[Number(col)]))), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-days" }, dateMonthList.map((day, index) => {
207
224
  const date = (0, import_dayjs.default)(day.date).format("YYYY-MM-DD");
208
225
  const isCurrentMonth = (0, import_dayjs.default)(day.date).isSame(
209
226
  currentMonth,
@@ -60,3 +60,4 @@ export declare const getStatus: (dateLimit: any, currentDate: string, cutTime: a
60
60
  * @Date: 2024-02-21 10:10
61
61
  */
62
62
  export declare const getCallToBookStatus: (currentDate: string, dateLimitData: any, cutTime: any) => boolean;
63
+ export declare const localeTypes: any;
@@ -33,6 +33,7 @@ __export(state_exports, {
33
33
  getCallToBookStatus: () => getCallToBookStatus,
34
34
  getNextSevenDaysList: () => getNextSevenDaysList,
35
35
  getStatus: () => getStatus,
36
+ localeTypes: () => localeTypes,
36
37
  statusColor: () => statusColor,
37
38
  weekListText: () => weekListText
38
39
  });
@@ -184,12 +185,18 @@ var getCallToBookStatus = (currentDate, dateLimitData, cutTime) => {
184
185
  }
185
186
  return isShowCallToBook;
186
187
  };
188
+ var localeTypes = {
189
+ "en-US": "en",
190
+ "zh-CN": "zh-cn",
191
+ "zh-TW": "zh-tw"
192
+ };
187
193
  // Annotate the CommonJS export names for ESM import in node:
188
194
  0 && (module.exports = {
189
195
  ShowDayOnly,
190
196
  getCallToBookStatus,
191
197
  getNextSevenDaysList,
192
198
  getStatus,
199
+ localeTypes,
193
200
  statusColor,
194
201
  weekListText
195
202
  });
@@ -50,6 +50,7 @@ var Form = (0, import_react.forwardRef)((props, ref) => {
50
50
  const { carts, appointmentBooking, setLoading } = (0, import_context.useAppointmentBookingContext)();
51
51
  const { getResourceList } = (0, import_hooks.useAppointmentBookingResource)();
52
52
  const { setOtherData, getOtherData } = (0, import_hooks.useAppointmentBookingSetting)();
53
+ const { nextStep } = (0, import_hooks.useAppointmentBookingStep)();
53
54
  (0, import_react.useImperativeHandle)(ref, () => ({
54
55
  next: () => {
55
56
  var _a, _b;
@@ -90,7 +91,7 @@ var Form = (0, import_react.forwardRef)((props, ref) => {
90
91
  setLoading(false);
91
92
  }
92
93
  } else {
93
- appointmentBooking.next();
94
+ nextStep();
94
95
  }
95
96
  };
96
97
  const updateFormStatus = (status) => {
@@ -166,9 +167,11 @@ var Form = (0, import_react.forwardRef)((props, ref) => {
166
167
  import_PolicyModal.default,
167
168
  {
168
169
  open: showAgreement,
169
- onCancel: handleAgreementOk,
170
+ onCancel: () => setShowAgreement(false),
171
+ onConfirm: () => handleAgreementOk(),
170
172
  item: agreementContent,
171
- onChange: () => setLoading(false)
173
+ onChange: () => setLoading(false),
174
+ isHideCheckout: false
172
175
  }
173
176
  ) : null);
174
177
  });
@@ -46,9 +46,10 @@ var Guest = (0, import_react.forwardRef)((props, ref) => {
46
46
  const [holderItem, setHolderItem] = (0, import_react.useState)(null);
47
47
  const { carts, appointmentBooking } = (0, import_context.useAppointmentBookingContext)();
48
48
  const { accountLists } = (0, import_hooks.useAppointmentBookingAccount)();
49
+ const { nextStep } = (0, import_hooks.useAppointmentBookingStep)();
49
50
  (0, import_react.useImperativeHandle)(ref, () => ({
50
51
  next: () => {
51
- appointmentBooking.next();
52
+ nextStep();
52
53
  }
53
54
  }));
54
55
  const lists = (0, import_react.useMemo)(() => {