@pisell/private-materials 3.3.33 → 3.3.34

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 (209) 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 +13 -13
  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 +8 -8
  11. package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +25 -4
  12. package/es/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
  13. package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
  14. package/es/components/appointmentBooking/components/Cart/Item/index.js +25 -45
  15. package/es/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  16. package/es/components/appointmentBooking/components/Content/index.d.ts +1 -0
  17. package/es/components/appointmentBooking/components/Content/index.js +36 -53
  18. package/es/components/appointmentBooking/components/Deposit/index.d.ts +0 -1
  19. package/es/components/appointmentBooking/components/Footer/index.d.ts +0 -1
  20. package/es/components/appointmentBooking/components/Form/index.js +161 -61
  21. package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
  22. package/es/components/appointmentBooking/components/Header/index.d.ts +1 -0
  23. package/es/components/appointmentBooking/components/Header/index.js +50 -64
  24. package/es/components/appointmentBooking/components/Resource/index.js +102 -119
  25. package/es/components/appointmentBooking/components/TimeSlicing/index.js +12 -5
  26. package/es/components/appointmentBooking/components/Voucher/index.d.ts +0 -1
  27. package/es/components/appointmentBooking/context.js +3 -43
  28. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -1
  29. package/es/components/appointmentBooking/deposit/index.d.ts +0 -1
  30. package/es/components/appointmentBooking/hooks.d.ts +3 -2
  31. package/es/components/appointmentBooking/hooks.js +209 -293
  32. package/es/components/appointmentBooking/index.d.ts +1 -0
  33. package/es/components/appointmentBooking/utils.d.ts +2 -88
  34. package/es/components/appointmentBooking/utils.js +63 -325
  35. package/es/components/booking/addons/model.js +5 -5
  36. package/es/components/booking/components/TabProduct/selectProductItem/index.js +4 -4
  37. package/es/components/booking/components/TabProduct/tabs/index.js +1 -5
  38. package/es/components/booking/components/browserSelect/index.js +1 -1
  39. package/es/components/booking/components/footer/index.d.ts +1 -0
  40. package/es/components/booking/components/voucher/index.d.ts +0 -1
  41. package/es/components/booking/deposit/index.d.ts +1 -0
  42. package/es/components/booking/forms/model.js +5 -5
  43. package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  44. package/es/components/booking/hooks/useClearCart.d.ts +0 -1
  45. package/es/components/booking/info/dateRange/index.d.ts +0 -1
  46. package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  47. package/es/components/booking/info/index.d.ts +1 -0
  48. package/es/components/booking/info/service/Lists.d.ts +1 -0
  49. package/es/components/booking/info/service/addService/index.d.ts +1 -0
  50. package/es/components/booking/info/service/addTimeModal/index.d.ts +1 -0
  51. package/es/components/booking/info/service/editService/BookingList/index.d.ts +0 -1
  52. package/es/components/booking/info/service/like/index.js +1 -1
  53. package/es/components/booking/info/service/serviceItem/index.d.ts +0 -1
  54. package/es/components/booking/info/utils.js +1 -1
  55. package/es/components/booking/info2/service/addService/index.d.ts +1 -0
  56. package/es/components/booking/info2/service/serviceItem/index.d.ts +0 -1
  57. package/es/components/booking/materiels/startTime/index.js +1 -1
  58. package/es/components/booking/notes/NoteBlock/NoteItem/index.js +1 -1
  59. package/es/components/booking/notes/NoteBlock/index.js +11 -11
  60. package/es/components/booking/notes/model.js +5 -5
  61. package/es/components/booking/payments/model.js +5 -5
  62. package/es/components/eftposPay/amount.d.ts +1 -1
  63. package/es/components/eftposPay/device.d.ts +1 -1
  64. package/es/components/eftposPay/hooks.d.ts +1 -1
  65. package/es/components/eftposPay/store/index.d.ts +3 -3
  66. package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  67. package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +0 -1
  68. package/es/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
  69. package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
  70. package/es/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
  71. package/es/components/eventBooking/components/Provider/Information/index.d.ts +0 -1
  72. package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
  73. package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
  74. package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
  75. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  76. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  77. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  78. package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +0 -1
  79. package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
  80. package/es/components/eventBooking/index.d.ts +1 -0
  81. package/es/components/listComponent/index.js +5 -5
  82. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
  83. package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
  84. package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
  85. package/es/components/pisellSelectCustomerModal/index.d.ts +0 -1
  86. package/es/components/productExtension/card/index.js +3 -3
  87. package/es/components/productExtension/fields/Actor/CutOffTime/index.js +1 -1
  88. package/es/components/productExtension/fields/Forms/index.js +12 -12
  89. package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.js +1 -1
  90. package/es/components/productExtension/fields/SelectProducts/server.js +2 -2
  91. package/es/components/productExtension/fields/SelectResourcesTable/server.js +2 -2
  92. package/es/components/productExtension/server.js +2 -2
  93. package/es/components/productSelect/components/TabProduct/index.d.ts +0 -1
  94. package/es/components/productSelect/components/productGroup/index.d.ts +0 -1
  95. package/es/components/ruleSetting/ruleBorder/index.js +1 -1
  96. package/es/components/schedules/calendar/index.js +4 -4
  97. package/es/components/schedules/calendar/serve.js +2 -2
  98. package/es/components/schedules/components/CurrentDay/index.js +5 -5
  99. package/es/components/schedules/components/CurrentDay/serve.js +2 -2
  100. package/es/components/schedules/components/DropdownSort/index.js +1 -1
  101. package/es/components/schedules/components/ResourceList/index.js +1 -1
  102. package/es/components/schedules/components/Search/index.js +5 -5
  103. package/es/components/schedules/model.js +5 -5
  104. package/es/components/schedules/openHours/index.js +1 -1
  105. package/es/components/schedules/openHours/serve.js +2 -2
  106. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.js +1 -1
  107. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.js +5 -5
  108. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +4 -4
  109. package/es/components/schedules/products/ProductDetailDrawer/index.js +3 -3
  110. package/es/components/schedules/products/serve.js +2 -2
  111. package/es/components/schedules/products/utils.js +5 -5
  112. package/es/components/schedules/resources/detail/detailContent.js +2 -2
  113. package/es/components/schedules/resources/detail/index.js +10 -10
  114. package/es/components/schedules/resources/list/index.js +2 -2
  115. package/es/components/schedules/resources/relationProduct/index.js +1 -1
  116. package/es/components/schedules/resources/serve.js +2 -2
  117. package/es/components/schedules/schedules/ScheduleDetailDrawer/index.js +9 -9
  118. package/es/components/schedules/utils.d.ts +1 -1
  119. package/es/components/schedules/utils.js +4 -4
  120. package/es/components/selectModal/index.js +2 -2
  121. package/es/components/shoppingCart/components/Cart/index.d.ts +0 -1
  122. package/es/components/shoppingCart/hooks/useAddService.d.ts +0 -1
  123. package/es/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
  124. package/es/components/ticketBooking/components/timeBar/index.d.ts +0 -1
  125. package/es/components/workSpaceList/components/Modal/index.d.ts +0 -1
  126. package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +0 -1
  127. package/es/hooks/useComponents.js +1 -1
  128. package/es/utils/index.d.ts +1 -1
  129. package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +5 -0
  130. package/lib/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
  131. package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
  132. package/lib/components/appointmentBooking/components/Cart/Item/index.js +9 -33
  133. package/lib/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  134. package/lib/components/appointmentBooking/components/Content/index.d.ts +1 -0
  135. package/lib/components/appointmentBooking/components/Content/index.js +21 -35
  136. package/lib/components/appointmentBooking/components/Deposit/index.d.ts +0 -1
  137. package/lib/components/appointmentBooking/components/Footer/index.d.ts +0 -1
  138. package/lib/components/appointmentBooking/components/Form/index.js +98 -54
  139. package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
  140. package/lib/components/appointmentBooking/components/Header/index.d.ts +1 -0
  141. package/lib/components/appointmentBooking/components/Header/index.js +20 -39
  142. package/lib/components/appointmentBooking/components/Resource/index.js +59 -41
  143. package/lib/components/appointmentBooking/components/TimeSlicing/index.js +7 -1
  144. package/lib/components/appointmentBooking/components/Voucher/index.d.ts +0 -1
  145. package/lib/components/appointmentBooking/context.js +4 -48
  146. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -1
  147. package/lib/components/appointmentBooking/deposit/index.d.ts +0 -1
  148. package/lib/components/appointmentBooking/hooks.d.ts +3 -2
  149. package/lib/components/appointmentBooking/hooks.js +57 -143
  150. package/lib/components/appointmentBooking/index.d.ts +1 -0
  151. package/lib/components/appointmentBooking/utils.d.ts +2 -88
  152. package/lib/components/appointmentBooking/utils.js +51 -191
  153. package/lib/components/booking/components/footer/index.d.ts +1 -0
  154. package/lib/components/booking/components/voucher/index.d.ts +0 -1
  155. package/lib/components/booking/deposit/index.d.ts +1 -0
  156. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  157. package/lib/components/booking/hooks/useClearCart.d.ts +0 -1
  158. package/lib/components/booking/info/dateRange/index.d.ts +0 -1
  159. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  160. package/lib/components/booking/info/index.d.ts +1 -0
  161. package/lib/components/booking/info/service/Lists.d.ts +1 -0
  162. package/lib/components/booking/info/service/addService/index.d.ts +1 -0
  163. package/lib/components/booking/info/service/addTimeModal/index.d.ts +1 -0
  164. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +0 -1
  165. package/lib/components/booking/info/service/serviceItem/index.d.ts +0 -1
  166. package/lib/components/booking/info/utils.js +1 -1
  167. package/lib/components/booking/info2/service/addService/index.d.ts +1 -0
  168. package/lib/components/booking/info2/service/serviceItem/index.d.ts +0 -1
  169. package/lib/components/eftposPay/amount.d.ts +1 -1
  170. package/lib/components/eftposPay/device.d.ts +1 -1
  171. package/lib/components/eftposPay/hooks.d.ts +1 -1
  172. package/lib/components/eftposPay/store/index.d.ts +3 -3
  173. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  174. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +0 -1
  175. package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
  176. package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
  177. package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
  178. package/lib/components/eventBooking/components/Provider/Information/index.d.ts +0 -1
  179. package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
  180. package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
  181. package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
  182. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  183. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  184. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  185. package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +0 -1
  186. package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
  187. package/lib/components/eventBooking/index.d.ts +1 -0
  188. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
  189. package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
  190. package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
  191. package/lib/components/pisellSelectCustomerModal/index.d.ts +0 -1
  192. package/lib/components/productSelect/components/TabProduct/index.d.ts +0 -1
  193. package/lib/components/productSelect/components/productGroup/index.d.ts +0 -1
  194. package/lib/components/schedules/utils.d.ts +1 -1
  195. package/lib/components/schedules/utils.js +1 -1
  196. package/lib/components/shoppingCart/components/Cart/index.d.ts +0 -1
  197. package/lib/components/shoppingCart/hooks/useAddService.d.ts +0 -1
  198. package/lib/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
  199. package/lib/components/ticketBooking/components/timeBar/index.d.ts +0 -1
  200. package/lib/components/workSpaceList/components/Modal/index.d.ts +0 -1
  201. package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +0 -1
  202. package/lib/utils/index.d.ts +1 -1
  203. package/package.json +4 -4
  204. package/es/components/eventBooking/components/Provider/SelectProduct/index.d.ts +0 -4
  205. package/es/components/eventBooking/components/Provider/SelectProduct/index.js +0 -77
  206. package/es/components/eventBooking/components/Provider/SelectProduct/index.less +0 -131
  207. package/lib/components/eventBooking/components/Provider/SelectProduct/index.d.ts +0 -4
  208. package/lib/components/eventBooking/components/Provider/SelectProduct/index.js +0 -69
  209. package/lib/components/eventBooking/components/Provider/SelectProduct/index.less +0 -131
