@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,8 +1,8 @@
1
1
  var _excluded = ["id"],
2
- _excluded2 = ["product_id"],
3
- _excluded3 = ["product_id"];
4
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
+ _excluded2 = ["product_id"];
5
3
  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); }
4
+ 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; }
5
+ 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; }
6
6
  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; }
7
7
  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; }
8
8
  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; }
@@ -26,134 +26,17 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
26
26
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
27
27
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
28
28
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
29
- 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; }
30
- 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; }
31
29
  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; }
32
30
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
33
31
  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); }
34
- import dayjs from 'dayjs';
35
32
  import { createBookingTicketModule } from "./types";
36
- import { getProductExtend as getProductExtendUtil, getResourceByIds as getResourceByIdsUtil, getResourceErrors as getResourceErrorsUtil, derivePresetStartTimeFromDate } from "../../modules/BookingContext";
37
33
  import { BaseSalesImpl } from "../BaseSales";
38
34
  import Scan from "./utils/scan";
39
35
  import { formatOrderCustomerPatch } from "./utils/orderCustomer";
40
36
  import { handleGlobalScan, handleCustomerScan, handleUniversalScan } from "./utils/scan/handleScan";
41
37
  import scanCache from "./utils/scan/scanCache";
42
- import { formatGlobalScanResult } from "./utils/scan/formatGlobalScan";
43
- import { applyGlobalScan } from "./utils/scan/applyGlobalScan";
44
38
  import { buildCartView } from "./utils/cartView";
