@pisell/pisellos 0.10.65 → 0.10.67

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.
@@ -51,6 +51,9 @@ import { buildProductOptionStringFromOrderLine } from "../../modules/BookingCont
51
51
  import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
52
52
  import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resolveBestAddTimePlan";
53
53
  import { createUuidV4 } from "../../modules/Order/utils";
54
+ import { extractCustomerContactInfo, isContactRecord } from "../../modules/OpenData/contactInfo";
55
+ import { isCustomerUserPlatform } from "../../utils/platform";
56
+ import { cloneDeep } from 'lodash-es';
54
57
  var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents'];
55
58
  var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
56
59
  var USER_PLATFORM = ['pc', 'h5'];
@@ -182,6 +185,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
182
185
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
183
186
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshTarget", null);
184
187
  _defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
188
+ _defineProperty(_assertThisInitialized(_this), "orderCustomerContactRequest", null);
185
189
  _defineProperty(_assertThisInitialized(_this), "customerResolveRequests", new Map());
186
190
  _defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
187
191
  _defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlightTarget", null);
@@ -452,29 +456,48 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
452
456
  return getOpenData;
453
457
  }()
454
458
  }, {
455
- key: "getInvoiceLayoutConfig",
459
+ key: "loadContactInfoOpenData",
456
460
  value: function () {
457
- var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
458
- var openData;
461
+ var _loadContactInfoOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
459
462
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
460
463
  while (1) switch (_context5.prev = _context5.next) {
461
464
  case 0:
462
- _context5.next = 2;
465
+ return _context5.abrupt("return", this.store.openData ? this.getOpenData() : _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadContactInfoOpenData", this).call(this));
466
+ case 1:
467
+ case "end":
468
+ return _context5.stop();
469
+ }
470
+ }, _callee5, this);
471
+ }));
472
+ function loadContactInfoOpenData() {
473
+ return _loadContactInfoOpenData.apply(this, arguments);
474
+ }
475
+ return loadContactInfoOpenData;
476
+ }()
477
+ }, {
478
+ key: "getInvoiceLayoutConfig",
479
+ value: function () {
480
+ var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
481
+ var openData;
482
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
483
+ while (1) switch (_context6.prev = _context6.next) {
484
+ case 0:
485
+ _context6.next = 2;
463
486
  return this.loadOpenDataConfig();
464
487
  case 2:
465
- openData = _context5.sent;
488
+ openData = _context6.sent;
466
489
  if (openData) {
467
- _context5.next = 5;
490
+ _context6.next = 5;
468
491
  break;
469
492
  }
470
- return _context5.abrupt("return", getDefaultInvoiceLayoutConfig());
493
+ return _context6.abrupt("return", getDefaultInvoiceLayoutConfig());
471
494
  case 5:
472
- return _context5.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
495
+ return _context6.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
473
496
  case 6:
474
497
  case "end":
475
- return _context5.stop();
498
+ return _context6.stop();
476
499
  }
477
- }, _callee5, this);
500
+ }, _callee6, this);
478
501
  }));
479
502
  function getInvoiceLayoutConfig() {
480
503
  return _getInvoiceLayoutConfig.apply(this, arguments);
@@ -484,27 +507,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
484
507
  }, {
485
508
  key: "getInvoiceTemplateSettings",
486
509
  value: function () {
487
- var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
510
+ var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
488
511
  var openData;
489
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
490
- while (1) switch (_context6.prev = _context6.next) {
512
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
513
+ while (1) switch (_context7.prev = _context7.next) {
491
514
  case 0:
492
- _context6.next = 2;
515
+ _context7.next = 2;
493
516
  return this.loadOpenDataConfig();
494
517
  case 2:
495
- openData = _context6.sent;
518
+ openData = _context7.sent;
496
519
  if (openData) {
497
- _context6.next = 5;
520
+ _context7.next = 5;
498
521
  break;
499
522
  }
500
- return _context6.abrupt("return", getDefaultInvoiceTemplateSettings());
523
+ return _context7.abrupt("return", getDefaultInvoiceTemplateSettings());
501
524
  case 5:
502
- return _context6.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
525
+ return _context7.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
503
526
  case 6:
504
527
  case "end":
505
- return _context6.stop();
528
+ return _context7.stop();
506
529
  }
507
- }, _callee6, this);
530
+ }, _callee7, this);
508
531
  }));
509
532
  function getInvoiceTemplateSettings() {
510
533
  return _getInvoiceTemplateSettings.apply(this, arguments);
@@ -534,32 +557,32 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
534
557
  }, {
535
558
  key: "getShortNumberOrDeviceId",
536
559
  value: function () {
537
- var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
560
+ var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
538
561
  var getAsyncIotDeviceInfo, res;
539
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
540
- while (1) switch (_context7.prev = _context7.next) {
562
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
563
+ while (1) switch (_context8.prev = _context8.next) {
541
564
  case 0:
542
565
  getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
543
566
  if (!getAsyncIotDeviceInfo) {
544
- _context7.next = 7;
567
+ _context8.next = 7;
545
568
  break;
546
569
  }
547
- _context7.next = 4;
570
+ _context8.next = 4;
548
571
  return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
549
572
  case 4:
550
- res = _context7.sent;
573
+ res = _context8.sent;
551
574
  if (!(res !== null && res !== void 0 && res.short_number)) {
552
- _context7.next = 7;
575
+ _context8.next = 7;
553
576
  break;
554
577
  }
555
- return _context7.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
578
+ return _context8.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
556
579
  case 7:
557
- return _context7.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
580
+ return _context8.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
558
581
  case 8:
559
582
  case "end":
560
- return _context7.stop();
583
+ return _context8.stop();
561
584
  }
562
- }, _callee7, this);
585
+ }, _callee8, this);
563
586
  }));
564
587
  function getShortNumberOrDeviceId() {
565
588
  return _getShortNumberOrDeviceId.apply(this, arguments);
@@ -569,35 +592,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
569
592
  }, {
570
593
  key: "configureIdGeneratorFromOpenData",
571
594
  value: function () {
572
- var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
595
+ var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
573
596
  var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
574
597
  var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
575
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
576
- while (1) switch (_context8.prev = _context8.next) {
598
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
599
+ while (1) switch (_context9.prev = _context9.next) {
577
600
  case 0:
578
601
  // 业务码切换或配置失败时不能复用上一次初始化的短号。
579
602
  this.setPaymentNumberDevicePrefix(null);
580
603
  idGenerator = this.getIdGeneratorPlugin();
581
604
  if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
582
- _context8.next = 5;
605
+ _context9.next = 5;
583
606
  break;
584
607
  }
585
608
  console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
586
- return _context8.abrupt("return");
609
+ return _context9.abrupt("return");
587
610
  case 5:
588
611
  openDataConfig = null;
589
- _context8.prev = 6;
590
- _context8.next = 9;
612
+ _context9.prev = 6;
613
+ _context9.next = 9;
591
614
  return this.loadOpenDataConfig();
592
615
  case 9:
593
- openDataConfig = _context8.sent;
594
- _context8.next = 16;
616
+ openDataConfig = _context9.sent;
617
+ _context9.next = 16;
595
618
  break;
596
619
  case 12:
597
- _context8.prev = 12;
598
- _context8.t0 = _context8["catch"](6);
599
- console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context8.t0);
600
- return _context8.abrupt("return");
620
+ _context9.prev = 12;
621
+ _context9.t0 = _context9["catch"](6);
622
+ console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context9.t0);
623
+ return _context9.abrupt("return");
601
624
  case 16:
602
625
  // if (!openDataConfig) return;
603
626
  receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
@@ -609,21 +632,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
609
632
  "type": "start_time",
610
633
  "time": "00:00"
611
634
  };
612
- _context8.next = 24;
635
+ _context9.next = 24;
613
636
  return this.getShortNumberOrDeviceId();
614
637
  case 24:
615
- deviceId = _context8.sent;
638
+ deviceId = _context9.sent;
616
639
  this.setPaymentNumberDevicePrefix(deviceId);
617
640
  businessCode = this.getBookingTicketBusinessCode();
618
641
  if (businessCode) {
619
- _context8.next = 30;
642
+ _context9.next = 30;
620
643
  break;
621
644
  }
622
645
  console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
623
- return _context8.abrupt("return");
646
+ return _context9.abrupt("return");
624
647
  case 30:
625
- _context8.prev = 30;
626
- _context8.next = 33;
648
+ _context9.prev = 30;
649
+ _context9.next = 33;
627
650
  return idGenerator.configure({
628
651
  biz: businessCode,
629
652
  config: {
@@ -639,17 +662,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
639
662
  }
640
663
  });
641
664
  case 33:
642
- _context8.next = 38;
665
+ _context9.next = 38;
643
666
  break;
644
667
  case 35:
645
- _context8.prev = 35;
646
- _context8.t1 = _context8["catch"](30);
647
- console.warn('[BookingTicket] idGenerator 配置失败', _context8.t1);
668
+ _context9.prev = 35;
669
+ _context9.t1 = _context9["catch"](30);
670
+ console.warn('[BookingTicket] idGenerator 配置失败', _context9.t1);
648
671
  case 38:
649
672
  case "end":
650
- return _context8.stop();
673
+ return _context9.stop();
651
674
  }
652
- }, _callee8, this, [[6, 12], [30, 35]]);
675
+ }, _callee9, this, [[6, 12], [30, 35]]);
653
676
  }));
654
677
  function configureIdGeneratorFromOpenData() {
655
678
  return _configureIdGeneratorFromOpenData.apply(this, arguments);
@@ -681,16 +704,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
681
704
  }, {
682
705
  key: "loadSalesDetail",
683
706
  value: (function () {
684
- var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(orderIdOrParams) {
707
+ var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(orderIdOrParams) {
685
708
  var _ref3;
686
709
  var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref4, detailCustomerId, detailCustomerRest, rawId, customer;
687
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
688
- while (1) switch (_context9.prev = _context9.next) {
710
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
711
+ while (1) switch (_context10.prev = _context10.next) {
689
712
  case 0:
690
- _context9.next = 2;
713
+ _context10.next = 2;
691
714
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
692
715
  case 2:
693
- sales = _context9.sent;
716
+ sales = _context10.sent;
694
717
  customerModule = this.store.customer;
695
718
  detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
696
719
  orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
@@ -722,12 +745,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
722
745
  });
723
746
  // await this.store.order.saveDraft();
724
747
  }
725
- return _context9.abrupt("return", sales);
748
+ return _context10.abrupt("return", sales);
726
749
  case 11:
727
750
  case "end":
728
- return _context9.stop();
751
+ return _context10.stop();
729
752
  }
730
- }, _callee9, this);
753
+ }, _callee10, this);
731
754
  }));
