@pisell/pisellos 2.2.233 → 2.2.235

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 (48) hide show
  1. package/dist/modules/Order/index.d.ts +36 -1
  2. package/dist/modules/Order/index.js +496 -308
  3. package/dist/modules/Order/types.d.ts +11 -0
  4. package/dist/modules/Order/utils.d.ts +1 -0
  5. package/dist/modules/Order/utils.js +1 -1
  6. package/dist/server/index.d.ts +5 -0
  7. package/dist/server/index.js +855 -633
  8. package/dist/server/modules/order/index.d.ts +2 -0
  9. package/dist/server/modules/order/index.js +86 -32
  10. package/dist/solution/BaseSales/index.d.ts +6 -0
  11. package/dist/solution/BaseSales/index.js +240 -197
  12. package/dist/solution/BookingByStep/index.d.ts +1 -1
  13. package/dist/solution/BookingTicket/index.d.ts +40 -1
  14. package/dist/solution/BookingTicket/index.js +674 -314
  15. package/dist/solution/BookingTicket/types.d.ts +62 -0
  16. package/dist/solution/BookingTicket/types.js +30 -0
  17. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  18. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  19. package/dist/solution/BookingTicket/utils/cartView.d.ts +9 -1
  20. package/dist/solution/BookingTicket/utils/cartView.js +76 -5
  21. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  22. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  23. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +9 -13
  24. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +42 -33
  25. package/lib/modules/Order/index.d.ts +36 -1
  26. package/lib/modules/Order/index.js +98 -10
  27. package/lib/modules/Order/types.d.ts +11 -0
  28. package/lib/modules/Order/utils.d.ts +1 -0
  29. package/lib/modules/Order/utils.js +1 -1
  30. package/lib/server/index.d.ts +5 -0
  31. package/lib/server/index.js +224 -63
  32. package/lib/server/modules/order/index.d.ts +2 -0
  33. package/lib/server/modules/order/index.js +43 -1
  34. package/lib/solution/BaseSales/index.d.ts +6 -0
  35. package/lib/solution/BaseSales/index.js +20 -1
  36. package/lib/solution/BookingByStep/index.d.ts +1 -1
  37. package/lib/solution/BookingTicket/index.d.ts +40 -1
  38. package/lib/solution/BookingTicket/index.js +201 -4
  39. package/lib/solution/BookingTicket/types.d.ts +62 -0
  40. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  41. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
  42. package/lib/solution/BookingTicket/utils/cartView.d.ts +9 -1
  43. package/lib/solution/BookingTicket/utils/cartView.js +48 -2
  44. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  45. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  46. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +9 -13
  47. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +41 -28
  48. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  var _excluded = ["id"],
2
2
  _excluded2 = ["product_id"],
3
3
  _excluded3 = ["product_id"];
4
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
5
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
6
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
7
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -30,6 +31,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
30
31
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
32
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
32
33
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
34
+ import dayjs from 'dayjs';
33
35
  import { createBookingTicketModule } from "./types";
34
36
  import { getProductExtend as getProductExtendUtil, getResourceByIds as getResourceByIdsUtil, getResourceErrors as getResourceErrorsUtil, derivePresetStartTimeFromDate } from "../../modules/BookingContext";
35
37
  import { BaseSalesImpl } from "../BaseSales";
@@ -49,6 +51,98 @@ import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolv
49
51
  import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resolveBestAddTimePlan";
50
52
  var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
51
53
  var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
54
+
55
+ /**
56
+ * 读取已有 booking 的协议唯一值,用于加时商品行绑定原预约。
57
+ *
58
+ * @example
59
+ * const bookingUid = resolveBookingUidForAddTime(booking);
60
+ */
61
+ function resolveBookingUidForAddTime(booking) {
62
+ var _booking$metadata;
63
+ var uid = booking === null || booking === void 0 || (_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.unique_identification_number;
64
+ return uid === undefined || uid === null ? '' : String(uid);
65
+ }
66
+
67
+ /**
68
+ * 规范化加车数量,避免非法值进入 OrderModule。
69
+ *
70
+ * @example
71
+ * const quantity = normalizeAddTimeQuantity(product.num);
72
+ */
73
+ function normalizeAddTimeQuantity(value) {
74
+ var parsed = Math.floor(Number(value));
75
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : 1;
76
+ }
77
+
78
+ /**
79
+ * 解析加时时长,优先使用显式入参,其次回退商品字段。
80
+ *
81
+ * @example
82
+ * const minutes = resolveAddTimeScheduleMinutes(input.product_add_schedule_time, product);
83
+ */
84
+ function resolveAddTimeScheduleMinutes(explicitValue, product) {
85
+ var raw = explicitValue !== null && explicitValue !== void 0 ? explicitValue : product === null || product === void 0 ? void 0 : product.product_add_schedule_time;
86
+ if (raw === undefined || raw === null || raw === '') return undefined;
87
+ var parsed = Number(raw);
88
+ return Number.isFinite(parsed) ? parsed : undefined;
89
+ }
90
+
91
+ /**
92
+ * 计算加时商品行价格字段,保持 `price` 与 `selling_price` 输入口径一致。
93
+ *
94
+ * @example
95
+ * const price = resolveAddTimeProductPrice(input.price, product);
96
+ */
97
+ function resolveAddTimeProductPrice(explicitValue, product) {
98
+ var _ref, _ref2;
99
+ return (_ref = (_ref2 = explicitValue !== null && explicitValue !== void 0 ? explicitValue : product === null || product === void 0 ? void 0 : product.price) !== null && _ref2 !== void 0 ? _ref2 : product === null || product === void 0 ? void 0 : product.selling_price) !== null && _ref !== void 0 ? _ref : product === null || product === void 0 ? void 0 : product.base_price;
100
+ }
101
+
102
+ /**
103
+ * 规范化加时覆盖分钟数。
104
+ *
105
+ * @example
106
+ * const minutes = normalizeCoveredMinutes(input.coveredMinutes);
107
+ */
108
+ function normalizeCoveredMinutes(value) {
109
+ var parsed = Math.ceil(Number(value));
110
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
111
+ }
112
+
113
+ /**
114
+ * 计算 booking 加时后的结束时间与时长。
115
+ *
116
+ * @example
117
+ * const updates = buildAddTimeBookingTimePatch(booking, 30);
118
+ */
119
+ function buildAddTimeBookingTimePatch(booking, coveredMinutes) {
120
+ if (coveredMinutes <= 0) return null;
121
+ var endDate = booking === null || booking === void 0 ? void 0 : booking.end_date;
122
+ var endTime = booking === null || booking === void 0 ? void 0 : booking.end_time;
123
+ if (!endDate || !endTime) {
124
+ throw new Error('[BookingTicket] addAddTimeProductsToBooking: booking.end_date/end_time 缺失');
125
+ }
126
+ var currentEnd = dayjs("".concat(endDate, " ").concat(endTime));
127
+ if (!currentEnd.isValid()) {
128
+ throw new Error('[BookingTicket] addAddTimeProductsToBooking: booking.end_date/end_time 无效');
129
+ }
130
+ var nextEnd = currentEnd.add(coveredMinutes, 'minute');
131
+ var currentDuration = Number(booking === null || booking === void 0 ? void 0 : booking.duration);
132
+ var duration = Number.isFinite(currentDuration) ? currentDuration + coveredMinutes : coveredMinutes;
133
+ if (booking !== null && booking !== void 0 && booking.start_date && booking !== null && booking !== void 0 && booking.start_time) {
134
+ var start = dayjs("".concat(booking.start_date, " ").concat(booking.start_time));
135
+ if (start.isValid()) {
136
+ var diffMinutes = nextEnd.diff(start, 'minute');
137
+ duration = diffMinutes > 0 ? diffMinutes : duration;
138
+ }
139
+ }
140
+ return {
141
+ end_date: nextEnd.format('YYYY-MM-DD'),
142
+ end_time: nextEnd.format('HH:mm'),
143
+ duration: duration
144
+ };
145
+ }
52
146
  function withProductOptionString(cacheItem) {
53
147
  var _cacheItem$_extend;
54
148
  var productOptionString = buildProductOptionStringFromOrderLine(cacheItem);
@@ -80,6 +174,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
80
174
  _defineProperty(_assertThisInitialized(_this), "platform", void 0);
81
175
  _defineProperty(_assertThisInitialized(_this), "scan", void 0);
82
176
  _defineProperty(_assertThisInitialized(_this), "productCatalog", []);
177
+ _defineProperty(_assertThisInitialized(_this), "addTimeProductsCatalog", []);
83
178
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
84
179
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
85
180
  _defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
@@ -187,7 +282,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
187
282
  _context2.next = 6;
188
283
  break;
189
284
  }
190
- console.warn('[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载');
285
+ console.warn('[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载,当前 module name: ', this.name);
191
286
  return _context2.abrupt("return", null);
192
287
  case 6:
193
288
  lastFetchedAt = this.store.openData.getLastFetchedAt();
@@ -238,34 +333,54 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
238
333
  return loadOpenDataConfig;
239
334
  }()