45
- import { buildCacheItemFromCartDetail, buildCacheItemFromDetail, buildRequiresDetailPayload as _buildRequiresDetailPayload, decideAddProduct as decideAddProductUtil, decideAfterDetail as decideAfterDetailUtil, decideAutoClose as decideAutoCloseUtil, getIsEject as getIsEjectUtil, getIsOnlySession as getIsOnlySessionUtil, transformDetailToProductAndBooking as transformDetailToProductAndBookingUtil } from "./utils/addProductDecision";
46
- import { buildCacheItemFromOrderLine as buildCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildCacheItemFromOrderLine";
47
- import { buildSessionCatalogStaleInfo, isSessionCatalogDateStale } from "./utils/sessionCatalogStale";
48
- import { buildNormalProductCacheItemFromOrderLine as buildNormalProductCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine";
49
- import { buildProductOptionStringFromOrderLine } from "../../modules/BookingContext/utils/orderLineDisplay";
50
- import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
51
- import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resolveBestAddTimePlan";
52
- var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
53
- var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
54
-
55
- /**
56
- * 读取已有 booking 的协议唯一值,用于加时商品行绑定原预约。
57
- *
58
- * @example
59
- * const bookingUid = resolveBookingUidForAddTime(booking);
60
- */
61
- function resolveBookingUidForAddTime(booking) {
62
- var _booking$metadata;
63
- var uid = booking === null || booking === void 0 || (_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.unique_identification_number;
64
- return uid === undefined || uid === null ? '' : String(uid);
65
- }
66
-
67
- /**
68
- * 规范化加车数量,避免非法值进入 OrderModule。
69
- *
70
- * @example
71
- * const quantity = normalizeAddTimeQuantity(product.num);
72
- */
73
- function normalizeAddTimeQuantity(value) {
74
- var parsed = Math.floor(Number(value));
75
- return Number.isFinite(parsed) && parsed > 0 ? parsed : 1;
76
- }
77
-
78
- /**
79
- * 解析加时时长,优先使用显式入参,其次回退商品字段。
80
- *
81
- * @example
82
- * const minutes = resolveAddTimeScheduleMinutes(input.product_add_schedule_time, product);
83
- */
84
- function resolveAddTimeScheduleMinutes(explicitValue, product) {
85
- var raw = explicitValue !== null && explicitValue !== void 0 ? explicitValue : product === null || product === void 0 ? void 0 : product.product_add_schedule_time;
86
- if (raw === undefined || raw === null || raw === '') return undefined;
87
- var parsed = Number(raw);
88
- return Number.isFinite(parsed) ? parsed : undefined;
89
- }
90
-
91
- /**
92
- * 计算加时商品行价格字段,保持 `price` 与 `selling_price` 输入口径一致。
93
- *
94
- * @example
95
- * const price = resolveAddTimeProductPrice(input.price, product);
96
- */
97
- function resolveAddTimeProductPrice(explicitValue, product) {
98
- var _ref, _ref2;
99
- return (_ref = (_ref2 = explicitValue !== null && explicitValue !== void 0 ? explicitValue : product === null || product === void 0 ? void 0 : product.price) !== null && _ref2 !== void 0 ? _ref2 : product === null || product === void 0 ? void 0 : product.selling_price) !== null && _ref !== void 0 ? _ref : product === null || product === void 0 ? void 0 : product.base_price;
100
- }
101
-
102
- /**
103
- * 规范化加时覆盖分钟数。
104
- *
105
- * @example
106
- * const minutes = normalizeCoveredMinutes(input.coveredMinutes);
107
- */
108
- function normalizeCoveredMinutes(value) {
109
- var parsed = Math.ceil(Number(value));
110
- return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
111
- }
112
-
113
- /**
114
- * 计算 booking 加时后的结束时间与时长。
115
- *
116
- * @example
117
- * const updates = buildAddTimeBookingTimePatch(booking, 30);
118
- */
119
- function buildAddTimeBookingTimePatch(booking, coveredMinutes) {
120
- if (coveredMinutes <= 0) return null;
121
- var endDate = booking === null || booking === void 0 ? void 0 : booking.end_date;
122
- var endTime = booking === null || booking === void 0 ? void 0 : booking.end_time;
123
- if (!endDate || !endTime) {
124
- throw new Error('[BookingTicket] addAddTimeProductsToBooking: booking.end_date/end_time 缺失');
125
- }
126
- var currentEnd = dayjs("".concat(endDate, " ").concat(endTime));
127
- if (!currentEnd.isValid()) {
128
- throw new Error('[BookingTicket] addAddTimeProductsToBooking: booking.end_date/end_time 无效');
129
- }
130
- var nextEnd = currentEnd.add(coveredMinutes, 'minute');
131
- var currentDuration = Number(booking === null || booking === void 0 ? void 0 : booking.duration);
132
- var duration = Number.isFinite(currentDuration) ? currentDuration + coveredMinutes : coveredMinutes;
133
- if (booking !== null && booking !== void 0 && booking.start_date && booking !== null && booking !== void 0 && booking.start_time) {
134
- var start = dayjs("".concat(booking.start_date, " ").concat(booking.start_time));
135
- if (start.isValid()) {
136
- var diffMinutes = nextEnd.diff(start, 'minute');
137
- duration = diffMinutes > 0 ? diffMinutes : duration;
138
- }
139
- }
140
- return {
141
- end_date: nextEnd.format('YYYY-MM-DD'),
142
- end_time: nextEnd.format('HH:mm'),
143
- duration: duration
144
- };
145
- }
146
- function withProductOptionString(cacheItem) {
147
- var _cacheItem$_extend;
148
- var productOptionString = buildProductOptionStringFromOrderLine(cacheItem);
149
- if (!productOptionString) return cacheItem;
150
- return _objectSpread(_objectSpread({}, cacheItem), {}, {
151
- product_option_string: (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_option_string) || productOptionString,
152
- _extend: _objectSpread(_objectSpread({}, (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem._extend) || {}), {}, {
153
- product_option_string: (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.product_option_string) || productOptionString
154
- })
155
- });
156
- }
39
+ import { applyBookingsStatus, resolveScheduleId, restoreBookingsStatus } from "./utils/bookingStatus";
157
40
  export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
158
41
  _inherits(BookingTicketImpl, _BaseSalesImpl);
159
42
  var _super = _createSuper(BookingTicketImpl);
@@ -174,28 +57,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
174
57
  _defineProperty(_assertThisInitialized(_this), "platform", void 0);
175
58
  _defineProperty(_assertThisInitialized(_this), "scan", void 0);
176
59
  _defineProperty(_assertThisInitialized(_this), "productCatalog", []);
177
- _defineProperty(_assertThisInitialized(_this), "addTimeProductsCatalog", []);
178
- _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
179
- _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
180
- _defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
181
60
  return _this;
182
61
  }
183
62
  _createClass(BookingTicketImpl, [{
184
63
  key: "getRegisteredModuleNames",
185
64
  value:
186
65
  /**
187
- * 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer + bookingContext
188
- * bookingContext 是 SalesSdk 加车下沉所需的「预约 UI 上下文」(bookingConfig / resourcesOrigin / date)。
66
+ * 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer。
189
67
  */
190
68
  function getRegisteredModuleNames() {
191
- return [].concat(_toConsumableArray(_get(_getPrototypeOf(BookingTicketImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['customer', 'bookingContext', 'openData']);
192
- }
193
- }, {
194
- key: "getSubmitOrderSalesChannel",
195
- value: function getSubmitOrderSalesChannel() {
196
- var _this$core, _this$core$getChannel;
197
- var channel = (_this$core = this.core) === null || _this$core === void 0 || (_this$core = _this$core.context) === null || _this$core === void 0 || (_this$core$getChannel = _this$core.getChannel) === null || _this$core$getChannel === void 0 ? void 0 : _this$core$getChannel.call(_this$core);
198
- return !channel || channel === 'system' ? 'pos' : channel;
69
+ return [].concat(_toConsumableArray(_get(_getPrototypeOf(BookingTicketImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['customer']);
199
70
  }
200
71
 
201
72
  /**
@@ -220,7 +91,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
220
91
  while (1) switch (_context.prev = _context.next) {
221
92
  case 0:
222
93
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
223
- this.scan = new Scan(this, "BOOKING_TICKET_SCAN:".concat(this.name));
94
+ this.scan = new Scan(this, 'BOOKING_TICKET_SCAN');
224
95
  _context.next = 4;
225
96
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "initialize", this).call(this, core, options);
226
97
  case 4:
@@ -231,11 +102,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
231
102
  throw new Error('bookingTicket解决方案需要 request 插件支持');
232
103
  case 6:
233
104
  this.platform = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform;
234
- _context.next = 9;
235
- return this.configureIdGeneratorFromOpenData();
236
- case 9:
237
105
  console.log('[BookingTicket] 初始化完成');
238
- case 10:
106
+ case 8:
239
107
  case "end":
240
108
  return _context.stop();
241
109
  }
@@ -246,246 +114,6 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
246
114
  }
247
115
  return initialize;
248
116
  }()
249
- }, {
250
- key: "getBookingTicketBusinessCode",
251
- value: function getBookingTicketBusinessCode() {
252
- var _this$otherParams$bus, _this$otherParams2, _this$otherParams3;
253
- var businessCode = (_this$otherParams$bus = (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.business_code;
254
- if (businessCode === undefined || businessCode === null) return null;
255
- var normalized = String(businessCode).trim();
256
- return normalized || null;
257
- }
258
- }, {
259
- key: "getIdGeneratorPlugin",
260
- value: function getIdGeneratorPlugin() {
261
- var _appPlugin$getApp, _app$getPlugin;
262
- var appPlugin = this.core.getPlugin('app');
263
- var app = appPlugin === null || appPlugin === void 0 || (_appPlugin$getApp = appPlugin.getApp) === null || _appPlugin$getApp === void 0 ? void 0 : _appPlugin$getApp.call(appPlugin);
264
- return (app === null || app === void 0 || (_app$getPlugin = app.getPlugin) === null || _app$getPlugin === void 0 ? void 0 : _app$getPlugin.call(app, 'idGenerator')) || null;
265
- }
266
- }, {
267
- key: "loadOpenDataConfig",
268
- value: function () {
269
- var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
270
- var businessCode, lastFetchedAt, cachedData, channel, openDataConfig;
271
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
272
- while (1) switch (_context2.prev = _context2.next) {
273
- case 0:
274
- if (this.store.openData) {
275
- _context2.next = 2;
276
- break;
277
- }
278
- throw new Error('openData 模块未初始化');
279
- case 2:
280
- businessCode = this.getBookingTicketBusinessCode();
281
- if (businessCode) {
282
- _context2.next = 6;
283
- break;
284
- }
285
- console.warn('[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载,当前 module name: ', this.name);
286
- return _context2.abrupt("return", null);
287
- case 6:
288
- lastFetchedAt = this.store.openData.getLastFetchedAt();
289
- cachedData = this.store.openData.getOpenData();
290
- if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
291
- _context2.next = 11;
292
- break;
293
- }
294
- this.otherParams.openData = cachedData;
295
- return _context2.abrupt("return", cachedData);
296
- case 11:
297
- if (!this.loadOpenDataConfigInFlight) {
298
- _context2.next = 15;
299
- break;
300
- }
301
- _context2.next = 14;
302
- return this.loadOpenDataConfigInFlight;
303
- case 14:
304
- return _context2.abrupt("return", _context2.sent);
305
- case 15:
306
- channel = this.getSubmitOrderSalesChannel();
307
- this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
308
- scope: 'board',
309
- target: "".concat(businessCode, "+").concat(channel),
310
- // target: `dine_in+pos`,
311
- section_code: [].concat(OPEN_DATA_SECTION_CODES)
312
- });
313
- _context2.prev = 17;
314
- _context2.next = 20;
315
- return this.loadOpenDataConfigInFlight;
316
- case 20:
317
- openDataConfig = _context2.sent;
318
- this.otherParams.openData = openDataConfig;
319
- return _context2.abrupt("return", openDataConfig);
320
- case 23:
321
- _context2.prev = 23;
322
- this.loadOpenDataConfigInFlight = null;
323
- return _context2.finish(23);
324
- case 26:
325
- case "end":
326
- return _context2.stop();
327
- }
328
- }, _callee2, this, [[17,, 23, 26]]);
329
- }));
330
- function loadOpenDataConfig() {
331
- return _loadOpenDataConfig.apply(this, arguments);
332
- }
333
- return loadOpenDataConfig;
334
- }()
335
- }, {
336
- key: "getOpenData",
337
- value: function () {
338
- var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
339
- var _this$store$openData;
340
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
341
- while (1) switch (_context3.prev = _context3.next) {
342
- case 0:
343
- return _context3.abrupt("return", (_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 ? void 0 : _this$store$openData.getOpenData());
344
- case 1:
345
- case "end":
346
- return _context3.stop();
347
- }
348
- }, _callee3, this);
349
- }));
350
- function getOpenData() {
351
- return _getOpenData.apply(this, arguments);
352
- }
353
- return getOpenData;
354
- }()
355
- }, {
356
- key: "getShortNumberOrDeviceId",
357
- value: function () {
358
- var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
359
- var getAsyncIotDeviceInfo, res;
360
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
361
- while (1) switch (_context4.prev = _context4.next) {
362
- case 0:
363
- getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
364
- if (!getAsyncIotDeviceInfo) {
365
- _context4.next = 7;
366
- break;
367
- }
368
- _context4.next = 4;
369
- return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
370
- case 4:
371
- res = _context4.sent;
372
- if (!(res !== null && res !== void 0 && res.short_number)) {
373
- _context4.next = 7;
374
- break;
375
- }
376
- return _context4.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
377
- case 7:
378
- return _context4.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
379
- case 8:
380
- case "end":
381
- return _context4.stop();
382
- }
383
- }, _callee4, this);
384
- }));
385
- function getShortNumberOrDeviceId() {
386
- return _getShortNumberOrDeviceId.apply(this, arguments);
387
- }
388
- return getShortNumberOrDeviceId;
389
- }()
390
- }, {
391
- key: "configureIdGeneratorFromOpenData",
392
- value: function () {
393
- var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
394
- var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
395
- var openDataConfig, idGenerator, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
396
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
397
- while (1) switch (_context5.prev = _context5.next) {
398
- case 0:
399
- openDataConfig = null;
400
- _context5.prev = 1;
401
- _context5.next = 4;
402
- return this.loadOpenDataConfig();
403
- case 4:
404
- openDataConfig = _context5.sent;
405
- _context5.next = 11;
406
- break;
407
- case 7:
408
- _context5.prev = 7;
409
- _context5.t0 = _context5["catch"](1);
410
- console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
411
- return _context5.abrupt("return");
412
- case 11:
413
- // if (!openDataConfig) return;
414
- idGenerator = this.getIdGeneratorPlugin();
415
- if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
416
- _context5.next = 15;
417
- break;
418
- }
419
- console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
420
- return _context5.abrupt("return");
421
- case 15:
422
- receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
423
- receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
424
- prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], '');
425
- shopOrderPrefix = this.normalizeIdPrefix((_openDataConfig4 = openDataConfig) === null || _openDataConfig4 === void 0 ? void 0 : _openDataConfig4['sale.sale_number_prefix'], '');
426
- resetReceiptSequenceDaily = typeof ((_openDataConfig5 = openDataConfig) === null || _openDataConfig5 === void 0 ? void 0 : _openDataConfig5['sale.short_number_daily_reset']) === 'boolean' ? (_openDataConfig6 = openDataConfig) === null || _openDataConfig6 === void 0 ? void 0 : _openDataConfig6['sale.short_number_daily_reset'] : false;
427
- operatingDayBoundary = this.getAppData('operating_day_boundary');
428
- _context5.next = 23;
429
- return this.getShortNumberOrDeviceId();
430
- case 23:
431
- deviceId = _context5.sent;
432
- businessCode = this.getBookingTicketBusinessCode();
433
- if (businessCode) {
434
- _context5.next = 28;
435
- break;
436
- }
437
- console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
438
- return _context5.abrupt("return");
439
- case 28:
440
- _context5.prev = 28;
441
- _context5.next = 31;
442
- return idGenerator.configure({
443
- biz: businessCode,
444
- config: {
445
- prefix: prefix,
446
- deviceCode: deviceId,
447
- // TODO 现在 picoding 没这个配置的 key
448
- padReceiptSequence: false,
449
- receiptSequenceLength: receiptSequenceLength,
450
- resetReceiptSequenceDaily: resetReceiptSequenceDaily,
451
- receiptSequenceResetTime: operatingDayBoundary.time,
452
- receiptSequenceStart: receiptSequenceStart,
453
- shopOrderPrefix: shopOrderPrefix
454
- }
455
- });
456
- case 31:
457
- _context5.next = 36;
458
- break;
459
- case 33:
460
- _context5.prev = 33;
461
- _context5.t1 = _context5["catch"](28);
462
- console.warn('[BookingTicket] idGenerator 配置失败', _context5.t1);
463
- case 36:
464
- case "end":
465
- return _context5.stop();
466
- }
467
- }, _callee5, this, [[1, 7], [28, 33]]);
468
- }));
469
- function configureIdGeneratorFromOpenData() {
470
- return _configureIdGeneratorFromOpenData.apply(this, arguments);
471
- }
472
- return configureIdGeneratorFromOpenData;
473
- }()
474
- }, {
475
- key: "normalizePositiveInteger",
476
- value: function normalizePositiveInteger(value, fallback) {
477
- var numeric = Number(value);
478
- if (!Number.isInteger(numeric) || numeric <= 0) return fallback;
479
- return numeric;
480
- }
481
- }, {
482
- key: "normalizeIdPrefix",
483
- value: function normalizeIdPrefix(value, fallback) {
484
- if (value === undefined || value === null) return fallback;
485
- var normalized = String(value).trim().toUpperCase();
486
- return normalized || fallback;
487
- }
488
-
489
117
  /**
490
118
  * 加载销售详情,并在父类基础上把 customer 信息装配到 CustomerModule。
491
119
  *
@@ -496,236 +124,43 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
496
124
  }, {
497
125
  key: "loadSalesDetail",
498
126
  value: (function () {
499
- var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(orderIdOrParams) {
500
- var _ref3;
501
- var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref4, detailCustomerId, detailCustomerRest, rawId, customer;
502
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
503
- while (1) switch (_context6.prev = _context6.next) {
127
+ var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(orderIdOrParams) {
128
+ var sales, customerModule, detailCustomer, _detailCustomer$name, _ref, detailCustomerId, detailCustomerRest, rawId, customer;
129
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
130
+ while (1) switch (_context2.prev = _context2.next) {
504
131
  case 0:
505
- debugger;
506
- _context6.next = 3;
132
+ _context2.next = 2;
507
133
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
508
- case 3:
509
- sales = _context6.sent;
134
+ case 2:
135
+ sales = _context2.sent;
136
+ console.log(sales, '1234sales');
510
137
  customerModule = this.store.customer;
511
138
  detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
512
- orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
513
- protocolCustomerId = sales === null || sales === void 0 ? void 0 : sales.customer_id;
514
- protocolCustomer = protocolCustomerId !== undefined && protocolCustomerId !== null ? {
515
- id: protocolCustomerId,
516
- name: String((sales === null || sales === void 0 ? void 0 : sales.customer_name) || ''),
517
- phone: sales === null || sales === void 0 ? void 0 : sales.phone,
518
- email: sales === null || sales === void 0 ? void 0 : sales.email,
519
- country_calling_code: sales === null || sales === void 0 ? void 0 : sales.country_calling_code
520
- } : null;
521
- selectedCustomer = (_ref3 = detailCustomer !== null && detailCustomer !== void 0 ? detailCustomer : orderCustomerSnapshot) !== null && _ref3 !== void 0 ? _ref3 : protocolCustomer;
522
- if (customerModule && selectedCustomer) {
523
- _ref4 = selectedCustomer !== null && selectedCustomer !== void 0 ? selectedCustomer : {}, detailCustomerId = _ref4.id, detailCustomerRest = _objectWithoutProperties(_ref4, _excluded);
139
+ if (customerModule && detailCustomer) {
140
+ _ref = detailCustomer !== null && detailCustomer !== void 0 ? detailCustomer : {}, detailCustomerId = _ref.id, detailCustomerRest = _objectWithoutProperties(_ref, _excluded);
524
141
  rawId = detailCustomerId !== null && detailCustomerId !== void 0 ? detailCustomerId : '';
525
142
  customer = _objectSpread(_objectSpread({}, detailCustomerRest), {}, {
526
143
  id: rawId == null ? '' : rawId,
527
- name: (_selectedCustomer$nam = selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.name) !== null && _selectedCustomer$nam !== void 0 ? _selectedCustomer$nam : '',
528
- phone: selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.phone,
529
- email: selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.email,
530
- country_calling_code: selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.country_calling_code
144
+ name: (_detailCustomer$name = detailCustomer === null || detailCustomer === void 0 ? void 0 : detailCustomer.name) !== null && _detailCustomer$name !== void 0 ? _detailCustomer$name : '',
145
+ phone: detailCustomer === null || detailCustomer === void 0 ? void 0 : detailCustomer.phone,
146
+ email: detailCustomer === null || detailCustomer === void 0 ? void 0 : detailCustomer.email,
147
+ country_calling_code: detailCustomer === null || detailCustomer === void 0 ? void 0 : detailCustomer.country_calling_code
531
148
  });
532
149
  customerModule.setSelectedCustomer(customer);
533
150
  this.setOrderCustomer(customer);
534
- // await this.store.order.saveDraft();
535
151
  }
536
- return _context6.abrupt("return", sales);
537
- case 12:
152
+ return _context2.abrupt("return", sales);
153
+ case 8:
538
154
  case "end":
539
- return _context6.stop();
155
+ return _context2.stop();
540
156
  }
541
- }, _callee6, this);
157
+ }, _callee2, this);
542
158
  }));
543
159
  function loadSalesDetail(_x2) {
544
160
  return _loadSalesDetail.apply(this, arguments);
545
161
  }
546
162
  return loadSalesDetail;
547
- }())
548
- }, {
549
- key: "scanPromotionCode",
550
- value: function () {
551
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(code, customerId) {
552
- var raw;
553
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
554
- while (1) switch (_context7.prev = _context7.next) {
555
- case 0:
556
- if (this.store.order) {
557
- _context7.next = 2;
558
- break;
559
- }
560
- throw new Error('order 模块未初始化');
561
- case 2:
562
- _context7.next = 4;
563
- return this.store.order.scanCode(code, customerId);
564
- case 4:
565
- raw = _context7.sent;
566
- if (!raw.isAvailable) {
567
- _context7.next = 11;
568
- break;
569
- }
570
- _context7.next = 8;
571
- return this.hydrateOrderCustomerFromScanDiscounts(raw.scannedDiscountList || []);
572
- case 8:
573
- _context7.next = 10;
574
- return this.store.order.recalculateSummary({
575
- createIfMissing: true
576
- });
577
- case 10:
578
- this.store.order.persistTempOrder();
579
- case 11:
580
- return _context7.abrupt("return", {
581
- isAvailable: raw.isAvailable,
582
- type: raw.type,
583
- unavailableReason: raw.unavailableReason
584
- });
585
- case 12:
586
- case "end":
587
- return _context7.stop();
588
- }
589
- }, _callee7, this);
590
- }));
591
- function scanPromotionCode(_x3, _x4) {
592
- return _scanPromotionCode.apply(this, arguments);
593
- }
594
- return scanPromotionCode;
595
- }()
596
- }, {
597
- key: "hydrateOrderCustomerFromScanDiscounts",
598
- value: function () {
599
- var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(discounts) {
600
- var currentOrderCustomer, customerId, customer;
601
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
602
- while (1) switch (_context8.prev = _context8.next) {
603
- case 0:
604
- currentOrderCustomer = this.store.order.getOrderCustomer();
605
- if (!currentOrderCustomer) {
606
- _context8.next = 3;
607
- break;
608
- }
609
- return _context8.abrupt("return");
610
- case 3:
611
- customerId = this.getDiscountCustomerId(discounts);
612
- if (customerId) {
613
- _context8.next = 6;
614
- break;
615
- }
616
- return _context8.abrupt("return");
617
- case 6:
618
- _context8.next = 8;
619
- return this.resolveCustomerByDiscountCustomerId(customerId);
620
- case 8:
621
- customer = _context8.sent;
622
- if (customer) {
623
- _context8.next = 11;
624
- break;
625
- }
626
- return _context8.abrupt("return");
627
- case 11:
628
- this.store.customer.setSelectedCustomer(customer);
629
- this.setOrderCustomer(customer);
630
- case 13:
631
- case "end":
632
- return _context8.stop();
633
- }
634
- }, _callee8, this);
635
- }));
636
- function hydrateOrderCustomerFromScanDiscounts(_x5) {
637
- return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
638
- }
639
- return hydrateOrderCustomerFromScanDiscounts;
640
- }()
641
- }, {
642
- key: "getDiscountCustomerId",
643
- value: function getDiscountCustomerId(discounts) {
644
- var discount = discounts.find(function (item) {
645
- return item.customer_id != null;
646
- });
647
- var customerId = Number(discount === null || discount === void 0 ? void 0 : discount.customer_id);
648
- if (!Number.isFinite(customerId) || customerId <= 0) return null;
649
- return customerId;
650
- }
651
- }, {
652
- key: "resolveCustomerByDiscountCustomerId",
653
- value: function () {
654
- var _resolveCustomerByDiscountCustomerId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(customerId) {
655
- var _result$list;
656
- var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer;
657
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
658
- while (1) switch (_context9.prev = _context9.next) {
659
- case 0:
660
- localCustomers = this.store.customer.getCustomers();
661
- localCustomer = this.findCustomerById(localCustomers, customerId);
662
- normalizedLocalCustomer = localCustomer ? this.normalizeCustomer(localCustomer) : null;
663
- if (!(normalizedLocalCustomer && this.hasUsableCustomerDetails(normalizedLocalCustomer))) {
664
- _context9.next = 5;
665
- break;
666
- }
667
- return _context9.abrupt("return", normalizedLocalCustomer);
668
- case 5:
669
- _context9.next = 7;
670
- return this.store.customer.queryCustomerList({
671
- ids: [customerId],
672
- skip: 1,
673
- num: 1
674
- });
675
- case 7:
676
- result = _context9.sent;
677
- remoteCustomer = this.findCustomerById((result === null || result === void 0 ? void 0 : result.list) || [], customerId) || (result === null || result === void 0 || (_result$list = result.list) === null || _result$list === void 0 ? void 0 : _result$list[0]) || null;
678
- return _context9.abrupt("return", remoteCustomer ? this.normalizeCustomer(remoteCustomer) : null);
679
- case 10:
680
- case "end":
681
- return _context9.stop();
682
- }
683
- }, _callee9, this);
684
- }));
685
- function resolveCustomerByDiscountCustomerId(_x6) {
686
- return _resolveCustomerByDiscountCustomerId.apply(this, arguments);
687
- }
688
- return resolveCustomerByDiscountCustomerId;
689
163
  }()
690
- }, {
691
- key: "findCustomerById",
692
- value: function findCustomerById() {
693
- var _this2 = this;
694
- var customers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
695
- var customerId = arguments.length > 1 ? arguments[1] : undefined;
696
- return customers.find(function (customer) {
697
- var rawId = _this2.getRawCustomerId(customer);
698
- return rawId !== null && String(rawId) === String(customerId);
699
- }) || null;
700
- }
701
- }, {
702
- key: "normalizeCustomer",
703
- value: function normalizeCustomer(customer) {
704
- var _ref5, _ref6, _customer$phone, _ref7, _customer$email, _ref8, _customer$country_cal;
705
- var raw = customer;
706
- var rawId = this.getRawCustomerId(customer);
707
- var name = customer.name || raw.display_name || raw.nickname || raw.customer_name || [raw.first_name, raw.last_name].filter(Boolean).join(' ') || '';
708
- return _objectSpread(_objectSpread({}, customer), {}, {
709
- id: rawId !== null && rawId !== void 0 ? rawId : customer.id,
710
- name: name,
711
- phone: (_ref5 = (_ref6 = (_customer$phone = customer.phone) !== null && _customer$phone !== void 0 ? _customer$phone : raw.phone) !== null && _ref6 !== void 0 ? _ref6 : raw.mobile) !== null && _ref5 !== void 0 ? _ref5 : '',
712
- email: (_ref7 = (_customer$email = customer.email) !== null && _customer$email !== void 0 ? _customer$email : raw.email) !== null && _ref7 !== void 0 ? _ref7 : '',
713
- country_calling_code: (_ref8 = (_customer$country_cal = customer.country_calling_code) !== null && _customer$country_cal !== void 0 ? _customer$country_cal : raw.country_calling_code) !== null && _ref8 !== void 0 ? _ref8 : ''
714
- });
715
- }
716
- }, {
717
- key: "getRawCustomerId",
718
- value: function getRawCustomerId(customer) {
719
- var _ref9, _ref10, _customer$id;
720
- var raw = customer;
721
- return (_ref9 = (_ref10 = (_customer$id = customer.id) !== null && _customer$id !== void 0 ? _customer$id : raw.customer_id) !== null && _ref10 !== void 0 ? _ref10 : raw.customerId) !== null && _ref9 !== void 0 ? _ref9 : null;
722
- }
723
- }, {
724
- key: "hasUsableCustomerDetails",
725
- value: function hasUsableCustomerDetails(customer) {
726
- return !!(customer.name || customer.phone || customer.email || customer.display_name || customer.customer_name);
727
- }
728
-
729
164
  /**
730
165
  * 更新当前预约的 appointment_status。
731
166
  *
@@ -740,370 +175,172 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
740
175
  * @param status 目标状态(如 'confirmed')
741
176
  * @returns 接口返回的 data
742
177
  */
178
+ )
743
179
  }, {
744
180
  key: "setBookingStatus",
745
181
  value: (function () {
746
- var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(status) {
182
+ var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(status) {
747
183
  var _this$store$order, _this$store$order$get;
748
184
  var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
749
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
750
- while (1) switch (_context10.prev = _context10.next) {
185
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
186
+ while (1) switch (_context3.prev = _context3.next) {
751
187
  case 0:
752
188
  tempOrder = (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$get = _this$store$order.getTempOrder) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.call(_this$store$order);
753
189
  if (tempOrder) {
754
- _context10.next = 3;
190
+ _context3.next = 3;
755
191
  break;
756
192
  }
757
193
  throw new Error('setBookingStatus: tempOrder 未加载');
758
194
  case 3:
759
195
  orderId = tempOrder.order_id;
760
196
  if (!(orderId === undefined || orderId === null)) {
761
- _context10.next = 6;
197
+ _context3.next = 6;
762
198
  break;
763
199
  }
764
200
  throw new Error('setBookingStatus: tempOrder.order_id 缺失');
765
201
  case 6:
766
202
  scheduleId = resolveScheduleId(tempOrder);
767
203
  if (!(scheduleId === null)) {
768
- _context10.next = 9;
204
+ _context3.next = 9;
769
205
  break;
770
206
  }
771
207
  throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
772
208
  case 9:
773
209
  bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
774
210
  previous = applyBookingsStatus(bookings, status);
775
- _context10.prev = 11;
776
- _context10.next = 14;
211
+ _context3.prev = 11;
212
+ _context3.next = 14;
777
213
  return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
778
214
  appointment_status: status
779
215
  });
780
216
  case 14:
781
- res = _context10.sent;
782
- _context10.next = 17;
217
+ res = _context3.sent;
218
+ _context3.next = 17;
783
219
  return this.refreshSalesDetail();
784
220
  case 17:
785
221
  this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
786
222
  orderId: orderId,
787
223
  status: status
788
224
  });
789
- return _context10.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
225
+ return _context3.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
790
226
  case 21:
791
- _context10.prev = 21;
792
- _context10.t0 = _context10["catch"](11);
227
+ _context3.prev = 21;
228
+ _context3.t0 = _context3["catch"](11);
793
229
  restoreBookingsStatus(bookings, previous);
794
- throw _context10.t0;
230
+ throw _context3.t0;
795
231
  case 25:
796
232
  case "end":
797
- return _context10.stop();
233
+ return _context3.stop();
798
234
  }
799
- }, _callee10, this, [[11, 21]]);
235
+ }, _callee3, this, [[11, 21]]);
800
236
  }));
801
- function setBookingStatus(_x7) {
237
+ function setBookingStatus(_x3) {
802
238
  return _setBookingStatus.apply(this, arguments);
803
239
  }
804
240
  return setBookingStatus;
805
241
  }()
806
242
  /**
807
- * 子预约状态机转移(POST /schedule/booking-transition/{schedule_event_id})。
808
- *
809
- * 与 `setBookingStatus`(父预约 PUT appointment-status)不同,本方法按子预约
810
- * `schedule_event_id` 调用状态转移接口,body 为 `{ action }`。
243
+ * 基于当前 tempOrder.order_id 强制从远端重新拉取销售详情。
811
244
  *
812
- * 流程:能解析出目标状态时先乐观更新对应子预约的 `appointment_status`,
813
- * 再调 POST;成功后强制刷新销售详情;失败则回滚该子预约本地状态并抛错。
814
- * `reschedule` 暂未启用状态矩阵,跳过乐观更新仅调接口。
245
+ * 适用场景:在 BookingTicket 内执行了「修改服务端订单状态」的动作(如改预约状态、
246
+ * 改下单客户、改商品行等)后,统一刷新本地销售详情,保证 UI 与服务端一致。
815
247
  *
816
- * @param params.schedule_event_id 子预约 schedule_event_id
817
- * @param params.action 转移动作:confirm | reject | arrive | start | complete | cancel | no_show | reschedule
818
- * @returns 接口返回的 data
248
+ * 约束:调用前必须已有 tempOrder order_id 存在,否则视为非法调用并抛错。
819
249
  *
820
- * @example
821
- * await bookingTicket.transitionChildBooking({
822
- * schedule_event_id: 301,
823
- * action: 'confirm',
824
- * });
250
+ * @returns loadSalesDetail 的返回值
825
251
  */
826
252
  )
827
253
  }, {
828
- key: "transitionChildBooking",
254
+ key: "refreshSalesDetail",
829
255
  value: (function () {
830
- var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
256
+ var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
831
257
  var _this$store$order2, _this$store$order2$ge;
832
- var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
833
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
834
- while (1) switch (_context11.prev = _context11.next) {
258
+ var tempOrder, orderId;
259
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
260
+ while (1) switch (_context4.prev = _context4.next) {
835
261
  case 0:
836
- schedule_event_id = params.schedule_event_id, action = params.action;
837
- if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
838
- _context11.next = 3;
839
- break;
840
- }
841
- throw new Error('transitionChildBooking: schedule_event_id 不能为空');
842
- case 3:
843
- if (action) {
844
- _context11.next = 5;
845
- break;
846
- }
847
- throw new Error('transitionChildBooking: action 不能为空');
848
- case 5:
849
262
  tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$ge = _this$store$order2.getTempOrder) === null || _this$store$order2$ge === void 0 ? void 0 : _this$store$order2$ge.call(_this$store$order2);
850
263
  if (tempOrder) {
851
- _context11.next = 8;
264
+ _context4.next = 3;
852
265
  break;
853
266
  }
854
- throw new Error('transitionChildBooking: tempOrder 未加载');
855
- case 8:
267
+ throw new Error('refreshSalesDetail: tempOrder 未加载');
268
+ case 3:
856
269
  orderId = tempOrder.order_id;
857
270
  if (!(orderId === undefined || orderId === null)) {
858
- _context11.next = 11;
271
+ _context4.next = 6;
859
272
  break;
860
273
  }
861
- throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
862
- case 11:
863
- bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
864
- targetStatus = resolveStatusAfterTransition(action);
865
- previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
866
- _context11.prev = 14;
867
- _context11.next = 17;
868
- return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
869
- action: action
870
- });
871
- case 17:
872
- res = _context11.sent;
873
- _context11.next = 20;
874
- return this.refreshSalesDetail();
875
- case 20:
876
- this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
877
- orderId: orderId,
878
- schedule_event_id: schedule_event_id,
879
- action: action,
880
- status: targetStatus
881
- });
882
- return _context11.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
883
- case 24:
884
- _context11.prev = 24;
885
- _context11.t0 = _context11["catch"](14);
886
- if (previous !== undefined) {
887
- restoreChildBookingStatus(bookings, schedule_event_id, previous);
888
- }
889
- throw _context11.t0;
890
- case 28:
274
+ throw new Error('refreshSalesDetail: tempOrder.order_id 缺失');
275
+ case 6:
276
+ return _context4.abrupt("return", this.loadSalesDetail({
277
+ orderId: Number(orderId),
278
+ forceRemote: true
279
+ }));
280
+ case 7:
891
281
  case "end":
892
- return _context11.stop();
282
+ return _context4.stop();
893
283
  }
