@pisell/pisellos 0.0.567 → 0.0.569

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 (557) hide show
  1. package/dist/core/index.js +6 -9
  2. package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
  3. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
  4. package/dist/model/strategy/adapter/walletPass/example.js +3 -26
  5. package/dist/model/strategy/adapter/walletPass/utils.js +7 -7
  6. package/dist/model/strategy/strategy-example.js +5 -19
  7. package/dist/modules/BaseModule.d.ts +2 -2
  8. package/dist/modules/BaseModule.js +4 -4
  9. package/dist/modules/BookingContext/index.d.ts +48 -0
  10. package/dist/modules/BookingContext/index.js +566 -0
  11. package/dist/modules/BookingContext/types.d.ts +102 -0
  12. package/dist/modules/BookingContext/types.js +51 -0
  13. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  14. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
  15. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  16. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
  17. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  18. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
  19. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  20. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  21. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  22. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  23. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  24. package/dist/modules/BookingContext/utils/index.js +11 -0
  25. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  26. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  27. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  28. package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
  29. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  30. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  31. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  32. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  33. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  34. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  35. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  36. package/dist/modules/BookingContext/utils/resources.js +486 -0
  37. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  38. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  39. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  40. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  41. package/dist/modules/Cart/index.js +0 -3
  42. package/dist/modules/Cart/utils/cartProduct.js +26 -6
  43. package/dist/modules/Cart/utils/changePrice.js +27 -20
  44. package/dist/modules/Customer/index.d.ts +20 -0
  45. package/dist/modules/Customer/index.js +172 -83
  46. package/dist/modules/Customer/types.d.ts +2 -0
  47. package/dist/modules/Date/index.js +1 -5
  48. package/dist/modules/Discount/index.d.ts +2 -1
  49. package/dist/modules/Discount/index.js +37 -12
  50. package/dist/modules/Discount/types.d.ts +1 -0
  51. package/dist/modules/OpenData/index.d.ts +8 -0
  52. package/dist/modules/OpenData/index.js +35 -17
  53. package/dist/modules/Order/index.d.ts +449 -24
  54. package/dist/modules/Order/index.js +5437 -608
  55. package/dist/modules/Order/types.d.ts +693 -88
  56. package/dist/modules/Order/types.js +68 -1
  57. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  58. package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
  59. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  60. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  61. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  62. package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
  63. package/dist/modules/Order/utils.d.ts +167 -18
  64. package/dist/modules/Order/utils.js +960 -165
  65. package/dist/modules/Payment/index.d.ts +10 -9
  66. package/dist/modules/Payment/index.js +508 -874
  67. package/dist/modules/Payment/types.d.ts +40 -16
  68. package/dist/modules/Payment/utils.d.ts +1 -1
  69. package/dist/modules/Payment/utils.js +4 -3
  70. package/dist/modules/Payment/walletpass.js +48 -34
  71. package/dist/modules/Product/types.d.ts +29 -7
  72. package/dist/modules/ProductList/index.d.ts +17 -13
  73. package/dist/modules/ProductList/index.js +184 -74
  74. package/dist/modules/ProductList/types.d.ts +17 -0
  75. package/dist/modules/Quotation/index.d.ts +22 -2
  76. package/dist/modules/Quotation/index.js +108 -42
  77. package/dist/modules/Quotation/types.d.ts +19 -0
  78. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  79. package/dist/modules/ResourcePlanner/index.js +181 -0
  80. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  81. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  82. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  83. package/dist/modules/ResourcePlanner/types.js +1 -0
  84. package/dist/modules/Rules/index.d.ts +8 -10
  85. package/dist/modules/Rules/index.js +219 -114
  86. package/dist/modules/Rules/types.d.ts +14 -3
  87. package/dist/modules/SalesSummary/index.d.ts +23 -26
  88. package/dist/modules/SalesSummary/index.js +152 -46
  89. package/dist/modules/SalesSummary/types.d.ts +9 -1
  90. package/dist/modules/SalesSummary/utils.d.ts +3 -22
  91. package/dist/modules/SalesSummary/utils.js +803 -163
  92. package/dist/modules/Schedule/getDateIsInSchedule.js +14 -7
  93. package/dist/modules/Schedule/index.d.ts +18 -5
  94. package/dist/modules/Schedule/index.js +78 -24
  95. package/dist/modules/Schedule/types.d.ts +2 -0
  96. package/dist/modules/Schedule/utils.js +0 -1
  97. package/dist/modules/Step/index.js +0 -1
  98. package/dist/modules/Summary/index.js +4 -3
  99. package/dist/modules/SurchargeList/index.d.ts +18 -0
  100. package/dist/modules/SurchargeList/index.js +185 -0
  101. package/dist/modules/SurchargeList/types.d.ts +15 -0
  102. package/dist/modules/SurchargeList/types.js +1 -0
  103. package/dist/modules/index.d.ts +3 -0
  104. package/dist/modules/index.js +4 -1
  105. package/dist/plugins/app.d.ts +2 -0
  106. package/dist/plugins/request.d.ts +1 -0
  107. package/dist/plugins/request.js +1 -4
  108. package/dist/plugins/window.js +2 -6
  109. package/dist/server/index.d.ts +462 -8
  110. package/dist/server/index.js +6137 -714
  111. package/dist/server/modules/floor-plan/index.d.ts +39 -0
  112. package/dist/server/modules/floor-plan/index.js +595 -0
  113. package/dist/server/modules/floor-plan/types.d.ts +43 -0
  114. package/dist/server/modules/floor-plan/types.js +13 -0
  115. package/dist/server/modules/index.d.ts +7 -2
  116. package/dist/server/modules/index.js +6 -0
  117. package/dist/server/modules/menu/index.js +32 -41
  118. package/dist/server/modules/order/index.d.ts +207 -14
  119. package/dist/server/modules/order/index.js +2326 -379
  120. package/dist/server/modules/order/types.d.ts +76 -5
  121. package/dist/server/modules/order/types.js +14 -1
  122. package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
  123. package/dist/server/modules/order/utils/filterBookings.js +118 -11
  124. package/dist/server/modules/order/utils/filterOrders.js +242 -14
  125. package/dist/server/modules/payment/index.d.ts +28 -0
  126. package/dist/server/modules/payment/index.js +305 -0
  127. package/dist/server/modules/payment/types.d.ts +9 -0
  128. package/dist/server/modules/payment/types.js +1 -0
  129. package/dist/server/modules/products/index.d.ts +105 -14
  130. package/dist/server/modules/products/index.js +1397 -540
  131. package/dist/server/modules/products/types.d.ts +34 -1
  132. package/dist/server/modules/products/types.js +4 -0
  133. package/dist/server/modules/quotation/index.d.ts +39 -0
  134. package/dist/server/modules/quotation/index.js +289 -86
  135. package/dist/server/modules/resource/index.d.ts +2 -3
  136. package/dist/server/modules/resource/index.js +105 -84
  137. package/dist/server/modules/schedule/index.d.ts +6 -4
  138. package/dist/server/modules/schedule/index.js +137 -114
  139. package/dist/server/test.json +713 -0
  140. package/dist/server/types.d.ts +2 -0
  141. package/dist/server/utils/product.js +2 -3
  142. package/dist/server/utils/small-ticket.d.ts +71 -0
  143. package/dist/server/utils/small-ticket.js +963 -0
  144. package/dist/solution/BaseSales/index.d.ts +378 -0
  145. package/dist/solution/BaseSales/index.js +4006 -0
  146. package/dist/solution/BaseSales/types.d.ts +394 -0
  147. package/dist/solution/BaseSales/types.js +40 -0
  148. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  149. package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
  150. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
  151. package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
  152. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
  153. package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
  154. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
  155. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
  156. package/dist/solution/BaseSales/utils.d.ts +40 -0
  157. package/dist/solution/BaseSales/utils.js +263 -0
  158. package/dist/solution/BookingByStep/index.js +7 -59
  159. package/dist/solution/BookingByStep/utils/capacity.js +1 -11
  160. package/dist/solution/BookingByStep/utils/resources.js +1 -3
  161. package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
  162. package/dist/solution/BookingTicket/index.d.ts +393 -24
  163. package/dist/solution/BookingTicket/index.js +2506 -445
  164. package/dist/solution/BookingTicket/types.d.ts +191 -6
  165. package/dist/solution/BookingTicket/types.js +83 -10
  166. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  167. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  168. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  169. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  170. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  171. package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
  172. package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
  173. package/dist/solution/BookingTicket/utils/cartView.js +209 -0
  174. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  175. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  176. package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  177. package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
  178. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  179. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
  180. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  181. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
  182. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
  183. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +41 -1
  184. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  185. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
  186. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  187. package/dist/solution/BookingTicket/utils/scan/handleScan.js +36 -34
  188. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  189. package/dist/solution/BookingTicket/utils/scan/index.js +26 -18
  190. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  191. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
  192. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  193. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
  194. package/dist/solution/BuyTickets/index.js +9 -12
  195. package/dist/solution/Checkout/index.d.ts +1 -0
  196. package/dist/solution/Checkout/index.js +199 -277
  197. package/dist/solution/Checkout/utils/index.js +8 -20
  198. package/dist/solution/RegisterAndLogin/config.js +2 -10
  199. package/dist/solution/RegisterAndLogin/index.js +30 -76
  200. package/dist/solution/Sales/index.d.ts +50 -5
  201. package/dist/solution/Sales/index.js +484 -92
  202. package/dist/solution/Sales/types.d.ts +26 -2
  203. package/dist/solution/ScanOrder/index.d.ts +27 -21
  204. package/dist/solution/ScanOrder/index.js +509 -454
  205. package/dist/solution/ScanOrder/types.d.ts +33 -11
  206. package/dist/solution/ScanOrder/types.js +4 -5
  207. package/dist/solution/ScanOrder/utils.d.ts +4 -1
  208. package/dist/solution/ScanOrder/utils.js +109 -34
  209. package/dist/solution/ShopDiscount/index.js +6 -11
  210. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  211. package/dist/solution/UnifiedBookingSales/index.js +1871 -0
  212. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  213. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  214. package/dist/solution/VenueBooking/index.d.ts +34 -20
  215. package/dist/solution/VenueBooking/index.js +630 -505
  216. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  217. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  218. package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
  219. package/dist/solution/index.d.ts +2 -0
  220. package/dist/solution/index.js +3 -1
  221. package/dist/types/index.d.ts +11 -1
  222. package/dist/utils/task.js +15 -18
  223. package/dist/utils/watch.js +0 -1
  224. package/lib/apis/picoding.js +2 -0
  225. package/lib/core/index.js +130 -131
  226. package/lib/effects/index.js +46 -57
  227. package/lib/index.js +92 -53
  228. package/lib/model/index.js +14 -21
  229. package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
  230. package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
  231. package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
  232. package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
  233. package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
  234. package/lib/model/strategy/adapter/index.js +100 -64
  235. package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
  236. package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
  237. package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
  238. package/lib/model/strategy/adapter/itemRule/index.js +83 -57
  239. package/lib/model/strategy/adapter/itemRule/type.js +97 -36
  240. package/lib/model/strategy/adapter/promotion/adapter.js +84 -63
  241. package/lib/model/strategy/adapter/promotion/evaluator.js +383 -232
  242. package/lib/model/strategy/adapter/promotion/examples.js +139 -159
  243. package/lib/model/strategy/adapter/promotion/index.js +1 -49
  244. package/lib/model/strategy/adapter/promotion/type.js +199 -35
  245. package/lib/model/strategy/adapter/type.js +4 -16
  246. package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -152
  247. package/lib/model/strategy/adapter/walletPass/example.js +217 -190
  248. package/lib/model/strategy/adapter/walletPass/index.js +75 -51
  249. package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
  250. package/lib/model/strategy/adapter/walletPass/type.js +4 -16
  251. package/lib/model/strategy/adapter/walletPass/utils.js +654 -402
  252. package/lib/model/strategy/engine.js +270 -168
  253. package/lib/model/strategy/index.js +49 -34
  254. package/lib/model/strategy/strategy-example.js +243 -239
  255. package/lib/model/strategy/type.js +100 -40
  256. package/lib/modules/Account/index.js +39 -53
  257. package/lib/modules/Account/types.js +20 -33
  258. package/lib/modules/AccountList/index.js +116 -154
  259. package/lib/modules/AccountList/types.js +30 -31
  260. package/lib/modules/AccountList/utils.js +18 -30
  261. package/lib/modules/BaseModule.d.ts +2 -2
  262. package/lib/modules/BaseModule.js +26 -49
  263. package/lib/modules/BookingContext/index.d.ts +48 -0
  264. package/lib/modules/BookingContext/index.js +390 -0
  265. package/lib/modules/BookingContext/types.d.ts +102 -0
  266. package/lib/modules/BookingContext/types.js +48 -0
  267. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  268. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +286 -0
  269. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  270. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
  271. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  272. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +242 -0
  273. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  274. package/lib/modules/BookingContext/utils/flexible.js +63 -0
  275. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  276. package/lib/modules/BookingContext/utils/formatResourceList.js +35 -0
  277. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  278. package/lib/modules/BookingContext/utils/index.js +126 -0
  279. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  280. package/lib/modules/BookingContext/utils/noResource.js +78 -0
  281. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  282. package/lib/modules/BookingContext/utils/orderLineDisplay.js +29 -0
  283. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  284. package/lib/modules/BookingContext/utils/productExtend.js +330 -0
  285. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  286. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  287. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  288. package/lib/modules/BookingContext/utils/resourceSelection.js +24 -0
  289. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  290. package/lib/modules/BookingContext/utils/resources.js +419 -0
  291. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  292. package/lib/modules/BookingContext/utils/serviceTimes.js +161 -0
  293. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  294. package/lib/modules/BookingContext/utils/timeSlices.js +114 -0
  295. package/lib/modules/Cart/index.js +170 -124
  296. package/lib/modules/Cart/types.js +46 -51
  297. package/lib/modules/Cart/utils/cartAccount.js +40 -39
  298. package/lib/modules/Cart/utils/cartDate.js +56 -61
  299. package/lib/modules/Cart/utils/cartDiscount.js +28 -33
  300. package/lib/modules/Cart/utils/cartNote.js +27 -32
  301. package/lib/modules/Cart/utils/cartProduct.js +331 -244
  302. package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
  303. package/lib/modules/Cart/utils/cartResource.js +72 -78
  304. package/lib/modules/Cart/utils/changePrice.js +37 -67
  305. package/lib/modules/Cart/utils/index.js +106 -48
  306. package/lib/modules/Customer/constants.js +13 -34
  307. package/lib/modules/Customer/index.d.ts +20 -0
  308. package/lib/modules/Customer/index.js +270 -154
  309. package/lib/modules/Customer/types.d.ts +2 -0
  310. package/lib/modules/Customer/types.js +38 -35
  311. package/lib/modules/Date/index.js +116 -115
  312. package/lib/modules/Date/types.js +16 -28
  313. package/lib/modules/Date/utils.js +174 -123
  314. package/lib/modules/Discount/index.d.ts +2 -1
  315. package/lib/modules/Discount/index.js +133 -113
  316. package/lib/modules/Discount/types.d.ts +1 -0
  317. package/lib/modules/Discount/types.js +9 -31
  318. package/lib/modules/Guests/index.js +30 -56
  319. package/lib/modules/Guests/types.js +23 -33
  320. package/lib/modules/Holder/index.js +209 -189
  321. package/lib/modules/Holder/types.js +4 -16
  322. package/lib/modules/Holder/utils.js +20 -49
  323. package/lib/modules/OpenData/index.d.ts +8 -0
  324. package/lib/modules/OpenData/index.js +81 -74
  325. package/lib/modules/OpenData/types.js +4 -16
  326. package/lib/modules/OpenData/utils.js +44 -78
  327. package/lib/modules/Order/index.d.ts +449 -24
  328. package/lib/modules/Order/index.js +3834 -489
  329. package/lib/modules/Order/types.d.ts +693 -88
  330. package/lib/modules/Order/types.js +78 -33
  331. package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  332. package/lib/modules/Order/utils/bundleDiscountHydration.js +106 -0
  333. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  334. package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
  335. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  336. package/lib/modules/Order/utils/orderCollectionIdentity.js +353 -0
  337. package/lib/modules/Order/utils.d.ts +167 -18
  338. package/lib/modules/Order/utils.js +1247 -345
  339. package/lib/modules/Payment/cash.js +20 -33
  340. package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
  341. package/lib/modules/Payment/eftpos.js +16 -30
  342. package/lib/modules/Payment/index.d.ts +10 -9
  343. package/lib/modules/Payment/index.js +542 -502
  344. package/lib/modules/Payment/mx51.js +1 -0
  345. package/lib/modules/Payment/types.d.ts +40 -16
  346. package/lib/modules/Payment/types.js +216 -107
  347. package/lib/modules/Payment/utils.d.ts +1 -1
  348. package/lib/modules/Payment/utils.js +53 -49
  349. package/lib/modules/Payment/walletpass.js +231 -203
  350. package/lib/modules/Product/index.js +51 -46
  351. package/lib/modules/Product/types.d.ts +29 -7
  352. package/lib/modules/Product/types.js +4 -16
  353. package/lib/modules/Product/utils.js +32 -33
  354. package/lib/modules/ProductList/index.d.ts +17 -13
  355. package/lib/modules/ProductList/index.js +160 -118
  356. package/lib/modules/ProductList/types.d.ts +17 -0
  357. package/lib/modules/ProductList/types.js +9 -31
  358. package/lib/modules/Quotation/index.d.ts +22 -2
  359. package/lib/modules/Quotation/index.js +123 -89
  360. package/lib/modules/Quotation/types.d.ts +19 -0
  361. package/lib/modules/Quotation/types.js +4 -16
  362. package/lib/modules/Resource/index.js +27 -59
  363. package/lib/modules/Resource/types.js +22 -32
  364. package/lib/modules/Resource/utils.js +30 -38
  365. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  366. package/lib/modules/ResourcePlanner/index.js +147 -0
  367. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  368. package/lib/modules/ResourcePlanner/planner.js +895 -0
  369. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  370. package/lib/modules/ResourcePlanner/types.js +5 -0
  371. package/lib/modules/Rules/index.d.ts +8 -10
  372. package/lib/modules/Rules/index.js +1286 -894
  373. package/lib/modules/Rules/types.d.ts +14 -3
  374. package/lib/modules/Rules/types.js +17 -40
  375. package/lib/modules/SalesSummary/index.d.ts +23 -26
  376. package/lib/modules/SalesSummary/index.js +130 -71
  377. package/lib/modules/SalesSummary/types.d.ts +9 -1
  378. package/lib/modules/SalesSummary/types.js +4 -16
  379. package/lib/modules/SalesSummary/utils.d.ts +3 -22
  380. package/lib/modules/SalesSummary/utils.js +738 -250
  381. package/lib/modules/ScanOrderLogger/index.js +59 -79
  382. package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
  383. package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
  384. package/lib/modules/ScanOrderLogger/types.js +4 -16
  385. package/lib/modules/Schedule/getDateIsInSchedule.js +345 -171
  386. package/lib/modules/Schedule/index.d.ts +18 -5
  387. package/lib/modules/Schedule/index.js +139 -114
  388. package/lib/modules/Schedule/type.js +4 -16
  389. package/lib/modules/Schedule/types.d.ts +2 -0
  390. package/lib/modules/Schedule/types.js +4 -16
  391. package/lib/modules/Schedule/utils.js +433 -291
  392. package/lib/modules/Step/index.js +40 -52
  393. package/lib/modules/Step/tyeps.js +4 -16
  394. package/lib/modules/Summary/index.js +66 -70
  395. package/lib/modules/Summary/types.js +4 -16
  396. package/lib/modules/Summary/utils.js +782 -429
  397. package/lib/modules/SurchargeList/index.d.ts +18 -0
  398. package/lib/modules/SurchargeList/index.js +95 -0
  399. package/lib/modules/SurchargeList/types.d.ts +15 -0
  400. package/lib/modules/SurchargeList/types.js +5 -0
  401. package/lib/modules/index.d.ts +3 -0
  402. package/lib/modules/index.js +245 -57
  403. package/lib/plugins/app.d.ts +2 -0
  404. package/lib/plugins/app.js +4 -16
  405. package/lib/plugins/index.js +36 -25
  406. package/lib/plugins/request.d.ts +1 -0
  407. package/lib/plugins/request.js +137 -126
  408. package/lib/plugins/shopStore.js +4 -16
  409. package/lib/plugins/user.js +4 -16
  410. package/lib/plugins/window.js +171 -179
  411. package/lib/server/index.d.ts +462 -8
  412. package/lib/server/index.js +4668 -713
  413. package/lib/server/modules/floor-plan/index.d.ts +39 -0
  414. package/lib/server/modules/floor-plan/index.js +306 -0
  415. package/lib/server/modules/floor-plan/types.d.ts +43 -0
  416. package/lib/server/modules/floor-plan/types.js +19 -0
  417. package/lib/server/modules/index.d.ts +7 -2
  418. package/lib/server/modules/index.js +106 -59
  419. package/lib/server/modules/menu/index.js +146 -122
  420. package/lib/server/modules/menu/types.js +18 -31
  421. package/lib/server/modules/order/index.d.ts +207 -14
  422. package/lib/server/modules/order/index.js +1463 -316
  423. package/lib/server/modules/order/types.d.ts +76 -5
  424. package/lib/server/modules/order/types.js +117 -32
  425. package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
  426. package/lib/server/modules/order/utils/filterBookings.js +288 -146
  427. package/lib/server/modules/order/utils/filterOrders.js +318 -64
  428. package/lib/server/modules/payment/index.d.ts +28 -0
  429. package/lib/server/modules/payment/index.js +168 -0
  430. package/lib/server/modules/payment/types.d.ts +9 -0
  431. package/lib/server/modules/payment/types.js +5 -0
  432. package/lib/server/modules/products/index.d.ts +105 -14
  433. package/lib/server/modules/products/index.js +969 -383
  434. package/lib/server/modules/products/types.d.ts +34 -1
  435. package/lib/server/modules/products/types.js +44 -34
  436. package/lib/server/modules/quotation/index.d.ts +39 -0
  437. package/lib/server/modules/quotation/index.js +220 -77
  438. package/lib/server/modules/quotation/types.js +21 -31
  439. package/lib/server/modules/resource/index.d.ts +2 -3
  440. package/lib/server/modules/resource/index.js +269 -214
  441. package/lib/server/modules/resource/types.js +42 -33
  442. package/lib/server/modules/schedule/index.d.ts +6 -4
  443. package/lib/server/modules/schedule/index.js +158 -132
  444. package/lib/server/modules/schedule/types.js +14 -21
  445. package/lib/server/modules/schedule/utils.js +334 -163
  446. package/lib/server/test.json +713 -0
  447. package/lib/server/types.d.ts +2 -0
  448. package/lib/server/types.js +4 -16
  449. package/lib/server/utils/index.js +25 -23
  450. package/lib/server/utils/product.js +197 -140
  451. package/lib/server/utils/schedule.js +34 -41
  452. package/lib/server/utils/small-ticket.d.ts +71 -0
  453. package/lib/server/utils/small-ticket.js +926 -0
  454. package/lib/server/utils/time.js +40 -49
  455. package/lib/solution/BaseSales/index.d.ts +378 -0
  456. package/lib/solution/BaseSales/index.js +2367 -0
  457. package/lib/solution/BaseSales/types.d.ts +394 -0
  458. package/lib/solution/BaseSales/types.js +47 -0
  459. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  460. package/lib/solution/BaseSales/utils/cartPromotion.js +1155 -0
  461. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
  462. package/lib/solution/BaseSales/utils/parseSalesResponse.js +140 -0
  463. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
  464. package/lib/solution/BaseSales/utils/quotationPrice.js +231 -0
  465. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
  466. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +215 -0
  467. package/lib/solution/BaseSales/utils.d.ts +40 -0
  468. package/lib/solution/BaseSales/utils.js +259 -0
  469. package/lib/solution/BookingByStep/index.js +1530 -1343
  470. package/lib/solution/BookingByStep/types.js +40 -99
  471. package/lib/solution/BookingByStep/utils/capacity.js +192 -160
  472. package/lib/solution/BookingByStep/utils/products.js +42 -52
  473. package/lib/solution/BookingByStep/utils/resources.js +527 -330
  474. package/lib/solution/BookingByStep/utils/stock.js +65 -44
  475. package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
  476. package/lib/solution/BookingTicket/index.d.ts +393 -24
  477. package/lib/solution/BookingTicket/index.js +1459 -160
  478. package/lib/solution/BookingTicket/types.d.ts +191 -6
  479. package/lib/solution/BookingTicket/types.js +101 -66
  480. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  481. package/lib/solution/BookingTicket/utils/addProductDecision.js +353 -0
  482. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  483. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +94 -0
  484. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  485. package/lib/solution/BookingTicket/utils/bookingStatus.js +136 -0
  486. package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
  487. package/lib/solution/BookingTicket/utils/cartView.js +200 -0
  488. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  489. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  490. package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  491. package/lib/solution/BookingTicket/utils/orderCustomer.js +35 -0
  492. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  493. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +387 -0
  494. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  495. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +220 -0
  496. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
  497. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +85 -80
  498. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  499. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +64 -0
  500. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  501. package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -80
  502. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  503. package/lib/solution/BookingTicket/utils/scan/index.js +103 -95
  504. package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
  505. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  506. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +115 -0
  507. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  508. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +83 -0
  509. package/lib/solution/BuyTickets/index.js +67 -70
  510. package/lib/solution/BuyTickets/types.js +22 -38
  511. package/lib/solution/Checkout/index.d.ts +1 -0
  512. package/lib/solution/Checkout/index.js +1461 -1169
  513. package/lib/solution/Checkout/types.js +91 -61
  514. package/lib/solution/Checkout/utils/index.js +228 -159
  515. package/lib/solution/PlaceOrder/index.js +55 -0
  516. package/lib/solution/RegisterAndLogin/config.js +495 -470
  517. package/lib/solution/RegisterAndLogin/index.js +633 -630
  518. package/lib/solution/RegisterAndLogin/types.js +189 -76
  519. package/lib/solution/RegisterAndLogin/utils.js +183 -125
  520. package/lib/solution/Sales/index.d.ts +50 -5
  521. package/lib/solution/Sales/index.js +495 -220
  522. package/lib/solution/Sales/types.d.ts +26 -2
  523. package/lib/solution/Sales/types.js +27 -33
  524. package/lib/solution/ScanOrder/index.d.ts +27 -21
  525. package/lib/solution/ScanOrder/index.js +908 -904
  526. package/lib/solution/ScanOrder/types.d.ts +33 -11
  527. package/lib/solution/ScanOrder/types.js +33 -34
  528. package/lib/solution/ScanOrder/utils.d.ts +4 -1
  529. package/lib/solution/ScanOrder/utils.js +457 -344
  530. package/lib/solution/ShopDiscount/index.js +230 -236
  531. package/lib/solution/ShopDiscount/types.js +15 -37
  532. package/lib/solution/ShopDiscount/utils.js +309 -172
  533. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  534. package/lib/solution/UnifiedBookingSales/index.js +1050 -0
  535. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  536. package/lib/solution/UnifiedBookingSales/types.js +14 -0
  537. package/lib/solution/VenueBooking/index.d.ts +34 -20
  538. package/lib/solution/VenueBooking/index.js +982 -950
  539. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  540. package/lib/solution/VenueBooking/types.js +20 -40
  541. package/lib/solution/VenueBooking/utils/dateSummary.js +22 -54
  542. package/lib/solution/VenueBooking/utils/resource.js +31 -54
  543. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  544. package/lib/solution/VenueBooking/utils/slotMerge.js +96 -108
  545. package/lib/solution/VenueBooking/utils/smartPricing.js +112 -100
  546. package/lib/solution/VenueBooking/utils/timeSlot.js +133 -132
  547. package/lib/solution/VenueBooking/utils.js +130 -67
  548. package/lib/solution/index.d.ts +2 -0
  549. package/lib/solution/index.js +124 -37
  550. package/lib/store/createStore.js +32 -29
  551. package/lib/types/index.d.ts +11 -1
  552. package/lib/types/index.js +4 -16
  553. package/lib/utils/task.js +36 -36
  554. package/lib/utils/watch.js +81 -47
  555. package/package.json +2 -1
  556. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  557. package/lib/solution/Checkout/appointmentDemo.json +0 -1
