@pisell/private-materials 6.1.1 → 6.2.1

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 (480) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +13 -13
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +11 -11
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +11 -11
  11. package/es/businessModel/SalesModel/Sales/index.js +37 -4
  12. package/es/businessModel/SalesModel/index.d.ts +0 -1
  13. package/es/components/Sales/Cart/index.js +13 -4
  14. package/es/components/Sales/Cart/utils.d.ts +40 -0
  15. package/es/components/Sales/Cart/utils.js +171 -0
  16. package/es/components/Sales/Checkout/index.d.ts +4 -0
  17. package/es/components/Sales/Checkout/index.js +52 -8
  18. package/es/components/Sales/Checkout/serve.d.ts +13 -0
  19. package/es/components/Sales/Checkout/serve.js +16 -2
  20. package/es/components/Sales/Checkout/utils.d.ts +6 -1
  21. package/es/components/Sales/Checkout/utils.js +15 -4
  22. package/es/components/Sales/Customer/index.d.ts +1 -0
  23. package/es/components/Sales/Customer/index.js +1 -0
  24. package/es/components/Sales/Resource/index.js +2 -2
  25. package/es/components/Sales/Resource/serve.d.ts +7 -0
  26. package/es/components/Sales/Resource/serve.js +10 -0
  27. package/es/components/Sales/Summary/index.d.ts +10 -0
  28. package/es/components/Sales/Summary/index.js +17 -2
  29. package/es/components/Sales/Summary/serve.d.ts +1 -0
  30. package/es/components/Sales/Summary/serve.js +6 -0
  31. package/es/components/Sales/Summary/utils.d.ts +15 -0
  32. package/es/components/Sales/Summary/utils.js +43 -1
  33. package/es/components/appointmentBooking/components/Cart/Item/index.js +1 -0
  34. package/es/components/appointmentBooking/components/Content/index.js +15 -1
  35. package/es/components/appointmentBooking/components/Deposit/index.d.ts +6 -0
  36. package/es/components/appointmentBooking/components/Deposit/index.js +27 -7
  37. package/es/components/appointmentBooking/components/Form/index.js +1 -1
  38. package/es/components/appointmentBooking/components/Form/utils.d.ts +1 -1
  39. package/es/components/appointmentBooking/components/Form/utils.js +17 -15
  40. package/es/components/appointmentBooking/components/Header/index.js +2 -1
  41. package/es/components/appointmentBooking/components/Resource/index.js +1 -0
  42. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.js +25 -20
  43. package/es/components/appointmentBooking/deposit/index.js +4 -2
  44. package/es/components/booking/components/TabProduct/index.d.ts +0 -1
  45. package/es/components/booking/components/footer/index.js +9 -33
  46. package/es/components/booking/components/footer/utils.d.ts +1 -0
  47. package/es/components/booking/components/footer/utils.js +47 -18
  48. package/es/components/booking/components/formItemChildrenWrap/index.d.ts +0 -1
  49. package/es/components/booking/components/reloadResourceModal/index.d.ts +8 -0
  50. package/es/components/{pay/toB/store/provider.js → booking/components/reloadResourceModal/index.js} +48 -52
  51. package/es/components/booking/components/reloadResourceModal/index.less +6 -0
  52. package/es/components/booking/components/voucher/index.js +2 -2
  53. package/es/components/booking/editBookingModal/index.d.ts +5 -0
  54. package/es/components/booking/editBookingModal/index.js +386 -0
  55. package/es/components/booking/editBookingModal/index.less +8 -0
  56. package/es/components/booking/editBookingModal/locales.d.ts +21 -0
  57. package/es/components/booking/editBookingModal/locales.js +20 -0
  58. package/es/components/booking/editBookingModal/mock.d.ts +807 -0
  59. package/es/components/booking/editBookingModal/mock.js +2993 -0
  60. package/es/components/booking/editBookingModal/serve.d.ts +51 -0
  61. package/es/components/booking/editBookingModal/serve.js +288 -0
  62. package/es/components/booking/editBookingModal/type.d.ts +12 -0
  63. package/es/components/booking/editBookingModal/type.js +1 -0
  64. package/es/components/booking/editBookingModal/utils.d.ts +12 -0
  65. package/es/components/booking/editBookingModal/utils.js +157 -0
  66. package/es/components/booking/forms/table/index.d.ts +0 -1
  67. package/es/components/booking/hooks/useIsBooking4Shop.js +2 -2
  68. package/es/components/booking/info/addServiceVariant/index.js +2 -2
  69. package/es/components/booking/info/client/index.js +2 -2
  70. package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  71. package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  72. package/es/components/booking/info/hooks/useInfoHolder.js +8 -1
  73. package/es/components/booking/info/index.js +4 -5
  74. package/es/components/booking/info/model.js +5 -0
  75. package/es/components/booking/info/service/addService/index.js +2 -2
  76. package/es/components/booking/info/service/editService/index.js +1 -1
  77. package/es/components/booking/info/service/like/index.d.ts +0 -1
  78. package/es/components/booking/info/service/serviceManager/index.js +4 -4
  79. package/es/components/booking/info/service2/Lists.d.ts +0 -1
  80. package/es/components/booking/info/service2/utils.d.ts +1 -1
  81. package/es/components/booking/info/service2/utils.js +6 -4
  82. package/es/components/booking/info/utils.js +1 -1
  83. package/es/components/booking/info2/index.js +37 -13
  84. package/es/components/booking/info2/service/addService/index.js +22 -9
  85. package/es/components/booking/info2/service/addService/utils.d.ts +10 -0
  86. package/es/components/booking/info2/service/addService/utils.js +48 -14
  87. package/es/components/booking/info2/service/addTimeModal/index.js +32 -9
  88. package/es/components/booking/info2/service/editService/Resources/index.js +22 -8
  89. package/es/components/booking/info2/service/editService/Resources/index.less +6 -0
  90. package/es/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.d.ts +7 -0
  91. package/es/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.js +26 -0
  92. package/es/components/booking/info2/service/editService/ResourcesV2/index.d.ts +10 -0
  93. package/es/components/booking/info2/service/editService/ResourcesV2/index.js +308 -0
  94. package/es/components/booking/info2/service/editService/ResourcesV2/index.less +44 -0
  95. package/es/components/booking/info2/service/editService/index.js +12 -15
  96. package/es/components/booking/info2/utils.js +13 -16
  97. package/es/components/booking/info2/utilsByBooking.js +10 -1
  98. package/es/components/booking/locales.d.ts +12 -0
  99. package/es/components/booking/locales.js +12 -0
  100. package/es/components/booking/materiels/holder/index.d.ts +0 -1
  101. package/es/components/booking/materiels/startTime/index.d.ts +0 -1
  102. package/es/components/booking/model.d.ts +1 -0
  103. package/es/components/eftpos/deviceList/index.d.ts +0 -1
  104. package/es/components/eftpos/form/index.d.ts +0 -1
  105. package/es/components/eftpos/group/index.d.ts +0 -1
  106. package/es/components/eftpos/hooks.d.ts +0 -1
  107. package/es/components/eftpos/icon/apiKey.d.ts +0 -1
  108. package/es/components/eftpos/icon/device.d.ts +0 -1
  109. package/es/components/eftpos/receipt/index.d.ts +0 -1
  110. package/es/components/eftpos/surcharge/index.d.ts +0 -1
  111. package/es/components/eftposPay/component/alert/warn.d.ts +0 -1
  112. package/es/components/eftposPay/component/header/titlebar.d.ts +0 -1
  113. package/es/components/eftposPay/component/step/index.d.ts +0 -1
  114. package/es/components/eftposPay/component/step/step.d.ts +0 -1
  115. package/es/components/eftposPay/const.d.ts +4 -1
  116. package/es/components/eftposPay/const.js +3 -1
  117. package/es/components/eftposPay/hooks.d.ts +2 -2
  118. package/es/components/eftposPay/hooks.js +3 -1
  119. package/es/components/eftposPay/index.js +1 -1
  120. package/es/components/eftposPay/linkly/const.d.ts +23 -0
  121. package/es/components/eftposPay/linkly/const.js +82 -0
  122. package/es/components/eftposPay/linkly/hooks/index.d.ts +2 -0
  123. package/es/components/eftposPay/linkly/hooks/index.js +2 -0
  124. package/es/components/eftposPay/linkly/hooks/normal.d.ts +30 -0
  125. package/es/components/eftposPay/linkly/hooks/normal.js +321 -0
  126. package/es/components/eftposPay/linkly/hooks/useTimeQuery.d.ts +4 -0
  127. package/es/components/{pay/toB/store/hooks.js → eftposPay/linkly/hooks/useTimeQuery.js} +252 -59
  128. package/es/components/eftposPay/linkly/index.d.ts +2 -0
  129. package/es/components/eftposPay/linkly/index.js +197 -0
  130. package/es/components/eftposPay/linkly/service.d.ts +32 -0
  131. package/es/components/eftposPay/linkly/service.js +81 -0
  132. package/es/components/eftposPay/manufacturer.d.ts +1 -0
  133. package/es/components/eftposPay/manufacturer.js +4 -0
  134. package/es/components/eftposPay/pay.d.ts +1 -1
  135. package/es/components/eftposPay/pay.js +6 -2
  136. package/es/components/eftposPay/payo/config.js +30 -3
  137. package/es/components/eftposPay/store/index.d.ts +5 -5
  138. package/es/components/eftposPay/tyro/hooks.d.ts +0 -1
  139. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +40 -19
  140. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +2 -0
  141. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.js +17 -0
  142. package/es/components/eventBooking/components/Provider/Cart/Item/Total.js +10 -6
  143. package/es/components/eventBooking/components/Provider/Cart/Item/index.js +4 -2
  144. package/es/components/eventBooking/components/Provider/Event/index.js +13 -4
  145. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
  146. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  147. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  148. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
  149. package/es/components/eventBooking/components/bookingDetailModal/index.js +22 -4
  150. package/es/components/eventBooking/index.js +21 -7
  151. package/es/components/eventBooking/locales.d.ts +24 -0
  152. package/es/components/eventBooking/locales.js +30 -6
  153. package/es/components/index.d.ts +3 -1
  154. package/es/components/index.js +3 -1
  155. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  156. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/SDK.d.ts +0 -1
  157. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  158. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  159. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/PaymentRequestForm.d.ts +0 -1
  160. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +0 -1
  161. package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +0 -1
  162. package/es/components/productExtension/fields/Actor/index.d.ts +0 -1
  163. package/es/components/productExtension/fields/Forms/index.d.ts +0 -1
  164. package/es/components/productSelect/components/pisellPriceText/index.js +2 -3
  165. package/es/components/schedules/calendar/calendarItem.d.ts +0 -1
  166. package/es/components/schedules/components/CurrentDay/index.d.ts +0 -1
  167. package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +0 -1
  168. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +0 -1
  169. package/es/components/schedules/products/ProductDetailDrawer/ProductDetailByDate/index.d.ts +0 -1
  170. package/es/components/schedules/products/index.d.ts +0 -1
  171. package/es/components/schedules/resources/relationProduct/index.d.ts +0 -1
  172. package/es/components/schedules/utils.d.ts +1 -1
  173. package/es/components/shoppingCart/components/Empty/index.d.ts +0 -1
  174. package/es/components/shoppingCart/components/Render/index.d.ts +0 -1
  175. package/es/components/stepController/components/Content/index.d.ts +7 -0
  176. package/es/components/stepController/components/Content/index.js +9 -0
  177. package/es/components/stepController/components/Content/index.less +8 -0
  178. package/es/components/stepController/components/Footer/index.d.ts +8 -0
  179. package/es/components/stepController/components/Footer/index.js +15 -0
  180. package/es/components/stepController/components/Footer/index.less +39 -0
  181. package/es/components/stepController/components/Header/index.d.ts +20 -0
  182. package/es/components/stepController/components/Header/index.js +97 -0
  183. package/es/components/stepController/components/Header/index.less +21 -0
  184. package/es/components/stepController/index.d.ts +5 -0
  185. package/es/components/stepController/index.js +64 -0
  186. package/es/components/stepController/index.less +11 -0
  187. package/es/components/stepController/locales.d.ts +27 -0
  188. package/es/components/stepController/locales.js +32 -0
  189. package/es/components/stepController/types.d.ts +23 -0
  190. package/es/components/stepController/types.js +1 -0
  191. package/es/components/ticketBooking/components/addServiceVariant/addService.js +19 -9
  192. package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -1
  193. package/es/components/ticketBooking/components/menuBar/index.d.ts +0 -1
  194. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  195. package/es/components/ticketBooking/components/ticketBooking/index.js +141 -142
  196. package/es/components/ticketBooking/index.js +4 -3
  197. package/es/components/ticketBooking/serve.d.ts +0 -1
  198. package/es/components/ticketBooking/serve.js +0 -26
  199. package/es/components/ticketBooking/utils/index.js +2 -1
  200. package/es/hooks/useWindowSize.d.ts +5 -0
  201. package/es/hooks/useWindowSize.js +26 -0
  202. package/es/index.d.ts +2 -1
  203. package/es/index.js +3 -2
  204. package/es/utils/index.d.ts +1 -1
  205. package/lib/businessModel/SalesModel/Sales/index.js +22 -8
  206. package/lib/businessModel/SalesModel/index.d.ts +0 -1
  207. package/lib/components/Sales/Cart/index.js +9 -4
  208. package/lib/components/Sales/Cart/utils.d.ts +40 -0
  209. package/lib/components/Sales/Cart/utils.js +120 -0
  210. package/lib/components/Sales/Checkout/index.d.ts +4 -0
  211. package/lib/components/Sales/Checkout/index.js +39 -7
  212. package/lib/components/Sales/Checkout/serve.d.ts +13 -0
  213. package/lib/components/Sales/Checkout/serve.js +7 -2
  214. package/lib/components/Sales/Checkout/utils.d.ts +6 -1
  215. package/lib/components/Sales/Checkout/utils.js +7 -3
  216. package/lib/components/Sales/Customer/index.d.ts +1 -0
  217. package/lib/components/Sales/Customer/index.js +1 -0
  218. package/lib/components/Sales/Resource/index.js +1 -1
  219. package/lib/components/Sales/Resource/serve.d.ts +7 -0
  220. package/lib/components/Sales/Resource/serve.js +9 -2
  221. package/lib/components/Sales/Summary/index.d.ts +10 -0
  222. package/lib/components/Sales/Summary/index.js +7 -1
  223. package/lib/components/Sales/Summary/serve.d.ts +1 -0
  224. package/lib/components/Sales/Summary/serve.js +32 -0
  225. package/lib/components/Sales/Summary/utils.d.ts +15 -0
  226. package/lib/components/Sales/Summary/utils.js +30 -1
  227. package/lib/components/appointmentBooking/components/Cart/Item/index.js +1 -0
  228. package/lib/components/appointmentBooking/components/Content/index.js +6 -1
  229. package/lib/components/appointmentBooking/components/Deposit/index.d.ts +6 -0
  230. package/lib/components/appointmentBooking/components/Deposit/index.js +36 -4
  231. package/lib/components/appointmentBooking/components/Form/index.js +6 -1
  232. package/lib/components/appointmentBooking/components/Form/utils.d.ts +1 -1
  233. package/lib/components/appointmentBooking/components/Form/utils.js +9 -12
  234. package/lib/components/appointmentBooking/components/Header/index.js +1 -0
  235. package/lib/components/appointmentBooking/components/Resource/index.js +1 -0
  236. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.js +8 -4
  237. package/lib/components/appointmentBooking/deposit/index.js +4 -2
  238. package/lib/components/booking/components/TabProduct/index.d.ts +0 -1
  239. package/lib/components/booking/components/footer/index.js +4 -23
  240. package/lib/components/booking/components/footer/utils.d.ts +1 -0
  241. package/lib/components/booking/components/footer/utils.js +27 -7
  242. package/lib/components/booking/components/formItemChildrenWrap/index.d.ts +0 -1
  243. package/lib/components/booking/components/reloadResourceModal/index.d.ts +8 -0
  244. package/lib/components/booking/components/reloadResourceModal/index.js +74 -0
  245. package/lib/components/booking/components/reloadResourceModal/index.less +6 -0
  246. package/lib/components/booking/components/voucher/index.js +2 -2
  247. package/lib/components/booking/editBookingModal/index.d.ts +5 -0
  248. package/lib/components/booking/editBookingModal/index.js +363 -0
  249. package/lib/components/booking/editBookingModal/index.less +8 -0
  250. package/lib/components/booking/editBookingModal/locales.d.ts +21 -0
  251. package/lib/components/booking/editBookingModal/locales.js +44 -0
  252. package/lib/components/booking/editBookingModal/mock.d.ts +807 -0
  253. package/lib/components/booking/editBookingModal/mock.js +3314 -0
  254. package/lib/components/booking/editBookingModal/serve.d.ts +51 -0
  255. package/lib/components/booking/editBookingModal/serve.js +178 -0
  256. package/lib/components/booking/editBookingModal/type.d.ts +12 -0
  257. package/lib/components/{pay/toB/store/context.js → booking/editBookingModal/type.js} +3 -18
  258. package/lib/components/booking/editBookingModal/utils.d.ts +12 -0
  259. package/lib/components/booking/editBookingModal/utils.js +158 -0
  260. package/lib/components/booking/forms/table/index.d.ts +0 -1
  261. package/lib/components/booking/hooks/useIsBooking4Shop.js +2 -2
  262. package/lib/components/booking/info/addServiceVariant/index.js +3 -3
  263. package/lib/components/booking/info/client/index.js +19 -57
  264. package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  265. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  266. package/lib/components/booking/info/hooks/useInfoHolder.js +6 -1
  267. package/lib/components/booking/info/index.js +6 -4
  268. package/lib/components/booking/info/model.js +3 -0
  269. package/lib/components/booking/info/service/addService/index.js +3 -3
  270. package/lib/components/booking/info/service/editService/index.js +1 -0
  271. package/lib/components/booking/info/service/like/index.d.ts +0 -1
  272. package/lib/components/booking/info/service/serviceManager/index.js +3 -3
  273. package/lib/components/booking/info/service2/Lists.d.ts +0 -1
  274. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  275. package/lib/components/booking/info/service2/utils.js +5 -4
  276. package/lib/components/booking/info/utils.js +2 -1
  277. package/lib/components/booking/info2/index.js +54 -20
  278. package/lib/components/booking/info2/service/addService/index.js +20 -7
  279. package/lib/components/booking/info2/service/addService/utils.d.ts +10 -0
  280. package/lib/components/booking/info2/service/addService/utils.js +32 -5
  281. package/lib/components/booking/info2/service/addTimeModal/index.js +26 -10
  282. package/lib/components/booking/info2/service/editService/Resources/index.js +54 -10
  283. package/lib/components/booking/info2/service/editService/Resources/index.less +6 -0
  284. package/lib/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.d.ts +7 -0
  285. package/lib/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.js +53 -0
  286. package/lib/components/booking/info2/service/editService/ResourcesV2/index.d.ts +10 -0
  287. package/lib/components/booking/info2/service/editService/ResourcesV2/index.js +311 -0
  288. package/lib/components/booking/info2/service/editService/ResourcesV2/index.less +44 -0
  289. package/lib/components/booking/info2/service/editService/index.js +25 -28
  290. package/lib/components/booking/info2/utils.js +0 -15
  291. package/lib/components/booking/info2/utilsByBooking.js +7 -1
  292. package/lib/components/booking/locales.d.ts +12 -0
  293. package/lib/components/booking/locales.js +12 -0
  294. package/lib/components/booking/materiels/holder/index.d.ts +0 -1
  295. package/lib/components/booking/materiels/startTime/index.d.ts +0 -1
  296. package/lib/components/booking/model.d.ts +1 -0
  297. package/lib/components/eftpos/deviceList/index.d.ts +0 -1
  298. package/lib/components/eftpos/form/index.d.ts +0 -1
  299. package/lib/components/eftpos/group/index.d.ts +0 -1
  300. package/lib/components/eftpos/hooks.d.ts +0 -1
  301. package/lib/components/eftpos/icon/apiKey.d.ts +0 -1
  302. package/lib/components/eftpos/icon/device.d.ts +0 -1
  303. package/lib/components/eftpos/receipt/index.d.ts +0 -1
  304. package/lib/components/eftpos/surcharge/index.d.ts +0 -1
  305. package/lib/components/eftposPay/component/alert/warn.d.ts +0 -1
  306. package/lib/components/eftposPay/component/header/titlebar.d.ts +0 -1
  307. package/lib/components/eftposPay/component/step/index.d.ts +0 -1
  308. package/lib/components/eftposPay/component/step/step.d.ts +0 -1
  309. package/lib/components/eftposPay/const.d.ts +4 -1
  310. package/lib/components/eftposPay/const.js +2 -0
  311. package/lib/components/eftposPay/hooks.d.ts +2 -2
  312. package/lib/components/eftposPay/hooks.js +11 -4
  313. package/lib/components/eftposPay/index.js +1 -1
  314. package/lib/components/eftposPay/linkly/const.d.ts +23 -0
  315. package/lib/components/eftposPay/linkly/const.js +102 -0
  316. package/lib/components/eftposPay/linkly/hooks/index.d.ts +2 -0
  317. package/lib/components/{pay/toB/types → eftposPay/linkly/hooks}/index.js +7 -5
  318. package/lib/components/eftposPay/linkly/hooks/normal.d.ts +30 -0
  319. package/lib/components/eftposPay/linkly/hooks/normal.js +242 -0
  320. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.d.ts +4 -0
  321. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +222 -0
  322. package/lib/components/eftposPay/linkly/index.d.ts +2 -0
  323. package/lib/components/eftposPay/linkly/index.js +208 -0
  324. package/lib/components/eftposPay/linkly/service.d.ts +32 -0
  325. package/lib/components/eftposPay/linkly/service.js +55 -0
  326. package/lib/components/eftposPay/manufacturer.d.ts +1 -0
  327. package/lib/components/eftposPay/manufacturer.js +6 -0
  328. package/lib/components/eftposPay/pay.d.ts +1 -1
  329. package/lib/components/eftposPay/pay.js +13 -2
  330. package/lib/components/eftposPay/payo/config.js +22 -2
  331. package/lib/components/eftposPay/store/index.d.ts +5 -5
  332. package/lib/components/eftposPay/tyro/hooks.d.ts +0 -1
  333. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +29 -8
  334. package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +2 -0
  335. package/lib/components/{pay/toB/components → eventBooking/components/Provider/Cart/Deposit}/index.js +26 -22
  336. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.js +8 -5
  337. package/lib/components/eventBooking/components/Provider/Cart/Item/index.js +4 -2
  338. package/lib/components/eventBooking/components/Provider/Event/index.js +10 -3
  339. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
  340. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  341. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  342. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
  343. package/lib/components/eventBooking/components/bookingDetailModal/index.js +10 -4
  344. package/lib/components/eventBooking/index.js +11 -7
  345. package/lib/components/eventBooking/locales.d.ts +24 -0
  346. package/lib/components/eventBooking/locales.js +30 -6
  347. package/lib/components/index.d.ts +3 -1
  348. package/lib/components/index.js +6 -0
  349. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  350. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/SDK.d.ts +0 -1
  351. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  352. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  353. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/PaymentRequestForm.d.ts +0 -1
  354. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +0 -1
  355. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +0 -1
  356. package/lib/components/productExtension/fields/Actor/index.d.ts +0 -1
  357. package/lib/components/productExtension/fields/Forms/index.d.ts +0 -1
  358. package/lib/components/productSelect/components/pisellPriceText/index.js +2 -8
  359. package/lib/components/schedules/calendar/calendarItem.d.ts +0 -1
  360. package/lib/components/schedules/components/CurrentDay/index.d.ts +0 -1
  361. package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +0 -1
  362. package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +0 -1
  363. package/lib/components/schedules/products/ProductDetailDrawer/ProductDetailByDate/index.d.ts +0 -1
  364. package/lib/components/schedules/products/index.d.ts +0 -1
  365. package/lib/components/schedules/resources/relationProduct/index.d.ts +0 -1
  366. package/lib/components/schedules/utils.d.ts +1 -1
  367. package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -1
  368. package/lib/components/shoppingCart/components/Render/index.d.ts +0 -1
  369. package/lib/components/stepController/components/Content/index.d.ts +7 -0
  370. package/lib/components/{pay/toB/components/Content/Header.js → stepController/components/Content/index.js} +9 -9
  371. package/lib/components/stepController/components/Content/index.less +8 -0
  372. package/lib/components/stepController/components/Footer/index.d.ts +8 -0
  373. package/lib/components/{pay/toB/components/CardGroup → stepController/components/Footer}/index.js +17 -11
  374. package/lib/components/stepController/components/Footer/index.less +39 -0
  375. package/lib/components/stepController/components/Header/index.d.ts +20 -0
  376. package/lib/components/stepController/components/Header/index.js +104 -0
  377. package/lib/components/stepController/components/Header/index.less +21 -0
  378. package/lib/components/stepController/index.d.ts +5 -0
  379. package/lib/components/stepController/index.js +89 -0
  380. package/lib/components/stepController/index.less +11 -0
  381. package/lib/components/stepController/locales.d.ts +27 -0
  382. package/lib/components/stepController/locales.js +50 -0
  383. package/lib/components/stepController/types.d.ts +23 -0
  384. package/lib/components/{pay/toB/store/index.js → stepController/types.js} +3 -13
  385. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +22 -11
  386. package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -1
  387. package/lib/components/ticketBooking/components/menuBar/index.d.ts +0 -1
  388. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  389. package/lib/components/ticketBooking/components/ticketBooking/index.js +147 -143
  390. package/lib/components/ticketBooking/index.js +5 -16
  391. package/lib/components/ticketBooking/serve.d.ts +0 -1
  392. package/lib/components/ticketBooking/serve.js +0 -11
  393. package/lib/components/ticketBooking/utils/index.js +2 -1
  394. package/lib/hooks/useWindowSize.d.ts +5 -0
  395. package/lib/hooks/useWindowSize.js +51 -0
  396. package/lib/index.d.ts +2 -1
  397. package/lib/index.js +6 -3
  398. package/lib/utils/index.d.ts +1 -1
  399. package/lowcode/edit-booking-modal/meta.ts +53 -0
  400. package/lowcode/step-controller/meta.ts +88 -0
  401. package/package.json +3 -3
  402. package/es/components/pay/toB/components/Cache/index.d.ts +0 -10
  403. package/es/components/pay/toB/components/Cache/index.js +0 -94
  404. package/es/components/pay/toB/components/Cache/index.less +0 -41
  405. package/es/components/pay/toB/components/Card/index.d.ts +0 -7
  406. package/es/components/pay/toB/components/Card/index.js +0 -32
  407. package/es/components/pay/toB/components/Card/index.less +0 -26
  408. package/es/components/pay/toB/components/CardGroup/index.d.ts +0 -7
  409. package/es/components/pay/toB/components/CardGroup/index.js +0 -22
  410. package/es/components/pay/toB/components/CardGroup/index.less +0 -18
  411. package/es/components/pay/toB/components/ConfirmedPayment/index.d.ts +0 -6
  412. package/es/components/pay/toB/components/ConfirmedPayment/index.js +0 -67
  413. package/es/components/pay/toB/components/ConfirmedPayment/index.less +0 -69
  414. package/es/components/pay/toB/components/Content/Footer.d.ts +0 -7
  415. package/es/components/pay/toB/components/Content/Footer.js +0 -36
  416. package/es/components/pay/toB/components/Content/Header.d.ts +0 -4
  417. package/es/components/pay/toB/components/Content/Header.js +0 -12
  418. package/es/components/pay/toB/components/Content/index.d.ts +0 -4
  419. package/es/components/pay/toB/components/Content/index.js +0 -277
  420. package/es/components/pay/toB/components/Content/index.less +0 -9
  421. package/es/components/pay/toB/components/Content/utils.d.ts +0 -16
  422. package/es/components/pay/toB/components/Content/utils.js +0 -76
  423. package/es/components/pay/toB/components/index.d.ts +0 -5
  424. package/es/components/pay/toB/components/index.js +0 -5
  425. package/es/components/pay/toB/hooks.d.ts +0 -12
  426. package/es/components/pay/toB/hooks.js +0 -30
  427. package/es/components/pay/toB/index.d.ts +0 -3
  428. package/es/components/pay/toB/index.js +0 -24
  429. package/es/components/pay/toB/locales.d.ts +0 -54
  430. package/es/components/pay/toB/locales.js +0 -65
  431. package/es/components/pay/toB/store/context.d.ts +0 -3
  432. package/es/components/pay/toB/store/context.js +0 -2
  433. package/es/components/pay/toB/store/hooks.d.ts +0 -15
  434. package/es/components/pay/toB/store/index.d.ts +0 -3
  435. package/es/components/pay/toB/store/index.js +0 -3
  436. package/es/components/pay/toB/store/provider.d.ts +0 -4
  437. package/es/components/pay/toB/store/utils.d.ts +0 -13
  438. package/es/components/pay/toB/store/utils.js +0 -66
  439. package/es/components/pay/toB/types/index.d.ts +0 -1
  440. package/es/components/pay/toB/types/index.js +0 -1
  441. package/es/components/pay/toB/types/storeTypes.d.ts +0 -141
  442. package/es/components/pay/toB/types/storeTypes.js +0 -24
  443. package/lib/components/pay/toB/components/Cache/index.d.ts +0 -10
  444. package/lib/components/pay/toB/components/Cache/index.js +0 -108
  445. package/lib/components/pay/toB/components/Cache/index.less +0 -41
  446. package/lib/components/pay/toB/components/Card/index.d.ts +0 -7
  447. package/lib/components/pay/toB/components/Card/index.js +0 -66
  448. package/lib/components/pay/toB/components/Card/index.less +0 -26
  449. package/lib/components/pay/toB/components/CardGroup/index.d.ts +0 -7
  450. package/lib/components/pay/toB/components/CardGroup/index.less +0 -18
  451. package/lib/components/pay/toB/components/ConfirmedPayment/index.d.ts +0 -6
  452. package/lib/components/pay/toB/components/ConfirmedPayment/index.js +0 -77
  453. package/lib/components/pay/toB/components/ConfirmedPayment/index.less +0 -69
  454. package/lib/components/pay/toB/components/Content/Footer.d.ts +0 -7
  455. package/lib/components/pay/toB/components/Content/Footer.js +0 -63
  456. package/lib/components/pay/toB/components/Content/Header.d.ts +0 -4
  457. package/lib/components/pay/toB/components/Content/index.d.ts +0 -4
  458. package/lib/components/pay/toB/components/Content/index.js +0 -209
  459. package/lib/components/pay/toB/components/Content/index.less +0 -9
  460. package/lib/components/pay/toB/components/Content/utils.d.ts +0 -16
  461. package/lib/components/pay/toB/components/Content/utils.js +0 -91
  462. package/lib/components/pay/toB/components/index.d.ts +0 -5
  463. package/lib/components/pay/toB/hooks.d.ts +0 -12
  464. package/lib/components/pay/toB/hooks.js +0 -60
  465. package/lib/components/pay/toB/index.d.ts +0 -3
  466. package/lib/components/pay/toB/index.js +0 -54
  467. package/lib/components/pay/toB/locales.d.ts +0 -54
  468. package/lib/components/pay/toB/locales.js +0 -77
  469. package/lib/components/pay/toB/store/context.d.ts +0 -3
  470. package/lib/components/pay/toB/store/hooks.d.ts +0 -15
  471. package/lib/components/pay/toB/store/hooks.js +0 -85
  472. package/lib/components/pay/toB/store/index.d.ts +0 -3
  473. package/lib/components/pay/toB/store/provider.d.ts +0 -4
  474. package/lib/components/pay/toB/store/provider.js +0 -70
  475. package/lib/components/pay/toB/store/utils.d.ts +0 -13
  476. package/lib/components/pay/toB/store/utils.js +0 -72
  477. package/lib/components/pay/toB/types/index.d.ts +0 -1
  478. package/lib/components/pay/toB/types/storeTypes.d.ts +0 -141
  479. package/lib/components/pay/toB/types/storeTypes.js +0 -36
  480. package/lowcode/tob-pay/meta.ts +0 -44
