@pisell/private-materials 3.3.16 → 3.3.18

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 (241) 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 +7 -7
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +3 -3
  9. package/es/components/Sales/Summary/utils.d.ts +1 -1
  10. package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +4 -16
  11. package/es/components/appointmentBooking/components/Cart/Item/Total.js +0 -1
  12. package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +0 -1
  13. package/es/components/appointmentBooking/components/Cart/Item/index.js +40 -13
  14. package/es/components/appointmentBooking/components/Cart/index.d.ts +1 -0
  15. package/es/components/appointmentBooking/components/Cart/utils.d.ts +20 -0
  16. package/es/components/appointmentBooking/components/Cart/utils.js +67 -1
  17. package/es/components/appointmentBooking/components/ConfirmInformation/index.js +2 -3
  18. package/es/components/appointmentBooking/components/Content/index.d.ts +0 -1
  19. package/es/components/appointmentBooking/components/Content/index.js +50 -7
  20. package/es/components/appointmentBooking/components/Date/index.js +6 -0
  21. package/es/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
  22. package/es/components/appointmentBooking/components/Footer/index.d.ts +1 -0
  23. package/es/components/appointmentBooking/components/Form/index.js +61 -49
  24. package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
  25. package/es/components/appointmentBooking/components/Header/index.d.ts +0 -1
  26. package/es/components/appointmentBooking/components/Header/index.js +5 -4
  27. package/es/components/appointmentBooking/components/Services/index.js +2 -4
  28. package/es/components/appointmentBooking/components/Voucher/index.js +1 -1
  29. package/es/components/appointmentBooking/context.d.ts +5 -1
  30. package/es/components/appointmentBooking/context.js +37 -14
  31. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +1 -0
  32. package/es/components/appointmentBooking/deposit/index.d.ts +1 -0
  33. package/es/components/appointmentBooking/hooks.js +7 -19
  34. package/es/components/appointmentBooking/locales.d.ts +3 -0
  35. package/es/components/appointmentBooking/locales.js +196 -193
  36. package/es/components/appointmentBooking/utils.js +21 -13
  37. package/es/components/booking/components/customSelect/index.js +2 -0
  38. package/es/components/booking/components/footer/index.d.ts +0 -1
  39. package/es/components/booking/components/footer/index.js +27 -22
  40. package/es/components/booking/components/footer/utils.d.ts +1 -0
  41. package/es/components/booking/components/footer/utils.js +17 -2
  42. package/es/components/booking/components/voucher/index.d.ts +1 -0
  43. package/es/components/booking/forms/footer.d.ts +1 -0
  44. package/es/components/booking/forms/forms.d.ts +4 -0
  45. package/es/components/booking/forms/forms.js +14 -3
  46. package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
  47. package/es/components/booking/forms/single/index.d.ts +1 -2
  48. package/es/components/booking/forms/single/index.js +33 -26
  49. package/es/components/booking/hooks/useClearCart.d.ts +1 -0
  50. package/es/components/booking/info/client/index.js +24 -3
  51. package/es/components/booking/info/client/index.less +39 -0
  52. package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
  53. package/es/components/booking/info/clientVariant/hooks/useClientFn.js +10 -1
  54. package/es/components/booking/info/clientVariant/utils.d.ts +1 -0
  55. package/es/components/booking/info/clientVariant/utils.js +6 -0
  56. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +17 -2
  57. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.less +17 -0
  58. package/es/components/booking/info/clientVariant/vertical/index.js +29 -4
  59. package/es/components/booking/info/clientVariant/vertical/index.less +18 -0
  60. package/es/components/booking/info/dateRange/index.d.ts +1 -0
  61. package/es/components/booking/info/hooks/useAddHolder.d.ts +8 -1
  62. package/es/components/booking/info/hooks/useAddHolder.js +131 -31
  63. package/es/components/booking/info/hooks/useGetHolderList.d.ts +2 -0
  64. package/es/components/booking/info/hooks/useGetHolderList.js +48 -0
  65. package/es/components/booking/info/hooks/useHolderConfig.js +2 -2
  66. package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  67. package/es/components/booking/info/hooks/useInfoHolder.js +4 -41
  68. package/es/components/booking/info/pet/index.js +83 -8
  69. package/es/components/booking/info/pet/serve.d.ts +1 -0
  70. package/es/components/booking/info/pet/serve.js +27 -0
  71. package/es/components/booking/info/service/Lists.d.ts +0 -1
  72. package/es/components/booking/info/service/Lists.js +2 -1
  73. package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  74. package/es/components/booking/info/service/serviceItem/index.d.ts +1 -0
  75. package/es/components/booking/info/service2/utils.d.ts +2 -0
  76. package/es/components/booking/info/service2/utils.js +20 -10
  77. package/es/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  78. package/es/components/booking/info2/utilsByBooking.d.ts +1 -0
  79. package/es/components/booking/info2/utilsByBooking.js +9 -1
  80. package/es/components/booking/locales.d.ts +21 -0
  81. package/es/components/booking/locales.js +42 -3
  82. package/es/components/booking/utils.js +3 -1
  83. package/es/components/eftposPay/amount.d.ts +1 -1
  84. package/es/components/eftposPay/device.d.ts +1 -1
  85. package/es/components/eftposPay/hooks.d.ts +1 -1
  86. package/es/components/eftposPay/store/index.d.ts +3 -3
  87. package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
  88. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.d.ts +1 -0
  89. package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -0
  90. package/es/components/eventBooking/components/Provider/Cart/Item/index.d.ts +1 -0
  91. package/es/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
  92. package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
  93. package/es/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
  94. package/es/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
  95. package/es/components/eventBooking/components/Provider/Information/index.d.ts +1 -0
  96. package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
  97. package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
  98. package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +1 -0
  99. package/es/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
  100. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  101. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
  102. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
  103. package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
  104. package/es/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
  105. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
  106. package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
  107. package/es/components/pisellSelectCustomerModal/index.d.ts +1 -0
  108. package/es/components/productSelect/components/TabProduct/index.d.ts +1 -0
  109. package/es/components/productSelect/components/productGroup/index.d.ts +1 -0
  110. package/es/components/shoppingCart/Provider.js +0 -1
  111. package/es/components/shoppingCart/components/Cart/Product.d.ts +1 -0
  112. package/es/components/shoppingCart/components/Cart/index.d.ts +1 -0
  113. package/es/components/shoppingCart/components/Render/index.d.ts +0 -1
  114. package/es/components/shoppingCart/components/Render/index.js +0 -1
  115. package/es/components/shoppingCart/hooks/useAddService.d.ts +1 -0
  116. package/es/components/shoppingCart/hooks/useClearCart.js +0 -2
  117. package/es/components/ticketBooking/components/addServiceVariant/addService.js +2 -3
  118. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
  119. package/es/components/ticketBooking/components/ticketBooking/index.js +5 -6
  120. package/es/components/ticketBooking/components/timeBar/index.d.ts +1 -0
  121. package/es/components/ticketBooking/index.d.ts +5 -2
  122. package/es/components/ticketBooking/index.js +20 -5
  123. package/es/components/workSpaceList/components/Modal/index.d.ts +1 -0
  124. package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
  125. package/lib/components/Sales/Summary/utils.d.ts +1 -1
  126. package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +4 -8
  127. package/lib/components/appointmentBooking/components/Cart/Item/Total.js +0 -1
  128. package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +0 -1
  129. package/lib/components/appointmentBooking/components/Cart/Item/index.js +27 -11
  130. package/lib/components/appointmentBooking/components/Cart/index.d.ts +1 -0
  131. package/lib/components/appointmentBooking/components/Cart/utils.d.ts +20 -0
  132. package/lib/components/appointmentBooking/components/Cart/utils.js +32 -2
  133. package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +3 -3
  134. package/lib/components/appointmentBooking/components/Content/index.d.ts +0 -1
  135. package/lib/components/appointmentBooking/components/Content/index.js +26 -1
  136. package/lib/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
  137. package/lib/components/appointmentBooking/components/Footer/index.d.ts +1 -0
  138. package/lib/components/appointmentBooking/components/Form/index.js +48 -36
  139. package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
  140. package/lib/components/appointmentBooking/components/Header/index.d.ts +0 -1
  141. package/lib/components/appointmentBooking/components/Header/index.js +5 -4
  142. package/lib/components/appointmentBooking/components/Services/index.js +4 -6
  143. package/lib/components/appointmentBooking/components/Voucher/index.js +2 -4
  144. package/lib/components/appointmentBooking/context.d.ts +5 -1
  145. package/lib/components/appointmentBooking/context.js +17 -5
  146. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +1 -0
  147. package/lib/components/appointmentBooking/deposit/index.d.ts +1 -0
  148. package/lib/components/appointmentBooking/hooks.js +1 -12
  149. package/lib/components/appointmentBooking/locales.d.ts +3 -0
  150. package/lib/components/appointmentBooking/locales.js +4 -1
  151. package/lib/components/appointmentBooking/utils.js +19 -13
  152. package/lib/components/booking/components/customSelect/index.js +2 -0
  153. package/lib/components/booking/components/footer/index.d.ts +0 -1
  154. package/lib/components/booking/components/footer/index.js +3 -1
  155. package/lib/components/booking/components/footer/utils.d.ts +1 -0
  156. package/lib/components/booking/components/footer/utils.js +16 -1
  157. package/lib/components/booking/components/voucher/index.d.ts +1 -0
  158. package/lib/components/booking/forms/footer.d.ts +1 -0
  159. package/lib/components/booking/forms/forms.d.ts +4 -0
  160. package/lib/components/booking/forms/forms.js +13 -3
  161. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
  162. package/lib/components/booking/forms/single/index.d.ts +1 -2
  163. package/lib/components/booking/forms/single/index.js +13 -1
  164. package/lib/components/booking/hooks/useClearCart.d.ts +1 -0
  165. package/lib/components/booking/info/client/index.js +20 -3
  166. package/lib/components/booking/info/client/index.less +39 -0
  167. package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
  168. package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +8 -1
  169. package/lib/components/booking/info/clientVariant/utils.d.ts +1 -0
  170. package/lib/components/booking/info/clientVariant/utils.js +34 -0
  171. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +11 -3
  172. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.less +17 -0
  173. package/lib/components/booking/info/clientVariant/vertical/index.js +31 -6
  174. package/lib/components/booking/info/clientVariant/vertical/index.less +18 -0
  175. package/lib/components/booking/info/dateRange/index.d.ts +1 -0
  176. package/lib/components/booking/info/hooks/useAddHolder.d.ts +8 -1
  177. package/lib/components/booking/info/hooks/useAddHolder.js +88 -16
  178. package/lib/components/booking/info/hooks/useGetHolderList.d.ts +2 -0
  179. package/lib/components/booking/info/hooks/useGetHolderList.js +61 -0
  180. package/lib/components/booking/info/hooks/useHolderConfig.js +2 -2
  181. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  182. package/lib/components/booking/info/hooks/useInfoHolder.js +2 -21
  183. package/lib/components/booking/info/pet/index.js +57 -10
  184. package/lib/components/booking/info/pet/serve.d.ts +1 -0
  185. package/lib/components/booking/info/pet/serve.js +33 -0
  186. package/lib/components/booking/info/service/Lists.d.ts +0 -1
  187. package/lib/components/booking/info/service/Lists.js +1 -1
  188. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  189. package/lib/components/booking/info/service/serviceItem/index.d.ts +1 -0
  190. package/lib/components/booking/info/service2/utils.d.ts +2 -0
  191. package/lib/components/booking/info/service2/utils.js +17 -7
  192. package/lib/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  193. package/lib/components/booking/info2/utilsByBooking.d.ts +1 -0
  194. package/lib/components/booking/info2/utilsByBooking.js +8 -1
  195. package/lib/components/booking/locales.d.ts +21 -0
  196. package/lib/components/booking/locales.js +42 -3
  197. package/lib/components/booking/utils.js +3 -1
  198. package/lib/components/eftposPay/amount.d.ts +1 -1
  199. package/lib/components/eftposPay/device.d.ts +1 -1
  200. package/lib/components/eftposPay/hooks.d.ts +1 -1
  201. package/lib/components/eftposPay/store/index.d.ts +3 -3
  202. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
  203. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.d.ts +1 -0
  204. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -0
  205. package/lib/components/eventBooking/components/Provider/Cart/Item/index.d.ts +1 -0
  206. package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
  207. package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
  208. package/lib/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
  209. package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
  210. package/lib/components/eventBooking/components/Provider/Information/index.d.ts +1 -0
  211. package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
  212. package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
  213. package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +1 -0
  214. package/lib/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
  215. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  216. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
  217. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
  218. package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
  219. package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
  220. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
  221. package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
  222. package/lib/components/pisellSelectCustomerModal/index.d.ts +1 -0
  223. package/lib/components/productSelect/components/TabProduct/index.d.ts +1 -0
  224. package/lib/components/productSelect/components/productGroup/index.d.ts +1 -0
  225. package/lib/components/shoppingCart/Provider.js +0 -1
  226. package/lib/components/shoppingCart/components/Cart/Product.d.ts +1 -0
  227. package/lib/components/shoppingCart/components/Cart/index.d.ts +1 -0
  228. package/lib/components/shoppingCart/components/Render/index.d.ts +0 -1
  229. package/lib/components/shoppingCart/components/Render/index.js +0 -1
  230. package/lib/components/shoppingCart/hooks/useAddService.d.ts +1 -0
  231. package/lib/components/shoppingCart/hooks/useClearCart.js +1 -2
  232. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +2 -3
  233. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
  234. package/lib/components/ticketBooking/components/ticketBooking/index.js +4 -3
  235. package/lib/components/ticketBooking/components/timeBar/index.d.ts +1 -0
  236. package/lib/components/ticketBooking/index.d.ts +5 -2
  237. package/lib/components/ticketBooking/index.js +13 -4
  238. package/lib/components/workSpaceList/components/Modal/index.d.ts +1 -0
  239. package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
  240. package/lowcode/ticket-booking/meta.ts +26 -0
  241. package/package.json +2 -2