894
- }, _callee11, this, [[14, 24]]);
284
+ }, _callee4, this);
895
285
  }));
896
- function transitionChildBooking(_x8) {
897
- return _transitionChildBooking.apply(this, arguments);
286
+ function refreshSalesDetail() {
287
+ return _refreshSalesDetail.apply(this, arguments);
898
288
  }
899
- return transitionChildBooking;
289
+ return refreshSalesDetail;
900
290
  }()
901
291
  /**
902
- * 基于当前 tempOrder.order_id 强制从远端重新拉取销售详情。
903
- *
904
- * 适用场景:在 BookingTicket 内执行了「修改服务端订单状态」的动作(如改预约状态、
905
- * 改下单客户、改商品行等)后,统一刷新本地销售详情,保证 UI 与服务端一致。
906
- *
907
- * 约束:调用前必须已有 tempOrder 且 order_id 存在,否则视为非法调用并抛错。
908
- *
909
- * @returns loadSalesDetail 的返回值
292
+ * 获取商品列表
293
+ * @param params 包含 schedule_date 的参数
294
+ * @returns 商品列表
910
295
  */
911
296
  )
912
297
  }, {
913
- key: "refreshSalesDetail",
298
+ key: "loadProducts",
914
299
  value: (function () {
915
- var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
916
- var _this$store$order3, _this$store$order3$ge;
917
- var params,
918
- tempOrder,
919
- orderId,
920
- _args12 = arguments;
921
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
922
- while (1) switch (_context12.prev = _context12.next) {
923
- case 0:
924
- params = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
925
- tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getTempOrder) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
926
- if (tempOrder) {
927
- _context12.next = 4;
928
- break;
929
- }
930
- throw new Error('refreshSalesDetail: tempOrder 未加载');
931
- case 4:
932
- debugger;
933
- orderId = tempOrder.order_id || tempOrder.external_sale_number;
934
- if (!(orderId === undefined || orderId === null)) {
935
- _context12.next = 8;
936
- break;
937
- }
938
- return _context12.abrupt("return", {});
939
- case 8:
940
- return _context12.abrupt("return", this.loadSalesDetail({
941
- orderId: orderId,
942
- // merge: true
943
- forceRemote: params.forceRemote
944
- }));
945
- case 9:
946
- case "end":
947
- return _context12.stop();
948
- }
949
- }, _callee12, this);
950
- }));
951
- function refreshSalesDetail() {
952
- return _refreshSalesDetail.apply(this, arguments);
953
- }
954
- return refreshSalesDetail;
955
- }()
956
- /**
957
- * 获取商品列表
958
- * @param params 包含 schedule_date 的参数
959
- * @returns 商品列表
960
- */
961
- )
962
- }, {
963
- key: "loadProducts",
964
- value: (function () {
965
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
300
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
966
301
  var params,
967
302
  options,
968
303
  schedule_date,
969
304
  customer_id,
970
305
  menu_list_ids,
971
306
  schedule_datetime,
972
- bookingDate,
973
307
  _result,
974
- _args13 = arguments;
975
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
976
- while (1) switch (_context13.prev = _context13.next) {
308
+ _args5 = arguments;
309
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
310
+ while (1) switch (_context5.prev = _context5.next) {
977
311
  case 0:
978
- params = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
979
- options = _args13.length > 1 ? _args13[1] : undefined;
980
- schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime; // 优先写入 schedule_datetime(含时分),供加购 presetStartTime 与 TimeBar 对齐;
981
- // requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
982
- bookingDate = schedule_datetime || schedule_date || '';
983
- if (bookingDate) {
984
- this.setBookingDate(bookingDate);
985
- }
986
- _context13.prev = 5;
987
- _context13.next = 8;
312
+ params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
313
+ options = _args5.length > 1 ? _args5[1] : undefined;
314
+ schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime;
315
+ _context5.prev = 3;
316
+ _context5.next = 6;
988
317
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
989
318
  with_count: ['bundleGroup', 'optionGroup'],
990
319
  with_schedule: 1
991
320
  }, params), {}, {
992
321
  cacheId: this.cacheId
993
322
  }), options);
994
- case 8:
995
- _result = _context13.sent;
323
+ case 6:
324
+ _result = _context5.sent;
996
325
  this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
997
326
  this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
998
- return _context13.abrupt("return", _result);
999
- case 14:
1000
- _context13.prev = 14;
1001
- _context13.t0 = _context13["catch"](5);
1002
- console.error('Failed to load products:', _context13.t0);
1003
- throw _context13.t0;
1004
- case 18:
327
+ return _context5.abrupt("return", _result);
328
+ case 12:
329
+ _context5.prev = 12;
330
+ _context5.t0 = _context5["catch"](3);
331
+ console.error('Failed to load products:', _context5.t0);
332
+ throw _context5.t0;
333
+ case 16:
1005
334
  case "end":
1006
- return _context13.stop();
335
+ return _context5.stop();
1007
336
  }