240
335
  }, {
241
- key: "getShortNumberOrDeviceId",
336
+ key: "getOpenData",
242
337
  value: function () {
243
- var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
244
- var getAsyncIotDeviceInfo, res;
338
+ var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
339
+ var _this$store$openData;
245
340
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
246
341
  while (1) switch (_context3.prev = _context3.next) {
342
+ case 0:
343
+ return _context3.abrupt("return", (_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 ? void 0 : _this$store$openData.getOpenData());
344
+ case 1:
345
+ case "end":
346
+ return _context3.stop();
347
+ }
348
+ }, _callee3, this);
349
+ }));
350
+ function getOpenData() {
351
+ return _getOpenData.apply(this, arguments);
352
+ }
353
+ return getOpenData;
354
+ }()
355
+ }, {
356
+ key: "getShortNumberOrDeviceId",
357
+ value: function () {
358
+ var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
359
+ var getAsyncIotDeviceInfo, res;
360
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
361
+ while (1) switch (_context4.prev = _context4.next) {
247
362
  case 0:
248
363
  getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
249
364
  if (!getAsyncIotDeviceInfo) {
250
- _context3.next = 7;
365
+ _context4.next = 7;
251
366
  break;
252
367
  }
253
- _context3.next = 4;
368
+ _context4.next = 4;
254
369
  return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
255
370
  case 4:
256
- res = _context3.sent;
371
+ res = _context4.sent;
257
372
  if (!(res !== null && res !== void 0 && res.short_number)) {
258
- _context3.next = 7;
373
+ _context4.next = 7;
259
374
  break;
260
375
  }
261
- return _context3.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
376
+ return _context4.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
262
377
  case 7:
263
- return _context3.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
378
+ return _context4.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
264
379
  case 8:
265
380
  case "end":
266
- return _context3.stop();
381
+ return _context4.stop();
267
382
  }
268
- }, _callee3, this);
383
+ }, _callee4, this);
269
384
  }));
270
385
  function getShortNumberOrDeviceId() {
271
386
  return _getShortNumberOrDeviceId.apply(this, arguments);
@@ -275,34 +390,34 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
275
390
  }, {
276
391
  key: "configureIdGeneratorFromOpenData",
277
392
  value: function () {
278
- var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
393
+ var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
279
394
  var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
280
395
  var openDataConfig, idGenerator, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId;
281
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
282
- while (1) switch (_context4.prev = _context4.next) {
396
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
397
+ while (1) switch (_context5.prev = _context5.next) {
283
398
  case 0:
284
399
  openDataConfig = null;
285
- _context4.prev = 1;
286
- _context4.next = 4;
400
+ _context5.prev = 1;
401
+ _context5.next = 4;
287
402
  return this.loadOpenDataConfig();
288
403
  case 4:
289
- openDataConfig = _context4.sent;
290
- _context4.next = 11;
404
+ openDataConfig = _context5.sent;
405
+ _context5.next = 11;
291
406
  break;
292
407
  case 7:
293
- _context4.prev = 7;
294
- _context4.t0 = _context4["catch"](1);
295
- console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context4.t0);
296
- return _context4.abrupt("return");
408
+ _context5.prev = 7;
409
+ _context5.t0 = _context5["catch"](1);
410
+ console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
411
+ return _context5.abrupt("return");
297
412
  case 11:
298
413
  // if (!openDataConfig) return;
299
414
  idGenerator = this.getIdGeneratorPlugin();
300
415
  if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
301
- _context4.next = 15;
416
+ _context5.next = 15;
302
417
  break;
303
418
  }
304
419
  console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
305
- return _context4.abrupt("return");
420
+ return _context5.abrupt("return");
306
421
  case 15:
307
422
  receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
308
423
  receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
@@ -310,12 +425,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
310
425
  shopOrderPrefix = this.normalizeIdPrefix((_openDataConfig4 = openDataConfig) === null || _openDataConfig4 === void 0 ? void 0 : _openDataConfig4['sale.sale_number_prefix'], '');
311
426
  resetReceiptSequenceDaily = typeof ((_openDataConfig5 = openDataConfig) === null || _openDataConfig5 === void 0 ? void 0 : _openDataConfig5['sale.short_number_daily_reset']) === 'boolean' ? (_openDataConfig6 = openDataConfig) === null || _openDataConfig6 === void 0 ? void 0 : _openDataConfig6['sale.short_number_daily_reset'] : false;
312
427
  operatingDayBoundary = this.getAppData('operating_day_boundary');
313
- _context4.next = 23;
428
+ _context5.next = 23;
314
429
  return this.getShortNumberOrDeviceId();
315
430
  case 23:
316
- deviceId = _context4.sent;
317
- _context4.prev = 24;
318
- _context4.next = 27;
431
+ deviceId = _context5.sent;
432
+ _context5.prev = 24;
433
+ _context5.next = 27;
319
434
  return idGenerator.configure({
320
435
  biz: this.getBookingTicketBusinessCode() || 'ticket',
321
436
  config: {
@@ -331,17 +446,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
331
446
  }
332
447
  });
333
448
  case 27:
334
- _context4.next = 32;
449
+ _context5.next = 32;
335
450
  break;
336
451
  case 29:
337
- _context4.prev = 29;
338
- _context4.t1 = _context4["catch"](24);
339
- console.warn('[BookingTicket] idGenerator 配置失败', _context4.t1);
452
+ _context5.prev = 29;
453
+ _context5.t1 = _context5["catch"](24);
454
+ console.warn('[BookingTicket] idGenerator 配置失败', _context5.t1);
340
455
  case 32:
341
456
  case "end":
342
- return _context4.stop();
457
+ return _context5.stop();
343
458
  }
344
- }, _callee4, this, [[1, 7], [24, 29]]);
459
+ }, _callee5, this, [[1, 7], [24, 29]]);
345
460
  }));
346
461
  function configureIdGeneratorFromOpenData() {
347
462
  return _configureIdGeneratorFromOpenData.apply(this, arguments);
@@ -373,17 +488,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
373
488
  }, {
374
489
  key: "loadSalesDetail",
375
490
  value: (function () {
376
- var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(orderIdOrParams) {
377
- var _ref;
378
- var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref2, detailCustomerId, detailCustomerRest, rawId, customer;
379
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
380
- while (1) switch (_context5.prev = _context5.next) {
491
+ var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(orderIdOrParams) {
492
+ var _ref3;
493
+ var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref4, detailCustomerId, detailCustomerRest, rawId, customer;
494
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
495
+ while (1) switch (_context6.prev = _context6.next) {
381
496
  case 0:
382
497
  debugger;
383
- _context5.next = 3;
498
+ _context6.next = 3;
384
499
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
385
500
  case 3:
386
- sales = _context5.sent;
501
+ sales = _context6.sent;
387
502
  customerModule = this.store.customer;
388
503
  detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
389
504
  orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
@@ -395,9 +510,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
395
510
  email: sales === null || sales === void 0 ? void 0 : sales.email,
396
511
  country_calling_code: sales === null || sales === void 0 ? void 0 : sales.country_calling_code
397
512
  } : null;
398
- selectedCustomer = (_ref = detailCustomer !== null && detailCustomer !== void 0 ? detailCustomer : orderCustomerSnapshot) !== null && _ref !== void 0 ? _ref : protocolCustomer;
513
+ selectedCustomer = (_ref3 = detailCustomer !== null && detailCustomer !== void 0 ? detailCustomer : orderCustomerSnapshot) !== null && _ref3 !== void 0 ? _ref3 : protocolCustomer;
399
514
  if (customerModule && selectedCustomer) {
400
- _ref2 = selectedCustomer !== null && selectedCustomer !== void 0 ? selectedCustomer : {}, detailCustomerId = _ref2.id, detailCustomerRest = _objectWithoutProperties(_ref2, _excluded);
515
+ _ref4 = selectedCustomer !== null && selectedCustomer !== void 0 ? selectedCustomer : {}, detailCustomerId = _ref4.id, detailCustomerRest = _objectWithoutProperties(_ref4, _excluded);
401
516
  rawId = detailCustomerId !== null && detailCustomerId !== void 0 ? detailCustomerId : '';
402
517
  customer = _objectSpread(_objectSpread({}, detailCustomerRest), {}, {
403
518
  id: rawId == null ? '' : rawId,
@@ -410,12 +525,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
410
525
  this.setOrderCustomer(customer);
411
526
  // await this.store.order.saveDraft();
412
527
  }
413
- return _context5.abrupt("return", sales);
528
+ return _context6.abrupt("return", sales);
414
529
  case 12:
415
530
  case "end":
416
- return _context5.stop();
531
+ return _context6.stop();
417
532
  }
418
- }, _callee5, this);
533
+ }, _callee6, this);
419
534
  }));