732
755
  function loadSalesDetail(_x3) {
733
756
  return _loadSalesDetail.apply(this, arguments);
@@ -737,56 +760,56 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
737
760
  }, {
738
761
  key: "scanPromotionCode",
739
762
  value: function () {
740
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(code, customerId) {
763
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(code, customerId) {
741
764
  var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
742
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
743
- while (1) switch (_context10.prev = _context10.next) {
765
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
766
+ while (1) switch (_context11.prev = _context11.next) {
744
767
  case 0:
745
768
  if (this.store.order) {
746
- _context10.next = 2;
769
+ _context11.next = 2;
747
770
  break;
748
771
  }
749
772
  throw new Error('order 模块未初始化');
750
773
  case 2:
751
- _context10.next = 4;
774
+ _context11.next = 4;
752
775
  return this.store.order.scanCode(code, customerId);
753
776
  case 4:
754
- raw = _context10.sent;
777
+ raw = _context11.sent;
755
778
  scannedList = raw.scannedDiscountList || [];
756
779
  extractedCustomerId = this.getDiscountCustomerId(scannedList);
757
780
  hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
758
781
  isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
759
782
  if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
760
- _context10.next = 18;
783
+ _context11.next = 18;
761
784
  break;
762
785
  }
763
- _context10.prev = 10;
764
- _context10.next = 13;
786
+ _context11.prev = 10;
787
+ _context11.next = 13;
765
788
  return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
766
789
  case 13:
767
- _context10.next = 18;
790
+ _context11.next = 18;
768
791
  break;
769
792
  case 15:
770
- _context10.prev = 15;
771
- _context10.t0 = _context10["catch"](10);
793
+ _context11.prev = 15;
794
+ _context11.t0 = _context11["catch"](10);
772
795
  // 客户映射失败不能阻断原有 Pass 的可用性、展示或优惠处理。
773
796
  console.warn('[BookingTicket] scan discount customer resolve failed', {
774
797
  customerId: extractedCustomerId,
775
- error: _context10.t0
798
+ error: _context11.t0
776
799
  });
777
800
  case 18:
778
801
  if (!raw.isAvailable) {
779
- _context10.next = 25;
802
+ _context11.next = 25;
780
803
  break;
781
804
  }
782
- _context10.next = 21;
805
+ _context11.next = 21;
783
806
  return this.store.order.recalculateSummary({
784
807
  createIfMissing: true
785
808
  });
786
809
  case 21:
787
810
  this.store.order.persistTempOrder();
788
811
  tempOrder = this.store.order.ensureTempOrder();
789
- _context10.next = 25;
812
+ _context11.next = 25;
790
813
  return this.effectsEmit('onDiscountApplied', {
791
814
  productList: tempOrder.products || [],
792
815
  discountList: this.store.order.getDiscountList(),
@@ -794,7 +817,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
794
817
  tempOrder: tempOrder
795
818
  });
796
819
  case 25:
797
- return _context10.abrupt("return", _objectSpread(_objectSpread({
820
+ return _context11.abrupt("return", _objectSpread(_objectSpread({
798
821
  isAvailable: raw.isAvailable
799
822
  }, raw.isAccepted !== undefined ? {
800
823
  isAccepted: raw.isAccepted
@@ -805,9 +828,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
805
828
  }));
806
829
  case 26:
807
830
  case "end":
808
- return _context10.stop();
831
+ return _context11.stop();
809
832
  }
810
- }, _callee10, this, [[10, 15]]);
833
+ }, _callee11, this, [[10, 15]]);
811
834
  }));
812
835
  function scanPromotionCode(_x4, _x5) {
813
836
  return _scanPromotionCode.apply(this, arguments);
@@ -817,42 +840,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
817
840
  }, {
818
841
  key: "hydrateOrderCustomerFromScanDiscounts",
819
842
  value: function () {
820
- var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(discounts) {
843
+ var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(discounts) {
821
844
  var currentOrderCustomer, customerId, customer;
822
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
823
- while (1) switch (_context11.prev = _context11.next) {
845
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
846
+ while (1) switch (_context12.prev = _context12.next) {
824
847
  case 0:
825
848
  currentOrderCustomer = this.store.order.getOrderCustomer();
826
849
  if (!currentOrderCustomer) {
827
- _context11.next = 3;
850
+ _context12.next = 3;
828
851
  break;
829
852
  }
830
- return _context11.abrupt("return");
853
+ return _context12.abrupt("return");
831
854
  case 3:
832
855
  customerId = this.getDiscountCustomerId(discounts);
833
856
  if (customerId) {
834
- _context11.next = 6;
857
+ _context12.next = 6;
835
858
  break;
836
859
  }
837
- return _context11.abrupt("return");
860
+ return _context12.abrupt("return");
838
861
  case 6:
839
- _context11.next = 8;
862
+ _context12.next = 8;
840
863
  return this.resolveCustomerByDiscountCustomerId(customerId);
841
864
  case 8:
842
- customer = _context11.sent;
865
+ customer = _context12.sent;
843
866
  if (customer) {
844
- _context11.next = 11;
867
+ _context12.next = 11;
845
868
  break;
846
869
  }
847
- return _context11.abrupt("return");
870
+ return _context12.abrupt("return");
848
871
  case 11:
849
872
  this.store.customer.setSelectedCustomer(customer);
850
873
  this.setOrderCustomer(customer);
851
874
  case 13:
852
875
  case "end":
853
- return _context11.stop();
876
+ return _context12.stop();
854
877
  }
855
- }, _callee11, this);
878
+ }, _callee12, this);
856
879
  }));
857
880
  function hydrateOrderCustomerFromScanDiscounts(_x6) {
858
881
  return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
@@ -888,27 +911,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
888
911
  }, {
889
912
  key: "resolveCustomerById",
890
913
  value: function () {
891
- var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(customerId) {
914
+ var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(customerId) {
892
915
  var _this2 = this;
893
916
  var rawCustomerId, numericCustomerId, normalizedCustomerId, existingRequest, request;
894
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
895
- while (1) switch (_context12.prev = _context12.next) {
917
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
918
+ while (1) switch (_context13.prev = _context13.next) {
896
919
  case 0:
897
920
  rawCustomerId = String(customerId !== null && customerId !== void 0 ? customerId : '').trim();
898
921
  numericCustomerId = Number(rawCustomerId);
899
922
  if (!(!rawCustomerId || !Number.isInteger(numericCustomerId) || numericCustomerId <= 1)) {
900
- _context12.next = 4;
923
+ _context13.next = 4;
901
924
  break;
902
925
  }
903
- return _context12.abrupt("return", null);
926
+ return _context13.abrupt("return", null);
904
927
  case 4:
905
928
  normalizedCustomerId = String(numericCustomerId);
906
929
  existingRequest = this.customerResolveRequests.get(normalizedCustomerId);
907
930
  if (!existingRequest) {
908
- _context12.next = 8;
931
+ _context13.next = 8;
909
932
  break;
910
933
  }
911
- return _context12.abrupt("return", existingRequest);
934
+ return _context13.abrupt("return", existingRequest);
912
935
  case 8:
913
936
  request = this.request.post("/customer/resolve/".concat(encodeURIComponent(normalizedCustomerId)), {
914
937
  with_franchisor_data: 1,
@@ -928,12 +951,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
928
951
  }
929
952
  });
930
953
  this.customerResolveRequests.set(normalizedCustomerId, request);
931
- return _context12.abrupt("return", request);
954
+ return _context13.abrupt("return", request);
932
955
  case 11:
933
956
  case "end":
934
- return _context12.stop();
957
+ return _context13.stop();
935
958
  }
936
- }, _callee12, this);
959
+ }, _callee13, this);
937
960
  }));
938
961
  function resolveCustomerById(_x7) {
939
962
  return _resolveCustomerById.apply(this, arguments);
@@ -985,60 +1008,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
985
1008
  }, {
986
1009
  key: "setBookingStatus",
987
1010
  value: (function () {
988
- var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(status) {
1011
+ var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(status) {
989
1012
  var _this$store$order2, _this$store$order2$ge;
990
1013
  var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
991
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
992
- while (1) switch (_context13.prev = _context13.next) {
1014
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1015
+ while (1) switch (_context14.prev = _context14.next) {
993
1016
  case 0:
994
1017
  tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$ge = _this$store$order2.getTempOrder) === null || _this$store$order2$ge === void 0 ? void 0 : _this$store$order2$ge.call(_this$store$order2);
995
1018
  if (tempOrder) {
996
- _context13.next = 3;
1019
+ _context14.next = 3;
997
1020
  break;
998
1021
  }
999
1022
  throw new Error('setBookingStatus: tempOrder 未加载');
1000
1023
  case 3:
1001
1024
  orderId = tempOrder.order_id;
1002
1025
  if (!(orderId === undefined || orderId === null)) {
1003
- _context13.next = 6;
1026
+ _context14.next = 6;
1004
1027
  break;
1005
1028
  }
1006
1029
  throw new Error('setBookingStatus: tempOrder.order_id 缺失');
1007
1030
  case 6:
1008
1031
  scheduleId = resolveScheduleId(tempOrder);
1009
1032
  if (!(scheduleId === null)) {
1010
- _context13.next = 9;
1033
+ _context14.next = 9;
1011
1034
  break;
1012
1035
  }
1013
1036
  throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
1014
1037
  case 9:
1015
1038
  bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
1016
1039
  previous = applyBookingsStatus(bookings, status);
1017
- _context13.prev = 11;
1018
- _context13.next = 14;
1040
+ _context14.prev = 11;
1041
+ _context14.next = 14;
1019
1042
  return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
1020
1043
  appointment_status: status
1021
1044
  });
1022
1045
  case 14:
1023
- res = _context13.sent;
1024
- _context13.next = 17;
1046
+ res = _context14.sent;
1047
+ _context14.next = 17;
1025
1048
  return this.refreshSalesDetail();
1026
1049
  case 17:
1027
1050
  this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
1028
1051
  orderId: orderId,
1029
1052
  status: status
1030
1053
  });
1031
- return _context13.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
1054
+ return _context14.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
1032
1055
  case 21:
1033
- _context13.prev = 21;
1034
- _context13.t0 = _context13["catch"](11);
1056
+ _context14.prev = 21;
1057
+ _context14.t0 = _context14["catch"](11);
1035
1058
  restoreBookingsStatus(bookings, previous);
1036
- throw _context13.t0;
1059
+ throw _context14.t0;
1037
1060
  case 25:
1038
1061
  case "end":
1039
- return _context13.stop();
1062
+ return _context14.stop();
1040
1063
  }
1041
- }, _callee13, this, [[11, 21]]);
1064
+ }, _callee14, this, [[11, 21]]);
1042
1065
  }));
1043
1066
  function setBookingStatus(_x8) {
1044
1067
  return _setBookingStatus.apply(this, arguments);
@@ -1069,35 +1092,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1069
1092
  }, {
1070
1093
  key: "transitionChildBooking",
1071
1094
  value: (function () {
1072
- var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
1095
+ var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1073
1096
  var _this$store$order3, _this$store$order3$ge;
1074
1097
  var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
1075
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1076
- while (1) switch (_context14.prev = _context14.next) {
1098
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1099
+ while (1) switch (_context15.prev = _context15.next) {
1077
1100
  case 0:
1078
1101
  schedule_event_id = params.schedule_event_id, action = params.action;
1079
1102
  if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
1080
- _context14.next = 3;
1103
+ _context15.next = 3;
1081
1104
  break;
1082
1105
  }
1083
1106
  throw new Error('transitionChildBooking: schedule_event_id 不能为空');
1084
1107
  case 3:
1085
1108
  if (action) {
1086
- _context14.next = 5;
1109
+ _context15.next = 5;
1087
1110
  break;
1088
1111
  }
1089
1112
  throw new Error('transitionChildBooking: action 不能为空');
1090
1113
  case 5:
1091
1114
  tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getTempOrder) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
1092
1115
  if (tempOrder) {
1093
- _context14.next = 8;
1116
+ _context15.next = 8;
1094
1117
  break;
1095
1118
  }
1096
1119
  throw new Error('transitionChildBooking: tempOrder 未加载');
1097
1120
  case 8:
1098
1121
  orderId = tempOrder.order_id;
1099
1122
  if (!(orderId === undefined || orderId === null)) {
1100
- _context14.next = 11;
1123
+ _context15.next = 11;
1101
1124
  break;
1102
1125
  }
1103
1126
  throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
@@ -1105,14 +1128,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1105
1128
  bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
1106
1129
  targetStatus = resolveStatusAfterTransition(action);
1107
1130
  previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
1108
- _context14.prev = 14;
1109
- _context14.next = 17;
1131
+ _context15.prev = 14;
1132
+ _context15.next = 17;
1110
1133
  return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
1111
1134
  action: action
1112
1135
  });
1113
1136
  case 17:
1114
- res = _context14.sent;
1115
- _context14.next = 20;
1137
+ res = _context15.sent;
1138
+ _context15.next = 20;
1116
1139
  return this.refreshSalesDetail();
1117
1140
  case 20:
1118
1141
  this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
@@ -1121,19 +1144,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1121
1144
  action: action,
1122
1145
  status: targetStatus
1123
1146
  });
1124
- return _context14.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
1147
+ return _context15.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
1125
1148
  case 24:
1126
- _context14.prev = 24;
1127
- _context14.t0 = _context14["catch"](14);
1149
+ _context15.prev = 24;
1150
+ _context15.t0 = _context15["catch"](14);
1128
1151
  if (previous !== undefined) {
1129
1152
  restoreChildBookingStatus(bookings, schedule_event_id, previous);
1130
1153
  }
1131
- throw _context14.t0;
1154
+ throw _context15.t0;
1132
1155
  case 28:
1133
1156
  case "end":
1134
- return _context14.stop();
1157
+ return _context15.stop();
1135
1158
  }
1136
- }, _callee14, this, [[14, 24]]);
1159
+ }, _callee15, this, [[14, 24]]);
1137
1160
  }));
1138
1161
  function transitionChildBooking(_x9) {
1139
1162
  return _transitionChildBooking.apply(this, arguments);
@@ -1154,19 +1177,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1154
1177
  }, {
1155
1178
  key: "refreshSalesDetail",
1156
1179
  value: (function () {
1157
- var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1180
+ var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1158
1181
  var _this$store$order4, _this$store$order4$ge;
1159
1182
  var params,
1160
1183
  tempOrder,
1161
1184
  orderId,
1162
- _args15 = arguments;
1163
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1164
- while (1) switch (_context15.prev = _context15.next) {
1185
+ _args16 = arguments;
1186
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1187
+ while (1) switch (_context16.prev = _context16.next) {
1165
1188
  case 0:
1166
- params = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
1189
+ params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
1167
1190
  tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || (_this$store$order4$ge = _this$store$order4.getTempOrder) === null || _this$store$order4$ge === void 0 ? void 0 : _this$store$order4$ge.call(_this$store$order4);
1168
1191
  if (tempOrder) {
1169
- _context15.next = 4;
1192
+ _context16.next = 4;
1170
1193
  break;
1171
1194
  }
1172
1195
  throw new Error('refreshSalesDetail: tempOrder 未加载');
@@ -1174,21 +1197,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1174
1197
  debugger;
1175
1198
  orderId = tempOrder.order_id || tempOrder.external_sale_number;
1176
1199
  if (!(orderId === undefined || orderId === null)) {
1177
- _context15.next = 8;
1200
+ _context16.next = 8;
1178
1201
  break;
1179
1202
  }
1180
- return _context15.abrupt("return", {});
1203
+ return _context16.abrupt("return", {});
1181
1204
  case 8:
1182
- return _context15.abrupt("return", this.loadSalesDetail({
1205
+ return _context16.abrupt("return", this.loadSalesDetail({
1183
1206
  orderId: orderId,
1184
1207
  // merge: true
1185
1208
  forceRemote: params.forceRemote
1186
1209
  }));
1187
1210
  case 9:
1188
1211
  case "end":
1189
- return _context15.stop();
1212
+ return _context16.stop();
1190
1213
  }
1191
- }, _callee15, this);
1214
+ }, _callee16, this);
1192
1215
  }));