@@ -17,9 +17,9 @@ import { useState, useEffect, useMemo } from 'react';
17
17
  import { locales } from "@pisell/utils";
18
18
  import { usePisellOS } from "../../hooks/useEngineContext";
19
19
  import useEngineContext from "../../hooks/useEngineContext";
20
- import { sortResources, getCustomer, currentAppointmentBoard, currentRenderLists, getFormInsertBeforeKey, checkAndGoNext, checkAndMarkCartRenderError, formatCustomer, formatHolder } from "./utils";
20
+ import { sortResources, getCustomer, formatCartsResources, checkHasFormStep } from "./utils";
21
21
  import { useAppointmentBookingContext } from "./context";
22
- import { scrollToFirstErrorCard } from "./components/Resource/utils";
22
+ import { checkHolder } from "./components/Cart/utils";
23
23
  export var useAppointmentBooking = function useAppointmentBooking() {
24
24
  var pisellOS = usePisellOS();
25
25
  return pisellOS.getModule('appointmentBooking');
@@ -45,29 +45,12 @@ export var contextUtils = function contextUtils() {
45
45
  export var useAppointmentBookingStep = function useAppointmentBookingStep() {
46
46
  var _appointmentBooking$s;
47
47
  var pisellOS = usePisellOS();
48
- var _ref = useAppointmentBookingContext(),
49
- appointmentBooking = _ref.appointmentBooking,
50
- setCurrentStep = _ref.setCurrentStep,
51
- carts = _ref.carts,
52
- openPolicy = _ref.openPolicy,
53
- setCarts = _ref.setCarts,
54
- setLoading = _ref.setLoading,
55
- currentSelectedResourcesRef = _ref.currentSelectedResourcesRef,
56
- currentStepParams = _ref.currentStepParams,
57
- setIsErrorHolder = _ref.setIsErrorHolder;
48
+ var _useAppointmentBookin = useAppointmentBookingContext(),
49
+ appointmentBooking = _useAppointmentBookin.appointmentBooking,
50
+ setCurrentStep = _useAppointmentBookin.setCurrentStep,
51
+ policyIdsRef = _useAppointmentBookin.policyIdsRef,
52
+ openPolicy = _useAppointmentBookin.openPolicy;
58
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) || [];
59
- var _useAppointmentBookin = useAppointmentBookingLogin(),
60
- isLogin = _useAppointmentBookin.isLogin,
61
- openLoginModal = _useAppointmentBookin.openLoginModal;
62
- var _useAppointmentBookin2 = useAppointmentBookingSetting(),
63
- isFormSubject = _useAppointmentBookin2.isFormSubject;
64
- var _useAppointmentBookin3 = useAppointmentBookingAccount(),
65
- accountLists = _useAppointmentBookin3.accountLists,
66
- getHolders = _useAppointmentBookin3.getHolders,
67
- checkAccount = _useAppointmentBookin3.checkAccount;
68
- var _useAppointmentBookin4 = useAppointmentBookingResource(),
69
- getResourceList = _useAppointmentBookin4.getResourceList;
70
- var utils = contextUtils();
71
54
 
72
55
  // 判断是否是最后一步
73
56
  var getCurrentAndLastStep = function getCurrentAndLastStep() {
@@ -77,7 +60,7 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
77
60
  useEffect(function () {
78
61
  getCurrentAndLastStep();
79
62
  pisellOS.effects.on('appointmentBooking_step:changed', /*#__PURE__*/function () {
80
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
63
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
81
64
  return _regeneratorRuntime().wrap(function _callee$(_context) {
82
65
  while (1) switch (_context.prev = _context.next) {
83
66
  case 0:
@@ -91,7 +74,7 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
91
74
  }, _callee);
92
75
  }));
93
76
  return function (_x) {
94
- return _ref2.apply(this, arguments);
77
+ return _ref.apply(this, arguments);
95
78
  };
96
79
  }());
97
80
  }, []);
@@ -139,146 +122,33 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
139
122
 
140
123
  // 下一步
141
124
  var nextStep = function nextStep() {
142
- var _nextStep$key;
143
- var stepList = (currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.stepLists) || [];
144
- var currentKey = currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.key;
145
- if (currentKey !== null && currentKey !== void 0 && currentKey.startsWith('select-resource')) {
146
- var _currentSelectedResou, _currentSelectedResou2;
147
- // 1. 检测购物车中是否选择了资源
148
- var _checkAndMarkCartRend = checkAndMarkCartRenderError((currentSelectedResourcesRef === null || currentSelectedResourcesRef === void 0 ? void 0 : currentSelectedResourcesRef.current) || [], appointmentBooking, utils),
149
- hasError = _checkAndMarkCartRend.hasError,
150
- updatedCartList = _checkAndMarkCartRend.updatedCartList;
151
- if (hasError) {
152
- // setCarts(updatedCartList)
153
- scrollToFirstErrorCard();
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();
154
150
  return;
155
151
  }
156
-
157
- // 2. 插入表单步骤
158
- currentSelectedResourcesRef === null || currentSelectedResourcesRef === void 0 || (_currentSelectedResou = currentSelectedResourcesRef.current) === null || _currentSelectedResou === void 0 || _currentSelectedResou.forEach(function (cart) {
159
- var _selectedResource$ren, _selectedResource$ren2;
160
- var selectedResource = cart === null || cart === void 0 ? void 0 : cart.currentSelectedResource;
161
- var resourceItem = (selectedResource === null || selectedResource === void 0 ? void 0 : selectedResource.resourceItem) || {};
162
- var formId = selectedResource === null || selectedResource === void 0 || (_selectedResource$ren = selectedResource.renderItem) === null || _selectedResource$ren === void 0 ? void 0 : _selectedResource$ren.resource_form_id;
163
- var policyId = selectedResource === null || selectedResource === void 0 || (_selectedResource$ren2 = selectedResource.renderItem) === null || _selectedResource$ren2 === void 0 ? void 0 : _selectedResource$ren2.policy_id;
164
- var formKey = "fill-form_@".concat(resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.form_id, "-").concat(resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.code, "-").concat(cart === null || cart === void 0 ? void 0 : cart._id, "-").concat(formId, "-").concat(policyId);
165
-
166
- // 如果有表单id则插入表单步骤
167
- if (formId) {
168
- var description = locales.getText('pisell2.appointment.fill-form');
169
- var beforeKey = getFormInsertBeforeKey(currentKey, stepList);
170
- appointmentBooking.addStep({
171
- key: formKey,
172
- description: description
173
- }, beforeKey);
174
- } else {
175
- appointmentBooking.removeStep(formKey);
176
- }
177
- });
178
-
179
- // 3. 插入下一个资源步骤
180
- var selectedResource = currentSelectedResourcesRef === null || currentSelectedResourcesRef === void 0 || (_currentSelectedResou2 = currentSelectedResourcesRef.current) === null || _currentSelectedResou2 === void 0 || (_currentSelectedResou2 = _currentSelectedResou2[0]) === null || _currentSelectedResou2 === void 0 ? void 0 : _currentSelectedResou2.currentSelectedResource;
181
- if (selectedResource) {
182
- var _selectedResource$res;
183
- var originRenderLists = (selectedResource === null || selectedResource === void 0 || (_selectedResource$res = selectedResource.resourceItem) === null || _selectedResource$res === void 0 ? void 0 : _selectedResource$res.originRenderLists) || [];
184
- var currentResourceIndex = originRenderLists === null || originRenderLists === void 0 ? void 0 : originRenderLists.findIndex(function (item) {
185
- var _selectedResource$ren3;
186
- return item.id === (selectedResource === null || selectedResource === void 0 || (_selectedResource$ren3 = selectedResource.renderItem) === null || _selectedResource$ren3 === void 0 ? void 0 : _selectedResource$ren3.form_id);
187
- });
188
- var nextResource = originRenderLists === null || originRenderLists === void 0 ? void 0 : originRenderLists[currentResourceIndex + 1];
189
- var resourceKey = "select-resource_@".concat(nextResource === null || nextResource === void 0 ? void 0 : nextResource.form_id, "-").concat(nextResource === null || nextResource === void 0 ? void 0 : nextResource.code);
190
-
191
- // 如果有下一个资源数据,则插入下一个资源步骤
192
- if (nextResource) {
193
- var _stepList;
194
- var beforeKey = (_stepList = stepList[stepList.length - 2]) === null || _stepList === void 0 ? void 0 : _stepList.key;
195
- appointmentBooking.addStep({
196
- key: resourceKey,
197
- description: ''
198
- }, beforeKey);
199
- } else {
200
- appointmentBooking.removeStep(resourceKey);
201
- }
202
- }
203
- }
204
-
205
- // 4. 检测是否登录和打开协议弹窗
206
- var nextStep = stepList[(currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.index) + 1];
207
- if (nextStep !== null && nextStep !== void 0 && (_nextStep$key = nextStep.key) !== null && _nextStep$key !== void 0 && _nextStep$key.startsWith('select-resource_') || (nextStep === null || nextStep === void 0 ? void 0 : nextStep.key) === 'confirm-information') {
208
- var _currentSelectedResou3;
209
- var _selectedResource = (_currentSelectedResou3 = currentSelectedResourcesRef.current) === null || _currentSelectedResou3 === void 0 || (_currentSelectedResou3 = _currentSelectedResou3[0]) === null || _currentSelectedResou3 === void 0 ? void 0 : _currentSelectedResou3.currentSelectedResource;
210
- var renderItem = (_selectedResource === null || _selectedResource === void 0 ? void 0 : _selectedResource.renderItem) || {};
211
-
212
- // 监测holder数据
213
- var checkHolder = function checkHolder() {
214
- setLoading(false);
215
- var _checkAndGoNext = checkAndGoNext(isFormSubject, checkAccount, carts),
216
- hasError = _checkAndGoNext.hasError,
217
- updatedCartList = _checkAndGoNext.updatedCartList;
218
- if (hasError) {
219
- setIsErrorHolder(hasError);
220
- setCarts(updatedCartList);
221
- return;
222
- }
223
- if (!!(renderItem !== null && renderItem !== void 0 && renderItem.policy_id)) {
224
- openPolicy({
225
- id: renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id
226
- }, function () {
227
- return appointmentBooking.next();
228
- });
229
- } else {
230
- return appointmentBooking.next();
231
- }
232
- };
233
-
234
- // 检测是否登录
235
- var checkLogin = function checkLogin() {
236
- // 如果没有登录,则验证登录
237
- if (!isLogin) {
238
- return openLoginModal({
239
- callback: function callback(status) {
240
- if (status === 'success') {
241
- if (!isFormSubject) {
242
- var _utils$storage;
243
- var user = JSON.parse((utils === null || utils === void 0 || (_utils$storage = utils.storage) === null || _utils$storage === void 0 ? void 0 : _utils$storage.get('customer')) || '{}');
244
- var currentUser = formatCustomer(user);
245
- var meAccount = accountLists === null || accountLists === void 0 ? void 0 : accountLists.find(function (d) {
246
- return !(d !== null && d !== void 0 && d.isGuest);
247
- });
248
- appointmentBooking.setLoginAccount(meAccount === null || meAccount === void 0 ? void 0 : meAccount.id, currentUser);
249
- } else {
250
- getHolders();
251
- }
252
-
253
- // 继续后续流程
254
- checkHolder();
255
- }
256
- }
257
- });
258
- } else {
259
- return checkHolder();
260
- }
261
- };
262
-
263
- // 如果下一步不是确认信息,则打开协议弹窗
264
- if ((nextStep === null || nextStep === void 0 ? void 0 : nextStep.key) !== 'confirm-information') {
265
- if (!(renderItem !== null && renderItem !== void 0 && renderItem.policy_id)) {
266
- return appointmentBooking.next();
267
- }
268
- return openPolicy({
269
- id: renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id
270
- }, function () {
271
- // 触发购物车数据发生改变,重新得出当前的资源
272
- var cartItem = carts === null || carts === void 0 ? void 0 : carts[0];
273
- appointmentBooking.updateCart(_objectSpread({
274
- _id: cartItem === null || cartItem === void 0 ? void 0 : cartItem._id
275
- }, cartItem));
276
- appointmentBooking.next();
277
- });
278
- } else {
279
- // 如果下一步是确认信息,则检测是否需要登录和检测holder数据
280
- return checkLogin();
281
- }
282
152
  }
283
153
  appointmentBooking.next();
284
154
  };
@@ -300,17 +170,19 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
300
170
  * @Date: 2025-04-15 11:12
301
171
  */
302
172
  export var useAppointmentBookingProduct = function useAppointmentBookingProduct() {
303
- var _ref3 = useAppointmentBookingContext(),
304
- appointmentBooking = _ref3.appointmentBooking;
305
- var _ref4 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {},
306
- productModuleParams = _ref4.productModuleParams;
307
- var _ref5 = productModuleParams || {},
308
- bookingProcess = _ref5.bookingProcess;
173
+ var _useAppointmentBookin2 = useAppointmentBookingContext(),
174
+ appointmentBooking = _useAppointmentBookin2.appointmentBooking,
175
+ carts = _useAppointmentBookin2.carts;
176
+ var _ref2 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {},
177
+ productModuleParams = _ref2.productModuleParams;
178
+ var _ref3 = productModuleParams || {},
179
+ bookingProcess = _ref3.bookingProcess,
180
+ bookingSubject = _ref3.bookingSubject;
309
181
 
310
182
  // 获取商品列表
311
183
  var getProducts = /*#__PURE__*/function () {
312
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
313
- var _dates$, dates, _ref7, _productModuleParams, _productList, _ref8, productModuleParams, productList;
184
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
185
+ var _dates$, dates, _ref5, _productModuleParams, _productList, _ref6, productModuleParams, productList;
314
186
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
315
187
  while (1) switch (_context2.prev = _context2.next) {
316
188
  case 0:
@@ -328,7 +200,7 @@ export var useAppointmentBookingProduct = function useAppointmentBookingProduct(
328
200
  }
329
201
  return _context2.abrupt("return");
330
202
  case 6:
331
- _ref7 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {}, _productModuleParams = _ref7.productModuleParams;
203
+ _ref5 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {}, _productModuleParams = _ref5.productModuleParams;
332
204
  _context2.next = 9;
333
205
  return appointmentBooking.loadProductByScheduleDate(_objectSpread({
334
206
  date: (_dates$ = dates[0]) === null || _dates$ === void 0 ? void 0 : _dates$.date
@@ -338,7 +210,7 @@ export var useAppointmentBookingProduct = function useAppointmentBookingProduct(
338
210
  return _context2.abrupt("return", _productList);
339
211
  case 11:
340
212
  // 先选商品
341
- _ref8 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {}, productModuleParams = _ref8.productModuleParams;
213
+ _ref6 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {}, productModuleParams = _ref6.productModuleParams;
342
214
  _context2.next = 14;
343
215
  return appointmentBooking.loadProducts(productModuleParams);
344
216
  case 14:
@@ -351,13 +223,13 @@ export var useAppointmentBookingProduct = function useAppointmentBookingProduct(
351
223
  }, _callee2);
352
224
  }));
353
225
  return function getProducts() {
354
- return _ref6.apply(this, arguments);
226
+ return _ref4.apply(this, arguments);
355
227
  };
356
228
  }();
357
229
 
358
230
  // 检测商品类型
359
231
  var checkProductType = /*#__PURE__*/function () {
360
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(productId) {
232
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(productId) {
361
233
  var result;
362
234
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
363
235
  while (1) switch (_context3.prev = _context3.next) {
@@ -374,7 +246,7 @@ export var useAppointmentBookingProduct = function useAppointmentBookingProduct(
374
246
  }, _callee3);
375
247
  }));
376
248
  return function checkProductType(_x2) {
377
- return _ref9.apply(this, arguments);
249
+ return _ref7.apply(this, arguments);
378
250
  };
379
251
  }();
380
252
  return {
@@ -394,51 +266,32 @@ export var useAppointmentBookingCart = function useAppointmentBookingCart() {
394
266
  var _appointmentBooking$o;
395
267
  var pisellOS = usePisellOS();
396
268
  var utils = contextUtils();
397
- var _ref10 = useAppointmentBookingContext(),
398
- appointmentBooking = _ref10.appointmentBooking,
399
- isErrorHolder = _ref10.isErrorHolder,
400
- setCarts = _ref10.setCarts,
401
- setSummary = _ref10.setSummary,
402
- setIsAgreeDepositPolicy = _ref10.setIsAgreeDepositPolicy;
403
- var _ref11 = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o = appointmentBooking.otherParams) === null || _appointmentBooking$o === void 0 ? void 0 : _appointmentBooking$o.productModuleParams) || {},
404
- bookingSubject = _ref11.bookingSubject;
269
+ var _useAppointmentBookin3 = useAppointmentBookingContext(),
270
+ appointmentBooking = _useAppointmentBookin3.appointmentBooking,
271
+ setCarts = _useAppointmentBookin3.setCarts,
272
+ setSummary = _useAppointmentBookin3.setSummary,
273
+ setIsAgreeDepositPolicy = _useAppointmentBookin3.setIsAgreeDepositPolicy;
274
+ var _ref8 = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o = appointmentBooking.otherParams) === null || _appointmentBooking$o === void 0 ? void 0 : _appointmentBooking$o.productModuleParams) || {},
275
+ bookingSubject = _ref8.bookingSubject;
405
276
  var getCartAndSummary = /*#__PURE__*/function () {
406
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
407
- var _utils$storage2;
408
- var locale, symbol, carts, accountLists, newCarts, summary;
277
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
278
+ var carts, newCarts, summary;
409
279
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
410
280
  while (1) switch (_context4.prev = _context4.next) {
411
281
  case 0:
412
- locale = (utils === null || utils === void 0 || (_utils$storage2 = utils.storage) === null || _utils$storage2 === void 0 ? void 0 : _utils$storage2.get('umi_locale')) || 'en-US';
413
- symbol = (utils === null || utils === void 0 ? void 0 : utils.getSymbolic()) || '$';
414
- _context4.next = 4;
282
+ _context4.next = 2;
415
283
  return appointmentBooking.getCart();
416
- case 4:
284
+ case 2:
417
285
  carts = _context4.sent;
418
- _context4.next = 7;
419
- return appointmentBooking.getAccounts();
420
- case 7:
421
- accountLists = _context4.sent;
422
286
  newCarts = carts === null || carts === void 0 ? void 0 : carts.map(function (item) {
423
- var _item$duration;
424
287
  return _objectSpread(_objectSpread({}, item), {}, {
425
- addHolderButtonText: utils === null || utils === void 0 ? void 0 : utils.translation(bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_name),
426
- format: ['HH:mm', 'HH:mm'],
427
- show_time: true,
428
- duration_type: (item === null || item === void 0 || (_item$duration = item.duration) === null || _item$duration === void 0 ? void 0 : _item$duration.type) || 'minutes',
429
- locale: locale,
430
- symbol: symbol,
431
- holders: formatHolder(accountLists),
432
- allowClearHolder: true,
433
- allowClearResource: true,
434
- isErrorHolder: isErrorHolder || false,
435
- isMultipleResource: true
288
+ addHolderButtonText: utils === null || utils === void 0 ? void 0 : utils.translation(bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_name)
436
289
  });
437
290
  });
438
291
  setCarts(newCarts || []);
439
- _context4.next = 12;
292
+ _context4.next = 7;
440
293
  return appointmentBooking.getSummary();
441
- case 12:
294
+ case 7:
442
295
  summary = _context4.sent;
443
296
  setSummary(summary || {});
444
297
 
@@ -446,14 +299,14 @@ export var useAppointmentBookingCart = function useAppointmentBookingCart() {
446
299
  if (!carts.length) {
447
300
  setIsAgreeDepositPolicy(false);
448
301
  }
449
- case 15:
302
+ case 10:
450
303
  case "end":
451
304
  return _context4.stop();
452
305
  }
453
306
  }, _callee4);
