@pisell/pisellos 0.10.15 → 0.10.17

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 (331) hide show
  1. package/dist/core/index.js +6 -9
  2. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  3. package/dist/model/strategy/adapter/walletPass/example.js +3 -26
  4. package/dist/model/strategy/strategy-example.js +5 -19
  5. package/dist/modules/Cart/index.js +0 -3
  6. package/dist/modules/Cart/utils/cartProduct.js +0 -1
  7. package/dist/modules/Date/index.js +1 -5
  8. package/dist/modules/Discount/index.js +2 -4
  9. package/dist/modules/OpenData/index.d.ts +5 -2
  10. package/dist/modules/OpenData/index.js +27 -14
  11. package/dist/modules/OpenData/types.d.ts +42 -0
  12. package/dist/modules/OpenData/types.js +7 -1
  13. package/dist/modules/OpenData/utils.d.ts +15 -1
  14. package/dist/modules/OpenData/utils.js +85 -0
  15. package/dist/modules/Order/index.d.ts +4 -2
  16. package/dist/modules/Order/index.js +131 -123
  17. package/dist/modules/Order/types.d.ts +8 -1
  18. package/dist/modules/Order/types.js +1 -0
  19. package/dist/modules/Order/utils.js +7 -1
  20. package/dist/modules/Payment/index.js +97 -162
  21. package/dist/modules/Product/types.d.ts +2 -0
  22. package/dist/modules/ProductList/index.js +96 -74
  23. package/dist/modules/Rules/index.js +12 -12
  24. package/dist/modules/SalesSummary/index.js +6 -4
  25. package/dist/modules/Schedule/index.js +0 -1
  26. package/dist/modules/Schedule/utils.js +0 -1
  27. package/dist/modules/Step/index.js +0 -1
  28. package/dist/plugins/request.js +1 -4
  29. package/dist/plugins/window.js +2 -6
  30. package/dist/server/index.d.ts +11 -0
  31. package/dist/server/index.js +977 -641
  32. package/dist/server/modules/menu/index.js +32 -41
  33. package/dist/server/modules/order/index.d.ts +8 -0
  34. package/dist/server/modules/order/index.js +253 -219
  35. package/dist/server/modules/products/index.js +24 -42
  36. package/dist/server/modules/quotation/index.js +29 -38
  37. package/dist/server/modules/resource/index.js +3 -4
  38. package/dist/server/modules/schedule/index.js +27 -35
  39. package/dist/server/utils/product.js +0 -1
  40. package/dist/server/utils/small-ticket.d.ts +9 -1
  41. package/dist/server/utils/small-ticket.js +117 -43
  42. package/dist/solution/BaseSales/index.d.ts +7 -0
  43. package/dist/solution/BaseSales/index.js +350 -215
  44. package/dist/solution/BaseSales/types.d.ts +2 -0
  45. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  46. package/dist/solution/BaseSales/utils/cartPromotion.js +15 -6
  47. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  48. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +7 -1
  49. package/dist/solution/BaseSales/utils.js +6 -3
  50. package/dist/solution/BookingByStep/index.d.ts +2 -2
  51. package/dist/solution/BookingByStep/index.js +7 -59
  52. package/dist/solution/BookingByStep/utils/capacity.js +1 -11
  53. package/dist/solution/BookingByStep/utils/resources.js +1 -3
  54. package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
  55. package/dist/solution/BookingTicket/index.d.ts +14 -19
  56. package/dist/solution/BookingTicket/index.js +553 -433
  57. package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -1
  58. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
  59. package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
  60. package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
  61. package/dist/solution/BuyTickets/index.js +9 -12
  62. package/dist/solution/Checkout/index.js +177 -252
  63. package/dist/solution/Checkout/utils/index.js +4 -16
  64. package/dist/solution/RegisterAndLogin/index.js +30 -76
  65. package/dist/solution/Sales/index.d.ts +20 -4
  66. package/dist/solution/Sales/index.js +348 -75
  67. package/dist/solution/Sales/types.d.ts +10 -0
  68. package/dist/solution/ScanOrder/index.js +50 -60
  69. package/dist/solution/ScanOrder/types.d.ts +2 -0
  70. package/dist/solution/ScanOrder/utils.js +6 -3
  71. package/dist/solution/ShopDiscount/index.js +2 -7
  72. package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
  73. package/dist/solution/UnifiedBookingSales/index.js +495 -422
  74. package/dist/solution/UnifiedBookingSales/types.d.ts +7 -1
  75. package/dist/solution/VenueBooking/index.js +45 -55
  76. package/dist/utils/task.js +15 -18
  77. package/dist/utils/watch.js +0 -1
  78. package/lib/apis/picoding.js +2 -0
  79. package/lib/core/index.js +131 -131
  80. package/lib/effects/index.js +46 -57
  81. package/lib/index.js +82 -49
  82. package/lib/model/index.js +14 -21
  83. package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
  84. package/lib/model/strategy/adapter/dataVariant/evaluator.js +209 -315
  85. package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
  86. package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
  87. package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
  88. package/lib/model/strategy/adapter/index.js +100 -64
  89. package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
  90. package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
  91. package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
  92. package/lib/model/strategy/adapter/itemRule/index.js +83 -57
  93. package/lib/model/strategy/adapter/itemRule/type.js +97 -36
  94. package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
  95. package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
  96. package/lib/model/strategy/adapter/promotion/examples.js +222 -234
  97. package/lib/model/strategy/adapter/promotion/index.js +1 -51
  98. package/lib/model/strategy/adapter/promotion/type.js +243 -36
  99. package/lib/model/strategy/adapter/type.js +4 -16
  100. package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
  101. package/lib/model/strategy/adapter/walletPass/example.js +217 -190
  102. package/lib/model/strategy/adapter/walletPass/index.js +75 -51
  103. package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
  104. package/lib/model/strategy/adapter/walletPass/type.js +4 -16
  105. package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
  106. package/lib/model/strategy/engine.js +270 -168
  107. package/lib/model/strategy/index.js +49 -34
  108. package/lib/model/strategy/strategy-example.js +243 -239
  109. package/lib/model/strategy/type.js +100 -40
  110. package/lib/modules/Account/index.js +39 -53
  111. package/lib/modules/Account/types.js +20 -33
  112. package/lib/modules/AccountList/index.js +116 -154
  113. package/lib/modules/AccountList/types.js +30 -31
  114. package/lib/modules/AccountList/utils.js +18 -30
  115. package/lib/modules/BaseModule.js +23 -42
  116. package/lib/modules/BookingContext/index.js +158 -136
  117. package/lib/modules/BookingContext/types.js +46 -32
  118. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
  119. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
  120. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
  121. package/lib/modules/BookingContext/utils/flexible.js +38 -55
  122. package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
  123. package/lib/modules/BookingContext/utils/index.js +124 -41
  124. package/lib/modules/BookingContext/utils/noResource.js +58 -70
  125. package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
  126. package/lib/modules/BookingContext/utils/productExtend.js +202 -155
  127. package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
  128. package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
  129. package/lib/modules/BookingContext/utils/resources.js +209 -167
  130. package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
  131. package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
  132. package/lib/modules/Cart/index.js +170 -124
  133. package/lib/modules/Cart/types.js +46 -51
  134. package/lib/modules/Cart/utils/cartAccount.js +40 -39
  135. package/lib/modules/Cart/utils/cartDate.js +56 -61
  136. package/lib/modules/Cart/utils/cartDiscount.js +28 -33
  137. package/lib/modules/Cart/utils/cartNote.js +27 -32
  138. package/lib/modules/Cart/utils/cartProduct.js +321 -251
  139. package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
  140. package/lib/modules/Cart/utils/cartResource.js +70 -78
  141. package/lib/modules/Cart/utils/changePrice.js +22 -50
  142. package/lib/modules/Cart/utils/index.js +106 -48
  143. package/lib/modules/Customer/constants.js +13 -34
  144. package/lib/modules/Customer/index.js +235 -172
  145. package/lib/modules/Customer/types.js +38 -35
  146. package/lib/modules/Date/index.js +116 -115
  147. package/lib/modules/Date/types.js +16 -28
  148. package/lib/modules/Date/utils.js +174 -123
  149. package/lib/modules/Discount/index.js +133 -143
  150. package/lib/modules/Discount/types.js +9 -31
  151. package/lib/modules/Guests/index.js +30 -56
  152. package/lib/modules/Guests/types.js +23 -33
  153. package/lib/modules/Holder/index.js +209 -189
  154. package/lib/modules/Holder/types.js +4 -16
  155. package/lib/modules/Holder/utils.js +20 -49
  156. package/lib/modules/OpenData/index.d.ts +5 -2
  157. package/lib/modules/OpenData/index.js +119 -78
  158. package/lib/modules/OpenData/types.d.ts +42 -0
  159. package/lib/modules/OpenData/types.js +12 -16
  160. package/lib/modules/OpenData/utils.d.ts +15 -1
  161. package/lib/modules/OpenData/utils.js +129 -78
  162. package/lib/modules/Order/index.d.ts +4 -2
  163. package/lib/modules/Order/index.js +1843 -2251
  164. package/lib/modules/Order/payment-utils.js +77 -120
  165. package/lib/modules/Order/types.d.ts +8 -1
  166. package/lib/modules/Order/types.js +88 -35
  167. package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
  168. package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
  169. package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
  170. package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
  171. package/lib/modules/Order/utils/virtualSettlement.js +120 -171
  172. package/lib/modules/Order/utils.js +834 -668
  173. package/lib/modules/Payment/cash.js +20 -33
  174. package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
  175. package/lib/modules/Payment/eftpos.js +16 -30
  176. package/lib/modules/Payment/index.js +532 -399
  177. package/lib/modules/Payment/mx51.js +1 -0
  178. package/lib/modules/Payment/types.js +230 -108
  179. package/lib/modules/Payment/utils.js +52 -51
  180. package/lib/modules/Payment/walletpass.js +485 -660
  181. package/lib/modules/Product/index.js +51 -46
  182. package/lib/modules/Product/types.d.ts +2 -0
  183. package/lib/modules/Product/types.js +4 -16
  184. package/lib/modules/Product/utils.js +32 -33
  185. package/lib/modules/ProductList/index.js +141 -161
  186. package/lib/modules/ProductList/types.js +9 -31
  187. package/lib/modules/Quotation/index.js +66 -100
  188. package/lib/modules/Quotation/types.js +4 -16
  189. package/lib/modules/Resource/index.js +27 -59
  190. package/lib/modules/Resource/types.js +22 -32
  191. package/lib/modules/Resource/utils.js +30 -38
  192. package/lib/modules/ResourcePlanner/index.js +25 -23
  193. package/lib/modules/ResourcePlanner/localClock.js +54 -119
  194. package/lib/modules/ResourcePlanner/planner.js +591 -772
  195. package/lib/modules/ResourcePlanner/types.js +10 -29
  196. package/lib/modules/Rules/index.js +1224 -963
  197. package/lib/modules/Rules/types.js +17 -40
  198. package/lib/modules/SalesSummary/index.js +80 -89
  199. package/lib/modules/SalesSummary/types.js +4 -16
  200. package/lib/modules/SalesSummary/utils.js +359 -442
  201. package/lib/modules/ScanOrderLogger/index.js +59 -79
  202. package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
  203. package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
  204. package/lib/modules/ScanOrderLogger/types.js +4 -16
  205. package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
  206. package/lib/modules/Schedule/index.js +100 -114
  207. package/lib/modules/Schedule/type.js +4 -16
  208. package/lib/modules/Schedule/types.js +4 -16
  209. package/lib/modules/Schedule/utils.js +433 -291
  210. package/lib/modules/Step/index.js +40 -52
  211. package/lib/modules/Step/tyeps.js +4 -16
  212. package/lib/modules/Summary/index.js +66 -71
  213. package/lib/modules/Summary/types.js +4 -16
  214. package/lib/modules/Summary/utils.js +773 -418
  215. package/lib/modules/SurchargeList/index.js +46 -60
  216. package/lib/modules/SurchargeList/types.js +4 -16
  217. package/lib/modules/index.js +245 -63
  218. package/lib/plugins/app.js +4 -16
  219. package/lib/plugins/index.js +36 -25
  220. package/lib/plugins/request.js +137 -126
  221. package/lib/plugins/shopStore.js +4 -16
  222. package/lib/plugins/user.js +4 -16
  223. package/lib/plugins/window.js +171 -179
  224. package/lib/server/index.d.ts +11 -0
  225. package/lib/server/index.js +3432 -2757
  226. package/lib/server/modules/floor-plan/index.js +102 -123
  227. package/lib/server/modules/floor-plan/types.js +15 -30
  228. package/lib/server/modules/index.js +106 -68
  229. package/lib/server/modules/menu/index.js +146 -122
  230. package/lib/server/modules/menu/types.js +18 -31
  231. package/lib/server/modules/order/index.d.ts +8 -0
  232. package/lib/server/modules/order/index.js +781 -956
  233. package/lib/server/modules/order/types.js +122 -33
  234. package/lib/server/modules/order/utils/filterBookings.js +219 -194
  235. package/lib/server/modules/order/utils/filterOrders.js +118 -92
  236. package/lib/server/modules/payment/index.js +59 -83
  237. package/lib/server/modules/payment/types.js +4 -16
  238. package/lib/server/modules/products/index.js +575 -459
  239. package/lib/server/modules/products/types.js +44 -34
  240. package/lib/server/modules/quotation/index.js +137 -172
  241. package/lib/server/modules/quotation/types.js +21 -31
  242. package/lib/server/modules/resource/index.js +213 -184
  243. package/lib/server/modules/resource/types.js +42 -33
  244. package/lib/server/modules/schedule/index.js +135 -123
  245. package/lib/server/modules/schedule/types.js +14 -21
  246. package/lib/server/modules/schedule/utils.js +334 -163
  247. package/lib/server/types.js +4 -16
  248. package/lib/server/utils/index.js +25 -23
  249. package/lib/server/utils/product.js +196 -139
  250. package/lib/server/utils/schedule.js +34 -41
  251. package/lib/server/utils/small-ticket.d.ts +9 -1
  252. package/lib/server/utils/small-ticket.js +565 -470
  253. package/lib/server/utils/time.js +40 -49
  254. package/lib/solution/BaseSales/index.d.ts +7 -0
  255. package/lib/solution/BaseSales/index.js +1385 -1503
  256. package/lib/solution/BaseSales/types.d.ts +2 -0
  257. package/lib/solution/BaseSales/types.js +42 -38
  258. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  259. package/lib/solution/BaseSales/utils/cartPromotion.js +652 -498
  260. package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
  261. package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
  262. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  263. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +138 -180
  264. package/lib/solution/BaseSales/utils.js +161 -143
  265. package/lib/solution/BookingByStep/index.d.ts +2 -2
  266. package/lib/solution/BookingByStep/index.js +1527 -1340
  267. package/lib/solution/BookingByStep/types.js +40 -99
  268. package/lib/solution/BookingByStep/utils/capacity.js +192 -160
  269. package/lib/solution/BookingByStep/utils/products.js +42 -52
  270. package/lib/solution/BookingByStep/utils/resources.js +527 -330
  271. package/lib/solution/BookingByStep/utils/stock.js +65 -44
  272. package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
  273. package/lib/solution/BookingTicket/index.d.ts +14 -19
  274. package/lib/solution/BookingTicket/index.js +663 -526
  275. package/lib/solution/BookingTicket/types.js +99 -77
  276. package/lib/solution/BookingTicket/utils/addProductDecision.js +229 -190
  277. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
  278. package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
  279. package/lib/solution/BookingTicket/utils/cartView.js +114 -99
  280. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  281. package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
  282. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
  283. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
  284. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
  285. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
  286. package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
  287. package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
  288. package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
  289. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
  290. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
  291. package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
  292. package/lib/solution/BuyTickets/index.js +67 -70
  293. package/lib/solution/BuyTickets/types.js +22 -38
  294. package/lib/solution/Checkout/index.js +1451 -1158
  295. package/lib/solution/Checkout/types.js +91 -61
  296. package/lib/solution/Checkout/utils/index.js +228 -156
  297. package/lib/solution/PlaceOrder/index.js +55 -0
  298. package/lib/solution/RegisterAndLogin/config.js +493 -460
  299. package/lib/solution/RegisterAndLogin/index.js +633 -630
  300. package/lib/solution/RegisterAndLogin/types.js +189 -76
  301. package/lib/solution/RegisterAndLogin/utils.js +183 -125
  302. package/lib/solution/Sales/index.d.ts +20 -4
  303. package/lib/solution/Sales/index.js +502 -330
  304. package/lib/solution/Sales/types.d.ts +10 -0
  305. package/lib/solution/Sales/types.js +27 -33
  306. package/lib/solution/ScanOrder/index.js +822 -852
  307. package/lib/solution/ScanOrder/types.d.ts +2 -0
  308. package/lib/solution/ScanOrder/types.js +33 -34
  309. package/lib/solution/ScanOrder/utils.js +412 -374
  310. package/lib/solution/ShopDiscount/index.js +226 -232
  311. package/lib/solution/ShopDiscount/types.js +15 -37
  312. package/lib/solution/ShopDiscount/utils.js +300 -172
  313. package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
  314. package/lib/solution/UnifiedBookingSales/index.js +1087 -1222
  315. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
  316. package/lib/solution/UnifiedBookingSales/types.d.ts +7 -1
  317. package/lib/solution/UnifiedBookingSales/types.js +10 -32
  318. package/lib/solution/VenueBooking/index.js +811 -879
  319. package/lib/solution/VenueBooking/types.js +19 -39
  320. package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
  321. package/lib/solution/VenueBooking/utils/resource.js +31 -54
  322. package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
  323. package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
  324. package/lib/solution/VenueBooking/utils.js +130 -67
  325. package/lib/solution/index.js +124 -41
  326. package/lib/store/createStore.js +32 -29
  327. package/lib/types/index.js +4 -16
  328. package/lib/utils/payment-number.js +26 -46
  329. package/lib/utils/task.js +36 -36
  330. package/lib/utils/watch.js +81 -47
  331. package/package.json +2 -1
