@pisell/pisellos 2.2.314 → 2.2.316

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 (268) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +3 -1
  3. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
  4. package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
  5. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
  6. package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
  7. package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
  8. package/dist/model/strategy/adapter/itemRule/type.js +10 -0
  9. package/dist/model/strategy/adapter/promotion/evaluator.js +89 -104
  10. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
  11. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +28 -4
  12. package/dist/modules/BookingContext/utils/productExtend.d.ts +7 -0
  13. package/dist/modules/BookingContext/utils/productExtend.js +62 -18
  14. package/dist/modules/BookingContext/utils/resources.js +1 -1
  15. package/dist/modules/BusinessAvailability/index.d.ts +30 -0
  16. package/dist/modules/BusinessAvailability/index.js +204 -0
  17. package/dist/modules/Cart/index.js +4 -3
  18. package/dist/modules/Cart/types.d.ts +2 -0
  19. package/dist/modules/Cart/utils/cartProduct.d.ts +3 -1
  20. package/dist/modules/Cart/utils/cartProduct.js +59 -32
  21. package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
  22. package/dist/modules/FulfillmentTiming/index.js +407 -0
  23. package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
  24. package/dist/modules/FulfillmentTiming/types.js +1 -0
  25. package/dist/modules/Holder/utils.d.ts +2 -0
  26. package/dist/modules/Holder/utils.js +32 -2
  27. package/dist/modules/OpenData/contactInfo.d.ts +20 -0
  28. package/dist/modules/OpenData/contactInfo.js +70 -0
  29. package/dist/modules/OpenData/index.d.ts +1 -0
  30. package/dist/modules/OpenData/index.js +1 -0
  31. package/dist/modules/OpenData/types.d.ts +23 -0
  32. package/dist/modules/Order/holderRelations.d.ts +14 -0
  33. package/dist/modules/Order/holderRelations.js +154 -0
  34. package/dist/modules/Order/index.d.ts +16 -4
  35. package/dist/modules/Order/index.js +926 -511
  36. package/dist/modules/Order/localEftposState.d.ts +13 -0
  37. package/dist/modules/Order/localEftposState.js +39 -0
  38. package/dist/modules/Order/pickupTiming.d.ts +46 -0
  39. package/dist/modules/Order/pickupTiming.js +53 -0
  40. package/dist/modules/Order/types.d.ts +49 -3
  41. package/dist/modules/Order/types.js +2 -0
  42. package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
  43. package/dist/modules/Order/utils/discountProductLineIdentity.js +142 -7
  44. package/dist/modules/Order/utils/orderCollectionIdentity.js +24 -10
  45. package/dist/modules/Order/utils.d.ts +2 -1
  46. package/dist/modules/Order/utils.js +61 -17
  47. package/dist/modules/Payment/index.js +9 -10
  48. package/dist/modules/Product/types.d.ts +11 -0
  49. package/dist/modules/ProductList/index.js +1 -1
  50. package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
  51. package/dist/modules/ResourcePlanner/planner.js +332 -23
  52. package/dist/modules/ResourcePlanner/types.d.ts +29 -0
  53. package/dist/modules/Rules/index.js +62 -61
  54. package/dist/modules/Schedule/index.d.ts +8 -0
  55. package/dist/modules/Schedule/index.js +141 -39
  56. package/dist/modules/index.d.ts +1 -0
  57. package/dist/modules/index.js +1 -0
  58. package/dist/plugins/request.d.ts +7 -0
  59. package/dist/server/index.d.ts +1 -0
  60. package/dist/server/index.js +1557 -1322
  61. package/dist/server/modules/form/index.d.ts +19 -0
  62. package/dist/server/modules/form/index.js +205 -0
  63. package/dist/server/modules/form/types.d.ts +13 -0
  64. package/dist/server/modules/form/types.js +3 -0
  65. package/dist/server/modules/index.d.ts +3 -0
  66. package/dist/server/modules/index.js +4 -0
  67. package/dist/server/modules/order/index.d.ts +19 -0
  68. package/dist/server/modules/order/index.js +1071 -774
  69. package/dist/server/modules/order/types.d.ts +4 -0
  70. package/dist/server/modules/products/index.d.ts +28 -7
  71. package/dist/server/modules/products/index.js +1297 -770
  72. package/dist/server/modules/products/replication.d.ts +8 -0
  73. package/dist/server/modules/products/replication.js +69 -0
  74. package/dist/server/modules/products/types.d.ts +12 -1
  75. package/dist/server/modules/products/types.js +4 -0
  76. package/dist/server/test.json +1 -1
  77. package/dist/server/utils/small-ticket.d.ts +1 -85
  78. package/dist/server/utils/small-ticket.js +2 -2542
  79. package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
  80. package/dist/shared/payment/loadPaymentMethods.js +66 -0
  81. package/dist/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
  82. package/dist/shared/receipt/customerInvoiceLanguages.js +60 -0
  83. package/dist/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
  84. package/dist/shared/receipt/loadCustomerInvoiceLayout.js +184 -0
  85. package/dist/shared/receipt/small-ticket.d.ts +96 -0
  86. package/dist/shared/receipt/small-ticket.js +2763 -0
  87. package/dist/shared/receipt/templateVisibility.d.ts +26 -0
  88. package/dist/shared/receipt/templateVisibility.js +68 -0
  89. package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
  90. package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
  91. package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
  92. package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
  93. package/dist/solution/BaseSales/index.d.ts +43 -16
  94. package/dist/solution/BaseSales/index.js +2028 -1247
  95. package/dist/solution/BaseSales/pickupTiming.d.ts +47 -0
  96. package/dist/solution/BaseSales/pickupTiming.js +616 -0
  97. package/dist/solution/BaseSales/types.d.ts +12 -0
  98. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
  99. package/dist/solution/BaseSales/utils/parseSalesResponse.js +10 -3
  100. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -4
  101. package/dist/solution/BookingByStep/index.d.ts +4 -2
  102. package/dist/solution/BookingByStep/index.js +8 -3
  103. package/dist/solution/BookingTicket/index.d.ts +23 -3
  104. package/dist/solution/BookingTicket/index.js +867 -507
  105. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
  106. package/dist/solution/BookingTicket/utils/addProductDecision.js +1 -1
  107. package/dist/solution/BookingTicket/utils/cartView.js +3 -1
  108. package/dist/solution/OrderInvoicePreview/index.d.ts +66 -0
  109. package/dist/solution/OrderInvoicePreview/index.js +340 -0
  110. package/dist/solution/RegisterAndLogin/config.js +54 -11
  111. package/dist/solution/RegisterAndLogin/index.d.ts +2 -0
  112. package/dist/solution/RegisterAndLogin/index.js +1 -1
  113. package/dist/solution/RegisterAndLogin/utils.d.ts +12 -4
  114. package/dist/solution/RegisterAndLogin/utils.js +36 -16
  115. package/dist/solution/ScanOrder/index.js +65 -31
  116. package/dist/solution/ScanOrder/types.d.ts +3 -0
  117. package/dist/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
  118. package/dist/solution/UnifiedBookingSales/businessAvailability.js +292 -0
  119. package/dist/solution/UnifiedBookingSales/index.d.ts +36 -4
  120. package/dist/solution/UnifiedBookingSales/index.js +1715 -906
  121. package/dist/solution/UnifiedBookingSales/types.d.ts +16 -2
  122. package/dist/solution/VenueBooking/index.d.ts +15 -2
  123. package/dist/solution/VenueBooking/index.js +1062 -785
  124. package/dist/solution/VenueBooking/types.d.ts +2 -1
  125. package/dist/solution/VenueBooking/types.js +1 -0
  126. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  127. package/dist/solution/VenueBooking/utils/dateSummary.js +7 -4
  128. package/dist/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
  129. package/dist/solution/VenueBooking/utils/smartPricing.js +273 -0
  130. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
  131. package/dist/solution/VenueBooking/utils/timeSlot.js +6 -3
  132. package/dist/solution/index.d.ts +1 -0
  133. package/dist/solution/index.js +2 -1
  134. package/lib/index.d.ts +2 -0
  135. package/lib/index.js +21 -1
  136. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
  137. package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
  138. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
  139. package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
  140. package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
  141. package/lib/model/strategy/adapter/itemRule/type.js +10 -0
  142. package/lib/model/strategy/adapter/promotion/evaluator.js +9 -14
  143. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  144. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
  145. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +17 -1
  146. package/lib/modules/BookingContext/utils/productExtend.d.ts +7 -0
  147. package/lib/modules/BookingContext/utils/productExtend.js +45 -2
  148. package/lib/modules/BookingContext/utils/resources.js +1 -1
  149. package/lib/modules/BusinessAvailability/index.d.ts +30 -0
  150. package/lib/modules/BusinessAvailability/index.js +146 -0
  151. package/lib/modules/Cart/index.js +4 -2
  152. package/lib/modules/Cart/types.d.ts +2 -0
  153. package/lib/modules/Cart/utils/cartProduct.d.ts +3 -1
  154. package/lib/modules/Cart/utils/cartProduct.js +39 -20
  155. package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
  156. package/lib/modules/FulfillmentTiming/index.js +359 -0
  157. package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
  158. package/lib/modules/FulfillmentTiming/types.js +5 -0
  159. package/lib/modules/Holder/utils.d.ts +2 -0
  160. package/lib/modules/Holder/utils.js +27 -1
  161. package/lib/modules/OpenData/contactInfo.d.ts +20 -0
  162. package/lib/modules/OpenData/contactInfo.js +56 -0
  163. package/lib/modules/OpenData/index.d.ts +1 -0
  164. package/lib/modules/OpenData/index.js +12 -0
  165. package/lib/modules/OpenData/types.d.ts +23 -0
  166. package/lib/modules/Order/holderRelations.d.ts +14 -0
  167. package/lib/modules/Order/holderRelations.js +98 -0
  168. package/lib/modules/Order/index.d.ts +16 -4
  169. package/lib/modules/Order/index.js +284 -50
  170. package/lib/modules/Order/localEftposState.d.ts +13 -0
  171. package/lib/modules/Order/localEftposState.js +44 -0
  172. package/lib/modules/Order/pickupTiming.d.ts +46 -0
  173. package/lib/modules/Order/pickupTiming.js +61 -0
  174. package/lib/modules/Order/types.d.ts +49 -3
  175. package/lib/modules/Order/types.js +1 -0
  176. package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
  177. package/lib/modules/Order/utils/discountProductLineIdentity.js +51 -2
  178. package/lib/modules/Order/utils/orderCollectionIdentity.js +5 -0
  179. package/lib/modules/Order/utils.d.ts +2 -1
  180. package/lib/modules/Order/utils.js +49 -11
  181. package/lib/modules/Payment/index.js +3 -4
  182. package/lib/modules/Product/types.d.ts +11 -0
  183. package/lib/modules/ProductList/index.js +1 -1
  184. package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
  185. package/lib/modules/ResourcePlanner/planner.js +252 -8
  186. package/lib/modules/ResourcePlanner/types.d.ts +29 -0
  187. package/lib/modules/Rules/index.js +2 -1
  188. package/lib/modules/Schedule/index.d.ts +8 -0
  189. package/lib/modules/Schedule/index.js +68 -12
  190. package/lib/modules/index.d.ts +1 -0
  191. package/lib/modules/index.js +11 -0
  192. package/lib/plugins/request.d.ts +7 -0
  193. package/lib/server/index.d.ts +1 -0
  194. package/lib/server/index.js +166 -39
  195. package/lib/server/modules/form/index.d.ts +19 -0
  196. package/lib/server/modules/form/index.js +73 -0
  197. package/lib/server/modules/form/types.d.ts +13 -0
  198. package/lib/server/modules/form/types.js +9 -0
  199. package/lib/server/modules/index.d.ts +3 -0
  200. package/lib/server/modules/index.js +15 -1
  201. package/lib/server/modules/order/index.d.ts +19 -0
  202. package/lib/server/modules/order/index.js +160 -7
  203. package/lib/server/modules/order/types.d.ts +4 -0
  204. package/lib/server/modules/products/index.d.ts +28 -7
  205. package/lib/server/modules/products/index.js +226 -63
  206. package/lib/server/modules/products/replication.d.ts +8 -0
  207. package/lib/server/modules/products/replication.js +30 -0
  208. package/lib/server/modules/products/types.d.ts +12 -1
  209. package/lib/server/modules/products/types.js +3 -0
  210. package/lib/server/test.json +1 -1
  211. package/lib/server/utils/small-ticket.d.ts +1 -85
  212. package/lib/server/utils/small-ticket.js +9 -2305
  213. package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
  214. package/lib/shared/payment/loadPaymentMethods.js +40 -0
  215. package/lib/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
  216. package/lib/shared/receipt/customerInvoiceLanguages.js +58 -0
  217. package/lib/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
  218. package/lib/shared/receipt/loadCustomerInvoiceLayout.js +124 -0
  219. package/lib/shared/receipt/small-ticket.d.ts +96 -0
  220. package/lib/shared/receipt/small-ticket.js +2555 -0
  221. package/lib/shared/receipt/templateVisibility.d.ts +26 -0
  222. package/lib/shared/receipt/templateVisibility.js +67 -0
  223. package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
  224. package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
  225. package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
  226. package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
  227. package/lib/solution/BaseSales/index.d.ts +43 -16
  228. package/lib/solution/BaseSales/index.js +401 -33
  229. package/lib/solution/BaseSales/pickupTiming.d.ts +47 -0
  230. package/lib/solution/BaseSales/pickupTiming.js +290 -0
  231. package/lib/solution/BaseSales/types.d.ts +12 -0
  232. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
  233. package/lib/solution/BaseSales/utils/parseSalesResponse.js +7 -0
  234. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -8
  235. package/lib/solution/BookingByStep/index.d.ts +4 -2
  236. package/lib/solution/BookingByStep/index.js +7 -3
  237. package/lib/solution/BookingTicket/index.d.ts +23 -3
  238. package/lib/solution/BookingTicket/index.js +197 -9
  239. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
  240. package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -1
  241. package/lib/solution/BookingTicket/utils/cartView.js +3 -1
  242. package/lib/solution/OrderInvoicePreview/index.d.ts +66 -0
  243. package/lib/solution/OrderInvoicePreview/index.js +246 -0
  244. package/lib/solution/RegisterAndLogin/config.js +57 -11
  245. package/lib/solution/RegisterAndLogin/index.d.ts +2 -0
  246. package/lib/solution/RegisterAndLogin/index.js +9 -1
  247. package/lib/solution/RegisterAndLogin/utils.d.ts +12 -4
  248. package/lib/solution/RegisterAndLogin/utils.js +24 -17
  249. package/lib/solution/ScanOrder/index.js +59 -20
  250. package/lib/solution/ScanOrder/types.d.ts +3 -0
  251. package/lib/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
  252. package/lib/solution/UnifiedBookingSales/businessAvailability.js +138 -0
  253. package/lib/solution/UnifiedBookingSales/index.d.ts +36 -4
  254. package/lib/solution/UnifiedBookingSales/index.js +562 -75
  255. package/lib/solution/UnifiedBookingSales/types.d.ts +16 -2
  256. package/lib/solution/VenueBooking/index.d.ts +15 -2
  257. package/lib/solution/VenueBooking/index.js +243 -96
  258. package/lib/solution/VenueBooking/types.d.ts +2 -1
  259. package/lib/solution/VenueBooking/types.js +1 -0
  260. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  261. package/lib/solution/VenueBooking/utils/dateSummary.js +7 -4
  262. package/lib/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
  263. package/lib/solution/VenueBooking/utils/smartPricing.js +224 -0
  264. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
  265. package/lib/solution/VenueBooking/utils/timeSlot.js +5 -2
  266. package/lib/solution/index.d.ts +1 -0
  267. package/lib/solution/index.js +11 -0
  268. package/package.json +1 -1