1193
1216
  function refreshSalesDetail() {
1194
1217
  return _refreshSalesDetail.apply(this, arguments);
@@ -1204,7 +1227,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1204
1227
  }, {
1205
1228
  key: "loadProducts",
1206
1229
  value: (function () {
1207
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1230
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1208
1231
  var params,
1209
1232
  options,
1210
1233
  schedule_date,
@@ -1213,20 +1236,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1213
1236
  schedule_datetime,
1214
1237
  bookingDate,
1215
1238
  _result,
1216
- _args16 = arguments;
1217
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1218
- while (1) switch (_context16.prev = _context16.next) {
1239
+ _args17 = arguments;
1240
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1241
+ while (1) switch (_context17.prev = _context17.next) {
1219
1242
  case 0:
1220
- params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
1221
- options = _args16.length > 1 ? _args16[1] : undefined;
1243
+ params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
1244
+ options = _args17.length > 1 ? _args17[1] : undefined;
1222
1245
  schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime; // 优先写入 schedule_datetime(含时分),供加购 presetStartTime 与 TimeBar 对齐;
1223
1246
  // requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
1224
1247
  bookingDate = schedule_datetime || schedule_date || '';
1225
1248
  if (bookingDate) {
1226
1249
  this.setBookingDate(bookingDate);
1227
1250
  }
1228
- _context16.prev = 5;
1229
- _context16.next = 8;
1251
+ _context17.prev = 5;
1252
+ _context17.next = 8;
1230
1253
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
1231
1254
  with_count: ['bundleGroup', 'optionGroup'],
1232
1255
  with_schedule: 1
@@ -1234,20 +1257,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1234
1257
  cacheId: this.cacheId
1235
1258
  }), options);
1236
1259
  case 8:
1237
- _result = _context16.sent;
1260
+ _result = _context17.sent;
1238
1261
  this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
1239
1262
  this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
1240
- return _context16.abrupt("return", _result);
1263
+ return _context17.abrupt("return", _result);
1241
1264
  case 14:
1242
- _context16.prev = 14;
1243
- _context16.t0 = _context16["catch"](5);
1244
- console.error('Failed to load products:', _context16.t0);
1245
- throw _context16.t0;
1265
+ _context17.prev = 14;
1266
+ _context17.t0 = _context17["catch"](5);
1267
+ console.error('Failed to load products:', _context17.t0);
1268
+ throw _context17.t0;
1246
1269
  case 18:
1247
1270
  case "end":
1248
- return _context16.stop();
1271
+ return _context17.stop();
1249
1272
  }
1250
- }, _callee16, this, [[5, 14]]);
1273
+ }, _callee17, this, [[5, 14]]);
1251
1274
  }));
1252
1275
  function loadProducts() {
1253
1276
  return _loadProducts.apply(this, arguments);
@@ -1264,27 +1287,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1264
1287
  }, {
1265
1288
  key: "getAddTimeProducts",
1266
1289
  value: (function () {
1267
- var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1290
+ var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1268
1291
  var params,
1269
1292
  result,
1270
- _args17 = arguments;
1271
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1272
- while (1) switch (_context17.prev = _context17.next) {
1293
+ _args18 = arguments;
1294
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1295
+ while (1) switch (_context18.prev = _context18.next) {
1273
1296
  case 0:
1274
- params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
1275
- _context17.next = 3;
1297
+ params = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
1298
+ _context18.next = 3;
1276
1299
  return this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
1277
1300
  cacheId: this.cacheId
1278
1301
  }));
1279
1302
  case 3:
1280
- result = _context17.sent;
1303
+ result = _context18.sent;
1281
1304
  this.addTimeProductsCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
1282
- return _context17.abrupt("return", result);
1305
+ return _context18.abrupt("return", result);
1283
1306
  case 6:
1284
1307
  case "end":
1285
- return _context17.stop();
1308
+ return _context18.stop();
1286
1309
  }
1287
- }, _callee17, this);
1310
+ }, _callee18, this);
1288
1311
  }));
1289
1312
  function getAddTimeProducts() {
1290
1313
  return _getAddTimeProducts.apply(this, arguments);
@@ -1309,14 +1332,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1309
1332
  }, {
1310
1333
  key: "queryProductDetail",
1311
1334
  value: (function () {
1312
- var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params, options) {
1335
+ var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params, options) {
1313
1336
  var product_id, queryParams, _result2, list;
1314
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1315
- while (1) switch (_context18.prev = _context18.next) {
1337
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1338
+ while (1) switch (_context19.prev = _context19.next) {
1316
1339
  case 0:
1317
1340
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
1318
- _context18.prev = 1;
1319
- _context18.next = 4;
1341
+ _context19.prev = 1;
1342
+ _context19.next = 4;
1320
1343
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
1321
1344
  with_count: ['bundleGroup', 'optionGroup'],
1322
1345
  with_schedule: 1
@@ -1325,21 +1348,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1325
1348
  cacheId: this.cacheId
1326
1349
  }), options);
1327
1350
  case 4:
1328
- _result2 = _context18.sent;
1351
+ _result2 = _context19.sent;
1329
1352
  list = Array.isArray(_result2) ? _result2 : [];
1330
- return _context18.abrupt("return", list.find(function (product) {
1353
+ return _context19.abrupt("return", list.find(function (product) {
1331
1354
  return Number(product.id) === Number(product_id);
1332
1355
  }));
1333
1356
  case 9:
1334
- _context18.prev = 9;
1335
- _context18.t0 = _context18["catch"](1);
1336
- console.error('Failed to query product detail:', _context18.t0);
1337
- throw _context18.t0;
1357
+ _context19.prev = 9;
1358
+ _context19.t0 = _context19["catch"](1);
1359
+ console.error('Failed to query product detail:', _context19.t0);
1360
+ throw _context19.t0;
1338
1361
  case 13:
1339
1362
  case "end":
1340
- return _context18.stop();
1363
+ return _context19.stop();
1341
1364
  }
1342
- }, _callee18, this, [[1, 9]]);
1365
+ }, _callee19, this, [[1, 9]]);
1343
1366
  }));
1344
1367
  function queryProductDetail(_x10, _x11) {
1345
1368
  return _queryProductDetail.apply(this, arguments);
@@ -1354,26 +1377,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1354
1377
  }, {
1355
1378
  key: "loadProductDetail",
1356
1379
  value: (function () {
1357
- var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params, options) {
1380
+ var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params, options) {
1358
1381
  var product_id, queryParams, products;
1359
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1360
- while (1) switch (_context19.prev = _context19.next) {
1382
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1383
+ while (1) switch (_context20.prev = _context20.next) {
1361
1384
  case 0:
1362
1385
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
1363
- _context19.next = 3;
1386
+ _context20.next = 3;
1364
1387
  return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
1365
1388
  product_ids: [product_id]
1366
1389
  }), options);
1367
1390
  case 3:
1368
- products = _context19.sent;
1369
- return _context19.abrupt("return", products.find(function (product) {
1391
+ products = _context20.sent;
1392
+ return _context20.abrupt("return", products.find(function (product) {
1370
1393
  return Number(product.id) === Number(product_id);
1371
1394
  }));
1372
1395
  case 5:
1373
1396
  case "end":
1374
- return _context19.stop();
1397
+ return _context20.stop();
1375
1398
  }
1376
- }, _callee19, this);
1399
+ }, _callee20, this);
1377
1400
  }));
1378
1401
  function loadProductDetail(_x12, _x13) {
1379
1402
  return _loadProductDetail.apply(this, arguments);
@@ -1408,16 +1431,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1408
1431
  }, {
1409
1432
  key: "getProducts",
1410
1433
  value: (function () {
1411
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1412
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1413
- while (1) switch (_context20.prev = _context20.next) {
1434
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1435
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1436
+ while (1) switch (_context21.prev = _context21.next) {
1414
1437
  case 0:
1415
- return _context20.abrupt("return", this.store.products.getProducts());
1438
+ return _context21.abrupt("return", this.store.products.getProducts());
1416
1439
  case 1:
1417
1440
  case "end":
1418
- return _context20.stop();
1441
+ return _context21.stop();
1419
1442
  }
1420
- }, _callee20, this);
1443
+ }, _callee21, this);
1421
1444
  }));
1422
1445
  function getProducts() {
1423
1446
  return _getProducts.apply(this, arguments);
@@ -1482,33 +1505,33 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1482
1505
  }, {
1483
1506
  key: "getProductByIds",
1484
1507
  value: (function () {
1485
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(ids, options) {
1508
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(ids, options) {
1486
1509
  var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
1487
1510
  var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
1488
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1489
- while (1) switch (_context21.prev = _context21.next) {
1511
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1512
+ while (1) switch (_context22.prev = _context22.next) {
1490
1513
  case 0:
1491
1514
  normalizedIds = Array.from(new Set((ids || []).map(function (id) {
1492
1515
  return Number(id);
1493
1516
  }).filter(function (id) {
1494
1517
  return Number.isFinite(id);
1495
1518
  })));
1496
- _context21.next = 3;
1519
+ _context22.next = 3;
1497
1520
  return this.store.products.getProductByIds(normalizedIds);
1498
1521
  case 3:
1499
- _context21.t0 = _context21.sent;
1500
- if (_context21.t0) {
1501
- _context21.next = 6;
1522
+ _context22.t0 = _context22.sent;
1523
+ if (_context22.t0) {
1524
+ _context22.next = 6;
1502
1525
  break;
1503
1526
  }
1504
- _context21.t0 = [];
1527
+ _context22.t0 = [];
1505
1528
  case 6:
1506
- localProducts = _context21.t0;
1529
+ localProducts = _context22.t0;
1507
1530
  if (options !== null && options !== void 0 && options.loadMissing) {
1508
- _context21.next = 9;
1531
+ _context22.next = 9;
1509
1532
  break;
1510
1533
  }
1511
- return _context21.abrupt("return", localProducts);
1534
+ return _context22.abrupt("return", localProducts);
1512
1535
  case 9:
1513
1536
  localProductIds = new Set(localProducts.map(function (product) {
1514
1537
  return Number(product.id);
@@ -1517,15 +1540,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1517
1540
  return !localProductIds.has(id);
1518
1541
  });
1519
1542
  if (missingIds.length) {
1520
- _context21.next = 13;
1543
+ _context22.next = 13;
1521
1544
  break;
1522
1545
  }
1523
- return _context21.abrupt("return", localProducts);
1546
+ return _context22.abrupt("return", localProducts);
1524
1547
  case 13:
1525
1548
  rawBookingDate = this.getBookingDate();
1526
1549
  bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
1527
1550
  customerId = Number((_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$getOrderCustome3 = this.getOrderCustomer()) === null || _this$getOrderCustome3 === void 0 ? void 0 : _this$getOrderCustome3.customer_id);
1528
- _context21.next = 18;
1551
+ _context22.next = 18;
1529
1552
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
1530
1553
  product_ids: missingIds,
1531
1554
  with_count: ['bundleGroup', 'optionGroup'],
@@ -1538,7 +1561,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1538
1561
  customer_id: customerId
1539
1562
  } : {}));
1540
1563
  case 18:
1541
- loadedProducts = _context21.sent;
1564
+ loadedProducts = _context22.sent;
1542
1565
  productById = new Map();
1543
1566
  [].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
1544
1567
  var productId = Number(product.id);
@@ -1546,16 +1569,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1546
1569
  productById.set(productId, product);
1547
1570
  }
1548
1571
  });
1549
- return _context21.abrupt("return", normalizedIds.map(function (id) {
1572
+ return _context22.abrupt("return", normalizedIds.map(function (id) {
1550
1573
  return productById.get(id);
1551
1574
  }).filter(function (product) {
1552
1575
  return Boolean(product);
1553
1576
  }));
1554
1577
  case 22:
1555
1578
  case "end":
1556
- return _context21.stop();
1579
+ return _context22.stop();
1557
1580
  }
1558
- }, _callee21, this);
1581
+ }, _callee22, this);
1559
1582
  }));