454
307
  }));
455
308
  return function getCartAndSummary() {
456
- return _ref12.apply(this, arguments);
309
+ return _ref9.apply(this, arguments);
457
310
  };
458
311
  }();
459
312
  useEffect(function () {
@@ -484,8 +337,8 @@ export var useAppointmentBookingLogin = function useAppointmentBookingLogin() {
484
337
  var utils = contextUtils();
485
338
  var isLogin = !!(utils !== null && utils !== void 0 && (_utils$token = utils.token) !== null && _utils$token !== void 0 && (_utils$token$get = _utils$token.get) !== null && _utils$token$get !== void 0 && _utils$token$get.call(_utils$token));
486
339
  var openLoginModal = function openLoginModal(params) {
487
- var _ref14 = params || {},
488
- callback = _ref14.callback;
340
+ var _ref11 = params || {},
341
+ callback = _ref11.callback;
489
342
  utils.action({
490
343
  type: 'pisell1.login',
491
344
  data: {
@@ -516,13 +369,13 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
516
369
  _useState2 = _slicedToArray(_useState, 2),
517
370
  accountLists = _useState2[0],
518
371
  setAccountLists = _useState2[1];
519
- var _ref15 = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o2 = appointmentBooking.otherParams) === null || _appointmentBooking$o2 === void 0 ? void 0 : _appointmentBooking$o2.productModuleParams) || {},
520
- bookingSubject = _ref15.bookingSubject;
372
+ var _ref12 = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o2 = appointmentBooking.otherParams) === null || _appointmentBooking$o2 === void 0 ? void 0 : _appointmentBooking$o2.productModuleParams) || {},
373
+ bookingSubject = _ref12.bookingSubject;
521
374
  var form_id = bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_id;
522
375
 
523
376
  // 获取账户列表数据
524
377
  var getAccountLists = /*#__PURE__*/function () {
525
- var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
378
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
526
379
  var data;
527
380
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
528
381
  while (1) switch (_context6.prev = _context6.next) {
@@ -539,13 +392,13 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
539
392
  }, _callee6);
540
393
  }));