1008
- }, _callee13, this, [[5, 14]]);
337
+ }, _callee5, this, [[3, 12]]);
1009
338
  }));
1010
339
  function loadProducts() {
1011
340
  return _loadProducts.apply(this, arguments);
1012
341
  }
1013
342
  return loadProducts;
1014
343
  }()
1015
- /**
1016
- * 获取加时商品列表。
1017
- *
1018
- * @example
1019
- * const products = await bookingTicket.getAddTimeProducts({ schedule_date: '2026-06-16' });
1020
- */
1021
- )
1022
- }, {
1023
- key: "getAddTimeProducts",
1024
- value: (function () {
1025
- var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1026
- var params,
1027
- result,
1028
- _args14 = arguments;
1029
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1030
- while (1) switch (_context14.prev = _context14.next) {
1031
- case 0:
1032
- params = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
1033
- _context14.next = 3;
1034
- return this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
1035
- cacheId: this.cacheId
1036
- }));
1037
- case 3:
1038
- result = _context14.sent;
1039
- this.addTimeProductsCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
1040
- return _context14.abrupt("return", result);
1041
- case 6:
1042
- case "end":
1043
- return _context14.stop();
1044
- }
1045
- }, _callee14, this);
1046
- }));
1047
- function getAddTimeProducts() {
1048
- return _getAddTimeProducts.apply(this, arguments);
1049
- }
1050
- return getAddTimeProducts;
1051
- }()
1052
- /**
1053
- * 只读查询单商品详情:走 ProductList 报价查询,但不写 productCatalog、
1054
- * 不 emit onProductsLoaded、不修改 BookingDate。
1055
- *
1056
- * 供「列表已 loadProducts、仅需补 product_resource / capacity」等场景使用,
1057
- * 避免 loadProductDetail 覆盖左侧商品列表。
1058
- *
1059
- * @example
1060
- * const detail = await bookingTicket.queryProductDetail({
1061
- * product_id: 2,
1062
- * schedule_date: '2030-01-15',
1063
- * schedule_datetime: '2030-01-15 10:00:00',
1064
- * });
1065
- */
1066
- )
1067
- }, {
1068
- key: "queryProductDetail",
1069
- value: (function () {
1070
- var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params, options) {
1071
- var product_id, queryParams, _result2, list;
1072
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1073
- while (1) switch (_context15.prev = _context15.next) {
1074
- case 0:
1075
- product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
1076
- _context15.prev = 1;
1077
- _context15.next = 4;
1078
- return this.store.products.loadProducts(_objectSpread(_objectSpread({
1079
- with_count: ['bundleGroup', 'optionGroup'],
1080
- with_schedule: 1
1081
- }, queryParams), {}, {
1082
- product_ids: [product_id],
1083
- cacheId: this.cacheId
1084
- }), options);
1085
- case 4:
1086
- _result2 = _context15.sent;
1087
- list = Array.isArray(_result2) ? _result2 : [];
1088
- return _context15.abrupt("return", list.find(function (product) {
1089
- return Number(product.id) === Number(product_id);
1090
- }));
1091
- case 9:
1092
- _context15.prev = 9;
1093
- _context15.t0 = _context15["catch"](1);
1094
- console.error('Failed to query product detail:', _context15.t0);
1095
- throw _context15.t0;
1096
- case 13:
1097
- case "end":
1098
- return _context15.stop();
1099
- }
1100
- }, _callee15, this, [[1, 9]]);
1101
- }));
1102
- function queryProductDetail(_x9, _x10) {
1103
- return _queryProductDetail.apply(this, arguments);
1104
- }
1105
- return queryProductDetail;
1106
- }()
1107
344
  /**
1108
345
  * 按预约时间加载单个商品详情。
1109
346
  * 价格仍由 server products 的报价单桥接统一计算,避免 solution 实例重复请求报价单。
@@ -1112,28 +349,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1112
349
  }, {
1113
350
  key: "loadProductDetail",
1114
351
  value: (function () {
1115
- var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params, options) {
352
+ var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params, options) {
1116
353
  var product_id, queryParams, products;
1117
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1118
- while (1) switch (_context16.prev = _context16.next) {
354
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
355
+ while (1) switch (_context6.prev = _context6.next) {
1119
356
  case 0:
1120
- product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
1121
- _context16.next = 3;
357
+ product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
358
+ _context6.next = 3;
1122
359
  return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
1123
360
  product_ids: [product_id]
1124
361
  }), options);
1125
362
  case 3:
1126
- products = _context16.sent;
1127
- return _context16.abrupt("return", products.find(function (product) {
363
+ products = _context6.sent;
364
+ return _context6.abrupt("return", products.find(function (product) {
1128
365
  return Number(product.id) === Number(product_id);
1129
366
  }));
1130
367
  case 5:
1131
368
  case "end":
1132
- return _context16.stop();
369
+ return _context6.stop();
1133
370
  }
1134
- }, _callee16, this);
371
+ }, _callee6, this);
1135
372
  }));
1136
- function loadProductDetail(_x11, _x12) {
373
+ function loadProductDetail(_x4, _x5) {
1137
374
  return _loadProductDetail.apply(this, arguments);
1138
375
  }
1139
376
  return loadProductDetail;
@@ -1166,16 +403,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1166
403
  }, {
1167
404
  key: "getProducts",
1168
405
  value: (function () {
1169
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1170
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1171
- while (1) switch (_context17.prev = _context17.next) {
406
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
407
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
408
+ while (1) switch (_context7.prev = _context7.next) {
1172
409
  case 0:
1173
- return _context17.abrupt("return", this.store.products.getProducts());
410
+ return _context7.abrupt("return", this.store.products.getProducts());
1174
411
  case 1:
1175
412
  case "end":
1176
- return _context17.stop();
413
+ return _context7.stop();
1177
414
  }
1178
- }, _callee17, this);
415
+ }, _callee7, this);
1179
416
  }));
1180
417
  function getProducts() {
1181
418
  return _getProducts.apply(this, arguments);
@@ -1205,23 +442,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1205
442
  }, {
1206
443
  key: "getCart",
1207
444
  value: function getCart() {
1208
- var _this$store$order$get2, _this$store$order4, _salesDetail$bookings, _operatingDayBoundary, _operatingDayBoundary2, _tempOrder$_extend;
1209
- var tempOrder = (_this$store$order$get2 = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder()) !== null && _this$store$order$get2 !== void 0 ? _this$store$order$get2 : null;
445
+ var _this$store$order$get2, _this$store$order3, _salesDetail$bookings;
446
+ var tempOrder = (_this$store$order$get2 = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 ? void 0 : _this$store$order3.getTempOrder()) !== null && _this$store$order$get2 !== void 0 ? _this$store$order$get2 : null;
1210
447
  var salesDetail = this.getSalesOrder();
1211
448
  var bookings = (_salesDetail$bookings = salesDetail === null || salesDetail === void 0 ? void 0 : salesDetail.bookings) !== null && _salesDetail$bookings !== void 0 ? _salesDetail$bookings : (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) || [];
1212
- var operatingDayBoundary;
1213
- try {
1214
- operatingDayBoundary = this.getAppData('operating_day_boundary');
1215
- } catch (_unused) {
1216
- operatingDayBoundary = undefined;
1217
- }
1218
- var shopOpeningHours = ((_operatingDayBoundary = operatingDayBoundary) === null || _operatingDayBoundary === void 0 ? void 0 : _operatingDayBoundary.type) === 'start_time' ? '23:59' : (_operatingDayBoundary2 = operatingDayBoundary) === null || _operatingDayBoundary2 === void 0 ? void 0 : _operatingDayBoundary2.time;
1219
- return buildCartView((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [], bookings, {
1220
- addTimeProducts: this.addTimeProductsCatalog,
1221
- bookingConfig: this.getBookingConfig(),
1222
- productsByUid: tempOrder === null || tempOrder === void 0 || (_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.productsByUid,
1223
- shopOpeningHours: shopOpeningHours
1224
- });
449
+ return buildCartView((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [], bookings);
1225
450
  }
1226
451
 
1227
452
  /**
@@ -1240,18 +465,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1240
465
  }, {
1241
466
  key: "getProductByIds",
1242
467
  value: (function () {
1243
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids) {
1244
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1245
- while (1) switch (_context18.prev = _context18.next) {
468
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(ids) {
469
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
470
+ while (1) switch (_context8.prev = _context8.next) {
1246
471
  case 0:
1247
- return _context18.abrupt("return", this.store.products.getProductByIds(ids));
472
+ return _context8.abrupt("return", this.store.products.getProductByIds(ids));
1248
473
  case 1:
1249
474
  case "end":
1250
- return _context18.stop();
475
+ return _context8.stop();
1251
476
  }
1252
- }, _callee18, this);
477
+ }, _callee8, this);
1253
478
  }));
1254
- function getProductByIds(_x13) {
479
+ function getProductByIds(_x6) {
1255
480
  return _getProductByIds.apply(this, arguments);
1256
481
  }
1257
482
  return getProductByIds;
@@ -1265,27 +490,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1265
490
  }, {
1266
491
  key: "getScheduleTimePoints",
1267
492
  value: (function () {
1268
- var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
493
+ var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
1269
494
  var result;
1270
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1271
- while (1) switch (_context19.prev = _context19.next) {
495
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
496
+ while (1) switch (_context9.prev = _context9.next) {
1272
497
  case 0:
1273
- _context19.next = 2;
498
+ _context9.next = 2;
1274
499
  return this.request.post('/menu/schedule-time-points', {
1275
500
  menu_list_ids: params.menu_list_ids
1276
501
  }, {
1277
502
  osServer: true
1278
503
  });
1279
504
  case 2:
1280
- result = _context19.sent;
1281
- return _context19.abrupt("return", result.data || []);
505
+ result = _context9.sent;
506
+ return _context9.abrupt("return", result.data || []);
1282
507
  case 4:
1283
508
  case "end":
1284
- return _context19.stop();
509
+ return _context9.stop();
1285
510
  }
1286
- }, _callee19, this);
511
+ }, _callee9, this);
1287
512
  }));
1288
- function getScheduleTimePoints(_x14) {
513
+ function getScheduleTimePoints(_x7) {
1289
514
  return _getScheduleTimePoints.apply(this, arguments);
1290
515
  }
1291
516
  return getScheduleTimePoints;
@@ -1299,30 +524,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1299
524
  }, {
1300
525
  key: "getCustomerList",
1301
526
  value: (function () {
1302
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
527
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
1303
528
  var params,
1304
- _result3,
1305
- _args20 = arguments;
1306
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1307
- while (1) switch (_context20.prev = _context20.next) {
529
+ _result2,
530
+ _args10 = arguments;
531
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
532
+ while (1) switch (_context10.prev = _context10.next) {
1308
533
  case 0:
1309
- params = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
1310
- _context20.prev = 1;
1311
- _context20.next = 4;
534
+ params = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
535
+ _context10.prev = 1;
536
+ _context10.next = 4;
1312
537
  return this.store.customer.getCustomerList(params);
1313
538
  case 4:
1314
- _result3 = _context20.sent;
1315
- return _context20.abrupt("return", _result3);
539
+ _result2 = _context10.sent;
540
+ return _context10.abrupt("return", _result2);
1316
541
  case 8:
1317
- _context20.prev = 8;
1318
- _context20.t0 = _context20["catch"](1);
1319
- console.error('Failed to get customer list:', _context20.t0);
1320
- throw _context20.t0;
542
+ _context10.prev = 8;
543
+ _context10.t0 = _context10["catch"](1);
544
+ console.error('Failed to get customer list:', _context10.t0);
545
+ throw _context10.t0;
1321
546
  case 12:
1322
547
  case "end":
1323
- return _context20.stop();
548
+ return _context10.stop();
1324
549
  }
1325
- }, _callee20, this, [[1, 8]]);
550
+ }, _callee10, this, [[1, 8]]);
1326
551
  }));
1327
552
  function getCustomerList() {
1328
553
  return _getCustomerList.apply(this, arguments);
@@ -1429,38 +654,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1429
654
  }, {
1430
655
  key: "setOrderCustomer",
1431
656
  value: function setOrderCustomer(customer) {
1432
- var _this$store$order$get3;
1433
657
  if (!customer) {
1434
658
  this.clearOrderCustomer();
1435
659
  return;
1436
660
  }
1437
- var previousCustomerId = (_this$store$order$get3 = this.store.order.getOrderCustomer()) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.customer_id;
1438
- var snapshotBeforeSet = this.store.order.getOrderCustomerSnapshot();
1439
661
  var patch = formatOrderCustomerPatch(customer);
1440
- var customerUnchanged = Number(previousCustomerId || 0) === Number(patch.customer_id || 0);
1441
- if (!customerUnchanged) {
1442
- this.discountConfigCacheKey = null;
1443
- this.hasManualDiscountSelection = false;
1444
- }
1445
662
  this.store.order.setOrderCustomer(patch, customer);
1446
- var snapshotAfterOrderSet = this.store.order.getOrderCustomerSnapshot();
1447
- if (customerUnchanged) {
1448
- // hydrate 后 customer_id 已存在但 _extend.customerSnapshot 仍为空时,
1449
- // 须通知 SalesSdk 刷新 selected(否则会一直停在 onSalesOrderLoaded 时的 null)。
1450
- var snapshotReplenished = !snapshotBeforeSet && Boolean(snapshotAfterOrderSet);
1451
- if (snapshotReplenished) {
1452
- var _next2 = this.buildOrderCustomerPayload();
1453
- this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), _next2);
1454
- }
1455
- return;
1456
- }
1457
663
  var next = this.buildOrderCustomerPayload();
1458
664
  this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), next);
1459
- this.refreshDiscountConfigAfterOrderCustomerChange(patch.customer_id);
1460
- // 客户切换可能改变可用促销/赠品;触发一次重算(recursion-safe)。
1461
- void this.store.order.applyPromotion().catch(function (error) {
1462
- console.error('[BookingTicket] applyPromotion after customer change failed', error);
1463
- });
1464
665
  }
1465
666
 
1466
667
  /**
@@ -1487,63 +688,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1487
688
  }, {
1488
689
  key: "clearOrderCustomer",
1489
690
  value: function clearOrderCustomer() {
1490
- var _discountModule$setOr,
1491
- _discountModule$setDi,
1492
- _this3 = this;
1493
691
  this.store.order.clearOrderCustomer();
1494
- this.discountConfigCacheKey = null;
1495
- this.hasManualDiscountSelection = false;
1496
- var orderStore = this.store.order.store || {};
1497
- var discountModule = orderStore.discount;
1498
- void (discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, []));
1499
- void (discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []));
1500
- this.store.order.applyDiscount();
1501
- void this.store.order.recalculateSummary({
1502
- createIfMissing: true
1503
- }).then(function () {
1504
- return _this3.store.order.persistTempOrder();
1505
- }).catch(function (error) {
1506
- console.error('Failed to recalculate summary after clearing customer:', error);
1507
- });
1508
692
  this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), null);
1509
693
  }
1510
694
 
1511
- /**
1512
- * 重置 tempOrder,并同步清空下单客户运行态。
1513
- *
1514
- * OrderModule.restoreOrder 会重建空单(customer_id 已为 null),但不会:
1515
- * - emit BookingTicket `onOrderCustomerChange`
1516
- * - 重置 CustomerModule.selectedCustomer(老路 getActiveCustomer)
1517
- *
1518
- * 因此在 super.restoreOrder 之后显式清客户,保证 SalesSdk / ticketBooking 订阅方与 tempOrder 一致。
1519
- */
1520
- }, {
1521
- key: "restoreOrder",
1522
- value: (function () {
1523
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1524
- var _this$store$customer;
1525
- var tempOrder;
1526
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1527
- while (1) switch (_context21.prev = _context21.next) {
1528
- case 0:
1529
- _context21.next = 2;
1530
- return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
1531
- case 2:
1532
- tempOrder = _context21.sent;
1533
- this.clearOrderCustomer();
1534
- (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
1535
- return _context21.abrupt("return", tempOrder);
1536
- case 6:
1537
- case "end":
1538
- return _context21.stop();
1539
- }
1540
- }, _callee21, this);
1541
- }));
1542
- function restoreOrder() {
1543
- return _restoreOrder.apply(this, arguments);
1544
- }
1545
- return restoreOrder;
1546
- }() /** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */)
695
+ /** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */
1547
696
  }, {
1548
697
  key: "buildOrderCustomerPayload",
1549
698
  value: function buildOrderCustomerPayload() {
@@ -1554,56 +703,6 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1554
703
  snapshot: this.store.order.getOrderCustomerSnapshot()
1555
704
  };
1556
705
  }