1560
1583
  function getProductByIds(_x14, _x15) {
1561
1584
  return _getProductByIds.apply(this, arguments);
@@ -1571,25 +1594,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1571
1594
  }, {
1572
1595
  key: "getScheduleTimePoints",
1573
1596
  value: (function () {
1574
- var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
1597
+ var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
1575
1598
  var result;
1576
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1577
- while (1) switch (_context22.prev = _context22.next) {
1599
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1600
+ while (1) switch (_context23.prev = _context23.next) {
1578
1601
  case 0:
1579
- _context22.next = 2;
1602
+ _context23.next = 2;
1580
1603
  return this.request.post('/menu/schedule-time-points', {
1581
1604
  menu_list_ids: params.menu_list_ids
1582
1605
  }, {
1583
1606
  osServer: true
1584
1607
  });
1585
1608
  case 2:
1586
- result = _context22.sent;
1587
- return _context22.abrupt("return", result.data || []);
1609
+ result = _context23.sent;
1610
+ return _context23.abrupt("return", result.data || []);
1588
1611
  case 4:
1589
1612
  case "end":
1590
- return _context22.stop();
1613
+ return _context23.stop();
1591
1614
  }
1592
- }, _callee22, this);
1615
+ }, _callee23, this);
1593
1616
  }));
1594
1617
  function getScheduleTimePoints(_x16) {
1595
1618
  return _getScheduleTimePoints.apply(this, arguments);
@@ -1605,30 +1628,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1605
1628
  }, {
1606
1629
  key: "getCustomerList",
1607
1630
  value: (function () {
1608
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1631
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1609
1632
  var params,
1610
1633
  _result3,
1611
- _args23 = arguments;
1612
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1613
- while (1) switch (_context23.prev = _context23.next) {
1634
+ _args24 = arguments;
1635
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1636
+ while (1) switch (_context24.prev = _context24.next) {
1614
1637
  case 0:
1615
- params = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
1616
- _context23.prev = 1;
1617
- _context23.next = 4;
1638
+ params = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
1639
+ _context24.prev = 1;
1640
+ _context24.next = 4;
1618
1641
  return this.store.customer.getCustomerList(params);
1619
1642
  case 4:
1620
- _result3 = _context23.sent;
1621
- return _context23.abrupt("return", _result3);
1643
+ _result3 = _context24.sent;
1644
+ return _context24.abrupt("return", _result3);
1622
1645
  case 8:
1623
- _context23.prev = 8;
1624
- _context23.t0 = _context23["catch"](1);
1625
- console.error('Failed to get customer list:', _context23.t0);
1626
- throw _context23.t0;
1646
+ _context24.prev = 8;
1647
+ _context24.t0 = _context24["catch"](1);
1648
+ console.error('Failed to get customer list:', _context24.t0);
1649
+ throw _context24.t0;
1627
1650
  case 12:
1628
1651
  case "end":
1629
- return _context23.stop();
1652
+ return _context24.stop();
1630
1653
  }
1631
- }, _callee23, this, [[1, 8]]);
1654
+ }, _callee24, this, [[1, 8]]);
1632
1655
  }));
1633
1656
  function getCustomerList() {
1634
1657
  return _getCustomerList.apply(this, arguments);
@@ -1738,7 +1761,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1738
1761
  var _this$store$order$get3,
1739
1762
  _this3 = this;
1740
1763
  if (!customer) {
1741
- this.clearOrderCustomer();
1764
+ this.clearOrderCustomer({
1765
+ preserveContactInfo: (options === null || options === void 0 ? void 0 : options.source) === 'detailHydrate'
1766
+ });
1742
1767
  return;
1743
1768
  }
1744
1769
  var previousCustomerId = (_this$store$order$get3 = this.store.order.getOrderCustomer()) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.customer_id;
@@ -1749,7 +1774,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1749
1774
  this.discountConfigCacheKey = null;
1750
1775
  this.hasManualDiscountSelection = false;
1751
1776
  }
1777
+ if (!customerUnchanged && (options === null || options === void 0 ? void 0 : options.source) !== 'detailHydrate') {
1778
+ this.resetOrderCustomerContactInfo();
1779
+ this.store.order.updateTempOrderContactsInfo(cloneDeep(extractCustomerContactInfo(customer)));
1780
+ }
1752
1781
  this.store.order.setOrderCustomer(patch, customer);
1782
+ if ((options === null || options === void 0 ? void 0 : options.source) === 'detailHydrate') {
1783
+ this.orderCustomerContactRequest = null;
1784
+ } else {
1785
+ this.prefillOrderCustomerContactInfo(customer, !customerUnchanged);
1786
+ }
1753
1787
  var snapshotAfterOrderSet = this.store.order.getOrderCustomerSnapshot();
1754
1788
  if (customerUnchanged) {
1755
1789
  // hydrate 后 customer_id 已存在但 _extend.customerSnapshot 仍为空时,
@@ -1782,7 +1816,242 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1782
1816
  _this3.orderCustomerPromotionRefreshInFlight = null;
1783
1817
  });
1784
1818
  }
1819
+ }, {
1820
+ key: "resetOrderCustomerContactInfo",
1821
+ value: function resetOrderCustomerContactInfo() {
1822
+ this.orderCustomerContactRequest = null;
1823
+ var order = this.getTempOrder();
1824
+ if (order !== null && order !== void 0 && order._extend) delete order._extend.contactInfoEdited;
1825
+ }
1785
1826
 
1827
+ /** Explicit edits, including clearing the contact, must win over a pending default. */
1828
+ }, {
1829
+ key: "updateTempOrderContactsInfo",
1830
+ value: function updateTempOrderContactsInfo(contact) {
1831
+ var order = this.store.order.ensureTempOrder();
1832
+ order._extend || (order._extend = {});
1833
+ order._extend.contactInfoEdited = true;
1834
+ this.orderCustomerContactRequest = null;
1835
+ return _get(_getPrototypeOf(BookingTicketImpl.prototype), "updateTempOrderContactsInfo", this).call(this, contact);
1836
+ }
1837
+ }, {
1838
+ key: "getCustomerContactScope",
1839
+ value: function getCustomerContactScope() {
1840
+ var _this$otherParams5, _this$otherParams6, _this$otherParams7;
1841
+ return JSON.stringify([this.getPickupTimingScope(), (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.channel, (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.shop_id, (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.tenantId]);
1842
+ }
1843
+ }, {
1844
+ key: "getCustomerContactOrderKey",
1845
+ value: function getCustomerContactOrderKey() {
1846
+ var _order$_extend;
1847
+ var order = this.getTempOrder();
1848
+ // Cart mutations can replace the object without changing the order.
1849
+ var identity = (order === null || order === void 0 ? void 0 : order.external_sale_number) || (order === null || order === void 0 ? void 0 : order.request_unique_idempotency_token) || (order === null || order === void 0 || (_order$_extend = order._extend) === null || _order$_extend === void 0 ? void 0 : _order$_extend.localId) || (order === null || order === void 0 ? void 0 : order.order_id);
1850
+ return identity ? JSON.stringify([identity, order === null || order === void 0 ? void 0 : order.order_id]) : order;
1851
+ }
1852
+ }, {
1853
+ key: "replaceTempOrder",
1854
+ value: function () {
1855
+ var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1856
+ var _get2;
1857
+ var _len2,
1858
+ args,
1859
+ _key2,
1860
+ _args25 = arguments;
1861
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1862
+ while (1) switch (_context25.prev = _context25.next) {
1863
+ case 0:
1864
+ this.orderCustomerContactRequest = null;
1865
+ for (_len2 = _args25.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1866
+ args[_key2] = _args25[_key2];
1867
+ }
1868
+ return _context25.abrupt("return", (_get2 = _get(_getPrototypeOf(BookingTicketImpl.prototype), "replaceTempOrder", this)).call.apply(_get2, [this].concat(args)));
1869
+ case 3:
1870
+ case "end":
1871
+ return _context25.stop();
1872
+ }
1873
+ }, _callee25, this);
1874
+ }));
1875
+ function replaceTempOrder() {
1876
+ return _replaceTempOrder.apply(this, arguments);
1877
+ }
1878
+ return replaceTempOrder;
1879
+ }()
1880
+ }, {
1881
+ key: "applyDefaultOrderCustomerContactInfo",
1882
+ value: function () {
1883
+ var _applyDefaultOrderCustomerContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(contact) {
1884
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1885
+ while (1) switch (_context26.prev = _context26.next) {
1886
+ case 0:
1887
+ this.store.order.updateTempOrderContactsInfo(cloneDeep(contact));
1888
+ // Metadata may finish after promotion/discount refresh; publish the updated cart explicitly.
1889
+ _context26.next = 3;
1890
+ return this.effectsEmit('onTempOrderReplaced', {
1891
+ tempOrder: this.getTempOrder()
1892
+ });
1893
+ case 3:
1894
+ case "end":
1895
+ return _context26.stop();
1896
+ }
1897
+ }, _callee26, this);
1898
+ }));
1899
+ function applyDefaultOrderCustomerContactInfo(_x17) {
1900
+ return _applyDefaultOrderCustomerContactInfo.apply(this, arguments);
1901
+ }
1902
+ return applyDefaultOrderCustomerContactInfo;
1903
+ }()
1904
+ }, {
1905
+ key: "prefillOrderCustomerContactInfo",
1906
+ value: function prefillOrderCustomerContactInfo(customer, customerChanged) {
1907
+ var _order$_extend2,
1908
+ _this$otherParams8,
1909
+ _this4 = this;
1910
+ var order = this.getTempOrder();
1911
+ var customerId = Number(order === null || order === void 0 ? void 0 : order.customer_id);
1912
+ if (!order || !Number.isInteger(customerId) || customerId <= 1 || order.contacts_info != null || (_order$_extend2 = order._extend) !== null && _order$_extend2 !== void 0 && _order$_extend2.contactInfoEdited) return;
1913
+ // A restored new cart may already have its customer ID. Existing sales keep their snapshot,
1914
+ // even when it is empty; only an explicit customer switch replaces it.
1915
+ if (!customerChanged && order.order_id && !String(order.order_id).startsWith('local_order')) return;
1916
+ var contact = extractCustomerContactInfo(customer);
1917
+ if (contact) {
1918
+ this.orderCustomerContactRequest = null;
1919
+ void this.applyDefaultOrderCustomerContactInfo(contact);
1920
+ return;
1921
+ }
1922
+ // A relation explicitly returned as null is authoritative. Only a missing relation needs fetching.
1923
+ if (customer.contacts_info !== undefined) return;
1924
+ var userPlatform = isCustomerUserPlatform((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform);
1925
+ var getAuthenticatedCustomerId = function getAuthenticatedCustomerId() {
1926
+ var _this4$core, _this4$core$getPlugin, _this4$core$getPlugin2;
1927
+ return Number((_this4$core = _this4.core) === null || _this4$core === void 0 || (_this4$core$getPlugin = _this4$core.getPlugin) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin = _this4$core$getPlugin.call(_this4$core, 'user')) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin.get) === null || _this4$core$getPlugin2 === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin2.call(_this4$core$getPlugin)) === null || _this4$core$getPlugin2 === void 0 ? void 0 : _this4$core$getPlugin2.id);
1928
+ };
1929
+ if (userPlatform && getAuthenticatedCustomerId() !== customerId) return;
1930
+ var scope = this.getCustomerContactScope();
1931
+ var orderKey = this.getCustomerContactOrderKey();
1932
+ var previous = this.orderCustomerContactRequest;
1933
+ if ((previous === null || previous === void 0 ? void 0 : previous.orderKey) === orderKey && previous.customerId === customerId && previous.scope === scope) return;
1934
+ var pending = {
1935
+ orderKey: orderKey,
1936
+ customerId: customerId,
1937
+ scope: scope,
1938
+ promise: Promise.resolve()
1939
+ };
1940
+ this.orderCustomerContactRequest = pending;
1941
+ var loadContact = /*#__PURE__*/function () {
1942
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
1943
+ var _result4, resolved;
1944
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1945
+ while (1) switch (_context27.prev = _context27.next) {
1946
+ case 0:
1947
+ if (!userPlatform) {
1948
+ _context27.next = 7;
1949
+ break;
1950
+ }
1951
+ _context27.next = 3;
1952
+ return _this4.request.get('/customer/metadata', {
1953
+ key: 'contacts_info'
1954
+ });
1955
+ case 3:
1956
+ _result4 = _context27.sent;
1957
+ if (!((_result4 === null || _result4 === void 0 ? void 0 : _result4.code) !== 200 || (_result4 === null || _result4 === void 0 ? void 0 : _result4.status) === false)) {
1958
+ _context27.next = 6;
1959
+ break;
1960
+ }
1961
+ throw new Error('Customer contact lookup failed');
1962
+ case 6:
1963
+ return _context27.abrupt("return", isContactRecord(_result4.data) ? _result4.data : null);
1964
+ case 7:
1965
+ _context27.next = 9;
1966
+ return _this4.resolveCustomerById(customerId);
1967
+ case 9:
1968
+ resolved = _context27.sent;
1969
+ return _context27.abrupt("return", Number(resolved === null || resolved === void 0 ? void 0 : resolved.id) === customerId ? extractCustomerContactInfo(resolved) : null);
1970
+ case 11:
1971
+ case "end":
1972
+ return _context27.stop();
1973
+ }
1974
+ }, _callee27);
1975
+ }));
1976
+ return function loadContact() {
1977
+ return _ref11.apply(this, arguments);
1978
+ };
1979
+ }();
1980
+ pending.promise = loadContact().then( /*#__PURE__*/function () {
1981
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(value) {
1982
+ var _current$_extend;
1983
+ var current;
1984
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
1985
+ while (1) switch (_context28.prev = _context28.next) {
1986
+ case 0:
1987
+ current = _this4.getTempOrder();
1988
+ if (!(_this4.orderCustomerContactRequest !== pending || _this4.getCustomerContactOrderKey() !== orderKey || Number(current === null || current === void 0 ? void 0 : current.customer_id) !== customerId || scope !== _this4.getCustomerContactScope() || current !== null && current !== void 0 && (_current$_extend = current._extend) !== null && _current$_extend !== void 0 && _current$_extend.contactInfoEdited || (current === null || current === void 0 ? void 0 : current.contacts_info) != null || userPlatform && getAuthenticatedCustomerId() !== customerId)) {
1989
+ _context28.next = 3;
1990
+ break;
1991
+ }
1992
+ return _context28.abrupt("return");
1993
+ case 3:
1994
+ if (!value) {
1995
+ _context28.next = 6;
1996
+ break;
1997
+ }
1998
+ _context28.next = 6;
1999
+ return _this4.applyDefaultOrderCustomerContactInfo(value);
2000
+ case 6:
2001
+ case "end":
2002
+ return _context28.stop();
2003
+ }
2004
+ }, _callee28);
2005
+ }));
2006
+ return function (_x18) {
2007
+ return _ref12.apply(this, arguments);
2008
+ };
2009
+ }()).catch(function () {
2010
+ // A failed default does not prevent manual entry; a subsequent sync can retry.
2011
+ if (_this4.orderCustomerContactRequest === pending) _this4.orderCustomerContactRequest = null;
2012
+ console.warn('[BookingTicket] Failed to load saved customer contact information');
2013
+ });
2014
+ }
2015
+ }, {
2016
+ key: "waitForOrderCustomerContactInfo",
2017
+ value: function waitForOrderCustomerContactInfo() {
2018
+ var _this$orderCustomerCo, _this$orderCustomerCo2;
2019
+ return (_this$orderCustomerCo = (_this$orderCustomerCo2 = this.orderCustomerContactRequest) === null || _this$orderCustomerCo2 === void 0 ? void 0 : _this$orderCustomerCo2.promise) !== null && _this$orderCustomerCo !== void 0 ? _this$orderCustomerCo : Promise.resolve();
2020
+ }
2021
+ }, {
2022
+ key: "validateContactInfo",
2023
+ value: function () {
2024
+ var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2025
+ var _this$getTempOrder, _this$getTempOrder2;
2026
+ var orderKey, customerId, scope;
2027
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2028
+ while (1) switch (_context29.prev = _context29.next) {
2029
+ case 0:
2030
+ orderKey = this.getCustomerContactOrderKey();
2031
+ customerId = (_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.customer_id;
2032
+ scope = this.getCustomerContactScope();
2033
+ _context29.next = 5;
2034
+ return this.waitForOrderCustomerContactInfo();
2035
+ case 5:
2036
+ if (!(this.getCustomerContactOrderKey() !== orderKey || ((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.customer_id) !== customerId || this.getCustomerContactScope() !== scope)) {
2037
+ _context29.next = 7;
2038
+ break;
2039
+ }
2040
+ throw new Error('The order changed. Please try again.');
2041
+ case 7:
2042
+ _context29.next = 9;
2043
+ return _get(_getPrototypeOf(BookingTicketImpl.prototype), "validateContactInfo", this).call(this);
2044
+ case 9:
2045
+ case "end":
2046
+ return _context29.stop();
2047
+ }
2048
+ }, _callee29, this);
2049
+ }));
2050
+ function validateContactInfo() {
2051
+ return _validateContactInfo.apply(this, arguments);
2052
+ }
2053
+ return validateContactInfo;
2054
+ }()
1786
2055
  /**
1787
2056
  * 读取 tempOrder 上的下单客户协议字段;customer_id 缺失时返回 null。
1788
2057
  */