@@ -11,6 +11,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
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
13
  import React, { createContext, useRef, useState } from 'react';
14
+ import useEngineContext from "../../../hooks/useEngineContext";
14
15
  var defaultData = {};
15
16
  var SALES_MODEL_SESSION_STORAGE_KEY = 'shop_h5_sales_model_data';
16
17
  export var SalesContext = /*#__PURE__*/createContext({});
@@ -26,23 +27,55 @@ export var SalesProvider = function SalesProvider(props) {
26
27
  _useState4 = _slicedToArray(_useState3, 2),
27
28
  hooks = _useState4[0],
28
29
  setHooks = _useState4[1];
30
+ var context = useEngineContext();
31
+ var utils = context.appHelper.utils || {};
29
32
  var _setData = function _setData(newData) {
30
33
  dataRef.current = _objectSpread(_objectSpread({}, dataRef.current), newData);
31
34
  console.log('sales_model_newData', dataRef.current);
32
35
  if (config !== null && config !== void 0 && config.useSessionStorage) {
33
- sessionStorage.setItem(SALES_MODEL_SESSION_STORAGE_KEY, JSON.stringify(dataRef.current || {}));
36
+ setSessionStorage();
34
37
  }
35
38
  setData(_objectSpread({}, dataRef.current));
36
39
  };
37
40
  var getCurrentData = function getCurrentData() {
38
41
  return dataRef.current;
39
42
  };
43
+
44
+ /**
45
+ * @title 设置sessionStorage
46
+ * @description 获取路由参数中的cacheId,并设置到sessionStorage中
47
+ */
40
48
  var setSessionStorage = function setSessionStorage() {
41
- sessionStorage.setItem(SALES_MODEL_SESSION_STORAGE_KEY, JSON.stringify(dataRef.current || {}));
49
+ var _utils$getHistory, _history$location;
50
+ var history = (utils === null || utils === void 0 || (_utils$getHistory = utils.getHistory) === null || _utils$getHistory === void 0 ? void 0 : _utils$getHistory.call(utils)) || {};
51
+ var cacheId = (history === null || history === void 0 || (_history$location = history.location) === null || _history$location === void 0 || (_history$location = _history$location.query) === null || _history$location === void 0 ? void 0 : _history$location.cacheId) || '';
52
+ var sessionData = _objectSpread(_objectSpread({}, dataRef.current || {}), {}, {
53
+ cacheId: cacheId
54
+ });
55
+ sessionStorage.setItem("".concat(SALES_MODEL_SESSION_STORAGE_KEY), JSON.stringify(sessionData || {}));
42
56
  };
57
+
58
+ /**
59
+ * @title 获取sessionStorage
60
+ * @description 获取路由参数中的cacheId并与sessionStorage中的cacheId进行匹配,如果匹配成功,则返回sessionStorage中的数据
61
+ */
43
62
  var getSessionStorage = function getSessionStorage() {
44
- var result = sessionStorage.getItem(SALES_MODEL_SESSION_STORAGE_KEY);
45
- return JSON.parse(result || '{}');
63
+ var _utils$getHistory2, _history$location2;
64
+ var history = (utils === null || utils === void 0 || (_utils$getHistory2 = utils.getHistory) === null || _utils$getHistory2 === void 0 ? void 0 : _utils$getHistory2.call(utils)) || {};
65
+ var strResult = sessionStorage.getItem(SALES_MODEL_SESSION_STORAGE_KEY);
66
+ var result = strResult ? JSON.parse(strResult || '{}') : {};
67
+ var cacheId = (history === null || history === void 0 || (_history$location2 = history.location) === null || _history$location2 === void 0 || (_history$location2 = _history$location2.query) === null || _history$location2 === void 0 ? void 0 : _history$location2.cacheId) || '';
68
+
69
+ // cacheId 为空,且sessionStorage中cacheId也为空,则返回sessionStorage中的数据
70
+ if (!cacheId && !(result !== null && result !== void 0 && result.cacheId)) {
71
+ return result;
72
+ }
73
+
74
+ // cacheId 不为空,需要比对sessionStorage中的cacheId与路由参数中的cacheId是否一致
75
+ if (cacheId && (result === null || result === void 0 ? void 0 : result.cacheId) === cacheId) {
76
+ return result;
77
+ }
78
+ return {};
46
79
  };
47
80
  var removeSessionStorage = function removeSessionStorage() {
48
81
  sessionStorage.removeItem(SALES_MODEL_SESSION_STORAGE_KEY);
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const SalesModel: ({ children, hooks, config }: any) => JSX.Element;
3
2
  export * from './Sales';
4
3
  export default SalesModel;
@@ -22,7 +22,7 @@ import { checkBeforeAddToCartApi } from "./serve";
22
22
  import { useCustomer } from "../Customer";
23
23
  import { useRequest } from 'ahooks';
24
24
  import { formatValues } from "../Checkout/utils";
25
- import { handleCartItemOrigin, handleProductInfo } from "./utils";
25
+ import { handleCartItemOrigin, handleProductDeposit, handleProductInfo } from "./utils";
26
26
  var defaultState = {
27
27
  cartItems: [],
28
28
  currentCartItem: null
@@ -31,6 +31,7 @@ export var CartContext = /*#__PURE__*/createContext(undefined);
31
31
  export var CartProvider = function CartProvider(_ref) {
32
32
  var children = _ref.children;
33
33
  var _useCustomer = useCustomer(),
34
+ appContext = _useCustomer.appContext,
34
35
  appUtils = _useCustomer.appUtils,
35
36
  getUserInfo = _useCustomer.getUserInfo;
36
37
  var _useSales = useSales(),
@@ -228,12 +229,16 @@ export var CartProvider = function CartProvider(_ref) {
228
229
  */
229
230
  var checkBeforeAddToCart = function checkBeforeAddToCart() {
230
231
  return new Promise(function (resolve) {
232
+ var _appContext$appHelper;
231
233
  var _cartData = getCurrentData().cartData;
232
234
  var newCartItem = createCartItemData() || {};
233
235
  var params = formatValues({
234
- cartData: {
235
- cartItems: [].concat(_toConsumableArray(_cartData.cartItems || []), [newCartItem])
236
- }
236
+ state: {
237
+ cartData: {
238
+ cartItems: [].concat(_toConsumableArray(_cartData.cartItems || []), [newCartItem])
239
+ }
240
+ },
241
+ platform: appContext === null || appContext === void 0 || (_appContext$appHelper = appContext.appHelper) === null || _appContext$appHelper === void 0 || (_appContext$appHelper = _appContext$appHelper.constants) === null || _appContext$appHelper === void 0 ? void 0 : _appContext$appHelper.platform
237
242
  });
238
243
  checkRef.current = {
239
244
  callback: function callback(res) {
@@ -324,6 +329,10 @@ export var CartProvider = function CartProvider(_ref) {
324
329
  }),
325
330
  _productDetail: eventDetail.productDetail
326
331
  };
332
+
333
+ // 处理定金
334
+ newCartItem.deposit = handleProductDeposit(newCartItem, eventDetail, num);
335
+ // 处理提交给接口的数据
327
336
  var originData = handleCartItemOrigin(newCartItem, eventDetail);
328
337
  newCartItem._originData = originData;
329
338
  if (_holderItem !== null && _holderItem !== void 0 && _holderItem._originData) {
@@ -1,3 +1,4 @@
1
+ import Decimal from 'decimal.js';
1
2
  import { ICalculatePriceParams } from './types';
2
3
  export declare const handleProductInfo: (eventDetail: any, num: number) => {
3
4
  totalPrice: number;
@@ -21,3 +22,42 @@ export declare const getOriginTotalPrice: (params: ICalculatePriceParams) => num
21
22
  export declare const handleCartItemOrigin: (cartItem: any, eventDetail: any) => any;
22
23
  export declare const formatBundleToOrigin: (bundle: any) => any;
23
24
  export declare const formatOptionsToOrigin: (options: any) => any;
25
+ export declare const handleProductDeposit: (cartItem: any, eventDetail: any, num: number) => {
26
+ total: number;
27
+ protocols: any;
28
+ } | null;
29
+ /**
30
+ * 获取商品定金
31
+ * @description 定金基于商品售价来算,最终乘商品数量
32
+ * 1、如果套餐主商品有定金规则,则定金为:(套餐商品总售价 * 定金百分比 + 定金固定金额)* 商品数量
33
+ * 2、如果套餐主商品没有定金规则,子商品有定金规则,则定金为:(套餐子商品售价 * 套餐子商品定金百分比 + 套餐子商品定金固定金额)* 商品数量,最终将所有子商品定金相加
34
+ * 3、普通商品/单规格商品/组合规则商品,定金规则:(商品总售价 * 定金百分比 + 定金固定金额)* 商品数量
35
+ * @param params 参数
36
+ * @returns 商品定金
37
+ */
38
+ export declare const getProductDeposit: (params: {
39
+ cartItem: any;
40
+ product: any;
41
+ bundle?: any;
42
+ options?: any;
43
+ num?: number;
44
+ }) => {
45
+ total: number;
46
+ protocols: any;
47
+ } | null;
48
+ /**
49
+ * 计算商品定金
50
+ * @param params 参数
51
+ * @returns 商品定金
52
+ */
53
+ export declare const calculateProductDeposit: (params: {
54
+ depositData: {
55
+ deposit_fixed?: string;
56
+ deposit_percentage?: string;
57
+ };
58
+ total: string | number;
59
+ num: number;
60
+ }) => {
61
+ result: boolean;
62
+ depositTotal: Decimal;
63
+ };
@@ -1,3 +1,10 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ 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."); }
3
+ 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); }
4
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
+ 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; }
7
+ import Decimal from 'decimal.js';
1
8
  export var handleProductInfo = function handleProductInfo(eventDetail, num) {
2
9
  var productDetail = eventDetail.productDetail,
3
10
  bookingOptionItem = eventDetail.bookingOptionItem;
@@ -158,4 +165,168 @@ export var formatOptionsToOrigin = function formatOptionsToOrigin(options) {
158
165
  option_group_id: d.option_group_id
159
166
  };
160
167
  });
168
+ };
169
+ export var handleProductDeposit = function handleProductDeposit(cartItem, eventDetail, num) {
170
+ var _origin$custom_deposi;
171
+ var productDetail = eventDetail.productDetail;
172
+ if (!productDetail) {
173
+ return null;
174
+ }
175
+ var _ref = productDetail || {},
176
+ origin = _ref.origin,
177
+ bundle = _ref.bundle,
178
+ options = _ref.options,
179
+ product_variant_id = _ref.product_variant_id;
180
+ var deposit = null;
181
+ var product = origin;
182
+ if (product_variant_id) {
183
+ product.product_variant_id = product_variant_id;
184
+ }
185
+ if ((origin === null || origin === void 0 || (_origin$custom_deposi = origin.custom_deposit_data) === null || _origin$custom_deposi === void 0 ? void 0 : _origin$custom_deposi.has_deposit) == 1) {
186
+ deposit = getProductDeposit({
187
+ cartItem: cartItem,
188
+ product: product,
189
+ bundle: bundle,
190
+ options: options,
191
+ num: num
192
+ });
193
+ }
194
+ return deposit;
195
+ };
196
+
197
+ /**
198
+ * 获取商品定金
199
+ * @description 定金基于商品售价来算,最终乘商品数量
200
+ * 1、如果套餐主商品有定金规则,则定金为:(套餐商品总售价 * 定金百分比 + 定金固定金额)* 商品数量
201
+ * 2、如果套餐主商品没有定金规则,子商品有定金规则,则定金为:(套餐子商品售价 * 套餐子商品定金百分比 + 套餐子商品定金固定金额)* 商品数量,最终将所有子商品定金相加
202
+ * 3、普通商品/单规格商品/组合规则商品,定金规则:(商品总售价 * 定金百分比 + 定金固定金额)* 商品数量
203
+ * @param params 参数
204
+ * @returns 商品定金
205
+ */
206
+ export var getProductDeposit = function getProductDeposit(params) {
207
+ var _product$custom_depos;
208
+ var cartItem = params.cartItem,
209
+ product = params.product,
210
+ bundle = params.bundle,
211
+ options = params.options;
212
+ var num = (params === null || params === void 0 ? void 0 : params.num) || 1;
213
+
214
+ // 判定商品是否有定金规则
215
+ if ((product === null || product === void 0 || (_product$custom_depos = product.custom_deposit_data) === null || _product$custom_depos === void 0 ? void 0 : _product$custom_depos.has_deposit) == 1) {
216
+ var total = new Decimal(0);
217
+ var _ref2 = (product === null || product === void 0 ? void 0 : product.custom_deposit_data) || {},
218
+ deposit_fixed = _ref2.deposit_fixed,
219
+ deposit_percentage = _ref2.deposit_percentage,
220
+ deposit_policy_data = _ref2.deposit_policy_data,
221
+ self_deposit_policy_ids = _ref2.self_deposit_policy_ids;
222
+ // 所有协议数据
223
+ var allProtocols = deposit_policy_data || [];
224
+ // 是否存在定金,主商品has_deposit为1,但是自身没有定金设置,需要判定子商品是否存在定金,如果不存在最终判定也是不存在定金
225
+ var productHasDeposit = false;
226
+ // 关联的定金协议id
227
+ var protocolIds = [];
228
+
229
+ // 判断主商品是否有定金规则
230
+ if (typeof deposit_fixed === 'string' && typeof deposit_percentage === 'string') {
231
+ var _calculateProductDepo = calculateProductDeposit({
232
+ depositData: product === null || product === void 0 ? void 0 : product.custom_deposit_data,
233
+ total: (cartItem === null || cartItem === void 0 ? void 0 : cartItem.total) || 0,
234
+ num: num
235
+ }),
236
+ depositTotal = _calculateProductDepo.depositTotal,
237
+ result = _calculateProductDepo.result;
238
+ if (result) {
239
+ total = depositTotal;
240
+ protocolIds.push.apply(protocolIds, _toConsumableArray(self_deposit_policy_ids || []));
241
+ productHasDeposit = true;
242
+ }
243
+ } else {
244
+ // 组合规格商品
245
+ if (product !== null && product !== void 0 && product.product_variant_id) {
246
+ var _product$variant;
247
+ var variantProduct = product === null || product === void 0 || (_product$variant = product.variant) === null || _product$variant === void 0 ? void 0 : _product$variant.find(function (item) {
248
+ return (item === null || item === void 0 ? void 0 : item.id) === (product === null || product === void 0 ? void 0 : product.product_variant_id);
249
+ });
250
+ if (variantProduct) {
251
+ var depositData = variantProduct === null || variantProduct === void 0 ? void 0 : variantProduct.custom_deposit_data;
252
+ var _calculateProductDepo2 = calculateProductDeposit({
253
+ depositData: depositData,
254
+ total: (cartItem === null || cartItem === void 0 ? void 0 : cartItem.total) || 0,
255
+ num: num
256
+ }),
257
+ _depositTotal = _calculateProductDepo2.depositTotal,
258
+ _result = _calculateProductDepo2.result;
259
+ if (_result) {
260
+ total = _depositTotal;
261
+ protocolIds.push.apply(protocolIds, _toConsumableArray((depositData === null || depositData === void 0 ? void 0 : depositData.self_deposit_policy_ids) || []));
262
+ productHasDeposit = true;
263
+ }
264
+ }
265
+ }
266
+ if (bundle !== null && bundle !== void 0 && bundle.length) {
267
+ total = bundle.reduce(function (accumulator, currBundleProduct) {
268
+ var depositData = currBundleProduct === null || currBundleProduct === void 0 ? void 0 : currBundleProduct.custom_deposit_data;
269
+ var _calculateProductDepo3 = calculateProductDeposit({
270
+ depositData: depositData,
271
+ total: currBundleProduct === null || currBundleProduct === void 0 ? void 0 : currBundleProduct.price,
272
+ num: (currBundleProduct === null || currBundleProduct === void 0 ? void 0 : currBundleProduct.num) || 1
273
+ }),
274
+ depositTotal = _calculateProductDepo3.depositTotal,
275
+ result = _calculateProductDepo3.result;
276
+ if (result) {
277
+ protocolIds.push.apply(protocolIds, _toConsumableArray((depositData === null || depositData === void 0 ? void 0 : depositData.self_deposit_policy_ids) || []));
278
+ productHasDeposit = true;
279
+ return accumulator.plus(depositTotal);
280
+ }
281
+ return accumulator;
282
+ }, new Decimal(0));
283
+ }
284
+ }
285
+ if (productHasDeposit) {
286
+ var ids = new Set(protocolIds);
287
+ var protocols = allProtocols.filter(function (item) {
288
+ return ids.has(item.id);
289
+ });
290
+ return {
291
+ total: total.toNumber(),
292
+ protocols: protocols
293
+ };
294
+ }
295
+ return null;
296
+ }
297
+ return null;
298
+ };
299
+
300
+ /**
301
+ * 计算商品定金
302
+ * @param params 参数
303
+ * @returns 商品定金
304
+ */
305
+ export var calculateProductDeposit = function calculateProductDeposit(params) {
306
+ var depositData = params.depositData,
307
+ total = params.total,
308
+ num = params.num;
309
+ if (!depositData) {
310
+ return {
311
+ result: false,
312
+ depositTotal: new Decimal(0)
313
+ };
314
+ }
315
+ var _ref3 = depositData || {},
316
+ deposit_fixed = _ref3.deposit_fixed,
317
+ deposit_percentage = _ref3.deposit_percentage;
318
+ if (typeof deposit_fixed === 'string' && typeof deposit_percentage === 'string') {
319
+ var depositFixed = new Decimal(deposit_fixed || 0);
320
+ var depositPercent = new Decimal(deposit_percentage || 0);
321
+ var productTotalPrice = new Decimal(total || 0);
322
+ var deposit = depositFixed.plus(depositPercent.times(productTotalPrice));
323
+ return {
324
+ depositTotal: deposit.times(num),
325
+ result: true
326
+ };
327
+ }
328
+ return {
329
+ result: false,
330
+ depositTotal: new Decimal(0)
331
+ };
161
332
  };
@@ -5,6 +5,9 @@ interface PayProps {
5
5
  order_id: string;
6
6
  amount: number;
7
7
  sale_channel?: string;
8
+ is_deposit?: number;
9
+ deposit_amount?: number;
10
+ total_amount?: number;
8
11
  }
9
12
  interface CheckoutContextType {
10
13
  onCheckBeforeBooking: (data: any) => Promise<{
@@ -15,6 +18,7 @@ interface CheckoutContextType {
15
18
  onPay: (payProps: PayProps) => void;
16
19
  createBooking: any;
17
20
  checkBeforeBooking: any;
21
+ freePay: any;
18
22
  }
19
23
  interface CheckoutProviderProps {
20
24
  children: React.ReactNode;
@@ -1,4 +1,9 @@
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 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
+ 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
+ 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; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
2
7
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
8
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
9
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -6,8 +11,9 @@ import React, { createContext, useRef } from 'react';
6
11
  import { useSales } from "../../../businessModel/SalesModel";
7
12
  import useEngineContext from "../../../hooks/useEngineContext";
8
13
  import { useRequest } from 'ahooks';
9
- import { checkBeforeBookingApi, createBookingApi } from "./serve";
14
+ import { checkBeforeBookingApi, createBookingApi, freePayApi } from "./serve";
10
15
  import { useCart } from "../Cart";
16
+ import { Toast } from "../../appointmentBooking/utils";
11
17
 
12
18
  // 定义上下文接口
13
19
 
@@ -27,6 +33,7 @@ export var CheckoutProvider = function CheckoutProvider(_ref) {
27
33
  updateDisabledCartItem = _useCart.updateDisabledCartItem;
28
34
  var checkoutCallback = useRef(null);
29
35
  var checkRef = useRef(null);
36
+ var payRef = useRef(null);
30
37
  var checkBeforeBooking = useRequest(checkBeforeBookingApi, {
31
38
  manual: true,
32
39
  onSuccess: function onSuccess(res) {
@@ -61,6 +68,17 @@ export var CheckoutProvider = function CheckoutProvider(_ref) {
61
68
  });
62
69
  }
63
70
  });
71
+ var freePay = useRequest(freePayApi, {
72
+ manual: true,
73
+ onSuccess: function onSuccess(res) {
74
+ if (res !== null && res !== void 0 && res.status) {
75
+ var _payRef$current, _payRef$current2;
76
+ goPaymentFinish((_payRef$current = payRef.current) === null || _payRef$current === void 0 ? void 0 : _payRef$current.order_id, (_payRef$current2 = payRef.current) === null || _payRef$current2 === void 0 ? void 0 : _payRef$current2.total_amount);
77
+ } else {
78
+ Toast(res === null || res === void 0 ? void 0 : res.message);
79
+ }
80
+ }
81
+ });
64
82
 
65
83
  /**
66
84
  * @title: 下单前校验
@@ -106,6 +124,11 @@ export var CheckoutProvider = function CheckoutProvider(_ref) {
106
124
  return _ref2.apply(this, arguments);
107
125
  };
108
126
  }();
127
+ var goPaymentFinish = function goPaymentFinish(order_id, amount) {
128
+ var _utils$history;
129
+ var url = "/payment-finish/success?order_id=".concat(order_id, "&amount=").concat(Number(amount));
130
+ utils === null || utils === void 0 || (_utils$history = utils.history) === null || _utils$history === void 0 || _utils$history.replace(url);
131
+ };
109
132
 
110
133
  /**
111
134
  * @title: 支付
@@ -115,20 +138,41 @@ export var CheckoutProvider = function CheckoutProvider(_ref) {
115
138
  * @Author: zhiwei.Wang
116
139
  */
117
140
  var onPay = function onPay(payProps) {
118
- utils.action({
119
- type: 'pisell1.payment',
120
- data: payProps,
121
- callback: function callback(e) {
122
- checkoutCallback.current && checkoutCallback.current(e);
141
+ payRef.current = payProps;
142
+ var is_deposit = payProps.is_deposit,
143
+ deposit_amount = payProps.deposit_amount,
144
+ total_amount = payProps.total_amount;
145
+
146
+ // 如果有定金,则支付定金金额,否则订单金额
147
+ var _total = is_deposit ? deposit_amount || 0 : total_amount || 0;
148
+ if (_total > 0) {
149
+ utils.action({
150
+ type: 'pisell1.payment',
151
+ data: _objectSpread(_objectSpread({}, payProps), {}, {
152
+ total_amount: _total
153
+ }),
154
+ callback: function callback(e) {
155
+ checkoutCallback.current && checkoutCallback.current(e);
156
+ }
157
+ });
158
+ } else {
159
+ // 定金为0则直接跳转结果页面
160
+ if (is_deposit) {
161
+ goPaymentFinish(payProps.order_id, _total);
162
+ return;
123
163
  }
124
- });
164
+
165
+ // 金额为0则需要调用免费支付接口,接口调用成功后跳转结果页面
166
+ freePay.runAsync(payProps.order_id);
167
+ }
125
168
  };
126
169
  var contextValue = {
127
170
  onCheckBeforeBooking: onCheckBeforeBooking,
128
171
  onCheckout: onCheckout,
129
172
  onPay: onPay,
130
173
  createBooking: createBooking,
131
- checkBeforeBooking: checkBeforeBooking
174
+ checkBeforeBooking: checkBeforeBooking,
175
+ freePay: freePay
132
176
  };
133
177
  return /*#__PURE__*/React.createElement(CheckoutContext.Provider, {
134
178
  value: contextValue
@@ -1,2 +1,15 @@
1
+ /**
2
+ * @title: 下单前置校验接口
3
+ * @param {any} data
4
+ */
1
5
  export declare const checkBeforeBookingApi: (data: any) => Promise<any>;
6
+ /**
7
+ * @title: 创建订单
8
+ * @param {any} data
9
+ */
2
10
  export declare const createBookingApi: (data: any) => Promise<any>;
11
+ /**
12
+ * @title: 免费支付
13
+ * @param {string} orderId
14
+ */
15
+ export declare const freePayApi: (orderId: string) => Promise<any>;
@@ -1,11 +1,25 @@
1
1
  import { request } from "../../../utils";
2
2
 
3
- // 下单前置校验接口
3
+ /**
4
+ * @title: 下单前置校验接口
5
+ * @param {any} data
6
+ */
4
7
  export var checkBeforeBookingApi = function checkBeforeBookingApi(data) {
5
8
  return request.getRequest().post('/h5/eventbookingv2/order/check-config', data);
6
9
  };
7
10
 
8
- // 创建
11
+ /**
12
+ * @title: 创建订单
13
+ * @param {any} data
14
+ */
9
15
  export var createBookingApi = function createBookingApi(data) {
10
16
  return request.getRequest().post('/h5/eventbookingv2/order', data);
17
+ };
18
+
19
+ /**
20
+ * @title: 免费支付
21
+ * @param {string} orderId
22
+ */
23
+ export var freePayApi = function freePayApi(orderId) {
24
+ return request.getRequest().post("/h5/pay/order/free-pay/".concat(orderId), {});
11
25
  };
@@ -24,7 +24,12 @@ export declare const formatProductBundle: (bundle: any) => any;
24
24
  * @Author: xiangfeng.xue
25
25
  * @Date: 2025-01-21 17:57
26
26
  */
27
- export declare const formatValues: (state: any, excludeDisabled?: boolean, otherValue?: Record<string, any>) => any;
27
+ export declare const formatValues: (params: {
28
+ state: any;
29
+ platform: 'h5' | 'pc';
30
+ excludeDisabled?: boolean;
31
+ extra?: Record<string, any>;
32
+ }) => any;
28
33
  /**
29
34
  * @title: 获取拉开表单弹窗参数
30
35
  * @param state
@@ -84,16 +84,21 @@ var formatBookings = function formatBookings(list) {
84
84
  * @Author: xiangfeng.xue
85
85
  * @Date: 2025-01-21 17:57
86
86
  */
87
- export var formatValues = function formatValues(state, excludeDisabled, otherValue) {
87
+ export var formatValues = function formatValues(params) {
88
+ var state = params.state,
89
+ platform = params.platform,
90
+ excludeDisabled = params.excludeDisabled,
91
+ extra = params.extra;
88
92
  var values = _objectSpread({
89
93
  type: 'event_booking_v2',
90
- platform: 'H5',
94
+ platform: platform === 'pc' ? 'PC' : 'H5',
91
95
  sales_channel: 'my_pisel',
92
96
  order_sales_channel: 'online_store',
93
97
  bookings: [],
94
98
  shop_note: '',
95
99
  schedule_date: ''
96
- }, otherValue || {});
100
+ }, extra || {});
101
+ console.log('values', values);
97
102
  var data = [];
98
103
  if (excludeDisabled) {
99
104
  var _state$cartData$cartI, _state$cartData$cartI2;
@@ -104,6 +109,12 @@ export var formatValues = function formatValues(state, excludeDisabled, otherVal
104
109
  data = state.cartData.cartItems;
105
110
  }
106
111
 
112
+ // 定金
113
+ var is_deposit = data.find(function (v) {
114
+ return v.deposit;
115
+ }) ? 1 : 0;
116
+ values.is_deposit = is_deposit;
117
+
107
118
  // 服务
108
119
  values.bookings = formatBookings(data);
109
120
  return values;
@@ -121,6 +132,6 @@ export var getFormParams = function getFormParams(state) {
121
132
  });
122
133
  return {
123
134
  product_id: product_id,
124
- appointment_type: "event_booking_v2"
135
+ appointment_type: 'event_booking_v2'
125
136
  };
126
137
  };
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  interface CustomerData {
3
3
  }
4
4
  interface CustomerContextType {
5
+ appContext: any;
5
6
  appUtils: any;
6
7
  isLogin: () => boolean;
7
8
  openLoginModal: (params: any) => void;
@@ -34,6 +34,7 @@ export var CustomerProvider = function CustomerProvider(_ref) {
34
34
  return userInfo !== null && userInfo !== void 0 && userInfo.id ? userInfo : localUserInfo;
35
35
  };
36
36
  var contextValue = {
37
+ appContext: context,
37
38
  appUtils: utils,
38
39
  isLogin: isLogin,
39
40
  openLoginModal: openLoginModal,
@@ -6,7 +6,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import React, { createContext } from 'react';
8
8
  import { useSales } from "../../../businessModel/SalesModel";
9
- import { getResourceListApi } from "./serve";
9
+ import { getSpecialResourceListApi } from "./serve";
10
10
  import { useRequest } from 'ahooks';
11
11
  import { useCart } from "../Cart";
12
12
  import { getIamgeFromMedia } from "../utils";
@@ -73,7 +73,7 @@ export var ResourceProvider = function ResourceProvider(_ref) {
73
73
  });
74
74
  return renderData;
75
75
  };
76
- var getResourceList = useRequest(getResourceListApi, {
76
+ var getResourceList = useRequest(getSpecialResourceListApi, {
77
77
  manual: true,
78
78
  onSuccess: function onSuccess(res) {
79
79
  var formatData = formatResourceList(res);
@@ -3,3 +3,10 @@ export declare const getResourceListApi: (params: {
3
3
  shop_id: string;
4
4
  form_data_status: string;
5
5
  }) => Promise<any>;
6
+ /**
7
+ * @title: 获取特殊资源列表
8
+ * @Author: xiangfeng.xue
9
+ */
10
+ export declare const getSpecialResourceListApi: (params: {
11
+ event_item_ids?: string | number[];
12
+ }) => Promise<any>;