@pisell/pisellos 0.10.16 → 0.10.18

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