@pisell/private-materials 6.5.27 → 6.6.2

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 (340) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +146 -165
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -1
  12. package/es/components/appointmentBooking/components/Cart/Item/index.js +4 -2
  13. package/es/components/appointmentBooking/components/ConfirmInformation/index.js +273 -76
  14. package/es/components/appointmentBooking/components/ConfirmInformation/index.less +15 -0
  15. package/es/components/appointmentBooking/hooks.d.ts +1 -0
  16. package/es/components/appointmentBooking/hooks.js +30 -30
  17. package/es/components/appointmentBooking/locales.d.ts +3 -0
  18. package/es/components/appointmentBooking/locales.js +9 -6
  19. package/es/components/booking/components/actionButtons/index.js +34 -20
  20. package/es/components/booking/components/customSelect/index.js +1 -1
  21. package/es/components/booking/components/footer/amount.js +25 -8
  22. package/es/components/booking/components/footer/index.js +66 -33
  23. package/es/components/booking/components/footer/utils.d.ts +7 -0
  24. package/es/components/booking/components/footer/utils.js +126 -99
  25. package/es/components/booking/components/voucher/index.js +25 -9
  26. package/es/components/booking/dashboard/serve.js +1 -6
  27. package/es/components/booking/forms/footer.js +24 -10
  28. package/es/components/booking/forms/serve.js +2 -12
  29. package/es/components/booking/hooks/useQuotation.js +69 -21
  30. package/es/components/booking/info/client/index.js +28 -13
  31. package/es/components/booking/info/client/serve.js +2 -11
  32. package/es/components/booking/info/clientVariant/hooks/useClientFn.js +16 -10
  33. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +10 -2
  34. package/es/components/booking/info/clientVariant/vertical/index.js +1 -1
  35. package/es/components/booking/info/hooks/useHolderConfig.d.ts +1 -0
  36. package/es/components/booking/info/hooks/useHolderConfig.js +9 -2
  37. package/es/components/booking/info/main.js +3 -2
  38. package/es/components/booking/info/model.js +5 -0
  39. package/es/components/booking/info/pet/serve.js +1 -6
  40. package/es/components/booking/info/service/Lists.d.ts +1 -1
  41. package/es/components/booking/info/service/Lists.js +10 -4
  42. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  43. package/es/components/booking/info/service/addTimeModal/serve.js +1 -11
  44. package/es/components/booking/info/service/serve.d.ts +14 -0
  45. package/es/components/booking/info/service/serve.js +25 -18
  46. package/es/components/booking/info/service2/Group/utils.js +2 -0
  47. package/es/components/booking/info/service2/utils.d.ts +1 -33
  48. package/es/components/booking/info/service2/utils.js +92 -56
  49. package/es/components/booking/info/utils.js +5 -0
  50. package/es/components/booking/info2/cartClientCard/index.js +49 -9
  51. package/es/components/booking/info2/index.js +3 -2
  52. package/es/components/booking/info2/serve.js +1 -6
  53. package/es/components/booking/info2/service/addService/index.js +146 -89
  54. package/es/components/booking/info2/service/addService/utils.d.ts +9 -1
  55. package/es/components/booking/info2/service/addService/utils.js +83 -14
  56. package/es/components/booking/info2/service/contactInfoMode/index.d.ts +2 -0
  57. package/es/components/booking/info2/service/contactInfoMode/index.js +94 -0
  58. package/es/components/booking/info2/service/editService/Holder/index.d.ts +12 -0
  59. package/es/components/booking/info2/service/editService/Holder/index.js +193 -0
  60. package/es/components/booking/info2/service/editService/Holder/index.less +63 -0
  61. package/es/components/booking/info2/service/editService/index.js +313 -57
  62. package/es/components/booking/info2/utilsByBooking.js +19 -14
  63. package/es/components/booking/locales.d.ts +36 -0
  64. package/es/components/booking/locales.js +48 -3
  65. package/es/components/booking/model.d.ts +4 -0
  66. package/es/components/booking/model.js +3 -0
  67. package/es/components/booking/utils/confirmHolderModal.d.ts +13 -0
  68. package/es/components/booking/utils/confirmHolderModal.js +318 -0
  69. package/es/components/booking/utils/confirmHolderModal.less +40 -0
  70. package/es/components/booking/utils/selectHolderModal.d.ts +24 -0
  71. package/es/components/booking/utils/selectHolderModal.js +407 -0
  72. package/es/components/booking/utils.d.ts +16 -7
  73. package/es/components/booking/utils.js +26 -37
  74. package/es/components/checkout/PaymentModal.js +61 -30
  75. package/es/components/checkout/components/CashPaymentModule/index.js +1 -7
  76. package/es/components/checkout/components/ScrollableList/index.js +0 -1
  77. package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
  78. package/es/components/checkout/locales.d.ts +3 -0
  79. package/es/components/checkout/locales.js +3 -0
  80. package/es/components/eftposPay/linkly/index.js +64 -2
  81. package/es/components/eftposPay/tyro/index.js +12 -0
  82. package/es/components/list/List.js +3 -0
  83. package/es/components/pay/toB/components/MX51/index.js +14 -44
  84. package/es/components/pay/toB/types/index.d.ts +0 -12
  85. package/es/components/pay/toB/types/index.js +0 -4
  86. package/es/components/pisellSelectCustomerModal/RightPanel/serve.js +1 -5
  87. package/es/components/shoppingCart/components/Cart/Product.js +6 -3
  88. package/es/components/shoppingCart/type.d.ts +1 -0
  89. package/es/components/ticketBooking/components/ProductDisplayAdapter/index.less +0 -12
  90. package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.d.ts +18 -0
  91. package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.js +119 -0
  92. package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.less +0 -0
  93. package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -2
  94. package/es/components/ticketBooking/components/addServiceVariant/addService.js +421 -794
  95. package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -2
  96. package/es/components/ticketBooking/components/addServiceVariant/index.js +4 -4
  97. package/es/components/ticketBooking/components/addServiceVariant/utils.js +1 -2
  98. package/es/components/ticketBooking/components/menuBar/index.js +109 -12
  99. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +2 -4
  100. package/es/components/ticketBooking/components/ticketBooking/index.js +32 -61
  101. package/es/components/ticketBooking/components/ticketBooking/index.less +2 -1
  102. package/es/components/ticketBooking/components/timeBar/index.d.ts +0 -1
  103. package/es/components/ticketBooking/components/timeBar/index.js +1 -4
  104. package/es/components/ticketBooking/hooks/pisellos/useProducts.d.ts +0 -4
  105. package/es/components/ticketBooking/hooks/pisellos/useProducts.js +122 -170
  106. package/es/components/ticketBooking/index.d.ts +0 -1
  107. package/es/components/ticketBooking/index.js +0 -2
  108. package/es/components/ticketBooking/serve.js +17 -119
  109. package/es/components/ticketBooking/utils/index.d.ts +7 -1
  110. package/es/components/ticketBooking/utils/index.js +44 -28
  111. package/es/hooks/useEngineContext.d.ts +0 -1
  112. package/es/hooks/useEngineContext.js +0 -7
  113. package/es/index.d.ts +4 -0
  114. package/es/index.js +5 -1
  115. package/es/plus/clientCard/locales.js +3 -3
  116. package/es/plus/clinetSearch/index.js +28 -30
  117. package/es/plus/clinetSearch/locales.d.ts +3 -0
  118. package/es/plus/clinetSearch/locales.js +7 -4
  119. package/es/plus/clinetSearch/types.d.ts +12 -0
  120. package/es/plus/contactInfo/components/Avatar/index.d.ts +10 -0
  121. package/es/plus/contactInfo/components/Avatar/index.js +30 -0
  122. package/es/plus/contactInfo/components/SwipeAction/index.d.ts +46 -0
  123. package/es/plus/contactInfo/components/SwipeAction/index.js +360 -0
  124. package/es/plus/contactInfo/components/SwipeAction/index.less +74 -0
  125. package/es/plus/contactInfo/index.d.ts +6 -0
  126. package/es/plus/contactInfo/index.js +198 -0
  127. package/es/plus/contactInfo/index.less +621 -0
  128. package/es/plus/contactInfo/locales.d.ts +15 -0
  129. package/es/plus/contactInfo/locales.js +14 -0
  130. package/es/plus/contactInfo/types.d.ts +91 -0
  131. package/es/plus/contactInfo/types.js +1 -0
  132. package/es/plus/contactInfo/utils.d.ts +7 -0
  133. package/es/plus/contactInfo/utils.js +50 -0
  134. package/es/plus/contactInfoModal/ContactInfoContent.d.ts +3 -0
  135. package/es/plus/contactInfoModal/ContactInfoContent.js +74 -0
  136. package/es/plus/contactInfoModal/index.d.ts +41 -0
  137. package/es/plus/contactInfoModal/index.js +155 -0
  138. package/es/plus/contactInfoModal/index.less +19 -0
  139. package/es/plus/contactInfoModal/locales.d.ts +66 -0
  140. package/es/plus/contactInfoModal/locales.js +65 -0
  141. package/es/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.js +1 -1
  142. package/es/plus/productSelect/ProductCard/index.js +1 -1
  143. package/es/plus/selectHolder/components/ErrorTip/index.d.ts +3 -0
  144. package/es/plus/selectHolder/components/ErrorTip/index.js +14 -0
  145. package/es/plus/selectHolder/components/ErrorTip/index.less +51 -0
  146. package/es/plus/selectHolder/components/HolderItem/index.d.ts +6 -0
  147. package/es/plus/selectHolder/components/HolderItem/index.js +77 -0
  148. package/es/plus/selectHolder/components/HolderItem/index.less +105 -0
  149. package/es/plus/selectHolder/components/HolderList/index.d.ts +30 -0
  150. package/es/plus/selectHolder/components/HolderList/index.js +43 -0
  151. package/es/plus/selectHolder/index.d.ts +7 -0
  152. package/es/plus/selectHolder/index.js +273 -0
  153. package/es/plus/selectHolder/index.less +137 -0
  154. package/es/plus/selectHolder/locales.d.ts +24 -0
  155. package/es/plus/selectHolder/locales.js +29 -0
  156. package/es/plus/selectHolder/types.d.ts +104 -0
  157. package/es/plus/selectHolder/types.js +1 -0
  158. package/es/plus/selectHolder/utils.d.ts +9 -0
  159. package/es/plus/selectHolder/utils.js +16 -0
  160. package/es/pro/comprehensiveSearch/components/searchSection/locales.js +3 -3
  161. package/es/pro/comprehensiveSearch/locales.js +1 -1
  162. package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.d.ts +9 -0
  163. package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.js +357 -0
  164. package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.less +8 -0
  165. package/es/pro/multiDayTimeSelect/index.d.ts +3 -0
  166. package/es/pro/multiDayTimeSelect/index.js +1 -0
  167. package/es/pro/multiDayTimeSelect/types.d.ts +28 -0
  168. package/es/pro/multiDayTimeSelect/types.js +1 -0
  169. package/es/pro/skuDetailModal/types.d.ts +1 -0
  170. package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -1
  171. package/lib/components/appointmentBooking/components/Cart/Item/index.js +6 -3
  172. package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +156 -13
  173. package/lib/components/appointmentBooking/components/ConfirmInformation/index.less +15 -0
  174. package/lib/components/appointmentBooking/hooks.d.ts +1 -0
  175. package/lib/components/appointmentBooking/hooks.js +73 -35
  176. package/lib/components/appointmentBooking/locales.d.ts +3 -0
  177. package/lib/components/appointmentBooking/locales.js +6 -3
  178. package/lib/components/booking/components/actionButtons/index.js +11 -2
  179. package/lib/components/booking/components/customSelect/index.js +1 -1
  180. package/lib/components/booking/components/footer/amount.js +23 -6
  181. package/lib/components/booking/components/footer/index.js +26 -5
  182. package/lib/components/booking/components/footer/utils.d.ts +7 -0
  183. package/lib/components/booking/components/footer/utils.js +120 -82
  184. package/lib/components/booking/components/voucher/index.js +10 -1
  185. package/lib/components/booking/dashboard/serve.js +1 -6
  186. package/lib/components/booking/forms/footer.js +29 -11
  187. package/lib/components/booking/forms/serve.js +2 -12
  188. package/lib/components/booking/hooks/useQuotation.js +45 -13
  189. package/lib/components/booking/info/client/index.js +14 -1
  190. package/lib/components/booking/info/client/serve.js +2 -13
  191. package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +7 -2
  192. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +11 -4
  193. package/lib/components/booking/info/clientVariant/vertical/index.js +34 -17
  194. package/lib/components/booking/info/hooks/useHolderConfig.d.ts +1 -0
  195. package/lib/components/booking/info/hooks/useHolderConfig.js +8 -3
  196. package/lib/components/booking/info/main.js +5 -4
  197. package/lib/components/booking/info/model.js +5 -0
  198. package/lib/components/booking/info/pet/serve.js +1 -6
  199. package/lib/components/booking/info/service/Lists.d.ts +1 -1
  200. package/lib/components/booking/info/service/Lists.js +5 -3
  201. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  202. package/lib/components/booking/info/service/addTimeModal/serve.js +1 -7
  203. package/lib/components/booking/info/service/serve.d.ts +14 -0
  204. package/lib/components/booking/info/service/serve.js +8 -17
  205. package/lib/components/booking/info/service2/Group/utils.js +2 -0
  206. package/lib/components/booking/info/service2/utils.d.ts +1 -33
  207. package/lib/components/booking/info/service2/utils.js +38 -29
  208. package/lib/components/booking/info/utils.js +4 -0
  209. package/lib/components/booking/info2/cartClientCard/index.js +34 -5
  210. package/lib/components/booking/info2/index.js +11 -5
  211. package/lib/components/booking/info2/serve.js +1 -6
  212. package/lib/components/booking/info2/service/addService/index.js +22 -3
  213. package/lib/components/booking/info2/service/addService/utils.d.ts +9 -1
  214. package/lib/components/booking/info2/service/addService/utils.js +48 -11
  215. package/lib/components/booking/info2/service/contactInfoMode/index.d.ts +2 -0
  216. package/lib/components/booking/info2/service/contactInfoMode/index.js +111 -0
  217. package/lib/components/booking/info2/service/editService/Holder/index.d.ts +12 -0
  218. package/lib/components/booking/info2/service/editService/Holder/index.js +199 -0
  219. package/lib/components/booking/info2/service/editService/Holder/index.less +63 -0
  220. package/lib/components/booking/info2/service/editService/index.js +254 -32
  221. package/lib/components/booking/info2/utilsByBooking.js +26 -19
  222. package/lib/components/booking/locales.d.ts +36 -0
  223. package/lib/components/booking/locales.js +42 -3
  224. package/lib/components/booking/model.d.ts +4 -0
  225. package/lib/components/booking/model.js +3 -0
  226. package/lib/components/booking/utils/confirmHolderModal.d.ts +13 -0
  227. package/lib/components/booking/utils/confirmHolderModal.js +253 -0
  228. package/lib/components/booking/utils/confirmHolderModal.less +40 -0
  229. package/lib/components/booking/utils/selectHolderModal.d.ts +24 -0
  230. package/lib/components/booking/utils/selectHolderModal.js +319 -0
  231. package/lib/components/booking/utils.d.ts +16 -7
  232. package/lib/components/booking/utils.js +18 -21
  233. package/lib/components/checkout/PaymentModal.js +41 -18
  234. package/lib/components/checkout/components/CashPaymentModule/index.js +1 -7
  235. package/lib/components/checkout/components/ScrollableList/index.js +0 -1
  236. package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
  237. package/lib/components/checkout/locales.d.ts +3 -0
  238. package/lib/components/checkout/locales.js +3 -0
  239. package/lib/components/eftposPay/linkly/index.js +31 -1
  240. package/lib/components/eftposPay/tyro/index.js +12 -0
  241. package/lib/components/list/List.js +3 -0
  242. package/lib/components/pay/toB/components/MX51/index.js +12 -37
  243. package/lib/components/pay/toB/types/index.d.ts +0 -12
  244. package/lib/components/pisellSelectCustomerModal/RightPanel/serve.js +1 -8
  245. package/lib/components/shoppingCart/components/Cart/Product.js +7 -3
  246. package/lib/components/shoppingCart/type.d.ts +1 -0
  247. package/lib/components/ticketBooking/components/ProductDisplayAdapter/index.less +0 -12
  248. package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.d.ts +18 -0
  249. package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.js +118 -0
  250. package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.less +0 -0
  251. package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -2
  252. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +281 -313
  253. package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -2
  254. package/lib/components/ticketBooking/components/addServiceVariant/index.js +5 -3
  255. package/lib/components/ticketBooking/components/addServiceVariant/utils.js +1 -2
  256. package/lib/components/ticketBooking/components/menuBar/index.js +42 -6
  257. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +2 -4
  258. package/lib/components/ticketBooking/components/ticketBooking/index.js +12 -49
  259. package/lib/components/ticketBooking/components/ticketBooking/index.less +2 -1
  260. package/lib/components/ticketBooking/components/timeBar/index.d.ts +0 -1
  261. package/lib/components/ticketBooking/components/timeBar/index.js +1 -3
  262. package/lib/components/ticketBooking/hooks/pisellos/useProducts.d.ts +0 -4
  263. package/lib/components/ticketBooking/hooks/pisellos/useProducts.js +69 -98
  264. package/lib/components/ticketBooking/index.d.ts +0 -1
  265. package/lib/components/ticketBooking/index.js +0 -2
  266. package/lib/components/ticketBooking/serve.js +15 -117
  267. package/lib/components/ticketBooking/utils/index.d.ts +7 -1
  268. package/lib/components/ticketBooking/utils/index.js +29 -23
  269. package/lib/hooks/useEngineContext.d.ts +0 -1
  270. package/lib/hooks/useEngineContext.js +2 -10
  271. package/lib/index.d.ts +4 -0
  272. package/lib/index.js +12 -0
  273. package/lib/plus/clientCard/locales.js +3 -3
  274. package/lib/plus/clinetSearch/index.js +17 -8
  275. package/lib/plus/clinetSearch/locales.d.ts +3 -0
  276. package/lib/plus/clinetSearch/locales.js +7 -4
  277. package/lib/plus/clinetSearch/types.d.ts +12 -0
  278. package/lib/plus/contactInfo/components/Avatar/index.d.ts +10 -0
  279. package/lib/plus/contactInfo/components/Avatar/index.js +56 -0
  280. package/lib/plus/contactInfo/components/SwipeAction/index.d.ts +46 -0
  281. package/lib/plus/contactInfo/components/SwipeAction/index.js +373 -0
  282. package/lib/plus/contactInfo/components/SwipeAction/index.less +74 -0
  283. package/lib/plus/contactInfo/index.d.ts +6 -0
  284. package/lib/plus/contactInfo/index.js +226 -0
  285. package/lib/plus/contactInfo/index.less +621 -0
  286. package/lib/plus/contactInfo/locales.d.ts +15 -0
  287. package/lib/plus/contactInfo/locales.js +38 -0
  288. package/lib/plus/contactInfo/types.d.ts +91 -0
  289. package/lib/plus/contactInfo/types.js +17 -0
  290. package/lib/plus/contactInfo/utils.d.ts +7 -0
  291. package/lib/plus/contactInfo/utils.js +64 -0
  292. package/lib/plus/contactInfoModal/ContactInfoContent.d.ts +3 -0
  293. package/lib/plus/contactInfoModal/ContactInfoContent.js +129 -0
  294. package/lib/plus/contactInfoModal/index.d.ts +41 -0
  295. package/lib/plus/contactInfoModal/index.js +139 -0
  296. package/lib/plus/contactInfoModal/index.less +19 -0
  297. package/lib/plus/contactInfoModal/locales.d.ts +66 -0
  298. package/lib/plus/contactInfoModal/locales.js +89 -0
  299. package/lib/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.js +1 -1
  300. package/lib/plus/productSelect/ProductCard/index.js +1 -1
  301. package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +3 -0
  302. package/lib/plus/selectHolder/components/ErrorTip/index.js +30 -0
  303. package/lib/plus/selectHolder/components/ErrorTip/index.less +51 -0
  304. package/lib/plus/selectHolder/components/HolderItem/index.d.ts +6 -0
  305. package/lib/plus/selectHolder/components/HolderItem/index.js +101 -0
  306. package/lib/plus/selectHolder/components/HolderItem/index.less +105 -0
  307. package/lib/plus/selectHolder/components/HolderList/index.d.ts +30 -0
  308. package/lib/plus/selectHolder/components/HolderList/index.js +63 -0
  309. package/lib/plus/selectHolder/index.d.ts +7 -0
  310. package/lib/plus/selectHolder/index.js +223 -0
  311. package/lib/plus/selectHolder/index.less +137 -0
  312. package/lib/plus/selectHolder/locales.d.ts +24 -0
  313. package/lib/plus/selectHolder/locales.js +47 -0
  314. package/lib/plus/selectHolder/types.d.ts +104 -0
  315. package/lib/plus/selectHolder/types.js +17 -0
  316. package/lib/plus/selectHolder/utils.d.ts +9 -0
  317. package/lib/plus/selectHolder/utils.js +34 -0
  318. package/lib/pro/comprehensiveSearch/components/searchSection/locales.js +3 -3
  319. package/lib/pro/comprehensiveSearch/locales.js +1 -1
  320. package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.d.ts +9 -0
  321. package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.js +304 -0
  322. package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.less +8 -0
  323. package/lib/pro/multiDayTimeSelect/index.d.ts +3 -0
  324. package/lib/{hooks/printer.js → pro/multiDayTimeSelect/index.js} +6 -31
  325. package/lib/pro/multiDayTimeSelect/types.d.ts +28 -0
  326. package/lib/pro/multiDayTimeSelect/types.js +17 -0
  327. package/lib/pro/skuDetailModal/types.d.ts +1 -0
  328. package/lowcode/contact-info/fragments/cardStyle.ts +68 -0
  329. package/lowcode/contact-info/fragments/nameStyle.ts +33 -0
  330. package/lowcode/contact-info/fragments/pisellAvatar.ts +103 -0
  331. package/lowcode/contact-info/fragments/textStyle.ts +33 -0
  332. package/lowcode/contact-info/meta.ts +199 -0
  333. package/lowcode/contact-info-modal/meta.ts +98 -0
  334. package/lowcode/event-select-holder/meta.ts +2 -2
  335. package/lowcode/select-holder/meta.ts +220 -0
  336. package/lowcode/select-holder/snippets.ts +41 -0
  337. package/package.json +13 -11
  338. package/es/hooks/printer.d.ts +0 -4
  339. package/es/hooks/printer.js +0 -35
  340. package/lib/hooks/printer.d.ts +0 -4