@@ -33,6 +33,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
33
33
  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
34
  import dayjs from 'dayjs';
35
35
  import { createBookingTicketModule } from "./types";
36
+ import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings } from "../../modules/OpenData";
36
37
  import { getProductExtend as getProductExtendUtil, getResourceByIds as getResourceByIdsUtil, getResourceErrors as getResourceErrorsUtil, derivePresetStartTimeFromDate } from "../../modules/BookingContext";
37
38
  import { BaseSalesImpl } from "../BaseSales";
38
39
  import Scan from "./utils/scan";
@@ -41,7 +42,7 @@ import { handleGlobalScan, handleCustomerScan, handleUniversalScan } from "./uti
41
42
  import scanCache from "./utils/scan/scanCache";
42
43
  import { formatGlobalScanResult } from "./utils/scan/formatGlobalScan";
43
44
  import { applyGlobalScan } from "./utils/scan/applyGlobalScan";
44
- import { buildCartView } from "./utils/cartView";
45
+ import { buildCartView, isWalkInCustomer } from "./utils/cartView";
45
46
  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
47
  import { buildCacheItemFromOrderLine as buildCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildCacheItemFromOrderLine";
47
48
  import { buildSessionCatalogStaleInfo, isSessionCatalogDateStale } from "./utils/sessionCatalogStale";
@@ -50,7 +51,7 @@ import { buildProductOptionStringFromOrderLine } from "../../modules/BookingCont
50
51
  import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
51
52
  import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resolveBestAddTimePlan";
52
53
  import { createUuidV4 } from "../../modules/Order/utils";
53
- var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
54
+ var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents'];
54
55
  var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
55
56
  var USER_PLATFORM = ['pc', 'h5'];
56
57
 
@@ -180,7 +181,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
180
181
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
181
182
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
182
183
  _defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
183
- _defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
184
+ _defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
185
+ _defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlightTarget", null);
186
+ _defineProperty(_assertThisInitialized(_this), "openDataTarget", null);
184
187
  return _this;
185
188
  }
186
189
  _createClass(BookingTicketImpl, [{
@@ -237,8 +240,6 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
237
240
  _context.next = 9;
238
241
  return this.configureIdGeneratorFromOpenData();
239
242
  case 9:
240
- console.log('[BookingTicket] 初始化完成');
241
- case 10:
242
243
  case "end":
243
244
  return _context.stop();
244
245
  }
@@ -270,7 +271,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
270
271
  key: "loadOpenDataConfig",
271
272
  value: function () {
272
273
  var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
273
- var businessCode, lastFetchedAt, cachedData, channel, openDataConfig;
274
+ var businessCode, channel, target, lastFetchedAt, cachedData, request, openDataConfig;
274
275
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
275
276
  while (1) switch (_context2.prev = _context2.next) {
276
277
  case 0:
@@ -288,47 +289,66 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
288
289
  console.warn('[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载,当前 module name: ', this.name);
289
290
  return _context2.abrupt("return", null);
290
291
  case 6:
292
+ channel = this.getSubmitOrderSalesChannel();
293
+ target = "".concat(businessCode, "+").concat(channel);
291
294
  lastFetchedAt = this.store.openData.getLastFetchedAt();
292
295
  cachedData = this.store.openData.getOpenData();
293
- if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
294
- _context2.next = 11;
296
+ if (!(cachedData && this.openDataTarget === target && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
297
+ _context2.next = 13;
295
298
  break;
296
299
  }
297
300
  this.otherParams.openData = cachedData;
298
301
  return _context2.abrupt("return", cachedData);
299
- case 11:
300
- if (!this.loadOpenDataConfigInFlight) {
301
- _context2.next = 15;
302
+ case 13:
303
+ if (!this.loadOpenDataInFlight) {
304
+ _context2.next = 21;
302
305
  break;
303
306
  }
304
- _context2.next = 14;
305
- return this.loadOpenDataConfigInFlight;
306
- case 14:
307
+ if (!(this.loadOpenDataInFlightTarget === target)) {
308
+ _context2.next = 18;
309
+ break;
310
+ }
311
+ _context2.next = 17;
312
+ return this.loadOpenDataInFlight;
313
+ case 17:
307
314
  return _context2.abrupt("return", _context2.sent);
308
- case 15:
309
- channel = this.getSubmitOrderSalesChannel();
310
- this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
315
+ case 18:
316
+ _context2.next = 20;
317
+ return this.loadOpenDataInFlight;
318
+ case 20:
319
+ return _context2.abrupt("return", this.loadOpenDataConfig());
320
+ case 21:
321
+ this.loadOpenDataInFlightTarget = target;
322
+ request = this.store.openData.fetchOpenData({
311
323
  scope: 'board',
312
- target: "".concat(businessCode, "+").concat(channel),
324
+ target: target,
313
325
  // target: `dine_in+pos`,
314
326
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
315
327
  });
316
- _context2.prev = 17;
317
- _context2.next = 20;
318
- return this.loadOpenDataConfigInFlight;
319
- case 20:
328
+ this.loadOpenDataInFlight = request;
329
+ _context2.prev = 24;
330
+ _context2.next = 27;
331
+ return request;
332
+ case 27:
320
333
  openDataConfig = _context2.sent;
321
- this.otherParams.openData = openDataConfig;
334
+ // clearOpenDataCache() 或新请求已接管时,旧响应只能返回给原调用方,不能复活缓存归属。
335
+ if (this.loadOpenDataInFlight === request) {
336
+ this.openDataTarget = target;
337
+ this.otherParams.openData = openDataConfig;
338
+ }
322
339
  return _context2.abrupt("return", openDataConfig);
323
- case 23:
324
- _context2.prev = 23;
325
- this.loadOpenDataConfigInFlight = null;
326
- return _context2.finish(23);
327
- case 26:
340
+ case 30:
341
+ _context2.prev = 30;
342
+ if (this.loadOpenDataInFlight === request) {
343
+ this.loadOpenDataInFlight = null;
344
+ this.loadOpenDataInFlightTarget = null;
345
+ }
346
+ return _context2.finish(30);
347
+ case 33:
328
348
  case "end":
329
349
  return _context2.stop();
330
350
  }
331
- }, _callee2, this, [[17,, 23, 26]]);
351
+ }, _callee2, this, [[24,, 30, 33]]);
332
352
  }));
