@pisell/private-materials 3.3.43 → 3.3.45

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