@@ -20,21 +20,24 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
20
  import { getUniqueId, locales, sendWarningLog } from '@pisell/utils';
21
21
  import React, { useEffect, useMemo, useRef, useState } from 'react';
22
22
  import { useMemoizedFn } from 'ahooks';
23
- import useEngineContext, { usePlatform } from "../../../../hooks/useEngineContext";
24
- import { isSessionProduct, request, getProductTotalPrice, getIsEject, getIsOnlySession } from "../../../booking/utils";
25
- import { getProductExtend } from "../../../booking/info2/service/addService/utils";
26
- import { holderId, isDaysBooking, isNormalProductByDurationSchedule } from "../../../booking/info/service2/utils";
23
+ import useEngineContext from "../../../../hooks/useEngineContext";
24
+ import { isSessionProduct, request, getProductTotalPrice, getIsEject, getIsOnlySession, isWalkIn } from "../../../booking/utils";
25
+ import { getMultiDay, getProductExtend, isMultiDayProduct } from "../../../booking/info2/service/addService/utils";
26
+ import { holderId, isNormalProductByDurationSchedule } from "../../../booking/info/service2/utils";
27
27
  import { isBooking4Shop } from "../../../booking/info/utils";
28
28
  import { useService } from "../../../booking/info/service/serviceManager";