541
394
  return function getAccountLists() {
542
- return _ref16.apply(this, arguments);
395
+ return _ref13.apply(this, arguments);
543
396
  };
544
397
  }();
545
398
  useEffect(function () {
546
399
  getAccountLists();
547
400
  pisellOS.effects.on('appointmentBooking_accountList:changed', /*#__PURE__*/function () {
548
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(res) {
401
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(res) {
549
402
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
550
403
  while (1) switch (_context7.prev = _context7.next) {
551
404
  case 0:
@@ -560,14 +413,14 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
560
413
  }, _callee7);
561
414
  }));
562
415
  return function (_x3) {
563
- return _ref17.apply(this, arguments);
416
+ return _ref14.apply(this, arguments);
564
417
  };
565
418
  }());
566
419
  }, []);
567
420
 
568
421
  // 获取表单数据
569
422
  var getHolders = /*#__PURE__*/function () {
570
- var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
423
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
571
424
  var _utils$getStore$getSt;
572
425
  var shop_id, customer, params, data, newData;
573
426
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
@@ -607,13 +460,13 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
607
460
  }, _callee8);
608
461
  }));
609
462
  return function getHolders() {
610
- return _ref18.apply(this, arguments);
463
+ return _ref15.apply(this, arguments);
611
464
  };