@@ -25,7 +25,7 @@ export declare const calculateSubtotal: (items: CartItem[]) => string;
25
25
  * @return {*}
26
26
  * @Author: xiangfeng.xue
27
27
  */
28
- export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => "0.00" | Decimal;
28
+ export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => Decimal | "0.00";
29
29
  /**
30
30
  * 计算所有价格明细
31
31
  * @param items - 购物车商品数组
@@ -29,7 +29,8 @@ var ContinueButton = function ContinueButton(_ref) {
29
29
  appointmentBooking = _useAppointmentBookin3.appointmentBooking,
30
30
  setCarts = _useAppointmentBookin3.setCarts,
31
31
  loading = _useAppointmentBookin3.loading,
32
- setIsErrorHolder = _useAppointmentBookin3.setIsErrorHolder;
32
+ setIsErrorHolder = _useAppointmentBookin3.setIsErrorHolder,
33
+ isLastStep = _useAppointmentBookin3.isLastStep;
33
34
  var _useAppointmentBookin4 = useAppointmentBookingSetting(),
34
35
  isFormSubject = _useAppointmentBookin4.isFormSubject;
35
36
  var stepList = useMemo(function () {
@@ -37,19 +38,6 @@ var ContinueButton = function ContinueButton(_ref) {
37
38
  return 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;
38
39
  }, [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]);
39
40
 
40
- /**
41
- * @title: 清空数据
42
- * @description:
43
- * @return {*}
44
- * @Author: WangHan
45
- * @Date: 2025-04-16 17:55
46
- */
47
- var clearData = function clearData() {
48
- var _shopDiscount$destroy;
49
- appointmentBooking.destroy();
50
- shopDiscount === null || shopDiscount === void 0 || (_shopDiscount$destroy = shopDiscount.destroy) === null || _shopDiscount$destroy === void 0 || _shopDiscount$destroy.call(shopDiscount);
51
- };
52
-
53
41
  /**
54
42
  * @title: 检测holder主体数据是否选择
55
43
  * @description:
@@ -164,12 +152,12 @@ var ContinueButton = function ContinueButton(_ref) {
164
152
  * @Date: 2025-01-17 16:10
165
153
  */