333
353
  function loadOpenDataConfig() {
334
354
  return _loadOpenDataConfig.apply(this, arguments);
@@ -353,44 +373,116 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
353
373
  return _getOpenData.apply(this, arguments);
354
374
  }
355
375
  return getOpenData;
356
- }() /** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
376
+ }()
377
+ }, {
378
+ key: "getInvoiceLayoutConfig",
379
+ value: function () {
380
+ var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
381
+ var openData;
382
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
383
+ while (1) switch (_context4.prev = _context4.next) {
384
+ case 0:
385
+ _context4.next = 2;
386
+ return this.loadOpenDataConfig();
387
+ case 2:
388
+ openData = _context4.sent;
389
+ if (openData) {
390
+ _context4.next = 5;
391
+ break;
392
+ }
393
+ return _context4.abrupt("return", getDefaultInvoiceLayoutConfig());
394
+ case 5:
395
+ return _context4.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
396
+ case 6:
397
+ case "end":
398
+ return _context4.stop();
399
+ }
400
+ }, _callee4, this);
401
+ }));
402
+ function getInvoiceLayoutConfig() {
403
+ return _getInvoiceLayoutConfig.apply(this, arguments);
404
+ }
405
+ return getInvoiceLayoutConfig;
406
+ }()
407
+ }, {
408
+ key: "getInvoiceTemplateSettings",
409
+ value: function () {
410
+ var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
411
+ var openData;
412
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
413
+ while (1) switch (_context5.prev = _context5.next) {
414
+ case 0:
415
+ _context5.next = 2;
416
+ return this.loadOpenDataConfig();
417
+ case 2:
418
+ openData = _context5.sent;
419
+ if (openData) {
420
+ _context5.next = 5;
421
+ break;
422
+ }
423
+ return _context5.abrupt("return", getDefaultInvoiceTemplateSettings());
424
+ case 5:
425
+ return _context5.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
426
+ case 6:
427
+ case "end":
428
+ return _context5.stop();
429
+ }
430
+ }, _callee5, this);
431
+ }));
432
+ function getInvoiceTemplateSettings() {
433
+ return _getInvoiceTemplateSettings.apply(this, arguments);
434
+ }
435
+ return getInvoiceTemplateSettings;
436
+ }()
437
+ }, {
438
+ key: "isInvoiceOpenDataCacheCurrent",
439
+ value: function isInvoiceOpenDataCacheCurrent() {
440
+ var businessCode = this.getBookingTicketBusinessCode();
441
+ var channel = this.getSubmitOrderSalesChannel();
442
+ if (!businessCode || !channel) return false;
443
+ return this.openDataTarget === "".concat(businessCode, "+").concat(channel);
444
+ }
445
+
446
+ /** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
357
447
  }, {
358
448
  key: "clearOpenDataCache",
359
449
  value: function clearOpenDataCache() {
360
450
  var _this$store$openData;
361
- this.loadOpenDataConfigInFlight = null;
451
+ this.loadOpenDataInFlight = null;
452
+ this.loadOpenDataInFlightTarget = null;
453
+ this.openDataTarget = null;
362
454
  this.otherParams.openData = null;
363
455
  (_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 || _this$store$openData.clearCache();
364
456
  }
365
457
  }, {
366
458
  key: "getShortNumberOrDeviceId",
367
459
  value: function () {
368
- var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
460
+ var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
369
461
  var getAsyncIotDeviceInfo, res;
370
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
371
- while (1) switch (_context4.prev = _context4.next) {
462
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
463
+ while (1) switch (_context6.prev = _context6.next) {
372
464
  case 0:
373
465
  getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
374
466
  if (!getAsyncIotDeviceInfo) {
375
- _context4.next = 7;
467
+ _context6.next = 7;
376
468
  break;
377
469
  }
378
- _context4.next = 4;
470
+ _context6.next = 4;
379
471
  return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
380
472
  case 4:
381
- res = _context4.sent;
473
+ res = _context6.sent;
382
474
  if (!(res !== null && res !== void 0 && res.short_number)) {
383
- _context4.next = 7;
475
+ _context6.next = 7;
384
476
  break;
385
477
  }
386
- return _context4.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
478
+ return _context6.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
387
479
  case 7:
388
- return _context4.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
480
+ return _context6.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
389
481
  case 8:
390
482
  case "end":
391
- return _context4.stop();
483
+ return _context6.stop();
392
484
  }
393
- }, _callee4, this);
485
+ }, _callee6, this);
394
486
  }));
395
487
  function getShortNumberOrDeviceId() {
396
488
  return _getShortNumberOrDeviceId.apply(this, arguments);
@@ -400,35 +492,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
400
492
  }, {
401
493
  key: "configureIdGeneratorFromOpenData",
402
494
  value: function () {
403
- var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
495
+ var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
404
496
  var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
405
497
  var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
406
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
407
- while (1) switch (_context5.prev = _context5.next) {
498
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
499
+ while (1) switch (_context7.prev = _context7.next) {
408
500
  case 0:
409
501
  // 业务码切换或配置失败时不能复用上一次初始化的短号。
410
502
  this.setPaymentNumberDevicePrefix(null);
411
503
  idGenerator = this.getIdGeneratorPlugin();
412
504
  if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
413
- _context5.next = 5;
505
+ _context7.next = 5;
414
506
  break;
415
507
  }
416
508
  console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
417
- return _context5.abrupt("return");
509
+ return _context7.abrupt("return");
418
510
  case 5:
419
511
  openDataConfig = null;
420
- _context5.prev = 6;
421
- _context5.next = 9;
512
+ _context7.prev = 6;
513
+ _context7.next = 9;
422
514
  return this.loadOpenDataConfig();
423
515
  case 9:
424
- openDataConfig = _context5.sent;
425
- _context5.next = 16;
516
+ openDataConfig = _context7.sent;
517
+ _context7.next = 16;
426
518
  break;
427
519
  case 12:
428
- _context5.prev = 12;
429
- _context5.t0 = _context5["catch"](6);
430
- console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
431
- return _context5.abrupt("return");
520
+ _context7.prev = 12;
521
+ _context7.t0 = _context7["catch"](6);
522
+ console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context7.t0);
523
+ return _context7.abrupt("return");
432
524
  case 16:
433
525
  // if (!openDataConfig) return;
434
526
  receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
@@ -436,22 +528,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
436
528
  prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], '');
437
529
  shopOrderPrefix = this.normalizeIdPrefix((_openDataConfig4 = openDataConfig) === null || _openDataConfig4 === void 0 ? void 0 : _openDataConfig4['sale.sale_number_prefix'], '');
438
530
  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;
439
- operatingDayBoundary = this.getAppData('operating_day_boundary');
440
- _context5.next = 24;
531
+ operatingDayBoundary = this.getAppData('operating_day_boundary') || {
532
+ "type": "start_time",
533
+ "time": "00:00"
534
+ };
535
+ _context7.next = 24;
441
536
  return this.getShortNumberOrDeviceId();
442
537
  case 24:
443
- deviceId = _context5.sent;
538
+ deviceId = _context7.sent;
444
539
  this.setPaymentNumberDevicePrefix(deviceId);
445
540
  businessCode = this.getBookingTicketBusinessCode();
446
541
  if (businessCode) {
447
- _context5.next = 30;
542
+ _context7.next = 30;
448
543
  break;
449
544
  }
450
545
  console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
451
- return _context5.abrupt("return");
546
+ return _context7.abrupt("return");
452
547
  case 30:
453
- _context5.prev = 30;
454
- _context5.next = 33;
548
+ _context7.prev = 30;
549
+ _context7.next = 33;
455
550
  return idGenerator.configure({
456
551
  biz: businessCode,
457
552
  config: {
@@ -461,23 +556,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
461
556
  padReceiptSequence: false,
462
557
  receiptSequenceLength: receiptSequenceLength,
463
558
  resetReceiptSequenceDaily: resetReceiptSequenceDaily,
464
- receiptSequenceResetTime: operatingDayBoundary.time,
559
+ receiptSequenceResetTime: operatingDayBoundary === null || operatingDayBoundary === void 0 ? void 0 : operatingDayBoundary.time,
465
560
  receiptSequenceStart: receiptSequenceStart,
466
561
  shopOrderPrefix: shopOrderPrefix
467
562
  }
468
563
  });
469
564
  case 33:
470
- _context5.next = 38;
565
+ _context7.next = 38;
471
566
  break;
472
567
  case 35:
473
- _context5.prev = 35;
474
- _context5.t1 = _context5["catch"](30);
475
- console.warn('[BookingTicket] idGenerator 配置失败', _context5.t1);
568
+ _context7.prev = 35;
569
+ _context7.t1 = _context7["catch"](30);
570
+ console.warn('[BookingTicket] idGenerator 配置失败', _context7.t1);
476
571
  case 38:
477
572
  case "end":
478
- return _context5.stop();
573
+ return _context7.stop();
479
574
  }
480
- }, _callee5, this, [[6, 12], [30, 35]]);
575
+ }, _callee7, this, [[6, 12], [30, 35]]);
481
576
  }));
482
577
  function configureIdGeneratorFromOpenData() {
483
578
  return _configureIdGeneratorFromOpenData.apply(this, arguments);
@@ -509,16 +604,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
509
604
  }, {
510
605
  key: "loadSalesDetail",
511
606
  value: (function () {
512
- var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(orderIdOrParams) {
607
+ var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(orderIdOrParams) {
513
608
  var _ref3;
514
609
  var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref4, detailCustomerId, detailCustomerRest, rawId, customer;
515
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
516
- while (1) switch (_context6.prev = _context6.next) {
610
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
611
+ while (1) switch (_context8.prev = _context8.next) {
517
612
  case 0:
518
- _context6.next = 2;
613
+ _context8.next = 2;
519
614
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
520
615
  case 2:
521
- sales = _context6.sent;
616
+ sales = _context8.sent;
522
617
  customerModule = this.store.customer;
523
618
  detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
524
619
  orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
@@ -542,15 +637,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
542
637
  country_calling_code: selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.country_calling_code
543
638
  });
544
639
  customerModule.setSelectedCustomer(customer);
545
- this.setOrderCustomer(customer);
640
+ // 详情 hydrate 后仍需广播一次,让 CustomerContext 等 UI 订阅方拿到刚补齐的
641
+ // customerSnapshot;但它不是用户主动切换客户。通过 source 明确标记初始化事件,
642
+ // 商品报价/折扣订阅方即可跳过 prepare/config,其他旧订阅方仍可照常刷新 UI。
643
+ this.setOrderCustomer(customer, {
644
+ source: 'detailHydrate'
645
+ });
546
646
  // await this.store.order.saveDraft();
547
647
  }
548
- return _context6.abrupt("return", sales);
648
+ return _context8.abrupt("return", sales);
549
649
  case 11:
550
650
  case "end":
551
- return _context6.stop();
651
+ return _context8.stop();
552
652
  }
553
- }, _callee6, this);
653
+ }, _callee8, this);
554
654
  }));
555
655
  function loadSalesDetail(_x2) {
556
656
  return _loadSalesDetail.apply(this, arguments);
@@ -560,44 +660,44 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
560
660
  }, {
561
661
  key: "scanPromotionCode",
562
662
  value: function () {
563
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(code, customerId) {
663
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(code, customerId) {
564
664
  var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
565
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
566
- while (1) switch (_context7.prev = _context7.next) {
665
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
666
+ while (1) switch (_context9.prev = _context9.next) {
567
667
  case 0:
568
668
  if (this.store.order) {
569
- _context7.next = 2;
669
+ _context9.next = 2;
570
670
  break;
571
671
  }
572
672
  throw new Error('order 模块未初始化');
573
673
  case 2:
574
- _context7.next = 4;
674
+ _context9.next = 4;
575
675
  return this.store.order.scanCode(code, customerId);
576
676
  case 4:
577
- raw = _context7.sent;
677
+ raw = _context9.sent;
578
678
  scannedList = raw.scannedDiscountList || [];
579
679
  extractedCustomerId = this.getDiscountCustomerId(scannedList);
580
680
  hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
581
681
  isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
582
682
  if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
583
- _context7.next = 12;
683
+ _context9.next = 12;
584
684
  break;
585
685
  }
586
- _context7.next = 12;
686
+ _context9.next = 12;
587
687
  return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
588
688
  case 12:
589
689
  if (!raw.isAvailable) {
590
- _context7.next = 19;
690
+ _context9.next = 19;
591
691
  break;
592
692
  }
593
- _context7.next = 15;
693
+ _context9.next = 15;
594
694
  return this.store.order.recalculateSummary({
595
695
  createIfMissing: true
596
696
  });
597
697
  case 15:
598
698
  this.store.order.persistTempOrder();
599
699
  tempOrder = this.store.order.ensureTempOrder();
600
- _context7.next = 19;
700
+ _context9.next = 19;
601
701
  return this.effectsEmit('onDiscountApplied', {
602
702
  productList: tempOrder.products || [],
603
703
  discountList: this.store.order.getDiscountList(),
@@ -605,7 +705,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
605
705
  tempOrder: tempOrder
606
706
  });
607
707
  case 19:
608
- return _context7.abrupt("return", _objectSpread(_objectSpread({
708
+ return _context9.abrupt("return", _objectSpread(_objectSpread({
609
709
  isAvailable: raw.isAvailable
610
710
  }, raw.isAccepted !== undefined ? {
611
711
  isAccepted: raw.isAccepted
@@ -616,9 +716,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
616
716
  }));
617
717
  case 20:
618
718
  case "end":
619
- return _context7.stop();
719
+ return _context9.stop();
620
720
  }
621
- }, _callee7, this);
721
+ }, _callee9, this);
622
722
  }));
623
723
  function scanPromotionCode(_x3, _x4) {
624
724
  return _scanPromotionCode.apply(this, arguments);
@@ -628,42 +728,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
628
728
  }, {
629
729
  key: "hydrateOrderCustomerFromScanDiscounts",
630
730
  value: function () {
631
- var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(discounts) {
731
+ var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(discounts) {
632
732
  var currentOrderCustomer, customerId, customer;
633
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
634
- while (1) switch (_context8.prev = _context8.next) {
733
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
734
+ while (1) switch (_context10.prev = _context10.next) {
635
735
  case 0:
636
736
  currentOrderCustomer = this.store.order.getOrderCustomer();
637
737
  if (!currentOrderCustomer) {
638
- _context8.next = 3;
738
+ _context10.next = 3;
639
739
  break;
640
740
  }
641
- return _context8.abrupt("return");
741
+ return _context10.abrupt("return");
642
742
  case 3:
643
743
  customerId = this.getDiscountCustomerId(discounts);
644
744
  if (customerId) {
645
- _context8.next = 6;
745
+ _context10.next = 6;
646
746
  break;
647
747
  }
648
- return _context8.abrupt("return");
748
+ return _context10.abrupt("return");
649
749
  case 6:
650
- _context8.next = 8;
750
+ _context10.next = 8;
651
751
  return this.resolveCustomerByDiscountCustomerId(customerId);
652
752
  case 8:
653
- customer = _context8.sent;
753
+ customer = _context10.sent;
654
754
  if (customer) {
655
- _context8.next = 11;
755
+ _context10.next = 11;
656
756
  break;
657
757
  }
658
- return _context8.abrupt("return");
758
+ return _context10.abrupt("return");
659
759
  case 11:
660
760
  this.store.customer.setSelectedCustomer(customer);
661
761
  this.setOrderCustomer(customer);
662
762
  case 13:
663
763
  case "end":
664
- return _context8.stop();
764
+ return _context10.stop();
665
765
  }
666
- }, _callee8, this);
766
+ }, _callee10, this);
667
767
  }));
668
768
  function hydrateOrderCustomerFromScanDiscounts(_x5) {
669
769
  return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
@@ -678,7 +778,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
678
778
  try {
679
779
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
680
780
  var item = _step.value;
681
- var topLevelId = Number(item.customer_id);
781
+ var rawCustomerId = item.customer_id;
782
+ if (!rawCustomerId || isWalkInCustomer({
783
+ id: rawCustomerId
784
+ })) {
785
+ continue;
786
+ }
787
+ var topLevelId = Number(rawCustomerId);
682
788
  if (Number.isFinite(topLevelId) && topLevelId > 0) {
683
789
  return topLevelId;
684
790
  }
@@ -693,55 +799,55 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
693
799
  }, {
694
800
  key: "resolveCustomerById",
695
801
  value: function () {
696
- var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(customerId) {
802
+ var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(customerId) {
697
803
  var _result$list;
698
804
  var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer, detailCustomer;
699
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
700
- while (1) switch (_context9.prev = _context9.next) {
805
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
806
+ while (1) switch (_context11.prev = _context11.next) {
701
807
  case 0:
702
808
  localCustomers = this.store.customer.getCustomers();
703
809
  localCustomer = this.findCustomerById(localCustomers, customerId);
704
810
  normalizedLocalCustomer = localCustomer ? this.normalizeCustomer(localCustomer) : null;
705
811
  if (!(normalizedLocalCustomer && this.hasUsableCustomerDetails(normalizedLocalCustomer))) {
706
- _context9.next = 5;
812
+ _context11.next = 5;
707
813
  break;
708
814
  }
709
- return _context9.abrupt("return", normalizedLocalCustomer);
815
+ return _context11.abrupt("return", normalizedLocalCustomer);
710
816
  case 5:
711
- _context9.next = 7;
817
+ _context11.next = 7;
712
818
  return this.store.customer.queryCustomerList({
713
819
  ids: [customerId],
714
820
  skip: 1,
715
821
  num: 1
716
822
  });
717
823
  case 7:
718
- result = _context9.sent;
824
+ result = _context11.sent;
719
825
  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;
720
826
  if (!remoteCustomer) {
721
- _context9.next = 11;
827
+ _context11.next = 11;
722
828
  break;
723
829
  }
724
- return _context9.abrupt("return", this.normalizeCustomer(remoteCustomer));
830
+ return _context11.abrupt("return", this.normalizeCustomer(remoteCustomer));
725
831
  case 11:
726
- _context9.prev = 11;
727
- _context9.next = 14;
832
+ _context11.prev = 11;
833
+ _context11.next = 14;
728
834
  return this.store.customer.queryCustomerDetail(customerId);
729
835
  case 14:
730
- detailCustomer = _context9.sent;
731
- return _context9.abrupt("return", detailCustomer ? this.normalizeCustomer(detailCustomer) : null);
836
+ detailCustomer = _context11.sent;
837
+ return _context11.abrupt("return", detailCustomer ? this.normalizeCustomer(detailCustomer) : null);
732
838
  case 18:
733
- _context9.prev = 18;
734
- _context9.t0 = _context9["catch"](11);
839
+ _context11.prev = 18;
840
+ _context11.t0 = _context11["catch"](11);
735
841
  console.warn('[BookingTicket] resolveCustomerById detail request failed', {
736
842
  customerId: customerId,
737
- error: _context9.t0
843
+ error: _context11.t0
738
844
  });
739
- return _context9.abrupt("return", null);
845
+ return _context11.abrupt("return", null);
740
846
  case 22:
741
847
  case "end":
742
- return _context9.stop();
848
+ return _context11.stop();
743
849
  }
744
- }, _callee9, this, [[11, 18]]);
850
+ }, _callee11, this, [[11, 18]]);
745
851
  }));
746
852
  function resolveCustomerById(_x6) {
747
853
  return _resolveCustomerById.apply(this, arguments);
@@ -809,60 +915,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
809
915
  }, {
810
916
  key: "setBookingStatus",
811
917
  value: (function () {
812
- var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(status) {
918
+ var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(status) {
813
919
  var _this$store$order, _this$store$order$get;
814
920
  var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
815
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
816
- while (1) switch (_context10.prev = _context10.next) {
921
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
922
+ while (1) switch (_context12.prev = _context12.next) {
817
923
  case 0:
818
924
  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);
819
925
  if (tempOrder) {
820
- _context10.next = 3;
926
+ _context12.next = 3;
821
927
  break;
822
928
  }
823
929
  throw new Error('setBookingStatus: tempOrder 未加载');
824
930
  case 3:
825
931
  orderId = tempOrder.order_id;
826
932
  if (!(orderId === undefined || orderId === null)) {
827
- _context10.next = 6;
933
+ _context12.next = 6;
828
934
  break;
829
935
  }
830
936
  throw new Error('setBookingStatus: tempOrder.order_id 缺失');
831
937
  case 6:
832
938
  scheduleId = resolveScheduleId(tempOrder);
833
939
  if (!(scheduleId === null)) {
834
- _context10.next = 9;
940
+ _context12.next = 9;
835
941
  break;
836
942
  }
837
943
  throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
838
944
  case 9:
839
945
  bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
840
946
  previous = applyBookingsStatus(bookings, status);
841
- _context10.prev = 11;
842
- _context10.next = 14;
947
+ _context12.prev = 11;
948
+ _context12.next = 14;
843
949
  return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
844
950
  appointment_status: status
845
951
  });
846
952
  case 14:
847
- res = _context10.sent;
848
- _context10.next = 17;
953
+ res = _context12.sent;
954
+ _context12.next = 17;
849
955
  return this.refreshSalesDetail();
850
956
  case 17:
851
957
  this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
852
958
  orderId: orderId,
853
959
  status: status
854
960
  });
855
- return _context10.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
961
+ return _context12.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
856
962
  case 21:
857
- _context10.prev = 21;
858
- _context10.t0 = _context10["catch"](11);
963
+ _context12.prev = 21;
964
+ _context12.t0 = _context12["catch"](11);
859
965
  restoreBookingsStatus(bookings, previous);
860
- throw _context10.t0;
966
+ throw _context12.t0;
861
967
  case 25:
862
968
  case "end":
863
- return _context10.stop();
969
+ return _context12.stop();
864
970
  }
865
- }, _callee10, this, [[11, 21]]);
971
+ }, _callee12, this, [[11, 21]]);
866
972
  }));
867
973
  function setBookingStatus(_x7) {
868
974
  return _setBookingStatus.apply(this, arguments);
@@ -893,35 +999,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
893
999
  }, {
894
1000
  key: "transitionChildBooking",
895
1001
  value: (function () {
896
- var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
1002
+ var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
897
1003
  var _this$store$order2, _this$store$order2$ge;
898
1004
  var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
899
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
900
- while (1) switch (_context11.prev = _context11.next) {
1005
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1006
+ while (1) switch (_context13.prev = _context13.next) {
901
1007
  case 0:
902
1008
  schedule_event_id = params.schedule_event_id, action = params.action;
903
1009
  if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
904
- _context11.next = 3;
1010
+ _context13.next = 3;
905
1011
  break;
906
1012
  }
907
1013
  throw new Error('transitionChildBooking: schedule_event_id 不能为空');
908
1014
  case 3:
909
1015
  if (action) {
910
- _context11.next = 5;
1016
+ _context13.next = 5;
911
1017
  break;
912
1018
  }
913
1019
  throw new Error('transitionChildBooking: action 不能为空');
914
1020
  case 5:
915
1021
  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);
916
1022
  if (tempOrder) {
917
- _context11.next = 8;
1023
+ _context13.next = 8;
918
1024
  break;
919
1025
  }
920
1026
  throw new Error('transitionChildBooking: tempOrder 未加载');
921
1027
  case 8:
922
1028
  orderId = tempOrder.order_id;
923
1029
  if (!(orderId === undefined || orderId === null)) {
924
- _context11.next = 11;
1030
+ _context13.next = 11;
925
1031
  break;
926
1032
  }
927
1033
  throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
@@ -929,14 +1035,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
929
1035
  bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
930
1036
  targetStatus = resolveStatusAfterTransition(action);
931
1037
  previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
932
- _context11.prev = 14;
933
- _context11.next = 17;
1038
+ _context13.prev = 14;
1039
+ _context13.next = 17;
934
1040
  return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
935
1041
  action: action
936
1042
  });
937
1043
  case 17:
938
- res = _context11.sent;
939
- _context11.next = 20;
1044
+ res = _context13.sent;
1045
+ _context13.next = 20;
940
1046
  return this.refreshSalesDetail();
941
1047
  case 20:
942
1048
  this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
@@ -945,19 +1051,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
945
1051
  action: action,
946
1052
  status: targetStatus
947
1053
  });
948
- return _context11.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
1054
+ return _context13.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
949
1055
  case 24:
950
- _context11.prev = 24;
951
- _context11.t0 = _context11["catch"](14);
1056
+ _context13.prev = 24;
1057
+ _context13.t0 = _context13["catch"](14);
952
1058
  if (previous !== undefined) {
953
1059
  restoreChildBookingStatus(bookings, schedule_event_id, previous);
954
1060
  }
955
- throw _context11.t0;
1061
+ throw _context13.t0;
956
1062
  case 28:
957
1063
  case "end":
958
- return _context11.stop();
1064
+ return _context13.stop();
959
1065
  }
960
- }, _callee11, this, [[14, 24]]);
1066
+ }, _callee13, this, [[14, 24]]);
961
1067
  }));
962
1068
  function transitionChildBooking(_x8) {
963
1069
  return _transitionChildBooking.apply(this, arguments);
@@ -978,19 +1084,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
978
1084
  }, {
979
1085
  key: "refreshSalesDetail",
980
1086
  value: (function () {
981
- var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1087
+ var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
982
1088
  var _this$store$order3, _this$store$order3$ge;
983
1089
  var params,
984
1090
  tempOrder,
985
1091
  orderId,
986
- _args12 = arguments;
987
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
988
- while (1) switch (_context12.prev = _context12.next) {
1092
+ _args14 = arguments;
1093
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1094
+ while (1) switch (_context14.prev = _context14.next) {
989
1095
  case 0:
990
- params = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
1096
+ params = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
991
1097
  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);
992
1098
  if (tempOrder) {
993
- _context12.next = 4;
1099
+ _context14.next = 4;
994
1100
  break;
995
1101
  }
996
1102
  throw new Error('refreshSalesDetail: tempOrder 未加载');
@@ -998,21 +1104,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
998
1104
  debugger;
999
1105
  orderId = tempOrder.order_id || tempOrder.external_sale_number;
1000
1106
  if (!(orderId === undefined || orderId === null)) {
1001
- _context12.next = 8;
1107
+ _context14.next = 8;
1002
1108
  break;
1003
1109
  }
1004
- return _context12.abrupt("return", {});
1110
+ return _context14.abrupt("return", {});
1005
1111
  case 8:
1006
- return _context12.abrupt("return", this.loadSalesDetail({
1112
+ return _context14.abrupt("return", this.loadSalesDetail({
1007
1113
  orderId: orderId,
1008
1114
  // merge: true
1009
1115
  forceRemote: params.forceRemote
1010
1116
  }));
1011
1117
  case 9:
1012
1118
  case "end":
1013
- return _context12.stop();
1119
+ return _context14.stop();
1014
1120
  }
1015
- }, _callee12, this);
1121
+ }, _callee14, this);
1016
1122
  }));
1017
1123
  function refreshSalesDetail() {
1018
1124
  return _refreshSalesDetail.apply(this, arguments);
@@ -1028,7 +1134,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1028
1134
  }, {
1029
1135
  key: "loadProducts",
1030
1136
  value: (function () {
1031
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
1137
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1032
1138
  var params,
1033
1139
  options,
1034
1140
  schedule_date,
@@ -1037,20 +1143,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1037
1143
  schedule_datetime,
1038
1144
  bookingDate,
1039
1145
  _result,
1040
- _args13 = arguments;
1041
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1042
- while (1) switch (_context13.prev = _context13.next) {
1146
+ _args15 = arguments;
1147
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1148
+ while (1) switch (_context15.prev = _context15.next) {
1043
1149
  case 0:
1044
- params = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
1045
- options = _args13.length > 1 ? _args13[1] : undefined;
1150
+ params = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
1151
+ options = _args15.length > 1 ? _args15[1] : undefined;
1046
1152
  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 对齐;
1047
1153
  // requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
1048
1154
  bookingDate = schedule_datetime || schedule_date || '';
1049
1155
  if (bookingDate) {
1050
1156
  this.setBookingDate(bookingDate);
1051
1157
  }
1052
- _context13.prev = 5;
1053
- _context13.next = 8;
1158
+ _context15.prev = 5;
1159
+ _context15.next = 8;
1054
1160
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
1055
1161
  with_count: ['bundleGroup', 'optionGroup'],
1056
1162
  with_schedule: 1
@@ -1058,20 +1164,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1058
1164
  cacheId: this.cacheId
1059
1165
  }), options);
1060
1166
  case 8:
1061
- _result = _context13.sent;
1167
+ _result = _context15.sent;
1062
1168
  this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
1063
1169
  this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
1064
- return _context13.abrupt("return", _result);
1170
+ return _context15.abrupt("return", _result);
1065
1171
  case 14:
1066
- _context13.prev = 14;
1067
- _context13.t0 = _context13["catch"](5);
1068
- console.error('Failed to load products:', _context13.t0);
1069
- throw _context13.t0;
1172
+ _context15.prev = 14;
1173
+ _context15.t0 = _context15["catch"](5);
1174
+ console.error('Failed to load products:', _context15.t0);
1175
+ throw _context15.t0;
1070
1176
  case 18:
1071
1177
  case "end":
1072
- return _context13.stop();
1178
+ return _context15.stop();
1073
1179
  }
1074
- }, _callee13, this, [[5, 14]]);
1180
+ }, _callee15, this, [[5, 14]]);
1075
1181
  }));
1076
1182
  function loadProducts() {
1077
1183
  return _loadProducts.apply(this, arguments);
@@ -1088,27 +1194,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1088
1194
  }, {
1089
1195
  key: "getAddTimeProducts",
1090
1196
  value: (function () {
1091
- var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1197
+ var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1092
1198
  var params,
1093
1199
  result,
1094
- _args14 = arguments;
1095
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1096
- while (1) switch (_context14.prev = _context14.next) {
1200
+ _args16 = arguments;
1201
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1202
+ while (1) switch (_context16.prev = _context16.next) {
1097
1203
  case 0:
1098
- params = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
1099
- _context14.next = 3;
1204
+ params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
1205
+ _context16.next = 3;
1100
1206
  return this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
1101
1207
  cacheId: this.cacheId
1102
1208
  }));
1103
1209
  case 3:
1104
- result = _context14.sent;
1210
+ result = _context16.sent;
1105
1211
  this.addTimeProductsCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
1106
- return _context14.abrupt("return", result);
1212
+ return _context16.abrupt("return", result);
1107
1213
  case 6:
1108
1214
  case "end":
1109
- return _context14.stop();
1215
+ return _context16.stop();
1110
1216
  }
1111
- }, _callee14, this);
1217
+ }, _callee16, this);
1112
1218
  }));
1113
1219
  function getAddTimeProducts() {
1114
1220
  return _getAddTimeProducts.apply(this, arguments);
@@ -1133,14 +1239,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1133
1239
  }, {
1134
1240
  key: "queryProductDetail",
1135
1241
  value: (function () {
1136
- var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params, options) {
1242
+ var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params, options) {
1137
1243
  var product_id, queryParams, _result2, list;
1138
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1139
- while (1) switch (_context15.prev = _context15.next) {
1244
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1245
+ while (1) switch (_context17.prev = _context17.next) {
1140
1246
  case 0:
1141
1247
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
1142
- _context15.prev = 1;
1143
- _context15.next = 4;
1248
+ _context17.prev = 1;
1249
+ _context17.next = 4;
1144
1250
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
1145
1251
  with_count: ['bundleGroup', 'optionGroup'],
1146
1252
  with_schedule: 1
@@ -1149,21 +1255,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1149
1255
  cacheId: this.cacheId
1150
1256
  }), options);
1151
1257
  case 4:
1152
- _result2 = _context15.sent;
1258
+ _result2 = _context17.sent;
1153
1259
  list = Array.isArray(_result2) ? _result2 : [];
1154
- return _context15.abrupt("return", list.find(function (product) {
1260
+ return _context17.abrupt("return", list.find(function (product) {
1155
1261
  return Number(product.id) === Number(product_id);
1156
1262
  }));
1157
1263
  case 9:
1158
- _context15.prev = 9;
1159
- _context15.t0 = _context15["catch"](1);
1160
- console.error('Failed to query product detail:', _context15.t0);
1161
- throw _context15.t0;
1264
+ _context17.prev = 9;
1265
+ _context17.t0 = _context17["catch"](1);
1266
+ console.error('Failed to query product detail:', _context17.t0);
1267
+ throw _context17.t0;
1162
1268
  case 13:
1163
1269
  case "end":
1164
- return _context15.stop();
1270
+ return _context17.stop();
1165
1271
  }
1166
- }, _callee15, this, [[1, 9]]);
1272
+ }, _callee17, this, [[1, 9]]);
1167
1273
  }));
1168
1274
  function queryProductDetail(_x9, _x10) {
1169
1275
  return _queryProductDetail.apply(this, arguments);
@@ -1178,26 +1284,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1178
1284
  }, {
1179
1285
  key: "loadProductDetail",
1180
1286
  value: (function () {
1181
- var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params, options) {
1287
+ var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params, options) {
1182
1288
  var product_id, queryParams, products;
1183
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1184
- while (1) switch (_context16.prev = _context16.next) {
1289
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1290
+ while (1) switch (_context18.prev = _context18.next) {
1185
1291
  case 0:
1186
1292
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
1187
- _context16.next = 3;
1293
+ _context18.next = 3;
1188
1294
  return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
1189
1295
  product_ids: [product_id]
1190
1296
  }), options);
1191
1297
  case 3:
1192
- products = _context16.sent;
1193
- return _context16.abrupt("return", products.find(function (product) {
1298
+ products = _context18.sent;
1299
+ return _context18.abrupt("return", products.find(function (product) {
1194
1300
  return Number(product.id) === Number(product_id);
1195
1301
  }));
1196
1302
  case 5:
1197
1303
  case "end":
1198
- return _context16.stop();
1304
+ return _context18.stop();
1199
1305
  }
1200
- }, _callee16, this);
1306
+ }, _callee18, this);
1201
1307
  }));
1202
1308
  function loadProductDetail(_x11, _x12) {
1203
1309
  return _loadProductDetail.apply(this, arguments);
@@ -1232,16 +1338,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1232
1338
  }, {
1233
1339
  key: "getProducts",
1234
1340
  value: (function () {
1235
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1236
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1237
- while (1) switch (_context17.prev = _context17.next) {
1341
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1342
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1343
+ while (1) switch (_context19.prev = _context19.next) {
1238
1344
  case 0:
1239
- return _context17.abrupt("return", this.store.products.getProducts());
1345
+ return _context19.abrupt("return", this.store.products.getProducts());
1240
1346
  case 1:
1241
1347
  case "end":
1242
- return _context17.stop();
1348
+ return _context19.stop();
1243
1349
  }
1244
- }, _callee17, this);
1350
+ }, _callee19, this);
1245
1351
  }));
1246
1352
  function getProducts() {
1247
1353
  return _getProducts.apply(this, arguments);
@@ -1306,33 +1412,33 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1306
1412
  }, {
1307
1413
  key: "getProductByIds",
1308
1414
  value: (function () {
1309
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids, options) {
1415
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(ids, options) {
1310
1416
  var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
1311
1417
  var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
1312
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1313
- while (1) switch (_context18.prev = _context18.next) {
1418
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1419
+ while (1) switch (_context20.prev = _context20.next) {
1314
1420
  case 0:
1315
1421
  normalizedIds = Array.from(new Set((ids || []).map(function (id) {
1316
1422
  return Number(id);
1317
1423
  }).filter(function (id) {
1318
1424
  return Number.isFinite(id);
1319
1425
  })));
1320
- _context18.next = 3;
1426
+ _context20.next = 3;
1321
1427
  return this.store.products.getProductByIds(normalizedIds);
1322
1428
  case 3:
1323
- _context18.t0 = _context18.sent;
1324
- if (_context18.t0) {
1325
- _context18.next = 6;
1429
+ _context20.t0 = _context20.sent;
1430
+ if (_context20.t0) {
1431
+ _context20.next = 6;
1326
1432
  break;
1327
1433
  }
1328
- _context18.t0 = [];
1434
+ _context20.t0 = [];
1329
1435
  case 6:
1330
- localProducts = _context18.t0;
1436
+ localProducts = _context20.t0;
1331
1437
  if (options !== null && options !== void 0 && options.loadMissing) {
1332
- _context18.next = 9;
1438
+ _context20.next = 9;
1333
1439
  break;
1334
1440
  }
1335
- return _context18.abrupt("return", localProducts);
1441
+ return _context20.abrupt("return", localProducts);
1336
1442
  case 9:
1337
1443
  localProductIds = new Set(localProducts.map(function (product) {
1338
1444
  return Number(product.id);
@@ -1341,15 +1447,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1341
1447
  return !localProductIds.has(id);
1342
1448
  });
1343
1449
  if (missingIds.length) {
1344
- _context18.next = 13;
1450
+ _context20.next = 13;
1345
1451
  break;
1346
1452
  }
1347
- return _context18.abrupt("return", localProducts);
1453
+ return _context20.abrupt("return", localProducts);
1348
1454
  case 13:
1349
1455
  rawBookingDate = this.getBookingDate();
1350
1456
  bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
1351
1457
  customerId = Number((_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$getOrderCustome3 = this.getOrderCustomer()) === null || _this$getOrderCustome3 === void 0 ? void 0 : _this$getOrderCustome3.customer_id);
1352
- _context18.next = 18;
1458
+ _context20.next = 18;
1353
1459
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
1354
1460
  product_ids: missingIds,
1355
1461
  with_count: ['bundleGroup', 'optionGroup'],
@@ -1362,7 +1468,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1362
1468
  customer_id: customerId
1363
1469
  } : {}));
1364
1470
  case 18:
1365
- loadedProducts = _context18.sent;
1471
+ loadedProducts = _context20.sent;
1366
1472
  productById = new Map();
1367
1473
  [].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
1368
1474
  var productId = Number(product.id);
@@ -1370,16 +1476,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1370
1476
  productById.set(productId, product);
1371
1477
  }
1372
1478
  });
1373
- return _context18.abrupt("return", normalizedIds.map(function (id) {
1479
+ return _context20.abrupt("return", normalizedIds.map(function (id) {
1374
1480
  return productById.get(id);
1375
1481
  }).filter(function (product) {
1376
1482
  return Boolean(product);
1377
1483
  }));
1378
1484
  case 22:
1379
1485
  case "end":
1380
- return _context18.stop();
1486
+ return _context20.stop();
1381
1487
  }
1382
- }, _callee18, this);
1488
+ }, _callee20, this);
1383
1489
  }));
1384
1490
  function getProductByIds(_x13, _x14) {
1385
1491
  return _getProductByIds.apply(this, arguments);
@@ -1395,25 +1501,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1395
1501
  }, {
1396
1502
  key: "getScheduleTimePoints",
1397
1503
  value: (function () {
1398
- var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
1504
+ var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1399
1505
  var result;
1400
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1401
- while (1) switch (_context19.prev = _context19.next) {
1506
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1507
+ while (1) switch (_context21.prev = _context21.next) {
1402
1508
  case 0:
1403
- _context19.next = 2;
1509
+ _context21.next = 2;
1404
1510
  return this.request.post('/menu/schedule-time-points', {
1405
1511
  menu_list_ids: params.menu_list_ids
1406
1512
  }, {
1407
1513
  osServer: true
1408
1514
  });
1409
1515
  case 2:
1410
- result = _context19.sent;
1411
- return _context19.abrupt("return", result.data || []);
1516
+ result = _context21.sent;
1517
+ return _context21.abrupt("return", result.data || []);
1412
1518
  case 4:
1413
1519
  case "end":
1414
- return _context19.stop();
1520
+ return _context21.stop();
1415
1521
  }
1416
- }, _callee19, this);
1522
+ }, _callee21, this);
1417
1523
  }));
1418
1524
  function getScheduleTimePoints(_x15) {
1419
1525
  return _getScheduleTimePoints.apply(this, arguments);
@@ -1429,30 +1535,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1429
1535
  }, {
1430
1536
  key: "getCustomerList",
1431
1537
  value: (function () {
1432
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1538
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1433
1539
  var params,
1434
1540
  _result3,
1435
- _args20 = arguments;
1436
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1437
- while (1) switch (_context20.prev = _context20.next) {
1541
+ _args22 = arguments;
1542
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1543
+ while (1) switch (_context22.prev = _context22.next) {
1438
1544
  case 0:
1439
- params = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
1440
- _context20.prev = 1;
1441
- _context20.next = 4;
1545
+ params = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
1546
+ _context22.prev = 1;
1547
+ _context22.next = 4;
1442
1548
  return this.store.customer.getCustomerList(params);
1443
1549
  case 4:
1444
- _result3 = _context20.sent;
1445
- return _context20.abrupt("return", _result3);
1550
+ _result3 = _context22.sent;
1551
+ return _context22.abrupt("return", _result3);
1446
1552
  case 8:
1447
- _context20.prev = 8;
1448
- _context20.t0 = _context20["catch"](1);
1449
- console.error('Failed to get customer list:', _context20.t0);
1450
- throw _context20.t0;
1553
+ _context22.prev = 8;
1554
+ _context22.t0 = _context22["catch"](1);
1555
+ console.error('Failed to get customer list:', _context22.t0);
1556
+ throw _context22.t0;
1451
1557
  case 12:
1452
1558
  case "end":
1453
- return _context20.stop();
1559
+ return _context22.stop();
1454
1560
  }
1455
- }, _callee20, this, [[1, 8]]);
1561
+ }, _callee22, this, [[1, 8]]);
1456
1562
  }));
1457
1563
  function getCustomerList() {
1458
1564
  return _getCustomerList.apply(this, arguments);
@@ -1558,7 +1664,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1558
1664
  */
