@pisell/pisellos 2.2.243 → 2.2.244

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 (315) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +2 -3
  2. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  3. package/dist/model/strategy/adapter/walletPass/utils.js +4 -7
  4. package/dist/modules/Cart/utils/cartProduct.js +3 -24
  5. package/dist/modules/Cart/utils/changePrice.js +11 -11
  6. package/dist/modules/Customer/index.d.ts +0 -20
  7. package/dist/modules/Customer/index.js +83 -172
  8. package/dist/modules/Customer/types.d.ts +0 -2
  9. package/dist/modules/Discount/index.js +3 -4
  10. package/dist/modules/Discount/types.d.ts +0 -1
  11. package/dist/modules/OpenData/index.d.ts +0 -8
  12. package/dist/modules/OpenData/index.js +17 -37
  13. package/dist/modules/Order/index.d.ts +18 -268
  14. package/dist/modules/Order/index.js +757 -3306
  15. package/dist/modules/Order/types.d.ts +31 -279
  16. package/dist/modules/Order/types.js +0 -38
  17. package/dist/modules/Order/utils.d.ts +5 -147
  18. package/dist/modules/Order/utils.js +103 -746
  19. package/dist/modules/Payment/index.d.ts +13 -10
  20. package/dist/modules/Payment/index.js +837 -467
  21. package/dist/modules/Payment/types.d.ts +0 -2
  22. package/dist/modules/Payment/utils.js +1 -2
  23. package/dist/modules/Payment/walletpass.js +7 -14
  24. package/dist/modules/ProductList/index.d.ts +12 -16
  25. package/dist/modules/ProductList/index.js +59 -133
  26. package/dist/modules/ProductList/types.d.ts +0 -14
  27. package/dist/modules/Quotation/index.d.ts +1 -0
  28. package/dist/modules/Quotation/index.js +22 -25
  29. package/dist/modules/Rules/index.d.ts +0 -4
  30. package/dist/modules/Rules/index.js +69 -93
  31. package/dist/modules/Rules/types.d.ts +0 -1
  32. package/dist/modules/SalesSummary/index.d.ts +25 -8
  33. package/dist/modules/SalesSummary/index.js +35 -86
  34. package/dist/modules/SalesSummary/types.d.ts +1 -4
  35. package/dist/modules/SalesSummary/utils.d.ts +25 -2
  36. package/dist/modules/SalesSummary/utils.js +162 -794
  37. package/dist/modules/Schedule/index.d.ts +0 -7
  38. package/dist/modules/Schedule/index.js +2 -24
  39. package/dist/modules/Summary/index.js +3 -4
  40. package/dist/modules/index.d.ts +0 -2
  41. package/dist/modules/index.js +1 -3
  42. package/dist/plugins/request.d.ts +0 -1
  43. package/dist/server/index.d.ts +1 -204
  44. package/dist/server/index.js +928 -3658
  45. package/dist/server/modules/index.d.ts +0 -2
  46. package/dist/server/modules/index.js +0 -2
  47. package/dist/server/modules/order/index.d.ts +4 -120
  48. package/dist/server/modules/order/index.js +483 -1779
  49. package/dist/server/modules/order/types.d.ts +3 -32
  50. package/dist/server/modules/order/types.js +0 -8
  51. package/dist/server/modules/order/utils/filterBookings.js +3 -26
  52. package/dist/server/modules/order/utils/filterOrders.js +8 -23
  53. package/dist/server/modules/products/index.d.ts +7 -34
  54. package/dist/server/modules/products/index.js +317 -631
  55. package/dist/server/modules/resource/index.d.ts +0 -2
  56. package/dist/server/modules/resource/index.js +3 -29
  57. package/dist/server/modules/schedule/index.d.ts +4 -4
  58. package/dist/server/modules/schedule/index.js +88 -111
  59. package/dist/solution/BaseSales/index.d.ts +9 -131
  60. package/dist/solution/BaseSales/index.js +447 -1944
  61. package/dist/solution/BaseSales/types.d.ts +6 -76
  62. package/dist/solution/BaseSales/types.js +4 -5
  63. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
  64. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +24 -105
  65. package/dist/solution/BaseSales/utils.d.ts +1 -1
  66. package/dist/solution/BaseSales/utils.js +21 -62
  67. package/dist/solution/BookingByStep/index.d.ts +1 -1
  68. package/dist/solution/BookingTicket/index.d.ts +10 -270
  69. package/dist/solution/BookingTicket/index.js +237 -1772
  70. package/dist/solution/BookingTicket/types.d.ts +1 -118
  71. package/dist/solution/BookingTicket/types.js +2 -41
  72. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
  73. package/dist/solution/BookingTicket/utils/bookingStatus.js +0 -70
  74. package/dist/solution/BookingTicket/utils/cartView.d.ts +1 -9
  75. package/dist/solution/BookingTicket/utils/cartView.js +7 -94
  76. package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -5
  77. package/dist/solution/BookingTicket/utils/scan/index.js +8 -20
  78. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  79. package/dist/solution/Checkout/index.d.ts +0 -1
  80. package/dist/solution/Checkout/index.js +9 -10
  81. package/dist/solution/RegisterAndLogin/config.js +10 -2
  82. package/dist/solution/ScanOrder/index.d.ts +3 -9
  83. package/dist/solution/ScanOrder/index.js +134 -241
  84. package/dist/solution/ScanOrder/types.d.ts +5 -9
  85. package/dist/solution/ScanOrder/types.js +3 -2
  86. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  87. package/dist/solution/ScanOrder/utils.js +22 -84
  88. package/dist/solution/VenueBooking/index.d.ts +2 -5
  89. package/dist/solution/VenueBooking/index.js +59 -110
  90. package/dist/solution/VenueBooking/sales-section-4-annotated.json +2 -0
  91. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  92. package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
  93. package/dist/types/index.d.ts +0 -10
  94. package/lib/model/strategy/adapter/promotion/evaluator.js +1 -2
  95. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  96. package/lib/model/strategy/adapter/walletPass/utils.js +2 -3
  97. package/lib/modules/Cart/utils/cartProduct.js +3 -20
  98. package/lib/modules/Cart/utils/changePrice.js +20 -12
  99. package/lib/modules/Customer/index.d.ts +0 -20
  100. package/lib/modules/Customer/index.js +11 -64
  101. package/lib/modules/Customer/types.d.ts +0 -2
  102. package/lib/modules/Discount/index.js +1 -5
  103. package/lib/modules/Discount/types.d.ts +0 -1
  104. package/lib/modules/OpenData/index.d.ts +0 -8
  105. package/lib/modules/OpenData/index.js +5 -19
  106. package/lib/modules/Order/index.d.ts +18 -268
  107. package/lib/modules/Order/index.js +344 -2149
  108. package/lib/modules/Order/types.d.ts +31 -279
  109. package/lib/modules/Order/types.js +0 -1
  110. package/lib/modules/Order/utils.d.ts +5 -147
  111. package/lib/modules/Order/utils.js +46 -614
  112. package/lib/modules/Payment/index.d.ts +13 -10
  113. package/lib/modules/Payment/index.js +150 -18
  114. package/lib/modules/Payment/types.d.ts +0 -2
  115. package/lib/modules/Payment/utils.js +1 -2
  116. package/lib/modules/Payment/walletpass.js +3 -7
  117. package/lib/modules/ProductList/index.d.ts +12 -16
  118. package/lib/modules/ProductList/index.js +4 -41
  119. package/lib/modules/ProductList/types.d.ts +0 -14
  120. package/lib/modules/Quotation/index.d.ts +1 -0
  121. package/lib/modules/Quotation/index.js +16 -19
  122. package/lib/modules/Rules/index.d.ts +0 -4
  123. package/lib/modules/Rules/index.js +120 -136
  124. package/lib/modules/Rules/types.d.ts +0 -1
  125. package/lib/modules/SalesSummary/index.d.ts +25 -8
  126. package/lib/modules/SalesSummary/index.js +4 -30
  127. package/lib/modules/SalesSummary/types.d.ts +1 -4
  128. package/lib/modules/SalesSummary/utils.d.ts +25 -2
  129. package/lib/modules/SalesSummary/utils.js +91 -645
  130. package/lib/modules/Schedule/index.d.ts +0 -7
  131. package/lib/modules/Schedule/index.js +1 -17
  132. package/lib/modules/Summary/index.js +4 -5
  133. package/lib/modules/index.d.ts +0 -2
  134. package/lib/modules/index.js +1 -5
  135. package/lib/plugins/request.d.ts +0 -1
  136. package/lib/server/index.d.ts +1 -204
  137. package/lib/server/index.js +57 -1888
  138. package/lib/server/modules/index.d.ts +0 -2
  139. package/lib/server/modules/index.js +0 -3
  140. package/lib/server/modules/order/index.d.ts +4 -120
  141. package/lib/server/modules/order/index.js +142 -919
  142. package/lib/server/modules/order/types.d.ts +3 -32
  143. package/lib/server/modules/order/utils/filterBookings.js +5 -24
  144. package/lib/server/modules/order/utils/filterOrders.js +6 -15
  145. package/lib/server/modules/products/index.d.ts +7 -34
  146. package/lib/server/modules/products/index.js +54 -189
  147. package/lib/server/modules/resource/index.d.ts +0 -2
  148. package/lib/server/modules/resource/index.js +3 -27
  149. package/lib/server/modules/schedule/index.d.ts +4 -4
  150. package/lib/server/modules/schedule/index.js +40 -47
  151. package/lib/solution/BaseSales/index.d.ts +9 -131
  152. package/lib/solution/BaseSales/index.js +63 -1106
  153. package/lib/solution/BaseSales/types.d.ts +6 -76
  154. package/lib/solution/BaseSales/types.js +1 -3
  155. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
  156. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +18 -106
  157. package/lib/solution/BaseSales/utils.d.ts +1 -1
  158. package/lib/solution/BaseSales/utils.js +10 -54
  159. package/lib/solution/BookingByStep/index.d.ts +1 -1
  160. package/lib/solution/BookingTicket/index.d.ts +10 -270
  161. package/lib/solution/BookingTicket/index.js +29 -922
  162. package/lib/solution/BookingTicket/types.d.ts +1 -118
  163. package/lib/solution/BookingTicket/types.js +0 -11
  164. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
  165. package/lib/solution/BookingTicket/utils/bookingStatus.js +2 -44
  166. package/lib/solution/BookingTicket/utils/cartView.d.ts +1 -9
  167. package/lib/solution/BookingTicket/utils/cartView.js +6 -61
  168. package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -5
  169. package/lib/solution/BookingTicket/utils/scan/index.js +3 -17
  170. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  171. package/lib/solution/Checkout/index.d.ts +0 -1
  172. package/lib/solution/Checkout/index.js +2 -1
  173. package/lib/solution/RegisterAndLogin/config.js +10 -2
  174. package/lib/solution/ScanOrder/index.d.ts +3 -9
  175. package/lib/solution/ScanOrder/index.js +70 -153
  176. package/lib/solution/ScanOrder/types.d.ts +5 -9
  177. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  178. package/lib/solution/ScanOrder/utils.js +17 -83
  179. package/lib/solution/VenueBooking/index.d.ts +2 -5
  180. package/lib/solution/VenueBooking/index.js +17 -54
  181. package/lib/solution/VenueBooking/sales-section-4-annotated.json +2 -0
  182. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  183. package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
  184. package/lib/types/index.d.ts +0 -10
  185. package/package.json +1 -1
  186. package/dist/modules/BookingContext/index.d.ts +0 -48
  187. package/dist/modules/BookingContext/index.js +0 -566
  188. package/dist/modules/BookingContext/types.d.ts +0 -102
  189. package/dist/modules/BookingContext/types.js +0 -51
  190. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  191. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -284
  192. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  193. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -145
  194. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  195. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -218
  196. package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
  197. package/dist/modules/BookingContext/utils/flexible.js +0 -56
  198. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  199. package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
  200. package/dist/modules/BookingContext/utils/index.d.ts +0 -11
  201. package/dist/modules/BookingContext/utils/index.js +0 -11
  202. package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
  203. package/dist/modules/BookingContext/utils/noResource.js +0 -77
  204. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  205. package/dist/modules/BookingContext/utils/orderLineDisplay.js +0 -36
  206. package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
  207. package/dist/modules/BookingContext/utils/productExtend.js +0 -339
  208. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  209. package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
  210. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  211. package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
  212. package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
  213. package/dist/modules/BookingContext/utils/resources.js +0 -486
  214. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  215. package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
  216. package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  217. package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
  218. package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  219. package/dist/modules/Order/utils/manualProductDiscount.js +0 -210
  220. package/dist/modules/SurchargeList/index.d.ts +0 -16
  221. package/dist/modules/SurchargeList/index.js +0 -162
  222. package/dist/modules/SurchargeList/types.d.ts +0 -11
  223. package/dist/modules/SurchargeList/types.js +0 -1
  224. package/dist/server/modules/payment/index.d.ts +0 -28
  225. package/dist/server/modules/payment/index.js +0 -305
  226. package/dist/server/modules/payment/types.d.ts +0 -9
  227. package/dist/server/modules/payment/types.js +0 -1
  228. package/dist/server/test.json +0 -713
  229. package/dist/server/utils/small-ticket.d.ts +0 -71
  230. package/dist/server/utils/small-ticket.js +0 -830
  231. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
  232. package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1438
  233. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  234. package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
  235. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
  236. package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
  237. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
  238. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +0 -95
  239. package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  240. package/dist/solution/BookingTicket/utils/exampleData.js +0 -183
  241. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  242. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -438
  243. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
  244. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -399
  245. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
  246. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -56
  247. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  248. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +0 -150
  249. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
  250. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +0 -78
  251. package/lib/modules/BookingContext/index.d.ts +0 -48
  252. package/lib/modules/BookingContext/index.js +0 -368
  253. package/lib/modules/BookingContext/types.d.ts +0 -102
  254. package/lib/modules/BookingContext/types.js +0 -34
  255. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  256. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -276
  257. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  258. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -151
  259. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  260. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -201
  261. package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
  262. package/lib/modules/BookingContext/utils/flexible.js +0 -80
  263. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  264. package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
  265. package/lib/modules/BookingContext/utils/index.d.ts +0 -11
  266. package/lib/modules/BookingContext/utils/index.js +0 -43
  267. package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
  268. package/lib/modules/BookingContext/utils/noResource.js +0 -90
  269. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  270. package/lib/modules/BookingContext/utils/orderLineDisplay.js +0 -56
  271. package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
  272. package/lib/modules/BookingContext/utils/productExtend.js +0 -283
  273. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  274. package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
  275. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  276. package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
  277. package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
  278. package/lib/modules/BookingContext/utils/resources.js +0 -377
  279. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  280. package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
  281. package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  282. package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
  283. package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  284. package/lib/modules/Order/utils/manualProductDiscount.js +0 -206
  285. package/lib/modules/SurchargeList/index.d.ts +0 -16
  286. package/lib/modules/SurchargeList/index.js +0 -89
  287. package/lib/modules/SurchargeList/types.d.ts +0 -11
  288. package/lib/modules/SurchargeList/types.js +0 -17
  289. package/lib/server/modules/payment/index.d.ts +0 -28
  290. package/lib/server/modules/payment/index.js +0 -192
  291. package/lib/server/modules/payment/types.d.ts +0 -9
  292. package/lib/server/modules/payment/types.js +0 -17
  293. package/lib/server/test.json +0 -713
  294. package/lib/server/utils/small-ticket.d.ts +0 -71
  295. package/lib/server/utils/small-ticket.js +0 -781
  296. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
  297. package/lib/solution/BaseSales/utils/cartPromotion.js +0 -992
  298. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  299. package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
  300. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
  301. package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
  302. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
  303. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +0 -125
  304. package/lib/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  305. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  306. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  307. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -254
  308. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
  309. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -168
  310. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
  311. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -51
  312. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  313. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +0 -127
  314. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
  315. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +0 -85