@@ -51,6 +51,10 @@ import { buildProductOptionStringFromOrderLine } from "../../modules/BookingCont
51
51
  import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
52
52
  import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resolveBestAddTimePlan";
53
53
  import { createUuidV4 } from "../../modules/Order/utils";
54
+ import { extractCustomerContactInfo, isContactRecord } from "../../modules/OpenData/contactInfo";
55
+ import { isCustomerUserPlatform } from "../../utils/platform";
56
+ import { cloneDeep } from 'lodash-es';
57
+ import { FormHooks } from "../../server/modules/form/types";
54
58
  var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents'];
55
59
  var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
56
60
  var USER_PLATFORM = ['pc', 'h5'];
@@ -182,6 +186,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
182
186
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
183
187
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshTarget", null);
184
188
  _defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
189
+ _defineProperty(_assertThisInitialized(_this), "orderCustomerContactRequest", null);
185
190
  _defineProperty(_assertThisInitialized(_this), "customerResolveRequests", new Map());
186
191
  _defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
187
192
  _defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlightTarget", null);
@@ -206,6 +211,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
206
211
  return !channel || channel === 'system' ? 'pos' : channel;
207
212
  }
208
213
 
214
+ /** 供销售展示层按 booking.resources[].form_id 读取当前多语言表单标题。 */
215
+ }, {
216
+ key: "getFormTitleMap",
217
+ value: function getFormTitleMap() {
218
+ var _this$core2, _this$core2$getTitleM;
219
+ return ((_this$core2 = this.core) === null || _this$core2 === void 0 || (_this$core2 = _this$core2.server) === null || _this$core2 === void 0 || (_this$core2 = _this$core2.form) === null || _this$core2 === void 0 || (_this$core2$getTitleM = _this$core2.getTitleMap) === null || _this$core2$getTitleM === void 0 ? void 0 : _this$core2$getTitleM.call(_this$core2)) || {};
220
+ }
221
+
222
+ /** 表单定义由 Ably 更新后通知展示层刷新,不改动订单里的历史 metadata。 */
223
+ }, {
224
+ key: "onFormTitlesChanged",
225
+ value: function onFormTitlesChanged(callback) {
226
+ return this.core.effects.on(FormHooks.onChanged, callback);
227
+ }
228
+
209
229
  /**
210
230
  * 业务侧子模块工厂:BookingTicket 自带的 createBookingTicketModule 优先匹配;
211
231
  * 未识别的模块名(如 BookingByStep 公共类型)回退到父类工厂。
@@ -452,29 +472,67 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
452
472
  return getOpenData;
453
473
  }()
454
474
  }, {
455
- key: "getInvoiceLayoutConfig",
475
+ key: "loadContactInfoOpenData",
456
476
  value: function () {
457
- var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
458
- var openData;
477
+ var _loadContactInfoOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
459
478
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
460
479
  while (1) switch (_context5.prev = _context5.next) {
461
480
  case 0:
462
- _context5.next = 2;
481
+ return _context5.abrupt("return", this.store.openData ? this.getOpenData() : _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadContactInfoOpenData", this).call(this));
482
+ case 1:
483
+ case "end":
484
+ return _context5.stop();
485
+ }
486
+ }, _callee5, this);
487
+ }));
488
+ function loadContactInfoOpenData() {
489
+ return _loadContactInfoOpenData.apply(this, arguments);
490
+ }
491
+ return loadContactInfoOpenData;
492
+ }()
493
+ }, {
494
+ key: "loadFulfillmentItemRuleOpenData",
495
+ value: function () {
496
+ var _loadFulfillmentItemRuleOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
497
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
498
+ while (1) switch (_context6.prev = _context6.next) {
499
+ case 0:
500
+ return _context6.abrupt("return", this.store.openData ? this.getOpenData() : _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadFulfillmentItemRuleOpenData", this).call(this));
501
+ case 1:
502
+ case "end":
503
+ return _context6.stop();
504
+ }
505
+ }, _callee6, this);
506
+ }));
507
+ function loadFulfillmentItemRuleOpenData() {
508
+ return _loadFulfillmentItemRuleOpenData.apply(this, arguments);
509
+ }
510
+ return loadFulfillmentItemRuleOpenData;
511
+ }()
512
+ }, {
513
+ key: "getInvoiceLayoutConfig",
514
+ value: function () {
515
+ var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
516
+ var openData;
517
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
518
+ while (1) switch (_context7.prev = _context7.next) {
519
+ case 0:
520
+ _context7.next = 2;
463
521
  return this.loadOpenDataConfig();
464
522
  case 2:
465
- openData = _context5.sent;
523
+ openData = _context7.sent;
466
524
  if (openData) {
467
- _context5.next = 5;
525
+ _context7.next = 5;
468
526
  break;
469
527
  }
470
- return _context5.abrupt("return", getDefaultInvoiceLayoutConfig());
528
+ return _context7.abrupt("return", getDefaultInvoiceLayoutConfig());
471
529
  case 5:
472
- return _context5.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
530
+ return _context7.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
473
531
  case 6:
474
532
  case "end":
475
- return _context5.stop();
533
+ return _context7.stop();
476
534
  }
477
- }, _callee5, this);
535
+ }, _callee7, this);
478
536
  }));
479
537
  function getInvoiceLayoutConfig() {
480
538
  return _getInvoiceLayoutConfig.apply(this, arguments);
@@ -484,27 +542,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
484
542
  }, {
485
543
  key: "getInvoiceTemplateSettings",
486
544
  value: function () {
487
- var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
545
+ var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
488
546
  var openData;
489
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
490
- while (1) switch (_context6.prev = _context6.next) {
547
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
548
+ while (1) switch (_context8.prev = _context8.next) {
491
549
  case 0:
492
- _context6.next = 2;
550
+ _context8.next = 2;
493
551
  return this.loadOpenDataConfig();
494
552
  case 2:
495
- openData = _context6.sent;
553
+ openData = _context8.sent;
496
554
  if (openData) {
497
- _context6.next = 5;
555
+ _context8.next = 5;
498
556
  break;
499
557
  }
500
- return _context6.abrupt("return", getDefaultInvoiceTemplateSettings());
558
+ return _context8.abrupt("return", getDefaultInvoiceTemplateSettings());
501
559
  case 5:
502
- return _context6.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
560
+ return _context8.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
503
561
  case 6:
504
562
  case "end":
505
- return _context6.stop();
563
+ return _context8.stop();
506
564
  }
507
- }, _callee6, this);
565
+ }, _callee8, this);
508
566
  }));
509
567
  function getInvoiceTemplateSettings() {
510
568
  return _getInvoiceTemplateSettings.apply(this, arguments);
@@ -534,32 +592,32 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
534
592
  }, {
535
593
  key: "getShortNumberOrDeviceId",
536
594
  value: function () {
537
- var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
595
+ var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
538
596
  var getAsyncIotDeviceInfo, res;
539
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
540
- while (1) switch (_context7.prev = _context7.next) {
597
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
598
+ while (1) switch (_context9.prev = _context9.next) {
541
599
  case 0:
542
600
  getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
543
601
  if (!getAsyncIotDeviceInfo) {
544
- _context7.next = 7;
602
+ _context9.next = 7;
545
603
  break;
546
604
  }
547
- _context7.next = 4;
605
+ _context9.next = 4;
548
606
  return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
549
607
  case 4:
550
- res = _context7.sent;
608
+ res = _context9.sent;
551
609
  if (!(res !== null && res !== void 0 && res.short_number)) {
552
- _context7.next = 7;
610
+ _context9.next = 7;
553
611
  break;
554
612
  }
555
- return _context7.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
613
+ return _context9.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
556
614
  case 7:
557
- return _context7.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
615
+ return _context9.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
558
616
  case 8:
559
617
  case "end":
560
- return _context7.stop();
618
+ return _context9.stop();
561
619
  }
562
- }, _callee7, this);
620
+ }, _callee9, this);
563
621
  }));
564
622
  function getShortNumberOrDeviceId() {
565
623
  return _getShortNumberOrDeviceId.apply(this, arguments);
@@ -569,35 +627,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
569
627
  }, {
570
628
  key: "configureIdGeneratorFromOpenData",
571
629
  value: function () {
572
- var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
630
+ var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
573
631
  var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
574
- var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
575
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
576
- while (1) switch (_context8.prev = _context8.next) {
632
+ var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7, _openDataConfig8, _openDataConfig9;
633
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
634
+ while (1) switch (_context10.prev = _context10.next) {
577
635
  case 0:
578
636
  // 业务码切换或配置失败时不能复用上一次初始化的短号。
579
637
  this.setPaymentNumberDevicePrefix(null);
580
638
  idGenerator = this.getIdGeneratorPlugin();
581
639
  if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
582
- _context8.next = 5;
640
+ _context10.next = 5;
583
641
  break;
584
642
  }
585
643
  console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
586
- return _context8.abrupt("return");
644
+ return _context10.abrupt("return");
587
645
  case 5:
588
646
  openDataConfig = null;
589
- _context8.prev = 6;
590
- _context8.next = 9;
647
+ _context10.prev = 6;
648
+ _context10.next = 9;
591
649
  return this.loadOpenDataConfig();
592
650
  case 9:
593
- openDataConfig = _context8.sent;
594
- _context8.next = 16;
651
+ openDataConfig = _context10.sent;
652
+ _context10.next = 16;
595
653
  break;
596
654
  case 12:
597
- _context8.prev = 12;
598
- _context8.t0 = _context8["catch"](6);
599
- console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context8.t0);
600
- return _context8.abrupt("return");
655
+ _context10.prev = 12;
656
+ _context10.t0 = _context10["catch"](6);
657
+ console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context10.t0);
658
+ return _context10.abrupt("return");
601
659
  case 16:
602
660
  // if (!openDataConfig) return;
603
661
  receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
@@ -609,29 +667,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
609
667
  "type": "start_time",
610
668
  "time": "00:00"
611
669
  };
612
- _context8.next = 24;
670
+ _context10.next = 24;
613
671
  return this.getShortNumberOrDeviceId();
614
672
  case 24:
615
- deviceId = _context8.sent;
673
+ deviceId = _context10.sent;
616
674
  this.setPaymentNumberDevicePrefix(deviceId);
617
675
  businessCode = this.getBookingTicketBusinessCode();
618
676
  if (businessCode) {
619
- _context8.next = 30;
677
+ _context10.next = 30;
620
678
  break;
621
679
  }
622
680
  console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
623
- return _context8.abrupt("return");
681
+ return _context10.abrupt("return");
624
682
  case 30:
625
- _context8.prev = 30;
626
- _context8.next = 33;
683
+ _context10.prev = 30;
684
+ _context10.next = 33;
627
685
  return idGenerator.configure({
628
686
  biz: businessCode,
629
687
  config: {
630
688
  prefix: prefix,
631
689
  deviceCode: deviceId,
632
- // TODO 现在 picoding 没这个配置的 key
633
- padReceiptSequence: false,
690
+ padReceiptSequence: ((_openDataConfig7 = openDataConfig) === null || _openDataConfig7 === void 0 ? void 0 : _openDataConfig7['sale.pad_with_leading_zeros']) === true,
634
691
  receiptSequenceLength: receiptSequenceLength,
692
+ receiptSequenceMax: this.normalizeShortNumberMaximum((_openDataConfig8 = openDataConfig) === null || _openDataConfig8 === void 0 ? void 0 : _openDataConfig8['sale.maximum_number']),
693
+ randomReceiptSequence: ((_openDataConfig9 = openDataConfig) === null || _openDataConfig9 === void 0 ? void 0 : _openDataConfig9['sale.short_number_random']) === true,
635
694
  resetReceiptSequenceDaily: resetReceiptSequenceDaily,
636
695
  receiptSequenceResetTime: operatingDayBoundary === null || operatingDayBoundary === void 0 ? void 0 : operatingDayBoundary.time,
637
696
  receiptSequenceStart: receiptSequenceStart,
@@ -639,17 +698,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
639
698
  }
640
699
  });
641
700
  case 33:
642
- _context8.next = 38;
701
+ _context10.next = 38;
643
702
  break;
644
703
  case 35:
645
- _context8.prev = 35;
646
- _context8.t1 = _context8["catch"](30);
647
- console.warn('[BookingTicket] idGenerator 配置失败', _context8.t1);
704
+ _context10.prev = 35;
705
+ _context10.t1 = _context10["catch"](30);
706
+ console.warn('[BookingTicket] idGenerator 配置失败', _context10.t1);
648
707
  case 38:
649
708
  case "end":
650
- return _context8.stop();
709
+ return _context10.stop();
651
710
  }
652
- }, _callee8, this, [[6, 12], [30, 35]]);
711
+ }, _callee10, this, [[6, 12], [30, 35]]);
653
712
  }));
654
713
  function configureIdGeneratorFromOpenData() {
655
714
  return _configureIdGeneratorFromOpenData.apply(this, arguments);
@@ -663,6 +722,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
663
722
  if (!Number.isInteger(numeric) || numeric <= 0) return fallback;
664
723
  return numeric;
665
724
  }
725
+ }, {
726
+ key: "normalizeShortNumberMaximum",
727
+ value: function normalizeShortNumberMaximum(value) {
728
+ if (value === undefined || value === null || typeof value === 'string' && !value.trim()) return null;
729
+ if (typeof value !== 'number' && typeof value !== 'string') {
730
+ throw new Error('sale.maximum_number 必须是安全正整数或空值');
731
+ }
732
+ var numeric = Number(value);
733
+ if (!Number.isSafeInteger(numeric) || numeric <= 0) {
734
+ throw new Error('sale.maximum_number 必须是安全正整数或空值');
735
+ }
736
+ return numeric;
737
+ }
666
738
  }, {
667
739
  key: "normalizeIdPrefix",
668
740
  value: function normalizeIdPrefix(value, fallback) {
@@ -681,16 +753,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
681
753
  }, {
682
754
  key: "loadSalesDetail",
683
755
  value: (function () {
684
- var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(orderIdOrParams) {
756
+ var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(orderIdOrParams) {
685
757
  var _ref3;
686
758
  var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref4, detailCustomerId, detailCustomerRest, rawId, customer;
687
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
688
- while (1) switch (_context9.prev = _context9.next) {
759
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
760
+ while (1) switch (_context11.prev = _context11.next) {
689
761
  case 0:
690
- _context9.next = 2;
762
+ _context11.next = 2;
691
763
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
692
764
  case 2:
693
- sales = _context9.sent;
765
+ sales = _context11.sent;
694
766
  customerModule = this.store.customer;
695
767
  detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
696
768
  orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
@@ -722,12 +794,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
722
794
  });
723
795
  // await this.store.order.saveDraft();
724
796
  }
725
- return _context9.abrupt("return", sales);
797
+ return _context11.abrupt("return", sales);
726
798
  case 11:
727
799
  case "end":
728
- return _context9.stop();
800
+ return _context11.stop();
729
801
  }
730
- }, _callee9, this);
802
+ }, _callee11, this);
731
803
  }));
732
804
  function loadSalesDetail(_x3) {
733
805
  return _loadSalesDetail.apply(this, arguments);
@@ -737,56 +809,56 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
737
809
  }, {
738
810
  key: "scanPromotionCode",
739
811
  value: function () {
740
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(code, customerId) {
812
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(code, customerId) {
741
813
  var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
742
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
743
- while (1) switch (_context10.prev = _context10.next) {
814
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
815
+ while (1) switch (_context12.prev = _context12.next) {
744
816
  case 0:
745
817
  if (this.store.order) {
746
- _context10.next = 2;
818
+ _context12.next = 2;
747
819
  break;
748
820
  }
749
821
  throw new Error('order 模块未初始化');
750
822
  case 2:
751
- _context10.next = 4;
823
+ _context12.next = 4;
752
824
  return this.store.order.scanCode(code, customerId);
753
825
  case 4:
754
- raw = _context10.sent;
826
+ raw = _context12.sent;
755
827
  scannedList = raw.scannedDiscountList || [];
756
828
  extractedCustomerId = this.getDiscountCustomerId(scannedList);
757
829
  hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
758
830
  isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
759
831
  if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
760
- _context10.next = 18;
832
+ _context12.next = 18;
761
833
  break;
762
834
  }
763
- _context10.prev = 10;
764
- _context10.next = 13;
835
+ _context12.prev = 10;
836
+ _context12.next = 13;
765
837
  return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
766
838
  case 13:
767
- _context10.next = 18;
839
+ _context12.next = 18;
768
840
  break;
769
841
  case 15:
770
- _context10.prev = 15;
771
- _context10.t0 = _context10["catch"](10);
842
+ _context12.prev = 15;
843
+ _context12.t0 = _context12["catch"](10);
772
844
  // 客户映射失败不能阻断原有 Pass 的可用性、展示或优惠处理。
773
845
  console.warn('[BookingTicket] scan discount customer resolve failed', {
774
846
  customerId: extractedCustomerId,
775
- error: _context10.t0
847
+ error: _context12.t0
776
848
  });
777
849
  case 18:
778
850
  if (!raw.isAvailable) {
779
- _context10.next = 25;
851
+ _context12.next = 25;
780
852
  break;
781
853
  }
782
- _context10.next = 21;
854
+ _context12.next = 21;
783
855
  return this.store.order.recalculateSummary({
784
856
  createIfMissing: true
785
857
  });
786
858
  case 21:
787
859
  this.store.order.persistTempOrder();
788
860
  tempOrder = this.store.order.ensureTempOrder();
789
- _context10.next = 25;
861
+ _context12.next = 25;
790
862
  return this.effectsEmit('onDiscountApplied', {
791
863
  productList: tempOrder.products || [],
792
864
  discountList: this.store.order.getDiscountList(),
@@ -794,7 +866,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
794
866
  tempOrder: tempOrder
795
867
  });
796
868
  case 25:
797
- return _context10.abrupt("return", _objectSpread(_objectSpread({
869
+ return _context12.abrupt("return", _objectSpread(_objectSpread({
798
870
  isAvailable: raw.isAvailable
799
871
  }, raw.isAccepted !== undefined ? {
800
872
  isAccepted: raw.isAccepted
@@ -805,9 +877,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
805
877
  }));
806
878
  case 26:
807
879
  case "end":
808
- return _context10.stop();
880
+ return _context12.stop();
809
881
  }
810
- }, _callee10, this, [[10, 15]]);
882
+ }, _callee12, this, [[10, 15]]);
811
883
  }));
812
884
  function scanPromotionCode(_x4, _x5) {
813
885
  return _scanPromotionCode.apply(this, arguments);
@@ -817,42 +889,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
817
889
  }, {
818
890
  key: "hydrateOrderCustomerFromScanDiscounts",
819
891
  value: function () {
820
- var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(discounts) {
892
+ var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(discounts) {
821
893
  var currentOrderCustomer, customerId, customer;
822
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
823
- while (1) switch (_context11.prev = _context11.next) {
894
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
895
+ while (1) switch (_context13.prev = _context13.next) {
824
896
  case 0:
825
897
  currentOrderCustomer = this.store.order.getOrderCustomer();
826
898
  if (!currentOrderCustomer) {
827
- _context11.next = 3;
899
+ _context13.next = 3;
828
900
  break;
829
901
  }
830
- return _context11.abrupt("return");
902
+ return _context13.abrupt("return");
831
903
  case 3:
832
904
  customerId = this.getDiscountCustomerId(discounts);
833
905
  if (customerId) {
834
- _context11.next = 6;
906
+ _context13.next = 6;
835
907
  break;
836
908
  }
837
- return _context11.abrupt("return");
909
+ return _context13.abrupt("return");
838
910
  case 6:
839
- _context11.next = 8;
911
+ _context13.next = 8;
840
912
  return this.resolveCustomerByDiscountCustomerId(customerId);
841
913
  case 8:
842
- customer = _context11.sent;
914
+ customer = _context13.sent;
843
915
  if (customer) {
844
- _context11.next = 11;
916
+ _context13.next = 11;
845
917
  break;
846
918
  }
847
- return _context11.abrupt("return");
919
+ return _context13.abrupt("return");
848
920
  case 11:
849
921
  this.store.customer.setSelectedCustomer(customer);
850
922
  this.setOrderCustomer(customer);
851
923
  case 13:
852
924
  case "end":
853
- return _context11.stop();
925
+ return _context13.stop();
854
926
  }
855
- }, _callee11, this);
927
+ }, _callee13, this);
856
928
  }));
857
929
  function hydrateOrderCustomerFromScanDiscounts(_x6) {
858
930
  return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
@@ -888,27 +960,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
888
960
  }, {
889
961
  key: "resolveCustomerById",
890
962
  value: function () {
891
- var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(customerId) {
963
+ var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(customerId) {
892
964
  var _this2 = this;
893
965
  var rawCustomerId, numericCustomerId, normalizedCustomerId, existingRequest, request;
894
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
895
- while (1) switch (_context12.prev = _context12.next) {
966
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
967
+ while (1) switch (_context14.prev = _context14.next) {
896
968
  case 0:
897
969
  rawCustomerId = String(customerId !== null && customerId !== void 0 ? customerId : '').trim();
898
970
  numericCustomerId = Number(rawCustomerId);
899
971
  if (!(!rawCustomerId || !Number.isInteger(numericCustomerId) || numericCustomerId <= 1)) {
900
- _context12.next = 4;
972
+ _context14.next = 4;
901
973
  break;
902
974
  }
903
- return _context12.abrupt("return", null);
975
+ return _context14.abrupt("return", null);
904
976
  case 4:
905
977
  normalizedCustomerId = String(numericCustomerId);
906
978
  existingRequest = this.customerResolveRequests.get(normalizedCustomerId);
907
979
  if (!existingRequest) {
908
- _context12.next = 8;
980
+ _context14.next = 8;
909
981
  break;
910
982
  }
911
- return _context12.abrupt("return", existingRequest);
983
+ return _context14.abrupt("return", existingRequest);
912
984
  case 8:
913
985
  request = this.request.post("/customer/resolve/".concat(encodeURIComponent(normalizedCustomerId)), {
914
986
  with_franchisor_data: 1,
@@ -928,12 +1000,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
928
1000
  }
929
1001
  });
930
1002
  this.customerResolveRequests.set(normalizedCustomerId, request);
931
- return _context12.abrupt("return", request);
1003
+ return _context14.abrupt("return", request);
932
1004
  case 11:
933
1005
  case "end":
934
- return _context12.stop();
1006
+ return _context14.stop();
935
1007
  }
936
- }, _callee12, this);
1008
+ }, _callee14, this);
937
1009
  }));
938
1010
  function resolveCustomerById(_x7) {
939
1011
  return _resolveCustomerById.apply(this, arguments);
@@ -985,60 +1057,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
985
1057
  }, {
986
1058
  key: "setBookingStatus",
987
1059
  value: (function () {
988
- var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(status) {
1060
+ var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(status) {
989
1061
  var _this$store$order2, _this$store$order2$ge;
990
1062
  var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
991
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
992
- while (1) switch (_context13.prev = _context13.next) {
1063
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1064
+ while (1) switch (_context15.prev = _context15.next) {
993
1065
  case 0:
994
1066
  tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$ge = _this$store$order2.getTempOrder) === null || _this$store$order2$ge === void 0 ? void 0 : _this$store$order2$ge.call(_this$store$order2);
995
1067
  if (tempOrder) {
996
- _context13.next = 3;
1068
+ _context15.next = 3;
997
1069
  break;
998
1070
  }
999
1071
  throw new Error('setBookingStatus: tempOrder 未加载');
1000
1072
  case 3:
1001
1073
  orderId = tempOrder.order_id;
1002
1074
  if (!(orderId === undefined || orderId === null)) {
1003
- _context13.next = 6;
1075
+ _context15.next = 6;
1004
1076
  break;
1005
1077
  }
1006
1078
  throw new Error('setBookingStatus: tempOrder.order_id 缺失');
1007
1079
  case 6:
1008
1080
  scheduleId = resolveScheduleId(tempOrder);
1009
1081
  if (!(scheduleId === null)) {
1010
- _context13.next = 9;
1082
+ _context15.next = 9;
1011
1083
  break;
1012
1084
  }
1013
1085
  throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
1014
1086
  case 9:
1015
1087
  bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
1016
1088
  previous = applyBookingsStatus(bookings, status);
1017
- _context13.prev = 11;
1018
- _context13.next = 14;
1089
+ _context15.prev = 11;
1090
+ _context15.next = 14;
1019
1091
  return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
1020
1092
  appointment_status: status
1021
1093
  });
1022
1094
  case 14:
1023
- res = _context13.sent;
1024
- _context13.next = 17;
1095
+ res = _context15.sent;
1096
+ _context15.next = 17;
1025
1097
  return this.refreshSalesDetail();
1026
1098
  case 17:
1027
1099
  this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
1028
1100
  orderId: orderId,
1029
1101
  status: status
1030
1102
  });
1031
- return _context13.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
1103
+ return _context15.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
1032
1104
  case 21:
1033
- _context13.prev = 21;
1034
- _context13.t0 = _context13["catch"](11);
1105
+ _context15.prev = 21;
1106
+ _context15.t0 = _context15["catch"](11);
1035
1107
  restoreBookingsStatus(bookings, previous);
1036
- throw _context13.t0;
1108
+ throw _context15.t0;
1037
1109
  case 25:
1038
1110
  case "end":
1039
- return _context13.stop();
1111
+ return _context15.stop();
1040
1112
  }
1041
- }, _callee13, this, [[11, 21]]);
1113
+ }, _callee15, this, [[11, 21]]);
1042
1114
  }));
1043
1115
  function setBookingStatus(_x8) {
1044
1116
  return _setBookingStatus.apply(this, arguments);
@@ -1069,35 +1141,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1069
1141
  }, {
1070
1142
  key: "transitionChildBooking",
1071
1143
  value: (function () {
1072
- var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
1144
+ var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1073
1145
  var _this$store$order3, _this$store$order3$ge;
1074
1146
  var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
1075
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1076
- while (1) switch (_context14.prev = _context14.next) {
1147
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1148
+ while (1) switch (_context16.prev = _context16.next) {
1077
1149
  case 0:
1078
1150
  schedule_event_id = params.schedule_event_id, action = params.action;
1079
1151
  if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
1080
- _context14.next = 3;
1152
+ _context16.next = 3;
1081
1153
  break;
1082
1154
  }
1083
1155
  throw new Error('transitionChildBooking: schedule_event_id 不能为空');
1084
1156
  case 3:
1085
1157
  if (action) {
1086
- _context14.next = 5;
1158
+ _context16.next = 5;
1087
1159
  break;
1088
1160
  }
1089
1161
  throw new Error('transitionChildBooking: action 不能为空');
1090
1162
  case 5:
1091
1163
  tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getTempOrder) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
1092
1164
  if (tempOrder) {
1093
- _context14.next = 8;
1165
+ _context16.next = 8;
1094
1166
  break;
1095
1167
  }
1096
1168
  throw new Error('transitionChildBooking: tempOrder 未加载');
1097
1169
  case 8:
1098
1170
  orderId = tempOrder.order_id;
1099
1171
  if (!(orderId === undefined || orderId === null)) {
1100
- _context14.next = 11;
1172
+ _context16.next = 11;
1101
1173
  break;
1102
1174
  }
1103
1175
  throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
@@ -1105,14 +1177,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1105
1177
  bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
1106
1178
  targetStatus = resolveStatusAfterTransition(action);
1107
1179
  previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
1108
- _context14.prev = 14;
1109
- _context14.next = 17;
1180
+ _context16.prev = 14;
1181
+ _context16.next = 17;
1110
1182
  return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
1111
1183
  action: action
1112
1184
  });
1113
1185
  case 17:
1114
- res = _context14.sent;
1115
- _context14.next = 20;
1186
+ res = _context16.sent;
1187
+ _context16.next = 20;
1116
1188
  return this.refreshSalesDetail();
1117
1189
  case 20:
1118
1190
  this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
@@ -1121,19 +1193,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1121
1193
  action: action,
1122
1194
  status: targetStatus
1123
1195
  });
1124
- return _context14.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
1196
+ return _context16.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
1125
1197
  case 24:
1126
- _context14.prev = 24;
1127
- _context14.t0 = _context14["catch"](14);
1198
+ _context16.prev = 24;
1199
+ _context16.t0 = _context16["catch"](14);
1128
1200
  if (previous !== undefined) {
1129
1201
  restoreChildBookingStatus(bookings, schedule_event_id, previous);
1130
1202
  }
1131
- throw _context14.t0;
1203
+ throw _context16.t0;
1132
1204
  case 28:
1133
1205
  case "end":
1134
- return _context14.stop();
1206
+ return _context16.stop();
1135
1207
  }
1136
- }, _callee14, this, [[14, 24]]);
1208
+ }, _callee16, this, [[14, 24]]);
1137
1209
  }));
1138
1210
  function transitionChildBooking(_x9) {
1139
1211
  return _transitionChildBooking.apply(this, arguments);
@@ -1154,19 +1226,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1154
1226
  }, {
1155
1227
  key: "refreshSalesDetail",
1156
1228
  value: (function () {
1157
- var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1229
+ var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1158
1230
  var _this$store$order4, _this$store$order4$ge;
1159
1231
  var params,
1160
1232
  tempOrder,
1161
1233
  orderId,
1162
- _args15 = arguments;
1163
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1164
- while (1) switch (_context15.prev = _context15.next) {
1234
+ _args17 = arguments;
1235
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1236
+ while (1) switch (_context17.prev = _context17.next) {
1165
1237
  case 0:
1166
- params = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
1238
+ params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
1167
1239
  tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || (_this$store$order4$ge = _this$store$order4.getTempOrder) === null || _this$store$order4$ge === void 0 ? void 0 : _this$store$order4$ge.call(_this$store$order4);
1168
1240
  if (tempOrder) {
1169
- _context15.next = 4;
1241
+ _context17.next = 4;
1170
1242
  break;
1171
1243
  }
1172
1244
  throw new Error('refreshSalesDetail: tempOrder 未加载');
@@ -1174,21 +1246,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1174
1246
  debugger;
1175
1247
  orderId = tempOrder.order_id || tempOrder.external_sale_number;
1176
1248
  if (!(orderId === undefined || orderId === null)) {
1177
- _context15.next = 8;
1249
+ _context17.next = 8;
1178
1250
  break;
1179
1251
  }
1180
- return _context15.abrupt("return", {});
1252
+ return _context17.abrupt("return", {});
1181
1253
  case 8:
1182
- return _context15.abrupt("return", this.loadSalesDetail({
1254
+ return _context17.abrupt("return", this.loadSalesDetail({
1183
1255
  orderId: orderId,
1184
1256
  // merge: true
1185
1257
  forceRemote: params.forceRemote
1186
1258
  }));
1187
1259
  case 9:
1188
1260
  case "end":
1189
- return _context15.stop();
1261
+ return _context17.stop();
1190
1262
  }
1191
- }, _callee15, this);
1263
+ }, _callee17, this);
1192
1264
  }));
1193
1265
  function refreshSalesDetail() {
1194
1266
  return _refreshSalesDetail.apply(this, arguments);
@@ -1204,7 +1276,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1204
1276
  }, {
1205
1277
  key: "loadProducts",
1206
1278
  value: (function () {
1207
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1279
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1208
1280
  var params,
1209
1281
  options,
1210
1282
  schedule_date,
@@ -1213,20 +1285,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1213
1285
  schedule_datetime,
1214
1286
  bookingDate,
1215
1287
  _result,
1216
- _args16 = arguments;
1217
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1218
- while (1) switch (_context16.prev = _context16.next) {
1288
+ _args18 = arguments;
1289
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1290
+ while (1) switch (_context18.prev = _context18.next) {
1219
1291
  case 0:
1220
- params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
1221
- options = _args16.length > 1 ? _args16[1] : undefined;
1292
+ params = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
1293
+ options = _args18.length > 1 ? _args18[1] : undefined;
1222
1294
  schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime; // 优先写入 schedule_datetime(含时分),供加购 presetStartTime 与 TimeBar 对齐;
1223
1295
  // requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
1224
1296
  bookingDate = schedule_datetime || schedule_date || '';
1225
1297
  if (bookingDate) {
1226
1298
  this.setBookingDate(bookingDate);
1227
1299
  }
1228
- _context16.prev = 5;
1229
- _context16.next = 8;
1300
+ _context18.prev = 5;
1301
+ _context18.next = 8;
1230
1302
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
1231
1303
  with_count: ['bundleGroup', 'optionGroup'],
1232
1304
  with_schedule: 1
@@ -1234,20 +1306,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1234
1306
  cacheId: this.cacheId
1235
1307
  }), options);
1236
1308
  case 8:
1237
- _result = _context16.sent;
1309
+ _result = _context18.sent;
1238
1310
  this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
1239
1311
  this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
1240
- return _context16.abrupt("return", _result);
1312
+ return _context18.abrupt("return", _result);
1241
1313
  case 14:
1242
- _context16.prev = 14;
1243
- _context16.t0 = _context16["catch"](5);
1244
- console.error('Failed to load products:', _context16.t0);
1245
- throw _context16.t0;
1314
+ _context18.prev = 14;
1315
+ _context18.t0 = _context18["catch"](5);
1316
+ console.error('Failed to load products:', _context18.t0);
1317
+ throw _context18.t0;
1246
1318
  case 18:
1247
1319
  case "end":
1248
- return _context16.stop();
1320
+ return _context18.stop();
1249
1321
  }
1250
- }, _callee16, this, [[5, 14]]);
1322
+ }, _callee18, this, [[5, 14]]);
1251
1323
  }));
1252
1324
  function loadProducts() {
1253
1325
  return _loadProducts.apply(this, arguments);
@@ -1264,27 +1336,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1264
1336
  }, {
1265
1337
  key: "getAddTimeProducts",
1266
1338
  value: (function () {
1267
- var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1339
+ var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1268
1340
  var params,
1269
1341
  result,
1270
- _args17 = arguments;
1271
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1272
- while (1) switch (_context17.prev = _context17.next) {
1342
+ _args19 = arguments;
1343
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1344
+ while (1) switch (_context19.prev = _context19.next) {
1273
1345
  case 0:
1274
- params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
1275
- _context17.next = 3;
1346
+ params = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
1347
+ _context19.next = 3;
1276
1348
  return this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
1277
1349
  cacheId: this.cacheId
1278
1350
  }));
1279
1351
  case 3:
1280
- result = _context17.sent;
1352
+ result = _context19.sent;
1281
1353
  this.addTimeProductsCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
1282
- return _context17.abrupt("return", result);
1354
+ return _context19.abrupt("return", result);
1283
1355
  case 6:
1284
1356
  case "end":
1285
- return _context17.stop();
1357
+ return _context19.stop();
1286
1358
  }
1287
- }, _callee17, this);
1359
+ }, _callee19, this);
1288
1360
  }));
1289
1361
  function getAddTimeProducts() {
1290
1362
  return _getAddTimeProducts.apply(this, arguments);
@@ -1309,14 +1381,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1309
1381
  }, {
1310
1382
  key: "queryProductDetail",
1311
1383
  value: (function () {
1312
- var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params, options) {
1384
+ var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params, options) {
1313
1385
  var product_id, queryParams, _result2, list;
1314
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1315
- while (1) switch (_context18.prev = _context18.next) {
1386
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1387
+ while (1) switch (_context20.prev = _context20.next) {
1316
1388
  case 0:
1317
1389
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
1318
- _context18.prev = 1;
1319
- _context18.next = 4;
1390
+ _context20.prev = 1;
1391
+ _context20.next = 4;
1320
1392
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
1321
1393
  with_count: ['bundleGroup', 'optionGroup'],
1322
1394
  with_schedule: 1
@@ -1325,21 +1397,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1325
1397
  cacheId: this.cacheId
1326
1398
  }), options);
1327
1399
  case 4:
1328
- _result2 = _context18.sent;
1400
+ _result2 = _context20.sent;
1329
1401
  list = Array.isArray(_result2) ? _result2 : [];
1330
- return _context18.abrupt("return", list.find(function (product) {
1402
+ return _context20.abrupt("return", list.find(function (product) {
1331
1403
  return Number(product.id) === Number(product_id);
1332
1404
  }));
1333
1405
  case 9:
1334
- _context18.prev = 9;
1335
- _context18.t0 = _context18["catch"](1);
1336
- console.error('Failed to query product detail:', _context18.t0);
1337
- throw _context18.t0;
1406
+ _context20.prev = 9;
1407
+ _context20.t0 = _context20["catch"](1);
1408
+ console.error('Failed to query product detail:', _context20.t0);
1409
+ throw _context20.t0;
1338
1410
  case 13:
1339
1411
  case "end":
1340
- return _context18.stop();
1412
+ return _context20.stop();
1341
1413
  }
1342
- }, _callee18, this, [[1, 9]]);
1414
+ }, _callee20, this, [[1, 9]]);
1343
1415
  }));
1344
1416
  function queryProductDetail(_x10, _x11) {
1345
1417
  return _queryProductDetail.apply(this, arguments);
@@ -1354,26 +1426,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1354
1426
  }, {
1355
1427
  key: "loadProductDetail",
1356
1428
  value: (function () {
1357
- var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params, options) {
1429
+ var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params, options) {
1358
1430
  var product_id, queryParams, products;
1359
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1360
- while (1) switch (_context19.prev = _context19.next) {
1431
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1432
+ while (1) switch (_context21.prev = _context21.next) {
1361
1433
  case 0:
1362
1434
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
1363
- _context19.next = 3;
1435
+ _context21.next = 3;
1364
1436
  return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
1365
1437
  product_ids: [product_id]
1366
1438
  }), options);
1367
1439
  case 3:
1368
- products = _context19.sent;
1369
- return _context19.abrupt("return", products.find(function (product) {
1440
+ products = _context21.sent;
1441
+ return _context21.abrupt("return", products.find(function (product) {
1370
1442
  return Number(product.id) === Number(product_id);
1371
1443
  }));
1372
1444
  case 5:
1373
1445
  case "end":
1374
- return _context19.stop();
1446
+ return _context21.stop();
1375
1447
  }
1376
- }, _callee19, this);
1448
+ }, _callee21, this);
1377
1449
  }));
1378
1450
  function loadProductDetail(_x12, _x13) {
1379
1451
  return _loadProductDetail.apply(this, arguments);
@@ -1408,16 +1480,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1408
1480
  }, {
1409
1481
  key: "getProducts",
1410
1482
  value: (function () {
1411
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1412
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1413
- while (1) switch (_context20.prev = _context20.next) {
1483
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1484
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1485
+ while (1) switch (_context22.prev = _context22.next) {
1414
1486
  case 0:
1415
- return _context20.abrupt("return", this.store.products.getProducts());
1487
+ return _context22.abrupt("return", this.store.products.getProducts());
1416
1488
  case 1:
1417
1489
  case "end":
1418
- return _context20.stop();
1490
+ return _context22.stop();
1419
1491
  }
1420
- }, _callee20, this);
1492
+ }, _callee22, this);
1421
1493
  }));
1422
1494
  function getProducts() {
1423
1495
  return _getProducts.apply(this, arguments);
@@ -1482,33 +1554,33 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1482
1554
  }, {
1483
1555
  key: "getProductByIds",
1484
1556
  value: (function () {
1485
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(ids, options) {
1557
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(ids, options) {
1486
1558
  var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
1487
1559
  var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
1488
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1489
- while (1) switch (_context21.prev = _context21.next) {
1560
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1561
+ while (1) switch (_context23.prev = _context23.next) {
1490
1562
  case 0:
1491
1563
  normalizedIds = Array.from(new Set((ids || []).map(function (id) {
1492
1564
  return Number(id);
1493
1565
  }).filter(function (id) {
1494
1566
  return Number.isFinite(id);
1495
1567
  })));
1496
- _context21.next = 3;
1568
+ _context23.next = 3;
1497
1569
  return this.store.products.getProductByIds(normalizedIds);
1498
1570
  case 3:
1499
- _context21.t0 = _context21.sent;
1500
- if (_context21.t0) {
1501
- _context21.next = 6;
1571
+ _context23.t0 = _context23.sent;
1572
+ if (_context23.t0) {
1573
+ _context23.next = 6;
1502
1574
  break;
1503
1575
  }
1504
- _context21.t0 = [];
1576
+ _context23.t0 = [];
1505
1577
  case 6:
1506
- localProducts = _context21.t0;
1578
+ localProducts = _context23.t0;
1507
1579
  if (options !== null && options !== void 0 && options.loadMissing) {
1508
- _context21.next = 9;
1580
+ _context23.next = 9;
1509
1581
  break;
1510
1582
  }
1511
- return _context21.abrupt("return", localProducts);
1583
+ return _context23.abrupt("return", localProducts);
1512
1584
  case 9:
1513
1585
  localProductIds = new Set(localProducts.map(function (product) {
1514
1586
  return Number(product.id);
@@ -1517,15 +1589,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1517
1589
  return !localProductIds.has(id);
1518
1590
  });
1519
1591
  if (missingIds.length) {
1520
- _context21.next = 13;
1592
+ _context23.next = 13;
1521
1593
  break;
1522
1594
  }
1523
- return _context21.abrupt("return", localProducts);
1595
+ return _context23.abrupt("return", localProducts);
1524
1596
  case 13:
1525
1597
  rawBookingDate = this.getBookingDate();
1526
1598
  bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
1527
1599
  customerId = Number((_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$getOrderCustome3 = this.getOrderCustomer()) === null || _this$getOrderCustome3 === void 0 ? void 0 : _this$getOrderCustome3.customer_id);
1528
- _context21.next = 18;
1600
+ _context23.next = 18;
1529
1601
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
1530
1602
  product_ids: missingIds,
1531
1603
  with_count: ['bundleGroup', 'optionGroup'],
@@ -1538,7 +1610,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1538
1610
  customer_id: customerId
1539
1611
  } : {}));
1540
1612
  case 18:
1541
- loadedProducts = _context21.sent;
1613
+ loadedProducts = _context23.sent;
1542
1614
  productById = new Map();
1543
1615
  [].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
1544
1616
  var productId = Number(product.id);
@@ -1546,16 +1618,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1546
1618
  productById.set(productId, product);
1547
1619
  }
1548
1620
  });
1549
- return _context21.abrupt("return", normalizedIds.map(function (id) {
1621
+ return _context23.abrupt("return", normalizedIds.map(function (id) {
1550
1622
  return productById.get(id);
1551
1623
  }).filter(function (product) {
1552
1624
  return Boolean(product);
1553
1625
  }));
1554
1626
  case 22:
1555
1627
  case "end":
1556
- return _context21.stop();
1628
+ return _context23.stop();
1557
1629
  }
1558
- }, _callee21, this);
1630
+ }, _callee23, this);
1559
1631
  }));
1560
1632
  function getProductByIds(_x14, _x15) {
1561
1633
  return _getProductByIds.apply(this, arguments);
@@ -1571,25 +1643,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1571
1643
  }, {
1572
1644
  key: "getScheduleTimePoints",
1573
1645
  value: (function () {
1574
- var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
1646
+ var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
1575
1647
  var result;
1576
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1577
- while (1) switch (_context22.prev = _context22.next) {
1648
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1649
+ while (1) switch (_context24.prev = _context24.next) {
1578
1650
  case 0:
1579
- _context22.next = 2;
1651
+ _context24.next = 2;
1580
1652
  return this.request.post('/menu/schedule-time-points', {
1581
1653
  menu_list_ids: params.menu_list_ids
1582
1654
  }, {
1583
1655
  osServer: true
1584
1656
  });
1585
1657
  case 2:
1586
- result = _context22.sent;
1587
- return _context22.abrupt("return", result.data || []);
1658
+ result = _context24.sent;
1659
+ return _context24.abrupt("return", result.data || []);
1588
1660
  case 4:
1589
1661
  case "end":
1590
- return _context22.stop();
1662
+ return _context24.stop();
1591
1663
  }
1592
- }, _callee22, this);
1664
+ }, _callee24, this);
1593
1665
  }));
1594
1666
  function getScheduleTimePoints(_x16) {
1595
1667
  return _getScheduleTimePoints.apply(this, arguments);
@@ -1605,30 +1677,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1605
1677
  }, {
1606
1678
  key: "getCustomerList",
1607
1679
  value: (function () {
1608
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1680
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1609
1681
  var params,
1610
1682
  _result3,
1611
- _args23 = arguments;
1612
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1613
- while (1) switch (_context23.prev = _context23.next) {
1683
+ _args25 = arguments;
1684
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1685
+ while (1) switch (_context25.prev = _context25.next) {
1614
1686
  case 0:
1615
- params = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
1616
- _context23.prev = 1;
1617
- _context23.next = 4;
1687
+ params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
1688
+ _context25.prev = 1;
1689
+ _context25.next = 4;
1618
1690
  return this.store.customer.getCustomerList(params);
1619
1691
  case 4:
1620
- _result3 = _context23.sent;
1621
- return _context23.abrupt("return", _result3);
1692
+ _result3 = _context25.sent;
1693
+ return _context25.abrupt("return", _result3);
1622
1694
  case 8:
1623
- _context23.prev = 8;
1624
- _context23.t0 = _context23["catch"](1);
1625
- console.error('Failed to get customer list:', _context23.t0);
1626
- throw _context23.t0;
1695
+ _context25.prev = 8;
1696
+ _context25.t0 = _context25["catch"](1);
1697
+ console.error('Failed to get customer list:', _context25.t0);
1698
+ throw _context25.t0;
1627
1699
  case 12:
1628
1700
  case "end":
1629
- return _context23.stop();
1701
+ return _context25.stop();
1630
1702
  }
1631
- }, _callee23, this, [[1, 8]]);
1703
+ }, _callee25, this, [[1, 8]]);
1632
1704
  }));
1633
1705
  function getCustomerList() {
1634
1706
  return _getCustomerList.apply(this, arguments);
@@ -1738,7 +1810,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1738
1810
  var _this$store$order$get3,
1739
1811
  _this3 = this;
1740
1812
  if (!customer) {
1741
- this.clearOrderCustomer();
1813
+ this.clearOrderCustomer({
1814
+ preserveContactInfo: (options === null || options === void 0 ? void 0 : options.source) === 'detailHydrate'
1815
+ });
1742
1816
  return;
1743
1817
  }
1744
1818
  var previousCustomerId = (_this$store$order$get3 = this.store.order.getOrderCustomer()) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.customer_id;
@@ -1749,7 +1823,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1749
1823
  this.discountConfigCacheKey = null;
1750
1824
  this.hasManualDiscountSelection = false;
1751
1825
  }
1826
+ if (!customerUnchanged && (options === null || options === void 0 ? void 0 : options.source) !== 'detailHydrate') {
1827
+ this.resetOrderCustomerContactInfo();
1828
+ this.store.order.updateTempOrderContactsInfo(cloneDeep(extractCustomerContactInfo(customer)));
1829
+ }
1752
1830
  this.store.order.setOrderCustomer(patch, customer);
1831
+ if ((options === null || options === void 0 ? void 0 : options.source) === 'detailHydrate') {
1832
+ this.orderCustomerContactRequest = null;
1833
+ } else {
1834
+ this.prefillOrderCustomerContactInfo(customer, !customerUnchanged);
1835
+ }
1753
1836
  var snapshotAfterOrderSet = this.store.order.getOrderCustomerSnapshot();
1754
1837
  if (customerUnchanged) {
1755
1838
  // hydrate 后 customer_id 已存在但 _extend.customerSnapshot 仍为空时,
@@ -1782,7 +1865,242 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1782
1865
  _this3.orderCustomerPromotionRefreshInFlight = null;
1783
1866
  });
1784
1867
  }
1868
+ }, {
1869
+ key: "resetOrderCustomerContactInfo",
1870
+ value: function resetOrderCustomerContactInfo() {
1871
+ this.orderCustomerContactRequest = null;
1872
+ var order = this.getTempOrder();
1873
+ if (order !== null && order !== void 0 && order._extend) delete order._extend.contactInfoEdited;
1874
+ }
1785
1875
 
1876
+ /** Explicit edits, including clearing the contact, must win over a pending default. */
1877
+ }, {
1878
+ key: "updateTempOrderContactsInfo",
1879
+ value: function updateTempOrderContactsInfo(contact) {
1880
+ var order = this.store.order.ensureTempOrder();
1881
+ order._extend || (order._extend = {});
1882
+ order._extend.contactInfoEdited = true;
1883
+ this.orderCustomerContactRequest = null;
1884
+ return _get(_getPrototypeOf(BookingTicketImpl.prototype), "updateTempOrderContactsInfo", this).call(this, contact);
1885
+ }
1886
+ }, {
1887
+ key: "getCustomerContactScope",
1888
+ value: function getCustomerContactScope() {
1889
+ var _this$otherParams5, _this$otherParams6, _this$otherParams7;
1890
+ return JSON.stringify([this.getPickupTimingScope(), (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.channel, (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.shop_id, (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.tenantId]);
1891
+ }
1892
+ }, {
1893
+ key: "getCustomerContactOrderKey",
1894
+ value: function getCustomerContactOrderKey() {
1895
+ var _order$_extend;
1896
+ var order = this.getTempOrder();
1897
+ // Cart mutations can replace the object without changing the order.
1898
+ var identity = (order === null || order === void 0 ? void 0 : order.external_sale_number) || (order === null || order === void 0 ? void 0 : order.request_unique_idempotency_token) || (order === null || order === void 0 || (_order$_extend = order._extend) === null || _order$_extend === void 0 ? void 0 : _order$_extend.localId) || (order === null || order === void 0 ? void 0 : order.order_id);
1899
+ return identity ? JSON.stringify([identity, order === null || order === void 0 ? void 0 : order.order_id]) : order;
1900
+ }
1901
+ }, {
1902
+ key: "replaceTempOrder",
1903
+ value: function () {
1904
+ var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1905
+ var _get2;
1906
+ var _len2,
1907
+ args,
1908
+ _key2,
1909
+ _args26 = arguments;
1910
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1911
+ while (1) switch (_context26.prev = _context26.next) {
1912
+ case 0:
1913
+ this.orderCustomerContactRequest = null;
1914
+ for (_len2 = _args26.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1915
+ args[_key2] = _args26[_key2];
1916
+ }
1917
+ return _context26.abrupt("return", (_get2 = _get(_getPrototypeOf(BookingTicketImpl.prototype), "replaceTempOrder", this)).call.apply(_get2, [this].concat(args)));
1918
+ case 3:
1919
+ case "end":
1920
+ return _context26.stop();
1921
+ }
1922
+ }, _callee26, this);
1923
+ }));
1924
+ function replaceTempOrder() {
1925
+ return _replaceTempOrder.apply(this, arguments);
1926
+ }
1927
+ return replaceTempOrder;
1928
+ }()
1929
+ }, {
1930
+ key: "applyDefaultOrderCustomerContactInfo",
1931
+ value: function () {
1932
+ var _applyDefaultOrderCustomerContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(contact) {
1933
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1934
+ while (1) switch (_context27.prev = _context27.next) {
1935
+ case 0:
1936
+ this.store.order.updateTempOrderContactsInfo(cloneDeep(contact));
1937
+ // Metadata may finish after promotion/discount refresh; publish the updated cart explicitly.
1938
+ _context27.next = 3;
1939
+ return this.effectsEmit('onTempOrderReplaced', {
1940
+ tempOrder: this.getTempOrder()
1941
+ });
1942
+ case 3:
1943
+ case "end":
1944
+ return _context27.stop();
1945
+ }
1946
+ }, _callee27, this);
1947
+ }));
1948
+ function applyDefaultOrderCustomerContactInfo(_x17) {
1949
+ return _applyDefaultOrderCustomerContactInfo.apply(this, arguments);
1950
+ }
1951
+ return applyDefaultOrderCustomerContactInfo;
1952
+ }()
1953
+ }, {
1954
+ key: "prefillOrderCustomerContactInfo",
1955
+ value: function prefillOrderCustomerContactInfo(customer, customerChanged) {
1956
+ var _order$_extend2,
1957
+ _this$otherParams8,
1958
+ _this4 = this;
1959
+ var order = this.getTempOrder();
1960
+ var customerId = Number(order === null || order === void 0 ? void 0 : order.customer_id);
1961
+ if (!order || !Number.isInteger(customerId) || customerId <= 1 || order.contacts_info != null || (_order$_extend2 = order._extend) !== null && _order$_extend2 !== void 0 && _order$_extend2.contactInfoEdited) return;
1962
+ // A restored new cart may already have its customer ID. Existing sales keep their snapshot,
1963
+ // even when it is empty; only an explicit customer switch replaces it.
1964
+ if (!customerChanged && order.order_id && !String(order.order_id).startsWith('local_order')) return;
1965
+ var contact = extractCustomerContactInfo(customer);
1966
+ if (contact) {
1967
+ this.orderCustomerContactRequest = null;
1968
+ void this.applyDefaultOrderCustomerContactInfo(contact);
1969
+ return;
1970
+ }
1971
+ // A relation explicitly returned as null is authoritative. Only a missing relation needs fetching.
1972
+ if (customer.contacts_info !== undefined) return;
1973
+ var userPlatform = isCustomerUserPlatform((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform);
1974
+ var getAuthenticatedCustomerId = function getAuthenticatedCustomerId() {
1975
+ var _this4$core, _this4$core$getPlugin, _this4$core$getPlugin2;
1976
+ return Number((_this4$core = _this4.core) === null || _this4$core === void 0 || (_this4$core$getPlugin = _this4$core.getPlugin) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin = _this4$core$getPlugin.call(_this4$core, 'user')) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin.get) === null || _this4$core$getPlugin2 === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin2.call(_this4$core$getPlugin)) === null || _this4$core$getPlugin2 === void 0 ? void 0 : _this4$core$getPlugin2.id);
1977
+ };
1978
+ if (userPlatform && getAuthenticatedCustomerId() !== customerId) return;
1979
+ var scope = this.getCustomerContactScope();
1980
+ var orderKey = this.getCustomerContactOrderKey();
1981
+ var previous = this.orderCustomerContactRequest;
1982
+ if ((previous === null || previous === void 0 ? void 0 : previous.orderKey) === orderKey && previous.customerId === customerId && previous.scope === scope) return;
1983
+ var pending = {
1984
+ orderKey: orderKey,
1985
+ customerId: customerId,
1986
+ scope: scope,
1987
+ promise: Promise.resolve()
1988
+ };
1989
+ this.orderCustomerContactRequest = pending;
1990
+ var loadContact = /*#__PURE__*/function () {
1991
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
1992
+ var _result4, resolved;
1993
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
1994
+ while (1) switch (_context28.prev = _context28.next) {
1995
+ case 0:
1996
+ if (!userPlatform) {
1997
+ _context28.next = 7;
1998
+ break;
1999
+ }
2000
+ _context28.next = 3;
2001
+ return _this4.request.get('/customer/metadata', {
2002
+ key: 'contacts_info'
2003
+ });
2004
+ case 3:
2005
+ _result4 = _context28.sent;
2006
+ if (!((_result4 === null || _result4 === void 0 ? void 0 : _result4.code) !== 200 || (_result4 === null || _result4 === void 0 ? void 0 : _result4.status) === false)) {
2007
+ _context28.next = 6;
2008
+ break;
2009
+ }
2010
+ throw new Error('Customer contact lookup failed');
2011
+ case 6:
2012
+ return _context28.abrupt("return", isContactRecord(_result4.data) ? _result4.data : null);
2013
+ case 7:
2014
+ _context28.next = 9;
2015
+ return _this4.resolveCustomerById(customerId);
2016
+ case 9:
2017
+ resolved = _context28.sent;
2018
+ return _context28.abrupt("return", Number(resolved === null || resolved === void 0 ? void 0 : resolved.id) === customerId ? extractCustomerContactInfo(resolved) : null);
2019
+ case 11:
2020
+ case "end":
2021
+ return _context28.stop();
2022
+ }
2023
+ }, _callee28);
2024
+ }));
2025
+ return function loadContact() {
2026
+ return _ref11.apply(this, arguments);
2027
+ };
2028
+ }();
2029
+ pending.promise = loadContact().then( /*#__PURE__*/function () {
2030
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(value) {
2031
+ var _current$_extend;
2032
+ var current;
2033
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2034
+ while (1) switch (_context29.prev = _context29.next) {
2035
+ case 0:
2036
+ current = _this4.getTempOrder();
2037
+ if (!(_this4.orderCustomerContactRequest !== pending || _this4.getCustomerContactOrderKey() !== orderKey || Number(current === null || current === void 0 ? void 0 : current.customer_id) !== customerId || scope !== _this4.getCustomerContactScope() || current !== null && current !== void 0 && (_current$_extend = current._extend) !== null && _current$_extend !== void 0 && _current$_extend.contactInfoEdited || (current === null || current === void 0 ? void 0 : current.contacts_info) != null || userPlatform && getAuthenticatedCustomerId() !== customerId)) {
2038
+ _context29.next = 3;
2039
+ break;
2040
+ }
2041
+ return _context29.abrupt("return");
2042
+ case 3:
2043
+ if (!value) {
2044
+ _context29.next = 6;
2045
+ break;
2046
+ }
2047
+ _context29.next = 6;
2048
+ return _this4.applyDefaultOrderCustomerContactInfo(value);
2049
+ case 6:
2050
+ case "end":
2051
+ return _context29.stop();
2052
+ }
2053
+ }, _callee29);
2054
+ }));
2055
+ return function (_x18) {
2056
+ return _ref12.apply(this, arguments);
2057
+ };
2058
+ }()).catch(function () {
2059
+ // A failed default does not prevent manual entry; a subsequent sync can retry.
2060
+ if (_this4.orderCustomerContactRequest === pending) _this4.orderCustomerContactRequest = null;
2061
+ console.warn('[BookingTicket] Failed to load saved customer contact information');
2062
+ });
2063
+ }
2064
+ }, {
2065
+ key: "waitForOrderCustomerContactInfo",
2066
+ value: function waitForOrderCustomerContactInfo() {
2067
+ var _this$orderCustomerCo, _this$orderCustomerCo2;
2068
+ return (_this$orderCustomerCo = (_this$orderCustomerCo2 = this.orderCustomerContactRequest) === null || _this$orderCustomerCo2 === void 0 ? void 0 : _this$orderCustomerCo2.promise) !== null && _this$orderCustomerCo !== void 0 ? _this$orderCustomerCo : Promise.resolve();
2069
+ }
2070
+ }, {
2071
+ key: "validateContactInfo",
2072
+ value: function () {
2073
+ var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2074
+ var _this$getTempOrder, _this$getTempOrder2;
2075
+ var orderKey, customerId, scope;
2076
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2077
+ while (1) switch (_context30.prev = _context30.next) {
2078
+ case 0:
2079
+ orderKey = this.getCustomerContactOrderKey();
2080
+ customerId = (_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.customer_id;
2081
+ scope = this.getCustomerContactScope();
2082
+ _context30.next = 5;
2083
+ return this.waitForOrderCustomerContactInfo();
2084
+ case 5:
2085
+ if (!(this.getCustomerContactOrderKey() !== orderKey || ((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.customer_id) !== customerId || this.getCustomerContactScope() !== scope)) {
2086
+ _context30.next = 7;
2087
+ break;
2088
+ }
2089
+ throw new Error('The order changed. Please try again.');
2090
+ case 7:
2091
+ _context30.next = 9;
2092
+ return _get(_getPrototypeOf(BookingTicketImpl.prototype), "validateContactInfo", this).call(this);
2093
+ case 9:
2094
+ case "end":
2095
+ return _context30.stop();
2096
+ }
2097
+ }, _callee30, this);
2098
+ }));
2099
+ function validateContactInfo() {
2100
+ return _validateContactInfo.apply(this, arguments);
2101
+ }
2102
+ return validateContactInfo;
2103
+ }()
1786
2104
  /**
1787
2105
  * 读取 tempOrder 上的下单客户协议字段;customer_id 缺失时返回 null。
1788
2106
  */