1557
- }, {
1558
- key: "refreshDiscountConfigAfterOrderCustomerChange",
1559
- value: function refreshDiscountConfigAfterOrderCustomerChange(customerId) {
1560
- var _this4 = this;
1561
- if (!customerId || customerId === 1) return;
1562
- if (this.orderCustomerDiscountRefreshInFlight && this.orderCustomerDiscountRefreshCustomerId === customerId) {
1563
- return;
1564
- }
1565
- var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
1566
- var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1567
- var currentCustomer;
1568
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1569
- while (1) switch (_context22.prev = _context22.next) {
1570
- case 0:
1571
- if (!previousRefresh) {
1572
- _context22.next = 3;
1573
- break;
1574
- }
1575
- _context22.next = 3;
1576
- return previousRefresh.catch(function () {
1577
- return undefined;
1578
- });
1579
- case 3:
1580
- currentCustomer = _this4.store.order.getOrderCustomer();
1581
- if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
1582
- _context22.next = 6;
1583
- break;
1584
- }
1585
- return _context22.abrupt("return");
1586
- case 6:
1587
- _context22.next = 8;
1588
- return _this4.loadDiscountConfig({
1589
- customerId: customerId
1590
- });
1591
- case 8:
1592
- case "end":
1593
- return _context22.stop();
1594
- }
1595
- }, _callee22);
1596
- }))();
1597
- this.orderCustomerDiscountRefreshInFlight = refreshTask;
1598
- this.orderCustomerDiscountRefreshCustomerId = customerId;
1599
- refreshTask.catch(function (error) {
1600
- console.error('Failed to load discount config after customer change:', error);
1601
- }).finally(function () {
1602
- if (_this4.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
1603
- _this4.orderCustomerDiscountRefreshInFlight = null;
1604
- _this4.orderCustomerDiscountRefreshCustomerId = null;
1605
- });
1606
- }
1607
706
 