420
535
  function loadSalesDetail(_x2) {
421
536
  return _loadSalesDetail.apply(this, arguments);
@@ -425,45 +540,45 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
425
540
  }, {
426
541
  key: "scanPromotionCode",
427
542
  value: function () {
428
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(code, customerId) {
543
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(code, customerId) {
429
544
  var raw;
430
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
431
- while (1) switch (_context6.prev = _context6.next) {
545
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
546
+ while (1) switch (_context7.prev = _context7.next) {
432
547
  case 0:
433
548
  if (this.store.order) {
434
- _context6.next = 2;
549
+ _context7.next = 2;
435
550
  break;
436
551
  }
437
552
  throw new Error('order 模块未初始化');
438
553
  case 2:
439
- _context6.next = 4;
554
+ _context7.next = 4;
440
555
  return this.store.order.scanCode(code, customerId);
441
556
  case 4:
442
- raw = _context6.sent;
557
+ raw = _context7.sent;
443
558
  if (!raw.isAvailable) {
444
- _context6.next = 11;
559
+ _context7.next = 11;
445
560
  break;
446
561
  }
447
- _context6.next = 8;
562
+ _context7.next = 8;
448
563
  return this.hydrateOrderCustomerFromScanDiscounts(raw.scannedDiscountList || []);
449
564
  case 8:
450
- _context6.next = 10;
565
+ _context7.next = 10;
451
566
  return this.store.order.recalculateSummary({
452
567
  createIfMissing: true
453
568
  });
454
569
  case 10:
455
570
  this.store.order.persistTempOrder();
456
571
  case 11:
457
- return _context6.abrupt("return", {
572
+ return _context7.abrupt("return", {
458
573
  isAvailable: raw.isAvailable,
459
574
  type: raw.type,
460
575
  unavailableReason: raw.unavailableReason
461
576
  });
462
577
  case 12:
463
578
  case "end":
464
- return _context6.stop();
579
+ return _context7.stop();
465
580
  }
466
- }, _callee6, this);
581
+ }, _callee7, this);
467
582
  }));
468
583
  function scanPromotionCode(_x3, _x4) {
469
584
  return _scanPromotionCode.apply(this, arguments);
@@ -473,42 +588,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
473
588
  }, {
474
589
  key: "hydrateOrderCustomerFromScanDiscounts",
475
590
  value: function () {
476
- var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(discounts) {
591
+ var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(discounts) {
477
592
  var currentOrderCustomer, customerId, customer;
478
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
479
- while (1) switch (_context7.prev = _context7.next) {
593
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
594
+ while (1) switch (_context8.prev = _context8.next) {
480
595
  case 0:
481
596
  currentOrderCustomer = this.store.order.getOrderCustomer();
482
597
  if (!currentOrderCustomer) {
483
- _context7.next = 3;
598
+ _context8.next = 3;
484
599
  break;
485
600
  }
486
- return _context7.abrupt("return");
601
+ return _context8.abrupt("return");
487
602
  case 3:
488
603
  customerId = this.getDiscountCustomerId(discounts);
489
604
  if (customerId) {
490
- _context7.next = 6;
605
+ _context8.next = 6;
491
606
  break;
492
607
  }
493
- return _context7.abrupt("return");
608
+ return _context8.abrupt("return");
494
609
  case 6:
495
- _context7.next = 8;
610
+ _context8.next = 8;
496
611
  return this.resolveCustomerByDiscountCustomerId(customerId);
497
612
  case 8:
498
- customer = _context7.sent;
613
+ customer = _context8.sent;
499
614
  if (customer) {
500
- _context7.next = 11;
615
+ _context8.next = 11;
501
616
  break;
502
617
  }
503
- return _context7.abrupt("return");
618
+ return _context8.abrupt("return");
504
619
  case 11:
505
620
  this.store.customer.setSelectedCustomer(customer);
506
621
  this.setOrderCustomer(customer);
507
622
  case 13:
508
623
  case "end":
509
- return _context7.stop();
624
+ return _context8.stop();
510
625
  }
511
- }, _callee7, this);
626
+ }, _callee8, this);
512
627
  }));
513
628
  function hydrateOrderCustomerFromScanDiscounts(_x5) {
514
629
  return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
@@ -528,36 +643,36 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
528
643
  }, {
529
644
  key: "resolveCustomerByDiscountCustomerId",
530
645
  value: function () {
531
- var _resolveCustomerByDiscountCustomerId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(customerId) {
646
+ var _resolveCustomerByDiscountCustomerId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(customerId) {
532
647
  var _result$list;
533
648
  var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer;
534
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
535
- while (1) switch (_context8.prev = _context8.next) {
649
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
650
+ while (1) switch (_context9.prev = _context9.next) {
536
651
  case 0:
537
652
  localCustomers = this.store.customer.getCustomers();
538
653
  localCustomer = this.findCustomerById(localCustomers, customerId);
539
654
  normalizedLocalCustomer = localCustomer ? this.normalizeCustomer(localCustomer) : null;
540
655
  if (!(normalizedLocalCustomer && this.hasUsableCustomerDetails(normalizedLocalCustomer))) {
541
- _context8.next = 5;
656
+ _context9.next = 5;
542
657
  break;
543
658
  }
544
- return _context8.abrupt("return", normalizedLocalCustomer);
659
+ return _context9.abrupt("return", normalizedLocalCustomer);
545
660
  case 5:
546
- _context8.next = 7;
661
+ _context9.next = 7;
547
662
  return this.store.customer.queryCustomerList({
548
663
  ids: [customerId],
549
664
  skip: 1,
550
665
  num: 1
551
666
  });
552
667
  case 7:
553
- result = _context8.sent;
668
+ result = _context9.sent;
554
669
  remoteCustomer = this.findCustomerById((result === null || result === void 0 ? void 0 : result.list) || [], customerId) || (result === null || result === void 0 || (_result$list = result.list) === null || _result$list === void 0 ? void 0 : _result$list[0]) || null;
555
- return _context8.abrupt("return", remoteCustomer ? this.normalizeCustomer(remoteCustomer) : null);
670
+ return _context9.abrupt("return", remoteCustomer ? this.normalizeCustomer(remoteCustomer) : null);
556
671
  case 10:
557
672
  case "end":
558
- return _context8.stop();
673
+ return _context9.stop();
559
674
  }
560
- }, _callee8, this);
675
+ }, _callee9, this);
561
676
  }));
562
677
  function resolveCustomerByDiscountCustomerId(_x6) {
563
678
  return _resolveCustomerByDiscountCustomerId.apply(this, arguments);
@@ -578,24 +693,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
578
693
  }, {
579
694
  key: "normalizeCustomer",
580
695
  value: function normalizeCustomer(customer) {
581
- var _ref3, _ref4, _customer$phone, _ref5, _customer$email, _ref6, _customer$country_cal;
696
+ var _ref5, _ref6, _customer$phone, _ref7, _customer$email, _ref8, _customer$country_cal;
582
697
  var raw = customer;
583
698
  var rawId = this.getRawCustomerId(customer);
584
699
  var name = customer.name || raw.display_name || raw.nickname || raw.customer_name || [raw.first_name, raw.last_name].filter(Boolean).join(' ') || '';
585
700
  return _objectSpread(_objectSpread({}, customer), {}, {
586
701
  id: rawId !== null && rawId !== void 0 ? rawId : customer.id,
587
702
  name: name,
588
- phone: (_ref3 = (_ref4 = (_customer$phone = customer.phone) !== null && _customer$phone !== void 0 ? _customer$phone : raw.phone) !== null && _ref4 !== void 0 ? _ref4 : raw.mobile) !== null && _ref3 !== void 0 ? _ref3 : '',
589
- email: (_ref5 = (_customer$email = customer.email) !== null && _customer$email !== void 0 ? _customer$email : raw.email) !== null && _ref5 !== void 0 ? _ref5 : '',
590
- country_calling_code: (_ref6 = (_customer$country_cal = customer.country_calling_code) !== null && _customer$country_cal !== void 0 ? _customer$country_cal : raw.country_calling_code) !== null && _ref6 !== void 0 ? _ref6 : ''
703
+ phone: (_ref5 = (_ref6 = (_customer$phone = customer.phone) !== null && _customer$phone !== void 0 ? _customer$phone : raw.phone) !== null && _ref6 !== void 0 ? _ref6 : raw.mobile) !== null && _ref5 !== void 0 ? _ref5 : '',
704
+ email: (_ref7 = (_customer$email = customer.email) !== null && _customer$email !== void 0 ? _customer$email : raw.email) !== null && _ref7 !== void 0 ? _ref7 : '',
705
+ country_calling_code: (_ref8 = (_customer$country_cal = customer.country_calling_code) !== null && _customer$country_cal !== void 0 ? _customer$country_cal : raw.country_calling_code) !== null && _ref8 !== void 0 ? _ref8 : ''
591
706
  });
592
707
  }
593
708
  }, {
594
709
  key: "getRawCustomerId",
595
710
  value: function getRawCustomerId(customer) {
596
- var _ref7, _ref8, _customer$id;
711
+ var _ref9, _ref10, _customer$id;
597
712
  var raw = customer;
598
- return (_ref7 = (_ref8 = (_customer$id = customer.id) !== null && _customer$id !== void 0 ? _customer$id : raw.customer_id) !== null && _ref8 !== void 0 ? _ref8 : raw.customerId) !== null && _ref7 !== void 0 ? _ref7 : null;
713
+ return (_ref9 = (_ref10 = (_customer$id = customer.id) !== null && _customer$id !== void 0 ? _customer$id : raw.customer_id) !== null && _ref10 !== void 0 ? _ref10 : raw.customerId) !== null && _ref9 !== void 0 ? _ref9 : null;
599
714
  }
600
715
  }, {
601
716
  key: "hasUsableCustomerDetails",
@@ -620,60 +735,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
620
735
  }, {
621
736
  key: "setBookingStatus",
622
737
  value: (function () {
623
- var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(status) {
738
+ var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(status) {
624
739
  var _this$store$order, _this$store$order$get;
625
740
  var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
626
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
627
- while (1) switch (_context9.prev = _context9.next) {
741
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
742
+ while (1) switch (_context10.prev = _context10.next) {
628
743
  case 0:
629
744
  tempOrder = (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$get = _this$store$order.getTempOrder) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.call(_this$store$order);
630
745
  if (tempOrder) {
631
- _context9.next = 3;
746
+ _context10.next = 3;
632
747
  break;
633
748
  }
634
749
  throw new Error('setBookingStatus: tempOrder 未加载');
635
750
  case 3:
636
751
  orderId = tempOrder.order_id;
637
752
  if (!(orderId === undefined || orderId === null)) {
638
- _context9.next = 6;
753
+ _context10.next = 6;
639
754
  break;
640
755
  }
641
756
  throw new Error('setBookingStatus: tempOrder.order_id 缺失');
642
757
  case 6:
643
758
  scheduleId = resolveScheduleId(tempOrder);
644
759
  if (!(scheduleId === null)) {
645
- _context9.next = 9;
760
+ _context10.next = 9;
646
761
  break;
647
762
  }
648
763
  throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
649
764
  case 9:
650
765
  bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
651
766
  previous = applyBookingsStatus(bookings, status);
652
- _context9.prev = 11;
653
- _context9.next = 14;
767
+ _context10.prev = 11;
768
+ _context10.next = 14;
654
769
  return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
655
770
  appointment_status: status
656
771
  });
657
772
  case 14:
658
- res = _context9.sent;
659
- _context9.next = 17;
773
+ res = _context10.sent;
774
+ _context10.next = 17;
660
775
  return this.refreshSalesDetail();
661
776
  case 17:
662
777
  this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
663
778
  orderId: orderId,
664
779
  status: status
665
780
  });
666
- return _context9.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
781
+ return _context10.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
667
782
  case 21:
668
- _context9.prev = 21;
669
- _context9.t0 = _context9["catch"](11);
783
+ _context10.prev = 21;
784
+ _context10.t0 = _context10["catch"](11);
670
785
  restoreBookingsStatus(bookings, previous);
671
- throw _context9.t0;
786
+ throw _context10.t0;
672
787
  case 25:
673
788
  case "end":
674
- return _context9.stop();
789
+ return _context10.stop();
675
790
  }
676
- }, _callee9, this, [[11, 21]]);
791
+ }, _callee10, this, [[11, 21]]);
677
792
  }));