612
465
  }();
613
466
 
614
467
  // 添加账户
615
468
  var addAccount = /*#__PURE__*/function () {
616
- var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(val, type) {
469
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(val, type) {
617
470
  var customer, result;
618
471
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
619
472
  while (1) switch (_context9.prev = _context9.next) {
@@ -634,7 +487,7 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
634
487
  }, _callee9);
635
488
  }));
636
489
  return function addAccount(_x4, _x5) {
637
- return _ref19.apply(this, arguments);
490
+ return _ref16.apply(this, arguments);
638
491
  };
639
492
  }();
640
493
 
@@ -659,12 +512,14 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
659
512
  * @Date: 2025-04-15 11:29
660
513
  */
661
514
  export var useAppointmentBookingResource = function useAppointmentBookingResource() {
662
- var _ref20 = useAppointmentBookingContext(),
663
- appointmentBooking = _ref20.appointmentBooking,
664
- setResources = _ref20.setResources,
665
- setTimes = _ref20.setTimes;
666
- var _ref21 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {},
667
- resourceSort = _ref21.resourceSort;
515
+ var _useAppointmentBookin4 = useAppointmentBookingContext(),
516
+ appointmentBooking = _useAppointmentBookin4.appointmentBooking,
517
+ setResources = _useAppointmentBookin4.setResources,
518
+ setTimes = _useAppointmentBookin4.setTimes,
519
+ setResourceOtherParams = _useAppointmentBookin4.setResourceOtherParams,
520
+ resourceOtherParams = _useAppointmentBookin4.resourceOtherParams;
521
+ var _ref17 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {},
522
+ resourceSort = _ref17.resourceSort;
668
523
 
669
524
  // 设置资源列表
670
525
  var getResourceList = function getResourceList() {
@@ -688,7 +543,7 @@ export var useAppointmentBookingResource = function useAppointmentBookingResourc
688
543
 
689
544
  // 设置时间切片
690
545
  var getResourceTimeSlot = /*#__PURE__*/function () {
691
- var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(index) {
546
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(index) {
692
547
  var _getResourceList, resourceCodes, code, data;
693
548
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
694
549
  while (1) switch (_context10.prev = _context10.next) {
@@ -707,12 +562,45 @@ export var useAppointmentBookingResource = function useAppointmentBookingResourc
707
562
  }, _callee10);
708
563
  }));
709
564
  return function getResourceTimeSlot(_x6) {
710
- return _ref22.apply(this, arguments);
565
+ return _ref18.apply(this, arguments);
566
+ };
567
+ }();
568
+
569
+ // 获取自动分配
570
+ var autoSelectAllProductResources = /*#__PURE__*/function () {
571
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(index) {
572
+ var _getResourceList2, resourceCodes, code, data, res;
573
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
574
+ while (1) switch (_context11.prev = _context11.next) {
575
+ case 0:
576
+ _getResourceList2 = getResourceList(), resourceCodes = _getResourceList2.resourceCodes;
577
+ code = resourceCodes === null || resourceCodes === void 0 ? void 0 : resourceCodes[index || 0]; // 获取时间切片
578
+ _context11.next = 4;
579
+ return appointmentBooking.getTimeSlotByAllResources(code);
580
+ case 4:
581
+ data = _context11.sent;
582
+ _context11.next = 7;
583
+ return appointmentBooking.autoSelectAllProductResources(code);
584
+ case 7:
585
+ res = _context11.sent;
586
+ setResourceOtherParams(_objectSpread(_objectSpread(_objectSpread({}, resourceOtherParams), res), {}, {
587
+ resourceCodes: resourceCodes
588
+ }));
589
+ return _context11.abrupt("return", res);
590
+ case 10:
591
+ case "end":
592
+ return _context11.stop();
593
+ }
594
+ }, _callee11);
595
+ }));
596
+ return function autoSelectAllProductResources(_x7) {
597
+ return _ref19.apply(this, arguments);
711
598
  };