@@ -1806,10 +2075,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1806
2075
  */
1807
2076
  }, {
1808
2077
  key: "clearOrderCustomer",
1809
- value: function clearOrderCustomer() {
2078
+ value: function clearOrderCustomer(options) {
1810
2079
  var _discountModule$setOr,
1811
2080
  _discountModule$setDi,
1812
- _this4 = this;
2081
+ _this5 = this;
2082
+ this.orderCustomerContactRequest = null;
2083
+ if (!(options !== null && options !== void 0 && options.preserveContactInfo)) this.resetOrderCustomerContactInfo();
2084
+ if (!(options !== null && options !== void 0 && options.preserveContactInfo)) this.store.order.updateTempOrderContactsInfo(null);
1813
2085
  this.store.order.clearOrderCustomer();
1814
2086
  this.discountConfigCacheKey = null;
1815
2087
  this.hasManualDiscountSelection = false;
@@ -1822,9 +2094,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1822
2094
  createIfMissing: true
1823
2095
  }).then(function () {
1824
2096
  var _discountModule$getDi;
1825
- var tempOrder = _this4.store.order.ensureTempOrder();
1826
- _this4.store.order.persistTempOrder();
1827
- return _this4.effectsEmit('onDiscountApplied', {
2097
+ var tempOrder = _this5.store.order.ensureTempOrder();
2098
+ _this5.store.order.persistTempOrder();
2099
+ return _this5.effectsEmit('onDiscountApplied', {
1828
2100
  productList: tempOrder.products || [],
1829
2101
  discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [],
1830
2102
  selectedDiscountList: tempOrder.discount_list || [],
@@ -1848,24 +2120,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1848
2120
  }, {
1849
2121
  key: "restoreOrder",
1850
2122
  value: (function () {
1851
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2123
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
1852
2124
  var _this$store$customer;
1853
2125
  var tempOrder;
1854
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1855
- while (1) switch (_context24.prev = _context24.next) {
2126
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2127
+ while (1) switch (_context30.prev = _context30.next) {
1856
2128
  case 0:
1857
- _context24.next = 2;
2129
+ _context30.next = 2;
1858
2130
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
1859
2131
  case 2:
1860
- tempOrder = _context24.sent;
2132
+ tempOrder = _context30.sent;
1861
2133
  this.clearOrderCustomer();
1862
2134
  (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
1863
- return _context24.abrupt("return", tempOrder);
2135
+ return _context30.abrupt("return", tempOrder);
1864
2136
  case 6:
1865
2137
  case "end":
1866
- return _context24.stop();
2138
+ return _context30.stop();
1867
2139
  }
1868
- }, _callee24, this);
2140
+ }, _callee30, this);
1869
2141
  }));
1870
2142
  function restoreOrder() {
1871
2143
  return _restoreOrder.apply(this, arguments);
@@ -1888,7 +2160,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1888
2160
  var _this$store$order$get4,
1889
2161
  _this$store$order6,
1890
2162
  _this$getOrderIdentit,
1891
- _this5 = this;
2163
+ _this6 = this;
1892
2164
  if (!customerId || customerId === 1) return Promise.resolve();
1893
2165
  var tempOrder = (_this$store$order$get4 = (_this$store$order6 = this.store.order).getTempOrder) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order6);
1894
2166
  var orderIdentity = (_this$getOrderIdentit = this.getOrderIdentity) === null || _this$getOrderIdentit === void 0 ? void 0 : _this$getOrderIdentit.call(this);
@@ -1900,50 +2172,50 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1900
2172
  return this.orderCustomerDiscountRefreshInFlight;
1901
2173
  }
1902
2174
  var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
1903
- var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1904
- var _this5$store$order$ge, _this5$store$order, _this5$getOrderIdenti;
2175
+ var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2176
+ var _this6$store$order$ge, _this6$store$order, _this6$getOrderIdenti;
1905
2177
  var currentCustomer, currentTempOrder, currentOrderIdentity, currentOrderId, currentAction, currentOrderTarget;
1906
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1907
- while (1) switch (_context25.prev = _context25.next) {
2178
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2179
+ while (1) switch (_context31.prev = _context31.next) {
1908
2180
  case 0:
1909
2181
  if (!previousRefresh) {
1910
- _context25.next = 3;
2182
+ _context31.next = 3;
1911
2183
  break;
1912
2184
  }
1913
- _context25.next = 3;
2185
+ _context31.next = 3;
1914
2186
  return previousRefresh.catch(function () {
1915
2187
  return undefined;
1916
2188
  });
1917
2189
  case 3:
1918
- currentCustomer = _this5.store.order.getOrderCustomer();
2190
+ currentCustomer = _this6.store.order.getOrderCustomer();
1919
2191
  if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
1920
- _context25.next = 6;
2192
+ _context31.next = 6;
1921
2193
  break;
1922
2194
  }
1923
- return _context25.abrupt("return");
2195
+ return _context31.abrupt("return");
1924
2196
  case 6:
1925
- currentTempOrder = (_this5$store$order$ge = (_this5$store$order = _this5.store.order).getTempOrder) === null || _this5$store$order$ge === void 0 ? void 0 : _this5$store$order$ge.call(_this5$store$order);
1926
- currentOrderIdentity = (_this5$getOrderIdenti = _this5.getOrderIdentity) === null || _this5$getOrderIdenti === void 0 ? void 0 : _this5$getOrderIdenti.call(_this5);
2197
+ currentTempOrder = (_this6$store$order$ge = (_this6$store$order = _this6.store.order).getTempOrder) === null || _this6$store$order$ge === void 0 ? void 0 : _this6$store$order$ge.call(_this6$store$order);
2198
+ currentOrderIdentity = (_this6$getOrderIdenti = _this6.getOrderIdentity) === null || _this6$getOrderIdenti === void 0 ? void 0 : _this6$getOrderIdenti.call(_this6);
1927
2199
  currentOrderId = (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.order_id) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.orderId);
1928
2200
  currentAction = !currentOrderId || String(currentOrderId).startsWith('local_order') ? 'create' : 'edit';
1929
2201
  currentOrderTarget = currentOrderId ? "order:".concat(String(currentOrderId)) : "external:".concat(String((currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.external_sale_number) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.externalSaleNumber) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.localId) || 'new'));
1930
2202
  if (!("".concat(customerId, ":").concat(currentAction, ":").concat(currentOrderTarget) !== refreshTarget)) {
1931
- _context25.next = 13;
2203
+ _context31.next = 13;
1932
2204
  break;
1933
2205
  }
1934
- return _context25.abrupt("return");
2206
+ return _context31.abrupt("return");
1935
2207
  case 13:
1936
- _context25.next = 15;
1937
- return _this5.loadDiscountConfig({
2208
+ _context31.next = 15;
2209
+ return _this6.loadDiscountConfig({
1938
2210
  customerId: customerId,
1939
2211
  action: action,
1940
2212
  force: true
1941
2213
  });
1942
2214
  case 15:
1943
2215
  case "end":
1944
- return _context25.stop();
2216
+ return _context31.stop();
1945
2217
  }
1946
- }, _callee25);
2218
+ }, _callee31);
1947
2219
  }))();
1948
2220
  this.orderCustomerDiscountRefreshInFlight = refreshTask;
1949
2221
  this.orderCustomerDiscountRefreshCustomerId = customerId;
@@ -1951,10 +2223,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1951
2223
  refreshTask.catch(function (error) {
1952
2224
  console.error('Failed to load discount config after customer change:', error);
1953
2225
  }).finally(function () {
1954
- if (_this5.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
1955
- _this5.orderCustomerDiscountRefreshInFlight = null;
1956
- _this5.orderCustomerDiscountRefreshCustomerId = null;
1957
- _this5.orderCustomerDiscountRefreshTarget = null;
2226
+ if (_this6.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
2227
+ _this6.orderCustomerDiscountRefreshInFlight = null;
2228
+ _this6.orderCustomerDiscountRefreshCustomerId = null;
2229
+ _this6.orderCustomerDiscountRefreshTarget = null;
1958
2230
  });
1959
2231
  return refreshTask;
1960
2232
  }
@@ -1966,30 +2238,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1966
2238
  }, {
1967
2239
  key: "prepareProductPriceQueryContext",
1968
2240
  value: function () {
1969
- var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(customerId) {
2241
+ var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(customerId) {
1970
2242
  var normalizedCustomerId, refreshTask, shouldWait;
1971
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1972
- while (1) switch (_context26.prev = _context26.next) {
2243
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2244
+ while (1) switch (_context32.prev = _context32.next) {
1973
2245
  case 0:
1974
- _context26.next = 2;
2246
+ _context32.next = 2;
1975
2247
  return Promise.resolve();
1976
2248
  case 2:
1977
2249
  normalizedCustomerId = Number(customerId || 0);
1978
2250
  refreshTask = this.orderCustomerDiscountRefreshInFlight;
1979
2251
  shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
1980
2252
  if (!(shouldWait && refreshTask)) {
1981
- _context26.next = 8;
2253
+ _context32.next = 8;
1982
2254
  break;
1983
2255
  }
1984
- _context26.next = 8;
2256
+ _context32.next = 8;
1985
2257
  return refreshTask;
1986
2258
  case 8:
1987
2259
  case "end":
1988
- return _context26.stop();
2260
+ return _context32.stop();
1989
2261
  }
1990
- }, _callee26, this);
2262
+ }, _callee32, this);
1991
2263
  }));