1559
1665
  }, {
1560
1666
  key: "setOrderCustomer",
1561
- value: function setOrderCustomer(customer) {
1667
+ value: function setOrderCustomer(customer, options) {
1562
1668
  var _this$store$order$get3,
1563
1669
  _this3 = this;
1564
1670
  if (!customer) {
@@ -1581,12 +1687,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1581
1687
  var snapshotReplenished = !snapshotBeforeSet && Boolean(snapshotAfterOrderSet);
1582
1688
  if (snapshotReplenished) {
1583
1689
  var _next2 = this.buildOrderCustomerPayload();
1584
- this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), _next2);
1690
+ this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), _next2 && options !== null && options !== void 0 && options.source ? _objectSpread(_objectSpread({}, _next2), {}, {
1691
+ source: options.source
1692
+ }) : _next2);
1585
1693
  }
1586
1694
  return;
1587
1695
  }
1588
1696
  var next = this.buildOrderCustomerPayload();
1589
- this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), next);
1697
+ this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), next && options !== null && options !== void 0 && options.source ? _objectSpread(_objectSpread({}, next), {}, {
1698
+ source: options.source
1699
+ }) : next);
1590
1700
  this.refreshDiscountConfigAfterOrderCustomerChange(patch.customer_id);
1591
1701
  // 客户切换可能改变可用促销/赠品;触发一次重算(recursion-safe)。