@@ -26,23 +26,22 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
26
26
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
27
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
28
28
  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); }
29
- import { BaseModule } from "../../modules/BaseModule";
29
+ import { BaseSalesImpl } from "../BaseSales";
30
30
  import { ScanOrderHooks } from "./types";
31
31
  import { OrderModule } from "../../modules/Order";
32
32
  import { AccountHooks } from "../../modules/Account/types";
33
33
  import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
34
34
  import Decimal from 'decimal.js';
35
- import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, collectLinkProductIdsFromReservationRules, computeResourceIsFull, createEmptySummary, findReservationRuleProductByResourceId, getProductIdentityIndex, getSafeProductNum, hasCustomCapacityProduct, pickFirstCustomCapacityDimensionId, pickFirstCustomCapacityPaxBounds, normalizeEnabledItemRuleIds, normalizeOrderProduct, normalizeItemRuleStrategies, pickFirstDurationMinutesFromProducts, toNonNegativeInt, toPriceString, toBoolean, toPositiveString } from "./utils";
35
+ import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, collectLinkProductIdsFromReservationRules, computeResourceIsFull, filterProductsForScanOrderMore, findReservationRuleProductByResourceId, getProductIdentityIndex, getSafeProductNum, hasCustomCapacityProduct, pickFirstCustomCapacityDimensionId, pickFirstCustomCapacityPaxBounds, normalizeEnabledItemRuleIds, normalizeOrderProduct, normalizeItemRuleStrategies, pickFirstDurationMinutesFromProducts, toNonNegativeInt, toPriceString, toBoolean, toPositiveString } from "./utils";
36
36
  import { createModule } from "../BookingByStep/types";