1992
- function prepareProductPriceQueryContext(_x17) {
2264
+ function prepareProductPriceQueryContext(_x19) {
1993
2265
  return _prepareProductPriceQueryContext.apply(this, arguments);
1994
2266
  }
1995
2267
  return prepareProductPriceQueryContext;
@@ -2042,29 +2314,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2042
2314
  }, {
2043
2315
  key: "changeCustomerPage",
2044
2316
  value: (function () {
2045
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(page, pageSize) {
2046
- var _result4;
2047
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2048
- while (1) switch (_context27.prev = _context27.next) {
2317
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(page, pageSize) {
2318
+ var _result5;
2319
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2320
+ while (1) switch (_context33.prev = _context33.next) {
2049
2321
  case 0:
2050
- _context27.prev = 0;
2051
- _context27.next = 3;
2322
+ _context33.prev = 0;
2323
+ _context33.next = 3;
2052
2324
  return this.store.customer.changeCustomerPage(page, pageSize);
2053
2325
  case 3:
2054
- _result4 = _context27.sent;
2055
- return _context27.abrupt("return", _result4);
2326
+ _result5 = _context33.sent;
2327
+ return _context33.abrupt("return", _result5);
2056
2328
  case 7:
2057
- _context27.prev = 7;
2058
- _context27.t0 = _context27["catch"](0);
2059
- console.error('Failed to change customer page:', _context27.t0);
2060
- throw _context27.t0;
2329
+ _context33.prev = 7;
2330
+ _context33.t0 = _context33["catch"](0);
2331
+ console.error('Failed to change customer page:', _context33.t0);
2332
+ throw _context33.t0;
2061
2333
  case 11:
2062
2334
  case "end":
2063
- return _context27.stop();
2335
+ return _context33.stop();
2064
2336
  }
2065
- }, _callee27, this, [[0, 7]]);
2337
+ }, _callee33, this, [[0, 7]]);
2066
2338
  }));
2067
- function changeCustomerPage(_x18, _x19) {
2339
+ function changeCustomerPage(_x20, _x21) {
2068
2340
  return _changeCustomerPage.apply(this, arguments);
2069
2341
  }
2070
2342
  return changeCustomerPage;
@@ -2077,28 +2349,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2077
2349
  }, {
2078
2350
  key: "loadMoreCustomers",
2079
2351
  value: (function () {
2080
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2081
- var _result5;
2082
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2083
- while (1) switch (_context28.prev = _context28.next) {
2352
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2353
+ var _result6;
2354
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2355
+ while (1) switch (_context34.prev = _context34.next) {
2084
2356
  case 0:
2085
- _context28.prev = 0;
2086
- _context28.next = 3;
2357
+ _context34.prev = 0;
2358
+ _context34.next = 3;
2087
2359
  return this.store.customer.loadMoreCustomers();
2088
2360
  case 3:
2089
- _result5 = _context28.sent;
2090
- this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
2091
- return _context28.abrupt("return", _result5);
2361
+ _result6 = _context34.sent;
2362
+ this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result6);
2363
+ return _context34.abrupt("return", _result6);
2092
2364
  case 8:
2093
- _context28.prev = 8;
2094
- _context28.t0 = _context28["catch"](0);
2095
- console.error('Failed to load more customers:', _context28.t0);
2096
- throw _context28.t0;
2365
+ _context34.prev = 8;
2366
+ _context34.t0 = _context34["catch"](0);
2367
+ console.error('Failed to load more customers:', _context34.t0);
2368
+ throw _context34.t0;
2097
2369
  case 12:
2098
2370
  case "end":
2099
- return _context28.stop();
2371
+ return _context34.stop();
2100
2372
  }
2101
- }, _callee28, this, [[0, 8]]);
2373
+ }, _callee34, this, [[0, 8]]);
2102
2374
  }));
2103
2375
  function loadMoreCustomers() {
2104
2376
  return _loadMoreCustomers.apply(this, arguments);
@@ -2114,31 +2386,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2114
2386
  }, {
2115
2387
  key: "resetAndLoadCustomers",
2116
2388
  value: (function () {
2117
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2389
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2118
2390
  var params,
2119
- _result6,
2120
- _args29 = arguments;
2121
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2122
- while (1) switch (_context29.prev = _context29.next) {
2391
+ _result7,
2392
+ _args35 = arguments;
2393
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2394
+ while (1) switch (_context35.prev = _context35.next) {
2123
2395
  case 0:
2124
- params = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {};
2125
- _context29.prev = 1;
2126
- _context29.next = 4;
2396
+ params = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {};
2397
+ _context35.prev = 1;
2398
+ _context35.next = 4;
2127
2399
  return this.store.customer.resetAndLoadCustomers(params);
2128
2400
  case 4:
2129
- _result6 = _context29.sent;
2130
- this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
2131
- return _context29.abrupt("return", _result6);
2401
+ _result7 = _context35.sent;
2402
+ this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result7);
2403
+ return _context35.abrupt("return", _result7);
2132
2404
  case 9:
2133
- _context29.prev = 9;
2134
- _context29.t0 = _context29["catch"](1);
2135
- console.error('Failed to reset and load customers:', _context29.t0);
2136
- throw _context29.t0;
2405
+ _context35.prev = 9;
2406
+ _context35.t0 = _context35["catch"](1);
2407
+ console.error('Failed to reset and load customers:', _context35.t0);
2408
+ throw _context35.t0;
2137
2409
  case 13:
2138
2410
  case "end":
2139
- return _context29.stop();
2411
+ return _context35.stop();
2140
2412
  }
2141
- }, _callee29, this, [[1, 9]]);
2413
+ }, _callee35, this, [[1, 9]]);
2142
2414
  }));
2143
2415
  function resetAndLoadCustomers() {
2144
2416
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -2183,9 +2455,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2183
2455
  }, {
2184
2456
  key: "scanGlobalListener",
2185
2457
  value: function scanGlobalListener(callback) {
2186
- var _this6 = this;
2458
+ var _this7 = this;
2187
2459
  var localSearch = function localSearch(v) {
2188
- return _this6.store.products.findProductsByCodeOrBarcode(v);
2460
+ return _this7.store.products.findProductsByCodeOrBarcode(v);
2189
2461
  };
2190
2462
  var scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
2191
2463
  var safeCallback = function safeCallback(d) {
@@ -2299,16 +2571,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2299
2571
  }, {
2300
2572
  key: "getOtherParams",
2301
2573
  value: (function () {
2302
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2303
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2304
- while (1) switch (_context30.prev = _context30.next) {
2574
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
2575
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2576
+ while (1) switch (_context36.prev = _context36.next) {
2305
2577
  case 0:
2306
- return _context30.abrupt("return", this.otherParams);
2578
+ return _context36.abrupt("return", this.otherParams);
2307
2579
  case 1:
2308
2580
  case "end":
2309
- return _context30.stop();
2581
+ return _context36.stop();
2310
2582
  }
2311
- }, _callee30, this);
2583
+ }, _callee36, this);
2312
2584
  }));