1592
1702
  var promotionRefreshTask = this.store.order.applyPromotion().then(function () {
@@ -1668,24 +1778,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1668
1778
  }, {
1669
1779
  key: "restoreOrder",
1670
1780
  value: (function () {
1671
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1781
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1672
1782
  var _this$store$customer;
1673
1783
  var tempOrder;
1674
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1675
- while (1) switch (_context21.prev = _context21.next) {
1784
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1785
+ while (1) switch (_context23.prev = _context23.next) {
1676
1786
  case 0:
1677
- _context21.next = 2;
1787
+ _context23.next = 2;
1678
1788
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
1679
1789
  case 2:
1680
- tempOrder = _context21.sent;
1790
+ tempOrder = _context23.sent;
1681
1791
  this.clearOrderCustomer();
1682
1792
  (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
1683
- return _context21.abrupt("return", tempOrder);
1793
+ return _context23.abrupt("return", tempOrder);
1684
1794
  case 6:
1685
1795
  case "end":
1686
- return _context21.stop();
1796
+ return _context23.stop();
1687
1797
  }
1688
- }, _callee21, this);
1798
+ }, _callee23, this);
1689
1799
  }));
1690
1800
  function restoreOrder() {
1691
1801
  return _restoreOrder.apply(this, arguments);
@@ -1711,41 +1821,41 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1711
1821
  return this.orderCustomerDiscountRefreshInFlight;
1712
1822
  }
