@pisell/pisellos 2.3.164 → 2.3.166
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/promotion/evaluator.js +89 -104
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +28 -4
- package/dist/modules/Holder/utils.d.ts +2 -0
- package/dist/modules/Holder/utils.js +32 -2
- package/dist/modules/OpenData/contactInfo.d.ts +20 -0
- package/dist/modules/OpenData/contactInfo.js +70 -0
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +1 -0
- package/dist/modules/OpenData/types.d.ts +9 -0
- package/dist/modules/Order/holderRelations.d.ts +14 -0
- package/dist/modules/Order/holderRelations.js +154 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +89 -44
- package/dist/modules/Order/types.d.ts +19 -1
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
- package/dist/modules/Order/utils/discountProductLineIdentity.js +142 -7
- package/dist/modules/Order/utils/orderCollectionIdentity.js +24 -10
- package/dist/modules/Order/utils.d.ts +1 -1
- package/dist/modules/Order/utils.js +35 -9
- package/dist/modules/Rules/index.js +62 -61
- package/dist/server/index.js +18 -12
- package/dist/server/modules/order/index.d.ts +4 -0
- package/dist/server/modules/order/index.js +255 -190
- package/dist/server/modules/order/types.d.ts +3 -0
- package/dist/server/modules/products/index.js +3 -2
- package/dist/shared/receipt/small-ticket.js +17 -6
- package/dist/shared/sales/loadSalesOrderSnapshot.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +4 -0
- package/dist/solution/BaseSales/index.js +1116 -935
- package/dist/solution/BaseSales/types.d.ts +2 -1
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +7 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -4
- package/dist/solution/BookingTicket/index.d.ts +15 -1
- package/dist/solution/BookingTicket/index.js +784 -501
- package/dist/solution/UnifiedBookingSales/index.js +1 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +9 -14
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +17 -1
- package/lib/modules/Holder/utils.d.ts +2 -0
- package/lib/modules/Holder/utils.js +27 -1
- package/lib/modules/OpenData/contactInfo.d.ts +20 -0
- package/lib/modules/OpenData/contactInfo.js +56 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/OpenData/types.d.ts +9 -0
- package/lib/modules/Order/holderRelations.d.ts +14 -0
- package/lib/modules/Order/holderRelations.js +98 -0
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +44 -12
- package/lib/modules/Order/types.d.ts +19 -1
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
- package/lib/modules/Order/utils/discountProductLineIdentity.js +51 -2
- package/lib/modules/Order/utils/orderCollectionIdentity.js +5 -0
- package/lib/modules/Order/utils.d.ts +1 -1
- package/lib/modules/Order/utils.js +27 -6
- package/lib/modules/Rules/index.js +2 -1
- package/lib/server/index.js +6 -0
- package/lib/server/modules/order/index.d.ts +4 -0
- package/lib/server/modules/order/index.js +46 -4
- package/lib/server/modules/order/types.d.ts +3 -0
- package/lib/server/modules/products/index.js +2 -1
- package/lib/shared/receipt/small-ticket.js +15 -7
- package/lib/shared/sales/loadSalesOrderSnapshot.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +4 -0
- package/lib/solution/BaseSales/index.js +68 -2
- package/lib/solution/BaseSales/types.d.ts +2 -1
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +4 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -8
- package/lib/solution/BookingTicket/index.d.ts +15 -1
- package/lib/solution/BookingTicket/index.js +132 -3
- package/lib/solution/UnifiedBookingSales/index.js +1 -1
- package/package.json +1 -1
|
@@ -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
|
import { FormHooks } from "../../server/modules/form/types";
|
|
55
58
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents'];
|
|
56
59
|
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
@@ -183,6 +186,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
183
186
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
184
187
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshTarget", null);
|
|
185
188
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
|
|
189
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerContactRequest", null);
|
|
186
190
|
_defineProperty(_assertThisInitialized(_this), "customerResolveRequests", new Map());
|
|
187
191
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
|
|
188
192
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlightTarget", null);
|
|
@@ -468,19 +472,38 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
468
472
|
return getOpenData;
|
|
469
473
|
}()
|
|
470
474
|
}, {
|
|
471
|
-
key: "
|
|
475
|
+
key: "loadContactInfoOpenData",
|
|
472
476
|
value: function () {
|
|
473
|
-
var
|
|
477
|
+
var _loadContactInfoOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
474
478
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
475
479
|
while (1) switch (_context5.prev = _context5.next) {
|
|
476
480
|
case 0:
|
|
477
|
-
return _context5.abrupt("return", this.store.openData ? this.getOpenData() : _get(_getPrototypeOf(BookingTicketImpl.prototype), "
|
|
481
|
+
return _context5.abrupt("return", this.store.openData ? this.getOpenData() : _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadContactInfoOpenData", this).call(this));
|
|
478
482
|
case 1:
|
|
479
483
|
case "end":
|
|
480
484
|
return _context5.stop();
|
|
481
485
|
}
|
|
482
486
|
}, _callee5, this);
|
|
483
487
|
}));
|
|
488
|
+
function loadContactInfoOpenData() {
|
|
489
|
+
return _loadContactInfoOpenData.apply(this, arguments);
|
|
490
|
+
}
|
|
491
|
+
return loadContactInfoOpenData;
|
|
492
|
+
}()
|
|
493
|
+
}, {
|
|
494
|
+
key: "loadFulfillmentItemRuleOpenData",
|
|
495
|
+
value: function () {
|
|
496
|
+
var _loadFulfillmentItemRuleOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
497
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
498
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
499
|
+
case 0:
|
|
500
|
+
return _context6.abrupt("return", this.store.openData ? this.getOpenData() : _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadFulfillmentItemRuleOpenData", this).call(this));
|
|
501
|
+
case 1:
|
|
502
|
+
case "end":
|
|
503
|
+
return _context6.stop();
|
|
504
|
+
}
|
|
505
|
+
}, _callee6, this);
|
|
506
|
+
}));
|
|
484
507
|
function loadFulfillmentItemRuleOpenData() {
|
|
485
508
|
return _loadFulfillmentItemRuleOpenData.apply(this, arguments);
|
|
486
509
|
}
|
|
@@ -489,27 +512,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
489
512
|
}, {
|
|
490
513
|
key: "getInvoiceLayoutConfig",
|
|
491
514
|
value: function () {
|
|
492
|
-
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
515
|
+
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
493
516
|
var openData;
|
|
494
|
-
return _regeneratorRuntime().wrap(function
|
|
495
|
-
while (1) switch (
|
|
517
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
518
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
496
519
|
case 0:
|
|
497
|
-
|
|
520
|
+
_context7.next = 2;
|
|
498
521
|
return this.loadOpenDataConfig();
|
|
499
522
|
case 2:
|
|
500
|
-
openData =
|
|
523
|
+
openData = _context7.sent;
|
|
501
524
|
if (openData) {
|
|
502
|
-
|
|
525
|
+
_context7.next = 5;
|
|
503
526
|
break;
|
|
504
527
|
}
|
|
505
|
-
return
|
|
528
|
+
return _context7.abrupt("return", getDefaultInvoiceLayoutConfig());
|
|
506
529
|
case 5:
|
|
507
|
-
return
|
|
530
|
+
return _context7.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
|
|
508
531
|
case 6:
|
|
509
532
|
case "end":
|
|
510
|
-
return
|
|
533
|
+
return _context7.stop();
|
|
511
534
|
}
|
|
512
|
-
},
|
|
535
|
+
}, _callee7, this);
|
|
513
536
|
}));
|
|
514
537
|
function getInvoiceLayoutConfig() {
|
|
515
538
|
return _getInvoiceLayoutConfig.apply(this, arguments);
|
|
@@ -519,27 +542,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
519
542
|
}, {
|
|
520
543
|
key: "getInvoiceTemplateSettings",
|
|
521
544
|
value: function () {
|
|
522
|
-
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
545
|
+
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
523
546
|
var openData;
|
|
524
|
-
return _regeneratorRuntime().wrap(function
|
|
525
|
-
while (1) switch (
|
|
547
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
548
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
526
549
|
case 0:
|
|
527
|
-
|
|
550
|
+
_context8.next = 2;
|
|
528
551
|
return this.loadOpenDataConfig();
|
|
529
552
|
case 2:
|
|
530
|
-
openData =
|
|
553
|
+
openData = _context8.sent;
|
|
531
554
|
if (openData) {
|
|
532
|
-
|
|
555
|
+
_context8.next = 5;
|
|
533
556
|
break;
|
|
534
557
|
}
|
|
535
|
-
return
|
|
558
|
+
return _context8.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
536
559
|
case 5:
|
|
537
|
-
return
|
|
560
|
+
return _context8.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
|
|
538
561
|
case 6:
|
|
539
562
|
case "end":
|
|
540
|
-
return
|
|
563
|
+
return _context8.stop();
|
|
541
564
|
}
|
|
542
|
-
},
|
|
565
|
+
}, _callee8, this);
|
|
543
566
|
}));
|
|
544
567
|
function getInvoiceTemplateSettings() {
|
|
545
568
|
return _getInvoiceTemplateSettings.apply(this, arguments);
|
|
@@ -569,32 +592,32 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
569
592
|
}, {
|
|
570
593
|
key: "getShortNumberOrDeviceId",
|
|
571
594
|
value: function () {
|
|
572
|
-
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
595
|
+
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
573
596
|
var getAsyncIotDeviceInfo, res;
|
|
574
|
-
return _regeneratorRuntime().wrap(function
|
|
575
|
-
while (1) switch (
|
|
597
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
598
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
576
599
|
case 0:
|
|
577
600
|
getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
|
|
578
601
|
if (!getAsyncIotDeviceInfo) {
|
|
579
|
-
|
|
602
|
+
_context9.next = 7;
|
|
580
603
|
break;
|
|
581
604
|
}
|
|
582
|
-
|
|
605
|
+
_context9.next = 4;
|
|
583
606
|
return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
|
|
584
607
|
case 4:
|
|
585
|
-
res =
|
|
608
|
+
res = _context9.sent;
|
|
586
609
|
if (!(res !== null && res !== void 0 && res.short_number)) {
|
|
587
|
-
|
|
610
|
+
_context9.next = 7;
|
|
588
611
|
break;
|
|
589
612
|
}
|
|
590
|
-
return
|
|
613
|
+
return _context9.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
|
|
591
614
|
case 7:
|
|
592
|
-
return
|
|
615
|
+
return _context9.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
|
|
593
616
|
case 8:
|
|
594
617
|
case "end":
|
|
595
|
-
return
|
|
618
|
+
return _context9.stop();
|
|
596
619
|
}
|
|
597
|
-
},
|
|
620
|
+
}, _callee9, this);
|
|
598
621
|
}));
|
|
599
622
|
function getShortNumberOrDeviceId() {
|
|
600
623
|
return _getShortNumberOrDeviceId.apply(this, arguments);
|
|
@@ -604,35 +627,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
604
627
|
}, {
|
|
605
628
|
key: "configureIdGeneratorFromOpenData",
|
|
606
629
|
value: function () {
|
|
607
|
-
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
630
|
+
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
608
631
|
var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
609
632
|
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7, _openDataConfig8, _openDataConfig9;
|
|
610
|
-
return _regeneratorRuntime().wrap(function
|
|
611
|
-
while (1) switch (
|
|
633
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
634
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
612
635
|
case 0:
|
|
613
636
|
// 业务码切换或配置失败时不能复用上一次初始化的短号。
|
|
614
637
|
this.setPaymentNumberDevicePrefix(null);
|
|
615
638
|
idGenerator = this.getIdGeneratorPlugin();
|
|
616
639
|
if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
|
|
617
|
-
|
|
640
|
+
_context10.next = 5;
|
|
618
641
|
break;
|
|
619
642
|
}
|
|
620
643
|
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
621
|
-
return
|
|
644
|
+
return _context10.abrupt("return");
|
|
622
645
|
case 5:
|
|
623
646
|
openDataConfig = null;
|
|
624
|
-
|
|
625
|
-
|
|
647
|
+
_context10.prev = 6;
|
|
648
|
+
_context10.next = 9;
|
|
626
649
|
return this.loadOpenDataConfig();
|
|
627
650
|
case 9:
|
|
628
|
-
openDataConfig =
|
|
629
|
-
|
|
651
|
+
openDataConfig = _context10.sent;
|
|
652
|
+
_context10.next = 16;
|
|
630
653
|
break;
|
|
631
654
|
case 12:
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置',
|
|
635
|
-
return
|
|
655
|
+
_context10.prev = 12;
|
|
656
|
+
_context10.t0 = _context10["catch"](6);
|
|
657
|
+
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context10.t0);
|
|
658
|
+
return _context10.abrupt("return");
|
|
636
659
|
case 16:
|
|
637
660
|
// if (!openDataConfig) return;
|
|
638
661
|
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
@@ -644,21 +667,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
644
667
|
"type": "start_time",
|
|
645
668
|
"time": "00:00"
|
|
646
669
|
};
|
|
647
|
-
|
|
670
|
+
_context10.next = 24;
|
|
648
671
|
return this.getShortNumberOrDeviceId();
|
|
649
672
|
case 24:
|
|
650
|
-
deviceId =
|
|
673
|
+
deviceId = _context10.sent;
|
|
651
674
|
this.setPaymentNumberDevicePrefix(deviceId);
|
|
652
675
|
businessCode = this.getBookingTicketBusinessCode();
|
|
653
676
|
if (businessCode) {
|
|
654
|
-
|
|
677
|
+
_context10.next = 30;
|
|
655
678
|
break;
|
|
656
679
|
}
|
|
657
680
|
console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
|
|
658
|
-
return
|
|
681
|
+
return _context10.abrupt("return");
|
|
659
682
|
case 30:
|
|
660
|
-
|
|
661
|
-
|
|
683
|
+
_context10.prev = 30;
|
|
684
|
+
_context10.next = 33;
|
|
662
685
|
return idGenerator.configure({
|
|
663
686
|
biz: businessCode,
|
|
664
687
|
config: {
|
|
@@ -675,17 +698,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
675
698
|
}
|
|
676
699
|
});
|
|
677
700
|
case 33:
|
|
678
|
-
|
|
701
|
+
_context10.next = 38;
|
|
679
702
|
break;
|
|
680
703
|
case 35:
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
console.warn('[BookingTicket] idGenerator 配置失败',
|
|
704
|
+
_context10.prev = 35;
|
|
705
|
+
_context10.t1 = _context10["catch"](30);
|
|
706
|
+
console.warn('[BookingTicket] idGenerator 配置失败', _context10.t1);
|
|
684
707
|
case 38:
|
|
685
708
|
case "end":
|
|
686
|
-
return
|
|
709
|
+
return _context10.stop();
|
|
687
710
|
}
|
|
688
|
-
},
|
|
711
|
+
}, _callee10, this, [[6, 12], [30, 35]]);
|
|
689
712
|
}));
|
|
690
713
|
function configureIdGeneratorFromOpenData() {
|
|
691
714
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -730,16 +753,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
730
753
|
}, {
|
|
731
754
|
key: "loadSalesDetail",
|
|
732
755
|
value: (function () {
|
|
733
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
756
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(orderIdOrParams) {
|
|
734
757
|
var _ref3;
|
|
735
758
|
var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref4, detailCustomerId, detailCustomerRest, rawId, customer;
|
|
736
|
-
return _regeneratorRuntime().wrap(function
|
|
737
|
-
while (1) switch (
|
|
759
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
760
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
738
761
|
case 0:
|
|
739
|
-
|
|
762
|
+
_context11.next = 2;
|
|
740
763
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
|
|
741
764
|
case 2:
|
|
742
|
-
sales =
|
|
765
|
+
sales = _context11.sent;
|
|
743
766
|
customerModule = this.store.customer;
|
|
744
767
|
detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
|
|
745
768
|
orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
|
|
@@ -771,12 +794,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
771
794
|
});
|
|
772
795
|
// await this.store.order.saveDraft();
|
|
773
796
|
}
|
|
774
|
-
return
|
|
797
|
+
return _context11.abrupt("return", sales);
|
|
775
798
|
case 11:
|
|
776
799
|
case "end":
|
|
777
|
-
return
|
|
800
|
+
return _context11.stop();
|
|
778
801
|
}
|
|
779
|
-
},
|
|
802
|
+
}, _callee11, this);
|
|
780
803
|
}));
|
|
781
804
|
function loadSalesDetail(_x3) {
|
|
782
805
|
return _loadSalesDetail.apply(this, arguments);
|
|
@@ -786,56 +809,56 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
786
809
|
}, {
|
|
787
810
|
key: "scanPromotionCode",
|
|
788
811
|
value: function () {
|
|
789
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
812
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(code, customerId) {
|
|
790
813
|
var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
|
|
791
|
-
return _regeneratorRuntime().wrap(function
|
|
792
|
-
while (1) switch (
|
|
814
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
815
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
793
816
|
case 0:
|
|
794
817
|
if (this.store.order) {
|
|
795
|
-
|
|
818
|
+
_context12.next = 2;
|
|
796
819
|
break;
|
|
797
820
|
}
|
|
798
821
|
throw new Error('order 模块未初始化');
|
|
799
822
|
case 2:
|
|
800
|
-
|
|
823
|
+
_context12.next = 4;
|
|
801
824
|
return this.store.order.scanCode(code, customerId);
|
|
802
825
|
case 4:
|
|
803
|
-
raw =
|
|
826
|
+
raw = _context12.sent;
|
|
804
827
|
scannedList = raw.scannedDiscountList || [];
|
|
805
828
|
extractedCustomerId = this.getDiscountCustomerId(scannedList);
|
|
806
829
|
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
807
830
|
isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
|
|
808
831
|
if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
|
|
809
|
-
|
|
832
|
+
_context12.next = 18;
|
|
810
833
|
break;
|
|
811
834
|
}
|
|
812
|
-
|
|
813
|
-
|
|
835
|
+
_context12.prev = 10;
|
|
836
|
+
_context12.next = 13;
|
|
814
837
|
return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
815
838
|
case 13:
|
|
816
|
-
|
|
839
|
+
_context12.next = 18;
|
|
817
840
|
break;
|
|
818
841
|
case 15:
|
|
819
|
-
|
|
820
|
-
|
|
842
|
+
_context12.prev = 15;
|
|
843
|
+
_context12.t0 = _context12["catch"](10);
|
|
821
844
|
// 客户映射失败不能阻断原有 Pass 的可用性、展示或优惠处理。
|
|
822
845
|
console.warn('[BookingTicket] scan discount customer resolve failed', {
|
|
823
846
|
customerId: extractedCustomerId,
|
|
824
|
-
error:
|
|
847
|
+
error: _context12.t0
|
|
825
848
|
});
|
|
826
849
|
case 18:
|
|
827
850
|
if (!raw.isAvailable) {
|
|
828
|
-
|
|
851
|
+
_context12.next = 25;
|
|
829
852
|
break;
|
|
830
853
|
}
|
|
831
|
-
|
|
854
|
+
_context12.next = 21;
|
|
832
855
|
return this.store.order.recalculateSummary({
|
|
833
856
|
createIfMissing: true
|
|
834
857
|
});
|
|
835
858
|
case 21:
|
|
836
859
|
this.store.order.persistTempOrder();
|
|
837
860
|
tempOrder = this.store.order.ensureTempOrder();
|
|
838
|
-
|
|
861
|
+
_context12.next = 25;
|
|
839
862
|
return this.effectsEmit('onDiscountApplied', {
|
|
840
863
|
productList: tempOrder.products || [],
|
|
841
864
|
discountList: this.store.order.getDiscountList(),
|
|
@@ -843,7 +866,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
843
866
|
tempOrder: tempOrder
|
|
844
867
|
});
|
|
845
868
|
case 25:
|
|
846
|
-
return
|
|
869
|
+
return _context12.abrupt("return", _objectSpread(_objectSpread({
|
|
847
870
|
isAvailable: raw.isAvailable
|
|
848
871
|
}, raw.isAccepted !== undefined ? {
|
|
849
872
|
isAccepted: raw.isAccepted
|
|
@@ -854,9 +877,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
854
877
|
}));
|
|
855
878
|
case 26:
|
|
856
879
|
case "end":
|
|
857
|
-
return
|
|
880
|
+
return _context12.stop();
|
|
858
881
|
}
|
|
859
|
-
},
|
|
882
|
+
}, _callee12, this, [[10, 15]]);
|
|
860
883
|
}));
|
|
861
884
|
function scanPromotionCode(_x4, _x5) {
|
|
862
885
|
return _scanPromotionCode.apply(this, arguments);
|
|
@@ -866,42 +889,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
866
889
|
}, {
|
|
867
890
|
key: "hydrateOrderCustomerFromScanDiscounts",
|
|
868
891
|
value: function () {
|
|
869
|
-
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
892
|
+
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(discounts) {
|
|
870
893
|
var currentOrderCustomer, customerId, customer;
|
|
871
|
-
return _regeneratorRuntime().wrap(function
|
|
872
|
-
while (1) switch (
|
|
894
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
895
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
873
896
|
case 0:
|
|
874
897
|
currentOrderCustomer = this.store.order.getOrderCustomer();
|
|
875
898
|
if (!currentOrderCustomer) {
|
|
876
|
-
|
|
899
|
+
_context13.next = 3;
|
|
877
900
|
break;
|
|
878
901
|
}
|
|
879
|
-
return
|
|
902
|
+
return _context13.abrupt("return");
|
|
880
903
|
case 3:
|
|
881
904
|
customerId = this.getDiscountCustomerId(discounts);
|
|
882
905
|
if (customerId) {
|
|
883
|
-
|
|
906
|
+
_context13.next = 6;
|
|
884
907
|
break;
|
|
885
908
|
}
|
|
886
|
-
return
|
|
909
|
+
return _context13.abrupt("return");
|
|
887
910
|
case 6:
|
|
888
|
-
|
|
911
|
+
_context13.next = 8;
|
|
889
912
|
return this.resolveCustomerByDiscountCustomerId(customerId);
|
|
890
913
|
case 8:
|
|
891
|
-
customer =
|
|
914
|
+
customer = _context13.sent;
|
|
892
915
|
if (customer) {
|
|
893
|
-
|
|
916
|
+
_context13.next = 11;
|
|
894
917
|
break;
|
|
895
918
|
}
|
|
896
|
-
return
|
|
919
|
+
return _context13.abrupt("return");
|
|
897
920
|
case 11:
|
|
898
921
|
this.store.customer.setSelectedCustomer(customer);
|
|
899
922
|
this.setOrderCustomer(customer);
|
|
900
923
|
case 13:
|
|
901
924
|
case "end":
|
|
902
|
-
return
|
|
925
|
+
return _context13.stop();
|
|
903
926
|
}
|
|
904
|
-
},
|
|
927
|
+
}, _callee13, this);
|
|
905
928
|
}));
|
|
906
929
|
function hydrateOrderCustomerFromScanDiscounts(_x6) {
|
|
907
930
|
return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
|
|
@@ -937,27 +960,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
937
960
|
}, {
|
|
938
961
|
key: "resolveCustomerById",
|
|
939
962
|
value: function () {
|
|
940
|
-
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
963
|
+
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(customerId) {
|
|
941
964
|
var _this2 = this;
|
|
942
965
|
var rawCustomerId, numericCustomerId, normalizedCustomerId, existingRequest, request;
|
|
943
|
-
return _regeneratorRuntime().wrap(function
|
|
944
|
-
while (1) switch (
|
|
966
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
967
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
945
968
|
case 0:
|
|
946
969
|
rawCustomerId = String(customerId !== null && customerId !== void 0 ? customerId : '').trim();
|
|
947
970
|
numericCustomerId = Number(rawCustomerId);
|
|
948
971
|
if (!(!rawCustomerId || !Number.isInteger(numericCustomerId) || numericCustomerId <= 1)) {
|
|
949
|
-
|
|
972
|
+
_context14.next = 4;
|
|
950
973
|
break;
|
|
951
974
|
}
|
|
952
|
-
return
|
|
975
|
+
return _context14.abrupt("return", null);
|
|
953
976
|
case 4:
|
|
954
977
|
normalizedCustomerId = String(numericCustomerId);
|
|
955
978
|
existingRequest = this.customerResolveRequests.get(normalizedCustomerId);
|
|
956
979
|
if (!existingRequest) {
|
|
957
|
-
|
|
980
|
+
_context14.next = 8;
|
|
958
981
|
break;
|
|
959
982
|
}
|
|
960
|
-
return
|
|
983
|
+
return _context14.abrupt("return", existingRequest);
|
|
961
984
|
case 8:
|
|
962
985
|
request = this.request.post("/customer/resolve/".concat(encodeURIComponent(normalizedCustomerId)), {
|
|
963
986
|
with_franchisor_data: 1,
|
|
@@ -977,12 +1000,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
977
1000
|
}
|
|
978
1001
|
});
|
|
979
1002
|
this.customerResolveRequests.set(normalizedCustomerId, request);
|
|
980
|
-
return
|
|
1003
|
+
return _context14.abrupt("return", request);
|
|
981
1004
|
case 11:
|
|
982
1005
|
case "end":
|
|
983
|
-
return
|
|
1006
|
+
return _context14.stop();
|
|
984
1007
|
}
|
|
985
|
-
},
|
|
1008
|
+
}, _callee14, this);
|
|
986
1009
|
}));
|
|
987
1010
|
function resolveCustomerById(_x7) {
|
|
988
1011
|
return _resolveCustomerById.apply(this, arguments);
|
|
@@ -1034,60 +1057,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1034
1057
|
}, {
|
|
1035
1058
|
key: "setBookingStatus",
|
|
1036
1059
|
value: (function () {
|
|
1037
|
-
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1060
|
+
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(status) {
|
|
1038
1061
|
var _this$store$order2, _this$store$order2$ge;
|
|
1039
1062
|
var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
|
|
1040
|
-
return _regeneratorRuntime().wrap(function
|
|
1041
|
-
while (1) switch (
|
|
1063
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1064
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1042
1065
|
case 0:
|
|
1043
1066
|
tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$ge = _this$store$order2.getTempOrder) === null || _this$store$order2$ge === void 0 ? void 0 : _this$store$order2$ge.call(_this$store$order2);
|
|
1044
1067
|
if (tempOrder) {
|
|
1045
|
-
|
|
1068
|
+
_context15.next = 3;
|
|
1046
1069
|
break;
|
|
1047
1070
|
}
|
|
1048
1071
|
throw new Error('setBookingStatus: tempOrder 未加载');
|
|
1049
1072
|
case 3:
|
|
1050
1073
|
orderId = tempOrder.order_id;
|
|
1051
1074
|
if (!(orderId === undefined || orderId === null)) {
|
|
1052
|
-
|
|
1075
|
+
_context15.next = 6;
|
|
1053
1076
|
break;
|
|
1054
1077
|
}
|
|
1055
1078
|
throw new Error('setBookingStatus: tempOrder.order_id 缺失');
|
|
1056
1079
|
case 6:
|
|
1057
1080
|
scheduleId = resolveScheduleId(tempOrder);
|
|
1058
1081
|
if (!(scheduleId === null)) {
|
|
1059
|
-
|
|
1082
|
+
_context15.next = 9;
|
|
1060
1083
|
break;
|
|
1061
1084
|
}
|
|
1062
1085
|
throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
|
|
1063
1086
|
case 9:
|
|
1064
1087
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
1065
1088
|
previous = applyBookingsStatus(bookings, status);
|
|
1066
|
-
|
|
1067
|
-
|
|
1089
|
+
_context15.prev = 11;
|
|
1090
|
+
_context15.next = 14;
|
|
1068
1091
|
return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
|
|
1069
1092
|
appointment_status: status
|
|
1070
1093
|
});
|
|
1071
1094
|
case 14:
|
|
1072
|
-
res =
|
|
1073
|
-
|
|
1095
|
+
res = _context15.sent;
|
|
1096
|
+
_context15.next = 17;
|
|
1074
1097
|
return this.refreshSalesDetail();
|
|
1075
1098
|
case 17:
|
|
1076
1099
|
this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
|
|
1077
1100
|
orderId: orderId,
|
|
1078
1101
|
status: status
|
|
1079
1102
|
});
|
|
1080
|
-
return
|
|
1103
|
+
return _context15.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
|
|
1081
1104
|
case 21:
|
|
1082
|
-
|
|
1083
|
-
|
|
1105
|
+
_context15.prev = 21;
|
|
1106
|
+
_context15.t0 = _context15["catch"](11);
|
|
1084
1107
|
restoreBookingsStatus(bookings, previous);
|
|
1085
|
-
throw
|
|
1108
|
+
throw _context15.t0;
|
|
1086
1109
|
case 25:
|
|
1087
1110
|
case "end":
|
|
1088
|
-
return
|
|
1111
|
+
return _context15.stop();
|
|
1089
1112
|
}
|
|
1090
|
-
},
|
|
1113
|
+
}, _callee15, this, [[11, 21]]);
|
|
1091
1114
|
}));
|
|
1092
1115
|
function setBookingStatus(_x8) {
|
|
1093
1116
|
return _setBookingStatus.apply(this, arguments);
|
|
@@ -1118,35 +1141,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1118
1141
|
}, {
|
|
1119
1142
|
key: "transitionChildBooking",
|
|
1120
1143
|
value: (function () {
|
|
1121
|
-
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1144
|
+
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
1122
1145
|
var _this$store$order3, _this$store$order3$ge;
|
|
1123
1146
|
var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
|
|
1124
|
-
return _regeneratorRuntime().wrap(function
|
|
1125
|
-
while (1) switch (
|
|
1147
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1148
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1126
1149
|
case 0:
|
|
1127
1150
|
schedule_event_id = params.schedule_event_id, action = params.action;
|
|
1128
1151
|
if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
|
|
1129
|
-
|
|
1152
|
+
_context16.next = 3;
|
|
1130
1153
|
break;
|
|
1131
1154
|
}
|
|
1132
1155
|
throw new Error('transitionChildBooking: schedule_event_id 不能为空');
|
|
1133
1156
|
case 3:
|
|
1134
1157
|
if (action) {
|
|
1135
|
-
|
|
1158
|
+
_context16.next = 5;
|
|
1136
1159
|
break;
|
|
1137
1160
|
}
|
|
1138
1161
|
throw new Error('transitionChildBooking: action 不能为空');
|
|
1139
1162
|
case 5:
|
|
1140
1163
|
tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getTempOrder) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
|
|
1141
1164
|
if (tempOrder) {
|
|
1142
|
-
|
|
1165
|
+
_context16.next = 8;
|
|
1143
1166
|
break;
|
|
1144
1167
|
}
|
|
1145
1168
|
throw new Error('transitionChildBooking: tempOrder 未加载');
|
|
1146
1169
|
case 8:
|
|
1147
1170
|
orderId = tempOrder.order_id;
|
|
1148
1171
|
if (!(orderId === undefined || orderId === null)) {
|
|
1149
|
-
|
|
1172
|
+
_context16.next = 11;
|
|
1150
1173
|
break;
|
|
1151
1174
|
}
|
|
1152
1175
|
throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
|
|
@@ -1154,14 +1177,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1154
1177
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
1155
1178
|
targetStatus = resolveStatusAfterTransition(action);
|
|
1156
1179
|
previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
|
|
1157
|
-
|
|
1158
|
-
|
|
1180
|
+
_context16.prev = 14;
|
|
1181
|
+
_context16.next = 17;
|
|
1159
1182
|
return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
|
|
1160
1183
|
action: action
|
|
1161
1184
|
});
|
|
1162
1185
|
case 17:
|
|
1163
|
-
res =
|
|
1164
|
-
|
|
1186
|
+
res = _context16.sent;
|
|
1187
|
+
_context16.next = 20;
|
|
1165
1188
|
return this.refreshSalesDetail();
|
|
1166
1189
|
case 20:
|
|
1167
1190
|
this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
|
|
@@ -1170,19 +1193,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1170
1193
|
action: action,
|
|
1171
1194
|
status: targetStatus
|
|
1172
1195
|
});
|
|
1173
|
-
return
|
|
1196
|
+
return _context16.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
|
|
1174
1197
|
case 24:
|
|
1175
|
-
|
|
1176
|
-
|
|
1198
|
+
_context16.prev = 24;
|
|
1199
|
+
_context16.t0 = _context16["catch"](14);
|
|
1177
1200
|
if (previous !== undefined) {
|
|
1178
1201
|
restoreChildBookingStatus(bookings, schedule_event_id, previous);
|
|
1179
1202
|
}
|
|
1180
|
-
throw
|
|
1203
|
+
throw _context16.t0;
|
|
1181
1204
|
case 28:
|
|
1182
1205
|
case "end":
|
|
1183
|
-
return
|
|
1206
|
+
return _context16.stop();
|
|
1184
1207
|
}
|
|
1185
|
-
},
|
|
1208
|
+
}, _callee16, this, [[14, 24]]);
|
|
1186
1209
|
}));
|
|
1187
1210
|
function transitionChildBooking(_x9) {
|
|
1188
1211
|
return _transitionChildBooking.apply(this, arguments);
|
|
@@ -1203,19 +1226,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1203
1226
|
}, {
|
|
1204
1227
|
key: "refreshSalesDetail",
|
|
1205
1228
|
value: (function () {
|
|
1206
|
-
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1229
|
+
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1207
1230
|
var _this$store$order4, _this$store$order4$ge;
|
|
1208
1231
|
var params,
|
|
1209
1232
|
tempOrder,
|
|
1210
1233
|
orderId,
|
|
1211
|
-
|
|
1212
|
-
return _regeneratorRuntime().wrap(function
|
|
1213
|
-
while (1) switch (
|
|
1234
|
+
_args17 = arguments;
|
|
1235
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1236
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1214
1237
|
case 0:
|
|
1215
|
-
params =
|
|
1238
|
+
params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
|
|
1216
1239
|
tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || (_this$store$order4$ge = _this$store$order4.getTempOrder) === null || _this$store$order4$ge === void 0 ? void 0 : _this$store$order4$ge.call(_this$store$order4);
|
|
1217
1240
|
if (tempOrder) {
|
|
1218
|
-
|
|
1241
|
+
_context17.next = 4;
|
|
1219
1242
|
break;
|
|
1220
1243
|
}
|
|
1221
1244
|
throw new Error('refreshSalesDetail: tempOrder 未加载');
|
|
@@ -1223,21 +1246,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1223
1246
|
debugger;
|
|
1224
1247
|
orderId = tempOrder.order_id || tempOrder.external_sale_number;
|
|
1225
1248
|
if (!(orderId === undefined || orderId === null)) {
|
|
1226
|
-
|
|
1249
|
+
_context17.next = 8;
|
|
1227
1250
|
break;
|
|
1228
1251
|
}
|
|
1229
|
-
return
|
|
1252
|
+
return _context17.abrupt("return", {});
|
|
1230
1253
|
case 8:
|
|
1231
|
-
return
|
|
1254
|
+
return _context17.abrupt("return", this.loadSalesDetail({
|
|
1232
1255
|
orderId: orderId,
|
|
1233
1256
|
// merge: true
|
|
1234
1257
|
forceRemote: params.forceRemote
|
|
1235
1258
|
}));
|
|
1236
1259
|
case 9:
|
|
1237
1260
|
case "end":
|
|
1238
|
-
return
|
|
1261
|
+
return _context17.stop();
|
|
1239
1262
|
}
|
|
1240
|
-
},
|
|
1263
|
+
}, _callee17, this);
|
|
1241
1264
|
}));
|
|
1242
1265
|
function refreshSalesDetail() {
|
|
1243
1266
|
return _refreshSalesDetail.apply(this, arguments);
|
|
@@ -1253,7 +1276,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1253
1276
|
}, {
|
|
1254
1277
|
key: "loadProducts",
|
|
1255
1278
|
value: (function () {
|
|
1256
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1279
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1257
1280
|
var params,
|
|
1258
1281
|
options,
|
|
1259
1282
|
schedule_date,
|
|
@@ -1262,20 +1285,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1262
1285
|
schedule_datetime,
|
|
1263
1286
|
bookingDate,
|
|
1264
1287
|
_result,
|
|
1265
|
-
|
|
1266
|
-
return _regeneratorRuntime().wrap(function
|
|
1267
|
-
while (1) switch (
|
|
1288
|
+
_args18 = arguments;
|
|
1289
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1290
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1268
1291
|
case 0:
|
|
1269
|
-
params =
|
|
1270
|
-
options =
|
|
1292
|
+
params = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
|
|
1293
|
+
options = _args18.length > 1 ? _args18[1] : undefined;
|
|
1271
1294
|
schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime; // 优先写入 schedule_datetime(含时分),供加购 presetStartTime 与 TimeBar 对齐;
|
|
1272
1295
|
// requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
|
|
1273
1296
|
bookingDate = schedule_datetime || schedule_date || '';
|
|
1274
1297
|
if (bookingDate) {
|
|
1275
1298
|
this.setBookingDate(bookingDate);
|
|
1276
1299
|
}
|
|
1277
|
-
|
|
1278
|
-
|
|
1300
|
+
_context18.prev = 5;
|
|
1301
|
+
_context18.next = 8;
|
|
1279
1302
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1280
1303
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1281
1304
|
with_schedule: 1
|
|
@@ -1283,20 +1306,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1283
1306
|
cacheId: this.cacheId
|
|
1284
1307
|
}), options);
|
|
1285
1308
|
case 8:
|
|
1286
|
-
_result =
|
|
1309
|
+
_result = _context18.sent;
|
|
1287
1310
|
this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
|
|
1288
1311
|
this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
|
|
1289
|
-
return
|
|
1312
|
+
return _context18.abrupt("return", _result);
|
|
1290
1313
|
case 14:
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
console.error('Failed to load products:',
|
|
1294
|
-
throw
|
|
1314
|
+
_context18.prev = 14;
|
|
1315
|
+
_context18.t0 = _context18["catch"](5);
|
|
1316
|
+
console.error('Failed to load products:', _context18.t0);
|
|
1317
|
+
throw _context18.t0;
|
|
1295
1318
|
case 18:
|
|
1296
1319
|
case "end":
|
|
1297
|
-
return
|
|
1320
|
+
return _context18.stop();
|
|
1298
1321
|
}
|
|
1299
|
-
},
|
|
1322
|
+
}, _callee18, this, [[5, 14]]);
|
|
1300
1323
|
}));
|
|
1301
1324
|
function loadProducts() {
|
|
1302
1325
|
return _loadProducts.apply(this, arguments);
|
|
@@ -1313,27 +1336,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1313
1336
|
}, {
|
|
1314
1337
|
key: "getAddTimeProducts",
|
|
1315
1338
|
value: (function () {
|
|
1316
|
-
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1339
|
+
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1317
1340
|
var params,
|
|
1318
1341
|
result,
|
|
1319
|
-
|
|
1320
|
-
return _regeneratorRuntime().wrap(function
|
|
1321
|
-
while (1) switch (
|
|
1342
|
+
_args19 = arguments;
|
|
1343
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1344
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1322
1345
|
case 0:
|
|
1323
|
-
params =
|
|
1324
|
-
|
|
1346
|
+
params = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
|
|
1347
|
+
_context19.next = 3;
|
|
1325
1348
|
return this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
|
|
1326
1349
|
cacheId: this.cacheId
|
|
1327
1350
|
}));
|
|
1328
1351
|
case 3:
|
|
1329
|
-
result =
|
|
1352
|
+
result = _context19.sent;
|
|
1330
1353
|
this.addTimeProductsCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
1331
|
-
return
|
|
1354
|
+
return _context19.abrupt("return", result);
|
|
1332
1355
|
case 6:
|
|
1333
1356
|
case "end":
|
|
1334
|
-
return
|
|
1357
|
+
return _context19.stop();
|
|
1335
1358
|
}
|
|
1336
|
-
},
|
|
1359
|
+
}, _callee19, this);
|
|
1337
1360
|
}));
|
|
1338
1361
|
function getAddTimeProducts() {
|
|
1339
1362
|
return _getAddTimeProducts.apply(this, arguments);
|
|
@@ -1358,14 +1381,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1358
1381
|
}, {
|
|
1359
1382
|
key: "queryProductDetail",
|
|
1360
1383
|
value: (function () {
|
|
1361
|
-
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1384
|
+
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params, options) {
|
|
1362
1385
|
var product_id, queryParams, _result2, list;
|
|
1363
|
-
return _regeneratorRuntime().wrap(function
|
|
1364
|
-
while (1) switch (
|
|
1386
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1387
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1365
1388
|
case 0:
|
|
1366
1389
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
|
|
1367
|
-
|
|
1368
|
-
|
|
1390
|
+
_context20.prev = 1;
|
|
1391
|
+
_context20.next = 4;
|
|
1369
1392
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1370
1393
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1371
1394
|
with_schedule: 1
|
|
@@ -1374,21 +1397,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1374
1397
|
cacheId: this.cacheId
|
|
1375
1398
|
}), options);
|
|
1376
1399
|
case 4:
|
|
1377
|
-
_result2 =
|
|
1400
|
+
_result2 = _context20.sent;
|
|
1378
1401
|
list = Array.isArray(_result2) ? _result2 : [];
|
|
1379
|
-
return
|
|
1402
|
+
return _context20.abrupt("return", list.find(function (product) {
|
|
1380
1403
|
return Number(product.id) === Number(product_id);
|
|
1381
1404
|
}));
|
|
1382
1405
|
case 9:
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
console.error('Failed to query product detail:',
|
|
1386
|
-
throw
|
|
1406
|
+
_context20.prev = 9;
|
|
1407
|
+
_context20.t0 = _context20["catch"](1);
|
|
1408
|
+
console.error('Failed to query product detail:', _context20.t0);
|
|
1409
|
+
throw _context20.t0;
|
|
1387
1410
|
case 13:
|
|
1388
1411
|
case "end":
|
|
1389
|
-
return
|
|
1412
|
+
return _context20.stop();
|
|
1390
1413
|
}
|
|
1391
|
-
},
|
|
1414
|
+
}, _callee20, this, [[1, 9]]);
|
|
1392
1415
|
}));
|
|
1393
1416
|
function queryProductDetail(_x10, _x11) {
|
|
1394
1417
|
return _queryProductDetail.apply(this, arguments);
|
|
@@ -1403,26 +1426,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1403
1426
|
}, {
|
|
1404
1427
|
key: "loadProductDetail",
|
|
1405
1428
|
value: (function () {
|
|
1406
|
-
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1429
|
+
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params, options) {
|
|
1407
1430
|
var product_id, queryParams, products;
|
|
1408
|
-
return _regeneratorRuntime().wrap(function
|
|
1409
|
-
while (1) switch (
|
|
1431
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1432
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1410
1433
|
case 0:
|
|
1411
1434
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
|
|
1412
|
-
|
|
1435
|
+
_context21.next = 3;
|
|
1413
1436
|
return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
|
|
1414
1437
|
product_ids: [product_id]
|
|
1415
1438
|
}), options);
|
|
1416
1439
|
case 3:
|
|
1417
|
-
products =
|
|
1418
|
-
return
|
|
1440
|
+
products = _context21.sent;
|
|
1441
|
+
return _context21.abrupt("return", products.find(function (product) {
|
|
1419
1442
|
return Number(product.id) === Number(product_id);
|
|
1420
1443
|
}));
|
|
1421
1444
|
case 5:
|
|
1422
1445
|
case "end":
|
|
1423
|
-
return
|
|
1446
|
+
return _context21.stop();
|
|
1424
1447
|
}
|
|
1425
|
-
},
|
|
1448
|
+
}, _callee21, this);
|
|
1426
1449
|
}));
|
|
1427
1450
|
function loadProductDetail(_x12, _x13) {
|
|
1428
1451
|
return _loadProductDetail.apply(this, arguments);
|
|
@@ -1457,16 +1480,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1457
1480
|
}, {
|
|
1458
1481
|
key: "getProducts",
|
|
1459
1482
|
value: (function () {
|
|
1460
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1461
|
-
return _regeneratorRuntime().wrap(function
|
|
1462
|
-
while (1) switch (
|
|
1483
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1484
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1485
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1463
1486
|
case 0:
|
|
1464
|
-
return
|
|
1487
|
+
return _context22.abrupt("return", this.store.products.getProducts());
|
|
1465
1488
|
case 1:
|
|
1466
1489
|
case "end":
|
|
1467
|
-
return
|
|
1490
|
+
return _context22.stop();
|
|
1468
1491
|
}
|
|
1469
|
-
},
|
|
1492
|
+
}, _callee22, this);
|
|
1470
1493
|
}));
|
|
1471
1494
|
function getProducts() {
|
|
1472
1495
|
return _getProducts.apply(this, arguments);
|
|
@@ -1531,33 +1554,33 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1531
1554
|
}, {
|
|
1532
1555
|
key: "getProductByIds",
|
|
1533
1556
|
value: (function () {
|
|
1534
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1557
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(ids, options) {
|
|
1535
1558
|
var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
|
|
1536
1559
|
var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
|
|
1537
|
-
return _regeneratorRuntime().wrap(function
|
|
1538
|
-
while (1) switch (
|
|
1560
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1561
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1539
1562
|
case 0:
|
|
1540
1563
|
normalizedIds = Array.from(new Set((ids || []).map(function (id) {
|
|
1541
1564
|
return Number(id);
|
|
1542
1565
|
}).filter(function (id) {
|
|
1543
1566
|
return Number.isFinite(id);
|
|
1544
1567
|
})));
|
|
1545
|
-
|
|
1568
|
+
_context23.next = 3;
|
|
1546
1569
|
return this.store.products.getProductByIds(normalizedIds);
|
|
1547
1570
|
case 3:
|
|
1548
|
-
|
|
1549
|
-
if (
|
|
1550
|
-
|
|
1571
|
+
_context23.t0 = _context23.sent;
|
|
1572
|
+
if (_context23.t0) {
|
|
1573
|
+
_context23.next = 6;
|
|
1551
1574
|
break;
|
|
1552
1575
|
}
|
|
1553
|
-
|
|
1576
|
+
_context23.t0 = [];
|
|
1554
1577
|
case 6:
|
|
1555
|
-
localProducts =
|
|
1578
|
+
localProducts = _context23.t0;
|
|
1556
1579
|
if (options !== null && options !== void 0 && options.loadMissing) {
|
|
1557
|
-
|
|
1580
|
+
_context23.next = 9;
|
|
1558
1581
|
break;
|
|
1559
1582
|
}
|
|
1560
|
-
return
|
|
1583
|
+
return _context23.abrupt("return", localProducts);
|
|
1561
1584
|
case 9:
|
|
1562
1585
|
localProductIds = new Set(localProducts.map(function (product) {
|
|
1563
1586
|
return Number(product.id);
|
|
@@ -1566,15 +1589,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1566
1589
|
return !localProductIds.has(id);
|
|
1567
1590
|
});
|
|
1568
1591
|
if (missingIds.length) {
|
|
1569
|
-
|
|
1592
|
+
_context23.next = 13;
|
|
1570
1593
|
break;
|
|
1571
1594
|
}
|
|
1572
|
-
return
|
|
1595
|
+
return _context23.abrupt("return", localProducts);
|
|
1573
1596
|
case 13:
|
|
1574
1597
|
rawBookingDate = this.getBookingDate();
|
|
1575
1598
|
bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
|
|
1576
1599
|
customerId = Number((_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$getOrderCustome3 = this.getOrderCustomer()) === null || _this$getOrderCustome3 === void 0 ? void 0 : _this$getOrderCustome3.customer_id);
|
|
1577
|
-
|
|
1600
|
+
_context23.next = 18;
|
|
1578
1601
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1579
1602
|
product_ids: missingIds,
|
|
1580
1603
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
@@ -1587,7 +1610,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1587
1610
|
customer_id: customerId
|
|
1588
1611
|
} : {}));
|
|
1589
1612
|
case 18:
|
|
1590
|
-
loadedProducts =
|
|
1613
|
+
loadedProducts = _context23.sent;
|
|
1591
1614
|
productById = new Map();
|
|
1592
1615
|
[].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
|
|
1593
1616
|
var productId = Number(product.id);
|
|
@@ -1595,16 +1618,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1595
1618
|
productById.set(productId, product);
|
|
1596
1619
|
}
|
|
1597
1620
|
});
|
|
1598
|
-
return
|
|
1621
|
+
return _context23.abrupt("return", normalizedIds.map(function (id) {
|
|
1599
1622
|
return productById.get(id);
|
|
1600
1623
|
}).filter(function (product) {
|
|
1601
1624
|
return Boolean(product);
|
|
1602
1625
|
}));
|
|
1603
1626
|
case 22:
|
|
1604
1627
|
case "end":
|
|
1605
|
-
return
|
|
1628
|
+
return _context23.stop();
|
|
1606
1629
|
}
|
|
1607
|
-
},
|
|
1630
|
+
}, _callee23, this);
|
|
1608
1631
|
}));
|
|
1609
1632
|
function getProductByIds(_x14, _x15) {
|
|
1610
1633
|
return _getProductByIds.apply(this, arguments);
|
|
@@ -1620,25 +1643,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1620
1643
|
}, {
|
|
1621
1644
|
key: "getScheduleTimePoints",
|
|
1622
1645
|
value: (function () {
|
|
1623
|
-
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1646
|
+
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
1624
1647
|
var result;
|
|
1625
|
-
return _regeneratorRuntime().wrap(function
|
|
1626
|
-
while (1) switch (
|
|
1648
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1649
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1627
1650
|
case 0:
|
|
1628
|
-
|
|
1651
|
+
_context24.next = 2;
|
|
1629
1652
|
return this.request.post('/menu/schedule-time-points', {
|
|
1630
1653
|
menu_list_ids: params.menu_list_ids
|
|
1631
1654
|
}, {
|
|
1632
1655
|
osServer: true
|
|
1633
1656
|
});
|
|
1634
1657
|
case 2:
|
|
1635
|
-
result =
|
|
1636
|
-
return
|
|
1658
|
+
result = _context24.sent;
|
|
1659
|
+
return _context24.abrupt("return", result.data || []);
|
|
1637
1660
|
case 4:
|
|
1638
1661
|
case "end":
|
|
1639
|
-
return
|
|
1662
|
+
return _context24.stop();
|
|
1640
1663
|
}
|
|
1641
|
-
},
|
|
1664
|
+
}, _callee24, this);
|
|
1642
1665
|
}));
|
|
1643
1666
|
function getScheduleTimePoints(_x16) {
|
|
1644
1667
|
return _getScheduleTimePoints.apply(this, arguments);
|
|
@@ -1654,30 +1677,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1654
1677
|
}, {
|
|
1655
1678
|
key: "getCustomerList",
|
|
1656
1679
|
value: (function () {
|
|
1657
|
-
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1680
|
+
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1658
1681
|
var params,
|
|
1659
1682
|
_result3,
|
|
1660
|
-
|
|
1661
|
-
return _regeneratorRuntime().wrap(function
|
|
1662
|
-
while (1) switch (
|
|
1683
|
+
_args25 = arguments;
|
|
1684
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1685
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1663
1686
|
case 0:
|
|
1664
|
-
params =
|
|
1665
|
-
|
|
1666
|
-
|
|
1687
|
+
params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
|
|
1688
|
+
_context25.prev = 1;
|
|
1689
|
+
_context25.next = 4;
|
|
1667
1690
|
return this.store.customer.getCustomerList(params);
|
|
1668
1691
|
case 4:
|
|
1669
|
-
_result3 =
|
|
1670
|
-
return
|
|
1692
|
+
_result3 = _context25.sent;
|
|
1693
|
+
return _context25.abrupt("return", _result3);
|
|
1671
1694
|
case 8:
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
console.error('Failed to get customer list:',
|
|
1675
|
-
throw
|
|
1695
|
+
_context25.prev = 8;
|
|
1696
|
+
_context25.t0 = _context25["catch"](1);
|
|
1697
|
+
console.error('Failed to get customer list:', _context25.t0);
|
|
1698
|
+
throw _context25.t0;
|
|
1676
1699
|
case 12:
|
|
1677
1700
|
case "end":
|
|
1678
|
-
return
|
|
1701
|
+
return _context25.stop();
|
|
1679
1702
|
}
|
|
1680
|
-
},
|
|
1703
|
+
}, _callee25, this, [[1, 8]]);
|
|
1681
1704
|
}));
|
|
1682
1705
|
function getCustomerList() {
|
|
1683
1706
|
return _getCustomerList.apply(this, arguments);
|
|
@@ -1787,7 +1810,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1787
1810
|
var _this$store$order$get3,
|
|
1788
1811
|
_this3 = this;
|
|
1789
1812
|
if (!customer) {
|
|
1790
|
-
this.clearOrderCustomer(
|
|
1813
|
+
this.clearOrderCustomer({
|
|
1814
|
+
preserveContactInfo: (options === null || options === void 0 ? void 0 : options.source) === 'detailHydrate'
|
|
1815
|
+
});
|
|
1791
1816
|
return;
|
|
1792
1817
|
}
|
|
1793
1818
|
var previousCustomerId = (_this$store$order$get3 = this.store.order.getOrderCustomer()) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.customer_id;
|
|
@@ -1798,7 +1823,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1798
1823
|
this.discountConfigCacheKey = null;
|
|
1799
1824
|
this.hasManualDiscountSelection = false;
|
|
1800
1825
|
}
|
|
1826
|
+
if (!customerUnchanged && (options === null || options === void 0 ? void 0 : options.source) !== 'detailHydrate') {
|
|
1827
|
+
this.resetOrderCustomerContactInfo();
|
|
1828
|
+
this.store.order.updateTempOrderContactsInfo(cloneDeep(extractCustomerContactInfo(customer)));
|
|
1829
|
+
}
|
|
1801
1830
|
this.store.order.setOrderCustomer(patch, customer);
|
|
1831
|
+
if ((options === null || options === void 0 ? void 0 : options.source) === 'detailHydrate') {
|
|
1832
|
+
this.orderCustomerContactRequest = null;
|
|
1833
|
+
} else {
|
|
1834
|
+
this.prefillOrderCustomerContactInfo(customer, !customerUnchanged);
|
|
1835
|
+
}
|
|
1802
1836
|
var snapshotAfterOrderSet = this.store.order.getOrderCustomerSnapshot();
|
|
1803
1837
|
if (customerUnchanged) {
|
|
1804
1838
|
// hydrate 后 customer_id 已存在但 _extend.customerSnapshot 仍为空时,
|
|
@@ -1831,7 +1865,242 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1831
1865
|
_this3.orderCustomerPromotionRefreshInFlight = null;
|
|
1832
1866
|
});
|
|
1833
1867
|
}
|
|
1868
|
+
}, {
|
|
1869
|
+
key: "resetOrderCustomerContactInfo",
|
|
1870
|
+
value: function resetOrderCustomerContactInfo() {
|
|
1871
|
+
this.orderCustomerContactRequest = null;
|
|
1872
|
+
var order = this.getTempOrder();
|
|
1873
|
+
if (order !== null && order !== void 0 && order._extend) delete order._extend.contactInfoEdited;
|
|
1874
|
+
}
|
|
1834
1875
|
|
|
1876
|
+
/** Explicit edits, including clearing the contact, must win over a pending default. */
|
|
1877
|
+
}, {
|
|
1878
|
+
key: "updateTempOrderContactsInfo",
|
|
1879
|
+
value: function updateTempOrderContactsInfo(contact) {
|
|
1880
|
+
var order = this.store.order.ensureTempOrder();
|
|
1881
|
+
order._extend || (order._extend = {});
|
|
1882
|
+
order._extend.contactInfoEdited = true;
|
|
1883
|
+
this.orderCustomerContactRequest = null;
|
|
1884
|
+
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "updateTempOrderContactsInfo", this).call(this, contact);
|
|
1885
|
+
}
|
|
1886
|
+
}, {
|
|
1887
|
+
key: "getCustomerContactScope",
|
|
1888
|
+
value: function getCustomerContactScope() {
|
|
1889
|
+
var _this$otherParams5, _this$otherParams6, _this$otherParams7;
|
|
1890
|
+
return JSON.stringify([this.getPickupTimingScope(), (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.channel, (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.shop_id, (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.tenantId]);
|
|
1891
|
+
}
|
|
1892
|
+
}, {
|
|
1893
|
+
key: "getCustomerContactOrderKey",
|
|
1894
|
+
value: function getCustomerContactOrderKey() {
|
|
1895
|
+
var _order$_extend;
|
|
1896
|
+
var order = this.getTempOrder();
|
|
1897
|
+
// Cart mutations can replace the object without changing the order.
|
|
1898
|
+
var identity = (order === null || order === void 0 ? void 0 : order.external_sale_number) || (order === null || order === void 0 ? void 0 : order.request_unique_idempotency_token) || (order === null || order === void 0 || (_order$_extend = order._extend) === null || _order$_extend === void 0 ? void 0 : _order$_extend.localId) || (order === null || order === void 0 ? void 0 : order.order_id);
|
|
1899
|
+
return identity ? JSON.stringify([identity, order === null || order === void 0 ? void 0 : order.order_id]) : order;
|
|
1900
|
+
}
|
|
1901
|
+
}, {
|
|
1902
|
+
key: "replaceTempOrder",
|
|
1903
|
+
value: function () {
|
|
1904
|
+
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
1905
|
+
var _get2;
|
|
1906
|
+
var _len2,
|
|
1907
|
+
args,
|
|
1908
|
+
_key2,
|
|
1909
|
+
_args26 = arguments;
|
|
1910
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1911
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1912
|
+
case 0:
|
|
1913
|
+
this.orderCustomerContactRequest = null;
|
|
1914
|
+
for (_len2 = _args26.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1915
|
+
args[_key2] = _args26[_key2];
|
|
1916
|
+
}
|
|
1917
|
+
return _context26.abrupt("return", (_get2 = _get(_getPrototypeOf(BookingTicketImpl.prototype), "replaceTempOrder", this)).call.apply(_get2, [this].concat(args)));
|
|
1918
|
+
case 3:
|
|
1919
|
+
case "end":
|
|
1920
|
+
return _context26.stop();
|
|
1921
|
+
}
|
|
1922
|
+
}, _callee26, this);
|
|
1923
|
+
}));
|
|
1924
|
+
function replaceTempOrder() {
|
|
1925
|
+
return _replaceTempOrder.apply(this, arguments);
|
|
1926
|
+
}
|
|
1927
|
+
return replaceTempOrder;
|
|
1928
|
+
}()
|
|
1929
|
+
}, {
|
|
1930
|
+
key: "applyDefaultOrderCustomerContactInfo",
|
|
1931
|
+
value: function () {
|
|
1932
|
+
var _applyDefaultOrderCustomerContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(contact) {
|
|
1933
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1934
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1935
|
+
case 0:
|
|
1936
|
+
this.store.order.updateTempOrderContactsInfo(cloneDeep(contact));
|
|
1937
|
+
// Metadata may finish after promotion/discount refresh; publish the updated cart explicitly.
|
|
1938
|
+
_context27.next = 3;
|
|
1939
|
+
return this.effectsEmit('onTempOrderReplaced', {
|
|
1940
|
+
tempOrder: this.getTempOrder()
|
|
1941
|
+
});
|
|
1942
|
+
case 3:
|
|
1943
|
+
case "end":
|
|
1944
|
+
return _context27.stop();
|
|
1945
|
+
}
|
|
1946
|
+
}, _callee27, this);
|
|
1947
|
+
}));
|
|
1948
|
+
function applyDefaultOrderCustomerContactInfo(_x17) {
|
|
1949
|
+
return _applyDefaultOrderCustomerContactInfo.apply(this, arguments);
|
|
1950
|
+
}
|
|
1951
|
+
return applyDefaultOrderCustomerContactInfo;
|
|
1952
|
+
}()
|
|
1953
|
+
}, {
|
|
1954
|
+
key: "prefillOrderCustomerContactInfo",
|
|
1955
|
+
value: function prefillOrderCustomerContactInfo(customer, customerChanged) {
|
|
1956
|
+
var _order$_extend2,
|
|
1957
|
+
_this$otherParams8,
|
|
1958
|
+
_this4 = this;
|
|
1959
|
+
var order = this.getTempOrder();
|
|
1960
|
+
var customerId = Number(order === null || order === void 0 ? void 0 : order.customer_id);
|
|
1961
|
+
if (!order || !Number.isInteger(customerId) || customerId <= 1 || order.contacts_info != null || (_order$_extend2 = order._extend) !== null && _order$_extend2 !== void 0 && _order$_extend2.contactInfoEdited) return;
|
|
1962
|
+
// A restored new cart may already have its customer ID. Existing sales keep their snapshot,
|
|
1963
|
+
// even when it is empty; only an explicit customer switch replaces it.
|
|
1964
|
+
if (!customerChanged && order.order_id && !String(order.order_id).startsWith('local_order')) return;
|
|
1965
|
+
var contact = extractCustomerContactInfo(customer);
|
|
1966
|
+
if (contact) {
|
|
1967
|
+
this.orderCustomerContactRequest = null;
|
|
1968
|
+
void this.applyDefaultOrderCustomerContactInfo(contact);
|
|
1969
|
+
return;
|
|
1970
|
+
}
|
|
1971
|
+
// A relation explicitly returned as null is authoritative. Only a missing relation needs fetching.
|
|
1972
|
+
if (customer.contacts_info !== undefined) return;
|
|
1973
|
+
var userPlatform = isCustomerUserPlatform((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform);
|
|
1974
|
+
var getAuthenticatedCustomerId = function getAuthenticatedCustomerId() {
|
|
1975
|
+
var _this4$core, _this4$core$getPlugin, _this4$core$getPlugin2;
|
|
1976
|
+
return Number((_this4$core = _this4.core) === null || _this4$core === void 0 || (_this4$core$getPlugin = _this4$core.getPlugin) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin = _this4$core$getPlugin.call(_this4$core, 'user')) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin.get) === null || _this4$core$getPlugin2 === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin2.call(_this4$core$getPlugin)) === null || _this4$core$getPlugin2 === void 0 ? void 0 : _this4$core$getPlugin2.id);
|
|
1977
|
+
};
|
|
1978
|
+
if (userPlatform && getAuthenticatedCustomerId() !== customerId) return;
|
|
1979
|
+
var scope = this.getCustomerContactScope();
|
|
1980
|
+
var orderKey = this.getCustomerContactOrderKey();
|
|
1981
|
+
var previous = this.orderCustomerContactRequest;
|
|
1982
|
+
if ((previous === null || previous === void 0 ? void 0 : previous.orderKey) === orderKey && previous.customerId === customerId && previous.scope === scope) return;
|
|
1983
|
+
var pending = {
|
|
1984
|
+
orderKey: orderKey,
|
|
1985
|
+
customerId: customerId,
|
|
1986
|
+
scope: scope,
|
|
1987
|
+
promise: Promise.resolve()
|
|
1988
|
+
};
|
|
1989
|
+
this.orderCustomerContactRequest = pending;
|
|
1990
|
+
var loadContact = /*#__PURE__*/function () {
|
|
1991
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
1992
|
+
var _result4, resolved;
|
|
1993
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1994
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1995
|
+
case 0:
|
|
1996
|
+
if (!userPlatform) {
|
|
1997
|
+
_context28.next = 7;
|
|
1998
|
+
break;
|
|
1999
|
+
}
|
|
2000
|
+
_context28.next = 3;
|
|
2001
|
+
return _this4.request.get('/customer/metadata', {
|
|
2002
|
+
key: 'contacts_info'
|
|
2003
|
+
});
|
|
2004
|
+
case 3:
|
|
2005
|
+
_result4 = _context28.sent;
|
|
2006
|
+
if (!((_result4 === null || _result4 === void 0 ? void 0 : _result4.code) !== 200 || (_result4 === null || _result4 === void 0 ? void 0 : _result4.status) === false)) {
|
|
2007
|
+
_context28.next = 6;
|
|
2008
|
+
break;
|
|
2009
|
+
}
|
|
2010
|
+
throw new Error('Customer contact lookup failed');
|
|
2011
|
+
case 6:
|
|
2012
|
+
return _context28.abrupt("return", isContactRecord(_result4.data) ? _result4.data : null);
|
|
2013
|
+
case 7:
|
|
2014
|
+
_context28.next = 9;
|
|
2015
|
+
return _this4.resolveCustomerById(customerId);
|
|
2016
|
+
case 9:
|
|
2017
|
+
resolved = _context28.sent;
|
|
2018
|
+
return _context28.abrupt("return", Number(resolved === null || resolved === void 0 ? void 0 : resolved.id) === customerId ? extractCustomerContactInfo(resolved) : null);
|
|
2019
|
+
case 11:
|
|
2020
|
+
case "end":
|
|
2021
|
+
return _context28.stop();
|
|
2022
|
+
}
|
|
2023
|
+
}, _callee28);
|
|
2024
|
+
}));
|
|
2025
|
+
return function loadContact() {
|
|
2026
|
+
return _ref11.apply(this, arguments);
|
|
2027
|
+
};
|
|
2028
|
+
}();
|
|
2029
|
+
pending.promise = loadContact().then( /*#__PURE__*/function () {
|
|
2030
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(value) {
|
|
2031
|
+
var _current$_extend;
|
|
2032
|
+
var current;
|
|
2033
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2034
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2035
|
+
case 0:
|
|
2036
|
+
current = _this4.getTempOrder();
|
|
2037
|
+
if (!(_this4.orderCustomerContactRequest !== pending || _this4.getCustomerContactOrderKey() !== orderKey || Number(current === null || current === void 0 ? void 0 : current.customer_id) !== customerId || scope !== _this4.getCustomerContactScope() || current !== null && current !== void 0 && (_current$_extend = current._extend) !== null && _current$_extend !== void 0 && _current$_extend.contactInfoEdited || (current === null || current === void 0 ? void 0 : current.contacts_info) != null || userPlatform && getAuthenticatedCustomerId() !== customerId)) {
|
|
2038
|
+
_context29.next = 3;
|
|
2039
|
+
break;
|
|
2040
|
+
}
|
|
2041
|
+
return _context29.abrupt("return");
|
|
2042
|
+
case 3:
|
|
2043
|
+
if (!value) {
|
|
2044
|
+
_context29.next = 6;
|
|
2045
|
+
break;
|
|
2046
|
+
}
|
|
2047
|
+
_context29.next = 6;
|
|
2048
|
+
return _this4.applyDefaultOrderCustomerContactInfo(value);
|
|
2049
|
+
case 6:
|
|
2050
|
+
case "end":
|
|
2051
|
+
return _context29.stop();
|
|
2052
|
+
}
|
|
2053
|
+
}, _callee29);
|
|
2054
|
+
}));
|
|
2055
|
+
return function (_x18) {
|
|
2056
|
+
return _ref12.apply(this, arguments);
|
|
2057
|
+
};
|
|
2058
|
+
}()).catch(function () {
|
|
2059
|
+
// A failed default does not prevent manual entry; a subsequent sync can retry.
|
|
2060
|
+
if (_this4.orderCustomerContactRequest === pending) _this4.orderCustomerContactRequest = null;
|
|
2061
|
+
console.warn('[BookingTicket] Failed to load saved customer contact information');
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2064
|
+
}, {
|
|
2065
|
+
key: "waitForOrderCustomerContactInfo",
|
|
2066
|
+
value: function waitForOrderCustomerContactInfo() {
|
|
2067
|
+
var _this$orderCustomerCo, _this$orderCustomerCo2;
|
|
2068
|
+
return (_this$orderCustomerCo = (_this$orderCustomerCo2 = this.orderCustomerContactRequest) === null || _this$orderCustomerCo2 === void 0 ? void 0 : _this$orderCustomerCo2.promise) !== null && _this$orderCustomerCo !== void 0 ? _this$orderCustomerCo : Promise.resolve();
|
|
2069
|
+
}
|
|
2070
|
+
}, {
|
|
2071
|
+
key: "validateContactInfo",
|
|
2072
|
+
value: function () {
|
|
2073
|
+
var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2074
|
+
var _this$getTempOrder, _this$getTempOrder2;
|
|
2075
|
+
var orderKey, customerId, scope;
|
|
2076
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2077
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2078
|
+
case 0:
|
|
2079
|
+
orderKey = this.getCustomerContactOrderKey();
|
|
2080
|
+
customerId = (_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.customer_id;
|
|
2081
|
+
scope = this.getCustomerContactScope();
|
|
2082
|
+
_context30.next = 5;
|
|
2083
|
+
return this.waitForOrderCustomerContactInfo();
|
|
2084
|
+
case 5:
|
|
2085
|
+
if (!(this.getCustomerContactOrderKey() !== orderKey || ((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.customer_id) !== customerId || this.getCustomerContactScope() !== scope)) {
|
|
2086
|
+
_context30.next = 7;
|
|
2087
|
+
break;
|
|
2088
|
+
}
|
|
2089
|
+
throw new Error('The order changed. Please try again.');
|
|
2090
|
+
case 7:
|
|
2091
|
+
_context30.next = 9;
|
|
2092
|
+
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "validateContactInfo", this).call(this);
|
|
2093
|
+
case 9:
|
|
2094
|
+
case "end":
|
|
2095
|
+
return _context30.stop();
|
|
2096
|
+
}
|
|
2097
|
+
}, _callee30, this);
|
|
2098
|
+
}));
|
|
2099
|
+
function validateContactInfo() {
|
|
2100
|
+
return _validateContactInfo.apply(this, arguments);
|
|
2101
|
+
}
|
|
2102
|
+
return validateContactInfo;
|
|
2103
|
+
}()
|
|
1835
2104
|
/**
|
|
1836
2105
|
* 读取 tempOrder 上的下单客户协议字段;customer_id 缺失时返回 null。
|
|
1837
2106
|
*/
|
|
@@ -1855,10 +2124,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1855
2124
|
*/
|
|
1856
2125
|
}, {
|
|
1857
2126
|
key: "clearOrderCustomer",
|
|
1858
|
-
value: function clearOrderCustomer() {
|
|
2127
|
+
value: function clearOrderCustomer(options) {
|
|
1859
2128
|
var _discountModule$setOr,
|
|
1860
2129
|
_discountModule$setDi,
|
|
1861
|
-
|
|
2130
|
+
_this5 = this;
|
|
2131
|
+
this.orderCustomerContactRequest = null;
|
|
2132
|
+
if (!(options !== null && options !== void 0 && options.preserveContactInfo)) this.resetOrderCustomerContactInfo();
|
|
2133
|
+
if (!(options !== null && options !== void 0 && options.preserveContactInfo)) this.store.order.updateTempOrderContactsInfo(null);
|
|
1862
2134
|
this.store.order.clearOrderCustomer();
|
|
1863
2135
|
this.discountConfigCacheKey = null;
|
|
1864
2136
|
this.hasManualDiscountSelection = false;
|
|
@@ -1871,9 +2143,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1871
2143
|
createIfMissing: true
|
|
1872
2144
|
}).then(function () {
|
|
1873
2145
|
var _discountModule$getDi;
|
|
1874
|
-
var tempOrder =
|
|
1875
|
-
|
|
1876
|
-
return
|
|
2146
|
+
var tempOrder = _this5.store.order.ensureTempOrder();
|
|
2147
|
+
_this5.store.order.persistTempOrder();
|
|
2148
|
+
return _this5.effectsEmit('onDiscountApplied', {
|
|
1877
2149
|
productList: tempOrder.products || [],
|
|
1878
2150
|
discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [],
|
|
1879
2151
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
@@ -1897,24 +2169,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1897
2169
|
}, {
|
|
1898
2170
|
key: "restoreOrder",
|
|
1899
2171
|
value: (function () {
|
|
1900
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2172
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
1901
2173
|
var _this$store$customer;
|
|
1902
2174
|
var tempOrder;
|
|
1903
|
-
return _regeneratorRuntime().wrap(function
|
|
1904
|
-
while (1) switch (
|
|
2175
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2176
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1905
2177
|
case 0:
|
|
1906
|
-
|
|
2178
|
+
_context31.next = 2;
|
|
1907
2179
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
|
|
1908
2180
|
case 2:
|
|
1909
|
-
tempOrder =
|
|
2181
|
+
tempOrder = _context31.sent;
|
|
1910
2182
|
this.clearOrderCustomer();
|
|
1911
2183
|
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
|
|
1912
|
-
return
|
|
2184
|
+
return _context31.abrupt("return", tempOrder);
|
|
1913
2185
|
case 6:
|
|
1914
2186
|
case "end":
|
|
1915
|
-
return
|
|
2187
|
+
return _context31.stop();
|
|
1916
2188
|
}
|
|
1917
|
-
},
|
|
2189
|
+
}, _callee31, this);
|
|
1918
2190
|
}));
|
|
1919
2191
|
function restoreOrder() {
|
|
1920
2192
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -1937,7 +2209,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1937
2209
|
var _this$store$order$get4,
|
|
1938
2210
|
_this$store$order6,
|
|
1939
2211
|
_this$getOrderIdentit,
|
|
1940
|
-
|
|
2212
|
+
_this6 = this;
|
|
1941
2213
|
if (!customerId || customerId === 1) return Promise.resolve();
|
|
1942
2214
|
var tempOrder = (_this$store$order$get4 = (_this$store$order6 = this.store.order).getTempOrder) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order6);
|
|
1943
2215
|
var orderIdentity = (_this$getOrderIdentit = this.getOrderIdentity) === null || _this$getOrderIdentit === void 0 ? void 0 : _this$getOrderIdentit.call(this);
|
|
@@ -1949,50 +2221,50 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1949
2221
|
return this.orderCustomerDiscountRefreshInFlight;
|
|
1950
2222
|
}
|
|
1951
2223
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
1952
|
-
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1953
|
-
var
|
|
2224
|
+
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
2225
|
+
var _this6$store$order$ge, _this6$store$order, _this6$getOrderIdenti;
|
|
1954
2226
|
var currentCustomer, currentTempOrder, currentOrderIdentity, currentOrderId, currentAction, currentOrderTarget;
|
|
1955
|
-
return _regeneratorRuntime().wrap(function
|
|
1956
|
-
while (1) switch (
|
|
2227
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2228
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1957
2229
|
case 0:
|
|
1958
2230
|
if (!previousRefresh) {
|
|
1959
|
-
|
|
2231
|
+
_context32.next = 3;
|
|
1960
2232
|
break;
|
|
1961
2233
|
}
|
|
1962
|
-
|
|
2234
|
+
_context32.next = 3;
|
|
1963
2235
|
return previousRefresh.catch(function () {
|
|
1964
2236
|
return undefined;
|
|
1965
2237
|
});
|
|
1966
2238
|
case 3:
|
|
1967
|
-
currentCustomer =
|
|
2239
|
+
currentCustomer = _this6.store.order.getOrderCustomer();
|
|
1968
2240
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
1969
|
-
|
|
2241
|
+
_context32.next = 6;
|
|
1970
2242
|
break;
|
|
1971
2243
|
}
|
|
1972
|
-
return
|
|
2244
|
+
return _context32.abrupt("return");
|
|
1973
2245
|
case 6:
|
|
1974
|
-
currentTempOrder = (
|
|
1975
|
-
currentOrderIdentity = (
|
|
2246
|
+
currentTempOrder = (_this6$store$order$ge = (_this6$store$order = _this6.store.order).getTempOrder) === null || _this6$store$order$ge === void 0 ? void 0 : _this6$store$order$ge.call(_this6$store$order);
|
|
2247
|
+
currentOrderIdentity = (_this6$getOrderIdenti = _this6.getOrderIdentity) === null || _this6$getOrderIdenti === void 0 ? void 0 : _this6$getOrderIdenti.call(_this6);
|
|
1976
2248
|
currentOrderId = (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.order_id) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.orderId);
|
|
1977
2249
|
currentAction = !currentOrderId || String(currentOrderId).startsWith('local_order') ? 'create' : 'edit';
|
|
1978
2250
|
currentOrderTarget = currentOrderId ? "order:".concat(String(currentOrderId)) : "external:".concat(String((currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.external_sale_number) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.externalSaleNumber) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.localId) || 'new'));
|
|
1979
2251
|
if (!("".concat(customerId, ":").concat(currentAction, ":").concat(currentOrderTarget) !== refreshTarget)) {
|
|
1980
|
-
|
|
2252
|
+
_context32.next = 13;
|
|
1981
2253
|
break;
|
|
1982
2254
|
}
|
|
1983
|
-
return
|
|
2255
|
+
return _context32.abrupt("return");
|
|
1984
2256
|
case 13:
|
|
1985
|
-
|
|
1986
|
-
return
|
|
2257
|
+
_context32.next = 15;
|
|
2258
|
+
return _this6.loadDiscountConfig({
|
|
1987
2259
|
customerId: customerId,
|
|
1988
2260
|
action: action,
|
|
1989
2261
|
force: true
|
|
1990
2262
|
});
|
|
1991
2263
|
case 15:
|
|
1992
2264
|
case "end":
|
|
1993
|
-
return
|
|
2265
|
+
return _context32.stop();
|
|
1994
2266
|
}
|
|
1995
|
-
},
|
|
2267
|
+
}, _callee32);
|
|
1996
2268
|
}))();
|
|
1997
2269
|
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
1998
2270
|
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
@@ -2000,10 +2272,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2000
2272
|
refreshTask.catch(function (error) {
|
|
2001
2273
|
console.error('Failed to load discount config after customer change:', error);
|
|
2002
2274
|
}).finally(function () {
|
|
2003
|
-
if (
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2275
|
+
if (_this6.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
|
|
2276
|
+
_this6.orderCustomerDiscountRefreshInFlight = null;
|
|
2277
|
+
_this6.orderCustomerDiscountRefreshCustomerId = null;
|
|
2278
|
+
_this6.orderCustomerDiscountRefreshTarget = null;
|
|
2007
2279
|
});
|
|
2008
2280
|
return refreshTask;
|
|
2009
2281
|
}
|
|
@@ -2015,30 +2287,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2015
2287
|
}, {
|
|
2016
2288
|
key: "prepareProductPriceQueryContext",
|
|
2017
2289
|
value: function () {
|
|
2018
|
-
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2290
|
+
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(customerId) {
|
|
2019
2291
|
var normalizedCustomerId, refreshTask, shouldWait;
|
|
2020
|
-
return _regeneratorRuntime().wrap(function
|
|
2021
|
-
while (1) switch (
|
|
2292
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2293
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2022
2294
|
case 0:
|
|
2023
|
-
|
|
2295
|
+
_context33.next = 2;
|
|
2024
2296
|
return Promise.resolve();
|
|
2025
2297
|
case 2:
|
|
2026
2298
|
normalizedCustomerId = Number(customerId || 0);
|
|
2027
2299
|
refreshTask = this.orderCustomerDiscountRefreshInFlight;
|
|
2028
2300
|
shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
|
|
2029
2301
|
if (!(shouldWait && refreshTask)) {
|
|
2030
|
-
|
|
2302
|
+
_context33.next = 8;
|
|
2031
2303
|
break;
|
|
2032
2304
|
}
|
|
2033
|
-
|
|
2305
|
+
_context33.next = 8;
|
|
2034
2306
|
return refreshTask;
|
|
2035
2307
|
case 8:
|
|
2036
2308
|
case "end":
|
|
2037
|
-
return
|
|
2309
|
+
return _context33.stop();
|
|
2038
2310
|
}
|
|
2039
|
-
},
|
|
2311
|
+
}, _callee33, this);
|
|
2040
2312
|
}));
|
|
2041
|
-
function prepareProductPriceQueryContext(
|
|
2313
|
+
function prepareProductPriceQueryContext(_x19) {
|
|
2042
2314
|
return _prepareProductPriceQueryContext.apply(this, arguments);
|
|
2043
2315
|
}
|
|
2044
2316
|
return prepareProductPriceQueryContext;
|
|
@@ -2091,29 +2363,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2091
2363
|
}, {
|
|
2092
2364
|
key: "changeCustomerPage",
|
|
2093
2365
|
value: (function () {
|
|
2094
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2095
|
-
var
|
|
2096
|
-
return _regeneratorRuntime().wrap(function
|
|
2097
|
-
while (1) switch (
|
|
2366
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(page, pageSize) {
|
|
2367
|
+
var _result5;
|
|
2368
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2369
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2098
2370
|
case 0:
|
|
2099
|
-
|
|
2100
|
-
|
|
2371
|
+
_context34.prev = 0;
|
|
2372
|
+
_context34.next = 3;
|
|
2101
2373
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
2102
2374
|
case 3:
|
|
2103
|
-
|
|
2104
|
-
return
|
|
2375
|
+
_result5 = _context34.sent;
|
|
2376
|
+
return _context34.abrupt("return", _result5);
|
|
2105
2377
|
case 7:
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
console.error('Failed to change customer page:',
|
|
2109
|
-
throw
|
|
2378
|
+
_context34.prev = 7;
|
|
2379
|
+
_context34.t0 = _context34["catch"](0);
|
|
2380
|
+
console.error('Failed to change customer page:', _context34.t0);
|
|
2381
|
+
throw _context34.t0;
|
|
2110
2382
|
case 11:
|
|
2111
2383
|
case "end":
|
|
2112
|
-
return
|
|
2384
|
+
return _context34.stop();
|
|
2113
2385
|
}
|
|
2114
|
-
},
|
|
2386
|
+
}, _callee34, this, [[0, 7]]);
|
|
2115
2387
|
}));
|
|
2116
|
-
function changeCustomerPage(
|
|
2388
|
+
function changeCustomerPage(_x20, _x21) {
|
|
2117
2389
|
return _changeCustomerPage.apply(this, arguments);
|
|
2118
2390
|
}
|
|
2119
2391
|
return changeCustomerPage;
|
|
@@ -2126,28 +2398,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2126
2398
|
}, {
|
|
2127
2399
|
key: "loadMoreCustomers",
|
|
2128
2400
|
value: (function () {
|
|
2129
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2130
|
-
var
|
|
2131
|
-
return _regeneratorRuntime().wrap(function
|
|
2132
|
-
while (1) switch (
|
|
2401
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2402
|
+
var _result6;
|
|
2403
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2404
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2133
2405
|
case 0:
|
|
2134
|
-
|
|
2135
|
-
|
|
2406
|
+
_context35.prev = 0;
|
|
2407
|
+
_context35.next = 3;
|
|
2136
2408
|
return this.store.customer.loadMoreCustomers();
|
|
2137
2409
|
case 3:
|
|
2138
|
-
|
|
2139
|
-
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"),
|
|
2140
|
-
return
|
|
2410
|
+
_result6 = _context35.sent;
|
|
2411
|
+
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result6);
|
|
2412
|
+
return _context35.abrupt("return", _result6);
|
|
2141
2413
|
case 8:
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
console.error('Failed to load more customers:',
|
|
2145
|
-
throw
|
|
2414
|
+
_context35.prev = 8;
|
|
2415
|
+
_context35.t0 = _context35["catch"](0);
|
|
2416
|
+
console.error('Failed to load more customers:', _context35.t0);
|
|
2417
|
+
throw _context35.t0;
|
|
2146
2418
|
case 12:
|
|
2147
2419
|
case "end":
|
|
2148
|
-
return
|
|
2420
|
+
return _context35.stop();
|
|
2149
2421
|
}
|
|
2150
|
-
},
|
|
2422
|
+
}, _callee35, this, [[0, 8]]);
|
|
2151
2423
|
}));
|
|
2152
2424
|
function loadMoreCustomers() {
|
|
2153
2425
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -2163,31 +2435,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2163
2435
|
}, {
|
|
2164
2436
|
key: "resetAndLoadCustomers",
|
|
2165
2437
|
value: (function () {
|
|
2166
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2438
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
2167
2439
|
var params,
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
return _regeneratorRuntime().wrap(function
|
|
2171
|
-
while (1) switch (
|
|
2440
|
+
_result7,
|
|
2441
|
+
_args36 = arguments;
|
|
2442
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2443
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2172
2444
|
case 0:
|
|
2173
|
-
params =
|
|
2174
|
-
|
|
2175
|
-
|
|
2445
|
+
params = _args36.length > 0 && _args36[0] !== undefined ? _args36[0] : {};
|
|
2446
|
+
_context36.prev = 1;
|
|
2447
|
+
_context36.next = 4;
|
|
2176
2448
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
2177
2449
|
case 4:
|
|
2178
|
-
|
|
2179
|
-
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"),
|
|
2180
|
-
return
|
|
2450
|
+
_result7 = _context36.sent;
|
|
2451
|
+
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result7);
|
|
2452
|
+
return _context36.abrupt("return", _result7);
|
|
2181
2453
|
case 9:
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
console.error('Failed to reset and load customers:',
|
|
2185
|
-
throw
|
|
2454
|
+
_context36.prev = 9;
|
|
2455
|
+
_context36.t0 = _context36["catch"](1);
|
|
2456
|
+
console.error('Failed to reset and load customers:', _context36.t0);
|
|
2457
|
+
throw _context36.t0;
|
|
2186
2458
|
case 13:
|
|
2187
2459
|
case "end":
|
|
2188
|
-
return
|
|
2460
|
+
return _context36.stop();
|
|
2189
2461
|
}
|
|
2190
|
-
},
|
|
2462
|
+
}, _callee36, this, [[1, 9]]);
|
|
2191
2463
|
}));
|
|
2192
2464
|
function resetAndLoadCustomers() {
|
|
2193
2465
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -2232,9 +2504,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2232
2504
|
}, {
|
|
2233
2505
|
key: "scanGlobalListener",
|
|
2234
2506
|
value: function scanGlobalListener(callback) {
|
|
2235
|
-
var
|
|
2507
|
+
var _this7 = this;
|
|
2236
2508
|
var localSearch = function localSearch(v) {
|
|
2237
|
-
return
|
|
2509
|
+
return _this7.store.products.findProductsByCodeOrBarcode(v);
|
|
2238
2510
|
};
|
|
2239
2511
|
var scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2240
2512
|
var safeCallback = function safeCallback(d) {
|
|
@@ -2348,16 +2620,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2348
2620
|
}, {
|
|
2349
2621
|
key: "getOtherParams",
|
|
2350
2622
|
value: (function () {
|
|
2351
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2352
|
-
return _regeneratorRuntime().wrap(function
|
|
2353
|
-
while (1) switch (
|
|
2623
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
2624
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
2625
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2354
2626
|
case 0:
|
|
2355
|
-
return
|
|
2627
|
+
return _context37.abrupt("return", this.otherParams);
|
|
2356
2628
|
case 1:
|
|
2357
2629
|
case "end":
|
|
2358
|
-
return
|
|
2630
|
+
return _context37.stop();
|
|
2359
2631
|
}
|
|
2360
|
-
},
|
|
2632
|
+
}, _callee37, this);
|
|
2361
2633
|
}));
|
|
2362
2634
|
function getOtherParams() {
|
|
2363
2635
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -2529,10 +2801,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2529
2801
|
}, {
|
|
2530
2802
|
key: "logSessionCatalogDateMismatch",
|
|
2531
2803
|
value: function logSessionCatalogDateMismatch(item, bookingDate) {
|
|
2532
|
-
var _this$
|
|
2804
|
+
var _this$getTempOrder3, _tempOrder$order_id, _tempOrder$external_s, _item$cartDetailValue, _item$cartDetailValue2;
|
|
2533
2805
|
var logger = this.logger;
|
|
2534
2806
|
if (!(logger !== null && logger !== void 0 && logger.addLog)) return;
|
|
2535
|
-
var tempOrder = (_this$
|
|
2807
|
+
var tempOrder = (_this$getTempOrder3 = this.getTempOrder) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.call(this);
|
|
2536
2808
|
var staleInfo = buildSessionCatalogStaleInfo(item, bookingDate);
|
|
2537
2809
|
logger.addLog({
|
|
2538
2810
|
type: 'warning',
|
|
@@ -2567,10 +2839,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2567
2839
|
}, {
|
|
2568
2840
|
key: "buildAddProductCtx",
|
|
2569
2841
|
value: function buildAddProductCtx(extra) {
|
|
2570
|
-
var _extra$date2,
|
|
2842
|
+
var _extra$date2, _ref14, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get5, _extra$presetStartTim2;
|
|
2571
2843
|
var bookingContextState = this.store.bookingContext.getState();
|
|
2572
2844
|
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
2573
|
-
var orderCustomerId = (
|
|
2845
|
+
var orderCustomerId = (_ref14 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.customer_id) !== null && _ref14 !== void 0 ? _ref14 : undefined;
|
|
2574
2846
|
return _objectSpread(_objectSpread({
|
|
2575
2847
|
bookingConfig: bookingContextState.bookingConfig,
|
|
2576
2848
|
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
@@ -2671,25 +2943,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2671
2943
|
}, {
|
|
2672
2944
|
key: "buildNormalProductCacheItemFromOrderLine",
|
|
2673
2945
|
value: function buildNormalProductCacheItemFromOrderLine(input) {
|
|
2674
|
-
|
|
2946
|
+
var _input$holder_relatio, _this$store$order7;
|
|
2947
|
+
return buildNormalProductCacheItemFromOrderLineUtil(_objectSpread(_objectSpread({}, input), {}, {
|
|
2948
|
+
holder_relations: (_input$holder_relatio = input.holder_relations) !== null && _input$holder_relatio !== void 0 ? _input$holder_relatio : (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7 = _this$store$order7.getTempOrder()) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.holder_relations
|
|
2949
|
+
}));
|
|
2675
2950
|
}
|
|
2676
2951
|
|
|
2677
2952
|
/** 文档别名:与 OrderModule.updateOrderProduct 一致。 */
|
|
2678
2953
|
}, {
|
|
2679
2954
|
key: "updateProductInOrder",
|
|
2680
2955
|
value: (function () {
|
|
2681
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2682
|
-
return _regeneratorRuntime().wrap(function
|
|
2683
|
-
while (1) switch (
|
|
2956
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
2957
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
2958
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
2684
2959
|
case 0:
|
|
2685
|
-
return
|
|
2960
|
+
return _context38.abrupt("return", this.updateOrderProduct(params));
|
|
2686
2961
|
case 1:
|
|
2687
2962
|
case "end":
|
|
2688
|
-
return
|
|
2963
|
+
return _context38.stop();
|
|
2689
2964
|
}
|
|
2690
|
-
},
|
|
2965
|
+
}, _callee38, this);
|
|
2691
2966
|
}));
|
|
2692
|
-
function updateProductInOrder(
|
|
2967
|
+
function updateProductInOrder(_x22) {
|
|
2693
2968
|
return _updateProductInOrder.apply(this, arguments);
|
|
2694
2969
|
}
|
|
2695
2970
|
return updateProductInOrder;
|
|
@@ -2711,24 +2986,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2711
2986
|
}, {
|
|
2712
2987
|
key: "handleGlobalScanCode",
|
|
2713
2988
|
value: (function () {
|
|
2714
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2715
|
-
var
|
|
2716
|
-
var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, localSearch, scanCallback, raw, formatted, _bridge$onNotify2,
|
|
2717
|
-
return _regeneratorRuntime().wrap(function
|
|
2718
|
-
while (1) switch (
|
|
2989
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(code, bridge) {
|
|
2990
|
+
var _this8 = this;
|
|
2991
|
+
var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result8, _bridge$onNotify3;
|
|
2992
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
2993
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
2719
2994
|
case 0:
|
|
2720
2995
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2721
2996
|
if (trimmed) {
|
|
2722
|
-
|
|
2997
|
+
_context39.next = 4;
|
|
2723
2998
|
break;
|
|
2724
2999
|
}
|
|
2725
3000
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2726
|
-
return
|
|
3001
|
+
return _context39.abrupt("return", {
|
|
2727
3002
|
status: 'failed',
|
|
2728
3003
|
reason: 'empty_code'
|
|
2729
3004
|
});
|
|
2730
3005
|
case 4:
|
|
2731
|
-
|
|
3006
|
+
_context39.prev = 4;
|
|
2732
3007
|
// Capture before lookup/UI awaits, so a result cannot land in a new cart.
|
|
2733
3008
|
// Unscoped POS Order modules return a no-op guard.
|
|
2734
3009
|
beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
|
|
@@ -2755,87 +3030,87 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2755
3030
|
} : undefined
|
|
2756
3031
|
}) : undefined;
|
|
2757
3032
|
localSearch = function localSearch(v) {
|
|
2758
|
-
return
|
|
3033
|
+
return _this8.store.products.findProductsByCodeOrBarcode(v);
|
|
2759
3034
|
};
|
|
2760
3035
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2761
|
-
|
|
3036
|
+
_context39.next = 13;
|
|
2762
3037
|
return scanCallback({
|
|
2763
3038
|
type: 'nativeScanner',
|
|
2764
3039
|
value: trimmed
|
|
2765
3040
|
});
|
|
2766
3041
|
case 13:
|
|
2767
|
-
raw =
|
|
3042
|
+
raw = _context39.sent;
|
|
2768
3043
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
2769
3044
|
if (formatted) {
|
|
2770
|
-
|
|
3045
|
+
_context39.next = 18;
|
|
2771
3046
|
break;
|
|
2772
3047
|
}
|
|
2773
3048
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2774
|
-
return
|
|
3049
|
+
return _context39.abrupt("return", {
|
|
2775
3050
|
status: 'failed',
|
|
2776
3051
|
reason: 'not_found'
|
|
2777
3052
|
});
|
|
2778
3053
|
case 18:
|
|
2779
|
-
|
|
3054
|
+
_context39.next = 20;
|
|
2780
3055
|
return applyGlobalScan({
|
|
2781
3056
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
2782
3057
|
beforeScanCommit();
|
|
2783
|
-
|
|
3058
|
+
_this8.setOrderCustomer(customer);
|
|
2784
3059
|
},
|
|
2785
3060
|
getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
|
|
2786
|
-
return
|
|
3061
|
+
return _this8.getOrderCustomerSnapshot();
|
|
2787
3062
|
},
|
|
2788
3063
|
resolveCustomerById: function resolveCustomerById(customerId) {
|
|
2789
|
-
return
|
|
3064
|
+
return _this8.resolveCustomerById(customerId);
|
|
2790
3065
|
},
|
|
2791
3066
|
getBusinessCode: function getBusinessCode() {
|
|
2792
|
-
var
|
|
2793
|
-
return (
|
|
3067
|
+
var _this8$otherParams;
|
|
3068
|
+
return (_this8$otherParams = _this8.otherParams) === null || _this8$otherParams === void 0 ? void 0 : _this8$otherParams.businessCode;
|
|
2794
3069
|
},
|
|
2795
3070
|
buildAddProductCtx: function buildAddProductCtx(extra) {
|
|
2796
|
-
return
|
|
3071
|
+
return _this8.buildAddProductCtx(extra);
|
|
2797
3072
|
},
|
|
2798
3073
|
decideAddProduct: function decideAddProduct(item, options) {
|
|
2799
|
-
return
|
|
3074
|
+
return _this8.decideAddProduct(item, options);
|
|
2800
3075
|
},
|
|
2801
3076
|
decideAfterDetail: function decideAfterDetail(cacheItem, options) {
|
|
2802
|
-
return
|
|
3077
|
+
return _this8.decideAfterDetail(cacheItem, options);
|
|
2803
3078
|
},
|
|
2804
3079
|
transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
|
|
2805
|
-
return
|
|
3080
|
+
return _this8.transformDetailToProductAndBooking(input);
|
|
2806
3081
|
},
|
|
2807
3082
|
addProductToOrder: function addProductToOrder(product, booking) {
|
|
2808
3083
|
beforeScanCommit();
|
|
2809
|
-
return
|
|
3084
|
+
return _this8.addProductToOrder(product, booking);
|
|
2810
3085
|
},
|
|
2811
3086
|
refreshWalletAssets: function refreshWalletAssets(params) {
|
|
2812
|
-
return
|
|
3087
|
+
return _this8.refreshWalletAssets(params);
|
|
2813
3088
|
},
|
|
2814
3089
|
scanWalletAsset: function scanWalletAsset(scanCode) {
|
|
2815
3090
|
beforeScanCommit();
|
|
2816
|
-
return
|
|
3091
|
+
return _this8.scanWalletAsset(scanCode);
|
|
2817
3092
|
}
|
|
2818
3093
|
}, formatted, guardedBridge);
|
|
2819
3094
|
case 20:
|
|
2820
|
-
|
|
3095
|
+
_result8 = _context39.sent;
|
|
2821
3096
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
2822
|
-
return
|
|
3097
|
+
return _context39.abrupt("return", _result8);
|
|
2823
3098
|
case 25:
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
console.error('[BookingTicket] handleGlobalScanCode failed',
|
|
3099
|
+
_context39.prev = 25;
|
|
3100
|
+
_context39.t0 = _context39["catch"](4);
|
|
3101
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context39.t0);
|
|
2827
3102
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2828
|
-
return
|
|
3103
|
+
return _context39.abrupt("return", {
|
|
2829
3104
|
status: 'failed',
|
|
2830
3105
|
reason: 'not_found'
|
|
2831
3106
|
});
|
|
2832
3107
|
case 30:
|
|
2833
3108
|
case "end":
|
|
2834
|
-
return
|
|
3109
|
+
return _context39.stop();
|
|
2835
3110
|
}
|
|
2836
|
-
},
|
|
3111
|
+
}, _callee39, this, [[4, 25]]);
|
|
2837
3112
|
}));
|
|
2838
|
-
function handleGlobalScanCode(
|
|
3113
|
+
function handleGlobalScanCode(_x23, _x24) {
|
|
2839
3114
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
2840
3115
|
}
|
|
2841
3116
|
return handleGlobalScanCode;
|
|
@@ -2843,39 +3118,39 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2843
3118
|
}, {
|
|
2844
3119
|
key: "getGlobalScanCodeType",
|
|
2845
3120
|
value: (function () {
|
|
2846
|
-
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2847
|
-
var
|
|
3121
|
+
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(code) {
|
|
3122
|
+
var _this9 = this,
|
|
2848
3123
|
_formatGlobalScanResu,
|
|
2849
3124
|
_formatGlobalScanResu2;
|
|
2850
3125
|
var trimmed, scan, raw;
|
|
2851
|
-
return _regeneratorRuntime().wrap(function
|
|
2852
|
-
while (1) switch (
|
|
3126
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3127
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
2853
3128
|
case 0:
|
|
2854
3129
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2855
3130
|
if (trimmed) {
|
|
2856
|
-
|
|
3131
|
+
_context40.next = 3;
|
|
2857
3132
|
break;
|
|
2858
3133
|
}
|
|
2859
|
-
return
|
|
3134
|
+
return _context40.abrupt("return", null);
|
|
2860
3135
|
case 3:
|
|
2861
3136
|
scan = handleGlobalScan(this.request, function (value) {
|
|
2862
|
-
return
|
|
3137
|
+
return _this9.store.products.findProductsByCodeOrBarcode(value);
|
|
2863
3138
|
}, this.getSubmitOrderSalesChannel());
|
|
2864
|
-
|
|
3139
|
+
_context40.next = 6;
|
|
2865
3140
|
return scan({
|
|
2866
3141
|
type: 'nativeScanner',
|
|
2867
3142
|
value: trimmed
|
|
2868
3143
|
});
|
|
2869
3144
|
case 6:
|
|
2870
|
-
raw =
|
|
2871
|
-
return
|
|
3145
|
+
raw = _context40.sent;
|
|
3146
|
+
return _context40.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
|
|
2872
3147
|
case 8:
|
|
2873
3148
|
case "end":
|
|
2874
|
-
return
|
|
3149
|
+
return _context40.stop();
|
|
2875
3150
|
}
|
|
2876
|
-
},
|
|
3151
|
+
}, _callee40, this);
|
|
2877
3152
|
}));
|
|
2878
|
-
function getGlobalScanCodeType(
|
|
3153
|
+
function getGlobalScanCodeType(_x25) {
|
|
2879
3154
|
return _getGlobalScanCodeType.apply(this, arguments);
|
|
2880
3155
|
}
|
|
2881
3156
|
return getGlobalScanCodeType;
|
|
@@ -2895,7 +3170,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2895
3170
|
}, {
|
|
2896
3171
|
key: "buildAddTimeOrderLine",
|
|
2897
3172
|
value: function buildAddTimeOrderLine(input, bookingUid) {
|
|
2898
|
-
var _input$num, _product$id, _product$product_id,
|
|
3173
|
+
var _input$num, _product$id, _product$product_id, _ref15, _product$product_vari, _ref16, _product$variant_id, _product$original_pri, _ref17, _ref18, _product$option, _product$product_sku, _ref19, _ref20, _product$bundle, _product$id2;
|
|
2899
3174
|
var product = input === null || input === void 0 ? void 0 : input.product;
|
|
2900
3175
|
if (!product || _typeof(product) !== 'object') {
|
|
2901
3176
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: product 不能为空');
|
|
@@ -2906,8 +3181,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2906
3181
|
var payload = {
|
|
2907
3182
|
id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id,
|
|
2908
3183
|
product_id: (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id,
|
|
2909
|
-
product_variant_id: (
|
|
2910
|
-
variant_id: (
|
|
3184
|
+
product_variant_id: (_ref15 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product.variant_id) !== null && _ref15 !== void 0 ? _ref15 : 0,
|
|
3185
|
+
variant_id: (_ref16 = (_product$variant_id = product.variant_id) !== null && _product$variant_id !== void 0 ? _product$variant_id : product.product_variant_id) !== null && _ref16 !== void 0 ? _ref16 : 0,
|
|
2911
3186
|
quantity: quantity,
|
|
2912
3187
|
num: quantity,
|
|
2913
3188
|
price: price,
|
|
@@ -2916,8 +3191,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2916
3191
|
line_total: price,
|
|
2917
3192
|
total: price,
|
|
2918
3193
|
product_sku: product.product_sku,
|
|
2919
|
-
option: (
|
|
2920
|
-
bundle: (
|
|
3194
|
+
option: (_ref17 = (_ref18 = (_product$option = product.option) !== null && _product$option !== void 0 ? _product$option : product.options) !== null && _ref18 !== void 0 ? _ref18 : (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option) !== null && _ref17 !== void 0 ? _ref17 : [],
|
|
3195
|
+
bundle: (_ref19 = (_ref20 = (_product$bundle = product.bundle) !== null && _product$bundle !== void 0 ? _product$bundle : product.bundles) !== null && _ref20 !== void 0 ? _ref20 : product.product_bundle) !== null && _ref19 !== void 0 ? _ref19 : []
|
|
2921
3196
|
};
|
|
2922
3197
|
var orderLine = this.transformBaseProductToOrderProduct({
|
|
2923
3198
|
payload: payload,
|
|
@@ -2957,11 +3232,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2957
3232
|
}, {
|
|
2958
3233
|
key: "addAddTimeProductToBooking",
|
|
2959
3234
|
value: (function () {
|
|
2960
|
-
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2961
|
-
return _regeneratorRuntime().wrap(function
|
|
2962
|
-
while (1) switch (
|
|
3235
|
+
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(input) {
|
|
3236
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3237
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
2963
3238
|
case 0:
|
|
2964
|
-
return
|
|
3239
|
+
return _context41.abrupt("return", this.addAddTimeProductsToBooking({
|
|
2965
3240
|
booking: input.booking,
|
|
2966
3241
|
products: [input],
|
|
2967
3242
|
coveredMinutes: input.coveredMinutes,
|
|
@@ -2969,11 +3244,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2969
3244
|
}));
|
|
2970
3245
|
case 1:
|
|
2971
3246
|
case "end":
|
|
2972
|
-
return
|
|
3247
|
+
return _context41.stop();
|
|
2973
3248
|
}
|
|
2974
|
-
},
|
|
3249
|
+
}, _callee41, this);
|
|
2975
3250
|
}));
|
|
2976
|
-
function addAddTimeProductToBooking(
|
|
3251
|
+
function addAddTimeProductToBooking(_x26) {
|
|
2977
3252
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
2978
3253
|
}
|
|
2979
3254
|
return addAddTimeProductToBooking;
|
|
@@ -2991,27 +3266,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2991
3266
|
}, {
|
|
2992
3267
|
key: "addAddTimeProductsToBooking",
|
|
2993
3268
|
value: (function () {
|
|
2994
|
-
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2995
|
-
var
|
|
3269
|
+
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(input) {
|
|
3270
|
+
var _this10 = this,
|
|
2996
3271
|
_input$bookingPatch;
|
|
2997
3272
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
2998
|
-
return _regeneratorRuntime().wrap(function
|
|
2999
|
-
while (1) switch (
|
|
3273
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3274
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3000
3275
|
case 0:
|
|
3001
3276
|
bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
|
|
3002
3277
|
if (bookingUid) {
|
|
3003
|
-
|
|
3278
|
+
_context42.next = 3;
|
|
3004
3279
|
break;
|
|
3005
3280
|
}
|
|
3006
3281
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
|
|
3007
3282
|
case 3:
|
|
3008
3283
|
orderLines = (input.products || []).map(function (line) {
|
|
3009
3284
|
return {
|
|
3010
|
-
product:
|
|
3285
|
+
product: _this10.buildAddTimeOrderLine(line, bookingUid)
|
|
3011
3286
|
};
|
|
3012
3287
|
});
|
|
3013
3288
|
if (this.store.order) {
|
|
3014
|
-
|
|
3289
|
+
_context42.next = 6;
|
|
3015
3290
|
break;
|
|
3016
3291
|
}
|
|
3017
3292
|
throw new Error('order 模块未初始化');
|
|
@@ -3025,55 +3300,55 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3025
3300
|
});
|
|
3026
3301
|
}
|
|
3027
3302
|
if (!(typeof this.store.order.addProductsToOrder === 'function')) {
|
|
3028
|
-
|
|
3303
|
+
_context42.next = 11;
|
|
3029
3304
|
break;
|
|
3030
3305
|
}
|
|
3031
|
-
return
|
|
3306
|
+
return _context42.abrupt("return", this.store.order.addProductsToOrder(orderLines));
|
|
3032
3307
|
case 11:
|
|
3033
3308
|
result = [];
|
|
3034
3309
|
_iterator2 = _createForOfIteratorHelper(orderLines);
|
|
3035
|
-
|
|
3310
|
+
_context42.prev = 13;
|
|
3036
3311
|
_iterator2.s();
|
|
3037
3312
|
case 15:
|
|
3038
3313
|
if ((_step2 = _iterator2.n()).done) {
|
|
3039
|
-
|
|
3314
|
+
_context42.next = 29;
|
|
3040
3315
|
break;
|
|
3041
3316
|
}
|
|
3042
3317
|
line = _step2.value;
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3318
|
+
_context42.t0 = result.splice;
|
|
3319
|
+
_context42.t1 = result;
|
|
3320
|
+
_context42.t2 = [0, result.length];
|
|
3321
|
+
_context42.t3 = _toConsumableArray;
|
|
3322
|
+
_context42.next = 23;
|
|
3048
3323
|
return this.addProductToOrder(line.product);
|
|
3049
3324
|
case 23:
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3325
|
+
_context42.t4 = _context42.sent;
|
|
3326
|
+
_context42.t5 = (0, _context42.t3)(_context42.t4);
|
|
3327
|
+
_context42.t6 = _context42.t2.concat.call(_context42.t2, _context42.t5);
|
|
3328
|
+
_context42.t0.apply.call(_context42.t0, _context42.t1, _context42.t6);
|
|
3054
3329
|
case 27:
|
|
3055
|
-
|
|
3330
|
+
_context42.next = 15;
|
|
3056
3331
|
break;
|
|
3057
3332
|
case 29:
|
|
3058
|
-
|
|
3333
|
+
_context42.next = 34;
|
|
3059
3334
|
break;
|
|
3060
3335
|
case 31:
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
_iterator2.e(
|
|
3336
|
+
_context42.prev = 31;
|
|
3337
|
+
_context42.t7 = _context42["catch"](13);
|
|
3338
|
+
_iterator2.e(_context42.t7);
|
|
3064
3339
|
case 34:
|
|
3065
|
-
|
|
3340
|
+
_context42.prev = 34;
|
|
3066
3341
|
_iterator2.f();
|
|
3067
|
-
return
|
|
3342
|
+
return _context42.finish(34);
|
|
3068
3343
|
case 37:
|
|
3069
|
-
return
|
|
3344
|
+
return _context42.abrupt("return", result);
|
|
3070
3345
|
case 38:
|
|
3071
3346
|
case "end":
|
|
3072
|
-
return
|
|
3347
|
+
return _context42.stop();
|
|
3073
3348
|
}
|
|
3074
|
-
},
|
|
3349
|
+
}, _callee42, this, [[13, 31, 34, 37]]);
|
|
3075
3350
|
}));
|
|
3076
|
-
function addAddTimeProductsToBooking(
|
|
3351
|
+
function addAddTimeProductsToBooking(_x27) {
|
|
3077
3352
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
3078
3353
|
}
|
|
3079
3354
|
return addAddTimeProductsToBooking;
|
|
@@ -3081,42 +3356,49 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3081
3356
|
}, {
|
|
3082
3357
|
key: "setOtherParams",
|
|
3083
3358
|
value: function () {
|
|
3084
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3085
|
-
var
|
|
3086
|
-
|
|
3359
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
3360
|
+
var _this11 = this;
|
|
3361
|
+
var _ref21,
|
|
3362
|
+
_ref21$cover,
|
|
3087
3363
|
cover,
|
|
3364
|
+
nextParams,
|
|
3088
3365
|
invoiceContextChanged,
|
|
3089
|
-
|
|
3090
|
-
return _regeneratorRuntime().wrap(function
|
|
3091
|
-
while (1) switch (
|
|
3366
|
+
_args43 = arguments;
|
|
3367
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3368
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3092
3369
|
case 0:
|
|
3093
|
-
|
|
3094
|
-
|
|
3370
|
+
_ref21 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref21$cover = _ref21.cover, cover = _ref21$cover === void 0 ? false : _ref21$cover;
|
|
3371
|
+
nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3372
|
+
if (['businessCode', 'business_code', 'channel', 'platform', 'shop_id', 'tenantId', 'cacheId'].some(function (key) {
|
|
3373
|
+
var _this11$otherParams;
|
|
3374
|
+
return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams[key]);
|
|
3375
|
+
})) this.orderCustomerContactRequest = null;
|
|
3376
|
+
_context43.next = 5;
|
|
3095
3377
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
3096
3378
|
cover: cover
|
|
3097
3379
|
});
|
|
3098
|
-
case
|
|
3380
|
+
case 5:
|
|
3099
3381
|
invoiceContextChanged = (params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || (params === null || params === void 0 ? void 0 : params.channel) !== undefined || (params === null || params === void 0 ? void 0 : params.platform) !== undefined || Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
3100
3382
|
if (!invoiceContextChanged) {
|
|
3101
|
-
|
|
3383
|
+
_context43.next = 9;
|
|
3102
3384
|
break;
|
|
3103
3385
|
}
|
|
3104
|
-
|
|
3386
|
+
_context43.next = 9;
|
|
3105
3387
|
return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
3106
|
-
case
|
|
3388
|
+
case 9:
|
|
3107
3389
|
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
3108
|
-
|
|
3390
|
+
_context43.next = 12;
|
|
3109
3391
|
break;
|
|
3110
3392
|
}
|
|
3111
|
-
|
|
3393
|
+
_context43.next = 12;
|
|
3112
3394
|
return this.configureIdGeneratorFromOpenData();
|
|
3113
|
-
case
|
|
3395
|
+
case 12:
|
|
3114
3396
|
case "end":
|
|
3115
|
-
return
|
|
3397
|
+
return _context43.stop();
|
|
3116
3398
|
}
|
|
3117
|
-
},
|
|
3399
|
+
}, _callee43, this);
|
|
3118
3400
|
}));
|
|
3119
|
-
function setOtherParams(
|
|
3401
|
+
function setOtherParams(_x28) {
|
|
3120
3402
|
return _setOtherParams.apply(this, arguments);
|
|
3121
3403
|
}
|
|
3122
3404
|
return setOtherParams;
|
|
@@ -3133,15 +3415,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3133
3415
|
}, {
|
|
3134
3416
|
key: "handlePrintWristband",
|
|
3135
3417
|
value: function () {
|
|
3136
|
-
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3418
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
3137
3419
|
var _this$getOrderIdentit2;
|
|
3138
3420
|
var deviceTask, deviceId, idempotencyKey;
|
|
3139
|
-
return _regeneratorRuntime().wrap(function
|
|
3140
|
-
while (1) switch (
|
|
3421
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3422
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3141
3423
|
case 0:
|
|
3142
3424
|
deviceTask = this.getDeviceTaskPlugin();
|
|
3143
3425
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
3144
|
-
|
|
3426
|
+
_context44.next = 4;
|
|
3145
3427
|
break;
|
|
3146
3428
|
}
|
|
3147
3429
|
this.logger.addLog({
|
|
@@ -3151,7 +3433,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3151
3433
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3152
3434
|
}
|
|
3153
3435
|
});
|
|
3154
|
-
return
|
|
3436
|
+
return _context44.abrupt("return");
|
|
3155
3437
|
case 4:
|
|
3156
3438
|
this.logger.addLog({
|
|
3157
3439
|
type: 'info',
|
|
@@ -3160,10 +3442,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3160
3442
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3161
3443
|
}
|
|
3162
3444
|
});
|
|
3163
|
-
|
|
3445
|
+
_context44.next = 7;
|
|
3164
3446
|
return this.getShortNumberOrDeviceId();
|
|
3165
3447
|
case 7:
|
|
3166
|
-
deviceId =
|
|
3448
|
+
deviceId = _context44.sent;
|
|
3167
3449
|
idempotencyKey = createUuidV4();
|
|
3168
3450
|
deviceTask.dispatch({
|
|
3169
3451
|
action: 'print_all',
|
|
@@ -3183,11 +3465,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3183
3465
|
});
|
|
3184
3466
|
case 10:
|
|
3185
3467
|
case "end":
|
|
3186
|
-
return
|
|
3468
|
+
return _context44.stop();
|
|
3187
3469
|
}
|
|
3188
|
-
},
|
|
3470
|
+
}, _callee44, this);
|
|
3189
3471
|
}));
|
|
3190
|
-
function handlePrintWristband(
|
|
3472
|
+
function handlePrintWristband(_x29) {
|
|
3191
3473
|
return _handlePrintWristband.apply(this, arguments);
|
|
3192
3474
|
}
|
|
3193
3475
|
return handlePrintWristband;
|
|
@@ -3195,11 +3477,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3195
3477
|
}, {
|
|
3196
3478
|
key: "handleRedeem",
|
|
3197
3479
|
value: function () {
|
|
3198
|
-
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3199
|
-
var _this$store$
|
|
3480
|
+
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
3481
|
+
var _this$store$order8, _this$store$order8$ge, _this$store$order9, _ref22, _tempOrder$order_id2;
|
|
3200
3482
|
var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
|
|
3201
|
-
return _regeneratorRuntime().wrap(function
|
|
3202
|
-
while (1) switch (
|
|
3483
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3484
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3203
3485
|
case 0:
|
|
3204
3486
|
voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
3205
3487
|
status = params.is_checkin ? 'used' : 'unused';
|
|
@@ -3212,8 +3494,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3212
3494
|
}
|
|
3213
3495
|
});
|
|
3214
3496
|
voucherIdSet = new Set(voucherIds);
|
|
3215
|
-
tempOrder = (_this$store$
|
|
3216
|
-
vouchers = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.vouchers) || ((_this$store$
|
|
3497
|
+
tempOrder = (_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || (_this$store$order8$ge = _this$store$order8.getTempOrder) === null || _this$store$order8$ge === void 0 ? void 0 : _this$store$order8$ge.call(_this$store$order8);
|
|
3498
|
+
vouchers = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.vouchers) || ((_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 ? void 0 : _this$store$order9.getVouchers()) || [];
|
|
3217
3499
|
hasUpdatedVoucher = false;
|
|
3218
3500
|
nextVouchers = vouchers.map(function (voucher) {
|
|
3219
3501
|
if (!voucherIdSet.has(voucher.voucher_id)) return voucher;
|
|
@@ -3223,20 +3505,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3223
3505
|
});
|
|
3224
3506
|
});
|
|
3225
3507
|
if (!(tempOrder && hasUpdatedVoucher)) {
|
|
3226
|
-
|
|
3508
|
+
_context45.next = 11;
|
|
3227
3509
|
break;
|
|
3228
3510
|
}
|
|
3229
|
-
|
|
3511
|
+
_context45.next = 11;
|
|
3230
3512
|
return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
3231
3513
|
vouchers: nextVouchers
|
|
3232
3514
|
}));
|
|
3233
3515
|
case 11:
|
|
3234
3516
|
this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
|
|
3235
3517
|
if (!(voucherIds.length === 0)) {
|
|
3236
|
-
|
|
3518
|
+
_context45.next = 14;
|
|
3237
3519
|
break;
|
|
3238
3520
|
}
|
|
3239
|
-
return
|
|
3521
|
+
return _context45.abrupt("return", {
|
|
3240
3522
|
code: 200,
|
|
3241
3523
|
status: true,
|
|
3242
3524
|
message: '',
|
|
@@ -3245,9 +3527,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3245
3527
|
case 14:
|
|
3246
3528
|
identity = this.getOrderIdentity();
|
|
3247
3529
|
externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
|
|
3248
|
-
orderId = (
|
|
3530
|
+
orderId = (_ref22 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref22 !== void 0 ? _ref22 : undefined;
|
|
3249
3531
|
orderLookup = externalSaleNumber || orderId || (identity === null || identity === void 0 ? void 0 : identity.orderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopFullOrderNumber) || undefined;
|
|
3250
|
-
return
|
|
3532
|
+
return _context45.abrupt("return", this.request.post('/machinecode/batch', {
|
|
3251
3533
|
ids: voucherIds,
|
|
3252
3534
|
status: status,
|
|
3253
3535
|
order_lookup: orderLookup,
|
|
@@ -3258,11 +3540,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3258
3540
|
}));
|
|
3259
3541
|
case 19:
|
|
3260
3542
|
case "end":
|
|
3261
|
-
return
|
|
3543
|
+
return _context45.stop();
|
|
3262
3544
|
}
|
|
3263
|
-
},
|
|
3545
|
+
}, _callee45, this);
|
|
3264
3546
|
}));
|
|
3265
|
-
function handleRedeem(
|
|
3547
|
+
function handleRedeem(_x30) {
|
|
3266
3548
|
return _handleRedeem.apply(this, arguments);
|
|
3267
3549
|
}
|
|
3268
3550
|
return handleRedeem;
|
|
@@ -3274,25 +3556,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3274
3556
|
}, {
|
|
3275
3557
|
key: "destroy",
|
|
3276
3558
|
value: (function () {
|
|
3277
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3559
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
|
|
3278
3560
|
var _this$scan;
|
|
3279
|
-
return _regeneratorRuntime().wrap(function
|
|
3280
|
-
while (1) switch (
|
|
3561
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3562
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
3281
3563
|
case 0:
|
|
3282
|
-
|
|
3564
|
+
this.orderCustomerContactRequest = null;
|
|
3565
|
+
_context46.next = 3;
|
|
3283
3566
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
3284
|
-
case
|
|
3567
|
+
case 3:
|
|
3285
3568
|
try {
|
|
3286
3569
|
(_this$scan = this.scan) === null || _this$scan === void 0 || _this$scan.removeAllListeners();
|
|
3287
3570
|
} catch (error) {
|
|
3288
3571
|
console.warn('[BookingTicket] scan removeAllListeners 失败', error);
|
|
3289
3572
|
}
|
|
3290
3573
|
scanCache.clear();
|
|
3291
|
-
case
|
|
3574
|
+
case 5:
|
|
3292
3575
|
case "end":
|
|
3293
|
-
return
|
|
3576
|
+
return _context46.stop();
|
|
3294
3577
|
}
|
|
3295
|
-
},
|
|
3578
|
+
}, _callee46, this);
|
|
3296
3579
|
}));
|
|
3297
3580
|
function destroy() {
|
|
3298
3581
|
return _destroy.apply(this, arguments);
|