@@ -1806,10 +2124,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1806
2124
  */
1807
2125
  }, {
1808
2126
  key: "clearOrderCustomer",
1809
- value: function clearOrderCustomer() {
2127
+ value: function clearOrderCustomer(options) {
1810
2128
  var _discountModule$setOr,
1811
2129
  _discountModule$setDi,
1812
- _this4 = this;
2130
+ _this5 = this;
2131
+ this.orderCustomerContactRequest = null;
2132
+ if (!(options !== null && options !== void 0 && options.preserveContactInfo)) this.resetOrderCustomerContactInfo();
2133
+ if (!(options !== null && options !== void 0 && options.preserveContactInfo)) this.store.order.updateTempOrderContactsInfo(null);
1813
2134
  this.store.order.clearOrderCustomer();
1814
2135
  this.discountConfigCacheKey = null;
1815
2136
  this.hasManualDiscountSelection = false;
@@ -1822,9 +2143,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1822
2143
  createIfMissing: true
1823
2144
  }).then(function () {
1824
2145
  var _discountModule$getDi;
1825
- var tempOrder = _this4.store.order.ensureTempOrder();
1826
- _this4.store.order.persistTempOrder();
1827
- return _this4.effectsEmit('onDiscountApplied', {
2146
+ var tempOrder = _this5.store.order.ensureTempOrder();
2147
+ _this5.store.order.persistTempOrder();
2148
+ return _this5.effectsEmit('onDiscountApplied', {
1828
2149
  productList: tempOrder.products || [],
1829
2150
  discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [],
1830
2151
  selectedDiscountList: tempOrder.discount_list || [],
@@ -1848,24 +2169,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1848
2169
  }, {
1849
2170
  key: "restoreOrder",
1850
2171
  value: (function () {
1851
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2172
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
1852
2173
  var _this$store$customer;
1853
2174
  var tempOrder;
1854
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1855
- while (1) switch (_context24.prev = _context24.next) {
2175
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2176
+ while (1) switch (_context31.prev = _context31.next) {
1856
2177
  case 0:
1857
- _context24.next = 2;
2178
+ _context31.next = 2;
1858
2179
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
1859
2180
  case 2:
1860
- tempOrder = _context24.sent;
2181
+ tempOrder = _context31.sent;
1861
2182
  this.clearOrderCustomer();
1862
2183
  (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
1863
- return _context24.abrupt("return", tempOrder);
2184
+ return _context31.abrupt("return", tempOrder);
1864
2185
  case 6:
1865
2186
  case "end":
1866
- return _context24.stop();
2187
+ return _context31.stop();
1867
2188
  }
1868
- }, _callee24, this);
2189
+ }, _callee31, this);
1869
2190
  }));
1870
2191
  function restoreOrder() {
1871
2192
  return _restoreOrder.apply(this, arguments);
@@ -1888,7 +2209,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1888
2209
  var _this$store$order$get4,
1889
2210
  _this$store$order6,
1890
2211
  _this$getOrderIdentit,
1891
- _this5 = this;
2212
+ _this6 = this;
1892
2213
  if (!customerId || customerId === 1) return Promise.resolve();
1893
2214
  var tempOrder = (_this$store$order$get4 = (_this$store$order6 = this.store.order).getTempOrder) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order6);
1894
2215
  var orderIdentity = (_this$getOrderIdentit = this.getOrderIdentity) === null || _this$getOrderIdentit === void 0 ? void 0 : _this$getOrderIdentit.call(this);
@@ -1900,50 +2221,50 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1900
2221
  return this.orderCustomerDiscountRefreshInFlight;
1901
2222
  }
1902
2223
  var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
1903
- var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1904
- var _this5$store$order$ge, _this5$store$order, _this5$getOrderIdenti;
2224
+ var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2225
+ var _this6$store$order$ge, _this6$store$order, _this6$getOrderIdenti;
1905
2226
  var currentCustomer, currentTempOrder, currentOrderIdentity, currentOrderId, currentAction, currentOrderTarget;
1906
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1907
- while (1) switch (_context25.prev = _context25.next) {
2227
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2228
+ while (1) switch (_context32.prev = _context32.next) {
1908
2229
  case 0:
1909
2230
  if (!previousRefresh) {
1910
- _context25.next = 3;
2231
+ _context32.next = 3;
1911
2232
  break;
1912
2233
  }
1913
- _context25.next = 3;
2234
+ _context32.next = 3;
1914
2235
  return previousRefresh.catch(function () {
1915
2236
  return undefined;
1916
2237
  });
1917
2238
  case 3:
1918
- currentCustomer = _this5.store.order.getOrderCustomer();
2239
+ currentCustomer = _this6.store.order.getOrderCustomer();
1919
2240
  if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
1920
- _context25.next = 6;
2241
+ _context32.next = 6;
1921
2242
  break;
1922
2243
  }
1923
- return _context25.abrupt("return");
2244
+ return _context32.abrupt("return");
1924
2245
  case 6:
1925
- currentTempOrder = (_this5$store$order$ge = (_this5$store$order = _this5.store.order).getTempOrder) === null || _this5$store$order$ge === void 0 ? void 0 : _this5$store$order$ge.call(_this5$store$order);
1926
- currentOrderIdentity = (_this5$getOrderIdenti = _this5.getOrderIdentity) === null || _this5$getOrderIdenti === void 0 ? void 0 : _this5$getOrderIdenti.call(_this5);
2246
+ currentTempOrder = (_this6$store$order$ge = (_this6$store$order = _this6.store.order).getTempOrder) === null || _this6$store$order$ge === void 0 ? void 0 : _this6$store$order$ge.call(_this6$store$order);
2247
+ currentOrderIdentity = (_this6$getOrderIdenti = _this6.getOrderIdentity) === null || _this6$getOrderIdenti === void 0 ? void 0 : _this6$getOrderIdenti.call(_this6);
1927
2248
  currentOrderId = (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.order_id) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.orderId);
1928
2249
  currentAction = !currentOrderId || String(currentOrderId).startsWith('local_order') ? 'create' : 'edit';
1929
2250
  currentOrderTarget = currentOrderId ? "order:".concat(String(currentOrderId)) : "external:".concat(String((currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.external_sale_number) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.externalSaleNumber) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.localId) || 'new'));
1930
2251
  if (!("".concat(customerId, ":").concat(currentAction, ":").concat(currentOrderTarget) !== refreshTarget)) {
1931
- _context25.next = 13;
2252
+ _context32.next = 13;
1932
2253
  break;
1933
2254
  }
1934
- return _context25.abrupt("return");
2255
+ return _context32.abrupt("return");
1935
2256
  case 13:
1936
- _context25.next = 15;
1937
- return _this5.loadDiscountConfig({
2257
+ _context32.next = 15;
2258
+ return _this6.loadDiscountConfig({
1938
2259
  customerId: customerId,
1939
2260
  action: action,
1940
2261
  force: true
1941
2262
  });
1942
2263
  case 15:
1943
2264
  case "end":
1944
- return _context25.stop();
2265
+ return _context32.stop();
1945
2266
  }
1946
- }, _callee25);
2267
+ }, _callee32);
1947
2268
  }))();