678
793
  function setBookingStatus(_x7) {
679
794
  return _setBookingStatus.apply(this, arguments);
@@ -704,35 +819,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
704
819
  }, {
705
820
  key: "transitionChildBooking",
706
821
  value: (function () {
707
- var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
822
+ var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
708
823
  var _this$store$order2, _this$store$order2$ge;
709
824
  var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
710
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
711
- while (1) switch (_context10.prev = _context10.next) {
825
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
826
+ while (1) switch (_context11.prev = _context11.next) {
712
827
  case 0:
713
828
  schedule_event_id = params.schedule_event_id, action = params.action;
714
829
  if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
715
- _context10.next = 3;
830
+ _context11.next = 3;
716
831
  break;
717
832
  }
718
833
  throw new Error('transitionChildBooking: schedule_event_id 不能为空');
719
834
  case 3:
720
835
  if (action) {
721
- _context10.next = 5;
836
+ _context11.next = 5;
722
837
  break;
723
838
  }
724
839
  throw new Error('transitionChildBooking: action 不能为空');
725
840
  case 5:
726
841
  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);
727
842
  if (tempOrder) {
728
- _context10.next = 8;
843
+ _context11.next = 8;
729
844
  break;
730
845
  }
731
846
  throw new Error('transitionChildBooking: tempOrder 未加载');
732
847
  case 8:
733
848
  orderId = tempOrder.order_id;
734
849
  if (!(orderId === undefined || orderId === null)) {
735
- _context10.next = 11;
850
+ _context11.next = 11;
736
851
  break;
737
852
  }
738
853
  throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
@@ -740,14 +855,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
740
855
  bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
741
856
  targetStatus = resolveStatusAfterTransition(action);
742
857
  previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
743
- _context10.prev = 14;
744
- _context10.next = 17;
858
+ _context11.prev = 14;
859
+ _context11.next = 17;
745
860
  return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
746
861
  action: action
747
862
  });
748
863
  case 17:
749
- res = _context10.sent;
750
- _context10.next = 20;
864
+ res = _context11.sent;
865
+ _context11.next = 20;
751
866
  return this.refreshSalesDetail();
752
867
  case 20:
753
868
  this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
@@ -756,19 +871,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
756
871
  action: action,
757
872
  status: targetStatus
758
873
  });
759
- return _context10.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
874
+ return _context11.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
760
875
  case 24:
761
- _context10.prev = 24;
762
- _context10.t0 = _context10["catch"](14);
876
+ _context11.prev = 24;
877
+ _context11.t0 = _context11["catch"](14);
763
878
  if (previous !== undefined) {
764
879
  restoreChildBookingStatus(bookings, schedule_event_id, previous);
765
880
  }
766
- throw _context10.t0;
881
+ throw _context11.t0;
767
882
  case 28:
768
883
  case "end":
769
- return _context10.stop();
884
+ return _context11.stop();
770
885
  }
771
- }, _callee10, this, [[14, 24]]);
886
+ }, _callee11, this, [[14, 24]]);
772
887
  }));
773
888
  function transitionChildBooking(_x8) {
774
889
  return _transitionChildBooking.apply(this, arguments);
@@ -789,19 +904,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
789
904
  }, {
790
905
  key: "refreshSalesDetail",
791
906
  value: (function () {
792
- var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
907
+ var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
793
908
  var _this$store$order3, _this$store$order3$ge;
794
909
  var params,
795
910
  tempOrder,
796
911
  orderId,
797
- _args11 = arguments;
798
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
799
- while (1) switch (_context11.prev = _context11.next) {
912
+ _args12 = arguments;
913
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
914
+ while (1) switch (_context12.prev = _context12.next) {
800
915
  case 0:
801
- params = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
916
+ params = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
802
917
  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);
803
918
  if (tempOrder) {
804
- _context11.next = 4;
919
+ _context12.next = 4;
805
920
  break;
806
921
  }
807
922
  throw new Error('refreshSalesDetail: tempOrder 未加载');
@@ -809,21 +924,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
809
924
  debugger;
810
925
  orderId = tempOrder.order_id || tempOrder.external_sale_number;
811
926
  if (!(orderId === undefined || orderId === null)) {
812
- _context11.next = 8;
927
+ _context12.next = 8;
813
928
  break;
814
929
  }
815
- return _context11.abrupt("return", {});
930
+ return _context12.abrupt("return", {});
816
931
  case 8:
817
- return _context11.abrupt("return", this.loadSalesDetail({
932
+ return _context12.abrupt("return", this.loadSalesDetail({
818
933
  orderId: orderId,
819
934
  // merge: true
820
935
  forceRemote: params.forceRemote
821
936
  }));
822
937
  case 9:
823
938
  case "end":
824
- return _context11.stop();
939
+ return _context12.stop();
825
940
  }
826
- }, _callee11, this);
941
+ }, _callee12, this);
827
942
  }));
828
943
  function refreshSalesDetail() {
829
944
  return _refreshSalesDetail.apply(this, arguments);
@@ -839,7 +954,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
839
954
  }, {
840
955
  key: "loadProducts",
841
956
  value: (function () {
842
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
957
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
843
958
  var params,
844
959
  options,
845
960
  schedule_date,
@@ -848,20 +963,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
848
963
  schedule_datetime,
849
964
  bookingDate,
850
965
  _result,
851
- _args12 = arguments;
852
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
853
- while (1) switch (_context12.prev = _context12.next) {
966
+ _args13 = arguments;
967
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
968
+ while (1) switch (_context13.prev = _context13.next) {
854
969
  case 0:
855
- params = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
856
- options = _args12.length > 1 ? _args12[1] : undefined;
970
+ params = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
971
+ options = _args13.length > 1 ? _args13[1] : undefined;
857
972
  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 对齐;
858
973
  // requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
859
974
  bookingDate = schedule_datetime || schedule_date || '';
860
975
  if (bookingDate) {
861
976
  this.setBookingDate(bookingDate);
862
977
  }
863
- _context12.prev = 5;
864
- _context12.next = 8;
978
+ _context13.prev = 5;
979
+ _context13.next = 8;
865
980
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
866
981
  with_count: ['bundleGroup', 'optionGroup'],
867
982
  with_schedule: 1
@@ -869,20 +984,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
869
984
  cacheId: this.cacheId
870
985
  }), options);
871
986
  case 8:
872
- _result = _context12.sent;
987
+ _result = _context13.sent;
873
988
  this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
874
989
  this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
875
- return _context12.abrupt("return", _result);
990
+ return _context13.abrupt("return", _result);
876
991
  case 14:
877
- _context12.prev = 14;
878
- _context12.t0 = _context12["catch"](5);
879
- console.error('Failed to load products:', _context12.t0);
880
- throw _context12.t0;
992
+ _context13.prev = 14;
993
+ _context13.t0 = _context13["catch"](5);
994
+ console.error('Failed to load products:', _context13.t0);
995
+ throw _context13.t0;
881
996
  case 18:
882
997
  case "end":
883
- return _context12.stop();
998
+ return _context13.stop();
884
999
  }
885
- }, _callee12, this, [[5, 14]]);
1000
+ }, _callee13, this, [[5, 14]]);
886
1001
  }));
