@pisell/pisellos 2.3.150 → 2.3.151
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.
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/dist/model/strategy/adapter/itemRule/type.js +10 -0
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/OpenData/types.d.ts +2 -0
- package/dist/modules/Order/index.d.ts +4 -2
- package/dist/modules/Order/index.js +115 -67
- package/dist/modules/Order/types.d.ts +7 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
- package/dist/solution/BaseSales/index.d.ts +5 -1
- package/dist/solution/BaseSales/index.js +1116 -1021
- package/dist/solution/BaseSales/pickupTiming.d.ts +2 -0
- package/dist/solution/BaseSales/pickupTiming.js +16 -5
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -0
- package/dist/solution/BookingTicket/index.js +444 -425
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/lib/model/strategy/adapter/itemRule/type.js +10 -0
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/OpenData/types.d.ts +2 -0
- package/lib/modules/Order/index.d.ts +4 -2
- package/lib/modules/Order/index.js +33 -14
- package/lib/modules/Order/types.d.ts +7 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
- package/lib/solution/BaseSales/index.d.ts +5 -1
- package/lib/solution/BaseSales/index.js +38 -2
- package/lib/solution/BaseSales/pickupTiming.d.ts +2 -0
- package/lib/solution/BaseSales/pickupTiming.js +5 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -0
- package/lib/solution/BookingTicket/index.js +3 -0
- package/package.json +1 -1
|
@@ -452,29 +452,48 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
452
452
|
return getOpenData;
|
|
453
453
|
}()
|
|
454
454
|
}, {
|
|
455
|
-
key: "
|
|
455
|
+
key: "loadFulfillmentItemRuleOpenData",
|
|
456
456
|
value: function () {
|
|
457
|
-
var
|
|
458
|
-
var openData;
|
|
457
|
+
var _loadFulfillmentItemRuleOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
459
458
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
460
459
|
while (1) switch (_context5.prev = _context5.next) {
|
|
461
460
|
case 0:
|
|
462
|
-
_context5.
|
|
461
|
+
return _context5.abrupt("return", this.store.openData ? this.getOpenData() : _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadFulfillmentItemRuleOpenData", this).call(this));
|
|
462
|
+
case 1:
|
|
463
|
+
case "end":
|
|
464
|
+
return _context5.stop();
|
|
465
|
+
}
|
|
466
|
+
}, _callee5, this);
|
|
467
|
+
}));
|
|
468
|
+
function loadFulfillmentItemRuleOpenData() {
|
|
469
|
+
return _loadFulfillmentItemRuleOpenData.apply(this, arguments);
|
|
470
|
+
}
|
|
471
|
+
return loadFulfillmentItemRuleOpenData;
|
|
472
|
+
}()
|
|
473
|
+
}, {
|
|
474
|
+
key: "getInvoiceLayoutConfig",
|
|
475
|
+
value: function () {
|
|
476
|
+
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
477
|
+
var openData;
|
|
478
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
479
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
480
|
+
case 0:
|
|
481
|
+
_context6.next = 2;
|
|
463
482
|
return this.loadOpenDataConfig();
|
|
464
483
|
case 2:
|
|
465
|
-
openData =
|
|
484
|
+
openData = _context6.sent;
|
|
466
485
|
if (openData) {
|
|
467
|
-
|
|
486
|
+
_context6.next = 5;
|
|
468
487
|
break;
|
|
469
488
|
}
|
|
470
|
-
return
|
|
489
|
+
return _context6.abrupt("return", getDefaultInvoiceLayoutConfig());
|
|
471
490
|
case 5:
|
|
472
|
-
return
|
|
491
|
+
return _context6.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
|
|
473
492
|
case 6:
|
|
474
493
|
case "end":
|
|
475
|
-
return
|
|
494
|
+
return _context6.stop();
|
|
476
495
|
}
|
|
477
|
-
},
|
|
496
|
+
}, _callee6, this);
|
|
478
497
|
}));
|
|
479
498
|
function getInvoiceLayoutConfig() {
|
|
480
499
|
return _getInvoiceLayoutConfig.apply(this, arguments);
|
|
@@ -484,27 +503,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
484
503
|
}, {
|
|
485
504
|
key: "getInvoiceTemplateSettings",
|
|
486
505
|
value: function () {
|
|
487
|
-
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
506
|
+
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
488
507
|
var openData;
|
|
489
|
-
return _regeneratorRuntime().wrap(function
|
|
490
|
-
while (1) switch (
|
|
508
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
509
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
491
510
|
case 0:
|
|
492
|
-
|
|
511
|
+
_context7.next = 2;
|
|
493
512
|
return this.loadOpenDataConfig();
|
|
494
513
|
case 2:
|
|
495
|
-
openData =
|
|
514
|
+
openData = _context7.sent;
|
|
496
515
|
if (openData) {
|
|
497
|
-
|
|
516
|
+
_context7.next = 5;
|
|
498
517
|
break;
|
|
499
518
|
}
|
|
500
|
-
return
|
|
519
|
+
return _context7.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
501
520
|
case 5:
|
|
502
|
-
return
|
|
521
|
+
return _context7.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
|
|
503
522
|
case 6:
|
|
504
523
|
case "end":
|
|
505
|
-
return
|
|
524
|
+
return _context7.stop();
|
|
506
525
|
}
|
|
507
|
-
},
|
|
526
|
+
}, _callee7, this);
|
|
508
527
|
}));
|
|
509
528
|
function getInvoiceTemplateSettings() {
|
|
510
529
|
return _getInvoiceTemplateSettings.apply(this, arguments);
|
|
@@ -534,32 +553,32 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
534
553
|
}, {
|
|
535
554
|
key: "getShortNumberOrDeviceId",
|
|
536
555
|
value: function () {
|
|
537
|
-
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
556
|
+
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
538
557
|
var getAsyncIotDeviceInfo, res;
|
|
539
|
-
return _regeneratorRuntime().wrap(function
|
|
540
|
-
while (1) switch (
|
|
558
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
559
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
541
560
|
case 0:
|
|
542
561
|
getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
|
|
543
562
|
if (!getAsyncIotDeviceInfo) {
|
|
544
|
-
|
|
563
|
+
_context8.next = 7;
|
|
545
564
|
break;
|
|
546
565
|
}
|
|
547
|
-
|
|
566
|
+
_context8.next = 4;
|
|
548
567
|
return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
|
|
549
568
|
case 4:
|
|
550
|
-
res =
|
|
569
|
+
res = _context8.sent;
|
|
551
570
|
if (!(res !== null && res !== void 0 && res.short_number)) {
|
|
552
|
-
|
|
571
|
+
_context8.next = 7;
|
|
553
572
|
break;
|
|
554
573
|
}
|
|
555
|
-
return
|
|
574
|
+
return _context8.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
|
|
556
575
|
case 7:
|
|
557
|
-
return
|
|
576
|
+
return _context8.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
|
|
558
577
|
case 8:
|
|
559
578
|
case "end":
|
|
560
|
-
return
|
|
579
|
+
return _context8.stop();
|
|
561
580
|
}
|
|
562
|
-
},
|
|
581
|
+
}, _callee8, this);
|
|
563
582
|
}));
|
|
564
583
|
function getShortNumberOrDeviceId() {
|
|
565
584
|
return _getShortNumberOrDeviceId.apply(this, arguments);
|
|
@@ -569,35 +588,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
569
588
|
}, {
|
|
570
589
|
key: "configureIdGeneratorFromOpenData",
|
|
571
590
|
value: function () {
|
|
572
|
-
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
591
|
+
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
573
592
|
var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
574
593
|
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7;
|
|
575
|
-
return _regeneratorRuntime().wrap(function
|
|
576
|
-
while (1) switch (
|
|
594
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
595
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
577
596
|
case 0:
|
|
578
597
|
// 业务码切换或配置失败时不能复用上一次初始化的短号。
|
|
579
598
|
this.setPaymentNumberDevicePrefix(null);
|
|
580
599
|
idGenerator = this.getIdGeneratorPlugin();
|
|
581
600
|
if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
|
|
582
|
-
|
|
601
|
+
_context9.next = 5;
|
|
583
602
|
break;
|
|
584
603
|
}
|
|
585
604
|
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
586
|
-
return
|
|
605
|
+
return _context9.abrupt("return");
|
|
587
606
|
case 5:
|
|
588
607
|
openDataConfig = null;
|
|
589
|
-
|
|
590
|
-
|
|
608
|
+
_context9.prev = 6;
|
|
609
|
+
_context9.next = 9;
|
|
591
610
|
return this.loadOpenDataConfig();
|
|
592
611
|
case 9:
|
|
593
|
-
openDataConfig =
|
|
594
|
-
|
|
612
|
+
openDataConfig = _context9.sent;
|
|
613
|
+
_context9.next = 16;
|
|
595
614
|
break;
|
|
596
615
|
case 12:
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置',
|
|
600
|
-
return
|
|
616
|
+
_context9.prev = 12;
|
|
617
|
+
_context9.t0 = _context9["catch"](6);
|
|
618
|
+
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context9.t0);
|
|
619
|
+
return _context9.abrupt("return");
|
|
601
620
|
case 16:
|
|
602
621
|
// if (!openDataConfig) return;
|
|
603
622
|
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
@@ -609,21 +628,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
609
628
|
"type": "start_time",
|
|
610
629
|
"time": "00:00"
|
|
611
630
|
};
|
|
612
|
-
|
|
631
|
+
_context9.next = 24;
|
|
613
632
|
return this.getShortNumberOrDeviceId();
|
|
614
633
|
case 24:
|
|
615
|
-
deviceId =
|
|
634
|
+
deviceId = _context9.sent;
|
|
616
635
|
this.setPaymentNumberDevicePrefix(deviceId);
|
|
617
636
|
businessCode = this.getBookingTicketBusinessCode();
|
|
618
637
|
if (businessCode) {
|
|
619
|
-
|
|
638
|
+
_context9.next = 30;
|
|
620
639
|
break;
|
|
621
640
|
}
|
|
622
641
|
console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
|
|
623
|
-
return
|
|
642
|
+
return _context9.abrupt("return");
|
|
624
643
|
case 30:
|
|
625
|
-
|
|
626
|
-
|
|
644
|
+
_context9.prev = 30;
|
|
645
|
+
_context9.next = 33;
|
|
627
646
|
return idGenerator.configure({
|
|
628
647
|
biz: businessCode,
|
|
629
648
|
config: {
|
|
@@ -640,17 +659,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
640
659
|
}
|
|
641
660
|
});
|
|
642
661
|
case 33:
|
|
643
|
-
|
|
662
|
+
_context9.next = 38;
|
|
644
663
|
break;
|
|
645
664
|
case 35:
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
console.warn('[BookingTicket] idGenerator 配置失败',
|
|
665
|
+
_context9.prev = 35;
|
|
666
|
+
_context9.t1 = _context9["catch"](30);
|
|
667
|
+
console.warn('[BookingTicket] idGenerator 配置失败', _context9.t1);
|
|
649
668
|
case 38:
|
|
650
669
|
case "end":
|
|
651
|
-
return
|
|
670
|
+
return _context9.stop();
|
|
652
671
|
}
|
|
653
|
-
},
|
|
672
|
+
}, _callee9, this, [[6, 12], [30, 35]]);
|
|
654
673
|
}));
|
|
655
674
|
function configureIdGeneratorFromOpenData() {
|
|
656
675
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -682,16 +701,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
682
701
|
}, {
|
|
683
702
|
key: "loadSalesDetail",
|
|
684
703
|
value: (function () {
|
|
685
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
704
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(orderIdOrParams) {
|
|
686
705
|
var _ref3;
|
|
687
706
|
var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref4, detailCustomerId, detailCustomerRest, rawId, customer;
|
|
688
|
-
return _regeneratorRuntime().wrap(function
|
|
689
|
-
while (1) switch (
|
|
707
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
708
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
690
709
|
case 0:
|
|
691
|
-
|
|
710
|
+
_context10.next = 2;
|
|
692
711
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
|
|
693
712
|
case 2:
|
|
694
|
-
sales =
|
|
713
|
+
sales = _context10.sent;
|
|
695
714
|
customerModule = this.store.customer;
|
|
696
715
|
detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
|
|
697
716
|
orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
|
|
@@ -723,12 +742,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
723
742
|
});
|
|
724
743
|
// await this.store.order.saveDraft();
|
|
725
744
|
}
|
|
726
|
-
return
|
|
745
|
+
return _context10.abrupt("return", sales);
|
|
727
746
|
case 11:
|
|
728
747
|
case "end":
|
|
729
|
-
return
|
|
748
|
+
return _context10.stop();
|
|
730
749
|
}
|
|
731
|
-
},
|
|
750
|
+
}, _callee10, this);
|
|
732
751
|
}));
|
|
733
752
|
function loadSalesDetail(_x3) {
|
|
734
753
|
return _loadSalesDetail.apply(this, arguments);
|
|
@@ -738,56 +757,56 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
738
757
|
}, {
|
|
739
758
|
key: "scanPromotionCode",
|
|
740
759
|
value: function () {
|
|
741
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
760
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(code, customerId) {
|
|
742
761
|
var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
|
|
743
|
-
return _regeneratorRuntime().wrap(function
|
|
744
|
-
while (1) switch (
|
|
762
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
763
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
745
764
|
case 0:
|
|
746
765
|
if (this.store.order) {
|
|
747
|
-
|
|
766
|
+
_context11.next = 2;
|
|
748
767
|
break;
|
|
749
768
|
}
|
|
750
769
|
throw new Error('order 模块未初始化');
|
|
751
770
|
case 2:
|
|
752
|
-
|
|
771
|
+
_context11.next = 4;
|
|
753
772
|
return this.store.order.scanCode(code, customerId);
|
|
754
773
|
case 4:
|
|
755
|
-
raw =
|
|
774
|
+
raw = _context11.sent;
|
|
756
775
|
scannedList = raw.scannedDiscountList || [];
|
|
757
776
|
extractedCustomerId = this.getDiscountCustomerId(scannedList);
|
|
758
777
|
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
759
778
|
isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
|
|
760
779
|
if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
|
|
761
|
-
|
|
780
|
+
_context11.next = 18;
|
|
762
781
|
break;
|
|
763
782
|
}
|
|
764
|
-
|
|
765
|
-
|
|
783
|
+
_context11.prev = 10;
|
|
784
|
+
_context11.next = 13;
|
|
766
785
|
return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
767
786
|
case 13:
|
|
768
|
-
|
|
787
|
+
_context11.next = 18;
|
|
769
788
|
break;
|
|
770
789
|
case 15:
|
|
771
|
-
|
|
772
|
-
|
|
790
|
+
_context11.prev = 15;
|
|
791
|
+
_context11.t0 = _context11["catch"](10);
|
|
773
792
|
// 客户映射失败不能阻断原有 Pass 的可用性、展示或优惠处理。
|
|
774
793
|
console.warn('[BookingTicket] scan discount customer resolve failed', {
|
|
775
794
|
customerId: extractedCustomerId,
|
|
776
|
-
error:
|
|
795
|
+
error: _context11.t0
|
|
777
796
|
});
|
|
778
797
|
case 18:
|
|
779
798
|
if (!raw.isAvailable) {
|
|
780
|
-
|
|
799
|
+
_context11.next = 25;
|
|
781
800
|
break;
|
|
782
801
|
}
|
|
783
|
-
|
|
802
|
+
_context11.next = 21;
|
|
784
803
|
return this.store.order.recalculateSummary({
|
|
785
804
|
createIfMissing: true
|
|
786
805
|
});
|
|
787
806
|
case 21:
|
|
788
807
|
this.store.order.persistTempOrder();
|
|
789
808
|
tempOrder = this.store.order.ensureTempOrder();
|
|
790
|
-
|
|
809
|
+
_context11.next = 25;
|
|
791
810
|
return this.effectsEmit('onDiscountApplied', {
|
|
792
811
|
productList: tempOrder.products || [],
|
|
793
812
|
discountList: this.store.order.getDiscountList(),
|
|
@@ -795,7 +814,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
795
814
|
tempOrder: tempOrder
|
|
796
815
|
});
|
|
797
816
|
case 25:
|
|
798
|
-
return
|
|
817
|
+
return _context11.abrupt("return", _objectSpread(_objectSpread({
|
|
799
818
|
isAvailable: raw.isAvailable
|
|
800
819
|
}, raw.isAccepted !== undefined ? {
|
|
801
820
|
isAccepted: raw.isAccepted
|
|
@@ -806,9 +825,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
806
825
|
}));
|
|
807
826
|
case 26:
|
|
808
827
|
case "end":
|
|
809
|
-
return
|
|
828
|
+
return _context11.stop();
|
|
810
829
|
}
|
|
811
|
-
},
|
|
830
|
+
}, _callee11, this, [[10, 15]]);
|
|
812
831
|
}));
|
|
813
832
|
function scanPromotionCode(_x4, _x5) {
|
|
814
833
|
return _scanPromotionCode.apply(this, arguments);
|
|
@@ -818,42 +837,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
818
837
|
}, {
|
|
819
838
|
key: "hydrateOrderCustomerFromScanDiscounts",
|
|
820
839
|
value: function () {
|
|
821
|
-
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
840
|
+
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(discounts) {
|
|
822
841
|
var currentOrderCustomer, customerId, customer;
|
|
823
|
-
return _regeneratorRuntime().wrap(function
|
|
824
|
-
while (1) switch (
|
|
842
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
843
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
825
844
|
case 0:
|
|
826
845
|
currentOrderCustomer = this.store.order.getOrderCustomer();
|
|
827
846
|
if (!currentOrderCustomer) {
|
|
828
|
-
|
|
847
|
+
_context12.next = 3;
|
|
829
848
|
break;
|
|
830
849
|
}
|
|
831
|
-
return
|
|
850
|
+
return _context12.abrupt("return");
|
|
832
851
|
case 3:
|
|
833
852
|
customerId = this.getDiscountCustomerId(discounts);
|
|
834
853
|
if (customerId) {
|
|
835
|
-
|
|
854
|
+
_context12.next = 6;
|
|
836
855
|
break;
|
|
837
856
|
}
|
|
838
|
-
return
|
|
857
|
+
return _context12.abrupt("return");
|
|
839
858
|
case 6:
|
|
840
|
-
|
|
859
|
+
_context12.next = 8;
|
|
841
860
|
return this.resolveCustomerByDiscountCustomerId(customerId);
|
|
842
861
|
case 8:
|
|
843
|
-
customer =
|
|
862
|
+
customer = _context12.sent;
|
|
844
863
|
if (customer) {
|
|
845
|
-
|
|
864
|
+
_context12.next = 11;
|
|
846
865
|
break;
|
|
847
866
|
}
|
|
848
|
-
return
|
|
867
|
+
return _context12.abrupt("return");
|
|
849
868
|
case 11:
|
|
850
869
|
this.store.customer.setSelectedCustomer(customer);
|
|
851
870
|
this.setOrderCustomer(customer);
|
|
852
871
|
case 13:
|
|
853
872
|
case "end":
|
|
854
|
-
return
|
|
873
|
+
return _context12.stop();
|
|
855
874
|
}
|
|
856
|
-
},
|
|
875
|
+
}, _callee12, this);
|
|
857
876
|
}));
|
|
858
877
|
function hydrateOrderCustomerFromScanDiscounts(_x6) {
|
|
859
878
|
return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
|
|
@@ -889,27 +908,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
889
908
|
}, {
|
|
890
909
|
key: "resolveCustomerById",
|
|
891
910
|
value: function () {
|
|
892
|
-
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
911
|
+
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(customerId) {
|
|
893
912
|
var _this2 = this;
|
|
894
913
|
var rawCustomerId, numericCustomerId, normalizedCustomerId, existingRequest, request;
|
|
895
|
-
return _regeneratorRuntime().wrap(function
|
|
896
|
-
while (1) switch (
|
|
914
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
915
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
897
916
|
case 0:
|
|
898
917
|
rawCustomerId = String(customerId !== null && customerId !== void 0 ? customerId : '').trim();
|
|
899
918
|
numericCustomerId = Number(rawCustomerId);
|
|
900
919
|
if (!(!rawCustomerId || !Number.isInteger(numericCustomerId) || numericCustomerId <= 1)) {
|
|
901
|
-
|
|
920
|
+
_context13.next = 4;
|
|
902
921
|
break;
|
|
903
922
|
}
|
|
904
|
-
return
|
|
923
|
+
return _context13.abrupt("return", null);
|
|
905
924
|
case 4:
|
|
906
925
|
normalizedCustomerId = String(numericCustomerId);
|
|
907
926
|
existingRequest = this.customerResolveRequests.get(normalizedCustomerId);
|
|
908
927
|
if (!existingRequest) {
|
|
909
|
-
|
|
928
|
+
_context13.next = 8;
|
|
910
929
|
break;
|
|
911
930
|
}
|
|
912
|
-
return
|
|
931
|
+
return _context13.abrupt("return", existingRequest);
|
|
913
932
|
case 8:
|
|
914
933
|
request = this.request.post("/customer/resolve/".concat(encodeURIComponent(normalizedCustomerId)), {
|
|
915
934
|
with_franchisor_data: 1,
|
|
@@ -929,12 +948,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
929
948
|
}
|
|
930
949
|
});
|
|
931
950
|
this.customerResolveRequests.set(normalizedCustomerId, request);
|
|
932
|
-
return
|
|
951
|
+
return _context13.abrupt("return", request);
|
|
933
952
|
case 11:
|
|
934
953
|
case "end":
|
|
935
|
-
return
|
|
954
|
+
return _context13.stop();
|
|
936
955
|
}
|
|
937
|
-
},
|
|
956
|
+
}, _callee13, this);
|
|
938
957
|
}));
|
|
939
958
|
function resolveCustomerById(_x7) {
|
|
940
959
|
return _resolveCustomerById.apply(this, arguments);
|
|
@@ -986,60 +1005,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
986
1005
|
}, {
|
|
987
1006
|
key: "setBookingStatus",
|
|
988
1007
|
value: (function () {
|
|
989
|
-
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1008
|
+
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(status) {
|
|
990
1009
|
var _this$store$order2, _this$store$order2$ge;
|
|
991
1010
|
var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
|
|
992
|
-
return _regeneratorRuntime().wrap(function
|
|
993
|
-
while (1) switch (
|
|
1011
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1012
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
994
1013
|
case 0:
|
|
995
1014
|
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);
|
|
996
1015
|
if (tempOrder) {
|
|
997
|
-
|
|
1016
|
+
_context14.next = 3;
|
|
998
1017
|
break;
|
|
999
1018
|
}
|
|
1000
1019
|
throw new Error('setBookingStatus: tempOrder 未加载');
|
|
1001
1020
|
case 3:
|
|
1002
1021
|
orderId = tempOrder.order_id;
|
|
1003
1022
|
if (!(orderId === undefined || orderId === null)) {
|
|
1004
|
-
|
|
1023
|
+
_context14.next = 6;
|
|
1005
1024
|
break;
|
|
1006
1025
|
}
|
|
1007
1026
|
throw new Error('setBookingStatus: tempOrder.order_id 缺失');
|
|
1008
1027
|
case 6:
|
|
1009
1028
|
scheduleId = resolveScheduleId(tempOrder);
|
|
1010
1029
|
if (!(scheduleId === null)) {
|
|
1011
|
-
|
|
1030
|
+
_context14.next = 9;
|
|
1012
1031
|
break;
|
|
1013
1032
|
}
|
|
1014
1033
|
throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
|
|
1015
1034
|
case 9:
|
|
1016
1035
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
1017
1036
|
previous = applyBookingsStatus(bookings, status);
|
|
1018
|
-
|
|
1019
|
-
|
|
1037
|
+
_context14.prev = 11;
|
|
1038
|
+
_context14.next = 14;
|
|
1020
1039
|
return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
|
|
1021
1040
|
appointment_status: status
|
|
1022
1041
|
});
|
|
1023
1042
|
case 14:
|
|
1024
|
-
res =
|
|
1025
|
-
|
|
1043
|
+
res = _context14.sent;
|
|
1044
|
+
_context14.next = 17;
|
|
1026
1045
|
return this.refreshSalesDetail();
|
|
1027
1046
|
case 17:
|
|
1028
1047
|
this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
|
|
1029
1048
|
orderId: orderId,
|
|
1030
1049
|
status: status
|
|
1031
1050
|
});
|
|
1032
|
-
return
|
|
1051
|
+
return _context14.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
|
|
1033
1052
|
case 21:
|
|
1034
|
-
|
|
1035
|
-
|
|
1053
|
+
_context14.prev = 21;
|
|
1054
|
+
_context14.t0 = _context14["catch"](11);
|
|
1036
1055
|
restoreBookingsStatus(bookings, previous);
|
|
1037
|
-
throw
|
|
1056
|
+
throw _context14.t0;
|
|
1038
1057
|
case 25:
|
|
1039
1058
|
case "end":
|
|
1040
|
-
return
|
|
1059
|
+
return _context14.stop();
|
|
1041
1060
|
}
|
|
1042
|
-
},
|
|
1061
|
+
}, _callee14, this, [[11, 21]]);
|
|
1043
1062
|
}));
|
|
1044
1063
|
function setBookingStatus(_x8) {
|
|
1045
1064
|
return _setBookingStatus.apply(this, arguments);
|
|
@@ -1070,35 +1089,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1070
1089
|
}, {
|
|
1071
1090
|
key: "transitionChildBooking",
|
|
1072
1091
|
value: (function () {
|
|
1073
|
-
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1092
|
+
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
1074
1093
|
var _this$store$order3, _this$store$order3$ge;
|
|
1075
1094
|
var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
|
|
1076
|
-
return _regeneratorRuntime().wrap(function
|
|
1077
|
-
while (1) switch (
|
|
1095
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1096
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1078
1097
|
case 0:
|
|
1079
1098
|
schedule_event_id = params.schedule_event_id, action = params.action;
|
|
1080
1099
|
if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
|
|
1081
|
-
|
|
1100
|
+
_context15.next = 3;
|
|
1082
1101
|
break;
|
|
1083
1102
|
}
|
|
1084
1103
|
throw new Error('transitionChildBooking: schedule_event_id 不能为空');
|
|
1085
1104
|
case 3:
|
|
1086
1105
|
if (action) {
|
|
1087
|
-
|
|
1106
|
+
_context15.next = 5;
|
|
1088
1107
|
break;
|
|
1089
1108
|
}
|
|
1090
1109
|
throw new Error('transitionChildBooking: action 不能为空');
|
|
1091
1110
|
case 5:
|
|
1092
1111
|
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);
|
|
1093
1112
|
if (tempOrder) {
|
|
1094
|
-
|
|
1113
|
+
_context15.next = 8;
|
|
1095
1114
|
break;
|
|
1096
1115
|
}
|
|
1097
1116
|
throw new Error('transitionChildBooking: tempOrder 未加载');
|
|
1098
1117
|
case 8:
|
|
1099
1118
|
orderId = tempOrder.order_id;
|
|
1100
1119
|
if (!(orderId === undefined || orderId === null)) {
|
|
1101
|
-
|
|
1120
|
+
_context15.next = 11;
|
|
1102
1121
|
break;
|
|
1103
1122
|
}
|
|
1104
1123
|
throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
|
|
@@ -1106,14 +1125,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1106
1125
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
1107
1126
|
targetStatus = resolveStatusAfterTransition(action);
|
|
1108
1127
|
previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
|
|
1109
|
-
|
|
1110
|
-
|
|
1128
|
+
_context15.prev = 14;
|
|
1129
|
+
_context15.next = 17;
|
|
1111
1130
|
return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
|
|
1112
1131
|
action: action
|
|
1113
1132
|
});
|
|
1114
1133
|
case 17:
|
|
1115
|
-
res =
|
|
1116
|
-
|
|
1134
|
+
res = _context15.sent;
|
|
1135
|
+
_context15.next = 20;
|
|
1117
1136
|
return this.refreshSalesDetail();
|
|
1118
1137
|
case 20:
|
|
1119
1138
|
this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
|
|
@@ -1122,19 +1141,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1122
1141
|
action: action,
|
|
1123
1142
|
status: targetStatus
|
|
1124
1143
|
});
|
|
1125
|
-
return
|
|
1144
|
+
return _context15.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
|
|
1126
1145
|
case 24:
|
|
1127
|
-
|
|
1128
|
-
|
|
1146
|
+
_context15.prev = 24;
|
|
1147
|
+
_context15.t0 = _context15["catch"](14);
|
|
1129
1148
|
if (previous !== undefined) {
|
|
1130
1149
|
restoreChildBookingStatus(bookings, schedule_event_id, previous);
|
|
1131
1150
|
}
|
|
1132
|
-
throw
|
|
1151
|
+
throw _context15.t0;
|
|
1133
1152
|
case 28:
|
|
1134
1153
|
case "end":
|
|
1135
|
-
return
|
|
1154
|
+
return _context15.stop();
|
|
1136
1155
|
}
|
|
1137
|
-
},
|
|
1156
|
+
}, _callee15, this, [[14, 24]]);
|
|
1138
1157
|
}));
|
|
1139
1158
|
function transitionChildBooking(_x9) {
|
|
1140
1159
|
return _transitionChildBooking.apply(this, arguments);
|
|
@@ -1155,19 +1174,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1155
1174
|
}, {
|
|
1156
1175
|
key: "refreshSalesDetail",
|
|
1157
1176
|
value: (function () {
|
|
1158
|
-
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1177
|
+
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1159
1178
|
var _this$store$order4, _this$store$order4$ge;
|
|
1160
1179
|
var params,
|
|
1161
1180
|
tempOrder,
|
|
1162
1181
|
orderId,
|
|
1163
|
-
|
|
1164
|
-
return _regeneratorRuntime().wrap(function
|
|
1165
|
-
while (1) switch (
|
|
1182
|
+
_args16 = arguments;
|
|
1183
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1184
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1166
1185
|
case 0:
|
|
1167
|
-
params =
|
|
1186
|
+
params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
|
|
1168
1187
|
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);
|
|
1169
1188
|
if (tempOrder) {
|
|
1170
|
-
|
|
1189
|
+
_context16.next = 4;
|
|
1171
1190
|
break;
|
|
1172
1191
|
}
|
|
1173
1192
|
throw new Error('refreshSalesDetail: tempOrder 未加载');
|
|
@@ -1175,21 +1194,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1175
1194
|
debugger;
|
|
1176
1195
|
orderId = tempOrder.order_id || tempOrder.external_sale_number;
|
|
1177
1196
|
if (!(orderId === undefined || orderId === null)) {
|
|
1178
|
-
|
|
1197
|
+
_context16.next = 8;
|
|
1179
1198
|
break;
|
|
1180
1199
|
}
|
|
1181
|
-
return
|
|
1200
|
+
return _context16.abrupt("return", {});
|
|
1182
1201
|
case 8:
|
|
1183
|
-
return
|
|
1202
|
+
return _context16.abrupt("return", this.loadSalesDetail({
|
|
1184
1203
|
orderId: orderId,
|
|
1185
1204
|
// merge: true
|
|
1186
1205
|
forceRemote: params.forceRemote
|
|
1187
1206
|
}));
|
|
1188
1207
|
case 9:
|
|
1189
1208
|
case "end":
|
|
1190
|
-
return
|
|
1209
|
+
return _context16.stop();
|
|
1191
1210
|
}
|
|
1192
|
-
},
|
|
1211
|
+
}, _callee16, this);
|
|
1193
1212
|
}));
|
|
1194
1213
|
function refreshSalesDetail() {
|
|
1195
1214
|
return _refreshSalesDetail.apply(this, arguments);
|
|
@@ -1205,7 +1224,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1205
1224
|
}, {
|
|
1206
1225
|
key: "loadProducts",
|
|
1207
1226
|
value: (function () {
|
|
1208
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1227
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1209
1228
|
var params,
|
|
1210
1229
|
options,
|
|
1211
1230
|
schedule_date,
|
|
@@ -1214,20 +1233,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1214
1233
|
schedule_datetime,
|
|
1215
1234
|
bookingDate,
|
|
1216
1235
|
_result,
|
|
1217
|
-
|
|
1218
|
-
return _regeneratorRuntime().wrap(function
|
|
1219
|
-
while (1) switch (
|
|
1236
|
+
_args17 = arguments;
|
|
1237
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1238
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1220
1239
|
case 0:
|
|
1221
|
-
params =
|
|
1222
|
-
options =
|
|
1240
|
+
params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
|
|
1241
|
+
options = _args17.length > 1 ? _args17[1] : undefined;
|
|
1223
1242
|
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 对齐;
|
|
1224
1243
|
// requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
|
|
1225
1244
|
bookingDate = schedule_datetime || schedule_date || '';
|
|
1226
1245
|
if (bookingDate) {
|
|
1227
1246
|
this.setBookingDate(bookingDate);
|
|
1228
1247
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1248
|
+
_context17.prev = 5;
|
|
1249
|
+
_context17.next = 8;
|
|
1231
1250
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1232
1251
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1233
1252
|
with_schedule: 1
|
|
@@ -1235,20 +1254,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1235
1254
|
cacheId: this.cacheId
|
|
1236
1255
|
}), options);
|
|
1237
1256
|
case 8:
|
|
1238
|
-
_result =
|
|
1257
|
+
_result = _context17.sent;
|
|
1239
1258
|
this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
|
|
1240
1259
|
this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
|
|
1241
|
-
return
|
|
1260
|
+
return _context17.abrupt("return", _result);
|
|
1242
1261
|
case 14:
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
console.error('Failed to load products:',
|
|
1246
|
-
throw
|
|
1262
|
+
_context17.prev = 14;
|
|
1263
|
+
_context17.t0 = _context17["catch"](5);
|
|
1264
|
+
console.error('Failed to load products:', _context17.t0);
|
|
1265
|
+
throw _context17.t0;
|
|
1247
1266
|
case 18:
|
|
1248
1267
|
case "end":
|
|
1249
|
-
return
|
|
1268
|
+
return _context17.stop();
|
|
1250
1269
|
}
|
|
1251
|
-
},
|
|
1270
|
+
}, _callee17, this, [[5, 14]]);
|
|
1252
1271
|
}));
|
|
1253
1272
|
function loadProducts() {
|
|
1254
1273
|
return _loadProducts.apply(this, arguments);
|
|
@@ -1265,27 +1284,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1265
1284
|
}, {
|
|
1266
1285
|
key: "getAddTimeProducts",
|
|
1267
1286
|
value: (function () {
|
|
1268
|
-
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1287
|
+
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1269
1288
|
var params,
|
|
1270
1289
|
result,
|
|
1271
|
-
|
|
1272
|
-
return _regeneratorRuntime().wrap(function
|
|
1273
|
-
while (1) switch (
|
|
1290
|
+
_args18 = arguments;
|
|
1291
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1292
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1274
1293
|
case 0:
|
|
1275
|
-
params =
|
|
1276
|
-
|
|
1294
|
+
params = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
|
|
1295
|
+
_context18.next = 3;
|
|
1277
1296
|
return this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
|
|
1278
1297
|
cacheId: this.cacheId
|
|
1279
1298
|
}));
|
|
1280
1299
|
case 3:
|
|
1281
|
-
result =
|
|
1300
|
+
result = _context18.sent;
|
|
1282
1301
|
this.addTimeProductsCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
1283
|
-
return
|
|
1302
|
+
return _context18.abrupt("return", result);
|
|
1284
1303
|
case 6:
|
|
1285
1304
|
case "end":
|
|
1286
|
-
return
|
|
1305
|
+
return _context18.stop();
|
|
1287
1306
|
}
|
|
1288
|
-
},
|
|
1307
|
+
}, _callee18, this);
|
|
1289
1308
|
}));
|
|
1290
1309
|
function getAddTimeProducts() {
|
|
1291
1310
|
return _getAddTimeProducts.apply(this, arguments);
|
|
@@ -1310,14 +1329,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1310
1329
|
}, {
|
|
1311
1330
|
key: "queryProductDetail",
|
|
1312
1331
|
value: (function () {
|
|
1313
|
-
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1332
|
+
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params, options) {
|
|
1314
1333
|
var product_id, queryParams, _result2, list;
|
|
1315
|
-
return _regeneratorRuntime().wrap(function
|
|
1316
|
-
while (1) switch (
|
|
1334
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1335
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1317
1336
|
case 0:
|
|
1318
1337
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
|
|
1319
|
-
|
|
1320
|
-
|
|
1338
|
+
_context19.prev = 1;
|
|
1339
|
+
_context19.next = 4;
|
|
1321
1340
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1322
1341
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1323
1342
|
with_schedule: 1
|
|
@@ -1326,21 +1345,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1326
1345
|
cacheId: this.cacheId
|
|
1327
1346
|
}), options);
|
|
1328
1347
|
case 4:
|
|
1329
|
-
_result2 =
|
|
1348
|
+
_result2 = _context19.sent;
|
|
1330
1349
|
list = Array.isArray(_result2) ? _result2 : [];
|
|
1331
|
-
return
|
|
1350
|
+
return _context19.abrupt("return", list.find(function (product) {
|
|
1332
1351
|
return Number(product.id) === Number(product_id);
|
|
1333
1352
|
}));
|
|
1334
1353
|
case 9:
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
console.error('Failed to query product detail:',
|
|
1338
|
-
throw
|
|
1354
|
+
_context19.prev = 9;
|
|
1355
|
+
_context19.t0 = _context19["catch"](1);
|
|
1356
|
+
console.error('Failed to query product detail:', _context19.t0);
|
|
1357
|
+
throw _context19.t0;
|
|
1339
1358
|
case 13:
|
|
1340
1359
|
case "end":
|
|
1341
|
-
return
|
|
1360
|
+
return _context19.stop();
|
|
1342
1361
|
}
|
|
1343
|
-
},
|
|
1362
|
+
}, _callee19, this, [[1, 9]]);
|
|
1344
1363
|
}));
|
|
1345
1364
|
function queryProductDetail(_x10, _x11) {
|
|
1346
1365
|
return _queryProductDetail.apply(this, arguments);
|
|
@@ -1355,26 +1374,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1355
1374
|
}, {
|
|
1356
1375
|
key: "loadProductDetail",
|
|
1357
1376
|
value: (function () {
|
|
1358
|
-
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1377
|
+
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params, options) {
|
|
1359
1378
|
var product_id, queryParams, products;
|
|
1360
|
-
return _regeneratorRuntime().wrap(function
|
|
1361
|
-
while (1) switch (
|
|
1379
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1380
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1362
1381
|
case 0:
|
|
1363
1382
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
|
|
1364
|
-
|
|
1383
|
+
_context20.next = 3;
|
|
1365
1384
|
return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
|
|
1366
1385
|
product_ids: [product_id]
|
|
1367
1386
|
}), options);
|
|
1368
1387
|
case 3:
|
|
1369
|
-
products =
|
|
1370
|
-
return
|
|
1388
|
+
products = _context20.sent;
|
|
1389
|
+
return _context20.abrupt("return", products.find(function (product) {
|
|
1371
1390
|
return Number(product.id) === Number(product_id);
|
|
1372
1391
|
}));
|
|
1373
1392
|
case 5:
|
|
1374
1393
|
case "end":
|
|
1375
|
-
return
|
|
1394
|
+
return _context20.stop();
|
|
1376
1395
|
}
|
|
1377
|
-
},
|
|
1396
|
+
}, _callee20, this);
|
|
1378
1397
|
}));
|
|
1379
1398
|
function loadProductDetail(_x12, _x13) {
|
|
1380
1399
|
return _loadProductDetail.apply(this, arguments);
|
|
@@ -1409,16 +1428,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1409
1428
|
}, {
|
|
1410
1429
|
key: "getProducts",
|
|
1411
1430
|
value: (function () {
|
|
1412
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1413
|
-
return _regeneratorRuntime().wrap(function
|
|
1414
|
-
while (1) switch (
|
|
1431
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1432
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1433
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1415
1434
|
case 0:
|
|
1416
|
-
return
|
|
1435
|
+
return _context21.abrupt("return", this.store.products.getProducts());
|
|
1417
1436
|
case 1:
|
|
1418
1437
|
case "end":
|
|
1419
|
-
return
|
|
1438
|
+
return _context21.stop();
|
|
1420
1439
|
}
|
|
1421
|
-
},
|
|
1440
|
+
}, _callee21, this);
|
|
1422
1441
|
}));
|
|
1423
1442
|
function getProducts() {
|
|
1424
1443
|
return _getProducts.apply(this, arguments);
|
|
@@ -1483,33 +1502,33 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1483
1502
|
}, {
|
|
1484
1503
|
key: "getProductByIds",
|
|
1485
1504
|
value: (function () {
|
|
1486
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1505
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(ids, options) {
|
|
1487
1506
|
var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
|
|
1488
1507
|
var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
|
|
1489
|
-
return _regeneratorRuntime().wrap(function
|
|
1490
|
-
while (1) switch (
|
|
1508
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1509
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1491
1510
|
case 0:
|
|
1492
1511
|
normalizedIds = Array.from(new Set((ids || []).map(function (id) {
|
|
1493
1512
|
return Number(id);
|
|
1494
1513
|
}).filter(function (id) {
|
|
1495
1514
|
return Number.isFinite(id);
|
|
1496
1515
|
})));
|
|
1497
|
-
|
|
1516
|
+
_context22.next = 3;
|
|
1498
1517
|
return this.store.products.getProductByIds(normalizedIds);
|
|
1499
1518
|
case 3:
|
|
1500
|
-
|
|
1501
|
-
if (
|
|
1502
|
-
|
|
1519
|
+
_context22.t0 = _context22.sent;
|
|
1520
|
+
if (_context22.t0) {
|
|
1521
|
+
_context22.next = 6;
|
|
1503
1522
|
break;
|
|
1504
1523
|
}
|
|
1505
|
-
|
|
1524
|
+
_context22.t0 = [];
|
|
1506
1525
|
case 6:
|
|
1507
|
-
localProducts =
|
|
1526
|
+
localProducts = _context22.t0;
|
|
1508
1527
|
if (options !== null && options !== void 0 && options.loadMissing) {
|
|
1509
|
-
|
|
1528
|
+
_context22.next = 9;
|
|
1510
1529
|
break;
|
|
1511
1530
|
}
|
|
1512
|
-
return
|
|
1531
|
+
return _context22.abrupt("return", localProducts);
|
|
1513
1532
|
case 9:
|
|
1514
1533
|
localProductIds = new Set(localProducts.map(function (product) {
|
|
1515
1534
|
return Number(product.id);
|
|
@@ -1518,15 +1537,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1518
1537
|
return !localProductIds.has(id);
|
|
1519
1538
|
});
|
|
1520
1539
|
if (missingIds.length) {
|
|
1521
|
-
|
|
1540
|
+
_context22.next = 13;
|
|
1522
1541
|
break;
|
|
1523
1542
|
}
|
|
1524
|
-
return
|
|
1543
|
+
return _context22.abrupt("return", localProducts);
|
|
1525
1544
|
case 13:
|
|
1526
1545
|
rawBookingDate = this.getBookingDate();
|
|
1527
1546
|
bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
|
|
1528
1547
|
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);
|
|
1529
|
-
|
|
1548
|
+
_context22.next = 18;
|
|
1530
1549
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1531
1550
|
product_ids: missingIds,
|
|
1532
1551
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
@@ -1539,7 +1558,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1539
1558
|
customer_id: customerId
|
|
1540
1559
|
} : {}));
|
|
1541
1560
|
case 18:
|
|
1542
|
-
loadedProducts =
|
|
1561
|
+
loadedProducts = _context22.sent;
|
|
1543
1562
|
productById = new Map();
|
|
1544
1563
|
[].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
|
|
1545
1564
|
var productId = Number(product.id);
|
|
@@ -1547,16 +1566,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1547
1566
|
productById.set(productId, product);
|
|
1548
1567
|
}
|
|
1549
1568
|
});
|
|
1550
|
-
return
|
|
1569
|
+
return _context22.abrupt("return", normalizedIds.map(function (id) {
|
|
1551
1570
|
return productById.get(id);
|
|
1552
1571
|
}).filter(function (product) {
|
|
1553
1572
|
return Boolean(product);
|
|
1554
1573
|
}));
|
|
1555
1574
|
case 22:
|
|
1556
1575
|
case "end":
|
|
1557
|
-
return
|
|
1576
|
+
return _context22.stop();
|
|
1558
1577
|
}
|
|
1559
|
-
},
|
|
1578
|
+
}, _callee22, this);
|
|
1560
1579
|
}));
|
|
1561
1580
|
function getProductByIds(_x14, _x15) {
|
|
1562
1581
|
return _getProductByIds.apply(this, arguments);
|
|
@@ -1572,25 +1591,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1572
1591
|
}, {
|
|
1573
1592
|
key: "getScheduleTimePoints",
|
|
1574
1593
|
value: (function () {
|
|
1575
|
-
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1594
|
+
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
1576
1595
|
var result;
|
|
1577
|
-
return _regeneratorRuntime().wrap(function
|
|
1578
|
-
while (1) switch (
|
|
1596
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1597
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1579
1598
|
case 0:
|
|
1580
|
-
|
|
1599
|
+
_context23.next = 2;
|
|
1581
1600
|
return this.request.post('/menu/schedule-time-points', {
|
|
1582
1601
|
menu_list_ids: params.menu_list_ids
|
|
1583
1602
|
}, {
|
|
1584
1603
|
osServer: true
|
|
1585
1604
|
});
|
|
1586
1605
|
case 2:
|
|
1587
|
-
result =
|
|
1588
|
-
return
|
|
1606
|
+
result = _context23.sent;
|
|
1607
|
+
return _context23.abrupt("return", result.data || []);
|
|
1589
1608
|
case 4:
|
|
1590
1609
|
case "end":
|
|
1591
|
-
return
|
|
1610
|
+
return _context23.stop();
|
|
1592
1611
|
}
|
|
1593
|
-
},
|
|
1612
|
+
}, _callee23, this);
|
|
1594
1613
|
}));
|
|
1595
1614
|
function getScheduleTimePoints(_x16) {
|
|
1596
1615
|
return _getScheduleTimePoints.apply(this, arguments);
|
|
@@ -1606,30 +1625,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1606
1625
|
}, {
|
|
1607
1626
|
key: "getCustomerList",
|
|
1608
1627
|
value: (function () {
|
|
1609
|
-
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1628
|
+
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1610
1629
|
var params,
|
|
1611
1630
|
_result3,
|
|
1612
|
-
|
|
1613
|
-
return _regeneratorRuntime().wrap(function
|
|
1614
|
-
while (1) switch (
|
|
1631
|
+
_args24 = arguments;
|
|
1632
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1633
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1615
1634
|
case 0:
|
|
1616
|
-
params =
|
|
1617
|
-
|
|
1618
|
-
|
|
1635
|
+
params = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
|
|
1636
|
+
_context24.prev = 1;
|
|
1637
|
+
_context24.next = 4;
|
|
1619
1638
|
return this.store.customer.getCustomerList(params);
|
|
1620
1639
|
case 4:
|
|
1621
|
-
_result3 =
|
|
1622
|
-
return
|
|
1640
|
+
_result3 = _context24.sent;
|
|
1641
|
+
return _context24.abrupt("return", _result3);
|
|
1623
1642
|
case 8:
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
console.error('Failed to get customer list:',
|
|
1627
|
-
throw
|
|
1643
|
+
_context24.prev = 8;
|
|
1644
|
+
_context24.t0 = _context24["catch"](1);
|
|
1645
|
+
console.error('Failed to get customer list:', _context24.t0);
|
|
1646
|
+
throw _context24.t0;
|
|
1628
1647
|
case 12:
|
|
1629
1648
|
case "end":
|
|
1630
|
-
return
|
|
1649
|
+
return _context24.stop();
|
|
1631
1650
|
}
|
|
1632
|
-
},
|
|
1651
|
+
}, _callee24, this, [[1, 8]]);
|
|
1633
1652
|
}));
|
|
1634
1653
|
function getCustomerList() {
|
|
1635
1654
|
return _getCustomerList.apply(this, arguments);
|
|
@@ -1849,24 +1868,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1849
1868
|
}, {
|
|
1850
1869
|
key: "restoreOrder",
|
|
1851
1870
|
value: (function () {
|
|
1852
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1871
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1853
1872
|
var _this$store$customer;
|
|
1854
1873
|
var tempOrder;
|
|
1855
|
-
return _regeneratorRuntime().wrap(function
|
|
1856
|
-
while (1) switch (
|
|
1874
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1875
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1857
1876
|
case 0:
|
|
1858
|
-
|
|
1877
|
+
_context25.next = 2;
|
|
1859
1878
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
|
|
1860
1879
|
case 2:
|
|
1861
|
-
tempOrder =
|
|
1880
|
+
tempOrder = _context25.sent;
|
|
1862
1881
|
this.clearOrderCustomer();
|
|
1863
1882
|
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
|
|
1864
|
-
return
|
|
1883
|
+
return _context25.abrupt("return", tempOrder);
|
|
1865
1884
|
case 6:
|
|
1866
1885
|
case "end":
|
|
1867
|
-
return
|
|
1886
|
+
return _context25.stop();
|
|
1868
1887
|
}
|
|
1869
|
-
},
|
|
1888
|
+
}, _callee25, this);
|
|
1870
1889
|
}));
|
|
1871
1890
|
function restoreOrder() {
|
|
1872
1891
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -1901,27 +1920,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1901
1920
|
return this.orderCustomerDiscountRefreshInFlight;
|
|
1902
1921
|
}
|
|
1903
1922
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
1904
|
-
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1923
|
+
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
1905
1924
|
var _this5$store$order$ge, _this5$store$order, _this5$getOrderIdenti;
|
|
1906
1925
|
var currentCustomer, currentTempOrder, currentOrderIdentity, currentOrderId, currentAction, currentOrderTarget;
|
|
1907
|
-
return _regeneratorRuntime().wrap(function
|
|
1908
|
-
while (1) switch (
|
|
1926
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1927
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1909
1928
|
case 0:
|
|
1910
1929
|
if (!previousRefresh) {
|
|
1911
|
-
|
|
1930
|
+
_context26.next = 3;
|
|
1912
1931
|
break;
|
|
1913
1932
|
}
|
|
1914
|
-
|
|
1933
|
+
_context26.next = 3;
|
|
1915
1934
|
return previousRefresh.catch(function () {
|
|
1916
1935
|
return undefined;
|
|
1917
1936
|
});
|
|
1918
1937
|
case 3:
|
|
1919
1938
|
currentCustomer = _this5.store.order.getOrderCustomer();
|
|
1920
1939
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
1921
|
-
|
|
1940
|
+
_context26.next = 6;
|
|
1922
1941
|
break;
|
|
1923
1942
|
}
|
|
1924
|
-
return
|
|
1943
|
+
return _context26.abrupt("return");
|
|
1925
1944
|
case 6:
|
|
1926
1945
|
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);
|
|
1927
1946
|
currentOrderIdentity = (_this5$getOrderIdenti = _this5.getOrderIdentity) === null || _this5$getOrderIdenti === void 0 ? void 0 : _this5$getOrderIdenti.call(_this5);
|
|
@@ -1929,12 +1948,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1929
1948
|
currentAction = !currentOrderId || String(currentOrderId).startsWith('local_order') ? 'create' : 'edit';
|
|
1930
1949
|
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'));
|
|
1931
1950
|
if (!("".concat(customerId, ":").concat(currentAction, ":").concat(currentOrderTarget) !== refreshTarget)) {
|
|
1932
|
-
|
|
1951
|
+
_context26.next = 13;
|
|
1933
1952
|
break;
|
|
1934
1953
|
}
|
|
1935
|
-
return
|
|
1954
|
+
return _context26.abrupt("return");
|
|
1936
1955
|
case 13:
|
|
1937
|
-
|
|
1956
|
+
_context26.next = 15;
|
|
1938
1957
|
return _this5.loadDiscountConfig({
|
|
1939
1958
|
customerId: customerId,
|
|
1940
1959
|
action: action,
|
|
@@ -1942,9 +1961,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1942
1961
|
});
|
|
1943
1962
|
case 15:
|
|
1944
1963
|
case "end":
|
|
1945
|
-
return
|
|
1964
|
+
return _context26.stop();
|
|
1946
1965
|
}
|
|
1947
|
-
},
|
|
1966
|
+
}, _callee26);
|
|
1948
1967
|
}))();
|
|
1949
1968
|
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
1950
1969
|
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
@@ -1967,28 +1986,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1967
1986
|
}, {
|
|
1968
1987
|
key: "prepareProductPriceQueryContext",
|
|
1969
1988
|
value: function () {
|
|
1970
|
-
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1989
|
+
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(customerId) {
|
|
1971
1990
|
var normalizedCustomerId, refreshTask, shouldWait;
|
|
1972
|
-
return _regeneratorRuntime().wrap(function
|
|
1973
|
-
while (1) switch (
|
|
1991
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1992
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1974
1993
|
case 0:
|
|
1975
|
-
|
|
1994
|
+
_context27.next = 2;
|
|
1976
1995
|
return Promise.resolve();
|
|
1977
1996
|
case 2:
|
|
1978
1997
|
normalizedCustomerId = Number(customerId || 0);
|
|
1979
1998
|
refreshTask = this.orderCustomerDiscountRefreshInFlight;
|
|
1980
1999
|
shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
|
|
1981
2000
|
if (!(shouldWait && refreshTask)) {
|
|
1982
|
-
|
|
2001
|
+
_context27.next = 8;
|
|
1983
2002
|
break;
|
|
1984
2003
|
}
|
|
1985
|
-
|
|
2004
|
+
_context27.next = 8;
|
|
1986
2005
|
return refreshTask;
|
|
1987
2006
|
case 8:
|
|
1988
2007
|
case "end":
|
|
1989
|
-
return
|
|
2008
|
+
return _context27.stop();
|
|
1990
2009
|
}
|
|
1991
|
-
},
|
|
2010
|
+
}, _callee27, this);
|
|
1992
2011
|
}));
|
|
1993
2012
|
function prepareProductPriceQueryContext(_x17) {
|
|
1994
2013
|
return _prepareProductPriceQueryContext.apply(this, arguments);
|
|
@@ -2043,27 +2062,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2043
2062
|
}, {
|
|
2044
2063
|
key: "changeCustomerPage",
|
|
2045
2064
|
value: (function () {
|
|
2046
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2065
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(page, pageSize) {
|
|
2047
2066
|
var _result4;
|
|
2048
|
-
return _regeneratorRuntime().wrap(function
|
|
2049
|
-
while (1) switch (
|
|
2067
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2068
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2050
2069
|
case 0:
|
|
2051
|
-
|
|
2052
|
-
|
|
2070
|
+
_context28.prev = 0;
|
|
2071
|
+
_context28.next = 3;
|
|
2053
2072
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
2054
2073
|
case 3:
|
|
2055
|
-
_result4 =
|
|
2056
|
-
return
|
|
2074
|
+
_result4 = _context28.sent;
|
|
2075
|
+
return _context28.abrupt("return", _result4);
|
|
2057
2076
|
case 7:
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
console.error('Failed to change customer page:',
|
|
2061
|
-
throw
|
|
2077
|
+
_context28.prev = 7;
|
|
2078
|
+
_context28.t0 = _context28["catch"](0);
|
|
2079
|
+
console.error('Failed to change customer page:', _context28.t0);
|
|
2080
|
+
throw _context28.t0;
|
|
2062
2081
|
case 11:
|
|
2063
2082
|
case "end":
|
|
2064
|
-
return
|
|
2083
|
+
return _context28.stop();
|
|
2065
2084
|
}
|
|
2066
|
-
},
|
|
2085
|
+
}, _callee28, this, [[0, 7]]);
|
|
2067
2086
|
}));
|
|
2068
2087
|
function changeCustomerPage(_x18, _x19) {
|
|
2069
2088
|
return _changeCustomerPage.apply(this, arguments);
|
|
@@ -2078,28 +2097,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2078
2097
|
}, {
|
|
2079
2098
|
key: "loadMoreCustomers",
|
|
2080
2099
|
value: (function () {
|
|
2081
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2100
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2082
2101
|
var _result5;
|
|
2083
|
-
return _regeneratorRuntime().wrap(function
|
|
2084
|
-
while (1) switch (
|
|
2102
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2103
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2085
2104
|
case 0:
|
|
2086
|
-
|
|
2087
|
-
|
|
2105
|
+
_context29.prev = 0;
|
|
2106
|
+
_context29.next = 3;
|
|
2088
2107
|
return this.store.customer.loadMoreCustomers();
|
|
2089
2108
|
case 3:
|
|
2090
|
-
_result5 =
|
|
2109
|
+
_result5 = _context29.sent;
|
|
2091
2110
|
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
|
|
2092
|
-
return
|
|
2111
|
+
return _context29.abrupt("return", _result5);
|
|
2093
2112
|
case 8:
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
console.error('Failed to load more customers:',
|
|
2097
|
-
throw
|
|
2113
|
+
_context29.prev = 8;
|
|
2114
|
+
_context29.t0 = _context29["catch"](0);
|
|
2115
|
+
console.error('Failed to load more customers:', _context29.t0);
|
|
2116
|
+
throw _context29.t0;
|
|
2098
2117
|
case 12:
|
|
2099
2118
|
case "end":
|
|
2100
|
-
return
|
|
2119
|
+
return _context29.stop();
|
|
2101
2120
|
}
|
|
2102
|
-
},
|
|
2121
|
+
}, _callee29, this, [[0, 8]]);
|
|
2103
2122
|
}));
|
|
2104
2123
|
function loadMoreCustomers() {
|
|
2105
2124
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -2115,31 +2134,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2115
2134
|
}, {
|
|
2116
2135
|
key: "resetAndLoadCustomers",
|
|
2117
2136
|
value: (function () {
|
|
2118
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2137
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2119
2138
|
var params,
|
|
2120
2139
|
_result6,
|
|
2121
|
-
|
|
2122
|
-
return _regeneratorRuntime().wrap(function
|
|
2123
|
-
while (1) switch (
|
|
2140
|
+
_args30 = arguments;
|
|
2141
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2142
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2124
2143
|
case 0:
|
|
2125
|
-
params =
|
|
2126
|
-
|
|
2127
|
-
|
|
2144
|
+
params = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {};
|
|
2145
|
+
_context30.prev = 1;
|
|
2146
|
+
_context30.next = 4;
|
|
2128
2147
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
2129
2148
|
case 4:
|
|
2130
|
-
_result6 =
|
|
2149
|
+
_result6 = _context30.sent;
|
|
2131
2150
|
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
|
|
2132
|
-
return
|
|
2151
|
+
return _context30.abrupt("return", _result6);
|
|
2133
2152
|
case 9:
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
console.error('Failed to reset and load customers:',
|
|
2137
|
-
throw
|
|
2153
|
+
_context30.prev = 9;
|
|
2154
|
+
_context30.t0 = _context30["catch"](1);
|
|
2155
|
+
console.error('Failed to reset and load customers:', _context30.t0);
|
|
2156
|
+
throw _context30.t0;
|
|
2138
2157
|
case 13:
|
|
2139
2158
|
case "end":
|
|
2140
|
-
return
|
|
2159
|
+
return _context30.stop();
|
|
2141
2160
|
}
|
|
2142
|
-
},
|
|
2161
|
+
}, _callee30, this, [[1, 9]]);
|
|
2143
2162
|
}));
|
|
2144
2163
|
function resetAndLoadCustomers() {
|
|
2145
2164
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -2300,16 +2319,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2300
2319
|
}, {
|
|
2301
2320
|
key: "getOtherParams",
|
|
2302
2321
|
value: (function () {
|
|
2303
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2304
|
-
return _regeneratorRuntime().wrap(function
|
|
2305
|
-
while (1) switch (
|
|
2322
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2323
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2324
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2306
2325
|
case 0:
|
|
2307
|
-
return
|
|
2326
|
+
return _context31.abrupt("return", this.otherParams);
|
|
2308
2327
|
case 1:
|
|
2309
2328
|
case "end":
|
|
2310
|
-
return
|
|
2329
|
+
return _context31.stop();
|
|
2311
2330
|
}
|
|
2312
|
-
},
|
|
2331
|
+
}, _callee31, this);
|
|
2313
2332
|
}));
|
|
2314
2333
|
function getOtherParams() {
|
|
2315
2334
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -2630,16 +2649,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2630
2649
|
}, {
|
|
2631
2650
|
key: "updateProductInOrder",
|
|
2632
2651
|
value: (function () {
|
|
2633
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2634
|
-
return _regeneratorRuntime().wrap(function
|
|
2635
|
-
while (1) switch (
|
|
2652
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
2653
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2654
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2636
2655
|
case 0:
|
|
2637
|
-
return
|
|
2656
|
+
return _context32.abrupt("return", this.updateOrderProduct(params));
|
|
2638
2657
|
case 1:
|
|
2639
2658
|
case "end":
|
|
2640
|
-
return
|
|
2659
|
+
return _context32.stop();
|
|
2641
2660
|
}
|
|
2642
|
-
},
|
|
2661
|
+
}, _callee32, this);
|
|
2643
2662
|
}));
|
|
2644
2663
|
function updateProductInOrder(_x20) {
|
|
2645
2664
|
return _updateProductInOrder.apply(this, arguments);
|
|
@@ -2663,24 +2682,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2663
2682
|
}, {
|
|
2664
2683
|
key: "handleGlobalScanCode",
|
|
2665
2684
|
value: (function () {
|
|
2666
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2685
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(code, bridge) {
|
|
2667
2686
|
var _this7 = this;
|
|
2668
2687
|
var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
|
|
2669
|
-
return _regeneratorRuntime().wrap(function
|
|
2670
|
-
while (1) switch (
|
|
2688
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2689
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2671
2690
|
case 0:
|
|
2672
2691
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2673
2692
|
if (trimmed) {
|
|
2674
|
-
|
|
2693
|
+
_context33.next = 4;
|
|
2675
2694
|
break;
|
|
2676
2695
|
}
|
|
2677
2696
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2678
|
-
return
|
|
2697
|
+
return _context33.abrupt("return", {
|
|
2679
2698
|
status: 'failed',
|
|
2680
2699
|
reason: 'empty_code'
|
|
2681
2700
|
});
|
|
2682
2701
|
case 4:
|
|
2683
|
-
|
|
2702
|
+
_context33.prev = 4;
|
|
2684
2703
|
// Capture before lookup/UI awaits, so a result cannot land in a new cart.
|
|
2685
2704
|
// Unscoped POS Order modules return a no-op guard.
|
|
2686
2705
|
beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
|
|
@@ -2710,25 +2729,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2710
2729
|
return _this7.store.products.findProductsByCodeOrBarcode(v);
|
|
2711
2730
|
};
|
|
2712
2731
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2713
|
-
|
|
2732
|
+
_context33.next = 13;
|
|
2714
2733
|
return scanCallback({
|
|
2715
2734
|
type: 'nativeScanner',
|
|
2716
2735
|
value: trimmed
|
|
2717
2736
|
});
|
|
2718
2737
|
case 13:
|
|
2719
|
-
raw =
|
|
2738
|
+
raw = _context33.sent;
|
|
2720
2739
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
2721
2740
|
if (formatted) {
|
|
2722
|
-
|
|
2741
|
+
_context33.next = 18;
|
|
2723
2742
|
break;
|
|
2724
2743
|
}
|
|
2725
2744
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2726
|
-
return
|
|
2745
|
+
return _context33.abrupt("return", {
|
|
2727
2746
|
status: 'failed',
|
|
2728
2747
|
reason: 'not_found'
|
|
2729
2748
|
});
|
|
2730
2749
|
case 18:
|
|
2731
|
-
|
|
2750
|
+
_context33.next = 20;
|
|
2732
2751
|
return applyGlobalScan({
|
|
2733
2752
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
2734
2753
|
beforeScanCommit();
|
|
@@ -2769,23 +2788,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2769
2788
|
}
|
|
2770
2789
|
}, formatted, guardedBridge);
|
|
2771
2790
|
case 20:
|
|
2772
|
-
_result7 =
|
|
2791
|
+
_result7 = _context33.sent;
|
|
2773
2792
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
2774
|
-
return
|
|
2793
|
+
return _context33.abrupt("return", _result7);
|
|
2775
2794
|
case 25:
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
console.error('[BookingTicket] handleGlobalScanCode failed',
|
|
2795
|
+
_context33.prev = 25;
|
|
2796
|
+
_context33.t0 = _context33["catch"](4);
|
|
2797
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context33.t0);
|
|
2779
2798
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2780
|
-
return
|
|
2799
|
+
return _context33.abrupt("return", {
|
|
2781
2800
|
status: 'failed',
|
|
2782
2801
|
reason: 'not_found'
|
|
2783
2802
|
});
|
|
2784
2803
|
case 30:
|
|
2785
2804
|
case "end":
|
|
2786
|
-
return
|
|
2805
|
+
return _context33.stop();
|
|
2787
2806
|
}
|
|
2788
|
-
},
|
|
2807
|
+
}, _callee33, this, [[4, 25]]);
|
|
2789
2808
|
}));
|
|
2790
2809
|
function handleGlobalScanCode(_x21, _x22) {
|
|
2791
2810
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
@@ -2795,37 +2814,37 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2795
2814
|
}, {
|
|
2796
2815
|
key: "getGlobalScanCodeType",
|
|
2797
2816
|
value: (function () {
|
|
2798
|
-
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2817
|
+
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(code) {
|
|
2799
2818
|
var _this8 = this,
|
|
2800
2819
|
_formatGlobalScanResu,
|
|
2801
2820
|
_formatGlobalScanResu2;
|
|
2802
2821
|
var trimmed, scan, raw;
|
|
2803
|
-
return _regeneratorRuntime().wrap(function
|
|
2804
|
-
while (1) switch (
|
|
2822
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2823
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2805
2824
|
case 0:
|
|
2806
2825
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2807
2826
|
if (trimmed) {
|
|
2808
|
-
|
|
2827
|
+
_context34.next = 3;
|
|
2809
2828
|
break;
|
|
2810
2829
|
}
|
|
2811
|
-
return
|
|
2830
|
+
return _context34.abrupt("return", null);
|
|
2812
2831
|
case 3:
|
|
2813
2832
|
scan = handleGlobalScan(this.request, function (value) {
|
|
2814
2833
|
return _this8.store.products.findProductsByCodeOrBarcode(value);
|
|
2815
2834
|
}, this.getSubmitOrderSalesChannel());
|
|
2816
|
-
|
|
2835
|
+
_context34.next = 6;
|
|
2817
2836
|
return scan({
|
|
2818
2837
|
type: 'nativeScanner',
|
|
2819
2838
|
value: trimmed
|
|
2820
2839
|
});
|
|
2821
2840
|
case 6:
|
|
2822
|
-
raw =
|
|
2823
|
-
return
|
|
2841
|
+
raw = _context34.sent;
|
|
2842
|
+
return _context34.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
|
|
2824
2843
|
case 8:
|
|
2825
2844
|
case "end":
|
|
2826
|
-
return
|
|
2845
|
+
return _context34.stop();
|
|
2827
2846
|
}
|
|
2828
|
-
},
|
|
2847
|
+
}, _callee34, this);
|
|
2829
2848
|
}));
|
|
2830
2849
|
function getGlobalScanCodeType(_x23) {
|
|
2831
2850
|
return _getGlobalScanCodeType.apply(this, arguments);
|
|
@@ -2909,11 +2928,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2909
2928
|
}, {
|
|
2910
2929
|
key: "addAddTimeProductToBooking",
|
|
2911
2930
|
value: (function () {
|
|
2912
|
-
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2913
|
-
return _regeneratorRuntime().wrap(function
|
|
2914
|
-
while (1) switch (
|
|
2931
|
+
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(input) {
|
|
2932
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2933
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2915
2934
|
case 0:
|
|
2916
|
-
return
|
|
2935
|
+
return _context35.abrupt("return", this.addAddTimeProductsToBooking({
|
|
2917
2936
|
booking: input.booking,
|
|
2918
2937
|
products: [input],
|
|
2919
2938
|
coveredMinutes: input.coveredMinutes,
|
|
@@ -2921,9 +2940,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2921
2940
|
}));
|
|
2922
2941
|
case 1:
|
|
2923
2942
|
case "end":
|
|
2924
|
-
return
|
|
2943
|
+
return _context35.stop();
|
|
2925
2944
|
}
|
|
2926
|
-
},
|
|
2945
|
+
}, _callee35, this);
|
|
2927
2946
|
}));
|
|
2928
2947
|
function addAddTimeProductToBooking(_x24) {
|
|
2929
2948
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
@@ -2943,16 +2962,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2943
2962
|
}, {
|
|
2944
2963
|
key: "addAddTimeProductsToBooking",
|
|
2945
2964
|
value: (function () {
|
|
2946
|
-
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2965
|
+
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(input) {
|
|
2947
2966
|
var _this9 = this,
|
|
2948
2967
|
_input$bookingPatch;
|
|
2949
2968
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
2950
|
-
return _regeneratorRuntime().wrap(function
|
|
2951
|
-
while (1) switch (
|
|
2969
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2970
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2952
2971
|
case 0:
|
|
2953
2972
|
bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
|
|
2954
2973
|
if (bookingUid) {
|
|
2955
|
-
|
|
2974
|
+
_context36.next = 3;
|
|
2956
2975
|
break;
|
|
2957
2976
|
}
|
|
2958
2977
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
|
|
@@ -2963,7 +2982,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2963
2982
|
};
|
|
2964
2983
|
});
|
|
2965
2984
|
if (this.store.order) {
|
|
2966
|
-
|
|
2985
|
+
_context36.next = 6;
|
|
2967
2986
|
break;
|
|
2968
2987
|
}
|
|
2969
2988
|
throw new Error('order 模块未初始化');
|
|
@@ -2977,53 +2996,53 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2977
2996
|
});
|
|
2978
2997
|
}
|
|
2979
2998
|
if (!(typeof this.store.order.addProductsToOrder === 'function')) {
|
|
2980
|
-
|
|
2999
|
+
_context36.next = 11;
|
|
2981
3000
|
break;
|
|
2982
3001
|
}
|
|
2983
|
-
return
|
|
3002
|
+
return _context36.abrupt("return", this.store.order.addProductsToOrder(orderLines));
|
|
2984
3003
|
case 11:
|
|
2985
3004
|
result = [];
|
|
2986
3005
|
_iterator2 = _createForOfIteratorHelper(orderLines);
|
|
2987
|
-
|
|
3006
|
+
_context36.prev = 13;
|
|
2988
3007
|
_iterator2.s();
|
|
2989
3008
|
case 15:
|
|
2990
3009
|
if ((_step2 = _iterator2.n()).done) {
|
|
2991
|
-
|
|
3010
|
+
_context36.next = 29;
|
|
2992
3011
|
break;
|
|
2993
3012
|
}
|
|
2994
3013
|
line = _step2.value;
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3014
|
+
_context36.t0 = result.splice;
|
|
3015
|
+
_context36.t1 = result;
|
|
3016
|
+
_context36.t2 = [0, result.length];
|
|
3017
|
+
_context36.t3 = _toConsumableArray;
|
|
3018
|
+
_context36.next = 23;
|
|
3000
3019
|
return this.addProductToOrder(line.product);
|
|
3001
3020
|
case 23:
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3021
|
+
_context36.t4 = _context36.sent;
|
|
3022
|
+
_context36.t5 = (0, _context36.t3)(_context36.t4);
|
|
3023
|
+
_context36.t6 = _context36.t2.concat.call(_context36.t2, _context36.t5);
|
|
3024
|
+
_context36.t0.apply.call(_context36.t0, _context36.t1, _context36.t6);
|
|
3006
3025
|
case 27:
|
|
3007
|
-
|
|
3026
|
+
_context36.next = 15;
|
|
3008
3027
|
break;
|
|
3009
3028
|
case 29:
|
|
3010
|
-
|
|
3029
|
+
_context36.next = 34;
|
|
3011
3030
|
break;
|
|
3012
3031
|
case 31:
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
_iterator2.e(
|
|
3032
|
+
_context36.prev = 31;
|
|
3033
|
+
_context36.t7 = _context36["catch"](13);
|
|
3034
|
+
_iterator2.e(_context36.t7);
|
|
3016
3035
|
case 34:
|
|
3017
|
-
|
|
3036
|
+
_context36.prev = 34;
|
|
3018
3037
|
_iterator2.f();
|
|
3019
|
-
return
|
|
3038
|
+
return _context36.finish(34);
|
|
3020
3039
|
case 37:
|
|
3021
|
-
return
|
|
3040
|
+
return _context36.abrupt("return", result);
|
|
3022
3041
|
case 38:
|
|
3023
3042
|
case "end":
|
|
3024
|
-
return
|
|
3043
|
+
return _context36.stop();
|
|
3025
3044
|
}
|
|
3026
|
-
},
|
|
3045
|
+
}, _callee36, this, [[13, 31, 34, 37]]);
|
|
3027
3046
|
}));
|
|
3028
3047
|
function addAddTimeProductsToBooking(_x25) {
|
|
3029
3048
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
@@ -3033,40 +3052,40 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3033
3052
|
}, {
|
|
3034
3053
|
key: "setOtherParams",
|
|
3035
3054
|
value: function () {
|
|
3036
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3055
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
3037
3056
|
var _ref19,
|
|
3038
3057
|
_ref19$cover,
|
|
3039
3058
|
cover,
|
|
3040
3059
|
invoiceContextChanged,
|
|
3041
|
-
|
|
3042
|
-
return _regeneratorRuntime().wrap(function
|
|
3043
|
-
while (1) switch (
|
|
3060
|
+
_args37 = arguments;
|
|
3061
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3062
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3044
3063
|
case 0:
|
|
3045
|
-
_ref19 =
|
|
3046
|
-
|
|
3064
|
+
_ref19 = _args37.length > 1 && _args37[1] !== undefined ? _args37[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
|
|
3065
|
+
_context37.next = 3;
|
|
3047
3066
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
3048
3067
|
cover: cover
|
|
3049
3068
|
});
|
|
3050
3069
|
case 3:
|
|
3051
3070
|
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');
|
|
3052
3071
|
if (!invoiceContextChanged) {
|
|
3053
|
-
|
|
3072
|
+
_context37.next = 7;
|
|
3054
3073
|
break;
|
|
3055
3074
|
}
|
|
3056
|
-
|
|
3075
|
+
_context37.next = 7;
|
|
3057
3076
|
return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
3058
3077
|
case 7:
|
|
3059
3078
|
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
3060
|
-
|
|
3079
|
+
_context37.next = 10;
|
|
3061
3080
|
break;
|
|
3062
3081
|
}
|
|
3063
|
-
|
|
3082
|
+
_context37.next = 10;
|
|
3064
3083
|
return this.configureIdGeneratorFromOpenData();
|
|
3065
3084
|
case 10:
|
|
3066
3085
|
case "end":
|
|
3067
|
-
return
|
|
3086
|
+
return _context37.stop();
|
|
3068
3087
|
}
|
|
3069
|
-
},
|
|
3088
|
+
}, _callee37, this);
|
|
3070
3089
|
}));
|
|
3071
3090
|
function setOtherParams(_x26) {
|
|
3072
3091
|
return _setOtherParams.apply(this, arguments);
|
|
@@ -3085,15 +3104,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3085
3104
|
}, {
|
|
3086
3105
|
key: "handlePrintWristband",
|
|
3087
3106
|
value: function () {
|
|
3088
|
-
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3107
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
3089
3108
|
var _this$getOrderIdentit2;
|
|
3090
3109
|
var deviceTask, deviceId, idempotencyKey;
|
|
3091
|
-
return _regeneratorRuntime().wrap(function
|
|
3092
|
-
while (1) switch (
|
|
3110
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3111
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3093
3112
|
case 0:
|
|
3094
3113
|
deviceTask = this.getDeviceTaskPlugin();
|
|
3095
3114
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
3096
|
-
|
|
3115
|
+
_context38.next = 4;
|
|
3097
3116
|
break;
|
|
3098
3117
|
}
|
|
3099
3118
|
this.logger.addLog({
|
|
@@ -3103,7 +3122,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3103
3122
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3104
3123
|
}
|
|
3105
3124
|
});
|
|
3106
|
-
return
|
|
3125
|
+
return _context38.abrupt("return");
|
|
3107
3126
|
case 4:
|
|
3108
3127
|
this.logger.addLog({
|
|
3109
3128
|
type: 'info',
|
|
@@ -3112,10 +3131,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3112
3131
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3113
3132
|
}
|
|
3114
3133
|
});
|
|
3115
|
-
|
|
3134
|
+
_context38.next = 7;
|
|
3116
3135
|
return this.getShortNumberOrDeviceId();
|
|
3117
3136
|
case 7:
|
|
3118
|
-
deviceId =
|
|
3137
|
+
deviceId = _context38.sent;
|
|
3119
3138
|
idempotencyKey = createUuidV4();
|
|
3120
3139
|
deviceTask.dispatch({
|
|
3121
3140
|
action: 'print_all',
|
|
@@ -3135,9 +3154,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3135
3154
|
});
|
|
3136
3155
|
case 10:
|
|
3137
3156
|
case "end":
|
|
3138
|
-
return
|
|
3157
|
+
return _context38.stop();
|
|
3139
3158
|
}
|
|
3140
|
-
},
|
|
3159
|
+
}, _callee38, this);
|
|
3141
3160
|
}));
|
|
3142
3161
|
function handlePrintWristband(_x27) {
|
|
3143
3162
|
return _handlePrintWristband.apply(this, arguments);
|
|
@@ -3147,11 +3166,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3147
3166
|
}, {
|
|
3148
3167
|
key: "handleRedeem",
|
|
3149
3168
|
value: function () {
|
|
3150
|
-
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3169
|
+
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
3151
3170
|
var _this$store$order7, _this$store$order7$ge, _this$store$order8, _ref20, _tempOrder$order_id2;
|
|
3152
3171
|
var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
|
|
3153
|
-
return _regeneratorRuntime().wrap(function
|
|
3154
|
-
while (1) switch (
|
|
3172
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3173
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3155
3174
|
case 0:
|
|
3156
3175
|
voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
3157
3176
|
status = params.is_checkin ? 'used' : 'unused';
|
|
@@ -3175,20 +3194,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3175
3194
|
});
|
|
3176
3195
|
});
|
|
3177
3196
|
if (!(tempOrder && hasUpdatedVoucher)) {
|
|
3178
|
-
|
|
3197
|
+
_context39.next = 11;
|
|
3179
3198
|
break;
|
|
3180
3199
|
}
|
|
3181
|
-
|
|
3200
|
+
_context39.next = 11;
|
|
3182
3201
|
return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
3183
3202
|
vouchers: nextVouchers
|
|
3184
3203
|
}));
|
|
3185
3204
|
case 11:
|
|
3186
3205
|
this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
|
|
3187
3206
|
if (!(voucherIds.length === 0)) {
|
|
3188
|
-
|
|
3207
|
+
_context39.next = 14;
|
|
3189
3208
|
break;
|
|
3190
3209
|
}
|
|
3191
|
-
return
|
|
3210
|
+
return _context39.abrupt("return", {
|
|
3192
3211
|
code: 200,
|
|
3193
3212
|
status: true,
|
|
3194
3213
|
message: '',
|
|
@@ -3199,7 +3218,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3199
3218
|
externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
|
|
3200
3219
|
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;
|
|
3201
3220
|
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;
|
|
3202
|
-
return
|
|
3221
|
+
return _context39.abrupt("return", this.request.post('/machinecode/batch', {
|
|
3203
3222
|
ids: voucherIds,
|
|
3204
3223
|
status: status,
|
|
3205
3224
|
order_lookup: orderLookup,
|
|
@@ -3210,9 +3229,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3210
3229
|
}));
|
|
3211
3230
|
case 19:
|
|
3212
3231
|
case "end":
|
|
3213
|
-
return
|
|
3232
|
+
return _context39.stop();
|
|
3214
3233
|
}
|
|
3215
|
-
},
|
|
3234
|
+
}, _callee39, this);
|
|
3216
3235
|
}));
|
|
3217
3236
|
function handleRedeem(_x28) {
|
|
3218
3237
|
return _handleRedeem.apply(this, arguments);
|
|
@@ -3226,12 +3245,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3226
3245
|
}, {
|
|
3227
3246
|
key: "destroy",
|
|
3228
3247
|
value: (function () {
|
|
3229
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3248
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3230
3249
|
var _this$scan;
|
|
3231
|
-
return _regeneratorRuntime().wrap(function
|
|
3232
|
-
while (1) switch (
|
|
3250
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3251
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3233
3252
|
case 0:
|
|
3234
|
-
|
|
3253
|
+
_context40.next = 2;
|
|
3235
3254
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
3236
3255
|
case 2:
|
|
3237
3256
|
try {
|
|
@@ -3242,9 +3261,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3242
3261
|
scanCache.clear();
|
|
3243
3262
|
case 4:
|
|
3244
3263
|
case "end":
|
|
3245
|
-
return
|
|
3264
|
+
return _context40.stop();
|
|
3246
3265
|
}
|
|
3247
|
-
},
|
|
3266
|
+
}, _callee40, this);
|
|
3248
3267
|
}));
|
|
3249
3268
|
function destroy() {
|
|
3250
3269
|
return _destroy.apply(this, arguments);
|