712
599
  }();
713
600
  return {
714
601
  getResourceTimeSlot: getResourceTimeSlot,
715
- getResourceList: getResourceList
602
+ getResourceList: getResourceList,
603
+ autoSelectAllProductResources: autoSelectAllProductResources
716
604
  };
717
605
  };
718
606
 
@@ -724,73 +612,101 @@ export var useAppointmentBookingResource = function useAppointmentBookingResourc
724
612
  * @Date: 2025-04-21 11:47
725
613
  */
726
614
  export var useIsSkipResourceStep = function useIsSkipResourceStep() {
727
- var _ref23 = useAppointmentBookingContext(),
728
- currentStepParams = _ref23.currentStepParams;
729
- var _useAppointmentBookin5 = useAppointmentBookingResource(),
730
- getResourceList = _useAppointmentBookin5.getResourceList;
731
- var _useAppointmentBookin6 = useAppointmentBookingSetting(),
732
- isFormSubject = _useAppointmentBookin6.isFormSubject;
615
+ var _appointmentBooking$s3;
616
+ var _useAppointmentBookin5 = useAppointmentBookingContext(),
617
+ currentStep = _useAppointmentBookin5.currentStep,
618
+ setCarts = _useAppointmentBookin5.setCarts,
619
+ setPolicyIds = _useAppointmentBookin5.setPolicyIds;
620
+ var _useAppointmentBookin6 = useAppointmentBookingResource(),
621
+ getResourceList = _useAppointmentBookin6.getResourceList,
622
+ autoSelectAllProductResources = _useAppointmentBookin6.autoSelectAllProductResources;
623
+ var _useAppointmentBookin7 = useAppointmentBookingSetting(),
624
+ isFormSubject = _useAppointmentBookin7.isFormSubject;
733
625
  var appointmentBooking = useAppointmentBooking();
734
- var _useAppointmentBookin7 = useAppointmentBookingStep(),
735
- nextStep = _useAppointmentBookin7.nextStep;
626
+ 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) || [];
627
+ var _useAppointmentBookin8 = useAppointmentBookingLogin(),
628
+ isLogin = _useAppointmentBookin8.isLogin,
629
+ openLoginModal = _useAppointmentBookin8.openLoginModal;
630
+ var _useAppointmentBookin9 = useAppointmentBookingAccount(),
631
+ getHolders = _useAppointmentBookin9.getHolders,
632
+ checkAccount = _useAppointmentBookin9.checkAccount;
633
+ var _useAppointmentBookin10 = useAppointmentBookingStep(),
634
+ nextStep = _useAppointmentBookin10.nextStep;
635
+ var utils = contextUtils();
736
636
  var checkSkipResourceStep = /*#__PURE__*/function () {
737
- var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
738
- var _getResourceList2, resources, accountLists, _currentAppointmentBo, isSystem, isSkip, form_code, renderLists, _isSkip;
739
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
740
- while (1) switch (_context11.prev = _context11.next) {
637
+ var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(isSkipUpdateFormStep) {
638
+ var accountLists, carts, _res$errorList, _resources$, res, _getResourceList3, resources, resultCarts;
639
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
640
+ while (1) switch (_context12.prev = _context12.next) {
741
641
  case 0:
742
- _context11.prev = 0;
743
- _getResourceList2 = getResourceList(), resources = _getResourceList2.resources;
744
- _context11.next = 4;
642
+ _context12.prev = 0;
643
+ _context12.next = 3;
745
644
  return appointmentBooking.getAccounts();
746
- case 4:
747
- accountLists = _context11.sent;
748
- _currentAppointmentBo = currentAppointmentBoard(currentStepParams.key, resources, appointmentBooking), isSystem = _currentAppointmentBo.isSystem, isSkip = _currentAppointmentBo.isSkip, form_code = _currentAppointmentBo.form_code; // 客户不可选择资源,系统自动分派
749
- if (!isSystem) {
750
- _context11.next = 9;
751
- break;
752
- }
753
- nextStep();
754
- return _context11.abrupt("return", true);
755
- case 9:
645
+ case 3:
646
+ accountLists = _context12.sent;
647
+ _context12.next = 6;
648
+ return appointmentBooking.getCart();
649
+ case 6:
650
+ carts = _context12.sent;
756
651
  if (!((accountLists === null || accountLists === void 0 ? void 0 : accountLists.length) === 1 || isFormSubject)) {
757
- _context11.next = 19;
652
+ _context12.next = 20;
758
653
  break;
759
654
  }
760
- renderLists = currentRenderLists(resources, form_code);
761
- _isSkip = false;
762
- if ((renderLists === null || renderLists === void 0 ? void 0 : renderLists.length) === 1) {
763
- _isSkip = isSkip || false;
764
- } else {
765
- _isSkip = false;
766
- }
767
-
768
- // 如果跳过资源选择步骤,则执行跳过的逻辑
769
- if (!_isSkip) {
770
- _context11.next = 16;
655
+ _context12.next = 10;
656
+ return autoSelectAllProductResources();
657
+ case 10:
658
+ res = _context12.sent;
659
+ _getResourceList3 = getResourceList(), resources = _getResourceList3.resources; // 如果分配成功,并且只有一个资源则跳过资源选择步骤,默认选中该资源
660
+ if (!(!(res !== null && res !== void 0 && (_res$errorList = res.errorList) !== null && _res$errorList !== void 0 && _res$errorList.length) && (resources === null || resources === void 0 || (_resources$ = resources[0]) === null || _resources$ === void 0 || (_resources$ = _resources$.resources) === null || _resources$ === void 0 || (_resources$ = _resources$[0]) === null || _resources$ === void 0 || (_resources$ = _resources$.renderList) === null || _resources$ === void 0 ? void 0 : _resources$.length) === 1)) {
661
+ _context12.next = 17;
771
662
  break;
772
663
  }
773
- nextStep();
774
- return _context11.abrupt("return", true);
775
- case 16:
776
- return _context11.abrupt("return", _isSkip);
777
- case 19:
778
- return _context11.abrupt("return", false);
664
+ if (!isSkipUpdateFormStep) {
665
+ resultCarts = formatCartsResources(carts, resources, setPolicyIds); // 如果当前资源有表单,则添加表单步骤,否则删除表单步骤
666
+ checkHasFormStep({
667
+ nextStep: nextStep,
668
+ isSkip: true,
669
+ openLoginModal: openLoginModal,
670
+ utils: utils,
671
+ accountLists: accountLists,
672
+ getHolders: getHolders,
673
+ checkHolder: checkHolder,
674
+ setCarts: setCarts,
675
+ checkAccount: checkAccount,
676
+ carts: carts,
677
+ isFormSubject: isFormSubject,
678
+ hasResourceFormId: (resultCarts === null || resultCarts === void 0 ? void 0 : resultCarts.length) > 0,
679
+ currentStep: currentStep,
680
+ stepList: stepList,
681
+ appointmentBooking: appointmentBooking,
682
+ locales: locales,
683
+ isLogin: isLogin
684
+ });
685
+ }
686
+ return _context12.abrupt("return", true);
687
+ case 17:
688
+ return _context12.abrupt("return", false);
689
+ case 18:
690
+ _context12.next = 21;
691
+ break;
779
692
  case 20:
780
- _context11.next = 25;
693
+ return _context12.abrupt("return", false);
694
+ case 21:
695
+ _context12.next = 27;
781
696
  break;
782
- case 22:
783
- _context11.prev = 22;
784
- _context11.t0 = _context11["catch"](0);
785
- return _context11.abrupt("return", false);
786
- case 25:
697
+ case 23:
698
+ _context12.prev = 23;
699
+ _context12.t0 = _context12["catch"](0);
700
+ console.log(_context12.t0, 'checkSkipResourceStep33');
701
+ return _context12.abrupt("return", false);
702
+ case 27:
787
703
  case "end":
788
- return _context11.stop();
704
+ return _context12.stop();
789
705
  }
790
- }, _callee11, null, [[0, 22]]);
706
+ }, _callee12, null, [[0, 23]]);
791
707
  }));