1948
2269
  this.orderCustomerDiscountRefreshInFlight = refreshTask;
1949
2270
  this.orderCustomerDiscountRefreshCustomerId = customerId;
@@ -1951,10 +2272,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1951
2272
  refreshTask.catch(function (error) {
1952
2273
  console.error('Failed to load discount config after customer change:', error);
1953
2274
  }).finally(function () {
1954
- if (_this5.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
1955
- _this5.orderCustomerDiscountRefreshInFlight = null;
1956
- _this5.orderCustomerDiscountRefreshCustomerId = null;
1957
- _this5.orderCustomerDiscountRefreshTarget = null;
2275
+ if (_this6.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
2276
+ _this6.orderCustomerDiscountRefreshInFlight = null;
2277
+ _this6.orderCustomerDiscountRefreshCustomerId = null;
2278
+ _this6.orderCustomerDiscountRefreshTarget = null;
1958
2279
  });
1959
2280
  return refreshTask;
1960
2281
  }
@@ -1966,30 +2287,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1966
2287
  }, {
1967
2288
  key: "prepareProductPriceQueryContext",
1968
2289
  value: function () {
1969
- var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(customerId) {
2290
+ var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(customerId) {
1970
2291
  var normalizedCustomerId, refreshTask, shouldWait;
1971
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1972
- while (1) switch (_context26.prev = _context26.next) {
2292
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2293
+ while (1) switch (_context33.prev = _context33.next) {
1973
2294
  case 0:
1974
- _context26.next = 2;
2295
+ _context33.next = 2;
1975
2296
  return Promise.resolve();
1976
2297
  case 2:
1977
2298
  normalizedCustomerId = Number(customerId || 0);
1978
2299
  refreshTask = this.orderCustomerDiscountRefreshInFlight;
1979
2300
  shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
1980
2301
  if (!(shouldWait && refreshTask)) {
1981
- _context26.next = 8;
2302
+ _context33.next = 8;
1982
2303
  break;
1983
2304
  }
1984
- _context26.next = 8;
2305
+ _context33.next = 8;
1985
2306
  return refreshTask;
1986
2307
  case 8:
1987
2308
  case "end":
1988
- return _context26.stop();
2309
+ return _context33.stop();
1989
2310
  }
1990
- }, _callee26, this);
2311
+ }, _callee33, this);
1991
2312
  }));