1713
1823
  var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
1714
- var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1824
+ var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1715
1825
  var _this5$store$order$ge, _this5$store$order, _this5$getOrderIdenti;
1716
1826
  var currentCustomer, tempOrder, orderId, action;
1717
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1718
- while (1) switch (_context22.prev = _context22.next) {
1827
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1828
+ while (1) switch (_context24.prev = _context24.next) {
1719
1829
  case 0:
1720
1830
  if (!previousRefresh) {
1721
- _context22.next = 3;
1831
+ _context24.next = 3;
1722
1832
  break;
1723
1833
  }
1724
- _context22.next = 3;
1834
+ _context24.next = 3;
1725
1835
  return previousRefresh.catch(function () {
1726
1836
  return undefined;
1727
1837
  });
1728
1838
  case 3:
1729
1839
  currentCustomer = _this5.store.order.getOrderCustomer();
1730
1840
  if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
1731
- _context22.next = 6;
1841
+ _context24.next = 6;
1732
1842
  break;
1733
1843
  }
1734
- return _context22.abrupt("return");
1844
+ return _context24.abrupt("return");
1735
1845
  case 6:
1736
1846
  tempOrder = (_this5$store$order$ge = (_this5$store$order = _this5.store.order).getTempOrder) === null || _this5$store$order$ge === void 0 ? void 0 : _this5$store$order$ge.call(_this5$store$order);
1737
1847
  orderId = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || ((_this5$getOrderIdenti = _this5.getOrderIdentity) === null || _this5$getOrderIdenti === void 0 || (_this5$getOrderIdenti = _this5$getOrderIdenti.call(_this5)) === null || _this5$getOrderIdenti === void 0 ? void 0 : _this5$getOrderIdenti.orderId);
1738
1848
  action = !orderId || String(orderId).startsWith('local_order') ? 'create' : 'edit';
1739
- _context22.next = 11;
1849
+ _context24.next = 11;
1740
1850
  return _this5.loadDiscountConfig({
1741
1851
  customerId: customerId,
1742
1852
  action: action
1743
1853
  });
1744
1854
  case 11:
1745
1855
  case "end":
1746
- return _context22.stop();
1856
+ return _context24.stop();
1747
1857
  }
1748
- }, _callee22);
1858
+ }, _callee24);
1749
1859
  }))();
1750
1860
  this.orderCustomerDiscountRefreshInFlight = refreshTask;
1751
1861
  this.orderCustomerDiscountRefreshCustomerId = customerId;
@@ -1766,28 +1876,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1766
1876
  }, {
1767
1877
  key: "prepareProductPriceQueryContext",
1768
1878
  value: function () {
1769
- var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(customerId) {
1879
+ var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(customerId) {
1770
1880
  var normalizedCustomerId, refreshTask, shouldWait;
1771
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1772
- while (1) switch (_context23.prev = _context23.next) {
1881
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1882
+ while (1) switch (_context25.prev = _context25.next) {
1773
1883
  case 0:
1774
- _context23.next = 2;
1884
+ _context25.next = 2;
1775
1885
  return Promise.resolve();
1776
1886
  case 2:
1777
1887
  normalizedCustomerId = Number(customerId || 0);
1778
1888
  refreshTask = this.orderCustomerDiscountRefreshInFlight;
1779
1889
  shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
1780
1890
  if (!(shouldWait && refreshTask)) {
1781
- _context23.next = 8;
1891
+ _context25.next = 8;
1782
1892
  break;
1783
1893
  }
1784
- _context23.next = 8;
1894
+ _context25.next = 8;
1785
1895
  return refreshTask;
1786
1896
  case 8:
1787
1897
  case "end":
1788
- return _context23.stop();
1898
+ return _context25.stop();
1789
1899
  }
1790
- }, _callee23, this);
1900
+ }, _callee25, this);
1791
1901
  }));