887
1002
  function loadProducts() {
888
1003
  return _loadProducts.apply(this, arguments);
@@ -899,21 +1014,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
899
1014
  }, {
900
1015
  key: "getAddTimeProducts",
901
1016
  value: (function () {
902
- var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
1017
+ var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
903
1018
  var params,
904
- _args13 = arguments;
905
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
906
- while (1) switch (_context13.prev = _context13.next) {
1019
+ result,
1020
+ _args14 = arguments;
1021
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1022
+ while (1) switch (_context14.prev = _context14.next) {
907
1023
  case 0:
908
- params = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
909
- return _context13.abrupt("return", this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
1024
+ params = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
1025
+ _context14.next = 3;
1026
+ return this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
910
1027
  cacheId: this.cacheId
911
- })));
912
- case 2:
1028
+ }));
1029
+ case 3:
1030
+ result = _context14.sent;
1031
+ this.addTimeProductsCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
1032
+ return _context14.abrupt("return", result);
1033
+ case 6:
913
1034
  case "end":
914
- return _context13.stop();
1035
+ return _context14.stop();
915
1036
  }
916
- }, _callee13, this);
1037
+ }, _callee14, this);
917
1038
  }));
918
1039
  function getAddTimeProducts() {
919
1040
  return _getAddTimeProducts.apply(this, arguments);
@@ -938,14 +1059,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
938
1059
  }, {
939
1060
  key: "queryProductDetail",
940
1061
  value: (function () {
941
- var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params, options) {
1062
+ var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params, options) {
942
1063
  var product_id, queryParams, _result2, list;
943
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
944
- while (1) switch (_context14.prev = _context14.next) {
1064
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1065
+ while (1) switch (_context15.prev = _context15.next) {
945
1066
  case 0:
946
1067
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
947
- _context14.prev = 1;
948
- _context14.next = 4;
1068
+ _context15.prev = 1;
1069
+ _context15.next = 4;
949
1070
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
950
1071
  with_count: ['bundleGroup', 'optionGroup'],
951
1072
  with_schedule: 1
@@ -954,21 +1075,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
954
1075
  cacheId: this.cacheId
955
1076
  }), options);
956
1077
  case 4:
957
- _result2 = _context14.sent;
1078
+ _result2 = _context15.sent;
958
1079
  list = Array.isArray(_result2) ? _result2 : [];
959
- return _context14.abrupt("return", list.find(function (product) {
1080
+ return _context15.abrupt("return", list.find(function (product) {
960
1081
  return Number(product.id) === Number(product_id);
961
1082
  }));
962
1083
  case 9:
963
- _context14.prev = 9;
964
- _context14.t0 = _context14["catch"](1);
965
- console.error('Failed to query product detail:', _context14.t0);
966
- throw _context14.t0;
1084
+ _context15.prev = 9;
1085
+ _context15.t0 = _context15["catch"](1);
1086
+ console.error('Failed to query product detail:', _context15.t0);
1087
+ throw _context15.t0;
967
1088
  case 13:
968
1089
  case "end":
969
- return _context14.stop();
1090
+ return _context15.stop();
970
1091
  }
971
- }, _callee14, this, [[1, 9]]);
1092
+ }, _callee15, this, [[1, 9]]);
972
1093
  }));
973
1094
  function queryProductDetail(_x9, _x10) {
974
1095
  return _queryProductDetail.apply(this, arguments);
@@ -983,26 +1104,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
983
1104
  }, {
984
1105
  key: "loadProductDetail",
985
1106
  value: (function () {
986
- var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params, options) {
1107
+ var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params, options) {
987
1108
  var product_id, queryParams, products;
988
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
989
- while (1) switch (_context15.prev = _context15.next) {
1109
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1110
+ while (1) switch (_context16.prev = _context16.next) {
990
1111
  case 0:
991
1112
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
992
- _context15.next = 3;
1113
+ _context16.next = 3;
993
1114
  return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
994
1115
  product_ids: [product_id]
995
1116
  }), options);
996
1117
  case 3:
997
- products = _context15.sent;
998
- return _context15.abrupt("return", products.find(function (product) {
1118
+ products = _context16.sent;
1119
+ return _context16.abrupt("return", products.find(function (product) {
999
1120
  return Number(product.id) === Number(product_id);
1000
1121
  }));
1001
1122
  case 5:
1002
1123
  case "end":
1003
- return _context15.stop();
1124
+ return _context16.stop();
1004
1125
  }
1005
- }, _callee15, this);
1126
+ }, _callee16, this);
1006
1127
  }));
1007
1128
  function loadProductDetail(_x11, _x12) {
1008
1129
  return _loadProductDetail.apply(this, arguments);
@@ -1037,16 +1158,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1037
1158
  }, {
1038
1159
  key: "getProducts",
1039
1160
  value: (function () {
1040
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1041
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1042
- while (1) switch (_context16.prev = _context16.next) {
1161
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1162
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1163
+ while (1) switch (_context17.prev = _context17.next) {
1043
1164
  case 0:
1044
- return _context16.abrupt("return", this.store.products.getProducts());
1165
+ return _context17.abrupt("return", this.store.products.getProducts());
1045
1166
  case 1:
1046
1167
  case "end":
1047
- return _context16.stop();
1168
+ return _context17.stop();
1048
1169
  }
1049
- }, _callee16, this);
1170
+ }, _callee17, this);
1050
1171
  }));