29
29
  import ProductDisplayAdapter, { resolveProductDisplayConfig } from "../ProductDisplayAdapter";
30
30
  import "./index.less";
31
- import { addService, addServiceScroll, genServiceKey, getIsShowNumber, isSameProduct } from "../../utils";
31
+ import { addService, addServiceScroll, createSimpleCacheItem, genHolderKey, genServiceKey, getIsShowNumber, isSameProduct } from "../../utils";
32
32
  import NotAvailable from "../notAvailable";
33
33
  import dayjs from 'dayjs';
34
34
  import { useProducts } from "../../hooks/pisellos";
35
35
  import { createCacheItem, genValues, isBundle, isOption, setHandleSetService } from "./utils";
36
36
  import { useToast } from '@pisell/materials';
37
37
  import { useIsActive } from "../../context/IsActiveContext";
38
+ import { concatBookings, createBookingItemsByGroup } from "../../../booking/info/service2/Group/utils";
39
+ import MultiDayTimeSelectModal from "./MultiDayTimeSelectModal";
40
+ import { selectHolderModal, SelectHolderModal } from "../../../booking/utils/selectHolderModal";
38
41
  var productListLayout = {
39
42
  grid: true,
40
43
  config: '12:12'
@@ -48,19 +51,15 @@ var productListSetting = {
48
51
  isStock: 0
49
52
  };
50
53
  var AddSerivce = function AddSerivce(props) {
51
- var _context$appHelper, _context$appHelper$ge, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$service, _state$bookingConfig2, _state$client2;
54
+ var _context$appHelper, _context$appHelper$ge, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$bookingConfig2, _state$client2;
52
55
  var onEdit = props.onEdit,
53
56
  state = props.state,
54
57
  dispatch = props.dispatch,
55
58
  _props$renderMode = props.renderMode,
56
59
  renderMode = _props$renderMode === void 0 ? 'current' : _props$renderMode,
57
- onPrerenderComplete = props.onPrerenderComplete,
58
- onGetProductsReady = props.onGetProductsReady,
59
60
  productDisplayConfig = props.productDisplayConfig;
60
61
  var context = useEngineContext();
61
- var platform = usePlatform();
62
62
  var notAvailableRef = useRef(null);
63
- var isLoadedServiceRef = useRef(false);
64
63
  request.setRequest(context.appHelper.utils.request);
65
64
  var isActive = useIsActive();
66
65
  var Toast = useToast();
@@ -81,43 +80,24 @@ var AddSerivce = function AddSerivce(props) {
81
80
  _useState4 = _slicedToArray(_useState3, 2),
82
81
  firstLoading = _useState4[0],
83
82
  setFirstLoading = _useState4[1];
83
+ var _useState5 = useState(false),
84
+ _useState6 = _slicedToArray(_useState5, 2),
85
+ multiDayModalOpen = _useState6[0],
86
+ setMultiDayModalOpen = _useState6[1];
87
+ var _useState7 = useState(false),
88
+ _useState8 = _slicedToArray(_useState7, 2),
89
+ multiDayModalLoading = _useState8[0],
90
+ setMultiDayModalLoading = _useState8[1];
91
+ var _useState9 = useState(null),
92
+ _useState10 = _slicedToArray(_useState9, 2),
93
+ pendingMultiDayData = _useState10[0],
94
+ setPendingMultiDayData = _useState10[1];
84
95
  var stateRef = useRef(state);
85
96
  stateRef.current = state;
86
- var prerenderCompletedRef = useRef(false);
87
- var latestServiceValueRef = useRef((state === null || state === void 0 || (_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.value) || []);
88
- var lastOperationTimeRef = useRef(0);
89
- var isInFastClickMode = function isInFastClickMode() {
90
- var now = Date.now();
91
- return now - lastOperationTimeRef.current < 2000;
92
- };
93
- var getCurrentServiceValue = function getCurrentServiceValue() {
94
- if (isInFastClickMode()) {
95
- var _stateRef$current;
96
- return latestServiceValueRef.current || ((_stateRef$current = stateRef.current) === null || _stateRef$current === void 0 || (_stateRef$current = _stateRef$current.service) === null || _stateRef$current === void 0 ? void 0 : _stateRef$current.value) || [];
97
- } else {
98
- var _state$service2;
99
- var stateValue = (state === null || state === void 0 || (_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : _state$service2.value) || [];
100
- latestServiceValueRef.current = null;
101
- return stateValue;
102
- }
103
- };
104
-
105
- // useEffect(() => {
106
- // if (!isInFastClickMode()) {
107
- // latestServiceValueRef.current = null;
108
- // }
109
- // }, [state?.service?.value]);
110
-
111
97
  var _useProducts = useProducts(notAvailableRef),
112
98
  getProducts = _useProducts.getProducts,
113
99
  products = _useProducts.products,
114
- loading = _useProducts.loading,
115
- getScheduleTimePoints = _useProducts.getScheduleTimePoints;
116
- useEffect(function () {
117
- if (onGetProductsReady && getProducts) {
118
- onGetProductsReady(getProducts);
119
- }
120
- }, []);
100
+ loading = _useProducts.loading;
121
101
  useEffect(function () {
122
102
  var timer = setTimeout(function () {
123
103
  setFirstLoading(false);
@@ -136,12 +116,6 @@ var AddSerivce = function AddSerivce(props) {
136
116
  debounceTimersRef.current = {};
137
117
  };
138
118
  }, []);
139
- useEffect(function () {
140
- if (!loading && !prerenderCompletedRef.current) {
141
- onPrerenderComplete === null || onPrerenderComplete === void 0 || onPrerenderComplete();
142
- prerenderCompletedRef.current = true;
143
- }
144
- }, [loading]);
145
119
 
146
120
  // 处理商品添加后的列表归位
147
121
  useEffect(function () {
@@ -171,30 +145,23 @@ var AddSerivce = function AddSerivce(props) {
171
145
  return ((_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id) || undefined;
172
146
  }, [(_state$client2 = state.client) === null || _state$client2 === void 0 || (_state$client2 = _state$client2.value) === null || _state$client2 === void 0 ? void 0 : _state$client2.id]);
173
147
  var scanAddService = useMemoizedFn(function (list, code) {
174
- // 使用 stateRef 获取最新状态
175
- var newService = _toConsumableArray(stateRef.current.service.value || []);
148
+ var newService = _toConsumableArray(state.service.value);
176
149
  list.forEach(function (item) {
177
150
  if (isBundle(item) || isOption(item)) {
178
151
  handleSelectProduct(item);
179
152
  return;
180
153
  }
181
154
  var values = genValues(item, code);
182
- var cacheItem = createCacheItem(item, values, stateRef.current);
155
+ var cacheItem = createCacheItem(item, values, state);
183
156
  cacheItem._serviceKey = genServiceKey(cacheItem);
157
+ cacheItem._holderKey = genHolderKey(cacheItem);
184
158
  cacheItem.autoClose = false;
185
- var _addService = addService(_toConsumableArray(newService), cacheItem, stateRef.current),
159
+ var _addService = addService(_toConsumableArray(newService), cacheItem, state),
186
160
  _list = _addService.list,
187
161
  quantity = _addService.quantity;
188
162
  handleAddToast(cacheItem.title, quantity);
189
163
  newService = _list;
190
164
  });
191
-
192
- // 立即更新 stateRef
193
- stateRef.current = _objectSpread(_objectSpread({}, stateRef.current), {}, {
194
- service: _objectSpread(_objectSpread({}, stateRef.current.service), {}, {
195
- value: newService
196
- })
197
- });
198
165
  dispatch({
199
166
  type: 'setService',
200
167
  payload: {
@@ -208,90 +175,6 @@ var AddSerivce = function AddSerivce(props) {
208
175
  setHandleSetService(scanAddService);
209
176
  }
210
177
  }, [isActive]);
211
-
212
- /*
213
- const removeNotAvailableService = (list: any) => {
214
- if (!stateRef.current?.service?.value?.length) return;
215
- const listMap = list.reduce((acc: any, cur: any) => {
216
- acc[cur.id] = cur;
217
- return acc;
218
- }, {});
219
- const newValue = (stateRef.current?.service?.value || []).filter(
220
- (item: any) => listMap[item.product_id]
221
- );
222
- dispatch({
223
- type: 'setService',
224
- payload: {
225
- value: newValue,
226
- edit: true,
227
- },
228
- });
229
- };
230
- const getServices = async (params?: any) => {
231
- setLoading(true);
232
- // 活动预约如果没有绑定商品id不查询
233
- if (
234
- state.renderType === 'eventBooking' &&
235
- !state.eventOtherParams?.productIds?.length
236
- ) {
237
- dispatch({
238
- type: 'setService',
239
- payload: {
240
- services: [],
241
- },
242
- });
243
- setLoading(false);
244
- return;
245
- }
246
- let data = await getProductList({
247
- skip: 1,
248
- num: 500,
249
- // extension_type: state.productExtensionType,
250
- exclude_extension_type: [
251
- 'product_party',
252
- 'product_event',
253
- 'product_series_event',
254
- 'product_package_ticket',
255
- 'ticket',
256
- 'event_item',
257
- ],
258
- with: ['category'],
259
- open_quotation: 1,
260
- with_schedule: 1,
261
- with_count: ['bundleGroup', 'optionGroup'],
262
- order_by_string: 'sort:desc',
263
- status: 'published',
264
- schedule_date: params?.schedule_date,
265
- schedule_datetime: params?.schedule_datetime,
266
- customer_id: params?.customer_id,
267
- menu_list_ids: params?.menu_list_ids,
268
- _config: {
269
- fullResult: true,
270
- customResponse: true,
271
- },
272
- });
273
- setLoading(false);
274
- if (data?.code === 607100) {
275
- // 第一次加载时,或者之前有数据
276
- if (!isLoadedServiceRef.current || state.service?.services?.length) {
277
- notAvailableRef.current?.open();
278
- }
279
- }
280
- // 只有自动获取列表的时候才设置商品, 手动点击添加按钮的时候不设置
281
- if (!state.service.addModal) {
282
- setDefaultService(data?.data?.list);
283
- }
284
- removeNotAvailableService(data?.data?.list);
285
- isLoadedServiceRef.current = true;
286
- dispatch({
287
- type: 'setService',
288
- payload: {
289
- services: data?.data?.list || [],
290
- },
291
- });
292
- };
293
- */
294
-
295
178
  var handleAddToast = function handleAddToast(title, quantity) {
296
179
  var _Toast$success;
297
180
  Toast === null || Toast === void 0 || (_Toast$success = Toast.success) === null || _Toast$success === void 0 || _Toast$success.call(Toast, /*#__PURE__*/React.createElement("div", {
@@ -317,7 +200,6 @@ var AddSerivce = function AddSerivce(props) {
317
200
 
318
201
  // 执行原始的回调函数
319
202
  originalCallback(finalCacheValues, '', item, true);
320
- lastOperationTimeRef.current = Date.now();
321
203
  });
322
204
 
323
205
  // 为每个商品单独创建防抖函数
@@ -327,375 +209,428 @@ var AddSerivce = function AddSerivce(props) {
327
209
  clearTimeout(debounceTimersRef.current[productId]);
328
210
  }
329
211
 
330
- // 从 localStorage 获取防抖时间配置,默认为 0
331
- var debounceTime = Number(localStorage.getItem('pisell_service_add_debounce_time')) || 0;
332
-
333
212
  // 创建新的防抖定时器
334
213
  debounceTimersRef.current[productId] = setTimeout(function () {
335
214
  executeCacheValues(productId, cacheValues, item, callback);
336
- }, debounceTime);
337
- });
338
-
339
- // 检查资源可用性
340
- var checkResourceAvailability = useMemoizedFn(function (item) {
341
- if (!isNormalProductByDurationSchedule(item)) {
342
- var _state$service3;
343
- if (!Array.isArray((_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : _state$service3.resourcesOrigin) || !state.service.resourcesOrigin.length) {
344
- dispatch({
345
- type: 'setService',
346
- payload: _objectSpread(_objectSpread({}, stateRef.current.service), {}, {
347
- reloadResourceModal: true
348
- })
349
- });
350
- return false;
351
- }
352
- }
353
- return true;
354
- });
355
-
356
- // 创建缓存项
357
- var createCacheItemFromParams = useMemoizedFn(function (item, params, detail) {
358
- var _detail = detail || item;
359
- var other = JSON.parse(JSON.stringify(params));
360
- other.session = params.session;
361
- var cacheItem = _objectSpread(_objectSpread({}, _detail), {}, {
362
- product_id: item.id,
363
- _id: getUniqueId(),
364
- _key: params.key,
365
- _extend: {
366
- start_date: state.date.value,
367
- quantity: (params === null || params === void 0 ? void 0 : params.quantity) || 1,
368
- price: _detail.price,
369
- product_name: item.title,
370
- other: other
371
- },
372
- new: 1
373
- });
374
- var _total = getProductTotalPrice(cacheItem);
375
- cacheItem._extend.total = _total;
376
- cacheItem._extend.origin_total = _total;
377
- var _isEdit = !!state.service.cacheItem;
378
- if (_isEdit) {
379
- var _state$service$cacheI;
380
- cacheItem._id = (_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI._id;
381
- cacheItem.new = 0;
382
- }
383
- if (renderMode === 'current') {
384
- cacheItem.currentDefaultTime = state.date.value.format('HH:mm');
385
- }
386
- var isNormalProduct = isNormalProductByDurationSchedule(item);
387
- cacheItem = isNormalProduct ? _objectSpread(_objectSpread({}, cacheItem), {}, {
388
- autoClose: true
389
- }) : getProductExtend({
390
- cacheItem: cacheItem,
391
- state: state,
392
- isDisabledTime: true
393
- });
394
- if (state.renderType === 'eventBooking') {
395
- cacheItem.autoClose = false;
396
- }
397
- return cacheItem;
398
- });
399
-
400
- // 生成商品唯一标识
401
- var getProductKey = useMemoizedFn(function (item, cacheItem) {
402
- // 使用 _serviceKey 来区分同一商品的不同规格/选项
403
- return cacheItem._serviceKey || "".concat(item.id, "_").concat(cacheItem._key);
215
+ }, 0);
404
216
  });
405
217
 
406
- // 获取当前服务列表中的商品数量
407
- var getServiceQuantity = useMemoizedFn(function (cacheItem) {
408
- var _stateRef$current$ser, _existingService$_ext;
409
- // 使用 stateRef 获取最新的 service.value
410
- var existingService = (_stateRef$current$ser = stateRef.current.service.value) === null || _stateRef$current$ser === void 0 ? void 0 : _stateRef$current$ser.find(function (val) {
411
- return isSameProduct(val, cacheItem);
412
- });
413
- return (existingService === null || existingService === void 0 || (_existingService$_ext = existingService._extend) === null || _existingService$_ext === void 0 ? void 0 : _existingService$_ext.quantity) || 0;
414
- });
415
-
416
- // 处理自动关闭的服务添加(带防抖)
417
- var processAutoCloseService = useMemoizedFn(function (cacheItem, item, detail, notShowToast) {
418
- console.time('processAutoCloseService2');
419
- cacheItem.autoClose = false;
420
- cacheItem._serviceKey = genServiceKey(cacheItem);
421
- var productKey = getProductKey(item, cacheItem);
422
-
423
- // 如果已经有待处理的同商品,增加点击次数
424
- if (pendingCacheValuesRef.current[productKey]) {
425
- clickCountRef.current[productKey] = (clickCountRef.current[productKey] || 1) + 1;
426
- } else {
427
- // 第一次点击,初始化数据
428
- pendingCacheValuesRef.current[productKey] = {
429
- cacheItem: cacheItem,
430
- item: item,
431
- detail: detail,
432
- notShowToast: notShowToast
433
- };
434
- clickCountRef.current[productKey] = 1;
435
- }
436
-
437
- // 立即显示 toast
438
- // 显示:购物车中已有数量 + 当前累积点击次数
439
- if (!notShowToast) {
440
- var originalQuantity = getServiceQuantity(cacheItem);
441
- var currentClickCount = clickCountRef.current[productKey] || 1;
442
- var totalQuantity = originalQuantity + currentClickCount;
443
- handleAddToast(cacheItem.title, totalQuantity);
444
- }
445
-
446
- // 清除旧的防抖定时器
447
- if (debounceTimersRef.current[productKey]) {
448
- clearTimeout(debounceTimersRef.current[productKey]);
449
- }
450
-
451
- // 从 localStorage 获取防抖时间配置,默认为 0
452
- var debounceTime = Number(localStorage.getItem('pisell_service_add_debounce_time')) || 0;
453
-
454
- // 创建新的防抖定时器
455
- debounceTimersRef.current[productKey] = setTimeout(function () {
456
- executeServiceDispatch(productKey);
457
- }, debounceTime);
458
- console.timeEnd('processAutoCloseService2');
459
- // 5ms
460
- });
461
-
462
- // 执行实际的 dispatch 操作
463
- var executeServiceDispatch = useMemoizedFn(function (productKey) {
464
- console.time('executeServiceDispatch');
465
- console.time('executeServiceDispatch1');
466
- var pendingData = pendingCacheValuesRef.current[productKey];
467
- if (!pendingData) return;
468
- var cacheItem = pendingData.cacheItem,
469
- item = pendingData.item,
470
- detail = pendingData.detail;
471
- var clickCount = clickCountRef.current[productKey] || 1;
472
-
473
- // 更新 quantity 为累积的点击次数
474
- var finalCacheItem = _objectSpread(_objectSpread({}, cacheItem), {}, {
475
- _extend: _objectSpread(_objectSpread({}, cacheItem._extend), {}, {
476
- quantity: clickCount
477
- })
478
- });
479
- console.timeEnd('executeServiceDispatch1');
480
- console.time('executeServiceDispatch addService');
481
- // 使用 stateRef 获取最新的 service.value,避免竞态条件
482
- var _addService2 = addService(_toConsumableArray(stateRef.current.service.value || []), finalCacheItem, stateRef.current),
483
- _list = _addService2.list,
484
- quantity = _addService2.quantity;
485
- console.timeEnd('executeServiceDispatch addService');
486
- console.time('executeServiceDispatch2');
487
- window.dispatchEvent(new CustomEvent('onAddNewService', {
488
- detail: {
489
- cacheItem: finalCacheItem
490
- }
491
- }));
492
- console.timeEnd('executeServiceDispatch2');
493
- console.time('executeServiceDispatch3');
494
- // 2155 日志记录
495
- logServiceForSpecificShop(item, detail, _list);
496
-
497
- // 立即更新 stateRef,减少竞态窗口
498
- stateRef.current = _objectSpread(_objectSpread({}, stateRef.current), {}, {
499
- service: _objectSpread(_objectSpread({}, stateRef.current.service), {}, {
500
- value: _list
501
- })
502
- });
503
- dispatch({
504
- type: 'setService',
505
- payload: {
506
- addModal: false,
507
- value: _list,
508
- edit: true,
509
- changeService: false
510
- }
511
- });
512
- console.timeEnd('executeServiceDispatch3');
513
- console.timeEnd('executeServiceDispatch');
514
-
515
- // 清理缓存数据
516
- delete pendingCacheValuesRef.current[productKey];
517
- delete clickCountRef.current[productKey];
518
- delete debounceTimersRef.current[productKey];
519
- });
520
-
521
- // 处理手动编辑的服务
522
- var processManualEditService = useMemoizedFn(function (cacheItem) {
523
- var _window$openBookingEd, _window;
524
- (_window$openBookingEd = (_window = window).openBookingEditModal) === null || _window$openBookingEd === void 0 || _window$openBookingEd.call(_window);
525
- dispatch({
526
- type: 'setService',
527
- payload: {
528
- editModal: true,
529
- cacheItem: cacheItem,
530
- addModal: !cacheItem.autoClose,
531
- changeService: false
532
- }
533
- });
534
- onEdit === null || onEdit === void 0 || onEdit(cacheItem);
535
- });
536
-
537
- // 特定商店的日志记录
538
- var logServiceForSpecificShop = useMemoizedFn(function (item, detail, _list) {
539
- try {
540
- var _context$appHelper$ut4, _context$appHelper$ut5;
541
- if (((_context$appHelper$ut4 = context.appHelper.utils.store) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut4.getState) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.call(_context$appHelper$ut4)) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.global) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.globalConfig) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.id) === 2155) {
542
- var val = _list === null || _list === void 0 ? void 0 : _list.map(function (s) {
543
- return {
544
- product_id: s === null || s === void 0 ? void 0 : s.product_id,
545
- detailId: s === null || s === void 0 ? void 0 : s.id,
546
- detailProductId: s === null || s === void 0 ? void 0 : s.product_id,
547
- product_name: s === null || s === void 0 ? void 0 : s.title,
548
- price: s === null || s === void 0 ? void 0 : s.price,
549
- _id: s === null || s === void 0 ? void 0 : s._id,
550
- _key: s === null || s === void 0 ? void 0 : s._key,
551
- _serviceKey: s === null || s === void 0 ? void 0 : s._serviceKey
552
- };
553
- });
554
- var sendData = {
555
- product_id: item === null || item === void 0 ? void 0 : item.id,
556
- detailId: detail === null || detail === void 0 ? void 0 : detail.id,
557
- detailProductId: detail === null || detail === void 0 ? void 0 : detail.product_id,
558
- product_name: item === null || item === void 0 ? void 0 : item.title,
559
- price: detail === null || detail === void 0 ? void 0 : detail.price,
560
- serviceVal: val
561
- };
562
- sendWarningLog({
563
- title: 'addService',
564
- content: [{
565
- key: '添加数据',
566
- value: JSON.stringify(sendData)
567
- }, {
568
- key: '日期',
569
- value: dayjs().format('YYYY-MM-DD HH:mm:ss')
570
- }]
571
- });
572
- }
573
- } catch (error) {}
574
- });
575
-
576
- // 处理非 booking4 的预约创建
577
- var handleBookingCreation = useMemoizedFn( /*#__PURE__*/function () {
578
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(item, params, detail) {
579
- var data;
580
- return _regeneratorRuntime().wrap(function _callee$(_context) {
581
- while (1) switch (_context.prev = _context.next) {
218
+ // 处理添加服务的逻辑(提取为独立函数,方便跨日商品确认后调用)
219
+ var processAddService = useMemoizedFn( /*#__PURE__*/function () {
220
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item, _detail, e, notShowToast, startDate, endDate) {
221
+ var _state$client3, _state$bookingConfig3;
222
+ var other, cacheItem, _total, _isEdit, _stateRef$current$ser, isMultiDay, getMultiDayCacheItem, res, _state$bookingConfig4, _addService2, _list, quantity, _context$appHelper$ut4, _context$appHelper$ut5, val, sendData, _window$openBookingEd, _window;
223
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
224
+ while (1) switch (_context2.prev = _context2.next) {
582
225
  case 0:
583
- _context.next = 2;
584
- return createBookingData({
585
- product: _objectSpread(_objectSpread({}, detail || item), {}, {
586
- _params: params
587
- })
226
+ other = JSON.parse(JSON.stringify(e));
227
+ other.session = e.session;
228
+ cacheItem = _objectSpread(_objectSpread({}, _detail), {}, {
229
+ product_id: item.id,
230
+ _id: getUniqueId(),
231
+ _key: e.key,
232
+ _extend: {
233
+ start_date: startDate,
234
+ quantity: (e === null || e === void 0 ? void 0 : e.quantity) || 1,
235
+ price: _detail.price,
236
+ product_name: item.title,
237
+ other: other,
238
+ end_date: endDate
239
+ },
240
+ new: 1
588
241
  });
589
- case 2:
590
- data = _context.sent;
591
- createBooking({
592
- booking: data
242
+ _total = getProductTotalPrice(cacheItem); // 用于折扣 可修改
243
+ cacheItem._extend.total = _total;
244
+ // 用于储存原价
245
+ cacheItem._extend.origin_total = _total;
246
+ _isEdit = !!stateRef.current.service.cacheItem;
247
+ if (_isEdit) {
248
+ cacheItem._id = (_stateRef$current$ser = stateRef.current.service.cacheItem) === null || _stateRef$current$ser === void 0 ? void 0 : _stateRef$current$ser._id;
249
+ cacheItem.new = 0;
250
+ }
251
+ // 渲染到当前位置模式时,默认无资源 时间默认取顶部设置的时间
252
+ if (renderMode === 'current') {
253
+ // cacheItem._extend.resource = 0;
254
+ cacheItem.currentDefaultTime = stateRef.current.date.value.format('HH:mm');
255
+ }
256
+ cacheItem = getProductExtend({
257
+ cacheItem: cacheItem,
258
+ state: stateRef.current,
259
+ isDisabledTime: true
593
260
  });
594
- case 4:
261
+ isMultiDay = isMultiDayProduct(cacheItem);
262
+ getMultiDayCacheItem = /*#__PURE__*/function () {
263
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(isConcatBookings) {
264
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
265
+ while (1) switch (_context.prev = _context.next) {
266
+ case 0:
267
+ _context.next = 2;
268
+ return getMultiDay({
269
+ start_date: cacheItem._extend.start_date,
270
+ end_date: cacheItem._extend.end_date,
271
+ state: stateRef.current,
272
+ cacheItem: cacheItem
273
+ });
274
+ case 2:
275
+ cacheItem = _context.sent;
276
+ cacheItem = createBookingItemsByGroup(cacheItem);
277
+ if (isConcatBookings) {
278
+ cacheItem = concatBookings(cacheItem);
279
+ }
280
+ case 5:
281
+ case "end":
282
+ return _context.stop();
283
+ }
284
+ }, _callee);
285
+ }));
286
+ return function getMultiDayCacheItem(_x7) {
287
+ return _ref2.apply(this, arguments);
288
+ };
289
+ }(); // 如果没有 holder 数据,且此时要求选择 holder,则弹出 holder 弹窗
290
+ if (!(!isNormalProductByDurationSchedule(cacheItem) && (!cacheItem._extend.holder_id || !cacheItem._extend.holder_id.length) && !isWalkIn((_state$client3 = state.client) === null || _state$client3 === void 0 || (_state$client3 = _state$client3.value) === null || _state$client3 === void 0 ? void 0 : _state$client3.id) && (state === null || state === void 0 || (_state$bookingConfig3 = state.bookingConfig) === null || _state$bookingConfig3 === void 0 || (_state$bookingConfig3 = _state$bookingConfig3.config) === null || _state$bookingConfig3 === void 0 || (_state$bookingConfig3 = _state$bookingConfig3.basic) === null || _state$bookingConfig3 === void 0 || (_state$bookingConfig3 = _state$bookingConfig3.appointment_subject) === null || _state$bookingConfig3 === void 0 ? void 0 : _state$bookingConfig3.show_hold_on_add_cart) !== 0)) {
291
+ _context2.next = 22;
292
+ break;
293
+ }
294
+ _context2.next = 15;
295
+ return handleAddHolder(cacheItem);
296
+ case 15:
297
+ res = _context2.sent;
298
+ if (!(res && res.length > 0)) {
299
+ _context2.next = 20;
300
+ break;
301
+ }
302
+ cacheItem._extend.holder_id = res;
303
+ _context2.next = 22;
304
+ break;
305
+ case 20:
306
+ if (!((state === null || state === void 0 || (_state$bookingConfig4 = state.bookingConfig) === null || _state$bookingConfig4 === void 0 || (_state$bookingConfig4 = _state$bookingConfig4.config) === null || _state$bookingConfig4 === void 0 || (_state$bookingConfig4 = _state$bookingConfig4.basic) === null || _state$bookingConfig4 === void 0 ? void 0 : _state$bookingConfig4.subject_require) === 'require')) {
307
+ _context2.next = 22;
308
+ break;
309
+ }
310
+ return _context2.abrupt("return");
311
+ case 22:
312
+ if (stateRef.current.renderType === 'eventBooking') {
313
+ cacheItem.autoClose = false;
314
+ }
315
+ if (!cacheItem.autoClose) {
316
+ _context2.next = 37;
317
+ break;
318
+ }
319
+ cacheItem.autoClose = false;
320
+ cacheItem._serviceKey = genServiceKey(cacheItem);
321
+ cacheItem._holderKey = genHolderKey(cacheItem);
322
+ if (!isMultiDay) {
323
+ _context2.next = 30;
324
+ break;
325
+ }
326
+ _context2.next = 30;
327
+ return getMultiDayCacheItem();
328
+ case 30:
329
+ _addService2 = addService(_toConsumableArray(stateRef.current.service.value), cacheItem, stateRef.current, isMultiDay), _list = _addService2.list, quantity = _addService2.quantity;
330
+ if (!notShowToast) {
331
+ handleAddToast(cacheItem.title, quantity || 1);
332
+ }
333
+ window.dispatchEvent(new CustomEvent('onAddNewService', {
334
+ detail: {
335
+ cacheItem: cacheItem
336
+ }
337
+ }));
338
+ try {
339
+ if (((_context$appHelper$ut4 = context.appHelper.utils.store) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut4.getState) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.call(_context$appHelper$ut4)) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.global) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.globalConfig) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.id) === 2155) {
340
+ val = _list === null || _list === void 0 ? void 0 : _list.map(function (s) {
341
+ return {
342
+ product_id: s === null || s === void 0 ? void 0 : s.product_id,
343
+ detailId: s === null || s === void 0 ? void 0 : s.id,
344
+ detailProductId: s === null || s === void 0 ? void 0 : s.product_id,
345
+ product_name: s === null || s === void 0 ? void 0 : s.title,
346
+ price: s === null || s === void 0 ? void 0 : s.price,
347
+ _id: s === null || s === void 0 ? void 0 : s._id,
348
+ _key: s === null || s === void 0 ? void 0 : s._key,
349
+ _serviceKey: s === null || s === void 0 ? void 0 : s._serviceKey,
350
+ _holderKey: s === null || s === void 0 ? void 0 : s._holderKey
351
+ };
352
+ });
353
+ sendData = {
354
+ product_id: item === null || item === void 0 ? void 0 : item.id,
355
+ detailId: _detail === null || _detail === void 0 ? void 0 : _detail.id,
356
+ detailProductId: _detail === null || _detail === void 0 ? void 0 : _detail.product_id,
357
+ product_name: item === null || item === void 0 ? void 0 : item.title,
358
+ price: _detail === null || _detail === void 0 ? void 0 : _detail.price,
359
+ serviceVal: val
360
+ };
361
+ sendWarningLog({
362
+ title: 'addService',
363
+ content: [{
364
+ key: '添加数据',
365
+ value: JSON.stringify(sendData)
366
+ }, {
367
+ key: '日期',
368
+ value: dayjs().format('YYYY-MM-DD HH:mm:ss')
369
+ }]
370
+ });
371
+ }
372
+ } catch (error) {}
373
+ dispatch({
374
+ type: 'setService',
375
+ payload: {
376
+ addModal: false,
377
+ value: _list,
378
+ edit: true,
379
+ changeService: false
380
+ }
381
+ });
382
+ _context2.next = 43;
383
+ break;
384
+ case 37:
385
+ (_window$openBookingEd = (_window = window).openBookingEditModal) === null || _window$openBookingEd === void 0 || _window$openBookingEd.call(_window);
386
+ if (!isMultiDay) {
387
+ _context2.next = 41;
388
+ break;
389
+ }
390
+ _context2.next = 41;
391
+ return getMultiDayCacheItem(true);
392
+ case 41:
393
+ dispatch({
394
+ type: 'setService',
395
+ payload: {
396
+ editModal: true,
397
+ cacheItem: cacheItem,
398
+ addModal: !cacheItem.autoClose,
399
+ changeService: false
400
+ }
401
+ });
402
+ onEdit === null || onEdit === void 0 || onEdit(cacheItem);
403
+ case 43:
595
404
  case "end":
596
- return _context.stop();
405
+ return _context2.stop();
597
406
  }
598
- }, _callee);
407
+ }, _callee2);
599
408
  }));
600
- return function (_x, _x2, _x3) {
409
+ return function (_x, _x2, _x3, _x4, _x5, _x6) {
601
410
  return _ref.apply(this, arguments);
602
411
  };
603
412
  }());
604
413
 
605
- // 处理 booking4 的服务添加
606
- var handleBooking4Service = useMemoizedFn(function (item, params, detail, notShowToast) {
607
- var cacheItem = createCacheItemFromParams(item, params, detail);
608
- if (cacheItem.autoClose) {
609
- processAutoCloseService(cacheItem, item, detail, notShowToast);
610
- } else {
611
- processManualEditService(cacheItem);
612
- }
613
- });
614
-
615
- // 直接添加商品(不打开弹窗)
616
- var handleDirectAddService = useMemoizedFn( /*#__PURE__*/function () {
617
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item) {
618
- var cacheItem;
619
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
620
- while (1) switch (_context2.prev = _context2.next) {
414
+ // 处理跨日商品时间选择确认
415
+ var handleMultiDayConfirm = useMemoizedFn( /*#__PURE__*/function () {
416
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(startDate, endDate, duration) {
417
+ var item, detail, e, notShowToast;
418
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
419
+ while (1) switch (_context3.prev = _context3.next) {
621
420
  case 0:
622
- console.log(item, 'handleSelectProduct33', '_list_list');
623
- if (isBooking4) {
624
- _context2.next = 5;
421
+ if (pendingMultiDayData) {
422
+ _context3.next = 2;
625
423
  break;
626
424
  }
627
- _context2.next = 4;
628
- return handleBookingCreation(item, item.cartDetailValue);
629
- case 4:
630
- return _context2.abrupt("return");
631
- case 5:
632
- console.time('createCacheItemFromParams');
633
- cacheItem = createCacheItemFromParams(item, item.cartDetailValue);
634
- console.timeEnd('createCacheItemFromParams');
635
- // 5ms
636
-
637
- if (cacheItem.autoClose) {
638
- // 使用带防抖的处理函数
639
- console.time('processAutoCloseService');
640
- processAutoCloseService(cacheItem, item, item, false);
641
- console.timeEnd('processAutoCloseService');
642
- // 5ms
643
- } else {
644
- processManualEditService(cacheItem);
645
- }
646
- case 9:
425
+ return _context3.abrupt("return");
426
+ case 2:
427
+ setMultiDayModalLoading(true);
428
+ _context3.prev = 3;
429
+ item = pendingMultiDayData.item, detail = pendingMultiDayData.detail, e = pendingMultiDayData.e, notShowToast = pendingMultiDayData.notShowToast; // 使用选择的时间继续处理添加服务逻辑
430
+ _context3.next = 7;
431
+ return processAddService(item, detail, e, notShowToast, startDate, endDate);
432
+ case 7:
433
+ setPendingMultiDayData(null);
434
+ setMultiDayModalOpen(false);
435
+ _context3.next = 14;
436
+ break;
437
+ case 11:
438
+ _context3.prev = 11;
439
+ _context3.t0 = _context3["catch"](3);
440
+ console.error('添加跨日商品失败:', _context3.t0);
441
+ case 14:
442
+ _context3.prev = 14;
443
+ setMultiDayModalLoading(false);
444
+ return _context3.finish(14);
445
+ case 17:
647
446
  case "end":
648
- return _context2.stop();
447
+ return _context3.stop();
649
448
  }
650
- }, _callee2);
449
+ }, _callee3, null, [[3, 11, 14, 17]]);
651
450
  }));
652
- return function (_x4) {
653
- return _ref2.apply(this, arguments);
451
+ return function (_x8, _x9, _x10) {
452
+ return _ref3.apply(this, arguments);
654
453
  };
655
454
  }());
656
455
 
657
- // 创建产品弹窗回调
658
- var createProductModalCallback = useMemoizedFn(function (item) {
659
- return /*#__PURE__*/function () {
660
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e, extension_type, detail, notShowToast) {
661
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
662
- while (1) switch (_context3.prev = _context3.next) {
456
+ // 处理跨日商品时间选择取消
457
+ var handleMultiDayCancel = useMemoizedFn(function () {
458
+ setMultiDayModalOpen(false);
459
+ setPendingMultiDayData(null);
460
+ });
461
+ // 处理添加 holder 的函数
462
+ var handleAddHolder = useMemoizedFn( /*#__PURE__*/function () {
463
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(cacheItem) {
464
+ var _stateRef$current, _cacheItem$_extend;
465
+ var holderConfig, currentMaxSelectedCount, result;
466
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
467
+ while (1) switch (_context4.prev = _context4.next) {
468
+ case 0:
469
+ // 获取 maxSelectedCount
470
+ holderConfig = ((_stateRef$current = stateRef.current) === null || _stateRef$current === void 0 || (_stateRef$current = _stateRef$current.bookingConfig) === null || _stateRef$current === void 0 ? void 0 : _stateRef$current.holder) || {};
471
+ currentMaxSelectedCount = (holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.maxSelectedCount) || (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.quantity) || 1; // 调用 selectHolderModal,所有逻辑都在内部处理
472
+ _context4.next = 4;
473
+ return selectHolderModal({
474
+ state: stateRef.current,
475
+ dispatch: dispatch,
476
+ maxSelectedCount: currentMaxSelectedCount
477
+ });
478
+ case 4:
479
+ result = _context4.sent;
480
+ return _context4.abrupt("return", result);
481
+ case 6:
482
+ case "end":
483
+ return _context4.stop();
484
+ }
485
+ }, _callee4);
486
+ }));
487
+ return function (_x11) {
488
+ return _ref4.apply(this, arguments);
489
+ };
490
+ }());
491
+ var handleSelectProduct = useMemoizedFn(function (item) {
492
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'select';
493
+ if (!isNormalProductByDurationSchedule(item)) {
494
+ var _state$service;
495
+ if (!Array.isArray((_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.resourcesOrigin) || !state.service.resourcesOrigin.length) {
496
+ dispatch({
497
+ type: 'setService',
498
+ payload: _objectSpread(_objectSpread({}, stateRef.current.service), {}, {
499
+ reloadResourceModal: true
500
+ })
501
+ });
502
+ return;
503
+ }
504
+ }
505
+ var isSession = isSessionProduct(item);
506
+ // 是否有单规格 组合规格 套餐, 或者session商品 如果没有不需要打开弹窗
507
+ var isEject = getIsEject(item, type);
508
+ var isOnlySession = getIsOnlySession(item);
509
+ var lock = false;
510
+ // 对于不需要打开弹窗的商品, 直接模拟数据, 不走弹窗
511
+ var cacheValues = null;
512
+ if (isEject) {
513
+ setCurrentProduct(item);
514
+ } else {
515
+ setCurrentProduct(null);
516
+ if ((item === null || item === void 0 ? void 0 : item.extension_type) === 'normal') {
517
+ cacheValues = {
518
+ bundle: [],
519
+ key: item.id,
520
+ option: [],
521
+ product_id: item.id,
522
+ product_variant_id: 0,
523
+ quantity: 1,
524
+ rowKey: item.id,
525
+ session: null,
526
+ unique: '08974625397',
527
+ _originalItem: item // 保存原始商品信息
528
+ };
529
+ }
530
+ }
531
+ var callback = /*#__PURE__*/function () {
532
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(e, extension_type, detail, notShowToast) {
533
+ var data, _detail, isMultiDay;
534
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
535
+ while (1) switch (_context5.prev = _context5.next) {
663
536
  case 0:
537
+ debugger;
664
538
  setCurrentProduct(null);
665
- if (isBooking4) {
666
- _context3.next = 5;
539
+ // 防止选择商品弹窗多次触发callback
540
+ if (!lock) {
541
+ _context5.next = 4;
667
542
  break;
668
543
  }
669
- _context3.next = 4;
670
- return handleBookingCreation(item, e, detail);
544
+ return _context5.abrupt("return");
671
545
  case 4:
672
- return _context3.abrupt("return");
673
- case 5:
674
- handleBooking4Service(item, e, detail, notShowToast);
675
- case 6:
546
+ lock = true;
547
+
548
+ // 2秒后解除
549
+ setTimeout(function () {
550
+ lock = false;
551
+ }, 2000);
552
+ if (isBooking4) {
553
+ _context5.next = 12;
554
+ break;
555
+ }
556
+ _context5.next = 9;
557
+ return createBookingData({
558
+ product: _objectSpread(_objectSpread({}, detail || item), {}, {
559
+ _params: e
560
+ })
561
+ });
562
+ case 9:
563
+ data = _context5.sent;
564
+ // 创建预约
565
+ createBooking({
566
+ booking: data
567
+ });
568
+ return _context5.abrupt("return");
569
+ case 12:
570
+ // info2 addService 逻辑
571
+ _detail = detail || item; // 判断是否是跨日商品,如果是,先打开时间选择弹窗
572
+ isMultiDay = isMultiDayProduct(_detail || item);
573
+ if (!isMultiDay) {
574
+ _context5.next = 18;
575
+ break;
576
+ }
577
+ // 保存待处理的数据
578
+ setPendingMultiDayData({
579
+ item: item,
580
+ detail: _detail,
581
+ e: e,
582
+ notShowToast: notShowToast
583
+ });
584
+ // 打开时间选择弹窗
585
+ setMultiDayModalOpen(true);
586
+ return _context5.abrupt("return");
587
+ case 18:
588
+ _context5.next = 20;
589
+ return processAddService(item, _detail, e, notShowToast, state.date.value);
590
+ case 20:
676
591
  case "end":
677
- return _context3.stop();
592
+ return _context5.stop();
678
593
  }
679
- }, _callee3);
594
+ }, _callee5);
680
595
  }));
681
- return function (_x5, _x6, _x7, _x8) {
682
- return _ref3.apply(this, arguments);
596
+ return function callback(_x12, _x13, _x14, _x15) {
597
+ return _ref5.apply(this, arguments);
683
598
  };
684
599
  }();
685
- });
686
600
 
687
- // 打开产品选择弹窗
688
- var openProductModal = useMemoizedFn(function (item) {
689
- var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'select';
690
- var isSession = isSessionProduct(item);
691
- var isOnlySession = getIsOnlySession(item);
692
- var isEject = getIsEject(item, type);
601
+ // 如果不需要打开弹窗, 直接添加数据
602
+ if (cacheValues) {
603
+ var _stateRef$current$ser2, _detail$_extend, _Toast$success2;
604
+ var productId = item.id.toString();
605
+
606
+ // 如果已经有pending的同商品,增加点击次数
607
+ if (pendingCacheValuesRef.current[productId]) {
608
+ clickCountRef.current[productId] = (clickCountRef.current[productId] || 1) + 1;
609
+ } else {
610
+ // 第一次点击,初始化数据
611
+ pendingCacheValuesRef.current[productId] = cacheValues;
612
+ clickCountRef.current[productId] = 1;
613
+ }
614
+ var cacheItem = createSimpleCacheItem(item, cacheValues, state);
615
+ var detail = (_stateRef$current$ser2 = stateRef.current.service.value) === null || _stateRef$current$ser2 === void 0 ? void 0 : _stateRef$current$ser2.find(function (val) {
616
+ return isSameProduct(val, cacheItem);
617
+ });
618
+ var originalQuantity = (detail === null || detail === void 0 || (_detail$_extend = detail._extend) === null || _detail$_extend === void 0 ? void 0 : _detail$_extend.quantity) || 0;
619
+ Toast === null || Toast === void 0 || (_Toast$success2 = Toast.success) === null || _Toast$success2 === void 0 || _Toast$success2.call(Toast, /*#__PURE__*/React.createElement("div", {
620
+ className: "add-toast-wrap"
621
+ }, /*#__PURE__*/React.createElement("div", {
622
+ className: "add-toast-title"
623
+ }, item.title), /*#__PURE__*/React.createElement("div", {
624
+ className: "add-toast-quantity"
625
+ }, locales.getText('pisell2.ticket-booking.in-cart')((clickCountRef.current[productId] || 1) + originalQuantity))));
626
+ debouncedExecuteCacheValues(productId, cacheValues, item, callback);
627
+ return;
628
+ }
693
629
  state.action({
694
630
  type: 'pisell1.handleOpenProductModal',
695
631
  data: {
696
632
  id: item.id,
697
633
  date: state.date.value.format('YYYY-MM-DD'),
698
- productDetail: item,
699
634
  showConfig: {
700
635
  option: true,
701
636
  session: isSession,
@@ -711,315 +646,11 @@ var AddSerivce = function AddSerivce(props) {
711
646
  onCancel: function onCancel() {
712
647
  setCurrentProduct(null);
713
648
  },
714
- callback: createProductModalCallback(item)
649
+ callback: callback
715
650
  });
716
651
  });
717
-
718
- // 处理产品选择
719
- var handleSelectProduct = useMemoizedFn( /*#__PURE__*/function () {
720
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(item) {
721
- var type,
722
- _args4 = arguments;
723
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
724
- while (1) switch (_context4.prev = _context4.next) {
725
- case 0:
726
- type = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : 'select';
727
- console.time("handleSelectProduct2");
728
- console.log(item, 'handleSelectProduct');
729
- // 检查资源可用性
730
- console.time("checkResourceAvailability");
731
- if (checkResourceAvailability(item)) {
732
- _context4.next = 6;
733
- break;
734
- }
735
- return _context4.abrupt("return");
736
- case 6:
737
- console.timeEnd("checkResourceAvailability");
738
- // 0ms
739
- // 如果不需要打开详情弹窗,直接添加服务
740
- if (!(!item.isOpenDetailModal && item.cartDetailValue)) {
741
- _context4.next = 11;
742
- break;
743
- }
744
- _context4.next = 10;
745
- return handleDirectAddService(item);
746
- case 10:
747
- return _context4.abrupt("return");
748
- case 11:
749
- // 打开产品选择弹窗
750
- openProductModal(item, type);
751
- case 12:
752
- case "end":
753
- return _context4.stop();
754
- }
755
- }, _callee4);
756
- }));
757
- return function (_x9) {
758
- return _ref4.apply(this, arguments);
759
- };
760
- }());
761
- /**
762
- const handleSelectProduct = useMemoizedFn(
763
- (item: any, type: 'select' | 'detail' = 'select') => {
764
- console.log(item, 'handleSelectProduct');
765
- if (!isNormalProductByDurationSchedule(item)) {
766
- if (
767
- !Array.isArray(state.service?.resourcesOrigin) ||
768
- !state.service.resourcesOrigin.length
769
- ) {
770
- dispatch({
771
- type: 'setService',
772
- payload: {
773
- ...stateRef.current.service,
774
- reloadResourceModal: true,
775
- },
776
- });
777
- return;
778
- }
779
- }
780
- const isSession = isSessionProduct(item);
781
- // 是否有单规格 组合规格 套餐, 或者session商品 如果没有不需要打开弹窗
782
- const isEject = getIsEject(item, type);
783
- const isOnlySession = getIsOnlySession(item);
784
- let lock = false;
785
- // 对于不需要打开弹窗的商品, 直接模拟数据, 不走弹窗
786
- let cacheValues = null;
787
- if (isEject) {
788
- setCurrentProduct(item);
789
- } else {
790
- setCurrentProduct(null);
791
- if (item?.extension_type === 'normal') {
792
- cacheValues = {
793
- bundle: [],
794
- key: item.id,
795
- option: [],
796
- product_id: item.id,
797
- product_variant_id: 0,
798
- quantity: 1,
799
- rowKey: item.id,
800
- session: null,
801
- unique: '08974625397',
802
- _originalItem: item, // 保存原始商品信息
803
- };
804
- }
805
- }
806
- const callback = async (
807
- e: any,
808
- extension_type: any,
809
- detail: any,
810
- notShowToast: boolean
811
- ) => {
812
- setCurrentProduct(null);
813
- // 防止选择商品弹窗多次触发callback
814
- // if (lock) {
815
- // return;
816
- // }
817
- lock = true;
818
- // 2秒后解除
819
- setTimeout(() => {
820
- lock = false;
821
- }, 2000);
822
- if (!isBooking4) {
823
- // info1 addService 逻辑
824
- // 预生成预约数据
825
- const data = await createBookingData({
826
- product: { ...(detail || item), _params: e },
827
- });
828
- // 创建预约
829
- createBooking({ booking: data });
830
- return;
831
- }
832
- const _currentItem = detail || item;
833
- // info2 addService 逻辑
834
- const _detail = _currentItem;
835
- const other = JSON.parse(JSON.stringify(e));
836
- other.session = e.session;
837
- let cacheItem: any = {
838
- ..._detail,
839
- product_id: _currentItem.id,
840
- _id: getUniqueId(),
841
- _key: e.key,
842
- _extend: {
843
- start_date: state.date.value,
844
- quantity: e?.quantity || 1,
845
- price: _detail.price,
846
- product_name: _currentItem.title,
847
- other,
848
- },
849
- new: 1,
850
- };
851
- let _total = getProductTotalPrice(cacheItem);
852
- // 用于折扣 可修改
853
- cacheItem._extend.total = _total;
854
- // 用于储存原价
855
- cacheItem._extend.origin_total = _total;
856
- const _isEdit = !!state.service.cacheItem;
857
- if (_isEdit) {
858
- cacheItem._id = state.service.cacheItem?._id;
859
- cacheItem.new = 0;
860
- }
861
- // 渲染到当前位置模式时,默认无资源 时间默认取顶部设置的时间
862
- if (renderMode === 'current') {
863
- // cacheItem._extend.resource = 0;
864
- cacheItem.currentDefaultTime = state.date.value.format('HH:mm');
865
- }
866
- cacheItem = getProductExtend({
867
- cacheItem,
868
- state,
869
- isDisabledTime: true,
870
- });
871
- if (state.renderType === 'eventBooking') {
872
- cacheItem.autoClose = false;
873
- }
874
- if (cacheItem.autoClose) {
875
- cacheItem.autoClose = false;
876
- cacheItem._serviceKey = genServiceKey(cacheItem);
877
- const val = getCurrentServiceValue();
878
- let { list: _list, quantity } = addService(
879
- [...val],
880
- cacheItem,
881
- stateRef.current
882
- );
883
- // 更新ref以确保后续快速操作时使用最新值
884
- latestServiceValueRef.current = _list;
885
- lastOperationTimeRef.current = Date.now();
886
- if (!notShowToast) {
887
- handleAddToast(cacheItem.title, quantity || 1);
888
- }
889
- window.dispatchEvent(
890
- new CustomEvent('onAddNewService', {
891
- detail: {
892
- cacheItem,
893
- },
894
- })
895
- );
896
- try {
897
- if (
898
- context.appHelper.utils.store?.getState?.()?.global?.globalConfig
899
- ?.id === 2155
900
- ) {
901
- const val = _list?.map((s) => {
902
- return {
903
- product_id: s?.product_id,
904
- detailId: s?.id,
905
- detailProductId: s?.product_id,
906
- product_name: s?.title,
907
- price: s?.price,
908
- _id: s?._id,
909
- _key: s?._key,
910
- _serviceKey: s?._serviceKey,
911
- };
912
- });
913
- const sendData = {
914
- product_id: _currentItem?.id,
915
- detailId: _detail?.id,
916
- detailProductId: _detail?.product_id,
917
- product_name: _currentItem?.title,
918
- price: _detail?.price,
919
- serviceVal: val,
920
- };
921
- sendWarningLog({
922
- title: 'addService',
923
- content: [
924
- { key: '添加数据', value: JSON.stringify(sendData) },
925
- {
926
- key: '日期',
927
- value: dayjs().format('YYYY-MM-DD HH:mm:ss'),
928
- },
929
- ],
930
- });
931
- }
932
- } catch (error) {}
933
- dispatch({
934
- type: 'setService',
935
- payload: {
936
- addModal: false,
937
- value: _list,
938
- edit: true,
939
- changeService: false,
940
- },
941
- });
942
- } else {
943
- window.openBookingEditModal?.();
944
- dispatch({
945
- type: 'setService',
946
- payload: {
947
- editModal: true,
948
- cacheItem: cacheItem,
949
- addModal: !cacheItem.autoClose,
950
- changeService: false,
951
- },
952
- });
953
- onEdit?.(cacheItem);
954
- }
955
- };
956
- // 如果不需要打开弹窗, 直接添加数据
957
- if (cacheValues) {
958
- const productId = item.id.toString();
959
- // 如果已经有pending的同商品,增加点击次数
960
- if (pendingCacheValuesRef.current[productId]) {
961
- clickCountRef.current[productId] =
962
- (clickCountRef.current[productId] || 1) + 1;
963
- } else {
964
- // 第一次点击,初始化数据
965
- pendingCacheValuesRef.current[productId] = cacheValues;
966
- clickCountRef.current[productId] = 1;
967
- }
968
- const cacheItem = createSimpleCacheItem(item, cacheValues, stateRef.current);
969
- const detail = stateRef.current.service.value?.find((val: any) =>
970
- isSameProduct(val, cacheItem)
971
- );
972
- const originalQuantity = detail?._extend?.quantity || 0;
973
- Toast?.success?.(
974
- <div className="add-toast-wrap">
975
- <div className="add-toast-title">{item.title}</div>
976
- <div className="add-toast-quantity">
977
- {locales.getText('pisell2.ticket-booking.in-cart')(
978
- (clickCountRef.current[productId] || 1) + originalQuantity
979
- )}
980
- </div>
981
- </div>
982
- );
983
- debouncedExecuteCacheValues(productId, cacheValues, item, callback);
984
- return;
985
- }
986
- state.action({
987
- type: 'pisell1.handleOpenProductModal',
988
- data: {
989
- id: item.id,
990
- date: state.date.value.format('YYYY-MM-DD'),
991
- showConfig: {
992
- option: true,
993
- session: isSession,
994
- variant: true,
995
- package: true,
996
- number: getIsShowNumber(item, state),
997
- },
998
- isOnlySession,
999
- is_eject: isEject ? 1 : 0,
1000
- customer_id: customerId,
1001
- isOS: isSession,
1002
- },
1003
- onCancel: () => {
1004
- setCurrentProduct(null);
1005
- },
1006
- callback,
1007
- });
1008
- }
1009
- );
1010
- */
1011
652
  var renderList = useMemo(function () {
1012
653
  var _list = products || [];
1013
-
1014
- // 跨日预约
1015
- if (isDaysBooking(state)) {
1016
- // 公共购物车下过滤掉预约商品
1017
- if (!holderId(state)) {
1018
- _list = _list.filter(function (item) {
1019
- return isNormalProductByDurationSchedule(item);
1020
- });
1021
- }
1022
- }
1023
654
  return _list;
1024
655
  }, [products, state === null || state === void 0 ? void 0 : state.activeCartId]);