1992
- function prepareProductPriceQueryContext(_x17) {
2313
+ function prepareProductPriceQueryContext(_x19) {
1993
2314
  return _prepareProductPriceQueryContext.apply(this, arguments);
1994
2315
  }
1995
2316
  return prepareProductPriceQueryContext;
@@ -2042,29 +2363,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2042
2363
  }, {
2043
2364
  key: "changeCustomerPage",
2044
2365
  value: (function () {
2045
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(page, pageSize) {
2046
- var _result4;
2047
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2048
- while (1) switch (_context27.prev = _context27.next) {
2366
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(page, pageSize) {
2367
+ var _result5;
2368
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2369
+ while (1) switch (_context34.prev = _context34.next) {
2049
2370
  case 0:
2050
- _context27.prev = 0;
2051
- _context27.next = 3;
2371
+ _context34.prev = 0;
2372
+ _context34.next = 3;
2052
2373
  return this.store.customer.changeCustomerPage(page, pageSize);
2053
2374
  case 3:
2054
- _result4 = _context27.sent;
2055
- return _context27.abrupt("return", _result4);
2375
+ _result5 = _context34.sent;
2376
+ return _context34.abrupt("return", _result5);
2056
2377
  case 7:
2057
- _context27.prev = 7;
2058
- _context27.t0 = _context27["catch"](0);
2059
- console.error('Failed to change customer page:', _context27.t0);
2060
- throw _context27.t0;
2378
+ _context34.prev = 7;
2379
+ _context34.t0 = _context34["catch"](0);
2380
+ console.error('Failed to change customer page:', _context34.t0);
2381
+ throw _context34.t0;
2061
2382
  case 11:
2062
2383
  case "end":
2063
- return _context27.stop();
2384
+ return _context34.stop();
2064
2385
  }
2065
- }, _callee27, this, [[0, 7]]);
2386
+ }, _callee34, this, [[0, 7]]);
2066
2387
  }));