792
- return function checkSkipResourceStep() {
793
- return _ref24.apply(this, arguments);
708
+ return function checkSkipResourceStep(_x8) {
709
+ return _ref20.apply(this, arguments);
794
710
  };
795
711
  }();
796
712
  return {
@@ -808,13 +724,13 @@ export var useIsSkipResourceStep = function useIsSkipResourceStep() {
808
724
  export var useAppointmentBookingSetting = function useAppointmentBookingSetting() {
809
725
  var _appointmentBooking$o3;
810
726
  var utils = contextUtils();
811
- var _ref25 = useAppointmentBookingContext(),
812
- appointmentBooking = _ref25.appointmentBooking;
813
- var _ref26 = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o3 = appointmentBooking.otherParams) === null || _appointmentBooking$o3 === void 0 ? void 0 : _appointmentBooking$o3.productModuleParams) || {},
814
- bookingProcess = _ref26.bookingProcess,
815
- bookingSubject = _ref26.bookingSubject,
816
- customPageId = _ref26.customPageId,
817
- channel = _ref26.channel;
727
+ var _useAppointmentBookin11 = useAppointmentBookingContext(),
728
+ appointmentBooking = _useAppointmentBookin11.appointmentBooking;
729
+ var _ref21 = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o3 = appointmentBooking.otherParams) === null || _appointmentBooking$o3 === void 0 ? void 0 : _appointmentBooking$o3.productModuleParams) || {},
730
+ bookingProcess = _ref21.bookingProcess,
731
+ bookingSubject = _ref21.bookingSubject,
732
+ customPageId = _ref21.customPageId,
733
+ channel = _ref21.channel;
818
734
 
819
735
  // 设置缓存
820
736
  var setOtherData = function setOtherData(key, val) {