1792
1902
  function prepareProductPriceQueryContext(_x16) {
1793
1903
  return _prepareProductPriceQueryContext.apply(this, arguments);
@@ -1842,27 +1952,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1842
1952
  }, {
1843
1953
  key: "changeCustomerPage",
1844
1954
  value: (function () {
1845
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(page, pageSize) {
1955
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(page, pageSize) {
1846
1956
  var _result4;
1847
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1848
- while (1) switch (_context24.prev = _context24.next) {
1957
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1958
+ while (1) switch (_context26.prev = _context26.next) {
1849
1959
  case 0:
1850
- _context24.prev = 0;
1851
- _context24.next = 3;
1960
+ _context26.prev = 0;
1961
+ _context26.next = 3;
1852
1962
  return this.store.customer.changeCustomerPage(page, pageSize);
1853
1963
  case 3:
1854
- _result4 = _context24.sent;
1855
- return _context24.abrupt("return", _result4);
1964
+ _result4 = _context26.sent;
1965
+ return _context26.abrupt("return", _result4);
1856
1966
  case 7:
1857
- _context24.prev = 7;
1858
- _context24.t0 = _context24["catch"](0);
1859
- console.error('Failed to change customer page:', _context24.t0);
1860
- throw _context24.t0;
1967
+ _context26.prev = 7;
1968
+ _context26.t0 = _context26["catch"](0);
1969
+ console.error('Failed to change customer page:', _context26.t0);
1970
+ throw _context26.t0;
1861
1971
  case 11:
1862
1972
  case "end":
1863
- return _context24.stop();
1973
+ return _context26.stop();
1864
1974
  }
1865
- }, _callee24, this, [[0, 7]]);
1975
+ }, _callee26, this, [[0, 7]]);
1866
1976
  }));
1867
1977
  function changeCustomerPage(_x17, _x18) {
1868
1978
  return _changeCustomerPage.apply(this, arguments);
@@ -1877,28 +1987,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1877
1987
  }, {
1878
1988
  key: "loadMoreCustomers",
1879
1989
  value: (function () {
1880
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1990
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
1881
1991
  var _result5;
1882
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1883
- while (1) switch (_context25.prev = _context25.next) {
1992
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1993
+ while (1) switch (_context27.prev = _context27.next) {
1884
1994
  case 0:
1885
- _context25.prev = 0;
1886
- _context25.next = 3;
1995
+ _context27.prev = 0;
1996
+ _context27.next = 3;
1887
1997
  return this.store.customer.loadMoreCustomers();
1888
1998
  case 3:
1889
- _result5 = _context25.sent;
1999
+ _result5 = _context27.sent;
1890
2000
  this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
1891
- return _context25.abrupt("return", _result5);
2001
+ return _context27.abrupt("return", _result5);
1892
2002
  case 8:
1893
- _context25.prev = 8;
1894
- _context25.t0 = _context25["catch"](0);
1895
- console.error('Failed to load more customers:', _context25.t0);
1896
- throw _context25.t0;
2003
+ _context27.prev = 8;
2004
+ _context27.t0 = _context27["catch"](0);
2005
+ console.error('Failed to load more customers:', _context27.t0);
2006
+ throw _context27.t0;
1897
2007
  case 12:
1898
2008
  case "end":
1899
- return _context25.stop();
2009
+ return _context27.stop();
1900
2010
  }
1901
- }, _callee25, this, [[0, 8]]);
2011
+ }, _callee27, this, [[0, 8]]);
1902
2012
  }));
1903
2013
  function loadMoreCustomers() {
1904
2014
  return _loadMoreCustomers.apply(this, arguments);
@@ -1914,31 +2024,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1914
2024
  }, {
1915
2025
  key: "resetAndLoadCustomers",
1916
2026
  value: (function () {
1917
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2027
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
1918
2028
  var params,
1919
2029
  _result6,
1920
- _args26 = arguments;
1921
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1922
- while (1) switch (_context26.prev = _context26.next) {
2030
+ _args28 = arguments;
2031
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2032
+ while (1) switch (_context28.prev = _context28.next) {
1923
2033
  case 0:
1924
- params = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : {};
1925
- _context26.prev = 1;
1926
- _context26.next = 4;
2034
+ params = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {};
2035
+ _context28.prev = 1;
2036
+ _context28.next = 4;
1927
2037
  return this.store.customer.resetAndLoadCustomers(params);
1928
2038
  case 4:
1929
- _result6 = _context26.sent;
2039
+ _result6 = _context28.sent;
1930
2040
  this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
1931
- return _context26.abrupt("return", _result6);
2041
+ return _context28.abrupt("return", _result6);
1932
2042
  case 9:
1933
- _context26.prev = 9;
1934
- _context26.t0 = _context26["catch"](1);
1935
- console.error('Failed to reset and load customers:', _context26.t0);
1936
- throw _context26.t0;
2043
+ _context28.prev = 9;
2044
+ _context28.t0 = _context28["catch"](1);
2045
+ console.error('Failed to reset and load customers:', _context28.t0);
2046
+ throw _context28.t0;
1937
2047
  case 13:
1938
2048
  case "end":
1939
- return _context26.stop();
2049
+ return _context28.stop();
1940
2050
  }
1941
- }, _callee26, this, [[1, 9]]);
2051
+ }, _callee28, this, [[1, 9]]);
1942
2052
  }));
1943
2053
  function resetAndLoadCustomers() {
1944
2054
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -2099,16 +2209,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2099
2209
  }, {
2100
2210
  key: "getOtherParams",
2101
2211
  value: (function () {
2102
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2103
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2104
- while (1) switch (_context27.prev = _context27.next) {
2212
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2213
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2214
+ while (1) switch (_context29.prev = _context29.next) {
2105
2215
  case 0:
2106
- return _context27.abrupt("return", this.otherParams);
2216
+ return _context29.abrupt("return", this.otherParams);
2107
2217
  case 1:
2108
2218
  case "end":
2109
- return _context27.stop();
2219
+ return _context29.stop();
2110
2220
  }
2111
- }, _callee27, this);
2221
+ }, _callee29, this);
2112
2222
  }));
2113
2223
  function getOtherParams() {
2114
2224
  return _getOtherParams.apply(this, arguments);
@@ -2429,16 +2539,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2429
2539
  }, {
2430
2540
  key: "updateProductInOrder",
2431
2541
  value: (function () {
2432
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
2433
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2434
- while (1) switch (_context28.prev = _context28.next) {
2542
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
2543
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2544
+ while (1) switch (_context30.prev = _context30.next) {
2435
2545
  case 0:
2436
- return _context28.abrupt("return", this.updateOrderProduct(params));
2546
+ return _context30.abrupt("return", this.updateOrderProduct(params));
2437
2547
  case 1:
2438
2548
  case "end":
2439
- return _context28.stop();
2549
+ return _context30.stop();
2440
2550
  }
2441
- }, _callee28, this);
2551
+ }, _callee30, this);
2442
2552
  }));