2067
- function changeCustomerPage(_x18, _x19) {
2388
+ function changeCustomerPage(_x20, _x21) {
2068
2389
  return _changeCustomerPage.apply(this, arguments);
2069
2390
  }
2070
2391
  return changeCustomerPage;
@@ -2077,28 +2398,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2077
2398
  }, {
2078
2399
  key: "loadMoreCustomers",
2079
2400
  value: (function () {
2080
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2081
- var _result5;
2082
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2083
- while (1) switch (_context28.prev = _context28.next) {
2401
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2402
+ var _result6;
2403
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2404
+ while (1) switch (_context35.prev = _context35.next) {
2084
2405
  case 0:
2085
- _context28.prev = 0;
2086
- _context28.next = 3;
2406
+ _context35.prev = 0;
2407
+ _context35.next = 3;
2087
2408
  return this.store.customer.loadMoreCustomers();
2088
2409
  case 3:
2089
- _result5 = _context28.sent;
2090
- this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
2091
- return _context28.abrupt("return", _result5);
2410
+ _result6 = _context35.sent;
2411
+ this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result6);
2412
+ return _context35.abrupt("return", _result6);
2092
2413
  case 8:
2093
- _context28.prev = 8;
2094
- _context28.t0 = _context28["catch"](0);
2095
- console.error('Failed to load more customers:', _context28.t0);
2096
- throw _context28.t0;
2414
+ _context35.prev = 8;
2415
+ _context35.t0 = _context35["catch"](0);
2416
+ console.error('Failed to load more customers:', _context35.t0);
2417
+ throw _context35.t0;
2097
2418
  case 12:
2098
2419
  case "end":
2099
- return _context28.stop();
2420
+ return _context35.stop();
2100
2421
  }
2101
- }, _callee28, this, [[0, 8]]);
2422
+ }, _callee35, this, [[0, 8]]);
2102
2423
  }));
2103
2424
  function loadMoreCustomers() {
2104
2425
  return _loadMoreCustomers.apply(this, arguments);
@@ -2114,31 +2435,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2114
2435
  }, {
2115
2436
  key: "resetAndLoadCustomers",
2116
2437
  value: (function () {
2117
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2438
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
2118
2439
  var params,
2119
- _result6,
2120
- _args29 = arguments;
2121
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2122
- while (1) switch (_context29.prev = _context29.next) {
2440
+ _result7,
2441
+ _args36 = arguments;
2442
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2443
+ while (1) switch (_context36.prev = _context36.next) {
2123
2444
  case 0:
2124
- params = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {};
2125
- _context29.prev = 1;
2126
- _context29.next = 4;
2445
+ params = _args36.length > 0 && _args36[0] !== undefined ? _args36[0] : {};
2446
+ _context36.prev = 1;
2447
+ _context36.next = 4;
2127
2448
  return this.store.customer.resetAndLoadCustomers(params);
2128
2449
  case 4:
2129
- _result6 = _context29.sent;
2130
- this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
2131
- return _context29.abrupt("return", _result6);
2450
+ _result7 = _context36.sent;
2451
+ this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result7);
2452
+ return _context36.abrupt("return", _result7);
2132
2453
  case 9:
2133
- _context29.prev = 9;
2134
- _context29.t0 = _context29["catch"](1);
2135
- console.error('Failed to reset and load customers:', _context29.t0);
2136
- throw _context29.t0;
2454
+ _context36.prev = 9;
2455
+ _context36.t0 = _context36["catch"](1);
2456
+ console.error('Failed to reset and load customers:', _context36.t0);
2457
+ throw _context36.t0;
2137
2458
  case 13:
2138
2459
  case "end":
2139
- return _context29.stop();
2460
+ return _context36.stop();
2140
2461
  }
2141
- }, _callee29, this, [[1, 9]]);
2462
+ }, _callee36, this, [[1, 9]]);
2142
2463
  }));
2143
2464
  function resetAndLoadCustomers() {
2144
2465
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -2183,9 +2504,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2183
2504
  }, {
2184
2505
  key: "scanGlobalListener",
2185
2506
  value: function scanGlobalListener(callback) {
2186
- var _this6 = this;
2507
+ var _this7 = this;
2187
2508
  var localSearch = function localSearch(v) {
2188
- return _this6.store.products.findProductsByCodeOrBarcode(v);
2509
+ return _this7.store.products.findProductsByCodeOrBarcode(v);
2189
2510
  };
2190
2511
  var scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
2191
2512
  var safeCallback = function safeCallback(d) {
@@ -2299,16 +2620,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2299
2620
  }, {
2300
2621
  key: "getOtherParams",
2301
2622
  value: (function () {
2302
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2303
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2304
- while (1) switch (_context30.prev = _context30.next) {
2623
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
2624
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
2625
+ while (1) switch (_context37.prev = _context37.next) {
2305
2626
  case 0:
2306
- return _context30.abrupt("return", this.otherParams);
2627
+ return _context37.abrupt("return", this.otherParams);
2307
2628
  case 1:
2308
2629
  case "end":
2309
- return _context30.stop();
2630
+ return _context37.stop();
2310
2631
  }
2311
- }, _callee30, this);
2632
+ }, _callee37, this);
2312
2633
  }));