1608
707
  /**
1609
708
  * 获取客户分页信息
@@ -1645,29 +744,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1645
744
  }, {
1646
745
  key: "changeCustomerPage",
1647
746
  value: (function () {
1648
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(page, pageSize) {
1649
- var _result4;
1650
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1651
- while (1) switch (_context23.prev = _context23.next) {
747
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(page, pageSize) {
748
+ var _result3;
749
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
750
+ while (1) switch (_context11.prev = _context11.next) {
1652
751
  case 0:
1653
- _context23.prev = 0;
1654
- _context23.next = 3;
752
+ _context11.prev = 0;
753
+ _context11.next = 3;
1655
754
  return this.store.customer.changeCustomerPage(page, pageSize);
1656
755
  case 3:
1657
- _result4 = _context23.sent;
1658
- return _context23.abrupt("return", _result4);
756
+ _result3 = _context11.sent;
757
+ return _context11.abrupt("return", _result3);
1659
758
  case 7:
1660
- _context23.prev = 7;
1661
- _context23.t0 = _context23["catch"](0);
1662
- console.error('Failed to change customer page:', _context23.t0);
1663
- throw _context23.t0;
759
+ _context11.prev = 7;
760
+ _context11.t0 = _context11["catch"](0);
761
+ console.error('Failed to change customer page:', _context11.t0);
762
+ throw _context11.t0;
1664
763
  case 11:
1665
764
  case "end":
1666
- return _context23.stop();
765
+ return _context11.stop();
1667
766
  }
1668
- }, _callee23, this, [[0, 7]]);
767
+ }, _callee11, this, [[0, 7]]);
1669
768
  }));
1670
- function changeCustomerPage(_x15, _x16) {
769
+ function changeCustomerPage(_x8, _x9) {
1671
770
  return _changeCustomerPage.apply(this, arguments);
1672
771
  }
1673
772
  return changeCustomerPage;
@@ -1680,28 +779,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1680
779
  }, {
1681
780
  key: "loadMoreCustomers",
1682
781
  value: (function () {
1683
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1684
- var _result5;
1685
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1686
- while (1) switch (_context24.prev = _context24.next) {
782
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
783
+ var _result4;
784
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
785
+ while (1) switch (_context12.prev = _context12.next) {
1687
786
  case 0:
1688
- _context24.prev = 0;
1689
- _context24.next = 3;
787
+ _context12.prev = 0;
788
+ _context12.next = 3;
1690
789
  return this.store.customer.loadMoreCustomers();
1691
790
  case 3:
1692
- _result5 = _context24.sent;
1693
- this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
1694
- return _context24.abrupt("return", _result5);
791
+ _result4 = _context12.sent;
792
+ this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result4);
793
+ return _context12.abrupt("return", _result4);
1695
794
  case 8:
1696
- _context24.prev = 8;
1697
- _context24.t0 = _context24["catch"](0);
1698
- console.error('Failed to load more customers:', _context24.t0);
1699
- throw _context24.t0;
795
+ _context12.prev = 8;
796
+ _context12.t0 = _context12["catch"](0);
797
+ console.error('Failed to load more customers:', _context12.t0);
798
+ throw _context12.t0;
1700
799
  case 12:
1701
800
  case "end":
1702
- return _context24.stop();
801
+ return _context12.stop();
1703
802
  }
1704
- }, _callee24, this, [[0, 8]]);
803
+ }, _callee12, this, [[0, 8]]);
1705
804
  }));
1706
805
  function loadMoreCustomers() {
1707
806
  return _loadMoreCustomers.apply(this, arguments);
@@ -1717,31 +816,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1717
816
  }, {
1718
817
  key: "resetAndLoadCustomers",
1719
818
  value: (function () {
1720
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
819
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
1721
820
  var params,
1722
- _result6,
1723
- _args25 = arguments;
1724
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1725
- while (1) switch (_context25.prev = _context25.next) {
821
+ _result5,
822
+ _args13 = arguments;
823
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
824
+ while (1) switch (_context13.prev = _context13.next) {
1726
825
  case 0:
1727
- params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
1728
- _context25.prev = 1;
1729
- _context25.next = 4;
826
+ params = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
827
+ _context13.prev = 1;
828
+ _context13.next = 4;
1730
829
  return this.store.customer.resetAndLoadCustomers(params);
1731
830
  case 4:
1732
- _result6 = _context25.sent;
1733
- this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
1734
- return _context25.abrupt("return", _result6);
831
+ _result5 = _context13.sent;
832
+ this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result5);
833
+ return _context13.abrupt("return", _result5);
1735
834
  case 9:
1736
- _context25.prev = 9;
1737
- _context25.t0 = _context25["catch"](1);
1738
- console.error('Failed to reset and load customers:', _context25.t0);
1739
- throw _context25.t0;
835
+ _context13.prev = 9;
836
+ _context13.t0 = _context13["catch"](1);
837
+ console.error('Failed to reset and load customers:', _context13.t0);
838
+ throw _context13.t0;
1740
839
  case 13:
1741
840
  case "end":
1742
- return _context25.stop();
841
+ return _context13.stop();
1743
842
  }
1744
- }, _callee25, this, [[1, 9]]);
843
+ }, _callee13, this, [[1, 9]]);
1745
844
  }));
1746
845
  function resetAndLoadCustomers() {
1747
846
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -1786,9 +885,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1786
885
  }, {
1787
886
  key: "scanGlobalListener",
1788
887
  value: function scanGlobalListener(callback) {
1789
- var _this5 = this;
888
+ var _this2 = this;
1790
889
  var localSearch = function localSearch(v) {
1791
- return _this5.store.products.findProductsByCodeOrBarcode(v);
890
+ return _this2.store.products.findProductsByCodeOrBarcode(v);
1792
891
  };
1793
892
  var scanCallback = handleGlobalScan(this.request, localSearch);
1794
893
  var safeCallback = function safeCallback(d) {
@@ -1896,710 +995,76 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1896
995
  }
1897
996
 
1898
997
  /**
1899
- * 获取其他参数
1900
- * @returns 其他参数
1901
- */
1902
- }, {
1903
- key: "getOtherParams",
1904
- value: (function () {
1905
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1906
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1907
- while (1) switch (_context26.prev = _context26.next) {
1908
- case 0:
1909
- return _context26.abrupt("return", this.otherParams);
1910
- case 1:
1911
- case "end":
1912
- return _context26.stop();
1913
- }
1914
- }, _callee26, this);
1915
- }));
1916
- function getOtherParams() {
1917
- return _getOtherParams.apply(this, arguments);
1918
- }
1919
- return getOtherParams;
1920
- }() // ─── BookingContext API(透传给 BookingContextModule) ──────────────────────
1921
- // SalesSdkProvider 挂载时默认调 initBookingContext;也可由 UI 显式 set* 灌入已有数据。
1922
- /** 拉取 board config 并写入 BookingContext。 */
1923
- )
1924
- }, {
1925
- key: "loadBookingConfig",
1926
- value: function loadBookingConfig(params) {
1927
- return this.store.bookingContext.loadBookingConfig(params);
1928
- }
1929
-
1930
- /** 拉取资源全集并写入 BookingContext。 */
1931
- }, {
1932
- key: "loadBookingResources",
1933
- value: function loadBookingResources(params) {
1934
- return this.store.bookingContext.loadResources(params);
1935
- }
1936
-
1937
- /** 初始化 BookingContext(date + config + resources)。 */
1938
- }, {
1939
- key: "initBookingContext",
1940
- value: function initBookingContext(params) {
1941
- return this.store.bookingContext.initBookingContext(params);
1942
- }
1943
-
1944
- /** 当前 store 是否已具备与入参等价的 config / resources(无需再请求接口)。 */
1945
- }, {
1946
- key: "isBookingContextReady",
1947
- value: function isBookingContextReady(params) {
1948
- return this.store.bookingContext.isBookingContextReady(params);
1949
- }
1950
-
1951
- /** 写入 booking config(来源:`/core/board/management/config`)。 */
1952
- }, {
1953
- key: "setBookingConfig",
1954
- value: function setBookingConfig(config) {
1955
- this.store.bookingContext.setBookingConfig(config);
1956
- }
1957
-
1958
- /** 读取当前 booking config。 */
1959
- }, {
1960
- key: "getBookingConfig",
1961
- value: function getBookingConfig() {
1962
- return this.store.bookingContext.getBookingConfig();
1963
- }
1964
-
1965
- /** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
1966
- }, {
1967
- key: "setResources",
1968
- value: function setResources(resources) {
1969
- this.store.bookingContext.setResources(resources);
1970
- }
1971
-
1972
- /** 读取资源全集(浅克隆)。 */
1973
- }, {
1974
- key: "getResourcesOrigin",
1975
- value: function getResourcesOrigin() {
1976
- return this.store.bookingContext.getResourcesOrigin();
1977
- }
1978
-
1979
- /** 读取资源全集 map(id → resource)。 */
1980
- }, {
1981
- key: "getResourcesOriginMap",
1982
- value: function getResourcesOriginMap() {
1983
- return this.store.bookingContext.getResourcesOriginMap();
1984
- }
1985
-
1986
- /** 写入当前选择的日期;支持 dayjs / Date / string。 */
1987
- }, {
1988
- key: "setBookingDate",
1989
- value: function setBookingDate(date) {
1990
- this.store.bookingContext.setDate(date);
1991
- }
1992
-
1993
- /** 读取当前选择的日期(统一 string)。 */
1994
- }, {
1995
- key: "getBookingDate",
1996
- value: function getBookingDate() {
1997
- return this.store.bookingContext.getDate();
1998
- }
1999
-
2000
- /** 读取 BookingContext 完整 store(调试 / 测试 / 透传给 SDK 使用)。 */
2001
- }, {
2002
- key: "getBookingContextState",
2003
- value: function getBookingContextState() {
2004
- return this.store.bookingContext.getState();
2005
- }
2006
-
2007
- /** 清空 BookingContext(切租户 / destroy 场景)。 */
2008
- }, {
2009
- key: "clearBookingContext",
2010
- value: function clearBookingContext() {
2011
- this.store.bookingContext.clear();
2012
- }
2013
-
2014
- /**
2015
- * 构造 BookingContext 计算上下文(供 getProductExtend / getResourceByIds 等读 API 复用)。
2016
- */
2017
- }, {
2018
- key: "buildBookingCalcContext",
2019
- value: function buildBookingCalcContext(extra) {
2020
- var _extra$date, _extra$presetStartTim;
2021
- var state = this.store.bookingContext.getState();
2022
- var date = (_extra$date = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date !== void 0 ? _extra$date : state.date;
2023
- return _objectSpread({
2024
- bookingConfig: state.bookingConfig,
2025
- resourcesOrigin: state.resourcesOrigin,
2026
- resourcesOriginMap: state.resourcesOriginMap,
2027
- date: date,
2028
- presetStartTime: (_extra$presetStartTim = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim !== void 0 ? _extra$presetStartTim : derivePresetStartTimeFromDate(date)
2029
- }, extra || {});
2030
- }
2031
-
2032
- /**
2033
- * 取商品当前可选资源列表(透传 OS BookingContext utils#getResourceByIds)。
2034
- * `extraResources` 用于把拖入未绑定的资源也展示出来。
2035
- */
2036
- }, {
2037
- key: "getResourcesForProduct",
2038
- value: function getResourcesForProduct(product, options) {
2039
- var _ctx$bookingConfig;
2040
- var ctx = this.buildBookingCalcContext();
2041
- return getResourceByIdsUtil(ctx.resourcesOriginMap || {}, product, {
2042
- resourceTab: (_ctx$bookingConfig = ctx.bookingConfig) === null || _ctx$bookingConfig === void 0 || (_ctx$bookingConfig = _ctx$bookingConfig.config) === null || _ctx$bookingConfig === void 0 ? void 0 : _ctx$bookingConfig.resource_tab,
2043
- resourcesOrigin: ctx.resourcesOrigin,
2044
- extraResources: (options === null || options === void 0 ? void 0 : options.extraResources) || []
2045
- });
2046
- }
2047
-
2048
- /**
2049
- * 拼装 cacheItem 的 _extend / _data(资源 / 容量 / timeObj),与 info2 `getProductExtend` 等价。
2050
- */
2051
- }, {
2052
- key: "getProductExtend",
2053
- value: function getProductExtend(cacheItem, extra) {
2054
- var preparedCacheItem = withProductOptionString(cacheItem);
2055
- var result = getProductExtendUtil({
2056
- cacheItem: preparedCacheItem,
2057
- ctx: this.buildBookingCalcContext(extra)
2058
- });
2059
- return result;
2060
- }
2061
-
2062
- /**
2063
- * 取资源不可用原因列表(结构化 enum + params,i18n 文案由 UI 渲染)。
2064
- */
2065
- }, {
2066
- key: "getResourceErrors",
2067
- value: function getResourceErrors(resource, cacheItem) {
2068
- return getResourceErrorsUtil(resource, cacheItem);
2069
- }
2070
-
2071
- // ─── addProduct 决策 / 转换 API(SDK 加车下沉所需) ─────────────────────────
2072
- // 这一组方法是 SalesSdkCartContext.addProduct / confirmDetail 的 OS 后端。
2073
- // 调用方传入 ProductData,OS 自取 bookingContext / customer / date 等上下文,
2074
- // 输出 (a) autoClose 决策结果或 (b) `{ product, booking }` 协议入参。
2075
-
2076
- /**
2077
- * session 商品 catalog 日期与 TimeBar 不一致时写业务日志。
2078
- *
2079
- * @example
2080
- * this.logSessionCatalogDateMismatch(product, ctx.date);
2081
- */
2082
- }, {
2083
- key: "logSessionCatalogDateMismatch",
2084
- value: function logSessionCatalogDateMismatch(item, bookingDate) {
2085
- var _this$getTempOrder, _tempOrder$order_id, _tempOrder$external_s, _item$cartDetailValue, _item$cartDetailValue2;
2086
- var logger = this.logger;
2087
- if (!(logger !== null && logger !== void 0 && logger.addLog)) return;
2088
- var tempOrder = (_this$getTempOrder = this.getTempOrder) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.call(this);
2089
- var staleInfo = buildSessionCatalogStaleInfo(item, bookingDate);
2090
- logger.addLog({
2091
- type: 'warning',
2092
- title: "[BookingTicket] session catalog date mismatch, reload products",
2093
- metadata: _objectSpread(_objectSpread({
2094
- order_id: (_tempOrder$order_id = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id !== void 0 ? _tempOrder$order_id : null,
2095
- external_sale_number: (_tempOrder$external_s = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) !== null && _tempOrder$external_s !== void 0 ? _tempOrder$external_s : null
2096
- }, staleInfo), {}, {
2097
- cartDetailValueSession: (_item$cartDetailValue = item === null || item === void 0 || (_item$cartDetailValue2 = item.cartDetailValue) === null || _item$cartDetailValue2 === void 0 ? void 0 : _item$cartDetailValue2.session) !== null && _item$cartDetailValue !== void 0 ? _item$cartDetailValue : null
2098
- })
2099
- });
2100
- }
2101
-
2102
- /**
2103
- * 加车前:session 商品 catalog 日历日与 bookingDate 不一致时中断加购,交由 SDK reload products。
2104
- */
2105
- }, {
2106
- key: "resolveSessionCatalogBeforeAdd",
2107
- value: function resolveSessionCatalogBeforeAdd(item, ctx) {
2108
- if (!isSessionCatalogDateStale(item, ctx.date)) {
2109
- return null;
2110
- }
2111
- this.logSessionCatalogDateMismatch(item, ctx.date);
2112
- return {
2113
- action: 'reloadCatalog'
2114
- };
2115
- }
2116
-
2117
- /**
2118
- * 拼装 addProductDecision 通用上下文(从 store 自取)。
2119
- */
2120
- }, {
2121
- key: "buildAddProductCtx",
2122
- value: function buildAddProductCtx(extra) {
2123
- var _extra$date2, _ref12, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get4, _extra$presetStartTim2;
2124
- var bookingContextState = this.store.bookingContext.getState();
2125
- var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
2126
- var orderCustomerId = (_ref12 = (_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
2127
- return _objectSpread({
2128
- bookingConfig: bookingContextState.bookingConfig,
2129
- resourcesOrigin: bookingContextState.resourcesOrigin,
2130
- resourcesOriginMap: bookingContextState.resourcesOriginMap,
2131
- date: date,
2132
- presetStartTime: (_extra$presetStartTim2 = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim2 !== void 0 ? _extra$presetStartTim2 : derivePresetStartTimeFromDate(date),
2133
- customerId: orderCustomerId
2134
- }, extra || {});
2135
- }
2136
-
2137
- /**
2138
- * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
2139
- * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
2140
- */
2141
- }, {
2142
- key: "decideAddProduct",
2143
- value: function decideAddProduct(item, options) {
2144
- var ctx = this.buildAddProductCtx(options);
2145
- var staleDecision = this.resolveSessionCatalogBeforeAdd(item, ctx);
2146
- if (staleDecision) {
2147
- return staleDecision;
2148
- }
2149
- return decideAddProductUtil(item, ctx);
2150
- }
2151
-
2152
- /** 规格弹窗 callback 后的第二段决策。 */
2153
- }, {
2154
- key: "decideAfterDetail",
2155
- value: function decideAfterDetail(cacheItem, options) {
2156
- return decideAfterDetailUtil(cacheItem, this.buildAddProductCtx(options));
2157
- }
2158
-
2159
- /**
2160
- * @deprecated 请用 `decideAddProduct`;`autoClose=true` 仅当 action=add。
2161
- */
2162
- }, {
2163
- key: "decideAutoClose",
2164
- value: function decideAutoClose(item, options) {
2165
- return decideAutoCloseUtil(item, this.buildAddProductCtx(options));
2166
- }
2167
-
2168
- /** 替代 info2 `getIsEject`:商品是否需要弹窗(0/1)。 */
2169
- }, {
2170
- key: "getIsEject",
2171
- value: function getIsEject(item) {
2172
- var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'select';
2173
- return getIsEjectUtil(item, type);
2174
- }
2175
-
2176
- /** 仅 session 商品(无 variant/option/package)→ true。 */
2177
- }, {
2178
- key: "getIsOnlySession",
2179
- value: function getIsOnlySession(item) {
2180
- return getIsOnlySessionUtil(item);
2181
- }
2182
-
2183
- /**
2184
- * 拼装 requiresDetail payload(给 SDK 直接 return 给 UI 用)。
2185
- */
2186
- }, {
2187
- key: "buildRequiresDetailPayload",
2188
- value: function buildRequiresDetailPayload(item, options) {
2189
- var ctx = this.buildAddProductCtx(options);
2190
- return _buildRequiresDetailPayload(item, ctx);
2191
- }
2192
-
2193
- /**
2194
- * 把 detail 弹窗回调结果(e, extension_type, detail)转换为 `(product, booking)` 入参。
2195
- * 内部会先拼 cacheItem,再走 cacheItemToBookingInput 严格协议对齐。
2196
- */
2197
- }, {
2198
- key: "transformDetailToProductAndBooking",
2199
- value: function transformDetailToProductAndBooking(input) {
2200
- var item = input.item,
2201
- preparedCacheItem = input.cacheItem,
2202
- detailResult = input.detailResult,
2203
- options = input.options;
2204
- var ctx = this.buildAddProductCtx(options);
2205
- var cacheItem = preparedCacheItem || (detailResult ? buildCacheItemFromDetail(item, detailResult, ctx) : buildCacheItemFromCartDetail(item, ctx));
2206
- return transformDetailToProductAndBookingUtil(cacheItem, ctx);
2207
- }
2208
-
2209
- /**
2210
- * 从已加车的 order line + booking 反查资源编辑抽屉所需的 cacheItem。
2211
- * 供 SalesSdk「编辑资源」等场景使用;字段语义与 buildCacheItemFromDetail 产出对齐。
2212
- */
2213
- }, {
2214
- key: "buildCacheItemFromOrderLine",
2215
- value: function buildCacheItemFromOrderLine(input) {
2216
- return buildCacheItemFromOrderLineUtil(input);
2217
- }
2218
-
2219
- /**
2220
- * 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
2221
- */
2222
- }, {
2223
- key: "buildNormalProductCacheItemFromOrderLine",
2224
- value: function buildNormalProductCacheItemFromOrderLine(input) {
2225
- return buildNormalProductCacheItemFromOrderLineUtil(input);
2226
- }
2227
-
2228
- /** 文档别名:与 OrderModule.updateOrderProduct 一致。 */
2229
- }, {
2230
- key: "updateProductInOrder",
2231
- value: (function () {
2232
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2233
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2234
- while (1) switch (_context27.prev = _context27.next) {
2235
- case 0:
2236
- return _context27.abrupt("return", this.updateOrderProduct(params));
2237
- case 1:
2238
- case "end":
2239
- return _context27.stop();
2240
- }
2241
- }, _callee27, this);
2242
- }));
2243
- function updateProductInOrder(_x17) {
2244
- return _updateProductInOrder.apply(this, arguments);
2245
- }
2246
- return updateProductInOrder;
2247
- }()
2248
- /**
2249
- * 全局扫码 pubsub 入口:解析码值 → 搜索 → 业务分发(客户 / 加车 / 开单)。
2250
- * UI 层在 pubsub 订阅回调里注入 `bridge`(uiHosts / action / cart.confirm*)。
2251
- *
2252
- * @example
2253
- * ```ts
2254
- * await bookingTicket.handleGlobalScanCode(payload.data, {
2255
- * openProductDetail: uiHosts.openProductDetail,
2256
- * confirmDetail: cart.confirmDetail,
2257
- * openOrder: ({ order_id }) => action({ type: 'pisell1.handleOpenCachedBigSale', data: { order_id } }),
2258
- * });
2259
- * ```
998
+ * 设置其他参数
999
+ * @param params 参数
1000
+ * @param options 选项
2260
1001
  */
2261
- )
2262
1002
  }, {
2263
- key: "handleGlobalScanCode",
1003
+ key: "setOtherParams",
2264
1004
  value: (function () {
2265
- var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(code, bridge) {
2266
- var _this6 = this;
2267
- var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
2268
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2269
- while (1) switch (_context28.prev = _context28.next) {
1005
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
1006
+ var _ref2,
1007
+ _ref2$cover,
1008
+ cover,
1009
+ _args14 = arguments;
1010
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1011
+ while (1) switch (_context14.prev = _context14.next) {
2270
1012
  case 0:
2271
- trimmed = typeof code === 'string' ? code.trim() : '';
2272
- if (trimmed) {
2273
- _context28.next = 4;
2274
- break;
1013
+ _ref2 = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {}, _ref2$cover = _ref2.cover, cover = _ref2$cover === void 0 ? false : _ref2$cover;
1014
+ if (cover) {
1015
+ this.otherParams = params;
1016
+ } else {
1017
+ this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
2275
1018
  }
2276
- bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2277
- return _context28.abrupt("return", {
2278
- status: 'failed',
2279
- reason: 'empty_code'
2280
- });
2281
- case 4:
2282
- _context28.prev = 4;
2283
- localSearch = function localSearch(v) {
2284
- return _this6.store.products.findProductsByCodeOrBarcode(v);
2285
- };
2286
- scanCallback = handleGlobalScan(this.request, localSearch);
2287
- _context28.next = 9;
2288
- return scanCallback({
2289
- type: 'nativeScanner',
2290
- value: trimmed
2291
- });
2292
- case 9:
2293
- raw = _context28.sent;
2294
- formatted = formatGlobalScanResult(raw, trimmed);
2295
- if (formatted) {
2296
- _context28.next = 14;
2297
- break;
2298
- }
2299
- bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2300
- return _context28.abrupt("return", {
2301
- status: 'failed',
2302
- reason: 'not_found'
2303
- });
2304
- case 14:
2305
- _context28.next = 16;
2306
- return applyGlobalScan({
2307
- setOrderCustomer: function setOrderCustomer(customer) {
2308
- return _this6.setOrderCustomer(customer);
2309
- },
2310
- getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
2311
- return _this6.getOrderCustomerSnapshot();
2312
- },
2313
- getBusinessCode: function getBusinessCode() {
2314
- var _this6$otherParams;
2315
- return (_this6$otherParams = _this6.otherParams) === null || _this6$otherParams === void 0 ? void 0 : _this6$otherParams.businessCode;
2316
- },
2317
- buildAddProductCtx: function buildAddProductCtx(extra) {
2318
- return _this6.buildAddProductCtx(extra);
2319
- },
2320
- decideAddProduct: function decideAddProduct(item, options) {
2321
- return _this6.decideAddProduct(item, options);
2322
- },
2323
- decideAfterDetail: function decideAfterDetail(cacheItem, options) {
2324
- return _this6.decideAfterDetail(cacheItem, options);
2325
- },
2326
- transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
2327
- return _this6.transformDetailToProductAndBooking(input);
2328
- },
2329
- addProductToOrder: function addProductToOrder(product, booking) {
2330
- return _this6.addProductToOrder(product, booking);
2331
- }
2332
- }, formatted, bridge);
2333
- case 16:
2334
- _result7 = _context28.sent;
2335
- bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
2336
- return _context28.abrupt("return", _result7);
2337
- case 21:
2338
- _context28.prev = 21;
2339
- _context28.t0 = _context28["catch"](4);
2340
- console.error('[BookingTicket] handleGlobalScanCode failed', _context28.t0);
2341
- bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2342
- return _context28.abrupt("return", {
2343
- status: 'failed',
2344
- reason: 'not_found'
2345
- });
2346
- case 26:
2347
- case "end":
2348
- return _context28.stop();
2349
- }
2350
- }, _callee28, this, [[4, 21]]);
2351
- }));
2352
- function handleGlobalScanCode(_x18, _x19) {
2353
- return _handleGlobalScanCode.apply(this, arguments);
2354
- }
2355
- return handleGlobalScanCode;
2356
- }())
2357
- }, {
2358
- key: "resolveBestAddTimePlan",
2359
- value: function resolveBestAddTimePlan(addTimeProducts, targetMinutes) {
2360
- return _resolveBestAddTimePlan(addTimeProducts, targetMinutes);
2361
- }
2362
-
2363
- /**
2364
- * 构造一条绑定到已有 booking 的加时商品行。
2365
- *
2366
- * @example
2367
- * const line = this.buildAddTimeOrderLine({ product, product_add_schedule_time: 30 }, 'booking-1');
2368
- */
2369
- }, {
2370
- key: "buildAddTimeOrderLine",
2371
- value: function buildAddTimeOrderLine(input, bookingUid) {
2372
- var _input$num, _product$id, _product$product_id, _ref13, _product$product_vari, _ref14, _product$variant_id, _product$original_pri, _ref15, _ref16, _product$option, _product$product_sku, _ref17, _ref18, _product$bundle, _product$id2;
2373
- var product = input === null || input === void 0 ? void 0 : input.product;
2374
- if (!product || _typeof(product) !== 'object') {
2375
- throw new Error('[BookingTicket] addAddTimeProductToBooking: product 不能为空');
2376
- }
2377
- var quantity = normalizeAddTimeQuantity((_input$num = input.num) !== null && _input$num !== void 0 ? _input$num : product.num);
2378
- var price = resolveAddTimeProductPrice(input.price, product);
2379
- var addScheduleTime = resolveAddTimeScheduleMinutes(input.product_add_schedule_time, product);
2380
- var payload = {
2381
- id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id,
2382
- product_id: (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id,
2383
- product_variant_id: (_ref13 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product.variant_id) !== null && _ref13 !== void 0 ? _ref13 : 0,
2384
- variant_id: (_ref14 = (_product$variant_id = product.variant_id) !== null && _product$variant_id !== void 0 ? _product$variant_id : product.product_variant_id) !== null && _ref14 !== void 0 ? _ref14 : 0,
2385
- quantity: quantity,
2386
- num: quantity,
2387
- price: price,
2388
- selling_price: price,
2389
- original_price: (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : price,
2390
- line_total: price,
2391
- total: price,
2392
- product_sku: product.product_sku,
2393
- option: (_ref15 = (_ref16 = (_product$option = product.option) !== null && _product$option !== void 0 ? _product$option : product.options) !== null && _ref16 !== void 0 ? _ref16 : (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option) !== null && _ref15 !== void 0 ? _ref15 : [],
2394
- bundle: (_ref17 = (_ref18 = (_product$bundle = product.bundle) !== null && _product$bundle !== void 0 ? _product$bundle : product.bundles) !== null && _ref18 !== void 0 ? _ref18 : product.product_bundle) !== null && _ref17 !== void 0 ? _ref17 : []
2395
- };
2396
- var orderLine = this.transformBaseProductToOrderProduct({
2397
- payload: payload,
2398
- fallbackProductId: (_product$id2 = product.id) !== null && _product$id2 !== void 0 ? _product$id2 : product.product_id,
2399
- sourceProduct: product,
2400
- sourceItem: product
2401
- });
2402
- if (!orderLine) {
2403
- throw new Error('[BookingTicket] addAddTimeProductToBooking: product transform failed');
2404
- }
2405
- var metadata = _objectSpread(_objectSpread(_objectSpread({}, orderLine.metadata || {}), addScheduleTime !== undefined ? {
2406
- product_add_schedule_time: addScheduleTime
2407
- } : {}), {}, {
2408
- booking_uid: bookingUid
2409
- });
2410
- return _objectSpread(_objectSpread({}, orderLine), {}, {
2411
- booking_uid: bookingUid,
2412
- metadata: metadata
2413
- });
2414
- }
2415
-
2416
- /**
2417
- * 将加时商品作为独立商品行绑定到已有 booking。
2418
- *
2419
- * 与预约商品加车不同,本方法不会把当前 booking 作为 `addProductToOrder` 第二参数传入,
2420
- * 避免 OrderModule 新建 booking 或重写已有 booking.product_uid。
2421
- *
2422
- * @example
2423
- * await bookingTicket.addAddTimeProductToBooking({
2424
- * booking,
2425
- * product,
2426
- * num: 1,
2427
- * price: '10.00',
2428
- * product_add_schedule_time: 30,
2429
- * });
2430
- */
2431
- }, {
2432
- key: "addAddTimeProductToBooking",
2433
- value: (function () {
2434
- var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(input) {
2435
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2436
- while (1) switch (_context29.prev = _context29.next) {
2437
- case 0:
2438
- return _context29.abrupt("return", this.addAddTimeProductsToBooking({
2439
- booking: input.booking,
2440
- products: [input],
2441
- coveredMinutes: input.coveredMinutes,
2442
- bookingPatch: input.bookingPatch
2443
- }));
2444
- case 1:
1019
+ case 2:
2445
1020
  case "end":
2446
- return _context29.stop();
1021
+ return _context14.stop();
2447
1022
  }
2448
- }, _callee29, this);
1023
+ }, _callee14, this);
2449
1024
  }));