@@ -1,102 +0,0 @@
1
- /**
2
- * BookingContext 子模块:承载「预约 UI 上下文」三件套。
3
- *
4
- * - bookingConfig:来自 `/core/board/management/config` 的整套预约配置(service_time / resource_tab /
5
- * appointment_subject / subject_require / stock_setting / basic / capacity 等)。
6
- * - resourcesOrigin / resourcesOriginMap:来自 `/schedule/resource/list` 的资源全集,含 times / event_list /
7
- * combined_resource 等运行态信息,是 getResourceByIds / getResourceTimeIsUsable 的输入。
8
- * - date:当前选择的日期(dayjs 或 ISO 字符串,迁移后内部统一存原始 ISO 字符串,UI 可自行解析)。
9
- *
10
- * 设计原则(与 BookingTicket 现状对齐):
11
- * - 默认由 `loadBookingConfig` / `loadResources` 拉取并写入 store;也支持消费方 `set*` 直接灌入(复用 ticketBooking 已拉到的数据)。
12
- * - 所有读 API 返回浅克隆(数组)或原引用(map / config),避免 UI 写穿。
13
- */
14
- /** `loadBookingConfig` 入参,与 ticketBooking `getBookingConfig` 一致。 */
15
- export interface LoadBookingConfigParams {
16
- item_type?: string;
17
- sub_type?: string;
18
- source_type?: string;
19
- [key: string]: any;
20
- }
21
- /** `loadResources` 入参,与 info2 `getResourceList` 一致。 */
22
- export interface LoadBookingResourcesParams {
23
- /** 查询日期,`YYYY-MM-DD`;缺省用 store 内已 set 的 date,再缺省为当天。 */
24
- date?: string;
25
- /** 编辑态排除容量占用用的 booking id 列表。 */
26
- bookingIds?: number[];
27
- }
28
- /** `initBookingContext` 入参(BookingTicket 聚合入口)。 */
29
- export interface InitBookingContextParams {
30
- bookingConfigParams?: LoadBookingConfigParams;
31
- date?: BookingContextDateInput;
32
- /** 是否拉资源列表,默认 true。 */
33
- loadResources?: boolean;
34
- bookingIds?: number[];
35
- /** 为 true 时忽略内存命中,强制重新请求(默认 false)。 */
36
- forceRefresh?: boolean;
37
- }
38
- /**
39
- * 资源全集 map:key 为资源 id(数字),value 为资源原始对象,含 times / event_list 等运行态。
40
- * 这里只声明 Record 形态;具体字段保留 `any`,与 ticketBooking 现网传入的数据形状兼容。
41
- */
42
- export type BookingContextResource = Record<string, any>;
43
- export type BookingContextResourceMap = Record<string, BookingContextResource>;
44
- /**
45
- * 形参 booking_config(结构来自 `/core/board/management/config` 接口)。
46
- * OS 不强制 schema,保留 `Record<string, any>` 兼容现网;常用路径文档化在 SDK docs。
47
- */
48
- export type BookingContextConfig = Record<string, any>;
49
- /**
50
- * 日期入参:接受 dayjs 实例、ISO 字符串、Date 实例;内部统一 normalize 为 ISO 字符串保存。
51
- */
52
- export type BookingContextDateInput = string | Date | {
53
- format?: (fmt?: string) => string;
54
- } | null | undefined;
55
- /**
56
- * 内部 store 形态。`resourcesOriginMap` 由 `setResources` 派生,不允许外部直接 set。
57
- */
58
- export interface BookingContextState {
59
- bookingConfig: BookingContextConfig | null;
60
- resourcesOrigin: BookingContextResource[];
61
- resourcesOriginMap: BookingContextResourceMap;
62
- /**
63
- * 当前选择的日期,统一 ISO 字符串('YYYY-MM-DD HH:mm:ss' 或 'YYYY-MM-DD')。
64
- * UI 取出后可自行 dayjs 解析;OS 内的计算 helper 都接受 string,不做 dayjs 依赖。
65
- */
66
- date: string | null;
67
- }
68
- /**
69
- * BookingContextModule 对外 API(给 BookingTicket / SDK Provider 透传消费)。
70
- */
71
- export interface BookingContextModuleAPI {
72
- setBookingConfig(config: BookingContextConfig | null): void;
73
- getBookingConfig(): BookingContextConfig | null;
74
- setResources(resources: BookingContextResource[] | null | undefined): void;
75
- getResourcesOrigin(): BookingContextResource[];
76
- getResourcesOriginMap(): BookingContextResourceMap;
77
- setDate(date: BookingContextDateInput): void;
78
- getDate(): string | null;
79
- /** 当前 store 的浅克隆,调试 / 测试用。 */
80
- getState(): BookingContextState;
81
- /** 一键清空,destroy / 切租户场景用。 */
82
- clear(): void;
83
- /** 拉取 board config 并写入 store(`/core/board/management/config`)。 */
84
- loadBookingConfig(params?: LoadBookingConfigParams): Promise<BookingContextConfig | null>;
85
- /** 拉取资源全集并写入 store(`/schedule/resource/list`)。 */
86
- loadResources(params?: LoadBookingResourcesParams): Promise<BookingContextResource[]>;
87
- /**
88
- * 依次 setDate → loadBookingConfig → loadResources。
89
- * SalesSdkProvider 挂载时默认调用 BookingTicket.initBookingContext。
90
- */
91
- initBookingContext(params?: InitBookingContextParams): Promise<BookingContextState>;
92
- /** store 是否已具备与入参等价的 config / resources(无需再请求)。 */
93
- isBookingContextReady(params?: InitBookingContextParams): boolean;
94
- }
95
- /**
96
- * BookingContextModule 事件名常量(采用 `${this.name}:` 前缀,与现有模块一致)。
97
- */
98
- export declare enum BookingContextEvent {
99
- OnBookingConfigChange = "onBookingConfigChange",
100
- OnResourcesChange = "onResourcesChange",
101
- OnDateChange = "onDateChange"
102
- }
@@ -1,51 +0,0 @@
1
- /**
2
- * BookingContext 子模块:承载「预约 UI 上下文」三件套。
3
- *
4
- * - bookingConfig:来自 `/core/board/management/config` 的整套预约配置(service_time / resource_tab /
5
- * appointment_subject / subject_require / stock_setting / basic / capacity 等)。
6
- * - resourcesOrigin / resourcesOriginMap:来自 `/schedule/resource/list` 的资源全集,含 times / event_list /
7
- * combined_resource 等运行态信息,是 getResourceByIds / getResourceTimeIsUsable 的输入。
8
- * - date:当前选择的日期(dayjs 或 ISO 字符串,迁移后内部统一存原始 ISO 字符串,UI 可自行解析)。
9
- *
10
- * 设计原则(与 BookingTicket 现状对齐):
11
- * - 默认由 `loadBookingConfig` / `loadResources` 拉取并写入 store;也支持消费方 `set*` 直接灌入(复用 ticketBooking 已拉到的数据)。
12
- * - 所有读 API 返回浅克隆(数组)或原引用(map / config),避免 UI 写穿。
13
- */
14
-
15
- /** `loadBookingConfig` 入参,与 ticketBooking `getBookingConfig` 一致。 */
16
-
17
- /** `loadResources` 入参,与 info2 `getResourceList` 一致。 */
18
-
19
- /** `initBookingContext` 入参(BookingTicket 聚合入口)。 */
20
-
21
- /**
22
- * 资源全集 map:key 为资源 id(数字),value 为资源原始对象,含 times / event_list 等运行态。
23
- * 这里只声明 Record 形态;具体字段保留 `any`,与 ticketBooking 现网传入的数据形状兼容。
24
- */
25
-
26
- /**
27
- * 形参 booking_config(结构来自 `/core/board/management/config` 接口)。
28
- * OS 不强制 schema,保留 `Record<string, any>` 兼容现网;常用路径文档化在 SDK docs。
29
- */
30
-
31
- /**
32
- * 日期入参:接受 dayjs 实例、ISO 字符串、Date 实例;内部统一 normalize 为 ISO 字符串保存。
33
- */
34
-
35
- /**
36
- * 内部 store 形态。`resourcesOriginMap` 由 `setResources` 派生,不允许外部直接 set。
37
- */
38
-
39
- /**
40
- * BookingContextModule 对外 API(给 BookingTicket / SDK Provider 透传消费)。
41
- */
42
-
43
- /**
44
- * BookingContextModule 事件名常量(采用 `${this.name}:` 前缀,与现有模块一致)。
45
- */
46
- export var BookingContextEvent = /*#__PURE__*/function (BookingContextEvent) {
47
- BookingContextEvent["OnBookingConfigChange"] = "onBookingConfigChange";
48
- BookingContextEvent["OnResourcesChange"] = "onResourcesChange";
49
- BookingContextEvent["OnDateChange"] = "onDateChange";
50
- return BookingContextEvent;
51
- }({});
@@ -1,16 +0,0 @@
1
- import type { OrderProduct } from '../../Order/types';
2
- export interface BuildCacheItemFromOrderLineInput {
3
- /** tempOrder.products 中的一行 */
4
- product: OrderProduct;
5
- /** 与该行 product_uid 关联的 tempOrder.bookings 项 */
6
- booking: Record<string, any>;
7
- /** 商品 catalog / 详情,用于 capacity、duration、product_resource 等模板字段 */
8
- sourceProduct?: Record<string, any> | null;
9
- }
10
- /**
11
- * 从已加车的 order line + booking 反查 editService 所需的 cacheItem。
12
- *
13
- * 与 `buildCacheItemFromCartDetail` / `buildCacheItemFromDetail` 正向拼装互逆(在 getProductExtend 之前调用)。
14
- * 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
15
- */
16
- export declare function buildCacheItemFromOrderLine(input: BuildCacheItemFromOrderLineInput): Record<string, any>;
@@ -1,284 +0,0 @@
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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
- 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); }
8
- 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; }
9
- 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; } }
10
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- 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); }
12
- 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; }
13
- 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; }
14
- 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; }
15
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
16
- 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); }
17
- import dayjs from 'dayjs';
18
- import { getProductSkuOptions } from "../../Order/utils";
19
- import { resolveManualDiscountMessage } from "../../Order/utils/manualProductDiscount";
20
- import { buildProductOptionStringFromOrderLine } from "./orderLineDisplay";
21
- function safeFormat(value, fmt) {
22
- if (value === undefined || value === null) return undefined;
23
- var d = dayjs(value);
24
- if (!d.isValid()) return undefined;
25
- return d.format(fmt);
26
- }
27
- function normalizeTimeString(value) {
28
- if (value === undefined || value === null) return undefined;
29
- if (typeof value === 'string') {
30
- var t = value.trim();
31
- var hhmmFromHhmmss = t.match(/^(\d{1,2}:\d{2}):\d{2}$/);
32
- if (hhmmFromHhmmss) return hhmmFromHhmmss[1];
33
- if (/^\d{1,2}:\d{2}$/.test(t)) return t;
34
- }
35
- var d = dayjs(value);
36
- if (d.isValid()) return d.format('HH:mm');
37
- return undefined;
38
- }
39
-
40
- /**
41
- * bookings[].resources[] → cacheItem._extend.resource(与 cacheItemToBookingInput.flattenResources 互逆)。
42
- */
43
- function unflattenResourceMap(resources) {
44
- var map = {};
45
- if (!Array.isArray(resources)) return map;
46
- resources.forEach(function (r) {
47
- var formId = r === null || r === void 0 ? void 0 : r.form_id;
48
- if (formId === undefined || formId === null) return;
49
- var key = String(formId);
50
- if (!map[key]) map[key] = [];
51
- map[key].push({
52
- form_id: formId,
53
- relation_id: r.relation_id,
54
- relation_type: r.relation_type || 'form',
55
- like_status: r.like_status || 'common',
56
- metadata: r.metadata ? _objectSpread({}, r.metadata) : undefined,
57
- children: r.children
58
- });
59
- });
60
- return map;
61
- }
62
-
63
- /**
64
- * 从 booking.metadata.capacity 还原 `_extend.capacity`(与 info2 ticketBooking getCapacity 对齐)。
65
- * 勿用 resources[].relation_id 反推人数维度 id。
66
- */
67
- function resolveCapacityFromBooking(booking) {
68
- var _booking$metadata;
69
- var metaCap = (_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.capacity;
70
- if (Array.isArray(metaCap) && metaCap.length > 0) {
71
- return metaCap.map(function (item) {
72
- var _item$value;
73
- if (!item || _typeof(item) !== 'object') return null;
74
- if (item.id === undefined || item.id === null) return null;
75
- var row = {
76
- id: item.id,
77
- value: Number((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : 0)
78
- };
79
- if (item.name !== undefined) row.name = item.name;
80
- return row;
81
- }).filter(function (item) {
82
- return item != null;
83
- });
84
- }
85
- if (typeof metaCap === 'number' && Number.isFinite(metaCap)) {
86
- return [{
87
- id: 0,
88
- value: metaCap,
89
- name: ''
90
- }];
91
- }
92
- return [];
93
- }
94
- function resolveDurationForExtend(booking) {
95
- var duration = booking.duration;
96
- if (booking.sub_type === 'days' || booking.is_all === 1) {
97
- return duration;
98
- }
99
- if (typeof duration === 'number' && Number.isFinite(duration)) {
100
- return duration;
101
- }
102
- return duration;
103
- }
104
-
105
- /** booking.duration → catalog 顶层 duration 结构(供 isNormalProductByDurationSchedule 识别)。 */
106
- function resolveTopLevelDuration(booking, sourceProduct) {
107
- if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.duration) !== undefined) {
108
- return sourceProduct.duration;
109
- }
110
- var raw = booking.duration;
111
- if (raw == null || raw === '') return undefined;
112
- if (_typeof(raw) === 'object' && raw.type) {
113
- return raw;
114
- }
115
- var subType = booking.sub_type === 'days' ? 'days' : 'minutes';
116
- var value = Number(raw);
117
- if (!Number.isFinite(value) || value <= 0) return undefined;
118
- return {
119
- type: subType,
120
- value: value
121
- };
122
- }
123
- function resolveProductTitle(product, booking, sourceProduct) {
124
- var _ref, _ref2, _ref3, _ref4, _ref5, _title, _booking$product, _booking$detail;
125
- var metadata = product.metadata || {};
126
- return (_ref = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_title = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) !== null && _title !== void 0 ? _title : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.name) !== null && _ref5 !== void 0 ? _ref5 : metadata.product_title) !== null && _ref4 !== void 0 ? _ref4 : metadata.product_name) !== null && _ref3 !== void 0 ? _ref3 : booking === null || booking === void 0 || (_booking$product = booking.product) === null || _booking$product === void 0 ? void 0 : _booking$product.title) !== null && _ref2 !== void 0 ? _ref2 : booking === null || booking === void 0 || (_booking$detail = booking.detail) === null || _booking$detail === void 0 ? void 0 : _booking$detail.product_title) !== null && _ref !== void 0 ? _ref : '';
127
- }
128
-
129
- /**
130
- * catalog 缺 product_resource 时,从 booking.resources 反推最小 product_resource 结构,
131
- * 供 getResourceByIds / formatResources 渲染资源编辑 UI。
132
- *
133
- * @example
134
- * synthesizeProductResourceFromBooking({ resources: [{ form_id: 35, relation_id: 41077 }] });
135
- */
136
- function synthesizeProductResourceFromBooking(booking) {
137
- var rows = booking === null || booking === void 0 ? void 0 : booking.resources;
138
- if (!Array.isArray(rows) || rows.length === 0) return undefined;
139
- var relationIdsByForm = new Map();
140
- rows.forEach(function (row) {
141
- var _relationIdsByForm$ge;
142
- var formId = row === null || row === void 0 ? void 0 : row.form_id;
143
- var relationId = Number(row === null || row === void 0 ? void 0 : row.relation_id);
144
- if (formId == null || formId === '' || !Number.isFinite(relationId) || relationId <= 0) {
145
- return;
146
- }
147
- var list = (_relationIdsByForm$ge = relationIdsByForm.get(formId)) !== null && _relationIdsByForm$ge !== void 0 ? _relationIdsByForm$ge : [];
148
- if (!list.includes(relationId)) {
149
- list.push(relationId);
150
- }
151
- relationIdsByForm.set(formId, list);
152
- });
153
- if (relationIdsByForm.size === 0) return undefined;
154
- return {
155
- resources: Array.from(relationIdsByForm.entries()).map(function (_ref6) {
156
- var _ref7 = _slicedToArray(_ref6, 2),
157
- formId = _ref7[0],
158
- relationIds = _ref7[1];
159
- return {
160
- id: formId,
161
- status: 1,
162
- type: 'form',
163
- code: '',
164
- optional_resource: relationIds,
165
- default_resource: []
166
- };
167
- })
168
- };
169
- }
170
-
171
- /**
172
- * 从已加车的 order line + booking 反查 editService 所需的 cacheItem。
173
- *
174
- * 与 `buildCacheItemFromCartDetail` / `buildCacheItemFromDetail` 正向拼装互逆(在 getProductExtend 之前调用)。
175
- * 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
176
- */
177
- export function buildCacheItemFromOrderLine(input) {
178
- var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref8, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref9, _extension_type, _booking$product2, _booking$product3, _price, _product$order_detail, _ref10, _booking$id;
179
- var product = input.product,
180
- booking = input.booking,
181
- sourceProduct = input.sourceProduct;
182
- var resolvedId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id;
183
- var selling = Number((_product$selling_pric = product.selling_price) !== null && _product$selling_pric !== void 0 ? _product$selling_pric : 0);
184
- var original = Number((_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : selling);
185
- var startDate = safeFormat(booking.start_date, 'YYYY-MM-DD');
186
- var endDate = safeFormat(booking.end_date, 'YYYY-MM-DD');
187
- var startTime = normalizeTimeString(booking.start_time);
188
- var endTime = normalizeTimeString(booking.end_time);
189
- var resource = unflattenResourceMap(booking.resources);
190
- var capacity = resolveCapacityFromBooking(booking);
191
- var holderId = (_booking$metadata$hol = (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.holder_id) !== null && _booking$metadata$hol !== void 0 ? _booking$metadata$hol : booking.holder_id;
192
- var productTitle = resolveProductTitle(product, booking, sourceProduct);
193
- var productOptionString = buildProductOptionStringFromOrderLine(product);
194
- var other = {
195
- product_variant_id: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0,
196
- option: getProductSkuOptions(product),
197
- bundle: Array.isArray(product.product_bundle) ? _toConsumableArray(product.product_bundle) : []
198
- };
199
- var extend = _objectSpread({
200
- start_date: startDate ? dayjs(startDate) : undefined,
201
- end_date: endDate ? dayjs(endDate) : undefined,
202
- startDate: startDate ? dayjs(startDate) : undefined,
203
- endDate: endDate ? dayjs(endDate) : undefined,
204
- start_time: startTime,
205
- end_time: endTime,
206
- duration: resolveDurationForExtend(booking),
207
- sub_type: booking.sub_type,
208
- quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1,
209
- product_name: productTitle,
210
- note: (_ref8 = (_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : booking === null || booking === void 0 || (_booking$detail2 = booking.detail) === null || _booking$detail2 === void 0 ? void 0 : _booking$detail2.note) !== null && _ref8 !== void 0 ? _ref8 : '',
211
- price: selling,
212
- total: selling,
213
- origin_total: original,
214
- resource: resource,
215
- capacity: capacity,
216
- holder_id: holderId,
217
- other: other,
218
- like_status: booking.like_status || 'common',
219
- discount_reason: resolveManualDiscountMessage(product.discount_list, (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.product_discount_reason) || undefined
220
- }, productOptionString ? {
221
- product_option_string: productOptionString
222
- } : {});
223
- var manualDiscount = (product.discount_list || []).find(function (d) {
224
- return (d === null || d === void 0 ? void 0 : d.type) === 'product';
225
- });
226
- if (manualDiscount && extend.origin_total === selling) {
227
- var _manualDiscount$amoun;
228
- var manualAmount = Number((_manualDiscount$amoun = manualDiscount.amount) !== null && _manualDiscount$amoun !== void 0 ? _manualDiscount$amoun : 0);
229
- if (Number.isFinite(manualAmount) && manualAmount > 0) {
230
- extend.origin_total = selling + manualAmount;
231
- }
232
- }
233
- if (((_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.price_override) != null || manualDiscount) {
234
- extend.priceOverride = selling;
235
- }
236
- if (booking.holder !== undefined) {
237
- extend.holder = booking.holder;
238
- }
239
- if (Array.isArray(booking.relation_forms)) {
240
- extend.relation_forms = booking.relation_forms;
241
- }
242
- var base = _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
243
- id: resolvedId,
244
- product_id: resolvedId,
245
- extension_type: (_ref9 = (_extension_type = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type) !== null && _extension_type !== void 0 ? _extension_type : booking === null || booking === void 0 || (_booking$product2 = booking.product) === null || _booking$product2 === void 0 ? void 0 : _booking$product2.extension_type) !== null && _ref9 !== void 0 ? _ref9 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type,
246
- title: productTitle || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || (booking === null || booking === void 0 || (_booking$product3 = booking.product) === null || _booking$product3 === void 0 ? void 0 : _booking$product3.title),
247
- price: (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : selling,
248
- selling_price: product.selling_price,
249
- original_price: product.original_price
250
- }, productOptionString ? {
251
- product_option_string: productOptionString
252
- } : {}), {}, {
253
- _extend: extend,
254
- new: 0,
255
- autoClose: false,
256
- order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
257
- booking_id: (_ref10 = (_booking$id = booking.id) !== null && _booking$id !== void 0 ? _booking$id : booking.booking_id) !== null && _ref10 !== void 0 ? _ref10 : 0
258
- });
259
- if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.capacity) !== undefined) {
260
- base.capacity = sourceProduct.capacity;
261
- }
262
- var topLevelDuration = resolveTopLevelDuration(booking, sourceProduct);
263
- if (topLevelDuration !== undefined) {
264
- base.duration = topLevelDuration;
265
- }
266
- if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.product_resource) !== undefined) {
267
- base.product_resource = sourceProduct.product_resource;
268
- } else {
269
- var synthesized = synthesizeProductResourceFromBooking(booking);
270
- if (synthesized) {
271
- base.product_resource = synthesized;
272
- }
273
- }
274
- if (Array.isArray(sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.schedules) && sourceProduct.schedules.length) {
275
- base.schedules = sourceProduct.schedules;
276
- }
277
- if (Array.isArray(sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct['schedule.ids']) && sourceProduct['schedule.ids'].length) {
278
- base['schedule.ids'] = sourceProduct['schedule.ids'];
279
- }
280
- if (booking.schedule_event_id !== undefined) {
281
- base.schedule_event_id = booking.schedule_event_id;
282
- }
283
- return base;
284
- }
@@ -1,8 +0,0 @@
1
- import type { OrderProduct } from '../../Order/types';
2
- export interface BuildNormalProductCacheItemFromOrderLineInput {
3
- /** tempOrder.products 中的一行(普通商品,无关联 booking) */
4
- product: OrderProduct;
5
- /** 商品 catalog / 详情,用于 variant / option / bundle 模板字段 */
6
- sourceProduct?: Record<string, any> | null;
7
- }
8
- export declare function buildNormalProductCacheItemFromOrderLine(input: BuildNormalProductCacheItemFromOrderLineInput): Record<string, any>;
@@ -1,145 +0,0 @@
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
- var _excluded = ["bundle_selling_price"];
3
- 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; }
4
- 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; }
5
- 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; }
6
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
- 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); }
8
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
- import { getProductSkuOptions } from "../../Order/utils";
11
- import { buildProductOptionStringFromOrderLine } from "./orderLineDisplay";
12
- /**
13
- * 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
14
- *
15
- * 与 `buildCacheItemFromOrderLine`(预约行 + booking)并列;不含 resource / duration / holder 等预约字段。
16
- */
17
- /**
18
- * 解析 v2 主商品 source 价(不含 option、不含 bundle),供 SkuDetailModal / transform 使用。
19
- */
20
- function resolveSourceProductPrice(product, sourceProduct) {
21
- var _price, _price2, _metadata$origin2, _metadata$origin3, _product$selling_pric;
22
- var metadata = product.metadata || {};
23
- if (metadata.source_product_price !== undefined && metadata.source_product_price !== null) {
24
- var parsed = Number(metadata.source_product_price);
25
- if (Number.isFinite(parsed)) return parsed;
26
- }
27
- var variantId = Number(product.product_variant_id || 0);
28
- if (variantId > 0) {
29
- var _variant, _metadata$origin;
30
- var variantList = (_variant = (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.variant) !== null && _variant !== void 0 ? _variant : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.variant;
31
- if (Array.isArray(variantList)) {
32
- var _matched$price;
33
- var matched = variantList.find(function (v) {
34
- return Number(v === null || v === void 0 ? void 0 : v.id) === variantId;
35
- });
36
- var variantPrice = (_matched$price = matched === null || matched === void 0 ? void 0 : matched.price) !== null && _matched$price !== void 0 ? _matched$price : matched === null || matched === void 0 ? void 0 : matched.base_price;
37
- if (variantPrice !== undefined && variantPrice !== null) {
38
- var _parsed = Number(variantPrice);
39
- if (Number.isFinite(_parsed)) return _parsed;
40
- }
41
- }
42
- }
43
- var catalogPrice = (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price;
44
- if (catalogPrice !== undefined && catalogPrice !== null) {
45
- var _parsed2 = Number(catalogPrice);
46
- if (Number.isFinite(_parsed2)) return _parsed2;
47
- }
48
- var originPrice = (_price2 = (_metadata$origin2 = metadata.origin) === null || _metadata$origin2 === void 0 ? void 0 : _metadata$origin2.price) !== null && _price2 !== void 0 ? _price2 : (_metadata$origin3 = metadata.origin) === null || _metadata$origin3 === void 0 ? void 0 : _metadata$origin3.base_price;
49
- if (originPrice !== undefined && originPrice !== null) {
50
- var _parsed3 = Number(originPrice);
51
- if (Number.isFinite(_parsed3)) return _parsed3;
52
- }
53
- return Number((_product$selling_pric = product.selling_price) !== null && _product$selling_pric !== void 0 ? _product$selling_pric : 0);
54
- }
55
-
56
- /** 订单行 bundle → booking other.bundle(保留 original_price 供 setProductPrice 按比例分摊) */
57
- function mapOrderBundleToOtherBundle(bundle) {
58
- return bundle.map(function (item) {
59
- var _ref, _ref2, _item$original_price, _ref3, _item$bundle_selling_, _item$original_total, _ref4, _item$num, _ref5, _item$quantity;
60
- var catalogOriginal = (_ref = (_ref2 = (_item$original_price = item.original_price) !== null && _item$original_price !== void 0 ? _item$original_price : item.product_price) !== null && _ref2 !== void 0 ? _ref2 : item.price) !== null && _ref !== void 0 ? _ref : item.bundle_selling_price;
61
- var selling = (_ref3 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref3 !== void 0 ? _ref3 : catalogOriginal;
62
- var _omitBundleSelling = item.bundle_selling_price,
63
- rest = _objectWithoutProperties(item, _excluded);
64
- var isMarkupOrMarkdown = (item.price_type === 'markdown' || item.price_type === 'markup') && (item.price_type_ext === '' || item.price_type_ext === undefined || item.price_type_ext === null);
65
- if (isMarkupOrMarkdown) delete rest.original_total;
66
- return _objectSpread(_objectSpread(_objectSpread({}, rest), {}, {
67
- price: selling,
68
- original_price: catalogOriginal
69
- }, isMarkupOrMarkdown ? {} : {
70
- original_total: (_item$original_total = item.original_total) !== null && _item$original_total !== void 0 ? _item$original_total : catalogOriginal
71
- }), {}, {
72
- num: (_ref4 = (_item$num = item.num) !== null && _item$num !== void 0 ? _item$num : item.quantity) !== null && _ref4 !== void 0 ? _ref4 : 1,
73
- quantity: (_ref5 = (_item$quantity = item.quantity) !== null && _item$quantity !== void 0 ? _item$quantity : item.num) !== null && _ref5 !== void 0 ? _ref5 : 1
74
- });
75
- });
76
- }
77
- export function buildNormalProductCacheItemFromOrderLine(input) {
78
- var _product$product_id, _product$selling_pric2, _product$original_pri, _product$metadata, _product$metadata2, _product$product_vari, _originExtend$other, _product$num, _product$product_vari2, _product$num2, _title, _product$note, _originExtend$price, _originExtend$total, _originExtend$origin_, _price3, _product$order_detail;
79
- var product = input.product,
80
- sourceProduct = input.sourceProduct;
81
- var resolvedId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id;
82
- var sourcePrice = resolveSourceProductPrice(product, sourceProduct);
83
- var selling = Number((_product$selling_pric2 = product.selling_price) !== null && _product$selling_pric2 !== void 0 ? _product$selling_pric2 : 0);
84
- var original = Number((_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : selling);
85
- var uid = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number;
86
- var option = getProductSkuOptions(product);
87
- var bundle = mapOrderBundleToOtherBundle(Array.isArray(product.product_bundle) ? product.product_bundle : []);
88
- var originExtend = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 || (_product$metadata2 = _product$metadata2.origin) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2._extend;
89
- var productOptionString = buildProductOptionStringFromOrderLine(product);
90
- var discountList = product.discount_list || [];
91
- var other = {
92
- product_id: resolvedId,
93
- product_variant_id: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0,
94
- option: option,
95
- bundle: originExtend !== null && originExtend !== void 0 && (_originExtend$other = originExtend.other) !== null && _originExtend$other !== void 0 && _originExtend$other.bundle ? JSON.parse(JSON.stringify(originExtend.other.bundle)) : bundle,
96
- quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1
97
- };
98
- var skuValue = {
99
- product_id: resolvedId,
100
- product_variant_id: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : 0,
101
- option: other.option,
102
- bundle: other.bundle
103
- };
104
- var extend = _objectSpread(_objectSpread(_objectSpread({
105
- quantity: (_product$num2 = product.num) !== null && _product$num2 !== void 0 ? _product$num2 : 1,
106
- product_name: (_title = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) !== null && _title !== void 0 ? _title : '',
107
- note: (_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : '',
108
- // v2:_extend.price 为主商品 source 价;行 composite 用 total / origin_total 展示
109
- price: (_originExtend$price = originExtend === null || originExtend === void 0 ? void 0 : originExtend.price) !== null && _originExtend$price !== void 0 ? _originExtend$price : sourcePrice,
110
- total: (_originExtend$total = originExtend === null || originExtend === void 0 ? void 0 : originExtend.total) !== null && _originExtend$total !== void 0 ? _originExtend$total : selling,
111
- origin_total: (_originExtend$origin_ = originExtend === null || originExtend === void 0 ? void 0 : originExtend.origin_total) !== null && _originExtend$origin_ !== void 0 ? _originExtend$origin_ : original,
112
- other: other,
113
- skuValue: JSON.parse(JSON.stringify(skuValue)),
114
- _skuValue: JSON.parse(JSON.stringify(skuValue)),
115
- isNormalProduct: true
116
- }, productOptionString ? {
117
- product_option_string: productOptionString
118
- } : {}), (originExtend === null || originExtend === void 0 ? void 0 : originExtend.priceOverride) !== undefined ? {
119
- priceOverride: originExtend.priceOverride
120
- } : {}), (originExtend === null || originExtend === void 0 ? void 0 : originExtend.bundle_edit) !== undefined ? {
121
- bundle_edit: originExtend.bundle_edit
122
- } : {});
123
- if (originExtend !== null && originExtend !== void 0 && originExtend.skuValue || originExtend !== null && originExtend !== void 0 && originExtend._skuValue) {
124
- extend.skuValue = JSON.parse(JSON.stringify(originExtend.skuValue || originExtend._skuValue));
125
- extend._skuValue = JSON.parse(JSON.stringify(extend.skuValue));
126
- }
127
- return _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
128
- id: resolvedId,
129
- product_id: resolvedId,
130
- _id: uid,
131
- title: sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title,
132
- price: (_price3 = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price3 !== void 0 ? _price3 : sourcePrice,
133
- selling_price: product.selling_price,
134
- original_price: product.original_price
135
- }, productOptionString ? {
136
- product_option_string: productOptionString
137
- } : {}), {}, {
138
- note: product.note,
139
- order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
140
- discount_list: discountList,
141
- new: 0,
142
- autoClose: true,
143
- _extend: extend
144
- });
145
- }