2313
2634
  function getOtherParams() {
2314
2635
  return _getOtherParams.apply(this, arguments);
@@ -2480,10 +2801,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2480
2801
  }, {
2481
2802
  key: "logSessionCatalogDateMismatch",
2482
2803
  value: function logSessionCatalogDateMismatch(item, bookingDate) {
2483
- var _this$getTempOrder, _tempOrder$order_id, _tempOrder$external_s, _item$cartDetailValue, _item$cartDetailValue2;
2804
+ var _this$getTempOrder3, _tempOrder$order_id, _tempOrder$external_s, _item$cartDetailValue, _item$cartDetailValue2;
2484
2805
  var logger = this.logger;
2485
2806
  if (!(logger !== null && logger !== void 0 && logger.addLog)) return;
2486
- var tempOrder = (_this$getTempOrder = this.getTempOrder) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.call(this);
2807
+ var tempOrder = (_this$getTempOrder3 = this.getTempOrder) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.call(this);
2487
2808
  var staleInfo = buildSessionCatalogStaleInfo(item, bookingDate);
2488
2809
  logger.addLog({
2489
2810
  type: 'warning',
@@ -2518,10 +2839,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2518
2839
  }, {
2519
2840
  key: "buildAddProductCtx",
2520
2841
  value: function buildAddProductCtx(extra) {
2521
- var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get5, _extra$presetStartTim2;
2842
+ var _extra$date2, _ref14, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get5, _extra$presetStartTim2;
2522
2843
  var bookingContextState = this.store.bookingContext.getState();
2523
2844
  var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
2524
- var orderCustomerId = (_ref12 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
2845
+ var orderCustomerId = (_ref14 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.customer_id) !== null && _ref14 !== void 0 ? _ref14 : undefined;
2525
2846
  return _objectSpread(_objectSpread({
2526
2847
  bookingConfig: bookingContextState.bookingConfig,
2527
2848
  resourcesOrigin: bookingContextState.resourcesOrigin,
@@ -2622,25 +2943,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2622
2943
  }, {
2623
2944
  key: "buildNormalProductCacheItemFromOrderLine",
2624
2945
  value: function buildNormalProductCacheItemFromOrderLine(input) {
2625
- return buildNormalProductCacheItemFromOrderLineUtil(input);
2946
+ var _input$holder_relatio, _this$store$order7;
2947
+ return buildNormalProductCacheItemFromOrderLineUtil(_objectSpread(_objectSpread({}, input), {}, {
2948
+ holder_relations: (_input$holder_relatio = input.holder_relations) !== null && _input$holder_relatio !== void 0 ? _input$holder_relatio : (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7 = _this$store$order7.getTempOrder()) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.holder_relations
2949
+ }));
2626
2950
  }
2627
2951
 
2628
2952
  /** 文档别名:与 OrderModule.updateOrderProduct 一致。 */
2629
2953
  }, {
2630
2954
  key: "updateProductInOrder",
2631
2955
  value: (function () {
2632
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
2633
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2634
- while (1) switch (_context31.prev = _context31.next) {
2956
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
2957
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
2958
+ while (1) switch (_context38.prev = _context38.next) {
2635
2959
  case 0:
2636
- return _context31.abrupt("return", this.updateOrderProduct(params));
2960
+ return _context38.abrupt("return", this.updateOrderProduct(params));
2637
2961
  case 1:
2638
2962
  case "end":
2639
- return _context31.stop();
2963
+ return _context38.stop();
2640
2964
  }
2641
- }, _callee31, this);
2965
+ }, _callee38, this);
2642
2966
  }));
2643
- function updateProductInOrder(_x20) {
2967
+ function updateProductInOrder(_x22) {
2644
2968
  return _updateProductInOrder.apply(this, arguments);
2645
2969
  }
2646
2970
  return updateProductInOrder;
@@ -2662,103 +2986,131 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2662
2986
  }, {
2663
2987
  key: "handleGlobalScanCode",
2664
2988
  value: (function () {
2665
- var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(code, bridge) {
2666
- var _this7 = this;
2667
- var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
2668
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2669
- while (1) switch (_context32.prev = _context32.next) {
2989
+ var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(code, bridge) {
2990
+ var _this8 = this;
2991
+ var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result8, _bridge$onNotify3;
2992
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
2993
+ while (1) switch (_context39.prev = _context39.next) {
2670
2994
  case 0:
2671
2995
  trimmed = typeof code === 'string' ? code.trim() : '';
2672
2996
  if (trimmed) {
2673
- _context32.next = 4;
2997
+ _context39.next = 4;
2674
2998
  break;
2675
2999
  }
2676
3000
  bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2677
- return _context32.abrupt("return", {
3001
+ return _context39.abrupt("return", {
2678
3002
  status: 'failed',
2679
3003
  reason: 'empty_code'
2680
3004
  });
2681
3005
  case 4:
2682
- _context32.prev = 4;
3006
+ _context39.prev = 4;
3007
+ // Capture before lookup/UI awaits, so a result cannot land in a new cart.
3008
+ // Unscoped POS Order modules return a no-op guard.
3009
+ beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
3010
+ beforeScanDialog = this.store.order.createCartIntentCommitGuard('add_product');
3011
+ guardCallback = function guardCallback(callback) {
3012
+ return callback ? function () {
3013
+ beforeScanCommit();
3014
+ return callback.apply(void 0, arguments);
3015
+ } : undefined;
3016
+ };
3017
+ guardedBridge = bridge ? _objectSpread(_objectSpread({}, bridge), {}, {
3018
+ confirmDetail: guardCallback(bridge.confirmDetail),
3019
+ confirmBookingEdit: guardCallback(bridge.confirmBookingEdit),
3020
+ applyPromotionCode: guardCallback(bridge.applyPromotionCode),
3021
+ openOrder: guardCallback(bridge.openOrder),
3022
+ requestCustomerSwitch: guardCallback(bridge.requestCustomerSwitch),
3023
+ openProductDetail: bridge.openProductDetail ? function (payload) {
3024
+ beforeScanDialog();
3025
+ return bridge.openProductDetail(payload);
3026
+ } : undefined,
3027
+ openBookingEdit: bridge.openBookingEdit ? function (payload) {
3028
+ beforeScanDialog();
3029
+ return bridge.openBookingEdit(payload);
3030
+ } : undefined
3031
+ }) : undefined;
2683
3032
  localSearch = function localSearch(v) {
2684
- return _this7.store.products.findProductsByCodeOrBarcode(v);
3033
+ return _this8.store.products.findProductsByCodeOrBarcode(v);
2685
3034
  };
2686
3035
  scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
2687
- _context32.next = 9;
3036
+ _context39.next = 13;
2688
3037
  return scanCallback({
2689
3038
  type: 'nativeScanner',
2690
3039
  value: trimmed
2691
3040
  });
2692
- case 9:
2693
- raw = _context32.sent;
3041
+ case 13:
3042
+ raw = _context39.sent;
2694
3043
  formatted = formatGlobalScanResult(raw, trimmed);
2695
3044
  if (formatted) {
2696
- _context32.next = 14;
3045
+ _context39.next = 18;
2697
3046
  break;
2698
3047
  }
2699
3048
  bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2700
- return _context32.abrupt("return", {
3049
+ return _context39.abrupt("return", {
2701
3050
  status: 'failed',
2702
3051
  reason: 'not_found'
2703
3052
  });
2704
- case 14:
2705
- _context32.next = 16;
3053
+ case 18:
3054
+ _context39.next = 20;
2706
3055
  return applyGlobalScan({
2707
3056
  setOrderCustomer: function setOrderCustomer(customer) {
2708
- return _this7.setOrderCustomer(customer);
3057
+ beforeScanCommit();
3058
+ _this8.setOrderCustomer(customer);
2709
3059
  },
2710
3060
  getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
2711
- return _this7.getOrderCustomerSnapshot();
3061
+ return _this8.getOrderCustomerSnapshot();
2712
3062
  },
2713
3063
  resolveCustomerById: function resolveCustomerById(customerId) {
2714
- return _this7.resolveCustomerById(customerId);
3064
+ return _this8.resolveCustomerById(customerId);
2715
3065
  },
2716
3066
  getBusinessCode: function getBusinessCode() {
2717
- var _this7$otherParams;
2718
- return (_this7$otherParams = _this7.otherParams) === null || _this7$otherParams === void 0 ? void 0 : _this7$otherParams.businessCode;
3067
+ var _this8$otherParams;
3068
+ return (_this8$otherParams = _this8.otherParams) === null || _this8$otherParams === void 0 ? void 0 : _this8$otherParams.businessCode;
2719
3069
  },
2720
3070
  buildAddProductCtx: function buildAddProductCtx(extra) {
2721
- return _this7.buildAddProductCtx(extra);
3071
+ return _this8.buildAddProductCtx(extra);
2722
3072
  },
2723
3073
  decideAddProduct: function decideAddProduct(item, options) {
2724
- return _this7.decideAddProduct(item, options);
3074
+ return _this8.decideAddProduct(item, options);
2725
3075
  },
2726
3076
  decideAfterDetail: function decideAfterDetail(cacheItem, options) {
2727
- return _this7.decideAfterDetail(cacheItem, options);
3077
+ return _this8.decideAfterDetail(cacheItem, options);
2728
3078
  },
2729
3079
  transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
2730
- return _this7.transformDetailToProductAndBooking(input);
3080
+ return _this8.transformDetailToProductAndBooking(input);
2731
3081
  },
2732
3082
  addProductToOrder: function addProductToOrder(product, booking) {
2733
- return _this7.addProductToOrder(product, booking);
3083
+ beforeScanCommit();
3084
+ return _this8.addProductToOrder(product, booking);
2734
3085
  },
2735
3086
  refreshWalletAssets: function refreshWalletAssets(params) {
2736
- return _this7.refreshWalletAssets(params);
3087
+ return _this8.refreshWalletAssets(params);
2737
3088
  },
2738
3089
  scanWalletAsset: function scanWalletAsset(scanCode) {
2739
- return _this7.scanWalletAsset(scanCode);
3090
+ beforeScanCommit();
3091
+ return _this8.scanWalletAsset(scanCode);
2740
3092
  }
2741
- }, formatted, bridge);
2742
- case 16:
2743
- _result7 = _context32.sent;
3093
+ }, formatted, guardedBridge);
3094
+ case 20:
3095
+ _result8 = _context39.sent;
2744
3096
  bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
2745
- return _context32.abrupt("return", _result7);
2746
- case 21:
2747
- _context32.prev = 21;
2748
- _context32.t0 = _context32["catch"](4);
2749
- console.error('[BookingTicket] handleGlobalScanCode failed', _context32.t0);
3097
+ return _context39.abrupt("return", _result8);
3098
+ case 25:
3099
+ _context39.prev = 25;
3100
+ _context39.t0 = _context39["catch"](4);
3101
+ console.error('[BookingTicket] handleGlobalScanCode failed', _context39.t0);
2750
3102
  bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2751
- return _context32.abrupt("return", {
3103
+ return _context39.abrupt("return", {
2752
3104
  status: 'failed',
2753
3105
  reason: 'not_found'
2754
3106
  });
2755
- case 26:
3107
+ case 30:
2756
3108
  case "end":
2757
- return _context32.stop();
3109
+ return _context39.stop();
2758
3110
  }
2759
- }, _callee32, this, [[4, 21]]);
3111
+ }, _callee39, this, [[4, 25]]);
2760
3112
  }));
2761
- function handleGlobalScanCode(_x21, _x22) {
3113
+ function handleGlobalScanCode(_x23, _x24) {
2762
3114
  return _handleGlobalScanCode.apply(this, arguments);
2763
3115
  }
2764
3116
  return handleGlobalScanCode;
@@ -2766,39 +3118,39 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2766
3118
  }, {
2767
3119
  key: "getGlobalScanCodeType",
2768
3120
  value: (function () {
2769
- var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(code) {
2770
- var _this8 = this,
3121
+ var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(code) {
3122
+ var _this9 = this,
2771
3123
  _formatGlobalScanResu,
2772
3124
  _formatGlobalScanResu2;
2773
3125
  var trimmed, scan, raw;
2774
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2775
- while (1) switch (_context33.prev = _context33.next) {
3126
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3127
+ while (1) switch (_context40.prev = _context40.next) {
2776
3128
  case 0:
2777
3129
  trimmed = typeof code === 'string' ? code.trim() : '';
2778
3130
  if (trimmed) {
2779
- _context33.next = 3;
3131
+ _context40.next = 3;
2780
3132
  break;
2781
3133
  }
2782
- return _context33.abrupt("return", null);
3134
+ return _context40.abrupt("return", null);
2783
3135
  case 3:
2784
3136
  scan = handleGlobalScan(this.request, function (value) {
2785
- return _this8.store.products.findProductsByCodeOrBarcode(value);
3137
+ return _this9.store.products.findProductsByCodeOrBarcode(value);
2786
3138
  }, this.getSubmitOrderSalesChannel());
2787
- _context33.next = 6;
3139
+ _context40.next = 6;
2788
3140
  return scan({
2789
3141
  type: 'nativeScanner',
2790
3142
  value: trimmed
2791
3143
  });
2792
3144
  case 6:
2793
- raw = _context33.sent;
2794
- return _context33.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
3145
+ raw = _context40.sent;
3146
+ return _context40.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
2795
3147
  case 8:
2796
3148
  case "end":
2797
- return _context33.stop();
3149
+ return _context40.stop();
2798
3150
  }
2799
- }, _callee33, this);
3151
+ }, _callee40, this);
2800
3152
  }));
2801
- function getGlobalScanCodeType(_x23) {
3153
+ function getGlobalScanCodeType(_x25) {
2802
3154
  return _getGlobalScanCodeType.apply(this, arguments);
2803
3155
  }
2804
3156
  return getGlobalScanCodeType;
@@ -2818,7 +3170,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2818
3170
  }, {
2819
3171
  key: "buildAddTimeOrderLine",
2820
3172
  value: function buildAddTimeOrderLine(input, bookingUid) {
2821
- var _input$num, _product$id, _product$product_id, _ref13, _product$product_vari, _ref14, _product$variant_id, _product$original_pri, _ref15, _ref16, _product$option, _product$product_sku, _ref17, _ref18, _product$bundle, _product$id2;
3173
+ var _input$num, _product$id, _product$product_id, _ref15, _product$product_vari, _ref16, _product$variant_id, _product$original_pri, _ref17, _ref18, _product$option, _product$product_sku, _ref19, _ref20, _product$bundle, _product$id2;
2822
3174
  var product = input === null || input === void 0 ? void 0 : input.product;
2823
3175
  if (!product || _typeof(product) !== 'object') {
2824
3176
  throw new Error('[BookingTicket] addAddTimeProductToBooking: product 不能为空');
@@ -2829,8 +3181,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2829
3181
  var payload = {
2830
3182
  id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id,
2831
3183
  product_id: (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id,
2832
- product_variant_id: (_ref13 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product.variant_id) !== null && _ref13 !== void 0 ? _ref13 : 0,
2833
- variant_id: (_ref14 = (_product$variant_id = product.variant_id) !== null && _product$variant_id !== void 0 ? _product$variant_id : product.product_variant_id) !== null && _ref14 !== void 0 ? _ref14 : 0,
3184
+ product_variant_id: (_ref15 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product.variant_id) !== null && _ref15 !== void 0 ? _ref15 : 0,
3185
+ variant_id: (_ref16 = (_product$variant_id = product.variant_id) !== null && _product$variant_id !== void 0 ? _product$variant_id : product.product_variant_id) !== null && _ref16 !== void 0 ? _ref16 : 0,
2834
3186
  quantity: quantity,
2835
3187
  num: quantity,
2836
3188
  price: price,
@@ -2839,8 +3191,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2839
3191
  line_total: price,
2840
3192
  total: price,
2841
3193
  product_sku: product.product_sku,
2842
- option: (_ref15 = (_ref16 = (_product$option = product.option) !== null && _product$option !== void 0 ? _product$option : product.options) !== null && _ref16 !== void 0 ? _ref16 : (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option) !== null && _ref15 !== void 0 ? _ref15 : [],
2843
- bundle: (_ref17 = (_ref18 = (_product$bundle = product.bundle) !== null && _product$bundle !== void 0 ? _product$bundle : product.bundles) !== null && _ref18 !== void 0 ? _ref18 : product.product_bundle) !== null && _ref17 !== void 0 ? _ref17 : []
3194
+ option: (_ref17 = (_ref18 = (_product$option = product.option) !== null && _product$option !== void 0 ? _product$option : product.options) !== null && _ref18 !== void 0 ? _ref18 : (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option) !== null && _ref17 !== void 0 ? _ref17 : [],
3195
+ bundle: (_ref19 = (_ref20 = (_product$bundle = product.bundle) !== null && _product$bundle !== void 0 ? _product$bundle : product.bundles) !== null && _ref20 !== void 0 ? _ref20 : product.product_bundle) !== null && _ref19 !== void 0 ? _ref19 : []
2844
3196
  };
2845
3197
  var orderLine = this.transformBaseProductToOrderProduct({
2846
3198
  payload: payload,
@@ -2880,11 +3232,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2880
3232
  }, {
2881
3233
  key: "addAddTimeProductToBooking",
2882
3234
  value: (function () {
2883
- var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(input) {
2884
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2885
- while (1) switch (_context34.prev = _context34.next) {
3235
+ var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(input) {
3236
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3237
+ while (1) switch (_context41.prev = _context41.next) {
2886
3238
  case 0:
2887
- return _context34.abrupt("return", this.addAddTimeProductsToBooking({
3239
+ return _context41.abrupt("return", this.addAddTimeProductsToBooking({
2888
3240
  booking: input.booking,
2889
3241
  products: [input],
2890
3242
  coveredMinutes: input.coveredMinutes,
@@ -2892,11 +3244,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2892
3244
  }));
2893
3245
  case 1:
2894
3246
  case "end":
2895
- return _context34.stop();
3247
+ return _context41.stop();
2896
3248
  }
2897
- }, _callee34, this);
3249
+ }, _callee41, this);
2898
3250
  }));
2899
- function addAddTimeProductToBooking(_x24) {
3251
+ function addAddTimeProductToBooking(_x26) {
2900
3252
  return _addAddTimeProductToBooking.apply(this, arguments);
2901
3253
  }
2902
3254
  return addAddTimeProductToBooking;
@@ -2914,27 +3266,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2914
3266
  }, {
2915
3267
  key: "addAddTimeProductsToBooking",
2916
3268
  value: (function () {
2917
- var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(input) {
2918
- var _this9 = this,
3269
+ var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(input) {
3270
+ var _this10 = this,
2919
3271
  _input$bookingPatch;
2920
3272
  var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
2921
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2922
- while (1) switch (_context35.prev = _context35.next) {
3273
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3274
+ while (1) switch (_context42.prev = _context42.next) {
2923
3275
  case 0:
2924
3276
  bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
2925
3277
  if (bookingUid) {
2926
- _context35.next = 3;
3278
+ _context42.next = 3;
2927
3279
  break;
2928
3280
  }
2929
3281
  throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
2930
3282
  case 3:
2931
3283
  orderLines = (input.products || []).map(function (line) {
2932
3284
  return {
2933
- product: _this9.buildAddTimeOrderLine(line, bookingUid)
3285
+ product: _this10.buildAddTimeOrderLine(line, bookingUid)
2934
3286
  };
2935
3287
  });
2936
3288
  if (this.store.order) {
2937
- _context35.next = 6;
3289
+ _context42.next = 6;
2938
3290
  break;
2939
3291
  }
2940
3292
  throw new Error('order 模块未初始化');
@@ -2948,55 +3300,55 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2948
3300
  });
2949
3301
  }
2950
3302
  if (!(typeof this.store.order.addProductsToOrder === 'function')) {
2951
- _context35.next = 11;
3303
+ _context42.next = 11;
2952
3304
  break;
2953
3305
  }
2954
- return _context35.abrupt("return", this.store.order.addProductsToOrder(orderLines));
3306
+ return _context42.abrupt("return", this.store.order.addProductsToOrder(orderLines));
2955
3307
  case 11:
2956
3308
  result = [];
2957
3309
  _iterator2 = _createForOfIteratorHelper(orderLines);
2958
- _context35.prev = 13;
3310
+ _context42.prev = 13;
2959
3311
  _iterator2.s();
2960
3312
  case 15:
2961
3313
  if ((_step2 = _iterator2.n()).done) {
2962
- _context35.next = 29;
3314
+ _context42.next = 29;
2963
3315
  break;
2964
3316
  }
2965
3317
  line = _step2.value;
2966
- _context35.t0 = result.splice;
2967
- _context35.t1 = result;
2968
- _context35.t2 = [0, result.length];
2969
- _context35.t3 = _toConsumableArray;
2970
- _context35.next = 23;
3318
+ _context42.t0 = result.splice;
3319
+ _context42.t1 = result;
3320
+ _context42.t2 = [0, result.length];
3321
+ _context42.t3 = _toConsumableArray;
3322
+ _context42.next = 23;
2971
3323
  return this.addProductToOrder(line.product);
2972
3324
  case 23:
2973
- _context35.t4 = _context35.sent;
2974
- _context35.t5 = (0, _context35.t3)(_context35.t4);
2975
- _context35.t6 = _context35.t2.concat.call(_context35.t2, _context35.t5);
2976
- _context35.t0.apply.call(_context35.t0, _context35.t1, _context35.t6);
3325
+ _context42.t4 = _context42.sent;
3326
+ _context42.t5 = (0, _context42.t3)(_context42.t4);
3327
+ _context42.t6 = _context42.t2.concat.call(_context42.t2, _context42.t5);
3328
+ _context42.t0.apply.call(_context42.t0, _context42.t1, _context42.t6);
2977
3329
  case 27:
2978
- _context35.next = 15;
3330
+ _context42.next = 15;
2979
3331
  break;
2980
3332
  case 29:
2981
- _context35.next = 34;
3333
+ _context42.next = 34;
2982
3334
  break;
2983
3335
  case 31:
2984
- _context35.prev = 31;
2985
- _context35.t7 = _context35["catch"](13);
2986
- _iterator2.e(_context35.t7);
3336
+ _context42.prev = 31;
3337
+ _context42.t7 = _context42["catch"](13);
3338
+ _iterator2.e(_context42.t7);
2987
3339
  case 34:
2988
- _context35.prev = 34;
3340
+ _context42.prev = 34;
2989
3341
  _iterator2.f();
2990
- return _context35.finish(34);
3342
+ return _context42.finish(34);
2991
3343
  case 37:
2992
- return _context35.abrupt("return", result);
3344
+ return _context42.abrupt("return", result);
2993
3345
  case 38:
2994
3346
  case "end":
2995
- return _context35.stop();
3347
+ return _context42.stop();
2996
3348
  }
2997
- }, _callee35, this, [[13, 31, 34, 37]]);
3349
+ }, _callee42, this, [[13, 31, 34, 37]]);
2998
3350
  }));
2999
- function addAddTimeProductsToBooking(_x25) {
3351
+ function addAddTimeProductsToBooking(_x27) {
3000
3352
  return _addAddTimeProductsToBooking.apply(this, arguments);
3001
3353
  }
3002
3354
  return addAddTimeProductsToBooking;
@@ -3004,42 +3356,49 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3004
3356
  }, {
3005
3357
  key: "setOtherParams",
3006
3358
  value: function () {
3007
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
3008
- var _ref19,
3009
- _ref19$cover,
3359
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
3360
+ var _this11 = this;
3361
+ var _ref21,
3362
+ _ref21$cover,
3010
3363
  cover,
3364
+ nextParams,
3011
3365
  invoiceContextChanged,
3012
- _args36 = arguments;
3013
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3014
- while (1) switch (_context36.prev = _context36.next) {
3366
+ _args43 = arguments;
3367
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3368
+ while (1) switch (_context43.prev = _context43.next) {
3015
3369
  case 0:
3016
- _ref19 = _args36.length > 1 && _args36[1] !== undefined ? _args36[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
3017
- _context36.next = 3;
3370
+ _ref21 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref21$cover = _ref21.cover, cover = _ref21$cover === void 0 ? false : _ref21$cover;
3371
+ nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
3372
+ if (['businessCode', 'business_code', 'channel', 'platform', 'shop_id', 'tenantId', 'cacheId'].some(function (key) {
3373
+ var _this11$otherParams;
3374
+ return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams[key]);
3375
+ })) this.orderCustomerContactRequest = null;
3376
+ _context43.next = 5;
3018
3377
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
3019
3378
  cover: cover
3020
3379
  });
3021
- case 3:
3380
+ case 5:
3022
3381
  invoiceContextChanged = (params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || (params === null || params === void 0 ? void 0 : params.channel) !== undefined || (params === null || params === void 0 ? void 0 : params.platform) !== undefined || Object.prototype.hasOwnProperty.call(params, 'openData');
3023
3382
  if (!invoiceContextChanged) {
3024
- _context36.next = 7;
3383
+ _context43.next = 9;
3025
3384
  break;
3026
3385
  }
3027
- _context36.next = 7;
3386
+ _context43.next = 9;
3028
3387
  return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
3029
- case 7:
3388
+ case 9:
3030
3389
  if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
3031
- _context36.next = 10;
3390
+ _context43.next = 12;
3032
3391
  break;
3033
3392
  }
3034
- _context36.next = 10;
3393
+ _context43.next = 12;
3035
3394
  return this.configureIdGeneratorFromOpenData();
3036
- case 10:
3395
+ case 12:
3037
3396
  case "end":
3038
- return _context36.stop();
3397
+ return _context43.stop();
3039
3398
  }
3040
- }, _callee36, this);
3399
+ }, _callee43, this);
3041
3400
  }));
3042
- function setOtherParams(_x26) {
3401
+ function setOtherParams(_x28) {
3043
3402
  return _setOtherParams.apply(this, arguments);
3044
3403
  }
3045
3404
  return setOtherParams;
@@ -3056,15 +3415,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3056
3415
  }, {
3057
3416
  key: "handlePrintWristband",
3058
3417
  value: function () {
3059
- var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
3418
+ var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
3060
3419
  var _this$getOrderIdentit2;
3061
3420
  var deviceTask, deviceId, idempotencyKey;
3062
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3063
- while (1) switch (_context37.prev = _context37.next) {
3421
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3422
+ while (1) switch (_context44.prev = _context44.next) {
3064
3423
  case 0:
3065
3424
  deviceTask = this.getDeviceTaskPlugin();
3066
3425
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
3067
- _context37.next = 4;
3426
+ _context44.next = 4;
3068
3427
  break;
3069
3428
  }
3070
3429
  this.logger.addLog({
@@ -3074,7 +3433,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3074
3433
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3075
3434
  }
3076
3435
  });
3077
- return _context37.abrupt("return");
3436
+ return _context44.abrupt("return");
3078
3437
  case 4:
3079
3438
  this.logger.addLog({
3080
3439
  type: 'info',
@@ -3083,10 +3442,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3083
3442
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3084
3443
  }
3085
3444
  });
3086
- _context37.next = 7;
3445
+ _context44.next = 7;
3087
3446
  return this.getShortNumberOrDeviceId();
3088
3447
  case 7:
3089
- deviceId = _context37.sent;
3448
+ deviceId = _context44.sent;
3090
3449
  idempotencyKey = createUuidV4();
3091
3450
  deviceTask.dispatch({
3092
3451
  action: 'print_all',
@@ -3106,11 +3465,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3106
3465
  });
3107
3466
  case 10:
3108
3467
  case "end":
3109
- return _context37.stop();
3468
+ return _context44.stop();
3110
3469
  }
3111
- }, _callee37, this);
3470
+ }, _callee44, this);
3112
3471
  }));