2450
- function addAddTimeProductToBooking(_x20) {
2451
- return _addAddTimeProductToBooking.apply(this, arguments);
1025
+ function setOtherParams(_x10) {
1026
+ return _setOtherParams.apply(this, arguments);
2452
1027
  }
2453
- return addAddTimeProductToBooking;
1028
+ return setOtherParams;
2454
1029
  }()
2455
1030
  /**
2456
- * 批量将加时商品作为独立商品行绑定到已有 booking,并只触发一次购物车重算。
2457
- *
2458
- * @example
2459
- * await bookingTicket.addAddTimeProductsToBooking({
2460
- * booking,
2461
- * products: [{ product, product_add_schedule_time: 30 }],
2462
- * });
1031
+ * 获取其他参数
1032
+ * @returns 其他参数
2463
1033
  */
2464
1034
  )
2465
1035
  }, {
2466
- key: "addAddTimeProductsToBooking",
1036
+ key: "getOtherParams",
2467
1037
  value: (function () {
2468
- var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(input) {
2469
- var _this7 = this,
2470
- _input$bookingPatch;
2471
- var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator, _step, line;
2472
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2473
- while (1) switch (_context30.prev = _context30.next) {
2474
- case 0:
2475
- bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
2476
- if (bookingUid) {
2477
- _context30.next = 3;
2478
- break;
2479
- }
2480
- throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
2481
- case 3:
2482
- orderLines = (input.products || []).map(function (line) {
2483
- return {
2484
- product: _this7.buildAddTimeOrderLine(line, bookingUid)
2485
- };
2486
- });
2487
- if (this.store.order) {
2488
- _context30.next = 6;
2489
- break;
2490
- }
2491
- throw new Error('order 模块未初始化');
2492
- case 6:
2493
- coveredMinutes = normalizeCoveredMinutes(input.coveredMinutes);
2494
- bookingTimePatch = (_input$bookingPatch = input.bookingPatch) !== null && _input$bookingPatch !== void 0 ? _input$bookingPatch : buildAddTimeBookingTimePatch(input.booking, coveredMinutes);
2495
- if (bookingTimePatch) {
2496
- this.store.order.updateOrderBooking({
2497
- unique_identification_number: bookingUid,
2498
- updates: bookingTimePatch
2499
- });
2500
- }
2501
- if (!(typeof this.store.order.addProductsToOrder === 'function')) {
2502
- _context30.next = 11;
2503
- break;
2504
- }
2505
- return _context30.abrupt("return", this.store.order.addProductsToOrder(orderLines, {
2506
- skipEditDiscountConfigRefresh: true,
2507
- skipDiscountRecalculation: true
2508
- }));
2509
- case 11:
2510
- result = [];
2511
- _iterator = _createForOfIteratorHelper(orderLines);
2512
- _context30.prev = 13;
2513
- _iterator.s();
2514
- case 15:
2515
- if ((_step = _iterator.n()).done) {
2516
- _context30.next = 29;
2517
- break;
2518
- }
2519
- line = _step.value;
2520
- _context30.t0 = result.splice;
2521
- _context30.t1 = result;
2522
- _context30.t2 = [0, result.length];
2523
- _context30.t3 = _toConsumableArray;
2524
- _context30.next = 23;
2525
- return this.addProductToOrder(line.product);
2526
- case 23:
2527
- _context30.t4 = _context30.sent;
2528
- _context30.t5 = (0, _context30.t3)(_context30.t4);
2529
- _context30.t6 = _context30.t2.concat.call(_context30.t2, _context30.t5);
2530
- _context30.t0.apply.call(_context30.t0, _context30.t1, _context30.t6);
2531
- case 27:
2532
- _context30.next = 15;
2533
- break;
2534
- case 29:
2535
- _context30.next = 34;
2536
- break;
2537
- case 31:
2538
- _context30.prev = 31;
2539
- _context30.t7 = _context30["catch"](13);
2540
- _iterator.e(_context30.t7);
2541
- case 34:
2542
- _context30.prev = 34;
2543
- _iterator.f();
2544
- return _context30.finish(34);
2545
- case 37:
2546
- return _context30.abrupt("return", result);
2547
- case 38:
2548
- case "end":
2549
- return _context30.stop();
2550
- }
2551
- }, _callee30, this, [[13, 31, 34, 37]]);
2552
- }));
2553
- function addAddTimeProductsToBooking(_x21) {
2554
- return _addAddTimeProductsToBooking.apply(this, arguments);
2555
- }
2556
- return addAddTimeProductsToBooking;
2557
- }())
2558
- }, {
2559
- key: "setOtherParams",
2560
- value: function () {
2561
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
2562
- var _ref19,
2563
- _ref19$cover,
2564
- cover,
2565
- _args31 = arguments;
2566
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2567
- while (1) switch (_context31.prev = _context31.next) {
1038
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1039
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1040
+ while (1) switch (_context15.prev = _context15.next) {
2568
1041
  case 0:
2569
- _ref19 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
2570
- _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2571
- cover: cover
2572
- });
2573
- if (!(params !== null && params !== void 0 && params.businessCode)) {
2574
- _context31.next = 5;
2575
- break;
2576
- }
2577
- _context31.next = 5;
2578
- return this.configureIdGeneratorFromOpenData();
2579
- case 5:
1042
+ return _context15.abrupt("return", this.otherParams);
1043
+ case 1:
2580
1044
  case "end":
2581
- return _context31.stop();
1045
+ return _context15.stop();
2582
1046
  }
2583
- }, _callee31, this);
1047
+ }, _callee15, this);
2584
1048
  }));