166
154
  var continueText = useMemo(function () {
167
- if ((currentStep === null || currentStep === void 0 ? void 0 : currentStep.index) + 1 === (stepList === null || stepList === void 0 ? void 0 : stepList.length)) {
155
+ if (isLastStep) {
168
156
  return locales.getText('pisell2.event.checkout');
169
157
  } else {
170
158
  return locales.getText('pisell2.event.close.continue');
171
159
  }
172
- }, [currentStep === null || currentStep === void 0 ? void 0 : currentStep.index, stepList]);
160
+ }, [isLastStep]);
173
161
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
174
162
  disabled: !(carts !== null && carts !== void 0 && carts.length),
175
163
  size: "large",
@@ -19,7 +19,6 @@ var Total = function Total(_ref) {
19
19
  isPriceIncludeTax = summary.isPriceIncludeTax,
20
20
  total = summary.total,
21
21
  deposit = summary.deposit;
22
- console.log(summary, 'summarysummary');
23
22
  return /*#__PURE__*/React.createElement("div", {
24
23
  className: "appointment-total-wrap ".concat(className, " ").concat(deposit !== null && deposit !== void 0 && deposit.hasDeposit ? 'appointment-total-deposit-wrap' : '')
25
24
  }, !isPriceIncludeTax && Number(totalTaxFee) > 0 ? /*#__PURE__*/React.createElement("div", {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const CartItem: ({ onNext }: any) => JSX.Element;
4
3
  export default CartItem;
@@ -19,9 +19,10 @@ import VoucherCard from "../../Voucher";
19
19
  import Total from "./Total";
20
20
  import Deposit from "../../Deposit";
21
21
  import useEngineContext from "../../../../../hooks/useEngineContext";
22
+ import { handleAddHolder } from "../utils";
22
23
  import "./index.less";
23
24
  var CartItem = function CartItem(_ref) {
24
- var _context$appHelper, _businessUtils$getApp, _currentStep$step, _currentStep$step2, _currentStep$step3;
25
+ var _context$appHelper, _businessUtils$getApp, _currentStep$step, _currentStep$step2;
25
26
  var onNext = _ref.onNext;
26
27
  var appointmentBooking = useAppointmentBooking();
27
28
  var _useAppointmentBookin = useAppointmentBookingContext(),
@@ -31,7 +32,7 @@ var CartItem = function CartItem(_ref) {
31
32
  setResourceOtherParams = _useAppointmentBookin.setResourceOtherParams,
32
33
  resourceOtherParams = _useAppointmentBookin.resourceOtherParams,
33
34
  summary = _useAppointmentBookin.summary,
34
- stepParams = _useAppointmentBookin.stepParams;
35
+ isLastStep = _useAppointmentBookin.isLastStep;
35
36
  var _useAppointmentBookin2 = useAppointmentBookingAccount(),
36
37
  accountLists = _useAppointmentBookin2.accountLists,
37
38
  getHolders = _useAppointmentBookin2.getHolders,
@@ -40,7 +41,8 @@ var CartItem = function CartItem(_ref) {
40
41
  var _useAppointmentBookin3 = useAppointmentBookingResource(),
41
42
  getResourceList = _useAppointmentBookin3.getResourceList;
42
43
  var _useAppointmentBookin4 = useAppointmentBookingSetting(),
43
- isFormSubject = _useAppointmentBookin4.isFormSubject;
44
+ isFormSubject = _useAppointmentBookin4.isFormSubject,
45
+ bookingSubject = _useAppointmentBookin4.bookingSubject;
44
46
  var _useAppointmentBookin5 = useAppointmentBookingLogin(),
45
47
  isLogin = _useAppointmentBookin5.isLogin;
46
48
  var context = useEngineContext();
@@ -125,8 +127,10 @@ var CartItem = function CartItem(_ref) {
125
127
 
126
128
  // 添加holder
127
129
  if (type === 'add_holder') {
130
+ // 关联的表单id
131
+ var relationShipFormId = bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.relationship_form_id;
128
132
  return openForm({
129
- form_id: form_id,
133
+ form_id: relationShipFormId || (bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_id),
130
134
  title: locales.getText('pisell2.event.create.form'),
131
135
  utils: utils,
132
136
  callback: function () {
@@ -136,18 +140,41 @@ var CartItem = function CartItem(_ref) {
136
140
  while (1) switch (_context.prev = _context.next) {
137
141
  case 0:
138
142
  if (!((res === null || res === void 0 ? void 0 : res.status) === 'success')) {
139
- _context.next = 5;
143
+ _context.next = 12;
140
144
  break;
141
145
  }
142
- _context.next = 3;
146
+ result = undefined; // 未关联表,则将接口返回的数据作为holder数据
147
+ if (relationShipFormId) {
148
+ _context.next = 8;
149
+ break;
150
+ }
151
+ _context.next = 5;
143
152
  return addAccount(res === null || res === void 0 ? void 0 : res.values, 'holder');
144
- case 3:
153
+ case 5:
145
154
  result = _context.sent;
146
- appointmentBooking.updateCart({
147
- _id: e === null || e === void 0 ? void 0 : e._id,
148
- account: result
155
+ _context.next = 11;
156
+ break;
157
+ case 8:
158
+ _context.next = 10;
159
+ return handleAddHolder({
160
+ res: res,
161
+ bookingSubject: bookingSubject,
162
+ accountLists: accountLists,
163
+ cartItem: e,
164
+ getHolders: getHolders,
165
+ appointmentBooking: appointmentBooking
149
166
  });
150
- case 5:
167
+ case 10:
168
+ result = _context.sent;
169
+ case 11:
170
+ // 更新购物车的holder数据
171
+ if (result) {
172
+ appointmentBooking.updateCart({
173
+ _id: e === null || e === void 0 ? void 0 : e._id,
174
+ account: result
175
+ });
176
+ }
177
+ case 12:
151
178
  case "end":
152
179
  return _context.stop();
153
180
  }
@@ -170,11 +197,11 @@ var CartItem = function CartItem(_ref) {
170
197
  products: formatCarts(carts, resources, accountLists),
171
198
  hideAddBtn: false,
172
199
  holders: holders,
173
- disabledEdit: stepParams === null || stepParams === void 0 ? void 0 : stepParams.isLastStep,
200
+ disabledEdit: isLastStep,
174
201
  isShowChangeResource: (currentStep === null || currentStep === void 0 || (_currentStep$step = currentStep.step) === null || _currentStep$step === void 0 ? void 0 : _currentStep$step.key) === 'select-resource',
175
202
  isShowDelete: (currentStep === null || currentStep === void 0 || (_currentStep$step2 = currentStep.step) === null || _currentStep$step2 === void 0 ? void 0 : _currentStep$step2.key) === 'select-service',
176
203
  isShowPackageNote: false,
177
- isShowChangeHolder: (currentStep === null || currentStep === void 0 || (_currentStep$step3 = currentStep.step) === null || _currentStep$step3 === void 0 ? void 0 : _currentStep$step3.key) === 'confirm-information' ? false : isFormSubject && isLogin,
204
+ isShowChangeHolder: isLastStep ? false : isFormSubject && isLogin,
178
205
  isShowHolder: isFormSubject,
179
206
  isShowAddHolderButton: true
180
207
  },
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Cart: ({ open, onCancel, onNext }: any) => JSX.Element;
3
4
  export default Cart;
@@ -33,4 +33,24 @@ interface CheckResourceParams {
33
33
  carts: any[];
34
34
  }
35
35
  export declare type StepKey = 'select-resource' | 'fill-form' | 'select-time' | 'confirm-information' | 'select-service' | 'select-date' | 'select-guest';
36
+ interface AddHolderParams {
37
+ res: any;
38
+ bookingSubject: any;
39
+ accountLists: any[];
40
+ cartItem: any;
41
+ getHolders: () => void;
42
+ appointmentBooking: any;
43
+ }
44
+ /**
45
+ * @title: 添加holder
46
+ * @description:
47
+ * @param {any} res
48
+ * @param {any} bookingSubject
49
+ * @param {any} accountLists
50
+ * @param {any} e
51
+ * @return {*}
52
+ * @Author: WangHan
53
+ * @Date: 2025-05-10 18:25
54
+ */
55
+ export declare const handleAddHolder: ({ res, bookingSubject, accountLists, cartItem, getHolders, appointmentBooking }: AddHolderParams) => Promise<any>;
36
56
  export {};
@@ -1,4 +1,10 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
2
8
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
9
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
10
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -101,4 +107,64 @@ export var checkResource = function checkResource(_ref4) {
101
107
  return false;
102
108
  };
103
109
 
104
- // 定义步骤 key 类型
110
+ // 定义步骤 key 类型
111
+
112
+ /**
113
+ * @title: 添加holder
114
+ * @description:
115
+ * @param {any} res
116
+ * @param {any} bookingSubject
117
+ * @param {any} accountLists
118
+ * @param {any} e
119
+ * @return {*}
120
+ * @Author: WangHan
121
+ * @Date: 2025-05-10 18:25
122
+ */
123
+ export var handleAddHolder = /*#__PURE__*/function () {
124
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref5) {
125
+ var res, bookingSubject, accountLists, cartItem, getHolders, appointmentBooking, _res$values, result, relationShipForms, currentForm, form_record_id, oldAccount, newAccountLists, newAccount;
126
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
127
+ while (1) switch (_context2.prev = _context2.next) {
128
+ case 0:
129
+ res = _ref5.res, bookingSubject = _ref5.bookingSubject, accountLists = _ref5.accountLists, cartItem = _ref5.cartItem, getHolders = _ref5.getHolders, appointmentBooking = _ref5.appointmentBooking;
130
+ _context2.prev = 1;
131
+ result = undefined; // 所有被关联的表数据
132
+ relationShipForms = (res === null || res === void 0 || (_res$values = res.values) === null || _res$values === void 0 ? void 0 : _res$values.form_to_form_value) || []; // 找到当前的表数据
133
+ currentForm = relationShipForms.find(function (item) {
134
+ return item.form_id === (bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_id);
135
+ }); // 找到当前新创建的表
136
+ form_record_id = Math.max.apply(Math, _toConsumableArray((currentForm === null || currentForm === void 0 ? void 0 : currentForm.form_data_value) || []));
137
+ oldAccount = accountLists.find(function (item) {
138
+ return item.id === form_record_id;
139
+ }); // 重新获取holder列表
140
+ _context2.next = 9;
141
+ return getHolders();
142
+ case 9:
143
+ _context2.next = 11;
144
+ return appointmentBooking.getAccounts();
145
+ case 11:
146
+ newAccountLists = _context2.sent;
147
+ // 编辑已有的表单, 判断当前购物车中是否有holder数据,没有则更新列表的第一条数据
148
+ if (oldAccount) {
149
+ result = !(cartItem !== null && cartItem !== void 0 && cartItem.holder_id) ? _objectSpread({}, accountLists === null || accountLists === void 0 ? void 0 : accountLists[0]) : undefined;
150
+ } else {
151
+ // 创建表单
152
+ newAccount = newAccountLists.find(function (item) {
153
+ return item.id === form_record_id;
154
+ });
155
+ result = _objectSpread({}, newAccount || (newAccountLists === null || newAccountLists === void 0 ? void 0 : newAccountLists[0]));
156
+ }
157
+ return _context2.abrupt("return", result);
158
+ case 16:
159
+ _context2.prev = 16;
160
+ _context2.t0 = _context2["catch"](1);
161
+ case 18:
162
+ case "end":
163
+ return _context2.stop();
164
+ }
165
+ }, _callee2, null, [[1, 16]]);
166
+ }));
167
+ return function handleAddHolder(_x2) {
168
+ return _ref6.apply(this, arguments);
169
+ };
170
+ }();
@@ -53,7 +53,6 @@ var ConfirmInformation = /*#__PURE__*/forwardRef(function (props, ref) {
53
53
  var _utils$history;
54
54
  var url = "/payment-finish/success?order_id=".concat(order_id, "&amount=").concat(Number(amount));
55
55
  utils === null || utils === void 0 || (_utils$history = utils.history) === null || _utils$history === void 0 || _utils$history.replace(url);
56
- clearData();
57
56
  setLoading(false);
58
57
  };
59
58
 
@@ -96,10 +95,10 @@ var ConfirmInformation = /*#__PURE__*/forwardRef(function (props, ref) {
96
95
  type: 'pisell1.payment',
97
96
  data: _objectSpread(_objectSpread({}, data), {}, {
98
97
  total_amount: _total
99
- })
98
+ }),
99
+ callback: function callback(e) {}
100
100
  });
101
101
  setTimeout(function () {
102
- clearData();
103
102
  setLoading(false);
104
103
  }, 200);
105
104
  _context.next = 24;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const Layout: () => JSX.Element;
4
3
  export default Layout;
@@ -23,10 +23,11 @@ import Guest from "../Guest";
23
23
  import Form from "../Form";
24
24
  import ConfirmInformation from "../ConfirmInformation";
25
25
  import { useAppointmentBookingContext } from "../../context";
26
- import { useAppointmentBookingCart, useAppointmentBookingStep, useAppointmentBookingSetting, useAppointmentBookingLogin, useAppointmentBookingAccount } from "../../hooks";
26
+ import PolicyModal from "../../deposit/components/PolicyModal";
27
+ import { useAppointmentBookingCart, useAppointmentBookingStep, useAppointmentBookingSetting, useAppointmentBookingLogin, useAppointmentBookingAccount, useShopDiscount } from "../../hooks";
27
28
  import "./index.less";
28
29
  var Layout = function Layout() {
29
- var _currentStep$step, _currentStep$step3, _currentStep$step4, _currentStep$step6, _currentStep$step7;
30
+ var _currentStep$step, _currentStep$step3, _currentStep$step4, _currentStep$step6, _currentStep$step8;
30
31
  var stepRef = useRef();
31
32
  var formRef = useRef();
32
33
  var _useAppointmentBookin = useAppointmentBookingContext(),
@@ -47,17 +48,30 @@ var Layout = function Layout() {
47
48
  var _useAppointmentBookin5 = useAppointmentBookingStep(),
48
49
  removeStep = _useAppointmentBookin5.removeStep,
49
50
  stepList = _useAppointmentBookin5.stepList;
51
+ var _useShopDiscount = useShopDiscount(),
52
+ shopDiscount = _useShopDiscount.shopDiscount;
53
+ var _useState = useState(false),
54
+ _useState2 = _slicedToArray(_useState, 2),
55
+ showAgreement = _useState2[0],
56
+ setShowAgreement = _useState2[1];
57
+ var _useState3 = useState({}),
58
+ _useState4 = _slicedToArray(_useState3, 2),
59
+ agreementContent = _useState4[0],
60
+ setAgreementContent = _useState4[1];
50
61
 
51
62
  // 不要删除
52
63
  useAppointmentBookingCart();
53
64
  useAppointmentBookingStep();
54
- var _useState = useState({}),
55
- _useState2 = _slicedToArray(_useState, 2),
56
- params = _useState2[0],
57
- setParams = _useState2[1];
65
+ var _useState5 = useState({}),
66
+ _useState6 = _slicedToArray(_useState5, 2),
67
+ params = _useState6[0],
68
+ setParams = _useState6[1];
58
69
  useEffect(function () {
59
70
  return function () {
71
+ var _shopDiscount$destroy;
60
72
  setIsAgreeDepositPolicy(false);
73
+ appointmentBooking.destroy();
74
+ shopDiscount === null || shopDiscount === void 0 || (_shopDiscount$destroy = shopDiscount.destroy) === null || _shopDiscount$destroy === void 0 || _shopDiscount$destroy.call(shopDiscount);
61
75
  };
62
76
  }, []);
63
77
  useEffect(function () {
@@ -162,17 +176,46 @@ var Layout = function Layout() {
162
176
  }
163
177
  }));
164
178
  }, [isDateSelectedFirst, currentStep === null || currentStep === void 0 || (_currentStep$step6 = currentStep.step) === null || _currentStep$step6 === void 0 ? void 0 : _currentStep$step6.key]);
179
+
180
+ /**
181
+ * @title: 是否显示底部
182
+ * @description:
183
+ * @param {*} useMemo
184
+ * @return {*}
185
+ * @Author: WangHan
186
+ * @Date: 2025-05-10 17:42
187
+ */
188
+ var isFooter = useMemo(function () {
189
+ var _currentStep$step7;
190
+ if (!isMobile()) return false;
191
+ var key = currentStep === null || currentStep === void 0 || (_currentStep$step7 = currentStep.step) === null || _currentStep$step7 === void 0 ? void 0 : _currentStep$step7.key;
192
+
193
+ // 先选日期并且当前步骤是选择日期,则不显示底部
194
+ if (isDateSelectedFirst && key === 'select-date') return false;
195
+ return key !== 'confirm-information';
196
+ }, [isDateSelectedFirst, currentStep === null || currentStep === void 0 || (_currentStep$step8 = currentStep.step) === null || _currentStep$step8 === void 0 ? void 0 : _currentStep$step8.key]);
197
+ var handleAgreementOk = function handleAgreementOk() {
198
+ setShowAgreement(false);
199
+ // goToNextForm();
200
+ };
165
201
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement("div", {
166
202
  className: "parallel-content-wrap ".concat(isMobile() ? 'parallel-content-mobile-wrap' : '')
167
203
  }, /*#__PURE__*/React.createElement("div", {
168
204
  className: "parallel-content-left"
169
- }, Com), isShowCartCom), isMobile() && (currentStep === null || currentStep === void 0 || (_currentStep$step7 = currentStep.step) === null || _currentStep$step7 === void 0 ? void 0 : _currentStep$step7.key) !== 'confirm-information' ? /*#__PURE__*/React.createElement(Footer
205
+ }, Com), isShowCartCom), isFooter ? /*#__PURE__*/React.createElement(Footer
170
206
  // isOpen={params?.isOpen}
171
207
  , {
172
208
  onNext: function onNext() {
173
209
  var _stepRef$current2, _stepRef$current2$nex;
174
210
  return stepRef === null || stepRef === void 0 || (_stepRef$current2 = stepRef.current) === null || _stepRef$current2 === void 0 || (_stepRef$current2$nex = _stepRef$current2.next) === null || _stepRef$current2$nex === void 0 ? void 0 : _stepRef$current2$nex.call(_stepRef$current2);
175
211
  }
212
+ }) : null, showAgreement ? /*#__PURE__*/React.createElement(PolicyModal, {
213
+ open: showAgreement,
214
+ onCancel: handleAgreementOk,
215
+ item: agreementContent,
216
+ onChange: function onChange() {
217
+ return setLoading(false);
218
+ }
176
219
  }) : null);
177
220
  };
178
221
  export default Layout;
@@ -69,6 +69,12 @@ var Date = /*#__PURE__*/forwardRef(function (props, ref) {
69
69
  }
70
70
  return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.unselect.date')));
71
71
  case 5:
72
+ // 判断选定的日期是否存在可用的预约
73
+ // const result = appointmentBooking.checkResourceListForDate();
74
+ // if (!result) {
75
+ // return Toast(locales.getText('pisell2.appointment.unuse.date'));
76
+ // }
77
+
72
78
  appointmentBooking.next();
73
79
  case 6:
74
80
  case "end":
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Deposit: () => JSX.Element;
3
4
  export default Deposit;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Footer: ({ onNext, isOpen }: any) => JSX.Element;
3
4
  export default Footer;
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
10
10
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
11
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import React, { useMemo, useRef, useState, useImperativeHandle, forwardRef } from 'react';
13
+ import React, { useMemo, useRef, useState, useImperativeHandle, forwardRef, useEffect } from 'react';
14
14
  import useComponents from "../../../../hooks/useComponents";
15
15
  import { formatForms, formatCarts, updateLists, updateBookingFormStorage } from "../../utils";
16
16
  import { useAppointmentBookingContext } from "../../context";
@@ -35,6 +35,14 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
35
35
  _useState8 = _slicedToArray(_useState7, 2),
36
36
  formStatus = _useState8[0],
37
37
  setFormStatus = _useState8[1];
38
+ var _useState9 = useState(false),
39
+ _useState10 = _slicedToArray(_useState9, 2),
40
+ isClearData = _useState10[0],
41
+ setIsClearData = _useState10[1];
42
+ var _useState11 = useState(0),
43
+ _useState12 = _slicedToArray(_useState11, 2),
44
+ formId = _useState12[0],
45
+ setFormId = _useState12[1];
38
46
  var _useAppointmentBookin = useAppointmentBookingContext(),
39
47
  carts = _useAppointmentBookin.carts,
40
48
  appointmentBooking = _useAppointmentBookin.appointmentBooking,
@@ -55,6 +63,9 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
55
63
  });
56
64
  var key = 'booking_form';
57
65
 
66
+ // 获取本地存储
67
+ var formStorage = getOtherData('booking_form') || {};
68
+
58
69
  /**
59
70
  * @title: 获取资源列表
60
71
  * @description:
@@ -67,25 +78,15 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
67
78
  var _resource = getResourceList();
68
79
  return (_resource === null || _resource === void 0 ? void 0 : _resource.resources) || [];
69
80
  }, []);
70
-
71
- /**
72
- * @title: 获取本地存储表单
73
- * @description:
74
- * @param {*} useMemo
75
- * @return {*}
76
- * @Author: WangHan
77
- * @Date: 2025-05-06 10:00
78
- */
79
- var formStorage = useMemo(function () {
80
- return getOtherData(key);
81
- }, []);
82
81
  var newCarts = formatCarts(carts, resources);
83
82
  var forms = useMemo(function () {
84
83
  if (!(newCarts !== null && newCarts !== void 0 && newCarts.length) || !(resources !== null && resources !== void 0 && resources.length)) return [];
85
84
  return formatForms(newCarts) || [];
86
85
  }, [newCarts, resources]);
87
- var currentForm = useMemo(function () {
88
- return forms === null || forms === void 0 ? void 0 : forms[currentFormIndex];
86
+ useEffect(function () {
87
+ var _forms$currentFormInd;
88
+ if (!(forms !== null && forms !== void 0 && forms.length)) return;
89
+ setFormId((forms === null || forms === void 0 || (_forms$currentFormInd = forms[currentFormIndex]) === null || _forms$currentFormInd === void 0 ? void 0 : _forms$currentFormInd.form_id) || 0);
89
90
  }, [forms, currentFormIndex]);
90
91
  var _useComponents = useComponents({
91
92
  components: ['FormCard']
@@ -104,7 +105,9 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
104
105
  var nextIndex = currentFormIndex + 1;
105
106
  if (nextIndex < forms.length) {
106
107
  var _forms$nextIndex, _forms$nextIndex2;
108
+ setIsClearData(true);
107
109
  setCurrentFormIndex(nextIndex);
110
+
108
111
  // 如果下一个表单没有id但有协议,直接弹协议
109
112
  if (!(forms !== null && forms !== void 0 && (_forms$nextIndex = forms[nextIndex]) !== null && _forms$nextIndex !== void 0 && _forms$nextIndex.form_id) && forms !== null && forms !== void 0 && (_forms$nextIndex2 = forms[nextIndex]) !== null && _forms$nextIndex2 !== void 0 && _forms$nextIndex2.policy_id) {
110
113
  var _forms$nextIndex3;
@@ -113,6 +116,8 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
113
116
  id: forms === null || forms === void 0 || (_forms$nextIndex3 = forms[nextIndex]) === null || _forms$nextIndex3 === void 0 ? void 0 : _forms$nextIndex3.policy_id
114
117
  });
115
118
  setShowAgreement(true);
119
+ } else {
120
+ setLoading(false);
116
121
  }
117
122
  } else {
118
123
  appointmentBooking.next();
@@ -131,7 +136,7 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
131
136
  if (status === 'error') {
132
137
  setLoading(false);
133
138
  }
134
- var newFormStatus = updateLists(formStatus, 'id', currentForm === null || currentForm === void 0 ? void 0 : currentForm.form_id, {
139
+ var newFormStatus = updateLists(formStatus, 'id', formId, {
135
140
  status: status
136
141
  });
137
142
  setFormStatus(newFormStatus);
@@ -146,16 +151,18 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
146
151
  * @Date: 2025-04-28 11:32
147
152
  */
148
153
  var setFormStorage = function setFormStorage(values) {
154
+ var _forms$currentFormInd2;
155
+ var cart_id = forms === null || forms === void 0 || (_forms$currentFormInd2 = forms[currentFormIndex]) === null || _forms$currentFormInd2 === void 0 ? void 0 : _forms$currentFormInd2.cart_id;
149
156
  var oldData = getOtherData(key);
150
- var newData = updateBookingFormStorage(oldData, currentForm === null || currentForm === void 0 ? void 0 : currentForm.id, values);
157
+ var newData = updateBookingFormStorage(oldData, cart_id, values);
151
158
  setOtherData(key, _objectSpread({}, newData));
152
159
 
153
160
  // 更新表单购物车
154
161
  appointmentBooking.updateCart({
155
- _id: currentForm === null || currentForm === void 0 ? void 0 : currentForm.cart_id,
162
+ _id: cart_id,
156
163
  relationForms: [{
157
- form_id: currentForm === null || currentForm === void 0 ? void 0 : currentForm.form_id,
158
- form_record_ids: [currentForm === null || currentForm === void 0 ? void 0 : currentForm.id]
164
+ form_id: formId,
165
+ form_record_ids: [values === null || values === void 0 ? void 0 : values.form_record_id]
159
166
  }]
160
167
  });
161
168
  };
@@ -170,14 +177,17 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
170
177
  * @Date: 2025-04-28 11:34
171
178
  */
172
179
  var handleFormFinish = function handleFormFinish(status, values) {
180
+ setIsClearData(false);
173
181
  updateFormStatus(status);
174
182
  if (status === 'success') {
183
+ var _forms$currentFormInd3;
175
184
  setFormStorage(values);
176
185
 
177
186
  // 判断当前表单是否有协议
178
- if (currentForm !== null && currentForm !== void 0 && currentForm.policy_id) {
187
+ if (forms !== null && forms !== void 0 && (_forms$currentFormInd3 = forms[currentFormIndex]) !== null && _forms$currentFormInd3 !== void 0 && _forms$currentFormInd3.policy_id) {
188
+ var _forms$currentFormInd4;
179
189
  setAgreementContent({
180
- id: currentForm.policy_id
190
+ id: forms === null || forms === void 0 || (_forms$currentFormInd4 = forms[currentFormIndex]) === null || _forms$currentFormInd4 === void 0 ? void 0 : _forms$currentFormInd4.policy_id
181
191
  });
182
192
  setShowAgreement(true);
183
193
  } else {
@@ -189,33 +199,35 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
189
199
  setShowAgreement(false);
190
200
  goToNextForm();
191
201
  };
192
- return /*#__PURE__*/React.createElement(React.Fragment, null, currentForm !== null && currentForm !== void 0 && currentForm.form_id ? /*#__PURE__*/React.createElement("div", {
193
- className: "appointment-form-wrap"
194
- }, /*#__PURE__*/React.createElement(FormCard, {
195
- id: currentForm === null || currentForm === void 0 ? void 0 : currentForm.form_id,
196
- ref: manualRef,
197
- isGetLastData: false,
198
- setting: {
199
- isHidden: 1
200
- },
201
- formWrapStyle: {
202
- padding: '16px'
203
- },
204
- isV2API: true,
205
- isShowSkeleton: true,
206
- onSubmit: function onSubmit(status, values) {
207
- handleFormFinish(status, values);
208
- },
209
- onFinishFailed: function onFinishFailed(e) {
210
- console.log(e, 'updateFormStatus');
211
- updateFormStatus('error');
212
- },
213
- onFormValueChange: function onFormValueChange(values) {
214
- console.log(values, 'onFormValueChange');
215
- },
216
- defaultValues: (formStorage === null || formStorage === void 0 ? void 0 : formStorage[currentForm === null || currentForm === void 0 ? void 0 : currentForm.id]) || {},
217
- isClearData: !(formStorage !== null && formStorage !== void 0 && formStorage[currentForm === null || currentForm === void 0 ? void 0 : currentForm.id])
218
- })) : null, showAgreement ? /*#__PURE__*/React.createElement(PolicyModal, {
202
+ var formCom = useMemo(function () {
203
+ var _forms$currentFormInd5;
204
+ if (!formId) return;
205
+ return /*#__PURE__*/React.createElement("div", {
206
+ className: "appointment-form-wrap"
207
+ }, /*#__PURE__*/React.createElement(FormCard, {
208
+ id: formId,
209
+ ref: manualRef,
210
+ isGetLastData: false,
211
+ setting: {
212
+ isHidden: 1
213
+ },
214
+ formWrapStyle: {
215
+ padding: '16px'
216
+ },
217
+ isV2API: true,
218
+ isShowSkeleton: true,
219
+ onSubmit: function onSubmit(status, values) {
220
+ handleFormFinish(status, values);
221
+ },
222
+ onFinishFailed: function onFinishFailed(e) {
223
+ updateFormStatus('error');
224
+ },
225
+ onFormValueChange: function onFormValueChange(values) {},
226
+ defaultValues: (formStorage === null || formStorage === void 0 ? void 0 : formStorage[forms === null || forms === void 0 || (_forms$currentFormInd5 = forms[currentFormIndex]) === null || _forms$currentFormInd5 === void 0 ? void 0 : _forms$currentFormInd5.cart_id]) || {},
227
+ isClearData: false
228
+ }));
229
+ }, [currentFormIndex, formId]);
230
+ return /*#__PURE__*/React.createElement(React.Fragment, null, formCom, showAgreement ? /*#__PURE__*/React.createElement(PolicyModal, {
219
231
  open: showAgreement,
220
232
  onCancel: handleAgreementOk,
221
233
  item: agreementContent,
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const GuestOptionsModal: (props: any) => JSX.Element;
3
4
  export default GuestOptionsModal;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const Header: () => JSX.Element;
4
3
  export default Header;