3113
- function handlePrintWristband(_x27) {
3472
+ function handlePrintWristband(_x29) {
3114
3473
  return _handlePrintWristband.apply(this, arguments);
3115
3474
  }
3116
3475
  return handlePrintWristband;
@@ -3118,11 +3477,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3118
3477
  }, {
3119
3478
  key: "handleRedeem",
3120
3479
  value: function () {
3121
- var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
3122
- var _this$store$order7, _this$store$order7$ge, _this$store$order8, _ref20, _tempOrder$order_id2;
3480
+ var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
3481
+ var _this$store$order8, _this$store$order8$ge, _this$store$order9, _ref22, _tempOrder$order_id2;
3123
3482
  var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
3124
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3125
- while (1) switch (_context38.prev = _context38.next) {
3483
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3484
+ while (1) switch (_context45.prev = _context45.next) {
3126
3485
  case 0:
3127
3486
  voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
3128
3487
  status = params.is_checkin ? 'used' : 'unused';
@@ -3135,8 +3494,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3135
3494
  }
3136
3495
  });
3137
3496
  voucherIdSet = new Set(voucherIds);
3138
- tempOrder = (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getTempOrder) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7);
3139
- vouchers = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.vouchers) || ((_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 ? void 0 : _this$store$order8.getVouchers()) || [];
3497
+ tempOrder = (_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || (_this$store$order8$ge = _this$store$order8.getTempOrder) === null || _this$store$order8$ge === void 0 ? void 0 : _this$store$order8$ge.call(_this$store$order8);
3498
+ vouchers = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.vouchers) || ((_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 ? void 0 : _this$store$order9.getVouchers()) || [];
3140
3499
  hasUpdatedVoucher = false;
3141
3500
  nextVouchers = vouchers.map(function (voucher) {
3142
3501
  if (!voucherIdSet.has(voucher.voucher_id)) return voucher;
@@ -3146,20 +3505,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3146
3505
  });
3147
3506
  });
3148
3507
  if (!(tempOrder && hasUpdatedVoucher)) {
3149
- _context38.next = 11;
3508
+ _context45.next = 11;
3150
3509
  break;
3151
3510
  }
3152
- _context38.next = 11;
3511
+ _context45.next = 11;
3153
3512
  return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
3154
3513
  vouchers: nextVouchers
3155
3514
  }));
3156
3515
  case 11:
3157
3516
  this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
3158
3517
  if (!(voucherIds.length === 0)) {
3159
- _context38.next = 14;
3518
+ _context45.next = 14;
3160
3519
  break;
3161
3520
  }
3162
- return _context38.abrupt("return", {
3521
+ return _context45.abrupt("return", {
3163
3522
  code: 200,
3164
3523
  status: true,
3165
3524
  message: '',
@@ -3168,9 +3527,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3168
3527
  case 14:
3169
3528
  identity = this.getOrderIdentity();
3170
3529
  externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
3171
- orderId = (_ref20 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref20 !== void 0 ? _ref20 : undefined;
3530
+ orderId = (_ref22 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref22 !== void 0 ? _ref22 : undefined;
3172
3531
  orderLookup = externalSaleNumber || orderId || (identity === null || identity === void 0 ? void 0 : identity.orderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopFullOrderNumber) || undefined;
3173
- return _context38.abrupt("return", this.request.post('/machinecode/batch', {
3532
+ return _context45.abrupt("return", this.request.post('/machinecode/batch', {
3174
3533
  ids: voucherIds,
3175
3534
  status: status,
3176
3535
  order_lookup: orderLookup,
@@ -3181,11 +3540,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3181
3540
  }));
3182
3541
  case 19:
3183
3542
  case "end":
3184
- return _context38.stop();
3543
+ return _context45.stop();
3185
3544
  }
3186
- }, _callee38, this);
3545
+ }, _callee45, this);
3187
3546
  }));
3188
- function handleRedeem(_x28) {
3547
+ function handleRedeem(_x30) {
3189
3548
  return _handleRedeem.apply(this, arguments);
3190
3549
  }
3191
3550
  return handleRedeem;
@@ -3197,25 +3556,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3197
3556
  }, {
3198
3557
  key: "destroy",
3199
3558
  value: (function () {
3200
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3559
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
3201
3560
  var _this$scan;
3202
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3203
- while (1) switch (_context39.prev = _context39.next) {
3561
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
3562
+ while (1) switch (_context46.prev = _context46.next) {
3204
3563
  case 0:
3205
- _context39.next = 2;
3564
+ this.orderCustomerContactRequest = null;
3565
+ _context46.next = 3;
3206
3566
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
3207
- case 2:
3567
+ case 3:
3208
3568
  try {
3209
3569
  (_this$scan = this.scan) === null || _this$scan === void 0 || _this$scan.removeAllListeners();
3210
3570
  } catch (error) {
3211
3571
  console.warn('[BookingTicket] scan removeAllListeners 失败', error);
3212
3572
  }
3213
3573
  scanCache.clear();
3214
- case 4:
3574
+ case 5:
3215
3575
  case "end":
3216
- return _context39.stop();
3576
+ return _context46.stop();
3217
3577
  }
3218
- }, _callee39, this);
3578
+ }, _callee46, this);
3219
3579
  }));
3220
3580
  function destroy() {
3221
3581
  return _destroy.apply(this, arguments);