1025
656
  var currentDate = useMemo(function () {
@@ -1029,20 +660,7 @@ var AddSerivce = function AddSerivce(props) {
1029
660
  return state.date.value.format('YYYY-MM-DD HH:mm:ss');
1030
661
  }, [state.date.value]);
1031
662
  useEffect(function () {
1032
- if (renderMode === 'current' && state.bookingConfig && platform !== 'shop') {
1033
- getProducts({
1034
- schedule_date: currentDate,
1035
- customer_id: customerId,
1036
- menu_list_ids: menuList,
1037
- schedule_datetime: currentDatetime
1038
- });
1039
- getScheduleTimePoints({
1040
- menu_list_ids: menuList
1041
- });
1042
- }
1043
- }, [renderMode, customerId, menuList]);
1044
- useEffect(function () {
1045
- if (renderMode === 'current' && state.bookingConfig && platform === 'shop') {
663
+ if (renderMode === 'current' && state.bookingConfig) {
1046
664
  getProducts({
1047
665
  schedule_date: currentDate,
1048
666
  customer_id: customerId,
@@ -1071,6 +689,7 @@ var AddSerivce = function AddSerivce(props) {
1071
689
  }, [productDisplayConfig]);
1072
690
  return useMemo(function () {
1073
691
  if (renderMode === 'current') {
692
+ var _pendingMultiDayData$;
1074
693
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProductDisplayAdapter, {
1075
694
  config: finalDisplayConfig,
1076
695
  dataSource: renderList,
@@ -1079,9 +698,17 @@ var AddSerivce = function AddSerivce(props) {
1079
698
  onSelectProduct: handleSelectProduct
1080
699
  }), /*#__PURE__*/React.createElement(NotAvailable, {
1081
700
  ref: notAvailableRef
1082
- }));
701
+ }), /*#__PURE__*/React.createElement(MultiDayTimeSelectModal, {
702
+ open: multiDayModalOpen,
703
+ productName: pendingMultiDayData === null || pendingMultiDayData === void 0 || (_pendingMultiDayData$ = pendingMultiDayData.item) === null || _pendingMultiDayData$ === void 0 ? void 0 : _pendingMultiDayData$.title,
704
+ locale: state === null || state === void 0 ? void 0 : state.locale,
705
+ defaultStartDate: state.date.value,
706
+ loading: multiDayModalLoading,
707
+ onConfirm: handleMultiDayConfirm,
708
+ onCancel: handleMultiDayCancel
709
+ }), /*#__PURE__*/React.createElement(SelectHolderModal, null));
1083
710
  }
1084
711
  return null;
1085
- }, [firstLoading, state.service.addModal, locales, renderList, state.amountSymbol, state.renderType, state === null || state === void 0 ? void 0 : state.activeCartId, holderId(state), loading, currentProduct, isBooking4, finalDisplayConfig]);
712
+ }, [firstLoading, state.service.addModal, locales, renderList, state.amountSymbol, state.renderType, state === null || state === void 0 ? void 0 : state.activeCartId, holderId(state), loading, currentProduct, isBooking4, finalDisplayConfig, multiDayModalOpen, pendingMultiDayData, multiDayModalLoading]);
1086
713
  };
1087
714
  export default AddSerivce;