37
37
  import { ProductList } from "../../modules/ProductList";
38
- import { ScheduleModule } from "../../modules/Schedule";
39
38
  import { getDateIsInSchedule } from "../../modules/Schedule/getDateIsInSchedule";
40
- import { composeLinePrice, createUuidV4, normalizeSubmitCollectPaxValue, sumOptionUnitPrice } from "../../modules/Order/utils";
39
+ import { composeLinePrice, buildSubmitPayload, createUuidV4, getProductSkuOptions, normalizeSubmitCollectPaxValue, sumOptionUnitPrice } from "../../modules/Order/utils";
41
40
  import dayjs from 'dayjs';
42
41
  import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
43
42
  export * from "./types";
44
- export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
45
- _inherits(ScanOrderImpl, _BaseModule);
43
+ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
44
+ _inherits(ScanOrderImpl, _BaseSalesImpl);
46
45
  var _super = _createSuper(ScanOrderImpl);
47
46
  function ScanOrderImpl(name, version) {
48
47
  var _this;
@@ -83,8 +82,6 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
83
82
  _defineProperty(_assertThisInitialized(_this), "customerLoginRefreshIdInFlight", null);
84
83
  return _this;
85
84
  }
86
-
87
- /** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
88
85
  _createClass(ScanOrderImpl, [{
89
86
  key: "getScanOrderLoggerContext",
90
87
  value: function getScanOrderLoggerContext() {
@@ -165,12 +162,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
165
162
  payload: payload,
166
163
  extra: extra
167
164
  });
168
- } else {
169
- console.log('[ScanOrder][log-fallback]', params.title, {
170
- payload: payload,
171
- extra: extra
172
- });
173
- }
165
+ } else {}
174
166
  return _context.abrupt("return");
175
167
  case 6:
176
168
  _context.next = 8;
@@ -435,70 +427,42 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
435
427
  }
436
428
  return refreshOrderMarketingAfterLogin;
437
429
  }()
430
+ }, {
431
+ key: "getRegisteredModuleNames",
432
+ value: function getRegisteredModuleNames() {
433
+ return ['scanOrderLogger', 'products', 'order', 'salesSummary', 'schedule'];
434
+ }
435
+ }, {
436
+ key: "createSubModule",
437
+ value: function createSubModule(moduleName) {
438
+ if (moduleName === 'scanOrderLogger') {
439
+ return createModule('scanOrderLogger', this.name);
440
+ }
441
+ return _get(_getPrototypeOf(ScanOrderImpl.prototype), "createSubModule", this).call(this, moduleName);
442
+ }
443
+
444
+ /** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
438
445
  }, {
439
446
  key: "getCacheId",
440
447
  value: function getCacheId() {
441
448
  return this.cacheId;
442
449
  }
443
- }, {
444
- key: "destroyRegisteredChildModules",
445
- value: function () {
446
- var _destroyRegisteredChildModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
447
- var modules, _i3, _modules, mod;
448
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
449
- while (1) switch (_context6.prev = _context6.next) {
450
- case 0:
451
- modules = [this.store.schedule, this.store.salesSummary, this.store.order, this.store.products, this.store.scanOrderLogger];
452
- _i3 = 0, _modules = modules;
453
- case 2:
454
- if (!(_i3 < _modules.length)) {
455
- _context6.next = 10;
456
- break;
457
- }
458
- mod = _modules[_i3];
459
- if (!(mod && typeof mod.destroy === 'function')) {
460
- _context6.next = 7;
461
- break;
462
- }
463
- _context6.next = 7;
464
- return Promise.resolve(mod.destroy());
465
- case 7:
466
- _i3++;
467
- _context6.next = 2;
468
- break;
469
- case 10:
470
- case "end":
471
- return _context6.stop();
472
- }
473
- }, _callee6, this);
474
- }));
475
- function destroyRegisteredChildModules() {
476
- return _destroyRegisteredChildModules.apply(this, arguments);
477
- }
478
- return destroyRegisteredChildModules;
479
- }()
480
450
  }, {
481
451
  key: "initialize",
482
452
  value: function () {
483
- var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(core) {
484
- var _options$otherParams,
485
- _this$otherParams,
486
- _this$otherParams2,
487
- _this$otherParams3,
488
- _this4 = this;
453
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(core) {
454
+ var _options$otherParams, _this$otherParams, _this$otherParams2, _this$otherParams3;
489
455
  var options,
490
- moduleArr,
491
- scheduleModule,
456
+ _this$otherParams4,
457
+ _this$otherParams5,
492
458
  _this$store$order,
493
459
  _this$store$order2,
494
- _args7 = arguments;
495
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
496
- while (1) switch (_context7.prev = _context7.next) {
460
+ _args6 = arguments;
461
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
462
+ while (1) switch (_context6.prev = _context6.next) {
497
463
  case 0:
498
- options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
464
+ options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
499
465
  this.logMethodStart('initialize');
500
- this.core = core;
501
- this.initializeOptions = options || {};
502
466
  this.store = _objectSpread(_objectSpread({}, this.store), options.store);
503
467
  this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
504
468
  this.store.status = 'initializing';
@@ -514,122 +478,74 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
514
478
  passed: null,
515
479
  failures: []
516
480
  };
517
- this.window = core.getPlugin('window');
518
- this.request = core.getPlugin('request');
519
- if (this.window) {
520
- _context7.next = 21;
521
- break;
522
- }
523
- this.logMethodError('initialize', 'window plugin missing');
524
- throw new Error('scanOrder解决方案需要 window 插件支持');
525
- case 21:
526
- if (this.request) {
527
- _context7.next = 24;
528
- break;
529
- }
530
- this.logMethodError('initialize', 'request plugin missing');
531
- throw new Error('scanOrder解决方案需要 request 插件支持');
532
- case 24:
533
- moduleArr = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
534
- moduleArr.forEach(function (step) {
535
- var targetModule = createModule(step, _this4.name);
536
- if (targetModule) {
537
- var _this4$store$order, _this4$otherParams, _this4$otherParams2, _this4$otherParams3, _this4$otherParams4;
538
- _this4.store[step] = targetModule;
539
- var initialState = step === 'salesSummary' ? {
540
- summary: ((_this4$store$order = _this4.store.order) === null || _this4$store$order === void 0 || (_this4$store$order = _this4$store$order.getTempOrder()) === null || _this4$store$order === void 0 ? void 0 : _this4$store$order.summary) || createEmptySummary()
541
- } : {};
542
- var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.scanOrderLoggerProvider) || 'feishu';
543
- var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.scanOrderLoggerConfig) || {
544
- feishu: {
545
- webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed',
546
- errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f'
547
- }
548
- };
549
- _this4.core.registerModule(targetModule, {
550
- initialState: initialState,
551
- otherParams: _objectSpread(_objectSpread({}, _this4.otherParams), {}, {
552
- fatherModule: _this4.name,
553
- openCache: (_this4$otherParams3 = _this4.otherParams) !== null && _this4$otherParams3 !== void 0 && _this4$otherParams3.cacheId ? true : false,
554
- cacheId: (_this4$otherParams4 = _this4.otherParams) === null || _this4$otherParams4 === void 0 ? void 0 : _this4$otherParams4.cacheId,
555
- salesSummaryModuleName: "".concat(_this4.name, "_salesSummary"),
556
- provider: loggerProvider,
557
- providerConfig: loggerConfig,
558
- context: _this4.getScanOrderLoggerContext()
559
- })
560
- });
561
- } else {
562
- _this4.logMethodError('initialize', "module ".concat(step, " missing"));
563
- throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
564
- }
565
- });
481
+ _context6.next = 16;
482
+ return _get(_getPrototypeOf(ScanOrderImpl.prototype), "initialize", this).call(this, core, options);
483
+ case 16:
566
484
  if (this.store.scanOrderLogger) {
485
+ this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.scanOrderLoggerProvider) || 'feishu');
486
+ this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.scanOrderLoggerConfig) || {
487
+ feishu: {
488
+ webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed',
489
+ errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f'
490
+ }
491
+ });
567
492
  this.store.scanOrderLogger.setContext(this.getScanOrderLoggerContext());
568
493
  }
569
- scheduleModule = new ScheduleModule("".concat(this.name, "_schedule"));
570
- this.store.schedule = scheduleModule;
571
- this.core.registerModule(scheduleModule, {
572
- otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
573
- fatherModule: this.name
574
- })
575
- });
576
494
  this.registerCustomerLoginListeners();
577
- console.log('[ScanOrder] 初始化开始');
578
- _context7.prev = 32;
579
- _context7.next = 35;
495
+ _context6.prev = 18;
496
+ _context6.next = 21;
580
497
  return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
581
498
  createIfMissing: false
582
499
  });
583
- case 35:
500
+ case 21:
584
501
  (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
585
- _context7.next = 38;
502
+ _context6.next = 24;
586
503
  return this.loadRuntimeConfigs();
587
- case 38:
504
+ case 24:
588
505
  if (!this.store.schedule) {
589
- _context7.next = 47;
506
+ _context6.next = 33;
590
507
  break;
591
508
  }
592
- _context7.prev = 39;
593
- _context7.next = 42;
509
+ _context6.prev = 25;
510
+ _context6.next = 28;
594
511
  return this.store.schedule.loadAllSchedule();
595
- case 42:
596
- _context7.next = 47;
512
+ case 28:
513
+ _context6.next = 33;
597
514
  break;
598
- case 44:
599
- _context7.prev = 44;
600
- _context7.t0 = _context7["catch"](39);
601
- console.warn('[ScanOrder] loadAllSchedule 失败,operating_hours 判定将跳过', _context7.t0);
602
- case 47:
603
- _context7.next = 49;
515
+ case 30:
516
+ _context6.prev = 30;
517
+ _context6.t0 = _context6["catch"](25);
518
+ console.warn('[ScanOrder] loadAllSchedule 失败,operating_hours 判定将跳过', _context6.t0);
519
+ case 33:
520
+ _context6.next = 35;
604
521
  return this.refreshItemRuleQuantityLimits();
605
- case 49:
522
+ case 35:
606
523
  this.store.status = 'ready';
607
- console.log('[ScanOrder] 初始化完成');
608
- _context7.next = 53;
524
+ _context6.next = 38;
609
525
  return this.core.effects.emit(ScanOrderHooks.onInited, {
610
526
  status: this.store.status
611
527
  });
612
- case 53:
528
+ case 38:
613
529
  this.logMethodSuccess('initialize', {
614
530
  status: this.store.status
615
531
  });
616
- _context7.next = 63;
532
+ _context6.next = 48;
617
533
  break;
618
- case 56:
619
- _context7.prev = 56;
620
- _context7.t1 = _context7["catch"](32);
534
+ case 41:
535
+ _context6.prev = 41;
536
+ _context6.t1 = _context6["catch"](18);
621
537
  this.store.status = 'error';
622
- this.store.error = _context7.t1 instanceof Error ? _context7.t1.message : '初始化失败';
623
- console.error('[ScanOrder] 初始化失败', _context7.t1);
624
- this.logMethodError('initialize', _context7.t1, {
538
+ this.store.error = _context6.t1 instanceof Error ? _context6.t1.message : '初始化失败';
539
+ console.error('[ScanOrder] 初始化失败', _context6.t1);
540
+ this.logMethodError('initialize', _context6.t1, {
625
541
  status: this.store.status
626
542
  });
627
- throw _context7.t1;
628
- case 63:
543
+ throw _context6.t1;
544
+ case 48:
629
545
  case "end":
630
- return _context7.stop();
546
+ return _context6.stop();
631
547
  }
632
- }, _callee7, this, [[32, 56], [39, 44]]);
548
+ }, _callee6, this, [[18, 41], [25, 30]]);
633
549
  }));
634
550
  function initialize(_x5) {
635
551
  return _initialize.apply(this, arguments);
@@ -639,26 +555,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
639
555
  }, {
640
556
  key: "destroy",
641
557
  value: function () {
642
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
643
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
644
- while (1) switch (_context8.prev = _context8.next) {
558
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
559
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
560
+ while (1) switch (_context7.prev = _context7.next) {
645
561
  case 0:
646
562
  this.logMethodStart('destroy');
647
563
  this.clearLoginEffectListeners();
648
- _context8.next = 4;
564
+ _context7.next = 4;
649
565
  return this.core.effects.emit(ScanOrderHooks.onDestroy, {});
650
566
  case 4:
651
- _context8.next = 6;
652
- return this.destroyRegisteredChildModules();
653
- case 6:
654
567
  _get(_getPrototypeOf(ScanOrderImpl.prototype), "destroy", this).call(this);
655
- console.log('[ScanOrder] 已销毁');
656
568
  this.logMethodSuccess('destroy');
657
- case 9:
569
+ case 6:
658
570
  case "end":
659
- return _context8.stop();
571
+ return _context7.stop();
660
572
  }
661
- }, _callee8, this);
573
+ }, _callee7, this);
662
574
  }));
663
575
  function destroy() {
664
576
  return _destroy.apply(this, arguments);
@@ -668,33 +580,32 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
668
580
  }, {
669
581
  key: "retryInit",
670
582
  value: function () {
671
- var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
672
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
673
- while (1) switch (_context9.prev = _context9.next) {
583
+ var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
584
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
585
+ while (1) switch (_context8.prev = _context8.next) {
674
586
  case 0:
675
587
  this.logMethodStart('retryInit');
676
588
  // TODO: 细化重试策略(指数退避、最大重试次数)后替换当前实现
677
- console.log('[ScanOrder] retryInit 调用');
678
- _context9.next = 4;
589
+ _context8.next = 3;
679
590
  return this.core.effects.emit(ScanOrderHooks.onRetryInit, {});
680
- case 4:
681
- _context9.prev = 4;
682
- _context9.next = 7;
591
+ case 3:
592
+ _context8.prev = 3;
593
+ _context8.next = 6;
683
594
  return this.initialize(this.core, this.initializeOptions);
684
- case 7:
595
+ case 6:
685
596
  this.logMethodSuccess('retryInit');
686
- _context9.next = 14;
597
+ _context8.next = 13;
687
598
  break;
688
- case 10:
689
- _context9.prev = 10;
690
- _context9.t0 = _context9["catch"](4);
691
- this.logMethodError('retryInit', _context9.t0);
692
- throw _context9.t0;
693
- case 14:
599
+ case 9:
600
+ _context8.prev = 9;
601
+ _context8.t0 = _context8["catch"](3);
602
+ this.logMethodError('retryInit', _context8.t0);
603
+ throw _context8.t0;
604
+ case 13:
694
605
  case "end":
695
- return _context9.stop();
606
+ return _context8.stop();
696
607
  }
697
- }, _callee9, this, [[4, 10]]);
608
+ }, _callee8, this, [[3, 9]]);
698
609
  }));
699
610
  function retryInit() {
700
611
  return _retryInit.apply(this, arguments);
@@ -704,42 +615,41 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
704
615
  }, {
705
616
  key: "refresh",
706
617
  value: function () {
707
- var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
708
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
709
- while (1) switch (_context10.prev = _context10.next) {
618
+ var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
619
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
620
+ while (1) switch (_context9.prev = _context9.next) {
710
621
  case 0:
711
622
  this.logMethodStart('refresh');
712
623
  // TODO: 接入真实刷新逻辑(资源重拉取、流程重建)后替换当前实现
713
- console.log('[ScanOrder] refresh 调用');
714
- _context10.prev = 2;
624
+ _context9.prev = 1;
715
625
  this.store.status = 'initializing';
716
- _context10.next = 6;
626
+ _context9.next = 5;
717
627
  return this.loadRuntimeConfigs();
718
- case 6:
719
- _context10.next = 8;
628
+ case 5:
629
+ _context9.next = 7;
720
630
  return this.refreshItemRuleQuantityLimits();
721
- case 8:
631
+ case 7:
722
632
  this.store.status = 'ready';
723
- _context10.next = 11;
633
+ _context9.next = 10;
724
634
  return this.core.effects.emit(ScanOrderHooks.onRefresh, {
725
635
  status: this.store.status
726
636
  });
727
- case 11:
637
+ case 10:
728
638
  this.logMethodSuccess('refresh', {
729
639
  status: this.store.status
730
640
  });
731
- _context10.next = 18;
641
+ _context9.next = 17;
732
642
  break;
733
- case 14:
734
- _context10.prev = 14;
735
- _context10.t0 = _context10["catch"](2);
736
- this.logMethodError('refresh', _context10.t0);
737
- throw _context10.t0;
738
- case 18:
643
+ case 13:
644
+ _context9.prev = 13;
645
+ _context9.t0 = _context9["catch"](1);
646
+ this.logMethodError('refresh', _context9.t0);
647
+ throw _context9.t0;
648
+ case 17:
739
649
  case "end":
740
- return _context10.stop();
650
+ return _context9.stop();
741
651
  }
742
- }, _callee10, this, [[2, 14]]);
652
+ }, _callee9, this, [[1, 13]]);
743
653
  }));
744
654
  function refresh() {
745
655
  return _refresh.apply(this, arguments);
@@ -827,16 +737,27 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
827
737
  }, {
828
738
  key: "updateTempOrderNote",
829
739
  value: function updateTempOrderNote(note) {
740
+ var _this4 = this;
741
+ var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
830
742
  this.logMethodStart('updateTempOrderNote', {
831
743
  noteLength: String(note || '').length
832
744
  });
833
745
  try {
834
746
  if (!this.store.order) throw new Error('order 模块未初始化');
835
- var result = this.store.order.updateTempOrderNote(note);
747
+ var result = this.store.order.updateTempOrderNote(note, sync);
748
+ if (result && typeof result.then === 'function') {
749
+ return result.then(function (nextNote) {
750
+ _this4.logMethodSuccess('updateTempOrderNote', {
751
+ noteLength: nextNote.length
752
+ });
753
+ return nextNote;
754
+ });
755
+ }
756
+ var nextNote = result;
836
757
  this.logMethodSuccess('updateTempOrderNote', {
837
- noteLength: result.length
758
+ noteLength: nextNote.length
838
759
  });
839
- return result;
760
+ return nextNote;
840
761
  } catch (error) {
841
762
  this.logMethodError('updateTempOrderNote', error);
842
763
  throw error;
@@ -852,12 +773,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
852
773
  mode: mode
853
774
  });
854
775
  try {
855
- var _this$otherParams4;
776
+ var _this$otherParams6;
856
777
  if (!this.store.order) throw new Error('order 模块未初始化');
857
778
  var tempOrder = this.store.order.ensureTempOrder();
858
779
  tempOrder.metadata = _objectSpread(_objectSpread({}, tempOrder.metadata || {}), {}, {
859
780
  shop_service_data: _objectSpread(_objectSpread({}, (tempOrder.metadata || {}).shop_service_data || {}), {}, {
860
- service_type: ((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.businessCode) === 'dine_in' ? 'dine_in' : '',
781
+ service_type: ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) === 'dine_in' ? 'dine_in' : '',
861
782
  pickup_reference_mode: mode
862
783
  })
863
784
  });
@@ -894,8 +815,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
894
815
  }
895
816
  }
896
817
  }, {
897
- key: "ensureTempOrder",
898
- value: function ensureTempOrder() {
818
+ key: "ensureScanOrderTempOrder",
819
+ value: function ensureScanOrderTempOrder() {
899
820
  if (!this.store.order) throw new Error('order 模块未初始化');
900
821
  return this.store.order.ensureTempOrder();
901
822
  }
@@ -904,37 +825,37 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
904
825
  }, {
905
826
  key: "addNewOrder",
906
827
  value: function () {
907
- var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
828
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
908
829
  var tempOrder;
909
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
910
- while (1) switch (_context11.prev = _context11.next) {
830
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
831
+ while (1) switch (_context10.prev = _context10.next) {
911
832
  case 0:
912
833
  this.logMethodStart('addNewOrder');
913
- _context11.prev = 1;
834
+ _context10.prev = 1;
914
835
  if (this.store.order) {
915
- _context11.next = 4;
836
+ _context10.next = 4;
916
837
  break;
917
838
  }
918
839
  throw new Error('order 模块未初始化');
919
840
  case 4:
920
- _context11.next = 6;
841
+ _context10.next = 6;
921
842
  return this.store.order.addNewOrder();
922
843
  case 6:
923
- tempOrder = _context11.sent;
844
+ tempOrder = _context10.sent;
924
845
  this.logMethodSuccess('addNewOrder', {
925
846
  productCount: tempOrder.products.length
926
847
  });
927
- return _context11.abrupt("return", tempOrder);
848
+ return _context10.abrupt("return", tempOrder);
928
849
  case 11:
929
- _context11.prev = 11;
930
- _context11.t0 = _context11["catch"](1);
931
- this.logMethodError('addNewOrder', _context11.t0);
932
- throw _context11.t0;
850
+ _context10.prev = 11;
851
+ _context10.t0 = _context10["catch"](1);
852
+ this.logMethodError('addNewOrder', _context10.t0);
853
+ throw _context10.t0;
933
854
  case 15:
934
855
  case "end":
935
- return _context11.stop();
856
+ return _context10.stop();
936
857
  }
937
- }, _callee11, this, [[1, 11]]);
858
+ }, _callee10, this, [[1, 11]]);
938
859
  }));
939
860
  function addNewOrder() {
940
861
  return _addNewOrder.apply(this, arguments);
@@ -945,15 +866,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
945
866
  }, {
946
867
  key: "restoreOrder",
947
868
  value: function () {
948
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
869
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
949
870
  var tempOrder;
950
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
951
- while (1) switch (_context12.prev = _context12.next) {
871
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
872
+ while (1) switch (_context11.prev = _context11.next) {
952
873
  case 0:
953
874
  this.logMethodStart('restoreOrder');
954
- _context12.prev = 1;
875
+ _context11.prev = 1;
955
876
  if (this.store.order) {
956
- _context12.next = 4;
877
+ _context11.next = 4;
957
878
  break;
958
879
  }
959
880
  throw new Error('scanOrder 解决方案需要 order 模块支持');
@@ -963,17 +884,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
963
884
  this.enabledReservationRuleProducts = [];
964
885
  tempOrder = this.store.order.restoreOrder();
965
886
  this.logMethodSuccess('restoreOrder');
966
- return _context12.abrupt("return", tempOrder);
887
+ return _context11.abrupt("return", tempOrder);
967
888
  case 12:
968
- _context12.prev = 12;
969
- _context12.t0 = _context12["catch"](1);
970
- this.logMethodError('restoreOrder', _context12.t0);
971
- throw _context12.t0;
889
+ _context11.prev = 12;
890
+ _context11.t0 = _context11["catch"](1);
891
+ this.logMethodError('restoreOrder', _context11.t0);
892
+ throw _context11.t0;
972
893
  case 16:
973
894
  case "end":
974
- return _context12.stop();
895
+ return _context11.stop();
975
896
  }
976
- }, _callee12, this, [[1, 12]]);
897
+ }, _callee11, this, [[1, 12]]);
977
898
  }));
978
899
  function restoreOrder() {
979
900
  return _restoreOrder.apply(this, arguments);
@@ -994,37 +915,37 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
994
915
  }, {
995
916
  key: "getSummary",
996
917
  value: function () {
997
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
918
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
998
919
  var summary;
999
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1000
- while (1) switch (_context13.prev = _context13.next) {
920
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
921
+ while (1) switch (_context12.prev = _context12.next) {
1001
922
  case 0:
1002
923
  this.logMethodStart('getSummary');
1003
- _context13.prev = 1;
924
+ _context12.prev = 1;
1004
925
  if (this.store.order) {
1005
- _context13.next = 4;
926
+ _context12.next = 4;
1006
927
  break;
1007
928
  }
1008
929
  throw new Error('order 模块未初始化');
1009
930
  case 4:
1010
- _context13.next = 6;
1011
- return this.store.order.getScanOrderSummary();
931
+ _context12.next = 6;
932
+ return this.store.order.getOrderSummary();
1012
933
  case 6:
1013
- summary = _context13.sent;
934
+ summary = _context12.sent;
1014
935
  this.logMethodSuccess('getSummary', {
1015
936
  totalAmount: summary.total_amount
1016
937
  });
1017
- return _context13.abrupt("return", summary);
938
+ return _context12.abrupt("return", summary);
1018
939
  case 11:
1019
- _context13.prev = 11;
1020
- _context13.t0 = _context13["catch"](1);
1021
- this.logMethodError('getSummary', _context13.t0);
1022
- throw _context13.t0;
940
+ _context12.prev = 11;
941
+ _context12.t0 = _context12["catch"](1);
942
+ this.logMethodError('getSummary', _context12.t0);
943
+ throw _context12.t0;
1023
944
  case 15:
1024
945
  case "end":
1025
- return _context13.stop();
946
+ return _context12.stop();
1026
947
  }
1027
- }, _callee13, this, [[1, 11]]);
948
+ }, _callee12, this, [[1, 11]]);
1028
949
  }));
1029
950
  function getSummary() {
1030
951
  return _getSummary.apply(this, arguments);
@@ -1040,30 +961,30 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1040
961
  }, {
1041
962
  key: "scanCode",
1042
963
  value: function () {
1043
- var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(code, customerId) {
964
+ var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(code, customerId) {
1044
965
  var raw;
1045
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1046
- while (1) switch (_context14.prev = _context14.next) {
966
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
967
+ while (1) switch (_context13.prev = _context13.next) {
1047
968
  case 0:
1048
969
  this.logMethodStart('scanCode', {
1049
970
  code: code
1050
971
  });
1051
- _context14.prev = 1;
972
+ _context13.prev = 1;
1052
973
  if (this.store.order) {
1053
- _context14.next = 4;
974
+ _context13.next = 4;
1054
975
  break;
1055
976
  }
1056
977
  throw new Error('order 模块未初始化');
1057
978
  case 4:
1058
- _context14.next = 6;
979
+ _context13.next = 6;
1059
980
  return this.store.order.scanCode(code, customerId);
1060
981
  case 6:
1061
- raw = _context14.sent;
982
+ raw = _context13.sent;
1062
983
  if (!raw.isAvailable) {
1063
- _context14.next = 11;
984
+ _context13.next = 11;
1064
985
  break;
1065
986
  }
1066
- _context14.next = 10;
987
+ _context13.next = 10;
1067
988
  return this.store.order.recalculateSummary({
1068
989
  createIfMissing: true
1069
990
  });
@@ -1073,21 +994,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1073
994
  this.logMethodSuccess('scanCode', {
1074
995
  isAvailable: raw.isAvailable
1075
996
  });
1076
- return _context14.abrupt("return", {
997
+ return _context13.abrupt("return", {
1077
998
  isAvailable: raw.isAvailable,
1078
999
  type: raw.type,
1079
1000
  unavailableReason: raw.unavailableReason
1080
1001
  });
1081
1002
  case 15:
1082
- _context14.prev = 15;
1083
- _context14.t0 = _context14["catch"](1);
1084
- this.logMethodError('scanCode', _context14.t0);
1085
- throw _context14.t0;
1003
+ _context13.prev = 15;
1004
+ _context13.t0 = _context13["catch"](1);
1005
+ this.logMethodError('scanCode', _context13.t0);
1006
+ throw _context13.t0;
1086
1007
  case 19:
1087
1008
  case "end":
1088
- return _context14.stop();
1009
+ return _context13.stop();
1089
1010
  }
1090
- }, _callee14, this, [[1, 15]]);
1011
+ }, _callee13, this, [[1, 15]]);
1091
1012
  }));
1092
1013
  function scanCode(_x6, _x7) {
1093
1014
  return _scanCode.apply(this, arguments);
@@ -1097,15 +1018,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1097
1018
  }, {
1098
1019
  key: "setDiscountSelected",
1099
1020
  value: function () {
1100
- var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1101
- var _tempOrder$holder, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, _iterator3, _step3, _product$_origin, _product$metadata$sou, _product$metadata, _product$metadata2, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
1102
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1103
- while (1) switch (_context15.prev = _context15.next) {
1021
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
1022
+ var _tempOrder$holder, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, _iterator3, _step3, _origin, _product$metadata$sou, _product$metadata, _product$metadata2, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
1023
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1024
+ while (1) switch (_context14.prev = _context14.next) {
1104
1025
  case 0:
1105
1026
  this.logMethodStart('setDiscountSelected', params);
1106
- _context15.prev = 1;
1027
+ _context14.prev = 1;
1107
1028
  if (this.store.order) {
1108
- _context15.next = 4;
1029
+ _context14.next = 4;
1109
1030
  break;
1110
1031
  }
1111
1032
  throw new Error('order 模块未初始化');
@@ -1125,7 +1046,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1125
1046
  form_record_id: tempOrder.holder.form_record_id
1126
1047
  }] : [];
1127
1048
  nextDiscountList = updated;
1128
- _context15.next = 14;
1049
+ _context14.next = 14;
1129
1050
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
1130
1051
  case 14:
1131
1052
  if (rulesModule) {
@@ -1174,19 +1095,19 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1174
1095
  return d.id;
1175
1096
  }));
1176
1097
  _iterator3 = _createForOfIteratorHelper(tempOrder.products);
1177
- _context15.prev = 17;
1098
+ _context14.prev = 17;
1178
1099
  _iterator3.s();
1179
1100
  case 19:
1180
1101
  if ((_step3 = _iterator3.n()).done) {
1181
- _context15.next = 33;
1102
+ _context14.next = 33;
1182
1103
  break;
1183
1104
  }
1184
1105
  product = _step3.value;
1185
- if (!((_product$_origin = product._origin) !== null && _product$_origin !== void 0 && _product$_origin.isManualDiscount)) {
1186
- _context15.next = 23;
1106
+ if (!((_origin = product._origin) !== null && _origin !== void 0 && _origin.isManualDiscount)) {
1107
+ _context14.next = 23;
1187
1108
  break;
1188
1109
  }
1189
- return _context15.abrupt("continue", 31);
1110
+ return _context14.abrupt("continue", 31);
1190
1111
  case 23:
1191
1112
  product.discount_list = (product.discount_list || []).filter(function (pd) {
1192
1113
  var _pd$discount$resource, _pd$discount;
@@ -1199,7 +1120,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1199
1120
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
1200
1121
  return sum + (pd.amount || 0);
1201
1122
  }, 0);
1202
- optionSum = sumOptionUnitPrice(product.product_option_item);
1123
+ optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
1203
1124
  sourcePrice = (_product$metadata$sou = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
1204
1125
  newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
1205
1126
  newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
@@ -1212,46 +1133,46 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1212
1133
  bundle: product.product_bundle
1213
1134
  });
1214
1135
  case 31:
1215
- _context15.next = 19;
1136
+ _context14.next = 19;
1216
1137
  break;
1217
1138
  case 33:
1218
- _context15.next = 38;
1139
+ _context14.next = 38;
1219
1140
  break;
1220
1141
  case 35:
1221
- _context15.prev = 35;
1222
- _context15.t0 = _context15["catch"](17);
1223
- _iterator3.e(_context15.t0);
1142
+ _context14.prev = 35;
1143
+ _context14.t0 = _context14["catch"](17);
1144
+ _iterator3.e(_context14.t0);
1224
1145
  case 38:
1225
- _context15.prev = 38;
1146
+ _context14.prev = 38;
1226
1147
  _iterator3.f();
1227
- return _context15.finish(38);
1148
+ return _context14.finish(38);
1228
1149
  case 41:
1229
1150
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1230
- _context15.next = 44;
1151
+ _context14.next = 44;
1231
1152
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1232
1153
  case 44:
1233
1154
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
1234
1155
  return d.isSelected;
1235
1156
  });
1236
- _context15.next = 47;
1157
+ _context14.next = 47;
1237
1158
  return this.store.order.recalculateSummary({
1238
1159
  createIfMissing: true
1239
1160
  });
1240
1161
  case 47:
1241
1162
  this.store.order.persistTempOrder();
1242
1163
  this.logMethodSuccess('setDiscountSelected', params);
1243
- _context15.next = 55;
1164
+ _context14.next = 55;
1244
1165
  break;
1245
1166
  case 51:
1246
- _context15.prev = 51;
1247
- _context15.t1 = _context15["catch"](1);
1248
- this.logMethodError('setDiscountSelected', _context15.t1);
1249
- throw _context15.t1;
1167
+ _context14.prev = 51;
1168
+ _context14.t1 = _context14["catch"](1);
1169
+ this.logMethodError('setDiscountSelected', _context14.t1);
1170
+ throw _context14.t1;
1250
1171
  case 55:
1251
1172
  case "end":
1252
- return _context15.stop();
1173
+ return _context14.stop();
1253
1174
  }
1254
- }, _callee15, this, [[1, 51], [17, 35, 38, 41]]);
1175
+ }, _callee14, this, [[1, 51], [17, 35, 38, 41]]);
1255
1176
  }));
1256
1177
  function setDiscountSelected(_x8) {
1257
1178
  return _setDiscountSelected.apply(this, arguments);
@@ -1261,15 +1182,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1261
1182
  }, {
1262
1183
  key: "onCustomerLogin",
1263
1184
  value: function () {
1264
- var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1265
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1266
- while (1) switch (_context16.prev = _context16.next) {
1185
+ var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1186
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1187
+ while (1) switch (_context15.prev = _context15.next) {
1267
1188
  case 0:
1268
1189
  this.logMethodStart('onCustomerLogin', {
1269
1190
  customerId: params.customerId
1270
1191
  });
1271
- _context16.prev = 1;
1272
- _context16.next = 4;
1192
+ _context15.prev = 1;
1193
+ _context15.next = 4;
1273
1194
  return this.refreshOrderMarketingAfterLogin({
1274
1195
  customerId: params.customerId
1275
1196
  });
@@ -1277,18 +1198,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1277
1198
  this.logMethodSuccess('onCustomerLogin', {
1278
1199
  customerId: params.customerId
1279
1200
  });
1280
- _context16.next = 11;
1201
+ _context15.next = 11;
1281
1202
  break;
1282
1203
  case 7:
1283
- _context16.prev = 7;
1284
- _context16.t0 = _context16["catch"](1);
1285
- this.logMethodError('onCustomerLogin', _context16.t0);
1286
- throw _context16.t0;
1204
+ _context15.prev = 7;
1205
+ _context15.t0 = _context15["catch"](1);
1206
+ this.logMethodError('onCustomerLogin', _context15.t0);
1207
+ throw _context15.t0;
1287
1208
  case 11:
1288
1209
  case "end":
1289
- return _context16.stop();
1210
+ return _context15.stop();
1290
1211
  }
1291
- }, _callee16, this, [[1, 7]]);
1212
+ }, _callee15, this, [[1, 7]]);
1292
1213
  }));
1293
1214
  function onCustomerLogin(_x9) {
1294
1215
  return _onCustomerLogin.apply(this, arguments);
@@ -1339,11 +1260,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1339
1260
  }, {
1340
1261
  key: "prepareRetailAvailability",
1341
1262
  value: function () {
1342
- var _prepareRetailAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1343
- var _this$store$order4, _this$otherParams5;
1263
+ var _prepareRetailAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1264
+ var _this$store$order4, _this$otherParams7;
1344
1265
  var tempOrder, hasOrderId, resourceId, reason, resourceState, availabilityInfo;
1345
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1346
- while (1) switch (_context17.prev = _context17.next) {
1266
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1267
+ while (1) switch (_context16.prev = _context16.next) {
1347
1268
  case 0:
1348
1269
  tempOrder = params.tempOrder, hasOrderId = params.hasOrderId, resourceId = params.resourceId, reason = params.reason;
1349
1270
  this.enabledReservationRuleProducts = [];
@@ -1366,12 +1287,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1366
1287
  };
1367
1288
  this.store.resource = resourceState;
1368
1289
  (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || _this$store$order4.persistTempOrder();
1369
- _context17.next = 15;
1290
+ _context16.next = 15;
1370
1291
  return this.addNewOrder();
1371
1292
  case 15:
1372
- _context17.next = 17;
1293
+ _context16.next = 17;
1373
1294
  return this.setItemRuleRuntimeConfig({
1374
- serviceType: (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.businessCode,
1295
+ serviceType: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode,
1375
1296
  submissionIndex: hasOrderId ? 1 : 0,
1376
1297
  historicalItems: []
1377
1298
  });
@@ -1385,15 +1306,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1385
1306
  mode: availabilityInfo.mode,
1386
1307
  retailMode: true,
1387
1308
  retailReason: reason,
1388
- persistedRelationId: tempOrder.relation_id,
1389
- persistedResourceId: tempOrder.resource_id
1309
+ relationId: resourceState.relationId,
1310
+ persistedResourceId: resourceState.relationId
1390
1311
  });
1391
- return _context17.abrupt("return", availabilityInfo);
1312
+ return _context16.abrupt("return", availabilityInfo);
1392
1313
  case 20:
1393
1314
  case "end":
1394
- return _context17.stop();
1315
+ return _context16.stop();
1395
1316
  }
1396
- }, _callee17, this);
1317
+ }, _callee16, this);
1397
1318
  }));
1398
1319
  function prepareRetailAvailability(_x10) {
1399
1320
  return _prepareRetailAvailability.apply(this, arguments);
@@ -1424,11 +1345,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1424
1345
  return 1;
1425
1346
  };
1426
1347
  return function (payload, _ref3) {
1427
- var _ref4, _tempOrder$resource_i, _tempOrder$metadata, _ref5, _pickOriginal, _resourceState$table_2, _resourceState$relati, _pickFirstCustomCapac;
1348
+ var _resourceState$relati, _tempOrder$metadata, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati2, _pickFirstCustomCapac;
1428
1349
  var bookingUuid = _ref3.bookingUuid,
1429
1350
  tempOrder = _ref3.tempOrder;
1430
- var resourceId = String((_ref4 = (_tempOrder$resource_i = tempOrder.resource_id) !== null && _tempOrder$resource_i !== void 0 ? _tempOrder$resource_i : resourceState === null || resourceState === void 0 ? void 0 : resourceState.relationId) !== null && _ref4 !== void 0 ? _ref4 : '').trim();
1431
- var hasReservationBookingContext = Boolean(ruleProduct && resourceState && resourceId && (tempOrder.relation_id || resourceState.relationId) && (tempOrder.table_form_id || resourceState.tableFormId));
1351
+ var resourceId = String((_resourceState$relati = resourceState === null || resourceState === void 0 ? void 0 : resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : '').trim();
1352
+ var hasReservationBookingContext = Boolean(ruleProduct && resourceState && resourceId && resourceState.relationId && resourceState.tableFormId);
1432
1353
  if (!hasReservationBookingContext) {
1433
1354
  return _objectSpread(_objectSpread({}, payload), {}, {
1434
1355
  bookings: [],
@@ -1445,14 +1366,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1445
1366
  }
1446
1367
  return undefined;
1447
1368
  };
1448
- var mainField = (_ref5 = (_pickOriginal = pickOriginal(tempOrder.table_number)) !== null && _pickOriginal !== void 0 ? _pickOriginal : pickOriginal(resourceState === null || resourceState === void 0 || (_resourceState$table_2 = resourceState.table_form_record) === null || _resourceState$table_2 === void 0 ? void 0 : _resourceState$table_2.name)) !== null && _ref5 !== void 0 ? _ref5 : '';
1369
+ var mainField = (_ref4 = (_pickOriginal = pickOriginal(tempOrder.table_number)) !== null && _pickOriginal !== void 0 ? _pickOriginal : pickOriginal(resourceState === null || resourceState === void 0 || (_resourceState$table_2 = resourceState.table_form_record) === null || _resourceState$table_2 === void 0 ? void 0 : _resourceState$table_2.name)) !== null && _ref4 !== void 0 ? _ref4 : '';
1449
1370
  var resourceEntry = resourceState && resourceId ? {
1450
1371
  relation_type: 'form',
1451
1372
  like_status: 'common',
1452
1373
  id: Number(resourceId),
1453
1374
  main_field: mainField,
1454
1375
  form_id: resourceState.tableFormId,
1455
- relation_id: (_resourceState$relati = resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : resourceId,
1376
+ relation_id: (_resourceState$relati2 = resourceState.relationId) !== null && _resourceState$relati2 !== void 0 ? _resourceState$relati2 : resourceId,
1456
1377
  capacity: bookingCapacityValue,
1457
1378
  metadata: _this5.buildScanOrderResourceMetadata({
1458
1379
  resourceState: resourceState,
@@ -1489,9 +1410,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1489
1410
  var nextProducts = _toConsumableArray(payload.products || []);
1490
1411
  // 加餐(已有 order_id)走 scanOrderMore,原单已含 booking 规则行,勿再追加虚拟规则商品
1491
1412
  if (ruleProduct && ruleProductUid && !tempOrder.order_id) {
1492
- var _ruleProduct$price, _ref6, _ruleProduct$original, _ruleProduct$is_gst;
1413
+ var _ruleProduct$price, _ref5, _ruleProduct$original, _ruleProduct$is_gst;
1493
1414
  var sellingPrice = String((_ruleProduct$price = ruleProduct.price) !== null && _ruleProduct$price !== void 0 ? _ruleProduct$price : '0.00');
1494
- var originalPrice = String((_ref6 = (_ruleProduct$original = ruleProduct.original_price) !== null && _ruleProduct$original !== void 0 ? _ruleProduct$original : ruleProduct.price) !== null && _ref6 !== void 0 ? _ref6 : '0.00');
1415
+ var originalPrice = String((_ref5 = (_ruleProduct$original = ruleProduct.original_price) !== null && _ruleProduct$original !== void 0 ? _ruleProduct$original : ruleProduct.price) !== null && _ref5 !== void 0 ? _ref5 : '0.00');
1495
1416
  nextProducts.push({
1496
1417
  product_id: ruleProduct.id,
1497
1418
  product_variant_id: 0,
@@ -1500,7 +1421,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1500
1421
  original_price: originalPrice,
1501
1422
  payment_price: sellingPrice,
1502
1423
  is_charge_tax: (_ruleProduct$is_gst = ruleProduct.is_gst) !== null && _ruleProduct$is_gst !== void 0 ? _ruleProduct$is_gst : 0,
1503
- product_option_item: [],
1424
+ product_sku: {
1425
+ option: []
1426
+ },
1504
1427
  discount_list: [],
1505
1428
  product_bundle: [],
1506
1429
  booking_uid: bookingUuid,
@@ -1517,11 +1440,89 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1517
1440
  });
1518
1441
  };
1519
1442
  }
1443
+ }, {
1444
+ key: "isScanOrderMoreMode",
1445
+ value: function isScanOrderMoreMode(tempOrder) {
1446
+ var _this$store$resource, _this$store$entryCont;
1447
+ var mode = (_this$store$resource = this.store.resource) === null || _this$store$resource === void 0 ? void 0 : _this$store$resource.mode;
1448
+ return Boolean(tempOrder.order_id && (mode === 'additional_order' || mode === 'additional_order_with_code' || ((_this$store$entryCont = this.store.entryContext) === null || _this$store$entryCont === void 0 ? void 0 : _this$store$entryCont.mode) === 'append'));
1449
+ }
1450
+ }, {
1451
+ key: "submitScanOrderMore",
1452
+ value: function () {
1453
+ var _submitScanOrderMore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1454
+ var _this$otherParams8, _this$otherParams9, _this$otherParams10, _this$otherParams11, _this$otherParams12;
1455
+ var tempOrder, enhancePayload, latestSummary, payload, products, orderId, result;
1456
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1457
+ while (1) switch (_context17.prev = _context17.next) {
1458
+ case 0:
1459
+ if (this.request) {
1460
+ _context17.next = 2;
1461
+ break;
1462
+ }
1463
+ throw new Error('scanOrder解决方案需要 request 插件支持');
1464
+ case 2:
1465
+ if (this.store.order) {
1466
+ _context17.next = 4;
1467
+ break;
1468
+ }
1469
+ throw new Error('scanOrder解决方案需要 order 模块支持');
1470
+ case 4:
1471
+ tempOrder = params.tempOrder, enhancePayload = params.enhancePayload;
1472
+ _context17.next = 7;
1473
+ return this.store.order.recalculateSummary({
1474
+ createIfMissing: true
1475
+ });
1476
+ case 7:
1477
+ latestSummary = _context17.sent;
1478
+ payload = buildSubmitPayload({
1479
+ tempOrder: tempOrder,
1480
+ cacheId: this.cacheId,
1481
+ platform: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform,
1482
+ businessCode: ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.businessCode) || ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.business_code),
1483
+ channel: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel,
1484
+ type: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.type,
1485
+ summary: latestSummary,
1486
+ enhance: enhancePayload
1487
+ });
1488
+ products = filterProductsForScanOrderMore(payload.products);
1489
+ orderId = tempOrder.order_id;
1490
+ _context17.next = 13;
1491
+ return this.request.put("/order/order/product/".concat(orderId), {
1492
+ products: products,
1493
+ request_unique_idempotency_token: payload.request_unique_idempotency_token
1494
+ }, {
1495
+ customToast: function customToast() {}
1496
+ });
1497
+ case 13:
1498
+ result = _context17.sent;
1499
+ if (!((result === null || result === void 0 ? void 0 : result.code) === 200 && !(result !== null && result !== void 0 && result.data))) {
1500
+ _context17.next = 16;
1501
+ break;
1502
+ }
1503
+ return _context17.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
1504
+ data: {
1505
+ order_id: orderId
1506
+ }
1507
+ }));
1508
+ case 16:
1509
+ return _context17.abrupt("return", result);
1510
+ case 17:
1511
+ case "end":
1512
+ return _context17.stop();
1513
+ }
1514
+ }, _callee17, this);
1515
+ }));
1516
+ function submitScanOrderMore(_x11) {
1517
+ return _submitScanOrderMore.apply(this, arguments);
1518
+ }
1519
+ return submitScanOrderMore;
1520
+ }()
1520
1521
  }, {
1521
1522
  key: "submitScanOrder",
1522
1523
  value: function () {
1523
1524
  var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1524
- var _this$store$resource, _this$otherParams6, _this$otherParams7, _this$otherParams8, _this$otherParams9, _tempOrder$products, tempOrderForSubmit, resourceTableName, enhancePayload, result, tempOrder;
1525
+ var _this$store$resource2, _tempOrder$products, pax, tempOrderForSubmit, resourceTableName, enhancePayload, result, tempOrder;
1525
1526
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1526
1527
  while (1) switch (_context18.prev = _context18.next) {
1527
1528
  case 0:
@@ -1536,9 +1537,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1536
1537
  }
1537
1538
  throw new Error('scanOrder解决方案需要 order 模块支持');
1538
1539
  case 6:
1540
+ pax = normalizeSubmitCollectPaxValue(this.store.entryPaxNumber);
1541
+ this.store.entryPaxNumber = pax;
1539
1542
  tempOrderForSubmit = this.store.order.ensureTempOrder();
1543
+ tempOrderForSubmit.metadata = _objectSpread(_objectSpread({}, tempOrderForSubmit.metadata), {}, {
1544
+ collect_pax: pax
1545
+ });
1540
1546
  tempOrderForSubmit.delivery_type = 'shop_service';
1541
- resourceTableName = (_this$store$resource = this.store.resource) === null || _this$store$resource === void 0 || (_this$store$resource = _this$store$resource.table_form_record) === null || _this$store$resource === void 0 ? void 0 : _this$store$resource.name;
1547
+ resourceTableName = (_this$store$resource2 = this.store.resource) === null || _this$store$resource2 === void 0 || (_this$store$resource2 = _this$store$resource2.table_form_record) === null || _this$store$resource2 === void 0 ? void 0 : _this$store$resource2.name;
1542
1548
  if (resourceTableName && _typeof(resourceTableName) === 'object') {
1543
1549
  tempOrderForSubmit.table_number = resourceTableName;
1544
1550
  } else {
@@ -1546,32 +1552,43 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1546
1552
  }
1547
1553
  this.store.order.persistTempOrder();
1548
1554
  enhancePayload = this.buildSubmitPayloadEnhancer();
1549
- _context18.next = 14;
1550
- return this.store.order.submitTempOrder({
1551
- cacheId: this.cacheId,
1552
- platform: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform,
1553
- businessCode: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode,
1554
- channel: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.channel,
1555
- type: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.type,
1555
+ if (!this.isScanOrderMoreMode(tempOrderForSubmit)) {
1556
+ _context18.next = 21;
1557
+ break;
1558
+ }
1559
+ _context18.next = 18;
1560
+ return this.submitScanOrderMore({
1561
+ tempOrder: tempOrderForSubmit,
1556
1562
  enhancePayload: enhancePayload
1557
1563
  });
1558
- case 14:
1559
- result = _context18.sent;
1564
+ case 18:
1565
+ _context18.t0 = _context18.sent;
1566
+ _context18.next = 24;
1567
+ break;
1568
+ case 21:
1569
+ _context18.next = 23;
1570
+ return this.submitSalesOrder({
1571
+ enhancePayload: enhancePayload
1572
+ });
1573
+ case 23:
1574
+ _context18.t0 = _context18.sent;
1575
+ case 24:
1576
+ result = _context18.t0;
1560
1577
  tempOrder = this.store.order.getTempOrder();
1561
1578
  this.logMethodSuccess('submitScanOrder', {
1562
1579
  productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products = tempOrder.products) === null || _tempOrder$products === void 0 ? void 0 : _tempOrder$products.length) || 0
1563
1580
  });
1564
1581
  return _context18.abrupt("return", result);
1565
- case 20:
1566
- _context18.prev = 20;
1567
- _context18.t0 = _context18["catch"](1);
1568
- this.logMethodError('submitScanOrder', _context18.t0);
1569
- throw _context18.t0;
1570
- case 24:
1582
+ case 30:
1583
+ _context18.prev = 30;
1584
+ _context18.t1 = _context18["catch"](1);
1585
+ this.logMethodError('submitScanOrder', _context18.t1);
1586
+ throw _context18.t1;
1587
+ case 34:
1571
1588
  case "end":
1572
1589
  return _context18.stop();
1573
1590
  }
1574
- }, _callee18, this, [[1, 20]]);
1591
+ }, _callee18, this, [[1, 30]]);
1575
1592
  }));
1576
1593
  function submitScanOrder() {
1577
1594
  return _submitScanOrder.apply(this, arguments);
@@ -1622,20 +1639,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1622
1639
  }
1623
1640
  }, _callee19, this, [[1, 15]]);
1624
1641
  }));
1625
- function addProductToOrder(_x11) {
1642
+ function addProductToOrder(_x12) {
1626
1643
  return _addProductToOrder.apply(this, arguments);
1627
1644
  }
1628
1645
  return addProductToOrder;
1629
1646
  }()
1630
1647
  }, {
1631
- key: "updateProductInOrder",
1648
+ key: "updateOrderProduct",
1632
1649
  value: function () {
1633
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
1650
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
1634
1651
  var products;
1635
1652
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1636
1653
  while (1) switch (_context20.prev = _context20.next) {
1637
1654
  case 0:
1638
- this.logMethodStart('updateProductInOrder', {
1655
+ this.logMethodStart('updateOrderProduct', {
1639
1656
  product_id: params.product_id,
1640
1657
  product_variant_id: params.product_variant_id
1641
1658
  });
@@ -1647,7 +1664,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1647
1664
  throw new Error('order 模块未初始化');
1648
1665
  case 4:
1649
1666
  _context20.next = 6;
1650
- return this.store.order.updateProductInOrder(params);
1667
+ return this.store.order.updateOrderProduct(params);
1651
1668
  case 6:
1652
1669
  products = _context20.sent;
1653
1670
  _context20.next = 9;
@@ -1656,14 +1673,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1656
1673
  _context20.next = 11;
1657
1674
  return this.refreshCartValidationPassed();
1658
1675
  case 11:
1659
- this.logMethodSuccess('updateProductInOrder', {
1676
+ this.logMethodSuccess('updateOrderProduct', {
1660
1677
  productCount: products.length
1661
1678
  });
1662
1679
  return _context20.abrupt("return", products);
1663
1680
  case 15:
1664
1681
  _context20.prev = 15;
1665
1682
  _context20.t0 = _context20["catch"](1);
1666
- this.logMethodError('updateProductInOrder', _context20.t0);
1683
+ this.logMethodError('updateOrderProduct', _context20.t0);
1667
1684
  throw _context20.t0;
1668
1685
  case 19:
1669
1686
  case "end":
@@ -1671,10 +1688,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1671
1688
  }
1672
1689
  }, _callee20, this, [[1, 15]]);
1673
1690
  }));
1674
- function updateProductInOrder(_x12) {
1675
- return _updateProductInOrder.apply(this, arguments);
1691
+ function updateOrderProduct(_x13) {
1692
+ return _updateOrderProduct.apply(this, arguments);
1676
1693
  }
1677
- return updateProductInOrder;
1694
+ return updateOrderProduct;
1678
1695
  }()
1679
1696
  /**
1680
1697
  * 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
@@ -1701,12 +1718,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1701
1718
  }
1702
1719
  };
1703
1720
  if (identity.identity_key !== undefined) params.identity_key = identity.identity_key;
1704
- if (identity.product_option_item !== undefined) {
1705
- params.product_option_item = identity.product_option_item;
1721
+ if (identity.product_sku !== undefined) {
1722
+ params.product_sku = identity.product_sku;
1706
1723
  }
1707
1724
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
1708
1725
  _context21.next = 8;
1709
- return this.updateProductInOrder(params);
1726
+ return this.updateOrderProduct(params);
1710
1727
  case 8:
1711
1728
  products = _context21.sent;
1712
1729
  this.logMethodSuccess('setOrderProductLineNote', {
@@ -1724,7 +1741,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1724
1741
  }
1725
1742
  }, _callee21, this, [[1, 13]]);
1726
1743
  }));
1727
- function setOrderProductLineNote(_x13, _x14) {
1744
+ function setOrderProductLineNote(_x14, _x15) {
1728
1745
  return _setOrderProductLineNote.apply(this, arguments);
1729
1746
  }
1730
1747
  return setOrderProductLineNote;
@@ -1773,7 +1790,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1773
1790
  }
1774
1791
  }, _callee22, this, [[1, 15]]);
1775
1792
  }));
1776
- function removeProductFromOrder(_x15) {
1793
+ function removeProductFromOrder(_x16) {
1777
1794
  return _removeProductFromOrder.apply(this, arguments);
1778
1795
  }
1779
1796
  return removeProductFromOrder;
@@ -1850,7 +1867,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1850
1867
  }
1851
1868
  }, _callee24, this);
1852
1869
  }));
1853
- function syncItemRuleConfigsFromDineInConfig(_x16) {
1870
+ function syncItemRuleConfigsFromDineInConfig(_x17) {
1854
1871
  return _syncItemRuleConfigsFromDineInConfig.apply(this, arguments);
1855
1872
  }
1856
1873
  return syncItemRuleConfigsFromDineInConfig;
@@ -1907,7 +1924,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1907
1924
  }
1908
1925
  }, _callee25, this, [[3, 13]]);
1909
1926
  }));
1910
- function fetchItemRuleConfigsByModelIds(_x17) {
1927
+ function fetchItemRuleConfigsByModelIds(_x18) {
1911
1928
  return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
1912
1929
  }
1913
1930
  return fetchItemRuleConfigsByModelIds;
@@ -1957,16 +1974,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1957
1974
  var rawProductId = (_node$product_id = node.product_id) !== null && _node$product_id !== void 0 ? _node$product_id : node.id;
1958
1975
  var productId = Number(rawProductId);
1959
1976
  if (Number.isFinite(productId) && productId > 0) {
1960
- var _ref7, _node$product_variant;
1961
- var productVariantId = Number((_ref7 = (_node$product_variant = node.product_variant_id) !== null && _node$product_variant !== void 0 ? _node$product_variant : node.variant_id) !== null && _ref7 !== void 0 ? _ref7 : 0);
1977
+ var _ref6, _node$product_variant;
1978
+ var productVariantId = Number((_ref6 = (_node$product_variant = node.product_variant_id) !== null && _node$product_variant !== void 0 ? _node$product_variant : node.variant_id) !== null && _ref6 !== void 0 ? _ref6 : 0);
1962
1979
  var normalizedVariantId = Number.isNaN(productVariantId) ? 0 : productVariantId;
1963
1980
  var key = buildProductKey(productId, normalizedVariantId);
1964
1981
  if (!sourceMap.has(key)) {
1965
1982
  sourceMap.set(key, node);
1966
1983
  }
1967
1984
  }
1968
- for (var _i4 = 0, _Object$values = Object.values(node); _i4 < _Object$values.length; _i4++) {
1969
- var childValue = _Object$values[_i4];
1985
+ for (var _i3 = 0, _Object$values = Object.values(node); _i3 < _Object$values.length; _i3++) {
1986
+ var childValue = _Object$values[_i3];
1970
1987
  if (childValue && _typeof(childValue) === 'object') {
1971
1988
  collectFromValue(childValue);
1972
1989
  }
@@ -2079,7 +2096,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2079
2096
  return _context29.abrupt("return", []);
2080
2097
  case 7:
2081
2098
  businessData = buildItemRuleBusinessData({
2082
- tempOrder: this.ensureTempOrder(),
2099
+ tempOrder: this.ensureScanOrderTempOrder(),
2083
2100
  runtimeConfig: this.getItemRuleRuntimeConfig(),
2084
2101
  itemRuleConfigs: this.itemRuleConfigs
2085
2102
  });
@@ -2110,7 +2127,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2110
2127
  key: "applyPrefillByItemRule",
2111
2128
  value: function () {
2112
2129
  var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2113
- var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator6, _step6, _prefillItem$product_, _targetProduct$_origi, _targetProduct$_origi2, _targetProduct$_origi3, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasOriginChanged;
2130
+ var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator6, _step6, _prefillItem$product_, _origin2, _origin3, _origin4, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasOriginChanged;
2114
2131
  return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2115
2132
  while (1) switch (_context30.prev = _context30.next) {
2116
2133
  case 0:
@@ -2137,7 +2154,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2137
2154
  return _context30.abrupt("return");
2138
2155
  case 9:
2139
2156
  businessData = buildItemRuleBusinessData({
2140
- tempOrder: this.ensureTempOrder(),
2157
+ tempOrder: this.ensureScanOrderTempOrder(),
2141
2158
  runtimeConfig: this.getItemRuleRuntimeConfig(),
2142
2159
  itemRuleConfigs: this.itemRuleConfigs
2143
2160
  });
@@ -2153,7 +2170,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2153
2170
  return this.buildPrefillProductSourceMap();
2154
2171
  case 16:
2155
2172
  productSourceMap = _context30.sent;
2156
- tempOrder = this.ensureTempOrder();
2173
+ tempOrder = this.ensureScanOrderTempOrder();
2157
2174
  hasChanges = false;
2158
2175
  _iterator6 = _createForOfIteratorHelper(prefillItems);
2159
2176
  _context30.prev = 20;
@@ -2220,7 +2237,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2220
2237
  _origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
2221
2238
  });
2222
2239
  hasQuantityChanged = delta > 0;
2223
- hasOriginChanged = Boolean(sourceItem && (!targetProduct._origin || ((_targetProduct$_origi = targetProduct._origin) === null || _targetProduct$_origi === void 0 ? void 0 : _targetProduct$_origi.name) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.name) || ((_targetProduct$_origi2 = targetProduct._origin) === null || _targetProduct$_origi2 === void 0 ? void 0 : _targetProduct$_origi2.title) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.title) || ((_targetProduct$_origi3 = targetProduct._origin) === null || _targetProduct$_origi3 === void 0 ? void 0 : _targetProduct$_origi3.price) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price)));
2240
+ hasOriginChanged = Boolean(sourceItem && (!targetProduct._origin || ((_origin2 = targetProduct._origin) === null || _origin2 === void 0 ? void 0 : _origin2.name) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.name) || ((_origin3 = targetProduct._origin) === null || _origin3 === void 0 ? void 0 : _origin3.title) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.title) || ((_origin4 = targetProduct._origin) === null || _origin4 === void 0 ? void 0 : _origin4.price) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price)));
2224
2241
  if (hasQuantityChanged || hasOriginChanged) {
2225
2242
  tempOrder.products[productIndex] = nextProduct;
2226
2243
  hasChanges = true;
@@ -2328,7 +2345,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2328
2345
  });
2329
2346
  case 5:
2330
2347
  businessData = buildItemRuleBusinessData({
2331
- tempOrder: this.ensureTempOrder(),
2348
+ tempOrder: this.ensureScanOrderTempOrder(),
2332
2349
  runtimeConfig: this.getItemRuleRuntimeConfig(),
2333
2350
  itemRuleConfigs: this.itemRuleConfigs
2334
2351
  });
@@ -2482,14 +2499,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2482
2499
  }, {
2483
2500
  key: "normalizeResourceState",
2484
2501
  value: function normalizeResourceState(detail, resourceSelectType, hasOrderId) {
2485
- var _detail$form_record, _this$otherParams10, _detail$resource_capa, _detail$resource_capa2;
2502
+ var _detail$form_record, _this$otherParams13, _detail$resource_capa, _detail$resource_capa2;
2486
2503
  var currentOrderId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.order_id);
2487
2504
  var lastOrderId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.last_order_id);
2488
2505
  var relationId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.form_record_id);
2489
2506
  var tableFormId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.form_id);
2490
2507
  var formRecord = (_detail$form_record = detail === null || detail === void 0 ? void 0 : detail.form_record) !== null && _detail$form_record !== void 0 ? _detail$form_record : null;
2491
2508
  // 是否允许加餐
2492
- var allowSnack = ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 || (_this$otherParams10 = _this$otherParams10.dineInConfig) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10['sale.allow_add_items']) || false;
2509
+ var allowSnack = ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.dineInConfig) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13['sale.allow_add_items']) || false;
2493
2510
  // 开启同桌验证 - 本期没有这个配置,默认关掉
2494
2511
  var deskmateValid = false;
2495
2512
  var isExclusive = resourceSelectType === 'single';
@@ -2572,7 +2589,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2572
2589
  key: "fetchResourceOccupyDetailsByResourceId",
2573
2590
  value: function () {
2574
2591
  var _fetchResourceOccupyDetailsByResourceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId) {
2575
- var _this$otherParams11, _this$otherParams11$g, _response$data$occupy, _response$data;
2592
+ var _this$otherParams14, _this$otherParams14$g, _response$data$occupy, _response$data;
2576
2593
  var formRecordId, shopId, response;
2577
2594
  return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2578
2595
  while (1) switch (_context36.prev = _context36.next) {
@@ -2584,7 +2601,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2584
2601
  }
2585
2602
  throw new Error("[ScanOrder] \u975E\u6CD5\u684C\u53F0 resourceId: ".concat(resourceId));
2586
2603
  case 3:
2587
- shopId = (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 || (_this$otherParams11$g = _this$otherParams11.getStateData) === null || _this$otherParams11$g === void 0 ? void 0 : _this$otherParams11$g.call(_this$otherParams11, 'shop_id');
2604
+ shopId = (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 || (_this$otherParams14$g = _this$otherParams14.getStateData) === null || _this$otherParams14$g === void 0 ? void 0 : _this$otherParams14$g.call(_this$otherParams14, 'shop_id');
2588
2605
  if (shopId) {
2589
2606
  _context36.next = 6;
2590
2607
  break;
@@ -2614,7 +2631,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2614
2631
  }
2615
2632
  }, _callee36, this);
2616
2633
  }));
2617
- function fetchResourceOccupyDetailsByResourceId(_x18) {
2634
+ function fetchResourceOccupyDetailsByResourceId(_x19) {
2618
2635
  return _fetchResourceOccupyDetailsByResourceId.apply(this, arguments);
2619
2636
  }
2620
2637
  return fetchResourceOccupyDetailsByResourceId;
@@ -2678,19 +2695,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2678
2695
  var hasOrderId,
2679
2696
  normalizedResourceId,
2680
2697
  _this$otherParams$bus,
2681
- _this$otherParams12,
2698
+ _this$otherParams15,
2682
2699
  _this$otherParams$cha,
2683
- _this$otherParams13,
2684
- _this$otherParams14,
2685
- _this$otherParams14$g,
2700
+ _this$otherParams16,
2701
+ _this$otherParams17,
2702
+ _this$otherParams17$g,
2686
2703
  _occupyDetails$,
2687
2704
  _occupyDetail$form_re,
2688
2705
  _occupyDetail$form_re2,
2689
- _this$otherParams15,
2690
2706
  _this$store$order6,
2691
2707
  _this$store$order7,
2692
2708
  _this$store$order7$ge,
2693
- _this$otherParams16,
2709
+ _this$otherParams18,
2710
+ _this$store$resource3,
2711
+ _this$store$resource4,
2694
2712
  businessCode,
2695
2713
  channel,
2696
2714
  openDataTarget,
@@ -2719,6 +2737,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2719
2737
  occupancyMinutes,
2720
2738
  paxBounds,
2721
2739
  error,
2740
+ _occupancyMinutes,
2741
+ _paxBounds,
2742
+ _error,
2722
2743
  occupyDetails,
2723
2744
  occupyDetail,
2724
2745
  resourceSelectType,
@@ -2743,11 +2764,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2743
2764
  resourceId: normalizedResourceId
2744
2765
  });
2745
2766
  _context37.prev = 3;
2746
- businessCode = String((_this$otherParams$bus = (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : '').trim();
2747
- channel = String((_this$otherParams$cha = (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
2767
+ businessCode = String((_this$otherParams$bus = (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : '').trim();
2768
+ channel = String((_this$otherParams$cha = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
2748
2769
  openDataTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : 'dine_in+scan_to_order';
2749
2770
  _context37.next = 9;
2750
- return (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 || (_this$otherParams14$g = _this$otherParams14.getOpenData) === null || _this$otherParams14$g === void 0 ? void 0 : _this$otherParams14$g.call(_this$otherParams14, {
2771
+ return (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 || (_this$otherParams17$g = _this$otherParams17.getOpenData) === null || _this$otherParams17$g === void 0 ? void 0 : _this$otherParams17$g.call(_this$otherParams17, {
2751
2772
  scope: 'board',
2752
2773
  target: openDataTarget,
2753
2774
  section_code: ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow']
@@ -2818,7 +2839,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2818
2839
  case 31:
2819
2840
  // Step1: 先加载预约规则商品,拿到 enabledReservationRuleProducts 与容量附加信息
2820
2841
  // (resourceSelectType 需要基于这些商品 + 占用接口的 form_id 计算,故必须前置)
2821
- tempOrder = this.ensureTempOrder();
2842
+ tempOrder = this.ensureScanOrderTempOrder();
2822
2843
  reservationLinkIds = collectLinkProductIdsFromReservationRules(dineInConfig['fulfillment.enabled_resource_rules']);
2823
2844
  if (!(!normalizedResourceId || reservationLinkIds.length === 0)) {
2824
2845
  _context37.next = 37;
@@ -2885,6 +2906,29 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2885
2906
  scheduleDatetime: scheduleDatetime,
2886
2907
  cacheId: this.cacheId
2887
2908
  });
2909
+ if (Array.isArray(loaded)) {
2910
+ this.enabledReservationRuleProducts = loaded;
2911
+ _occupancyMinutes = pickFirstDurationMinutesFromProducts(loaded);
2912
+ if (_occupancyMinutes !== undefined) {
2913
+ tempOrder.metadata.table_occupancy_duration = _occupancyMinutes;
2914
+ }
2915
+ if (hasCustomCapacityProduct(loaded)) {
2916
+ pendingRequestEntryPax = 1;
2917
+ _paxBounds = pickFirstCustomCapacityPaxBounds(loaded);
2918
+ if ((_paxBounds === null || _paxBounds === void 0 ? void 0 : _paxBounds.min) !== undefined) pendingRequestPaxMin = _paxBounds.min;
2919
+ if ((_paxBounds === null || _paxBounds === void 0 ? void 0 : _paxBounds.max) !== undefined) pendingRequestPaxMax = _paxBounds.max;
2920
+ }
2921
+ } else {
2922
+ this.enabledReservationRuleProducts = [];
2923
+ _error = loaded instanceof Error ? loaded : new Error('预约规则商品列表接口返回异常');
2924
+ this.logMethodError('loadReservationRuleProducts', _error, {
2925
+ resourceId: resourceId,
2926
+ reservationLinkIds: reservationLinkIds,
2927
+ scheduleDate: scheduleDate,
2928
+ scheduleDatetime: scheduleDatetime,
2929
+ cacheId: this.cacheId
2930
+ });
2931
+ }
2888
2932
  }
2889
2933
 
2890
2934
  // Step2: 请求新的资源占用详情接口。occupy_details 第一维是资源,不是订单。
@@ -2961,19 +3005,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2961
3005
  } : {}), this.store.resource.requestPaxMax !== undefined ? {
2962
3006
  requestPaxMax: this.store.resource.requestPaxMax
2963
3007
  } : {});
2964
- tempOrder.relation_id = normalizedResourceId || ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.relation_id);
2965
- tempOrder.table_form_id = resourceState.tableFormId;
2966
- tempOrder.resource_id = normalizedResourceId;
2967
3008
  (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || _this$store$order6.persistTempOrder();
2968
3009
 
2969
3010
  // 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
2970
3011
  if (!(availabilityInfo.mode === 'idle')) {
2971
- _context37.next = 76;
3012
+ _context37.next = 73;
2972
3013
  break;
2973
3014
  }
2974
- _context37.next = 76;
3015
+ _context37.next = 73;
2975
3016
  return this.addNewOrder();
2976
- case 76:
3017
+ case 73:
2977
3018
  isAdditionalOrderMode = availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code'; // 如果是加单模式,tempOrder 里需要记录目标订单 id,提交的时候走加单接口
2978
3019
  if (isAdditionalOrderMode) {
2979
3020
  tempOrder.order_id = additionalOrderId;
@@ -2989,13 +3030,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2989
3030
  } : {}));
2990
3031
  return acc;
2991
3032
  }, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
2992
- _context37.next = 82;
3033
+ _context37.next = 79;
2993
3034
  return this.setItemRuleRuntimeConfig({
2994
- serviceType: (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.businessCode,
3035
+ serviceType: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode,
2995
3036
  submissionIndex: isAdditionalOrderMode ? 1 : 0,
2996
3037
  historicalItems: historicalItems
2997
3038
  });
2998
- case 82:
3039
+ case 79:
2999
3040
  // operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
3000
3041
  // 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
3001
3042
  if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
@@ -3009,28 +3050,28 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3009
3050
  orderId: availabilityInfo.order_id,
3010
3051
  relationId: availabilityInfo.relation_id,
3011
3052
  tableFormId: availabilityInfo.table_form_id,
3012
- persistedRelationId: tempOrder.relation_id,
3013
- persistedResourceId: tempOrder.resource_id,
3053
+ persistedRelationId: (_this$store$resource3 = this.store.resource) === null || _this$store$resource3 === void 0 ? void 0 : _this$store$resource3.relationId,
3054
+ persistedResourceId: (_this$store$resource4 = this.store.resource) === null || _this$store$resource4 === void 0 ? void 0 : _this$store$resource4.relationId,
3014
3055
  deskmateValid: availabilityInfo.deskmate_valid,
3015
3056
  resourceSelectType: resourceState.resourceSelectType,
3016
3057
  isExclusive: resourceState.isExclusive,
3017
3058
  isFull: resourceState.isFull
3018
3059
  });
3019
3060
  return _context37.abrupt("return", availabilityInfo);
3020
- case 87:
3021
- _context37.prev = 87;
3061
+ case 84:
3062
+ _context37.prev = 84;
3022
3063
  _context37.t0 = _context37["catch"](3);
3023
3064
  this.logMethodError('checkResourceAvailable', _context37.t0.message, {
3024
3065
  resourceId: normalizedResourceId
3025
3066
  });
3026
3067
  throw _context37.t0;
3027
- case 91:
3068
+ case 88:
3028
3069
  case "end":
3029
3070
  return _context37.stop();
3030
3071
  }
3031
- }, _callee37, this, [[3, 87]]);
3072
+ }, _callee37, this, [[3, 84]]);
3032
3073
  }));
3033
- function checkResourceAvailable(_x19) {
3074
+ function checkResourceAvailable(_x20) {
3034
3075
  return _checkResourceAvailable.apply(this, arguments);
3035
3076
  }
3036
3077
  return checkResourceAvailable;
@@ -3039,18 +3080,25 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3039
3080
  key: "restorePreviousOrderData",
3040
3081
  value: function () {
3041
3082
  var _restorePreviousOrderData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3042
- var tempOrder, _this$store$order8, _res$data, res, entryPaxNumber;
3083
+ var orderModule, tempOrder, _res$data, res, entryPaxNumber;
3043
3084
  return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3044
3085
  while (1) switch (_context38.prev = _context38.next) {
3045
3086
  case 0:
3046
- tempOrder = this.ensureTempOrder();
3087
+ orderModule = this.store.order;
3088
+ if (orderModule) {
3089
+ _context38.next = 3;
3090
+ break;
3091
+ }
3092
+ return _context38.abrupt("return");
3093
+ case 3:
3094
+ tempOrder = orderModule.ensureTempOrder();
3047
3095
  if (!tempOrder.order_id) {
3048
- _context38.next = 9;
3096
+ _context38.next = 12;
3049
3097
  break;
3050
3098
  }
3051
- _context38.next = 4;
3052
- return (_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 ? void 0 : _this$store$order8.getOrderInfoByRemote(tempOrder.order_id);
3053
- case 4:
3099
+ _context38.next = 7;
3100
+ return orderModule.getOrderInfo(tempOrder.order_id);
3101
+ case 7:
3054
3102
  res = _context38.sent;
3055
3103
  // 找到下单的时候输入的 entryPaxNumber
3056
3104
  entryPaxNumber = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.bookings) === null || _res$data === void 0 || (_res$data = _res$data.find(function (p) {
@@ -3058,12 +3106,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3058
3106
  return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
3059
3107
  })) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
3060
3108
  if (!entryPaxNumber) {
3061
- _context38.next = 9;
3109
+ _context38.next = 12;
3062
3110
  break;
3063
3111
  }
3064
- _context38.next = 9;
3112
+ _context38.next = 12;
3065
3113
  return this.setEntryPaxNumber(entryPaxNumber);
3066
- case 9:
3114
+ case 12:
3067
3115
  case "end":
3068
3116
  return _context38.stop();
3069
3117
  }
@@ -3110,31 +3158,32 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3110
3158
  key: "getProductList",
3111
3159
  value: function () {
3112
3160
  var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3113
- var _this$otherParams17;
3114
- var menu_list_ids, res, productList, formattedRes;
3161
+ var _this$otherParams19;
3162
+ var associatedMenus, menu_list_ids, res, productList, formattedRes;
3115
3163
  return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3116
3164
  while (1) switch (_context40.prev = _context40.next) {
3117
3165
  case 0:
3118
3166
  this.logMethodStart('getProductList');
3119
3167
  // 可以直接通过配置里的 menu 读取
3120
- menu_list_ids = ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 || (_this$otherParams17 = _this$otherParams17.dineInConfig) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17['menu.associated_menus'].map(function (n) {
3168
+ associatedMenus = (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 || (_this$otherParams19 = _this$otherParams19.dineInConfig) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19['menu.associated_menus'];
3169
+ menu_list_ids = associatedMenus.map(function (n) {
3121
3170
  return Number(n.value);
3122
- })) || [];
3123
- _context40.prev = 2;
3171
+ }) || [];
3172
+ _context40.prev = 3;
3124
3173
  if (this.store.products) {
3125
- _context40.next = 5;
3174
+ _context40.next = 6;
3126
3175
  break;
3127
3176
  }
3128
3177
  throw new Error('products 模块未初始化');
3129
- case 5:
3130
- _context40.next = 7;
3178
+ case 6:
3179
+ _context40.next = 8;
3131
3180
  return this.store.products.loadProducts({
3132
3181
  menu_list_ids: menu_list_ids,
3133
3182
  cacheId: this.cacheId,
3134
3183
  schedule_date: dayjs().format('YYYY-MM-DD'),
3135
3184
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
3136
3185
  });
3137
- case 7:
3186
+ case 8:
3138
3187
  res = _context40.sent;
3139
3188
  productList = this.assertProductListLoaded('getProductList', res, {
3140
3189
  menu_list_ids: menu_list_ids,
@@ -3145,9 +3194,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3145
3194
  menuCount: menu_list_ids.length
3146
3195
  });
3147
3196
  return _context40.abrupt("return", formattedRes);
3148
- case 14:
3149
- _context40.prev = 14;
3150
- _context40.t0 = _context40["catch"](2);
3197
+ case 15:
3198
+ _context40.prev = 15;
3199
+ _context40.t0 = _context40["catch"](3);
3151
3200
  if (!(_context40.t0 !== null && _context40.t0 !== void 0 && _context40.t0.__scanOrderLogged)) {
3152
3201
  this.logMethodError('getProductList', _context40.t0, {
3153
3202
  menu_list_ids: menu_list_ids,
@@ -3155,11 +3204,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3155
3204
  });
3156
3205
  }
3157
3206
  throw _context40.t0;
3158
- case 18:
3207
+ case 19:
3159
3208
  case "end":
3160
3209
  return _context40.stop();
3161
3210
  }
3162
- }, _callee40, this, [[2, 14]]);
3211
+ }, _callee40, this, [[3, 15]]);
3163
3212
  }));
3164
3213
  function getProductList() {
3165
3214
  return _getProductList.apply(this, arguments);
@@ -3175,14 +3224,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3175
3224
  key: "setOtherParams",
3176
3225
  value: function () {
3177
3226
  var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
3178
- var _ref9,
3179
- _ref9$cover,
3227
+ var _ref8,
3228
+ _ref8$cover,
3180
3229
  cover,
3181
3230
  _args41 = arguments;
3182
3231
  return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3183
3232
  while (1) switch (_context41.prev = _context41.next) {
3184
3233
  case 0:
3185
- _ref9 = _args41.length > 1 && _args41[1] !== undefined ? _args41[1] : {}, _ref9$cover = _ref9.cover, cover = _ref9$cover === void 0 ? false : _ref9$cover;
3234
+ _ref8 = _args41.length > 1 && _args41[1] !== undefined ? _args41[1] : {}, _ref8$cover = _ref8.cover, cover = _ref8$cover === void 0 ? false : _ref8$cover;
3186
3235
  if (cover) {
3187
3236
  this.otherParams = params;
3188
3237
  } else {
@@ -3194,7 +3243,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3194
3243
  }
3195
3244
  }, _callee41, this);
3196
3245
  }));
3197
- function setOtherParams(_x20) {
3246
+ function setOtherParams(_x21) {
3198
3247
  return _setOtherParams.apply(this, arguments);
3199
3248
  }
3200
3249
  return setOtherParams;
@@ -3319,7 +3368,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3319
3368
  }
3320
3369
  }, _callee42, this);
3321
3370
  }));
3322
- function setEntryPaxNumber(_x21) {
3371
+ function setEntryPaxNumber(_x22) {
3323
3372
  return _setEntryPaxNumber.apply(this, arguments);
3324
3373
  }
3325
3374
  return setEntryPaxNumber;
@@ -3333,18 +3382,24 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3333
3382
  key: "syncAdditionalOrderFromResource",
3334
3383
  value: function () {
3335
3384
  var _syncAdditionalOrderFromResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(resourceId) {
3336
- var _ref10, _ref11, _ref12, _this$store$resource2, _this$store$resource3, _occupyDetails$2, _this$store$resource4, _this$otherParams18, _this$store$order9;
3385
+ var _ref9, _ref10, _ref11, _this$store$resource5, _this$store$resource6, _occupyDetails$2, _this$store$resource7, _this$otherParams20, _this$store$order8;
3337
3386
  var tempOrder, normalizedResourceId, _result, occupyDetails, occupyDetail, resourceSelectType, allowAddItems, result;
3338
3387
  return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3339
3388
  while (1) switch (_context43.prev = _context43.next) {
3340
3389
  case 0:
3341
- tempOrder = this.ensureTempOrder();
3342
- normalizedResourceId = String((_ref10 = (_ref11 = (_ref12 = resourceId !== null && resourceId !== void 0 ? resourceId : tempOrder.resource_id) !== null && _ref12 !== void 0 ? _ref12 : (_this$store$resource2 = this.store.resource) === null || _this$store$resource2 === void 0 ? void 0 : _this$store$resource2.relationId) !== null && _ref11 !== void 0 ? _ref11 : (_this$store$resource3 = this.store.resource) === null || _this$store$resource3 === void 0 ? void 0 : _this$store$resource3.relation_id) !== null && _ref10 !== void 0 ? _ref10 : '').trim();
3390
+ if (this.store.order) {
3391
+ _context43.next = 2;
3392
+ break;
3393
+ }
3394
+ throw new Error('order 模块未初始化');
3395
+ case 2:
3396
+ tempOrder = this.store.order.ensureTempOrder();
3397
+ normalizedResourceId = String((_ref9 = (_ref10 = (_ref11 = resourceId !== null && resourceId !== void 0 ? resourceId : tempOrder.resource_id) !== null && _ref11 !== void 0 ? _ref11 : (_this$store$resource5 = this.store.resource) === null || _this$store$resource5 === void 0 ? void 0 : _this$store$resource5.relationId) !== null && _ref10 !== void 0 ? _ref10 : (_this$store$resource6 = this.store.resource) === null || _this$store$resource6 === void 0 ? void 0 : _this$store$resource6.relation_id) !== null && _ref9 !== void 0 ? _ref9 : '').trim();
3343
3398
  this.logMethodStart('syncAdditionalOrderFromResource', {
3344
3399
  resourceId: normalizedResourceId
3345
3400
  });
3346
3401
  if (normalizedResourceId) {
3347
- _context43.next = 7;
3402
+ _context43.next = 9;
3348
3403
  break;
3349
3404
  }
3350
3405
  _result = {
@@ -3353,17 +3408,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3353
3408
  };
3354
3409
  this.logMethodSuccess('syncAdditionalOrderFromResource', _result);
3355
3410
  return _context43.abrupt("return", _result);
3356
- case 7:
3357
- _context43.next = 9;
3358
- return this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
3359
3411
  case 9:
3412
+ _context43.next = 11;
3413
+ return this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
3414
+ case 11:
3360
3415
  occupyDetails = _context43.sent;
3361
3416
  occupyDetail = (_occupyDetails$2 = occupyDetails[0]) !== null && _occupyDetails$2 !== void 0 ? _occupyDetails$2 : null;
3362
- resourceSelectType = ((_this$store$resource4 = this.store.resource) === null || _this$store$resource4 === void 0 ? void 0 : _this$store$resource4.resourceSelectType) || this.resolveResourceSelectType(toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id));
3363
- allowAddItems = toBoolean((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 || (_this$otherParams18 = _this$otherParams18.dineInConfig) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18['sale.allow_add_items']);
3417
+ resourceSelectType = ((_this$store$resource7 = this.store.resource) === null || _this$store$resource7 === void 0 ? void 0 : _this$store$resource7.resourceSelectType) || this.resolveResourceSelectType(toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id));
3418
+ allowAddItems = toBoolean((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 || (_this$otherParams20 = _this$otherParams20.dineInConfig) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20['sale.allow_add_items']);
3364
3419
  result = this.resolveAdditionalOrderFromOccupyDetail(occupyDetail, resourceSelectType, allowAddItems);
3365
3420
  if (!(!result.matched || !result.order_id)) {
3366
- _context43.next = 17;
3421
+ _context43.next = 19;
3367
3422
  break;
3368
3423
  }
3369
3424
  this.logMethodSuccess('syncAdditionalOrderFromResource', _objectSpread(_objectSpread({}, result), {}, {
@@ -3372,25 +3427,25 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3372
3427
  allowAddItems: allowAddItems
3373
3428
  }));
3374
3429
  return _context43.abrupt("return", result);
3375
- case 17:
3430
+ case 19:
3376
3431
  tempOrder.order_id = result.order_id;
3377
3432
  tempOrder.resource_id = normalizedResourceId;
3378
3433
  tempOrder.relation_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_record_id) || normalizedResourceId || tempOrder.relation_id;
3379
3434
  tempOrder.table_form_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id) || tempOrder.table_form_id;
3380
- (_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 || _this$store$order9.persistTempOrder();
3435
+ (_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || _this$store$order8.persistTempOrder();
3381
3436
  this.logMethodSuccess('syncAdditionalOrderFromResource', _objectSpread(_objectSpread({}, result), {}, {
3382
3437
  resourceId: normalizedResourceId,
3383
3438
  resourceSelectType: resourceSelectType,
3384
3439
  allowAddItems: allowAddItems
3385
3440
  }));
3386
3441
  return _context43.abrupt("return", result);
3387
- case 24:
3442
+ case 26:
3388
3443
  case "end":
3389
3444
  return _context43.stop();
3390
3445
  }
3391
3446
  }, _callee43, this);
3392
3447
  }));
3393
- function syncAdditionalOrderFromResource(_x22) {
3448
+ function syncAdditionalOrderFromResource(_x23) {
3394
3449
  return _syncAdditionalOrderFromResource.apply(this, arguments);
3395
3450
  }
3396
3451
  return syncAdditionalOrderFromResource;
@@ -3399,9 +3454,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3399
3454
  }, {
3400
3455
  key: "getReservationResourceSelectType",
3401
3456
  value: function getReservationResourceSelectType() {
3402
- var _this$store$resource5;
3457
+ var _this$store$resource8;
3403
3458
  this.logMethodStart('getReservationResourceSelectType');
3404
- var resourceSelectType = (_this$store$resource5 = this.store.resource) === null || _this$store$resource5 === void 0 ? void 0 : _this$store$resource5.resourceSelectType;
3459
+ var resourceSelectType = (_this$store$resource8 = this.store.resource) === null || _this$store$resource8 === void 0 ? void 0 : _this$store$resource8.resourceSelectType;
3405
3460
  var result = _objectSpread(_objectSpread({}, resourceSelectType ? {
3406
3461
  resourceSelectType: resourceSelectType
3407
3462
  } : {}), {}, {
@@ -3418,9 +3473,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3418
3473
  }, {
3419
3474
  key: "checkAllowAddItems",
3420
3475
  value: function checkAllowAddItems() {
3421
- var _this$otherParams19;
3476
+ var _this$otherParams21;
3422
3477
  this.logMethodStart('checkAllowAddItems');
3423
- var dineInConfig = ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.dineInConfig) || {};
3478
+ var dineInConfig = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.dineInConfig) || {};
3424
3479
  var result = {
3425
3480
  enabled: toBoolean(dineInConfig['sale.allow_add_items'])
3426
3481
  };
@@ -3433,9 +3488,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3433
3488
  }, {
3434
3489
  key: "getFulfillmentModes",
3435
3490
  value: function getFulfillmentModes() {
3436
- var _this$otherParams20;
3491
+ var _this$otherParams22;
3437
3492
  this.logMethodStart('getFulfillmentModes');
3438
- var dineInConfig = ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.dineInConfig) || {};
3493
+ var dineInConfig = ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.dineInConfig) || {};
3439
3494
  var result = {
3440
3495
  enablePickup: Boolean(dineInConfig['fulfillment.enable_pickup']),
3441
3496
  enableTableService: Boolean(dineInConfig['fulfillment.enable_table_service'])
@@ -3449,9 +3504,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3449
3504
  }, {
3450
3505
  key: "checkManualPickupRef",
3451
3506
  value: function checkManualPickupRef() {
3452
- var _this$otherParams21;
3507
+ var _this$otherParams23;
3453
3508
  this.logMethodStart('checkManualPickupRef');
3454
- var dineInConfig = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.dineInConfig) || {};
3509
+ var dineInConfig = ((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.dineInConfig) || {};
3455
3510
  var refMode = dineInConfig['fulfillment.fulfillment_ref_mode'];
3456
3511
  var manualInputType = dineInConfig['fulfillment.manual_input_type'];
3457
3512
  var enabled = refMode === 'manual_input';
@@ -3469,6 +3524,6 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3469
3524
  }
3470
3525
  }]);
3471
3526
  return ScanOrderImpl;
3472
- }(BaseModule);
3527
+ }(BaseSalesImpl);
3473
3528
  _defineProperty(ScanOrderImpl, "PISELL1_LOGIN_SUCCESS", 'pisell1.login.success');
3474
3529
  _defineProperty(ScanOrderImpl, "UI_STATE_KEY_PREFIX", 'pisell.scanOrder.uiState:');