1051
1172
  function getProducts() {
1052
1173
  return _getProducts.apply(this, arguments);
@@ -1076,11 +1197,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1076
1197
  }, {
1077
1198
  key: "getCart",
1078
1199
  value: function getCart() {
1079
- var _this$store$order$get2, _this$store$order4, _salesDetail$bookings;
1200
+ var _this$store$order$get2, _this$store$order4, _salesDetail$bookings, _operatingDayBoundary, _operatingDayBoundary2, _tempOrder$_extend;
1080
1201
  var tempOrder = (_this$store$order$get2 = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder()) !== null && _this$store$order$get2 !== void 0 ? _this$store$order$get2 : null;
1081
1202
  var salesDetail = this.getSalesOrder();
1082
1203
  var bookings = (_salesDetail$bookings = salesDetail === null || salesDetail === void 0 ? void 0 : salesDetail.bookings) !== null && _salesDetail$bookings !== void 0 ? _salesDetail$bookings : (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) || [];
1083
- return buildCartView((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [], bookings);
1204
+ var operatingDayBoundary;
1205
+ try {
1206
+ operatingDayBoundary = this.getAppData('operating_day_boundary');
1207
+ } catch (_unused) {
1208
+ operatingDayBoundary = undefined;
1209
+ }
1210
+ var shopOpeningHours = ((_operatingDayBoundary = operatingDayBoundary) === null || _operatingDayBoundary === void 0 ? void 0 : _operatingDayBoundary.type) === 'start_time' ? '23:59' : (_operatingDayBoundary2 = operatingDayBoundary) === null || _operatingDayBoundary2 === void 0 ? void 0 : _operatingDayBoundary2.time;
1211
+ return buildCartView((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [], bookings, {
1212
+ addTimeProducts: this.addTimeProductsCatalog,
1213
+ bookingConfig: this.getBookingConfig(),
1214
+ productsByUid: tempOrder === null || tempOrder === void 0 || (_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.productsByUid,
1215
+ shopOpeningHours: shopOpeningHours
1216
+ });
1084
1217
  }
1085
1218
 
1086
1219
  /**
@@ -1099,16 +1232,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1099
1232
  }, {
1100
1233
  key: "getProductByIds",
1101
1234
  value: (function () {
1102
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(ids) {
1103
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1104
- while (1) switch (_context17.prev = _context17.next) {
1235
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids) {
1236
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1237
+ while (1) switch (_context18.prev = _context18.next) {
1105
1238
  case 0:
1106
- return _context17.abrupt("return", this.store.products.getProductByIds(ids));
1239
+ return _context18.abrupt("return", this.store.products.getProductByIds(ids));
1107
1240
  case 1:
1108
1241
  case "end":
1109
- return _context17.stop();
1242
+ return _context18.stop();
1110
1243
  }
1111
- }, _callee17, this);
1244
+ }, _callee18, this);
1112
1245
  }));
1113
1246
  function getProductByIds(_x13) {
1114
1247
  return _getProductByIds.apply(this, arguments);
@@ -1124,25 +1257,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1124
1257
  }, {
1125
1258
  key: "getScheduleTimePoints",
1126
1259
  value: (function () {
1127
- var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
1260
+ var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
1128
1261
  var result;
1129
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1130
- while (1) switch (_context18.prev = _context18.next) {
1262
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1263
+ while (1) switch (_context19.prev = _context19.next) {
1131
1264
  case 0:
1132
- _context18.next = 2;
1265
+ _context19.next = 2;
1133
1266
  return this.request.post('/menu/schedule-time-points', {
1134
1267
  menu_list_ids: params.menu_list_ids
1135
1268
  }, {
1136
1269
  osServer: true
1137
1270
  });
1138
1271
  case 2:
1139
- result = _context18.sent;
1140
- return _context18.abrupt("return", result.data || []);
1272
+ result = _context19.sent;
1273
+ return _context19.abrupt("return", result.data || []);
1141
1274
  case 4:
1142
1275
  case "end":
1143
- return _context18.stop();
1276
+ return _context19.stop();
1144
1277
  }
1145
- }, _callee18, this);
1278
+ }, _callee19, this);
1146
1279
  }));
1147
1280
  function getScheduleTimePoints(_x14) {
1148
1281
  return _getScheduleTimePoints.apply(this, arguments);
@@ -1158,30 +1291,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1158
1291
  }, {
1159
1292
  key: "getCustomerList",
1160
1293
  value: (function () {
1161
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1294
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1162
1295
  var params,
1163
1296
  _result3,
1164
- _args19 = arguments;
1165
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1166
- while (1) switch (_context19.prev = _context19.next) {
1297
+ _args20 = arguments;
1298
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1299
+ while (1) switch (_context20.prev = _context20.next) {
1167
1300
  case 0:
1168
- params = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
1169
- _context19.prev = 1;
1170
- _context19.next = 4;
1301
+ params = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
1302
+ _context20.prev = 1;
1303
+ _context20.next = 4;
1171
1304
  return this.store.customer.getCustomerList(params);
1172
1305
  case 4:
1173
- _result3 = _context19.sent;
1174
- return _context19.abrupt("return", _result3);
1306
+ _result3 = _context20.sent;
1307
+ return _context20.abrupt("return", _result3);
1175
1308
  case 8:
1176
- _context19.prev = 8;
1177
- _context19.t0 = _context19["catch"](1);
1178
- console.error('Failed to get customer list:', _context19.t0);
1179
- throw _context19.t0;
1309
+ _context20.prev = 8;
1310
+ _context20.t0 = _context20["catch"](1);
1311
+ console.error('Failed to get customer list:', _context20.t0);
1312
+ throw _context20.t0;
1180
1313
  case 12:
1181
1314
  case "end":
1182
- return _context19.stop();
1315
+ return _context20.stop();
1183
1316
  }
1184
- }, _callee19, this, [[1, 8]]);
1317
+ }, _callee20, this, [[1, 8]]);
1185
1318
  }));
1186
1319
  function getCustomerList() {
1187
1320
  return _getCustomerList.apply(this, arguments);
@@ -1379,24 +1512,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1379
1512
  }, {
1380
1513
  key: "restoreOrder",
1381
1514
  value: (function () {
1382
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1515
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1383
1516
  var _this$store$customer;
1384
1517
  var tempOrder;
1385
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1386
- while (1) switch (_context20.prev = _context20.next) {
1518
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1519
+ while (1) switch (_context21.prev = _context21.next) {
1387
1520
  case 0:
1388
- _context20.next = 2;
1521
+ _context21.next = 2;
1389
1522
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
1390
1523
  case 2:
1391
- tempOrder = _context20.sent;
1524
+ tempOrder = _context21.sent;
1392
1525
  this.clearOrderCustomer();
1393
1526
  (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
1394
- return _context20.abrupt("return", tempOrder);
1527
+ return _context21.abrupt("return", tempOrder);
1395
1528
  case 6:
1396
1529
  case "end":
1397
- return _context20.stop();
1530
+ return _context21.stop();
1398
1531
  }
1399
- }, _callee20, this);
1532
+ }, _callee21, this);
1400
1533
  }));
1401
1534
  function restoreOrder() {
1402
1535
  return _restoreOrder.apply(this, arguments);
@@ -1422,36 +1555,36 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1422
1555
  return;
1423
1556
  }
1424
1557
  var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
1425
- var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1558
+ var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1426
1559
  var currentCustomer;
1427
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1428
- while (1) switch (_context21.prev = _context21.next) {
1560
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1561
+ while (1) switch (_context22.prev = _context22.next) {
1429
1562
  case 0:
1430
1563
  if (!previousRefresh) {
1431
- _context21.next = 3;
1564
+ _context22.next = 3;
1432
1565
  break;
1433
1566
  }
1434
- _context21.next = 3;
1567
+ _context22.next = 3;
1435
1568
  return previousRefresh.catch(function () {
1436
1569
  return undefined;
1437
1570
  });
1438
1571
  case 3:
1439
1572
  currentCustomer = _this4.store.order.getOrderCustomer();
1440
1573
  if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
1441
- _context21.next = 6;
1574
+ _context22.next = 6;
1442
1575
  break;
1443
1576
  }
1444
- return _context21.abrupt("return");
1577
+ return _context22.abrupt("return");
1445
1578
  case 6:
1446
- _context21.next = 8;
1579
+ _context22.next = 8;
1447
1580
  return _this4.loadDiscountConfig({
1448
1581
  customerId: customerId
1449
1582
  });
1450
1583
  case 8:
1451
1584
  case "end":
1452
- return _context21.stop();
1585
+ return _context22.stop();
1453
1586
  }
1454
- }, _callee21);
1587
+ }, _callee22);
1455
1588
  }))();
1456
1589
  this.orderCustomerDiscountRefreshInFlight = refreshTask;
1457
1590
  this.orderCustomerDiscountRefreshCustomerId = customerId;
@@ -1504,27 +1637,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1504
1637
  }, {
1505
1638
  key: "changeCustomerPage",
1506
1639
  value: (function () {
1507
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(page, pageSize) {
1640
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(page, pageSize) {
1508
1641
  var _result4;
1509
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1510
- while (1) switch (_context22.prev = _context22.next) {
1642
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1643
+ while (1) switch (_context23.prev = _context23.next) {
1511
1644
  case 0:
1512
- _context22.prev = 0;
1513
- _context22.next = 3;
1645
+ _context23.prev = 0;
1646
+ _context23.next = 3;
1514
1647
  return this.store.customer.changeCustomerPage(page, pageSize);
1515
1648
  case 3:
1516
- _result4 = _context22.sent;
1517
- return _context22.abrupt("return", _result4);
1649
+ _result4 = _context23.sent;
1650
+ return _context23.abrupt("return", _result4);
1518
1651
  case 7:
1519
- _context22.prev = 7;
1520
- _context22.t0 = _context22["catch"](0);
1521
- console.error('Failed to change customer page:', _context22.t0);
1522
- throw _context22.t0;
1652
+ _context23.prev = 7;
1653
+ _context23.t0 = _context23["catch"](0);
1654
+ console.error('Failed to change customer page:', _context23.t0);
1655
+ throw _context23.t0;
1523
1656
  case 11:
1524
1657
  case "end":
1525
- return _context22.stop();
1658
+ return _context23.stop();
1526
1659
  }
1527
- }, _callee22, this, [[0, 7]]);
1660
+ }, _callee23, this, [[0, 7]]);
1528
1661
  }));
1529
1662
  function changeCustomerPage(_x15, _x16) {
1530
1663
  return _changeCustomerPage.apply(this, arguments);
@@ -1539,28 +1672,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1539
1672
  }, {
1540
1673
  key: "loadMoreCustomers",
1541
1674
  value: (function () {
1542
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1675
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1543
1676
  var _result5;
1544
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1545
- while (1) switch (_context23.prev = _context23.next) {
1677
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1678
+ while (1) switch (_context24.prev = _context24.next) {
1546
1679
  case 0:
1547
- _context23.prev = 0;
1548
- _context23.next = 3;
1680
+ _context24.prev = 0;
1681
+ _context24.next = 3;
1549
1682
  return this.store.customer.loadMoreCustomers();
1550
1683
  case 3:
1551
- _result5 = _context23.sent;
1684
+ _result5 = _context24.sent;
1552
1685
  this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
1553
- return _context23.abrupt("return", _result5);
1686
+ return _context24.abrupt("return", _result5);
1554
1687
  case 8:
1555
- _context23.prev = 8;
1556
- _context23.t0 = _context23["catch"](0);
1557
- console.error('Failed to load more customers:', _context23.t0);
1558
- throw _context23.t0;
1688
+ _context24.prev = 8;
1689
+ _context24.t0 = _context24["catch"](0);
1690
+ console.error('Failed to load more customers:', _context24.t0);
1691
+ throw _context24.t0;
1559
1692
  case 12:
1560
1693
  case "end":
1561
- return _context23.stop();
1694
+ return _context24.stop();
1562
1695
  }
1563
- }, _callee23, this, [[0, 8]]);
1696
+ }, _callee24, this, [[0, 8]]);
1564
1697
  }));
1565
1698
  function loadMoreCustomers() {
1566
1699
  return _loadMoreCustomers.apply(this, arguments);
@@ -1576,31 +1709,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1576
1709
  }, {
1577
1710
  key: "resetAndLoadCustomers",
1578
1711
  value: (function () {
1579
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1712
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1580
1713
  var params,
1581
1714
  _result6,
1582
- _args24 = arguments;
1583
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1584
- while (1) switch (_context24.prev = _context24.next) {
1715
+ _args25 = arguments;
1716
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1717
+ while (1) switch (_context25.prev = _context25.next) {
1585
1718
  case 0:
1586
- params = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
1587
- _context24.prev = 1;
1588
- _context24.next = 4;
1719
+ params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
1720
+ _context25.prev = 1;
1721
+ _context25.next = 4;
1589
1722
  return this.store.customer.resetAndLoadCustomers(params);
1590
1723
  case 4:
1591
- _result6 = _context24.sent;
1724
+ _result6 = _context25.sent;
1592
1725
  this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
1593
- return _context24.abrupt("return", _result6);
1726
+ return _context25.abrupt("return", _result6);
1594
1727
  case 9:
1595
- _context24.prev = 9;
1596
- _context24.t0 = _context24["catch"](1);
1597
- console.error('Failed to reset and load customers:', _context24.t0);
1598
- throw _context24.t0;
1728
+ _context25.prev = 9;
1729
+ _context25.t0 = _context25["catch"](1);
1730
+ console.error('Failed to reset and load customers:', _context25.t0);
1731
+ throw _context25.t0;
1599
1732
  case 13:
1600
1733
  case "end":
1601
- return _context24.stop();
1734
+ return _context25.stop();
1602
1735
  }
1603
- }, _callee24, this, [[1, 9]]);
1736
+ }, _callee25, this, [[1, 9]]);
1604
1737
  }));
1605
1738
  function resetAndLoadCustomers() {
1606
1739
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -1761,16 +1894,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1761
1894
  }, {
1762
1895
  key: "getOtherParams",
1763
1896
  value: (function () {
1764
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1765
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1766
- while (1) switch (_context25.prev = _context25.next) {
1897
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1898
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1899
+ while (1) switch (_context26.prev = _context26.next) {
1767
1900
  case 0:
1768
- return _context25.abrupt("return", this.otherParams);
1901
+ return _context26.abrupt("return", this.otherParams);
1769
1902
  case 1:
1770
1903
  case "end":
1771
- return _context25.stop();
1904
+ return _context26.stop();
1772
1905
  }
1773
- }, _callee25, this);
1906
+ }, _callee26, this);
1774
1907
  }));
1775
1908
  function getOtherParams() {
1776
1909
  return _getOtherParams.apply(this, arguments);
@@ -1979,10 +2112,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1979
2112
  }, {
1980
2113
  key: "buildAddProductCtx",
1981
2114
  value: function buildAddProductCtx(extra) {
1982
- var _extra$date2, _ref10, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get4, _extra$presetStartTim2;
2115
+ var _extra$date2, _ref12, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get4, _extra$presetStartTim2;
1983
2116
  var bookingContextState = this.store.bookingContext.getState();
1984
2117
  var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
1985
- var orderCustomerId = (_ref10 = (_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref10 !== void 0 ? _ref10 : undefined;
2118
+ var orderCustomerId = (_ref12 = (_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
1986
2119
  return _objectSpread({
1987
2120
  bookingConfig: bookingContextState.bookingConfig,
1988
2121
  resourcesOrigin: bookingContextState.resourcesOrigin,
@@ -2088,16 +2221,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2088
2221
  }, {
2089
2222
  key: "updateProductInOrder",
2090
2223
  value: (function () {
2091
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2092
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2093
- while (1) switch (_context26.prev = _context26.next) {
2224
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2225
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2226
+ while (1) switch (_context27.prev = _context27.next) {
2094
2227
  case 0:
2095
- return _context26.abrupt("return", this.updateOrderProduct(params));
2228
+ return _context27.abrupt("return", this.updateOrderProduct(params));
2096
2229
  case 1:
2097
2230
  case "end":
2098
- return _context26.stop();
2231
+ return _context27.stop();
2099
2232
  }
2100
- }, _callee26, this);
2233
+ }, _callee27, this);
2101
2234
  }));
2102
2235
  function updateProductInOrder(_x17) {
2103
2236
  return _updateProductInOrder.apply(this, arguments);
@@ -2121,47 +2254,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2121
2254
  }, {
2122
2255
  key: "handleGlobalScanCode",
2123
2256
  value: (function () {
2124
- var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(code, bridge) {
2257
+ var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(code, bridge) {
2125
2258
  var _this6 = this;
2126
2259
  var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
2127
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2128
- while (1) switch (_context27.prev = _context27.next) {
2260
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2261
+ while (1) switch (_context28.prev = _context28.next) {
2129
2262
  case 0:
2130
2263
  trimmed = typeof code === 'string' ? code.trim() : '';
2131
2264
  if (trimmed) {
2132
- _context27.next = 4;
2265
+ _context28.next = 4;
2133
2266
  break;
2134
2267
  }
2135
2268
  bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2136
- return _context27.abrupt("return", {
2269
+ return _context28.abrupt("return", {
2137
2270
  status: 'failed',
2138
2271
  reason: 'empty_code'
2139
2272
  });
2140
2273
  case 4:
2141
- _context27.prev = 4;
2274
+ _context28.prev = 4;
2142
2275
  localSearch = function localSearch(v) {
2143
2276
  return _this6.store.products.findProductsByCodeOrBarcode(v);
2144
2277
  };
2145
2278
  scanCallback = handleGlobalScan(this.request, localSearch);
2146
- _context27.next = 9;
2279
+ _context28.next = 9;
2147
2280
  return scanCallback({
2148
2281
  type: 'nativeScanner',
2149
2282
  value: trimmed
2150
2283
  });
2151
2284
  case 9:
2152
- raw = _context27.sent;
2285
+ raw = _context28.sent;
2153
2286
  formatted = formatGlobalScanResult(raw, trimmed);
2154
2287
  if (formatted) {
2155
- _context27.next = 14;
2288
+ _context28.next = 14;
2156
2289
  break;
2157
2290
  }
2158
2291
  bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2159
- return _context27.abrupt("return", {
2292
+ return _context28.abrupt("return", {
2160
2293
  status: 'failed',
2161
2294
  reason: 'not_found'
2162
2295
  });
2163
2296
  case 14:
2164
- _context27.next = 16;
2297
+ _context28.next = 16;
2165
2298
  return applyGlobalScan({
2166
2299
  setOrderCustomer: function setOrderCustomer(customer) {
2167
2300
  return _this6.setOrderCustomer(customer);
@@ -2190,23 +2323,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2190
2323
  }
2191
2324
  }, formatted, bridge);
2192
2325
  case 16:
2193
- _result7 = _context27.sent;
2326
+ _result7 = _context28.sent;
2194
2327
  bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
2195
- return _context27.abrupt("return", _result7);
2328
+ return _context28.abrupt("return", _result7);
2196
2329
  case 21:
2197
- _context27.prev = 21;
2198
- _context27.t0 = _context27["catch"](4);
2199
- console.error('[BookingTicket] handleGlobalScanCode failed', _context27.t0);
2330
+ _context28.prev = 21;
2331
+ _context28.t0 = _context28["catch"](4);
2332
+ console.error('[BookingTicket] handleGlobalScanCode failed', _context28.t0);
2200
2333
  bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2201
- return _context27.abrupt("return", {
2334
+ return _context28.abrupt("return", {
2202
2335
  status: 'failed',
2203
2336
  reason: 'not_found'
2204
2337
  });
2205
2338
  case 26:
2206
2339
  case "end":
2207
- return _context27.stop();
2340
+ return _context28.stop();
2208
2341
  }
2209
- }, _callee27, this, [[4, 21]]);
2342
+ }, _callee28, this, [[4, 21]]);
2210
2343
  }));
2211
2344
  function handleGlobalScanCode(_x18, _x19) {
2212
2345
  return _handleGlobalScanCode.apply(this, arguments);
@@ -2219,6 +2352,233 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2219
2352
  return _resolveBestAddTimePlan(addTimeProducts, targetMinutes);
2220
2353
  }
2221
2354
 
2355
+ /**
2356
+ * 构造一条绑定到已有 booking 的加时商品行。
2357
+ *
2358
+ * @example
2359
+ * const line = this.buildAddTimeOrderLine({ product, product_add_schedule_time: 30 }, 'booking-1');
2360
+ */
2361
+ }, {
2362
+ key: "buildAddTimeOrderLine",
2363
+ value: function buildAddTimeOrderLine(input, bookingUid) {
2364
+ 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;
2365
+ var product = input === null || input === void 0 ? void 0 : input.product;
2366
+ if (!product || _typeof(product) !== 'object') {
2367
+ throw new Error('[BookingTicket] addAddTimeProductToBooking: product 不能为空');
2368
+ }
2369
+ var quantity = normalizeAddTimeQuantity((_input$num = input.num) !== null && _input$num !== void 0 ? _input$num : product.num);
2370
+ var price = resolveAddTimeProductPrice(input.price, product);
2371
+ var addScheduleTime = resolveAddTimeScheduleMinutes(input.product_add_schedule_time, product);
2372
+ var payload = {
2373
+ id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id,
2374
+ product_id: (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id,
2375
+ 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,
2376
+ 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,
2377
+ quantity: quantity,
2378
+ num: quantity,
2379
+ price: price,
2380
+ selling_price: price,
2381
+ original_price: (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : price,
2382
+ line_total: price,
2383
+ total: price,
2384
+ product_sku: product.product_sku,
2385
+ 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 : [],
2386
+ 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 : []
2387
+ };
2388
+ var orderLine = this.transformBaseProductToOrderProduct({
2389
+ payload: payload,
2390
+ fallbackProductId: (_product$id2 = product.id) !== null && _product$id2 !== void 0 ? _product$id2 : product.product_id,
2391
+ sourceProduct: product,
2392
+ sourceItem: product
2393
+ });
2394
+ if (!orderLine) {
2395
+ throw new Error('[BookingTicket] addAddTimeProductToBooking: product transform failed');
2396
+ }
2397
+ var metadata = _objectSpread(_objectSpread(_objectSpread({}, orderLine.metadata || {}), addScheduleTime !== undefined ? {
2398
+ product_add_schedule_time: addScheduleTime
2399
+ } : {}), {}, {
2400
+ booking_uid: bookingUid
2401
+ });
2402
+ return _objectSpread(_objectSpread({}, orderLine), {}, {
2403
+ booking_uid: bookingUid,
2404
+ metadata: metadata
2405
+ });
2406
+ }
2407
+
2408
+ /**
2409
+ * 将加时商品作为独立商品行绑定到已有 booking。
2410
+ *
2411
+ * 与预约商品加车不同,本方法不会把当前 booking 作为 `addProductToOrder` 第二参数传入,
2412
+ * 避免 OrderModule 新建 booking 或重写已有 booking.product_uid。
2413
+ *
2414
+ * @example
2415
+ * await bookingTicket.addAddTimeProductToBooking({
2416
+ * booking,
2417
+ * product,
2418
+ * num: 1,
2419
+ * price: '10.00',
2420
+ * product_add_schedule_time: 30,
2421
+ * });
2422
+ */
2423
+ }, {
2424
+ key: "addAddTimeProductToBooking",
2425
+ value: (function () {
2426
+ var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(input) {
2427
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2428
+ while (1) switch (_context29.prev = _context29.next) {
2429
+ case 0:
2430
+ return _context29.abrupt("return", this.addAddTimeProductsToBooking({
2431
+ booking: input.booking,
2432
+ products: [input],
2433
+ coveredMinutes: input.coveredMinutes,
2434
+ bookingPatch: input.bookingPatch
2435
+ }));
2436
+ case 1:
2437
+ case "end":
2438
+ return _context29.stop();
2439
+ }
2440
+ }, _callee29, this);
2441
+ }));
2442
+ function addAddTimeProductToBooking(_x20) {
2443
+ return _addAddTimeProductToBooking.apply(this, arguments);
2444
+ }
2445
+ return addAddTimeProductToBooking;
2446
+ }()
2447
+ /**
2448
+ * 批量将加时商品作为独立商品行绑定到已有 booking,并只触发一次购物车重算。
2449
+ *
2450
+ * @example
2451
+ * await bookingTicket.addAddTimeProductsToBooking({
2452
+ * booking,
2453
+ * products: [{ product, product_add_schedule_time: 30 }],
2454
+ * });
2455
+ */
2456
+ )
2457
+ }, {
2458
+ key: "addAddTimeProductsToBooking",
2459
+ value: (function () {
2460
+ var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(input) {
2461
+ var _this7 = this,
2462
+ _input$bookingPatch;
2463
+ var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator, _step, line;
2464
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2465
+ while (1) switch (_context30.prev = _context30.next) {
2466
+ case 0:
2467
+ bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
2468
+ if (bookingUid) {
2469
+ _context30.next = 3;
2470
+ break;
2471
+ }
2472
+ throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
2473
+ case 3:
2474
+ orderLines = (input.products || []).map(function (line) {
2475
+ return {
2476
+ product: _this7.buildAddTimeOrderLine(line, bookingUid)
2477
+ };
2478
+ });
2479
+ if (this.store.order) {
2480
+ _context30.next = 6;
2481
+ break;
2482
+ }
2483
+ throw new Error('order 模块未初始化');
2484
+ case 6:
2485
+ coveredMinutes = normalizeCoveredMinutes(input.coveredMinutes);
2486
+ bookingTimePatch = (_input$bookingPatch = input.bookingPatch) !== null && _input$bookingPatch !== void 0 ? _input$bookingPatch : buildAddTimeBookingTimePatch(input.booking, coveredMinutes);
2487
+ if (bookingTimePatch) {
2488
+ this.store.order.updateOrderBooking({
2489
+ unique_identification_number: bookingUid,
2490
+ updates: bookingTimePatch
2491
+ });
2492
+ }
2493
+ if (!(typeof this.store.order.addProductsToOrder === 'function')) {
2494
+ _context30.next = 11;
2495
+ break;
2496
+ }
2497
+ return _context30.abrupt("return", this.store.order.addProductsToOrder(orderLines, {
2498
+ skipEditDiscountConfigRefresh: true,
2499
+ skipDiscountRecalculation: true
2500
+ }));
2501
+ case 11:
2502
+ result = [];
2503
+ _iterator = _createForOfIteratorHelper(orderLines);
2504
+ _context30.prev = 13;
2505
+ _iterator.s();
2506
+ case 15:
2507
+ if ((_step = _iterator.n()).done) {
2508
+ _context30.next = 29;
2509
+ break;
2510
+ }
2511
+ line = _step.value;
2512
+ _context30.t0 = result.splice;
2513
+ _context30.t1 = result;
2514
+ _context30.t2 = [0, result.length];
2515
+ _context30.t3 = _toConsumableArray;
2516
+ _context30.next = 23;
2517
+ return this.addProductToOrder(line.product);
2518
+ case 23:
2519
+ _context30.t4 = _context30.sent;
2520
+ _context30.t5 = (0, _context30.t3)(_context30.t4);
2521
+ _context30.t6 = _context30.t2.concat.call(_context30.t2, _context30.t5);
2522
+ _context30.t0.apply.call(_context30.t0, _context30.t1, _context30.t6);
2523
+ case 27:
2524
+ _context30.next = 15;
2525
+ break;
2526
+ case 29:
2527
+ _context30.next = 34;
2528
+ break;
2529
+ case 31:
2530
+ _context30.prev = 31;
2531
+ _context30.t7 = _context30["catch"](13);
2532
+ _iterator.e(_context30.t7);
2533
+ case 34:
2534
+ _context30.prev = 34;
2535
+ _iterator.f();
2536
+ return _context30.finish(34);
2537
+ case 37:
2538
+ return _context30.abrupt("return", result);
2539
+ case 38:
2540
+ case "end":
2541
+ return _context30.stop();
2542
+ }
2543
+ }, _callee30, this, [[13, 31, 34, 37]]);
2544
+ }));
2545
+ function addAddTimeProductsToBooking(_x21) {
2546
+ return _addAddTimeProductsToBooking.apply(this, arguments);
2547
+ }
2548
+ return addAddTimeProductsToBooking;
2549
+ }())
2550
+ }, {
2551
+ key: "setOtherParams",
2552
+ value: function () {
2553
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
2554
+ var _ref19,
2555
+ _ref19$cover,
2556
+ cover,
2557
+ _args31 = arguments;
2558
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2559
+ while (1) switch (_context31.prev = _context31.next) {
2560
+ case 0:
2561
+ _ref19 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
2562
+ _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2563
+ cover: cover
2564
+ });
2565
+ if (!(params !== null && params !== void 0 && params.businessCode)) {
2566
+ _context31.next = 5;
2567
+ break;
2568
+ }
2569
+ _context31.next = 5;
2570
+ return this.configureIdGeneratorFromOpenData();
2571
+ case 5:
2572
+ case "end":
2573
+ return _context31.stop();
2574
+ }
2575
+ }, _callee31, this);
2576
+ }));
2577
+ function setOtherParams(_x22) {
2578
+ return _setOtherParams.apply(this, arguments);
2579
+ }
2580
+ return setOtherParams;
2581
+ }()
2222
2582
  /**
2223
2583
  * 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
2224
2584
  * 再清理 BookingTicket 自有资源(scan 监听 + scan 内存缓存)。
@@ -2226,12 +2586,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2226
2586
  }, {
2227
2587
  key: "destroy",
2228
2588
  value: (function () {
2229
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2589
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2230
2590
  var _this$scan;
2231
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2232
- while (1) switch (_context28.prev = _context28.next) {
2591
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2592
+ while (1) switch (_context32.prev = _context32.next) {
2233
2593
  case 0:
2234
- _context28.next = 2;
2594
+ _context32.next = 2;
2235
2595
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
2236
2596
  case 2:
2237
2597
  try {
@@ -2242,9 +2602,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2242
2602
  scanCache.clear();
2243
2603
  case 4:
2244
2604
  case "end":
2245
- return _context28.stop();
2605
+ return _context32.stop();
2246
2606
  }
2247
- }, _callee28, this);
2607
+ }, _callee32, this);
2248
2608
  }));
2249
2609
  function destroy() {
2250
2610
  return _destroy.apply(this, arguments);