2313
2585
  function getOtherParams() {
2314
2586
  return _getOtherParams.apply(this, arguments);
@@ -2480,10 +2752,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2480
2752
  }, {
2481
2753
  key: "logSessionCatalogDateMismatch",
2482
2754
  value: function logSessionCatalogDateMismatch(item, bookingDate) {
2483
- var _this$getTempOrder, _tempOrder$order_id, _tempOrder$external_s, _item$cartDetailValue, _item$cartDetailValue2;
2755
+ var _this$getTempOrder3, _tempOrder$order_id, _tempOrder$external_s, _item$cartDetailValue, _item$cartDetailValue2;
2484
2756
  var logger = this.logger;
2485
2757
  if (!(logger !== null && logger !== void 0 && logger.addLog)) return;
2486
- var tempOrder = (_this$getTempOrder = this.getTempOrder) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.call(this);
2758
+ var tempOrder = (_this$getTempOrder3 = this.getTempOrder) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.call(this);
2487
2759
  var staleInfo = buildSessionCatalogStaleInfo(item, bookingDate);
2488
2760
  logger.addLog({
2489
2761
  type: 'warning',
@@ -2518,10 +2790,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2518
2790
  }, {
2519
2791
  key: "buildAddProductCtx",
2520
2792
  value: function buildAddProductCtx(extra) {
2521
- var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get5, _extra$presetStartTim2;
2793
+ var _extra$date2, _ref14, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get5, _extra$presetStartTim2;
2522
2794
  var bookingContextState = this.store.bookingContext.getState();
2523
2795
  var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
2524
- var orderCustomerId = (_ref12 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
2796
+ var orderCustomerId = (_ref14 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.customer_id) !== null && _ref14 !== void 0 ? _ref14 : undefined;
2525
2797
  return _objectSpread(_objectSpread({
2526
2798
  bookingConfig: bookingContextState.bookingConfig,
2527
2799
  resourcesOrigin: bookingContextState.resourcesOrigin,
@@ -2632,18 +2904,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2632
2904
  }, {
2633
2905
  key: "updateProductInOrder",
2634
2906
  value: (function () {
2635
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
2636
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2637
- while (1) switch (_context31.prev = _context31.next) {
2907
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
2908
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
2909
+ while (1) switch (_context37.prev = _context37.next) {
2638
2910
  case 0:
2639
- return _context31.abrupt("return", this.updateOrderProduct(params));
2911
+ return _context37.abrupt("return", this.updateOrderProduct(params));
2640
2912
  case 1:
2641
2913
  case "end":
2642
- return _context31.stop();
2914
+ return _context37.stop();
2643
2915
  }
2644
- }, _callee31, this);
2916
+ }, _callee37, this);
2645
2917
  }));
2646
- function updateProductInOrder(_x20) {
2918
+ function updateProductInOrder(_x22) {
2647
2919
  return _updateProductInOrder.apply(this, arguments);
2648
2920
  }
2649
2921
  return updateProductInOrder;
@@ -2665,24 +2937,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2665
2937
  }, {
2666
2938
  key: "handleGlobalScanCode",
2667
2939
  value: (function () {
2668
- var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(code, bridge) {
2669
- var _this7 = this;
2670
- var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, _promotion$isAccepted, promotion, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
2671
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2672
- while (1) switch (_context32.prev = _context32.next) {
2940
+ var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(code, bridge) {
2941
+ var _this8 = this;
2942
+ var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, _promotion$isAccepted, promotion, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result8, _bridge$onNotify3;
2943
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
2944
+ while (1) switch (_context38.prev = _context38.next) {
2673
2945
  case 0:
2674
2946
  trimmed = typeof code === 'string' ? code.trim() : '';
2675
2947
  if (trimmed) {
2676
- _context32.next = 4;
2948
+ _context38.next = 4;
2677
2949
  break;
2678
2950
  }
2679
2951
  bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2680
- return _context32.abrupt("return", {
2952
+ return _context38.abrupt("return", {
2681
2953
  status: 'failed',
2682
2954
  reason: 'empty_code'
2683
2955
  });
2684
2956
  case 4:
2685
- _context32.prev = 4;
2957
+ _context38.prev = 4;
2686
2958
  // Capture before lookup/UI awaits, so a result cannot land in a new cart.
2687
2959
  // Unscoped POS Order modules return a no-op guard.
2688
2960
  beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
@@ -2709,23 +2981,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2709
2981
  } : undefined
2710
2982
  }) : undefined;
2711
2983
  if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher')) {
2712
- _context32.next = 16;
2984
+ _context38.next = 16;
2713
2985
  break;
2714
2986
  }
2715
2987
  if (guardedBridge.applyPromotionCode) {
2716
- _context32.next = 12;
2988
+ _context38.next = 12;
2717
2989
  break;
2718
2990
  }
2719
- return _context32.abrupt("return", {
2991
+ return _context38.abrupt("return", {
2720
2992
  status: 'failed',
2721
2993
  reason: 'no_bridge'
2722
2994
  });
2723
2995
  case 12:
2724
- _context32.next = 14;
2996
+ _context38.next = 14;
2725
2997
  return guardedBridge.applyPromotionCode(trimmed);
2726
2998
  case 14:
2727
- promotion = _context32.sent;
2728
- return _context32.abrupt("return", ((_promotion$isAccepted = promotion.isAccepted) !== null && _promotion$isAccepted !== void 0 ? _promotion$isAccepted : promotion.isAvailable) ? {
2999
+ promotion = _context38.sent;
3000
+ return _context38.abrupt("return", ((_promotion$isAccepted = promotion.isAccepted) !== null && _promotion$isAccepted !== void 0 ? _promotion$isAccepted : promotion.isAvailable) ? {
2729
3001
  status: 'success',
2730
3002
  kind: 'promotion'
2731
3003
  } : {
@@ -2734,87 +3006,87 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2734
3006
  });
2735
3007
  case 16:
2736
3008
  localSearch = function localSearch(v) {
2737
- return _this7.store.products.findProductsByCodeOrBarcode(v);
3009
+ return _this8.store.products.findProductsByCodeOrBarcode(v);
2738
3010
  };
2739
3011
  scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
2740
- _context32.next = 20;
3012
+ _context38.next = 20;
2741
3013
  return scanCallback({
2742
3014
  type: 'nativeScanner',
2743
3015
  value: trimmed
2744
3016
  });
2745
3017
  case 20:
2746
- raw = _context32.sent;
3018
+ raw = _context38.sent;
2747
3019
  formatted = formatGlobalScanResult(raw, trimmed);
2748
3020
  if (formatted) {
2749
- _context32.next = 25;
3021
+ _context38.next = 25;
2750
3022
  break;
2751
3023
  }
2752
3024
  bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2753
- return _context32.abrupt("return", {
3025
+ return _context38.abrupt("return", {
2754
3026
  status: 'failed',
2755
3027
  reason: 'not_found'
2756
3028
  });
2757
3029
  case 25:
2758
- _context32.next = 27;
3030
+ _context38.next = 27;
2759
3031
  return applyGlobalScan({
2760
3032
  setOrderCustomer: function setOrderCustomer(customer) {
2761
3033
  beforeScanCommit();
2762
- _this7.setOrderCustomer(customer);
3034
+ _this8.setOrderCustomer(customer);
2763
3035
  },
2764
3036
  getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
2765
- return _this7.getOrderCustomerSnapshot();
3037
+ return _this8.getOrderCustomerSnapshot();
2766
3038
  },
2767
3039
  resolveCustomerById: function resolveCustomerById(customerId) {
2768
- return _this7.resolveCustomerById(customerId);
3040
+ return _this8.resolveCustomerById(customerId);
2769
3041
  },
2770
3042
  getBusinessCode: function getBusinessCode() {
2771
- var _this7$otherParams;
2772
- return (_this7$otherParams = _this7.otherParams) === null || _this7$otherParams === void 0 ? void 0 : _this7$otherParams.businessCode;
3043
+ var _this8$otherParams;
3044
+ return (_this8$otherParams = _this8.otherParams) === null || _this8$otherParams === void 0 ? void 0 : _this8$otherParams.businessCode;
2773
3045
  },
2774
3046
  buildAddProductCtx: function buildAddProductCtx(extra) {
2775
- return _this7.buildAddProductCtx(extra);
3047
+ return _this8.buildAddProductCtx(extra);
2776
3048
  },
2777
3049
  decideAddProduct: function decideAddProduct(item, options) {
2778
- return _this7.decideAddProduct(item, options);
3050
+ return _this8.decideAddProduct(item, options);
2779
3051
  },
2780
3052
  decideAfterDetail: function decideAfterDetail(cacheItem, options) {
2781
- return _this7.decideAfterDetail(cacheItem, options);
3053
+ return _this8.decideAfterDetail(cacheItem, options);
2782
3054
  },
2783
3055
  transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
2784
- return _this7.transformDetailToProductAndBooking(input);
3056
+ return _this8.transformDetailToProductAndBooking(input);
2785
3057
  },
2786
3058
  addProductToOrder: function addProductToOrder(product, booking) {
2787
3059
  beforeScanCommit();
2788
- return _this7.addProductToOrder(product, booking);
3060
+ return _this8.addProductToOrder(product, booking);
2789
3061
  },
2790
3062
  refreshWalletAssets: function refreshWalletAssets(params) {
2791
- return _this7.refreshWalletAssets(params);
3063
+ return _this8.refreshWalletAssets(params);
2792
3064
  },
2793
3065
  scanWalletAsset: function scanWalletAsset(scanCode) {
2794
3066
  beforeScanCommit();
2795
- return _this7.scanWalletAsset(scanCode);
3067
+ return _this8.scanWalletAsset(scanCode);
2796
3068
  }
2797
3069
  }, formatted, guardedBridge);
2798
3070
  case 27:
2799
- _result7 = _context32.sent;
3071
+ _result8 = _context38.sent;
2800
3072
  bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
2801
- return _context32.abrupt("return", _result7);
3073
+ return _context38.abrupt("return", _result8);
2802
3074
  case 32:
2803
- _context32.prev = 32;
2804
- _context32.t0 = _context32["catch"](4);
2805
- console.error('[BookingTicket] handleGlobalScanCode failed', _context32.t0);
3075
+ _context38.prev = 32;
3076
+ _context38.t0 = _context38["catch"](4);
3077
+ console.error('[BookingTicket] handleGlobalScanCode failed', _context38.t0);
2806
3078
  bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2807
- return _context32.abrupt("return", {
3079
+ return _context38.abrupt("return", {
2808
3080
  status: 'failed',
2809
3081
  reason: 'not_found'
2810
3082
  });
2811
3083
  case 37:
2812
3084
  case "end":
2813
- return _context32.stop();
3085
+ return _context38.stop();
2814
3086
  }
2815
- }, _callee32, this, [[4, 32]]);
3087
+ }, _callee38, this, [[4, 32]]);
2816
3088
  }));
2817
- function handleGlobalScanCode(_x21, _x22) {
3089
+ function handleGlobalScanCode(_x23, _x24) {
2818
3090
  return _handleGlobalScanCode.apply(this, arguments);
2819
3091
  }
2820
3092
  return handleGlobalScanCode;
@@ -2822,39 +3094,39 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2822
3094
  }, {
2823
3095
  key: "getGlobalScanCodeType",
2824
3096
  value: (function () {
2825
- var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(code) {
2826
- var _this8 = this,
3097
+ var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(code) {
3098
+ var _this9 = this,
2827
3099
  _formatGlobalScanResu,
2828
3100
  _formatGlobalScanResu2;
2829
3101
  var trimmed, scan, raw;
2830
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2831
- while (1) switch (_context33.prev = _context33.next) {
3102
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3103
+ while (1) switch (_context39.prev = _context39.next) {
2832
3104
  case 0:
2833
3105
  trimmed = typeof code === 'string' ? code.trim() : '';
2834
3106
  if (trimmed) {
2835
- _context33.next = 3;
3107
+ _context39.next = 3;
2836
3108
  break;
2837
3109
  }
2838
- return _context33.abrupt("return", null);
3110
+ return _context39.abrupt("return", null);
2839
3111
  case 3:
2840
3112
  scan = handleGlobalScan(this.request, function (value) {
2841
- return _this8.store.products.findProductsByCodeOrBarcode(value);
3113
+ return _this9.store.products.findProductsByCodeOrBarcode(value);
2842
3114
  }, this.getSubmitOrderSalesChannel());
2843
- _context33.next = 6;
3115
+ _context39.next = 6;
2844
3116
  return scan({
2845
3117
  type: 'nativeScanner',
2846
3118
  value: trimmed
2847
3119
  });
2848
3120
  case 6:
2849
- raw = _context33.sent;
2850
- return _context33.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
3121
+ raw = _context39.sent;
3122
+ return _context39.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
2851
3123
  case 8:
2852
3124
  case "end":
2853
- return _context33.stop();
3125
+ return _context39.stop();
2854
3126
  }
2855
- }, _callee33, this);
3127
+ }, _callee39, this);
2856
3128
  }));
2857
- function getGlobalScanCodeType(_x23) {
3129
+ function getGlobalScanCodeType(_x25) {
2858
3130
  return _getGlobalScanCodeType.apply(this, arguments);
2859
3131
  }
2860
3132
  return getGlobalScanCodeType;
@@ -2874,7 +3146,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2874
3146
  }, {
2875
3147
  key: "buildAddTimeOrderLine",
2876
3148
  value: function buildAddTimeOrderLine(input, bookingUid) {
2877
- var _input$num, _product$id, _product$product_id, _ref13, _product$product_vari, _ref14, _product$variant_id, _product$original_pri, _ref15, _ref16, _product$option, _product$product_sku, _ref17, _ref18, _product$bundle, _product$id2;
3149
+ var _input$num, _product$id, _product$product_id, _ref15, _product$product_vari, _ref16, _product$variant_id, _product$original_pri, _ref17, _ref18, _product$option, _product$product_sku, _ref19, _ref20, _product$bundle, _product$id2;
2878
3150
  var product = input === null || input === void 0 ? void 0 : input.product;
2879
3151
  if (!product || _typeof(product) !== 'object') {
2880
3152
  throw new Error('[BookingTicket] addAddTimeProductToBooking: product 不能为空');
@@ -2885,8 +3157,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2885
3157
  var payload = {
2886
3158
  id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id,
2887
3159
  product_id: (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id,
2888
- product_variant_id: (_ref13 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product.variant_id) !== null && _ref13 !== void 0 ? _ref13 : 0,
2889
- variant_id: (_ref14 = (_product$variant_id = product.variant_id) !== null && _product$variant_id !== void 0 ? _product$variant_id : product.product_variant_id) !== null && _ref14 !== void 0 ? _ref14 : 0,
3160
+ product_variant_id: (_ref15 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product.variant_id) !== null && _ref15 !== void 0 ? _ref15 : 0,
3161
+ variant_id: (_ref16 = (_product$variant_id = product.variant_id) !== null && _product$variant_id !== void 0 ? _product$variant_id : product.product_variant_id) !== null && _ref16 !== void 0 ? _ref16 : 0,
2890
3162
  quantity: quantity,
2891
3163
  num: quantity,
2892
3164
  price: price,
@@ -2895,8 +3167,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2895
3167
  line_total: price,
2896
3168
  total: price,
2897
3169
  product_sku: product.product_sku,
2898
- option: (_ref15 = (_ref16 = (_product$option = product.option) !== null && _product$option !== void 0 ? _product$option : product.options) !== null && _ref16 !== void 0 ? _ref16 : (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option) !== null && _ref15 !== void 0 ? _ref15 : [],
2899
- bundle: (_ref17 = (_ref18 = (_product$bundle = product.bundle) !== null && _product$bundle !== void 0 ? _product$bundle : product.bundles) !== null && _ref18 !== void 0 ? _ref18 : product.product_bundle) !== null && _ref17 !== void 0 ? _ref17 : []
3170
+ option: (_ref17 = (_ref18 = (_product$option = product.option) !== null && _product$option !== void 0 ? _product$option : product.options) !== null && _ref18 !== void 0 ? _ref18 : (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option) !== null && _ref17 !== void 0 ? _ref17 : [],
3171
+ bundle: (_ref19 = (_ref20 = (_product$bundle = product.bundle) !== null && _product$bundle !== void 0 ? _product$bundle : product.bundles) !== null && _ref20 !== void 0 ? _ref20 : product.product_bundle) !== null && _ref19 !== void 0 ? _ref19 : []
2900
3172
  };
2901
3173
  var orderLine = this.transformBaseProductToOrderProduct({
2902
3174
  payload: payload,
@@ -2936,11 +3208,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2936
3208
  }, {
2937
3209
  key: "addAddTimeProductToBooking",
2938
3210
  value: (function () {
2939
- var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(input) {
2940
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2941
- while (1) switch (_context34.prev = _context34.next) {
3211
+ var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(input) {
3212
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3213
+ while (1) switch (_context40.prev = _context40.next) {
2942
3214
  case 0:
2943
- return _context34.abrupt("return", this.addAddTimeProductsToBooking({
3215
+ return _context40.abrupt("return", this.addAddTimeProductsToBooking({
2944
3216
  booking: input.booking,
2945
3217
  products: [input],
2946
3218
  coveredMinutes: input.coveredMinutes,
@@ -2948,11 +3220,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2948
3220
  }));
2949
3221
  case 1:
2950
3222
  case "end":
2951
- return _context34.stop();
3223
+ return _context40.stop();
2952
3224
  }
2953
- }, _callee34, this);
3225
+ }, _callee40, this);
2954
3226
  }));
2955
- function addAddTimeProductToBooking(_x24) {
3227
+ function addAddTimeProductToBooking(_x26) {
2956
3228
  return _addAddTimeProductToBooking.apply(this, arguments);
2957
3229
  }
2958
3230
  return addAddTimeProductToBooking;
@@ -2970,27 +3242,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2970
3242
  }, {
2971
3243
  key: "addAddTimeProductsToBooking",
2972
3244
  value: (function () {
2973
- var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(input) {
2974
- var _this9 = this,
3245
+ var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(input) {
3246
+ var _this10 = this,
2975
3247
  _input$bookingPatch;
2976
3248
  var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
2977
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2978
- while (1) switch (_context35.prev = _context35.next) {
3249
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3250
+ while (1) switch (_context41.prev = _context41.next) {
2979
3251
  case 0:
2980
3252
  bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
2981
3253
  if (bookingUid) {
2982
- _context35.next = 3;
3254
+ _context41.next = 3;
2983
3255
  break;
2984
3256
  }
2985
3257
  throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
2986
3258
  case 3:
2987
3259
  orderLines = (input.products || []).map(function (line) {
2988
3260
  return {
2989
- product: _this9.buildAddTimeOrderLine(line, bookingUid)
3261
+ product: _this10.buildAddTimeOrderLine(line, bookingUid)
2990
3262
  };
2991
3263
  });
2992
3264
  if (this.store.order) {
2993
- _context35.next = 6;
3265
+ _context41.next = 6;
2994
3266
  break;
2995
3267
  }
2996
3268
  throw new Error('order 模块未初始化');
@@ -3004,55 +3276,55 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3004
3276
  });
3005
3277
  }
3006
3278
  if (!(typeof this.store.order.addProductsToOrder === 'function')) {
3007
- _context35.next = 11;
3279
+ _context41.next = 11;
3008
3280
  break;
3009
3281
  }
3010
- return _context35.abrupt("return", this.store.order.addProductsToOrder(orderLines));
3282
+ return _context41.abrupt("return", this.store.order.addProductsToOrder(orderLines));
3011
3283
  case 11:
3012
3284
  result = [];
3013
3285
  _iterator2 = _createForOfIteratorHelper(orderLines);
3014
- _context35.prev = 13;
3286
+ _context41.prev = 13;
3015
3287
  _iterator2.s();
3016
3288
  case 15:
3017
3289
  if ((_step2 = _iterator2.n()).done) {
3018
- _context35.next = 29;
3290
+ _context41.next = 29;
3019
3291
  break;
3020
3292
  }
3021
3293
  line = _step2.value;
3022
- _context35.t0 = result.splice;
3023
- _context35.t1 = result;
3024
- _context35.t2 = [0, result.length];
3025
- _context35.t3 = _toConsumableArray;
3026
- _context35.next = 23;
3294
+ _context41.t0 = result.splice;
3295
+ _context41.t1 = result;
3296
+ _context41.t2 = [0, result.length];
3297
+ _context41.t3 = _toConsumableArray;
3298
+ _context41.next = 23;
3027
3299
  return this.addProductToOrder(line.product);
3028
3300
  case 23:
3029
- _context35.t4 = _context35.sent;
3030
- _context35.t5 = (0, _context35.t3)(_context35.t4);
3031
- _context35.t6 = _context35.t2.concat.call(_context35.t2, _context35.t5);
3032
- _context35.t0.apply.call(_context35.t0, _context35.t1, _context35.t6);
3301
+ _context41.t4 = _context41.sent;
3302
+ _context41.t5 = (0, _context41.t3)(_context41.t4);
3303
+ _context41.t6 = _context41.t2.concat.call(_context41.t2, _context41.t5);
3304
+ _context41.t0.apply.call(_context41.t0, _context41.t1, _context41.t6);
3033
3305
  case 27:
3034
- _context35.next = 15;
3306
+ _context41.next = 15;
3035
3307
  break;
3036
3308
  case 29:
3037
- _context35.next = 34;
3309
+ _context41.next = 34;
3038
3310
  break;
3039
3311
  case 31:
3040
- _context35.prev = 31;
3041
- _context35.t7 = _context35["catch"](13);
3042
- _iterator2.e(_context35.t7);
3312
+ _context41.prev = 31;
3313
+ _context41.t7 = _context41["catch"](13);
3314
+ _iterator2.e(_context41.t7);
3043
3315
  case 34:
3044
- _context35.prev = 34;
3316
+ _context41.prev = 34;
3045
3317
  _iterator2.f();
3046
- return _context35.finish(34);
3318
+ return _context41.finish(34);
3047
3319
  case 37:
3048
- return _context35.abrupt("return", result);
3320
+ return _context41.abrupt("return", result);
3049
3321
  case 38:
3050
3322
  case "end":
3051
- return _context35.stop();
3323
+ return _context41.stop();
3052
3324
  }
3053
- }, _callee35, this, [[13, 31, 34, 37]]);
3325
+ }, _callee41, this, [[13, 31, 34, 37]]);
3054
3326
  }));
3055
- function addAddTimeProductsToBooking(_x25) {
3327
+ function addAddTimeProductsToBooking(_x27) {
3056
3328
  return _addAddTimeProductsToBooking.apply(this, arguments);
3057
3329
  }
3058
3330
  return addAddTimeProductsToBooking;
@@ -3060,42 +3332,49 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3060
3332
  }, {
3061
3333
  key: "setOtherParams",
3062
3334
  value: function () {
3063
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
3064
- var _ref19,
3065
- _ref19$cover,
3335
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
3336
+ var _this11 = this;
3337
+ var _ref21,
3338
+ _ref21$cover,
3066
3339
  cover,
3340
+ nextParams,
3067
3341
  invoiceContextChanged,
3068
- _args36 = arguments;
3069
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3070
- while (1) switch (_context36.prev = _context36.next) {
3342
+ _args42 = arguments;
3343
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3344
+ while (1) switch (_context42.prev = _context42.next) {
3071
3345
  case 0:
3072
- _ref19 = _args36.length > 1 && _args36[1] !== undefined ? _args36[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
3073
- _context36.next = 3;
3346
+ _ref21 = _args42.length > 1 && _args42[1] !== undefined ? _args42[1] : {}, _ref21$cover = _ref21.cover, cover = _ref21$cover === void 0 ? false : _ref21$cover;
3347
+ nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
3348
+ if (['businessCode', 'business_code', 'channel', 'platform', 'shop_id', 'tenantId', 'cacheId'].some(function (key) {
3349
+ var _this11$otherParams;
3350
+ return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams[key]);
3351
+ })) this.orderCustomerContactRequest = null;
3352
+ _context42.next = 5;
3074
3353
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
3075
3354
  cover: cover
3076
3355
  });
3077
- case 3:
3356
+ case 5:
3078
3357
  invoiceContextChanged = (params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || (params === null || params === void 0 ? void 0 : params.channel) !== undefined || (params === null || params === void 0 ? void 0 : params.platform) !== undefined || Object.prototype.hasOwnProperty.call(params, 'openData');
3079
3358
  if (!invoiceContextChanged) {
3080
- _context36.next = 7;
3359
+ _context42.next = 9;
3081
3360
  break;
3082
3361
  }
3083
- _context36.next = 7;
3362
+ _context42.next = 9;
3084
3363
  return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
3085
- case 7:
3364
+ case 9:
3086
3365
  if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
3087
- _context36.next = 10;
3366
+ _context42.next = 12;
3088
3367
  break;
3089
3368
  }
3090
- _context36.next = 10;
3369
+ _context42.next = 12;
3091
3370
  return this.configureIdGeneratorFromOpenData();
3092
- case 10:
3371
+ case 12:
3093
3372
  case "end":
3094
- return _context36.stop();
3373
+ return _context42.stop();
3095
3374
  }
3096
- }, _callee36, this);
3375
+ }, _callee42, this);
3097
3376
  }));
3098
- function setOtherParams(_x26) {
3377
+ function setOtherParams(_x28) {
3099
3378
  return _setOtherParams.apply(this, arguments);
3100
3379
  }
3101
3380
  return setOtherParams;
@@ -3112,15 +3391,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3112
3391
  }, {
3113
3392
  key: "handlePrintWristband",
3114
3393
  value: function () {
3115
- var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
3394
+ var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
3116
3395
  var _this$getOrderIdentit2;
3117
3396
  var deviceTask, deviceId, idempotencyKey;
3118
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3119
- while (1) switch (_context37.prev = _context37.next) {
3397
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3398
+ while (1) switch (_context43.prev = _context43.next) {
3120
3399
  case 0:
3121
3400
  deviceTask = this.getDeviceTaskPlugin();
3122
3401
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
3123
- _context37.next = 4;
3402
+ _context43.next = 4;
3124
3403
  break;
3125
3404
  }
3126
3405
  this.logger.addLog({
@@ -3130,7 +3409,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3130
3409
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3131
3410
  }
3132
3411
  });
3133
- return _context37.abrupt("return");
3412
+ return _context43.abrupt("return");
3134
3413
  case 4:
3135
3414
  this.logger.addLog({
3136
3415
  type: 'info',
@@ -3139,10 +3418,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3139
3418
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3140
3419
  }
3141
3420
  });
3142
- _context37.next = 7;
3421
+ _context43.next = 7;
3143
3422
  return this.getShortNumberOrDeviceId();
3144
3423
  case 7:
3145
- deviceId = _context37.sent;
3424
+ deviceId = _context43.sent;
3146
3425
  idempotencyKey = createUuidV4();
3147
3426
  deviceTask.dispatch({
3148
3427
  action: 'print_all',
@@ -3162,11 +3441,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3162
3441
  });
3163
3442
  case 10:
3164
3443
  case "end":
3165
- return _context37.stop();
3444
+ return _context43.stop();
3166
3445
  }
3167
- }, _callee37, this);
3446
+ }, _callee43, this);
3168
3447
  }));