2585
- function setOtherParams(_x22) {
2586
- return _setOtherParams.apply(this, arguments);
1049
+ function getOtherParams() {
1050
+ return _getOtherParams.apply(this, arguments);
2587
1051
  }
2588
- return setOtherParams;
1052
+ return getOtherParams;
2589
1053
  }()
2590
1054
  /**
2591
1055
  * 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
2592
1056
  * 再清理 BookingTicket 自有资源(scan 监听 + scan 内存缓存)。
2593
1057
  */
1058
+ )
2594
1059
  }, {
2595
1060
  key: "destroy",
2596
1061
  value: (function () {
2597
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
1062
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
2598
1063
  var _this$scan;
2599
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2600
- while (1) switch (_context32.prev = _context32.next) {
1064
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1065
+ while (1) switch (_context16.prev = _context16.next) {
2601
1066
  case 0:
2602
- _context32.next = 2;
1067
+ _context16.next = 2;
2603
1068
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
2604
1069
  case 2:
2605
1070
  try {
@@ -2610,9 +1075,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2610
1075
  scanCache.clear();
2611
1076
  case 4:
2612
1077
  case "end":
2613
- return _context32.stop();
1078
+ return _context16.stop();
2614
1079
  }
2615
- }, _callee32, this);
1080
+ }, _callee16, this);
2616
1081
  }));
2617
1082
  function destroy() {
2618
1083
  return _destroy.apply(this, arguments);