2443
2553
  function updateProductInOrder(_x19) {
2444
2554
  return _updateProductInOrder.apply(this, arguments);
@@ -2462,47 +2572,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2462
2572
  }, {
2463
2573
  key: "handleGlobalScanCode",
2464
2574
  value: (function () {
2465
- var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(code, bridge) {
2575
+ var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(code, bridge) {
2466
2576
  var _this7 = this;
2467
2577
  var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
2468
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2469
- while (1) switch (_context29.prev = _context29.next) {
2578
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2579
+ while (1) switch (_context31.prev = _context31.next) {
2470
2580
  case 0:
2471
2581
  trimmed = typeof code === 'string' ? code.trim() : '';
2472
2582
  if (trimmed) {
2473
- _context29.next = 4;
2583
+ _context31.next = 4;
2474
2584
  break;
2475
2585
  }
2476
2586
  bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2477
- return _context29.abrupt("return", {
2587
+ return _context31.abrupt("return", {
2478
2588
  status: 'failed',
2479
2589
  reason: 'empty_code'
2480
2590
  });
2481
2591
  case 4:
2482
- _context29.prev = 4;
2592
+ _context31.prev = 4;
2483
2593
  localSearch = function localSearch(v) {
2484
2594
  return _this7.store.products.findProductsByCodeOrBarcode(v);
2485
2595
  };
2486
2596
  scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
2487
- _context29.next = 9;
2597
+ _context31.next = 9;
2488
2598
  return scanCallback({
2489
2599
  type: 'nativeScanner',
2490
2600
  value: trimmed
2491
2601
  });
2492
2602
  case 9:
2493
- raw = _context29.sent;
2603
+ raw = _context31.sent;
2494
2604
  formatted = formatGlobalScanResult(raw, trimmed);
2495
2605
  if (formatted) {
2496
- _context29.next = 14;
2606
+ _context31.next = 14;
2497
2607
  break;
2498
2608
  }
2499
2609
  bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2500
- return _context29.abrupt("return", {
2610
+ return _context31.abrupt("return", {
2501
2611
  status: 'failed',
2502
2612
  reason: 'not_found'
2503
2613
  });
2504
2614
  case 14:
2505
- _context29.next = 16;
2615
+ _context31.next = 16;
2506
2616
  return applyGlobalScan({
2507
2617
  setOrderCustomer: function setOrderCustomer(customer) {
2508
2618
  return _this7.setOrderCustomer(customer);
@@ -2537,23 +2647,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2537
2647
  }
2538
2648
  }, formatted, bridge);
2539
2649
  case 16:
2540
- _result7 = _context29.sent;
2650
+ _result7 = _context31.sent;
2541
2651
  bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
2542
- return _context29.abrupt("return", _result7);
2652
+ return _context31.abrupt("return", _result7);
2543
2653
  case 21:
2544
- _context29.prev = 21;
2545
- _context29.t0 = _context29["catch"](4);
2546
- console.error('[BookingTicket] handleGlobalScanCode failed', _context29.t0);
2654
+ _context31.prev = 21;
2655
+ _context31.t0 = _context31["catch"](4);
2656
+ console.error('[BookingTicket] handleGlobalScanCode failed', _context31.t0);
2547
2657
  bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2548
- return _context29.abrupt("return", {
2658
+ return _context31.abrupt("return", {
2549
2659
  status: 'failed',
2550
2660
  reason: 'not_found'
2551
2661
  });
2552
2662
  case 26:
2553
2663
  case "end":
2554
- return _context29.stop();
2664
+ return _context31.stop();
2555
2665
  }
2556
- }, _callee29, this, [[4, 21]]);
2666
+ }, _callee31, this, [[4, 21]]);
2557
2667
  }));
2558
2668
  function handleGlobalScanCode(_x20, _x21) {
2559
2669
  return _handleGlobalScanCode.apply(this, arguments);
@@ -2637,11 +2747,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2637
2747
  }, {
2638
2748
  key: "addAddTimeProductToBooking",
2639
2749
  value: (function () {
2640
- var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(input) {
2641
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2642
- while (1) switch (_context30.prev = _context30.next) {
2750
+ var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(input) {
2751
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2752
+ while (1) switch (_context32.prev = _context32.next) {
2643
2753
  case 0:
2644
- return _context30.abrupt("return", this.addAddTimeProductsToBooking({
2754
+ return _context32.abrupt("return", this.addAddTimeProductsToBooking({
2645
2755
  booking: input.booking,
2646
2756
  products: [input],
2647
2757
  coveredMinutes: input.coveredMinutes,
@@ -2649,9 +2759,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2649
2759
  }));
2650
2760
  case 1:
2651
2761
  case "end":
2652
- return _context30.stop();
2762
+ return _context32.stop();
2653
2763
  }
2654
- }, _callee30, this);
2764
+ }, _callee32, this);
2655
2765
  }));
2656
2766
  function addAddTimeProductToBooking(_x22) {
2657
2767
  return _addAddTimeProductToBooking.apply(this, arguments);
@@ -2671,16 +2781,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2671
2781
  }, {
2672
2782
  key: "addAddTimeProductsToBooking",
2673
2783
  value: (function () {
2674
- var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(input) {
2784
+ var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(input) {
2675
2785
  var _this8 = this,
2676
2786
  _input$bookingPatch;
2677
2787
  var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
2678
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2679
- while (1) switch (_context31.prev = _context31.next) {
2788
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2789
+ while (1) switch (_context33.prev = _context33.next) {
2680
2790
  case 0:
2681
2791
  bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
2682
2792
  if (bookingUid) {
2683
- _context31.next = 3;
2793
+ _context33.next = 3;
2684
2794
  break;
2685
2795
  }
2686
2796
  throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
@@ -2691,7 +2801,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2691
2801
  };
2692
2802
  });
2693
2803
  if (this.store.order) {
2694
- _context31.next = 6;
2804
+ _context33.next = 6;
2695
2805
  break;
2696
2806
  }
2697
2807
  throw new Error('order 模块未初始化');
@@ -2705,53 +2815,53 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2705
2815
  });
2706
2816
  }
2707
2817
  if (!(typeof this.store.order.addProductsToOrder === 'function')) {
2708
- _context31.next = 11;
2818
+ _context33.next = 11;
2709
2819
  break;
2710
2820
  }
2711
- return _context31.abrupt("return", this.store.order.addProductsToOrder(orderLines));
2821
+ return _context33.abrupt("return", this.store.order.addProductsToOrder(orderLines));
2712
2822
  case 11:
2713
2823
  result = [];
2714
2824
  _iterator2 = _createForOfIteratorHelper(orderLines);
2715
- _context31.prev = 13;
2825
+ _context33.prev = 13;
2716
2826
  _iterator2.s();
2717
2827
  case 15:
2718
2828
  if ((_step2 = _iterator2.n()).done) {
2719
- _context31.next = 29;
2829
+ _context33.next = 29;
2720
2830
  break;
2721
2831
  }
2722
2832
  line = _step2.value;
2723
- _context31.t0 = result.splice;
2724
- _context31.t1 = result;
2725
- _context31.t2 = [0, result.length];
2726
- _context31.t3 = _toConsumableArray;
2727
- _context31.next = 23;
2833
+ _context33.t0 = result.splice;
2834
+ _context33.t1 = result;
2835
+ _context33.t2 = [0, result.length];
2836
+ _context33.t3 = _toConsumableArray;
2837
+ _context33.next = 23;
2728
2838
  return this.addProductToOrder(line.product);
2729
2839
  case 23:
2730
- _context31.t4 = _context31.sent;
2731
- _context31.t5 = (0, _context31.t3)(_context31.t4);
2732
- _context31.t6 = _context31.t2.concat.call(_context31.t2, _context31.t5);
2733
- _context31.t0.apply.call(_context31.t0, _context31.t1, _context31.t6);
2840
+ _context33.t4 = _context33.sent;
2841
+ _context33.t5 = (0, _context33.t3)(_context33.t4);
2842
+ _context33.t6 = _context33.t2.concat.call(_context33.t2, _context33.t5);
2843
+ _context33.t0.apply.call(_context33.t0, _context33.t1, _context33.t6);
2734
2844
  case 27:
2735
- _context31.next = 15;
2845
+ _context33.next = 15;
2736
2846
  break;
2737
2847
  case 29:
2738
- _context31.next = 34;
2848
+ _context33.next = 34;
2739
2849
  break;
2740
2850
  case 31:
2741
- _context31.prev = 31;
2742
- _context31.t7 = _context31["catch"](13);
2743
- _iterator2.e(_context31.t7);
2851
+ _context33.prev = 31;
2852
+ _context33.t7 = _context33["catch"](13);
2853
+ _iterator2.e(_context33.t7);
2744
2854
  case 34:
2745
- _context31.prev = 34;
2855
+ _context33.prev = 34;
2746
2856
  _iterator2.f();
2747
- return _context31.finish(34);
2857
+ return _context33.finish(34);
2748
2858
  case 37:
2749
- return _context31.abrupt("return", result);
2859
+ return _context33.abrupt("return", result);
2750
2860
  case 38:
2751
2861
  case "end":
2752
- return _context31.stop();
2862
+ return _context33.stop();
2753
2863
  }
2754
- }, _callee31, this, [[13, 31, 34, 37]]);
2864
+ }, _callee33, this, [[13, 31, 34, 37]]);
2755
2865
  }));
2756
2866
  function addAddTimeProductsToBooking(_x23) {
2757
2867
  return _addAddTimeProductsToBooking.apply(this, arguments);
@@ -2761,31 +2871,41 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2761
2871
  }, {
2762
2872
  key: "setOtherParams",
2763
2873
  value: function () {
2764
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
2874
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
2765
2875
  var _ref19,
2766
2876
  _ref19$cover,
2767
2877
  cover,
2768
- _args32 = arguments;
2769
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2770
- while (1) switch (_context32.prev = _context32.next) {
2878
+ _args34 = arguments;
2879
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2880
+ while (1) switch (_context34.prev = _context34.next) {
2771
2881
  case 0:
2772
- _ref19 = _args32.length > 1 && _args32[1] !== undefined ? _args32[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
2773
- _context32.next = 3;
2882
+ _ref19 = _args34.length > 1 && _args34[1] !== undefined ? _args34[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
2883
+ _context34.next = 3;
2774
2884
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2775
2885
  cover: cover
2776
2886
  });
2777
2887
  case 3:
2778
2888
  if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
2779
- _context32.next = 6;
2889
+ _context34.next = 8;
2780
2890
  break;
2781
2891
  }
2782
- _context32.next = 6;
2892
+ _context34.next = 6;
2783
2893
  return this.configureIdGeneratorFromOpenData();
2784
2894
  case 6:
2895
+ _context34.next = 11;
2896
+ break;
2897
+ case 8:
2898
+ if (!((params === null || params === void 0 ? void 0 : params.channel) !== undefined)) {
2899
+ _context34.next = 11;
2900
+ break;
2901
+ }
2902
+ _context34.next = 11;
2903
+ return this.loadOpenDataConfig();
2904
+ case 11:
2785
2905
  case "end":
2786
- return _context32.stop();
2906
+ return _context34.stop();
2787
2907
  }
2788
- }, _callee32, this);
2908
+ }, _callee34, this);
2789
2909
  }));
2790
2910
  function setOtherParams(_x24) {
2791
2911
  return _setOtherParams.apply(this, arguments);
@@ -2804,15 +2924,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2804
2924
  }, {
2805
2925
  key: "handlePrintWristband",
2806
2926
  value: function () {
2807
- var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
2927
+ var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
2808
2928
  var _this$getOrderIdentit;
2809
2929
  var deviceTask, deviceId, idempotencyKey;
2810
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2811
- while (1) switch (_context33.prev = _context33.next) {
2930
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2931
+ while (1) switch (_context35.prev = _context35.next) {
2812
2932
  case 0:
2813
2933
  deviceTask = this.getDeviceTaskPlugin();
2814
2934
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
2815
- _context33.next = 4;
2935
+ _context35.next = 4;
2816
2936
  break;
2817
2937
  }
2818
2938
  this.logger.addLog({
@@ -2822,7 +2942,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2822
2942
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
2823
2943
  }
2824
2944
  });
2825
- return _context33.abrupt("return");
2945
+ return _context35.abrupt("return");
2826
2946
  case 4:
2827
2947
  this.logger.addLog({
2828
2948
  type: 'info',
@@ -2831,10 +2951,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2831
2951
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
2832
2952
  }
2833
2953
  });
2834
- _context33.next = 7;
2954
+ _context35.next = 7;
2835
2955
  return this.getShortNumberOrDeviceId();
2836
2956
  case 7:
2837
- deviceId = _context33.sent;
2957
+ deviceId = _context35.sent;
2838
2958
  idempotencyKey = createUuidV4();
2839
2959
  deviceTask.dispatch({
2840
2960
  action: 'print_all',
@@ -2854,9 +2974,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2854
2974
  });
2855
2975
  case 10:
2856
2976
  case "end":
2857
- return _context33.stop();
2977
+ return _context35.stop();
2858
2978
  }
2859
- }, _callee33, this);
2979
+ }, _callee35, this);
2860
2980
  }));
2861
2981
  function handlePrintWristband(_x25) {
2862
2982
  return _handlePrintWristband.apply(this, arguments);
@@ -2866,11 +2986,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2866
2986
  }, {
2867
2987
  key: "handleRedeem",
2868
2988
  value: function () {
2869
- var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
2989
+ var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
2870
2990
  var _this$store$order5, _this$store$order5$ge, _this$store$order6, _ref20, _tempOrder$order_id2;
2871
2991
  var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
2872
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2873
- while (1) switch (_context34.prev = _context34.next) {
2992
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2993
+ while (1) switch (_context36.prev = _context36.next) {
2874
2994
  case 0:
2875
2995
  voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
2876
2996
  status = params.is_checkin ? 'used' : 'unused';
@@ -2894,20 +3014,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2894
3014
  });
2895
3015
  });
2896
3016
  if (!(tempOrder && hasUpdatedVoucher)) {
2897
- _context34.next = 11;
3017
+ _context36.next = 11;
2898
3018
  break;
2899
3019
  }
2900
- _context34.next = 11;
3020
+ _context36.next = 11;
2901
3021
  return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
2902
3022
  vouchers: nextVouchers
2903
3023
  }));
2904
3024
  case 11:
2905
3025
  this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
2906
3026
  if (!(voucherIds.length === 0)) {
2907
- _context34.next = 14;
3027
+ _context36.next = 14;
2908
3028
  break;
2909
3029
  }
2910
- return _context34.abrupt("return", {
3030
+ return _context36.abrupt("return", {
2911
3031
  code: 200,
2912
3032
  status: true,
2913
3033
  message: '',
@@ -2918,7 +3038,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2918
3038
  externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
2919
3039
  orderId = (_ref20 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref20 !== void 0 ? _ref20 : undefined;
2920
3040
  orderLookup = externalSaleNumber || orderId || (identity === null || identity === void 0 ? void 0 : identity.orderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopFullOrderNumber) || undefined;
2921
- return _context34.abrupt("return", this.request.post('/machinecode/batch', {
3041
+ return _context36.abrupt("return", this.request.post('/machinecode/batch', {
2922
3042
  ids: voucherIds,
2923
3043
  status: status,
2924
3044
  order_lookup: orderLookup,
@@ -2929,9 +3049,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2929
3049
  }));
2930
3050
  case 19:
2931
3051
  case "end":
2932
- return _context34.stop();
3052
+ return _context36.stop();
2933
3053
  }
2934
- }, _callee34, this);
3054
+ }, _callee36, this);
2935
3055
  }));
2936
3056
  function handleRedeem(_x26) {
2937
3057
  return _handleRedeem.apply(this, arguments);
@@ -2945,12 +3065,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2945
3065
  }, {
2946
3066
  key: "destroy",
2947
3067
  value: (function () {
2948
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
3068
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
2949
3069
  var _this$scan;
2950
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2951
- while (1) switch (_context35.prev = _context35.next) {
3070
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3071
+ while (1) switch (_context37.prev = _context37.next) {
2952
3072
  case 0:
2953
- _context35.next = 2;
3073
+ _context37.next = 2;
2954
3074
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
2955
3075
  case 2:
2956
3076
  try {
@@ -2961,9 +3081,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2961
3081
  scanCache.clear();
2962
3082
  case 4:
2963
3083
  case "end":
2964
- return _context35.stop();
3084
+ return _context37.stop();
2965
3085
  }
2966
- }, _callee35, this);
3086
+ }, _callee37, this);
2967
3087
  }));
2968
3088
  function destroy() {
2969
3089
  return _destroy.apply(this, arguments);