3169
- function handlePrintWristband(_x27) {
3448
+ function handlePrintWristband(_x29) {
3170
3449
  return _handlePrintWristband.apply(this, arguments);
3171
3450
  }
3172
3451
  return handlePrintWristband;
@@ -3174,11 +3453,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3174
3453
  }, {
3175
3454
  key: "handleRedeem",
3176
3455
  value: function () {
3177
- var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
3178
- var _this$store$order8, _this$store$order8$ge, _this$store$order9, _ref20, _tempOrder$order_id2;
3456
+ var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
3457
+ var _this$store$order8, _this$store$order8$ge, _this$store$order9, _ref22, _tempOrder$order_id2;
3179
3458
  var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
3180
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3181
- while (1) switch (_context38.prev = _context38.next) {
3459
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3460
+ while (1) switch (_context44.prev = _context44.next) {
3182
3461
  case 0:
3183
3462
  voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
3184
3463
  status = params.is_checkin ? 'used' : 'unused';
@@ -3202,20 +3481,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3202
3481
  });
3203
3482
  });
3204
3483
  if (!(tempOrder && hasUpdatedVoucher)) {
3205
- _context38.next = 11;
3484
+ _context44.next = 11;
3206
3485
  break;
3207
3486
  }
3208
- _context38.next = 11;
3487
+ _context44.next = 11;
3209
3488
  return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
3210
3489
  vouchers: nextVouchers
3211
3490
  }));
3212
3491
  case 11:
3213
3492
  this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
3214
3493
  if (!(voucherIds.length === 0)) {
3215
- _context38.next = 14;
3494
+ _context44.next = 14;
3216
3495
  break;
3217
3496
  }
3218
- return _context38.abrupt("return", {
3497
+ return _context44.abrupt("return", {
3219
3498
  code: 200,
3220
3499
  status: true,
3221
3500
  message: '',
@@ -3224,9 +3503,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3224
3503
  case 14:
3225
3504
  identity = this.getOrderIdentity();
3226
3505
  externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
3227
- 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;
3506
+ orderId = (_ref22 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref22 !== void 0 ? _ref22 : undefined;
3228
3507
  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;
3229
- return _context38.abrupt("return", this.request.post('/machinecode/batch', {
3508
+ return _context44.abrupt("return", this.request.post('/machinecode/batch', {
3230
3509
  ids: voucherIds,
3231
3510
  status: status,
3232
3511
  order_lookup: orderLookup,
@@ -3237,11 +3516,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3237
3516
  }));
3238
3517
  case 19:
3239
3518
  case "end":
3240
- return _context38.stop();
3519
+ return _context44.stop();
3241
3520
  }
3242
- }, _callee38, this);
3521
+ }, _callee44, this);
3243
3522
  }));
3244
- function handleRedeem(_x28) {
3523
+ function handleRedeem(_x30) {
3245
3524
  return _handleRedeem.apply(this, arguments);
3246
3525
  }
3247
3526
  return handleRedeem;
@@ -3253,25 +3532,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3253
3532
  }, {
3254
3533
  key: "destroy",
3255
3534
  value: (function () {
3256
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3535
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
3257
3536
  var _this$scan;
3258
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3259
- while (1) switch (_context39.prev = _context39.next) {
3537
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3538
+ while (1) switch (_context45.prev = _context45.next) {
3260
3539
  case 0:
3261
- _context39.next = 2;
3540
+ this.orderCustomerContactRequest = null;
3541
+ _context45.next = 3;
3262
3542
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
3263
- case 2:
3543
+ case 3:
3264
3544
  try {
3265
3545
  (_this$scan = this.scan) === null || _this$scan === void 0 || _this$scan.removeAllListeners();
3266
3546
  } catch (error) {
3267
3547
  console.warn('[BookingTicket] scan removeAllListeners 失败', error);
3268
3548
  }
3269
3549
  scanCache.clear();
3270
- case 4:
3550
+ case 5:
3271
3551
  case "end":
3272
- return _context39.stop();
3552
+ return _context45.stop();
3273
3553
  }
3274
- }, _callee39, this);
3554
+ }, _callee45, this);
3275
3555
  }));
3276
3556
  function destroy() {
3277
3557
  return _destroy.apply(this, arguments);