@pisell/pisellos 2.3.51 → 2.3.53
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/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +7 -9
- package/dist/modules/Order/index.js +165 -140
- package/dist/modules/Order/types.d.ts +21 -12
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +3 -35
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.js +32 -56
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +0 -14
- package/dist/server/index.js +793 -907
- package/dist/solution/BaseSales/index.d.ts +15 -12
- package/dist/solution/BaseSales/index.js +194 -178
- package/dist/solution/BaseSales/utils/cartPromotion.js +5 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -16
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +2 -14
- package/dist/solution/BookingTicket/index.js +2 -2
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +739 -1142
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +841 -1167
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +0 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +7 -9
- package/lib/modules/Order/index.js +89 -38
- package/lib/modules/Order/types.d.ts +21 -12
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +5 -36
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.js +32 -44
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +0 -14
- package/lib/server/index.js +15 -72
- package/lib/solution/BaseSales/index.d.ts +15 -12
- package/lib/solution/BaseSales/index.js +52 -35
- package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -16
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +2 -14
- package/lib/solution/BookingTicket/index.js +2 -10
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +182 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +110 -322
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1891
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1084
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -118,7 +118,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
118
118
|
this.otherData = ((_data$this$otherParam = data[this.otherParams.cacheId]) === null || _data$this$otherParam === void 0 || (_data$this$otherParam = _data$this$otherParam[this.name]) === null || _data$this$otherParam === void 0 ? void 0 : _data$this$otherParam['otherData']) || {};
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
moduleArr = ['accountList', '
|
|
121
|
+
moduleArr = ['accountList', 'cart', 'schedule', 'summary', 'step', 'products', 'date', 'order'];
|
|
122
122
|
moduleArr.forEach(function (step) {
|
|
123
123
|
var targetModule = createModule(step, _this2.name);
|
|
124
124
|
if (targetModule) {
|
|
@@ -644,59 +644,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
644
644
|
return _fetchHolderAccountsAsync.apply(this, arguments);
|
|
645
645
|
}
|
|
646
646
|
return fetchHolderAccountsAsync;
|
|
647
|
-
}()
|
|
648
|
-
/**
|
|
649
|
-
* 获取 holder 表单 map
|
|
650
|
-
*/
|
|
651
|
-
)
|
|
652
|
-
}, {
|
|
653
|
-
key: "getHolderFormMap",
|
|
654
|
-
value: function getHolderFormMap() {
|
|
655
|
-
return this.store.holder.getHolderFormMap();
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
|
|
660
|
-
*/
|
|
661
|
-
}, {
|
|
662
|
-
key: "refreshAllHolderFormRecords",
|
|
663
|
-
value: (function () {
|
|
664
|
-
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
|
|
665
|
-
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
666
|
-
while (1) switch (_context10.prev = _context10.next) {
|
|
667
|
-
case 0:
|
|
668
|
-
return _context10.abrupt("return", this.store.holder.refreshAllFormRecords({
|
|
669
|
-
customer_id: params === null || params === void 0 ? void 0 : params.customer_id,
|
|
670
|
-
useCache: false
|
|
671
|
-
}));
|
|
672
|
-
case 1:
|
|
673
|
-
case "end":
|
|
674
|
-
return _context10.stop();
|
|
675
|
-
}
|
|
676
|
-
}, _callee10, this);
|
|
677
|
-
}));
|
|
678
|
-
function refreshAllHolderFormRecords(_x12) {
|
|
679
|
-
return _refreshAllHolderFormRecords.apply(this, arguments);
|
|
680
|
-
}
|
|
681
|
-
return refreshAllHolderFormRecords;
|
|
682
|
-
}()
|
|
683
|
-
/**
|
|
684
|
-
* 添加表单记录
|
|
685
|
-
*/
|
|
647
|
+
}() // 设置日期范围,注入到日期模块中
|
|
686
648
|
)
|
|
687
|
-
}, {
|
|
688
|
-
key: "appendFormRecord",
|
|
689
|
-
value: function appendFormRecord(params) {
|
|
690
|
-
return this.store.holder.appendFormRecord(params);
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
// 设置日期范围,注入到日期模块中
|
|
694
649
|
}, {
|
|
695
650
|
key: "setDateRange",
|
|
696
651
|
value: function () {
|
|
697
|
-
var _setDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
698
|
-
return _regeneratorRuntime().wrap(function
|
|
699
|
-
while (1) switch (
|
|
652
|
+
var _setDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(dateRange) {
|
|
653
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
654
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
700
655
|
case 0:
|
|
701
656
|
this.store.date.setDateRange(dateRange);
|
|
702
657
|
// 日期数据变更后,如果购物车里有数据,需要更新购物车里的报价单的价格
|
|
@@ -705,11 +660,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
705
660
|
}
|
|
706
661
|
case 2:
|
|
707
662
|
case "end":
|
|
708
|
-
return
|
|
663
|
+
return _context10.stop();
|
|
709
664
|
}
|
|
710
|
-
},
|
|
665
|
+
}, _callee10, this);
|
|
711
666
|
}));
|
|
712
|
-
function setDateRange(
|
|
667
|
+
function setDateRange(_x12) {
|
|
713
668
|
return _setDateRange.apply(this, arguments);
|
|
714
669
|
}
|
|
715
670
|
return setDateRange;
|
|
@@ -724,16 +679,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
724
679
|
}, {
|
|
725
680
|
key: "getDateRange",
|
|
726
681
|
value: function () {
|
|
727
|
-
var _getDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
728
|
-
return _regeneratorRuntime().wrap(function
|
|
729
|
-
while (1) switch (
|
|
682
|
+
var _getDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
683
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
684
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
730
685
|
case 0:
|
|
731
|
-
return
|
|
686
|
+
return _context11.abrupt("return", this.store.date.getDateRange());
|
|
732
687
|
case 1:
|
|
733
688
|
case "end":
|
|
734
|
-
return
|
|
689
|
+
return _context11.stop();
|
|
735
690
|
}
|
|
736
|
-
},
|
|
691
|
+
}, _callee11, this);
|
|
737
692
|
}));
|
|
738
693
|
function getDateRange() {
|
|
739
694
|
return _getDateRange.apply(this, arguments);
|
|
@@ -750,7 +705,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
750
705
|
}, {
|
|
751
706
|
key: "getAvailableDate",
|
|
752
707
|
value: function () {
|
|
753
|
-
var _getAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
708
|
+
var _getAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
754
709
|
var _this4 = this,
|
|
755
710
|
_dateRange$,
|
|
756
711
|
_dateRange$2,
|
|
@@ -772,11 +727,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
772
727
|
rules,
|
|
773
728
|
resourcesMap,
|
|
774
729
|
res,
|
|
775
|
-
|
|
776
|
-
return _regeneratorRuntime().wrap(function
|
|
777
|
-
while (1) switch (
|
|
730
|
+
_args12 = arguments;
|
|
731
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
732
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
778
733
|
case 0:
|
|
779
|
-
params =
|
|
734
|
+
params = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
|
|
780
735
|
// 开始日期如果小于今天,直接以今天当做开始日期
|
|
781
736
|
products = params.products, startDate = params.startDate, endDate = params.endDate, type = params.type, _params$useCache = params.useCache, useCache = _params$useCache === void 0 ? true : _params$useCache; // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天 且 endDate 小于或等于今天,需要把 startDate 置为今天
|
|
782
737
|
if (dayjs(startDate).isBefore(dayjs(), 'day') && (dayjs(endDate).isAfter(dayjs(), 'day') || dayjs(endDate).isSame(dayjs(), 'day'))) {
|
|
@@ -803,15 +758,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
803
758
|
tempStartDate = startDate || (dateRange === null || dateRange === void 0 || (_dateRange$ = dateRange[0]) === null || _dateRange$ === void 0 ? void 0 : _dateRange$.date);
|
|
804
759
|
tempEndDate = endDate || (dateRange === null || dateRange === void 0 || (_dateRange$2 = dateRange[1]) === null || _dateRange$2 === void 0 ? void 0 : _dateRange$2.date) || (dateRange === null || dateRange === void 0 || (_dateRange$3 = dateRange[0]) === null || _dateRange$3 === void 0 ? void 0 : _dateRange$3.date);
|
|
805
760
|
if (tempProducts.length) {
|
|
806
|
-
|
|
761
|
+
_context12.next = 11;
|
|
807
762
|
break;
|
|
808
763
|
}
|
|
809
|
-
return
|
|
764
|
+
return _context12.abrupt("return", []);
|
|
810
765
|
case 11:
|
|
811
766
|
// 在这里需要把能收集到的数据都收集上来,拼装好给 date 模块去查询
|
|
812
767
|
_ref4 = getAvailableProductResources(tempProducts) || {}, resourceIds = _ref4.resourceIds, rules = _ref4.rules, resourcesMap = _ref4.resourcesMap;
|
|
813
768
|
this.otherParams.currentResourcesMap = resourcesMap;
|
|
814
|
-
|
|
769
|
+
_context12.next = 15;
|
|
815
770
|
return this.store.date.getResourceDates({
|
|
816
771
|
url: params.url,
|
|
817
772
|
query: {
|
|
@@ -824,13 +779,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
824
779
|
useCache: useCache
|
|
825
780
|
});
|
|
826
781
|
case 15:
|
|
827
|
-
res =
|
|
828
|
-
return
|
|
782
|
+
res = _context12.sent;
|
|
783
|
+
return _context12.abrupt("return", res);
|
|
829
784
|
case 17:
|
|
830
785
|
case "end":
|
|
831
|
-
return
|
|
786
|
+
return _context12.stop();
|
|
832
787
|
}
|
|
833
|
-
},
|
|
788
|
+
}, _callee12, this);
|
|
834
789
|
}));
|
|
835
790
|
function getAvailableDate() {
|
|
836
791
|
return _getAvailableDate.apply(this, arguments);
|
|
@@ -843,22 +798,22 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
843
798
|
}, {
|
|
844
799
|
key: "getSummary",
|
|
845
800
|
value: (function () {
|
|
846
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
801
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
847
802
|
var cartItems, summary;
|
|
848
|
-
return _regeneratorRuntime().wrap(function
|
|
849
|
-
while (1) switch (
|
|
803
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
804
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
850
805
|
case 0:
|
|
851
806
|
cartItems = this.store.cart.getItems();
|
|
852
|
-
|
|
807
|
+
_context13.next = 3;
|
|
853
808
|
return this.store.summary.getSummary(cartItems);
|
|
854
809
|
case 3:
|
|
855
|
-
summary =
|
|
856
|
-
return
|
|
810
|
+
summary = _context13.sent;
|
|
811
|
+
return _context13.abrupt("return", summary);
|
|
857
812
|
case 5:
|
|
858
813
|
case "end":
|
|
859
|
-
return
|
|
814
|
+
return _context13.stop();
|
|
860
815
|
}
|
|
861
|
-
},
|
|
816
|
+
}, _callee13, this);
|
|
862
817
|
}));
|
|
863
818
|
function getSummary() {
|
|
864
819
|
return _getSummary.apply(this, arguments);
|
|
@@ -872,18 +827,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
872
827
|
}, {
|
|
873
828
|
key: "getProtocol",
|
|
874
829
|
value: (function () {
|
|
875
|
-
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
876
|
-
return _regeneratorRuntime().wrap(function
|
|
877
|
-
while (1) switch (
|
|
830
|
+
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(protocolId) {
|
|
831
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
832
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
878
833
|
case 0:
|
|
879
|
-
return
|
|
834
|
+
return _context14.abrupt("return", this.store.summary.getProtocol(protocolId));
|
|
880
835
|
case 1:
|
|
881
836
|
case "end":
|
|
882
|
-
return
|
|
837
|
+
return _context14.stop();
|
|
883
838
|
}
|
|
884
|
-
},
|
|
839
|
+
}, _callee14, this);
|
|
885
840
|
}));
|
|
886
|
-
function getProtocol(
|
|
841
|
+
function getProtocol(_x13) {
|
|
887
842
|
return _getProtocol.apply(this, arguments);
|
|
888
843
|
}
|
|
889
844
|
return getProtocol;
|
|
@@ -892,16 +847,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
892
847
|
}, {
|
|
893
848
|
key: "getProducts",
|
|
894
849
|
value: function () {
|
|
895
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
896
|
-
return _regeneratorRuntime().wrap(function
|
|
897
|
-
while (1) switch (
|
|
850
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
851
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
852
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
898
853
|
case 0:
|
|
899
|
-
return
|
|
854
|
+
return _context15.abrupt("return", this.store.products.getProducts());
|
|
900
855
|
case 1:
|
|
901
856
|
case "end":
|
|
902
|
-
return
|
|
857
|
+
return _context15.stop();
|
|
903
858
|
}
|
|
904
|
-
},
|
|
859
|
+
}, _callee15, this);
|
|
905
860
|
}));
|
|
906
861
|
function getProducts() {
|
|
907
862
|
return _getProducts.apply(this, arguments);
|
|
@@ -911,15 +866,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
911
866
|
}, {
|
|
912
867
|
key: "setLoginAccount",
|
|
913
868
|
value: function () {
|
|
914
|
-
var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
869
|
+
var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(accountId, accountInfo) {
|
|
915
870
|
var _this5 = this;
|
|
916
|
-
var account, stateAccountId, cartItems, _this$store$date$getD2, date, normalProductCartItem
|
|
917
|
-
return _regeneratorRuntime().wrap(function
|
|
918
|
-
while (1) switch (
|
|
871
|
+
var account, stateAccountId, cartItems, _this$store$date$getD2, date, normalProductCartItem;
|
|
872
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
873
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
919
874
|
case 0:
|
|
920
875
|
account = this.store.accountList.getAccount(accountId);
|
|
921
876
|
if (!account) {
|
|
922
|
-
|
|
877
|
+
_context16.next = 11;
|
|
923
878
|
break;
|
|
924
879
|
}
|
|
925
880
|
stateAccountId = account.getId();
|
|
@@ -936,47 +891,29 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
936
891
|
}
|
|
937
892
|
});
|
|
938
893
|
this.store.accountList.updateAccountListById(stateAccountId, accountInfo);
|
|
939
|
-
if (
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
date = (normalProductCartItem === null || normalProductCartItem === void 0 ? void 0 : normalProductCartItem.start_date) || '';
|
|
894
|
+
if (cartItems.length) {
|
|
895
|
+
date = (_this$store$date$getD2 = this.store.date.getDateRange()) === null || _this$store$date$getD2 === void 0 || (_this$store$date$getD2 = _this$store$date$getD2[0]) === null || _this$store$date$getD2 === void 0 ? void 0 : _this$store$date$getD2.date;
|
|
896
|
+
if (!date) {
|
|
897
|
+
// 如果没有日期,则应该是 session 类先选商品的流程,直接从购物车里拿 start_date
|
|
898
|
+
// 不能从购物车里第一个找时间,而是找到购物车里第一个有 start_date 的时间
|
|
899
|
+
normalProductCartItem = cartItems.find(function (n) {
|
|
900
|
+
return !isNormalProduct(n._productOrigin);
|
|
901
|
+
});
|
|
902
|
+
date = (normalProductCartItem === null || normalProductCartItem === void 0 ? void 0 : normalProductCartItem.start_date) || '';
|
|
903
|
+
}
|
|
904
|
+
this.updateQuotationPriceAndCart(date);
|
|
951
905
|
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
// 登录后刷新 holder 表单
|
|
955
|
-
_context17.prev = 12;
|
|
956
|
-
customerId = Number(accountInfo.id);
|
|
957
|
-
_context17.next = 16;
|
|
958
|
-
return this.refreshAllHolderFormRecords({
|
|
959
|
-
customer_id: customerId
|
|
960
|
-
});
|
|
961
|
-
case 16:
|
|
962
|
-
_context17.next = 21;
|
|
963
|
-
break;
|
|
964
|
-
case 18:
|
|
965
|
-
_context17.prev = 18;
|
|
966
|
-
_context17.t0 = _context17["catch"](12);
|
|
967
|
-
console.error('[BookingByStep] 登录后刷新 holder 表单失败', _context17.t0);
|
|
968
|
-
case 21:
|
|
969
|
-
_context17.next = 24;
|
|
906
|
+
_context16.next = 12;
|
|
970
907
|
break;
|
|
971
|
-
case
|
|
908
|
+
case 11:
|
|
972
909
|
throw new Error("\u6CA1\u6709\u627E\u5230".concat(accountId, "\u8D26\u6237"));
|
|
973
|
-
case
|
|
910
|
+
case 12:
|
|
974
911
|
case "end":
|
|
975
|
-
return
|
|
912
|
+
return _context16.stop();
|
|
976
913
|
}
|
|
977
|
-
},
|
|
914
|
+
}, _callee16, this);
|
|
978
915
|
}));
|
|
979
|
-
function setLoginAccount(
|
|
916
|
+
function setLoginAccount(_x14, _x15) {
|
|
980
917
|
return _setLoginAccount.apply(this, arguments);
|
|
981
918
|
}
|
|
982
919
|
return setLoginAccount;
|
|
@@ -984,14 +921,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
984
921
|
}, {
|
|
985
922
|
key: "generateCartData",
|
|
986
923
|
value: function () {
|
|
987
|
-
var _generateCartData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
988
|
-
return _regeneratorRuntime().wrap(function
|
|
989
|
-
while (1) switch (
|
|
924
|
+
var _generateCartData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
925
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
926
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
990
927
|
case 0:
|
|
991
928
|
case "end":
|
|
992
|
-
return
|
|
929
|
+
return _context17.stop();
|
|
993
930
|
}
|
|
994
|
-
},
|
|
931
|
+
}, _callee17);
|
|
995
932
|
}));
|
|
996
933
|
function generateCartData() {
|
|
997
934
|
return _generateCartData.apply(this, arguments);
|
|
@@ -1001,23 +938,23 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1001
938
|
}, {
|
|
1002
939
|
key: "getFreeProduct",
|
|
1003
940
|
value: function () {
|
|
1004
|
-
var _getFreeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
941
|
+
var _getFreeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(id) {
|
|
1005
942
|
var res;
|
|
1006
|
-
return _regeneratorRuntime().wrap(function
|
|
1007
|
-
while (1) switch (
|
|
943
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
944
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1008
945
|
case 0:
|
|
1009
|
-
|
|
946
|
+
_context18.next = 2;
|
|
1010
947
|
return this.request.post("/pay/order/free-pay/".concat(id));
|
|
1011
948
|
case 2:
|
|
1012
|
-
res =
|
|
1013
|
-
return
|
|
949
|
+
res = _context18.sent;
|
|
950
|
+
return _context18.abrupt("return", res);
|
|
1014
951
|
case 4:
|
|
1015
952
|
case "end":
|
|
1016
|
-
return
|
|
953
|
+
return _context18.stop();
|
|
1017
954
|
}
|
|
1018
|
-
},
|
|
955
|
+
}, _callee18, this);
|
|
1019
956
|
}));
|
|
1020
|
-
function getFreeProduct(
|
|
957
|
+
function getFreeProduct(_x16) {
|
|
1021
958
|
return _getFreeProduct.apply(this, arguments);
|
|
1022
959
|
}
|
|
1023
960
|
return getFreeProduct;
|
|
@@ -1040,11 +977,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1040
977
|
}, {
|
|
1041
978
|
key: "submitOrder",
|
|
1042
979
|
value: function () {
|
|
1043
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1044
|
-
var _this$otherParams4;
|
|
980
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(extraData) {
|
|
1045
981
|
var cartItems, newCartItems, type;
|
|
1046
|
-
return _regeneratorRuntime().wrap(function
|
|
1047
|
-
while (1) switch (
|
|
982
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
983
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1048
984
|
case 0:
|
|
1049
985
|
cartItems = this.store.cart.getItems();
|
|
1050
986
|
newCartItems = cloneDeep(cartItems); // 先整个临时的逻辑,把购物车里所有商品的资源给他格式化一下
|
|
@@ -1074,22 +1010,21 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1074
1010
|
}))) {
|
|
1075
1011
|
type = 'virtual';
|
|
1076
1012
|
}
|
|
1077
|
-
return
|
|
1013
|
+
return _context19.abrupt("return", this.store.order.submitOrder({
|
|
1078
1014
|
query: {
|
|
1079
1015
|
cartItems: newCartItems,
|
|
1080
1016
|
type: type,
|
|
1081
1017
|
platform: this.platform,
|
|
1082
|
-
business_code: (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.business_code,
|
|
1083
1018
|
extraData: extraData
|
|
1084
1019
|
}
|
|
1085
1020
|
}));
|
|
1086
1021
|
case 6:
|
|
1087
1022
|
case "end":
|
|
1088
|
-
return
|
|
1023
|
+
return _context19.stop();
|
|
1089
1024
|
}
|
|
1090
|
-
},
|
|
1025
|
+
}, _callee19, this);
|
|
1091
1026
|
}));
|
|
1092
|
-
function submitOrder(
|
|
1027
|
+
function submitOrder(_x17) {
|
|
1093
1028
|
return _submitOrder.apply(this, arguments);
|
|
1094
1029
|
}
|
|
1095
1030
|
return submitOrder;
|
|
@@ -1097,14 +1032,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1097
1032
|
}, {
|
|
1098
1033
|
key: "pay",
|
|
1099
1034
|
value: function () {
|
|
1100
|
-
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1101
|
-
return _regeneratorRuntime().wrap(function
|
|
1102
|
-
while (1) switch (
|
|
1035
|
+
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1036
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1037
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1103
1038
|
case 0:
|
|
1104
1039
|
case "end":
|
|
1105
|
-
return
|
|
1040
|
+
return _context20.stop();
|
|
1106
1041
|
}
|
|
1107
|
-
},
|
|
1042
|
+
}, _callee20);
|
|
1108
1043
|
}));
|
|
1109
1044
|
function pay() {
|
|
1110
1045
|
return _pay.apply(this, arguments);
|
|
@@ -1114,14 +1049,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1114
1049
|
}, {
|
|
1115
1050
|
key: "getPayInfo",
|
|
1116
1051
|
value: function () {
|
|
1117
|
-
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1118
|
-
return _regeneratorRuntime().wrap(function
|
|
1119
|
-
while (1) switch (
|
|
1052
|
+
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1053
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1054
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1120
1055
|
case 0:
|
|
1121
1056
|
case "end":
|
|
1122
|
-
return
|
|
1057
|
+
return _context21.stop();
|
|
1123
1058
|
}
|
|
1124
|
-
},
|
|
1059
|
+
}, _callee21);
|
|
1125
1060
|
}));
|
|
1126
1061
|
function getPayInfo() {
|
|
1127
1062
|
return _getPayInfo.apply(this, arguments);
|
|
@@ -1131,15 +1066,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1131
1066
|
}, {
|
|
1132
1067
|
key: "setOtherParams",
|
|
1133
1068
|
value: function () {
|
|
1134
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1069
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
1135
1070
|
var _ref5,
|
|
1136
1071
|
_ref5$cover,
|
|
1137
1072
|
cover,
|
|
1138
|
-
|
|
1139
|
-
return _regeneratorRuntime().wrap(function
|
|
1140
|
-
while (1) switch (
|
|
1073
|
+
_args22 = arguments;
|
|
1074
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1075
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1141
1076
|
case 0:
|
|
1142
|
-
_ref5 =
|
|
1077
|
+
_ref5 = _args22.length > 1 && _args22[1] !== undefined ? _args22[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
|
|
1143
1078
|
if (cover) {
|
|
1144
1079
|
this.otherParams = params;
|
|
1145
1080
|
} else {
|
|
@@ -1147,11 +1082,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1147
1082
|
}
|
|
1148
1083
|
case 2:
|
|
1149
1084
|
case "end":
|
|
1150
|
-
return
|
|
1085
|
+
return _context22.stop();
|
|
1151
1086
|
}
|
|
1152
|
-
},
|
|
1087
|
+
}, _callee22, this);
|
|
1153
1088
|
}));
|
|
1154
|
-
function setOtherParams(
|
|
1089
|
+
function setOtherParams(_x18) {
|
|
1155
1090
|
return _setOtherParams.apply(this, arguments);
|
|
1156
1091
|
}
|
|
1157
1092
|
return setOtherParams;
|
|
@@ -1159,16 +1094,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1159
1094
|
}, {
|
|
1160
1095
|
key: "getOtherParams",
|
|
1161
1096
|
value: function () {
|
|
1162
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1163
|
-
return _regeneratorRuntime().wrap(function
|
|
1164
|
-
while (1) switch (
|
|
1097
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1098
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1099
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1165
1100
|
case 0:
|
|
1166
|
-
return
|
|
1101
|
+
return _context23.abrupt("return", this.otherParams);
|
|
1167
1102
|
case 1:
|
|
1168
1103
|
case "end":
|
|
1169
|
-
return
|
|
1104
|
+
return _context23.stop();
|
|
1170
1105
|
}
|
|
1171
|
-
},
|
|
1106
|
+
}, _callee23, this);
|
|
1172
1107
|
}));
|
|
1173
1108
|
function getOtherParams() {
|
|
1174
1109
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -1256,15 +1191,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1256
1191
|
account = activeAccount;
|
|
1257
1192
|
}
|
|
1258
1193
|
}
|
|
1259
|
-
try {
|
|
1260
|
-
this.store.holder.ensureFormByProduct({
|
|
1261
|
-
product: productData,
|
|
1262
|
-
shop_id: (productData === null || productData === void 0 ? void 0 : productData.shop_id) || '',
|
|
1263
|
-
useCache: true
|
|
1264
|
-
});
|
|
1265
|
-
} catch (error) {
|
|
1266
|
-
console.error('[BookingByStep] 加载 holder 表单失败', error);
|
|
1267
|
-
}
|
|
1268
1194
|
var flag = this.store.cart.mergeCartItemByRowKey({
|
|
1269
1195
|
rowKey: rowKey,
|
|
1270
1196
|
quantity: quantity,
|
|
@@ -1860,7 +1786,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1860
1786
|
}
|
|
1861
1787
|
// 计算在时间片内有交集的预约容量总和
|
|
1862
1788
|
var totalCapacity = (countMap[n.id] || []).reduce(function (sum, item) {
|
|
1863
|
-
var hasOverlap = dayjs(item.time.start_at).
|
|
1789
|
+
var hasOverlap = !dayjs(item.time.start_at).isAfter(dayjs(timeSlots.start_at)) && !dayjs(item.time.end_at).isBefore(dayjs(timeSlots.end_at));
|
|
1864
1790
|
return hasOverlap ? sum + item.pax : sum;
|
|
1865
1791
|
}, 0);
|
|
1866
1792
|
|
|
@@ -1967,9 +1893,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1967
1893
|
cartItems.forEach(function (item, index) {
|
|
1968
1894
|
var _getCapacityInfoByCar6 = getCapacityInfoByCartItem(item),
|
|
1969
1895
|
currentCapacity = _getCapacityInfoByCar6.currentCapacity;
|
|
1970
|
-
var hasOriginTimeSlot = Boolean(item._origin.start_time) && Boolean(item._origin.end_time) && !(timeSlots !== null && timeSlots !== void 0 && timeSlots.start_time);
|
|
1971
1896
|
// 如果商品已经有时间数据了,意味着是通过先选日期再选商品流程进来的,相当于时间切片已经选中了
|
|
1972
|
-
if (
|
|
1897
|
+
if (item._origin.start_time && !(timeSlots !== null && timeSlots !== void 0 && timeSlots.start_time)) {
|
|
1973
1898
|
recordTimeSlots = {
|
|
1974
1899
|
start_time: item._origin.start_time,
|
|
1975
1900
|
end_time: item._origin.end_time,
|
|
@@ -1985,11 +1910,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1985
1910
|
return n.code === resources_code;
|
|
1986
1911
|
});
|
|
1987
1912
|
// 只有 duration 类商品且不含有灵活时间的商品需要这个操作
|
|
1988
|
-
if (index !== 0 && recordTimeSlots && (currentResourceConfig === null || currentResourceConfig === void 0 ? void 0 : currentResourceConfig.type) === 'single' && (_item$_productOrigin3 = item._productOrigin) !== null && _item$_productOrigin3 !== void 0 && _item$_productOrigin3.duration && !hasFlexibleProduct
|
|
1989
|
-
var _item$_productOrigin4;
|
|
1990
|
-
var
|
|
1991
|
-
var start_at =
|
|
1992
|
-
var end_at = start_at.add(((_item$_productOrigin4 = item._productOrigin) === null || _item$_productOrigin4 === void 0 || (_item$_productOrigin4 = _item$_productOrigin4.duration) === null || _item$_productOrigin4 === void 0 ? void 0 : _item$_productOrigin4.value) || 10, 'minutes');
|
|
1913
|
+
if (index !== 0 && recordTimeSlots && (currentResourceConfig === null || currentResourceConfig === void 0 ? void 0 : currentResourceConfig.type) === 'single' && (_item$_productOrigin3 = item._productOrigin) !== null && _item$_productOrigin3 !== void 0 && _item$_productOrigin3.duration && !hasFlexibleProduct) {
|
|
1914
|
+
var _item$_productOrigin4, _item$_productOrigin5;
|
|
1915
|
+
var start_at = dayjs(recordTimeSlots.end_time).add(((_item$_productOrigin4 = item._productOrigin) === null || _item$_productOrigin4 === void 0 || (_item$_productOrigin4 = _item$_productOrigin4.duration) === null || _item$_productOrigin4 === void 0 ? void 0 : _item$_productOrigin4.value) || 10, 'minutes');
|
|
1916
|
+
var end_at = start_at.add(((_item$_productOrigin5 = item._productOrigin) === null || _item$_productOrigin5 === void 0 || (_item$_productOrigin5 = _item$_productOrigin5.duration) === null || _item$_productOrigin5 === void 0 ? void 0 : _item$_productOrigin5.value) || 10, 'minutes');
|
|
1993
1917
|
recordTimeSlots = {
|
|
1994
1918
|
start_time: start_at.format('HH:mm'),
|
|
1995
1919
|
end_time: end_at.format('HH:mm'),
|
|
@@ -2033,13 +1957,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2033
1957
|
errorList.push(item._id);
|
|
2034
1958
|
}
|
|
2035
1959
|
} else {
|
|
2036
|
-
var _item$
|
|
1960
|
+
var _item$_productOrigin6, _productResources$fin;
|
|
2037
1961
|
// 这里必须每次循环重新读,避免前一次循环操作了购物车,导致数据变更
|
|
2038
1962
|
// 能进到这种逻辑,说明是 duration 类商品或者灵活时长商品,且是第一种资源,还没有确定时间
|
|
2039
1963
|
var allCartItems = cloneDeep(_this11.store.cart.getItems());
|
|
2040
1964
|
// 如果没有传递 timeSlots,代表是第一种资源,则直接拿商品的 duration,到资源列表里找一个公共可用的
|
|
2041
1965
|
var selectedResources = [];
|
|
2042
|
-
var _resources = cloneDeep(((_item$
|
|
1966
|
+
var _resources = cloneDeep(((_item$_productOrigin6 = item._productOrigin) === null || _item$_productOrigin6 === void 0 || (_item$_productOrigin6 = _item$_productOrigin6.product_resource) === null || _item$_productOrigin6 === void 0 ? void 0 : _item$_productOrigin6.resources) || []);
|
|
2043
1967
|
var currentResourcesRenderList = [];
|
|
2044
1968
|
_resources.forEach(function (n) {
|
|
2045
1969
|
var _n$renderList;
|
|
@@ -2079,7 +2003,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2079
2003
|
return n.code === resources_code;
|
|
2080
2004
|
})) === null || _productResources$fin === void 0 ? void 0 : _productResources$fin.renderList;
|
|
2081
2005
|
if (targetRenderList && targetRenderList.length > 0) {
|
|
2082
|
-
var _item$_origin$resourc2
|
|
2006
|
+
var _item$_origin$resourc2;
|
|
2083
2007
|
// 如果购物车里已经有同类型的 form_id 的资源了,则不处理
|
|
2084
2008
|
if ((_item$_origin$resourc2 = item._origin.resources) !== null && _item$_origin$resourc2 !== void 0 && _item$_origin$resourc2.some(function (n) {
|
|
2085
2009
|
return n.form_id === targetRenderList[0].form_id;
|
|
@@ -2089,9 +2013,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2089
2013
|
var fastestResource = findFastestAvailableResource({
|
|
2090
2014
|
resources: targetRenderList,
|
|
2091
2015
|
currentCapacity: currentCapacity,
|
|
2092
|
-
countMap: selectResourcesMap
|
|
2093
|
-
targetDate: dateRange === null || dateRange === void 0 || (_dateRange$5 = dateRange[0]) === null || _dateRange$5 === void 0 ? void 0 : _dateRange$5.date,
|
|
2094
|
-
durationMinutes: (item === null || item === void 0 || (_item$duration2 = item.duration) === null || _item$duration2 === void 0 ? void 0 : _item$duration2.value) || (item === null || item === void 0 || (_item$_productOrigin6 = item._productOrigin) === null || _item$_productOrigin6 === void 0 || (_item$_productOrigin6 = _item$_productOrigin6.duration) === null || _item$_productOrigin6 === void 0 ? void 0 : _item$_productOrigin6.value) || 10
|
|
2016
|
+
countMap: selectResourcesMap
|
|
2095
2017
|
});
|
|
2096
2018
|
var targetResource = fastestResource || targetRenderList[0];
|
|
2097
2019
|
targetResource.capacity = currentCapacity;
|
|
@@ -2142,7 +2064,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2142
2064
|
_cartItems$,
|
|
2143
2065
|
_cartItems$2,
|
|
2144
2066
|
_this$shopStore$get;
|
|
2145
|
-
var split = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
|
|
2146
2067
|
var dateRange = this.store.date.getDateRange();
|
|
2147
2068
|
// 取出购物车中所有一已选择的第一步资源
|
|
2148
2069
|
var resources = [];
|
|
@@ -2326,7 +2247,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2326
2247
|
resourcesMap: resourcesMap,
|
|
2327
2248
|
duration: duration,
|
|
2328
2249
|
currentDate: dateRange[0].date,
|
|
2329
|
-
split:
|
|
2250
|
+
split: 10,
|
|
2330
2251
|
resourcesUseableMap: resourcesUseableMap,
|
|
2331
2252
|
capacity: maxCapacity,
|
|
2332
2253
|
cut_off_time: maxCutOffTime,
|
|
@@ -2340,14 +2261,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2340
2261
|
}, {
|
|
2341
2262
|
key: "getTimeSlotByAllResourcesForDate",
|
|
2342
2263
|
value: function () {
|
|
2343
|
-
var _getTimeSlotByAllResourcesForDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2264
|
+
var _getTimeSlotByAllResourcesForDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(_ref10) {
|
|
2344
2265
|
var _this13 = this,
|
|
2345
2266
|
_cartItems$5,
|
|
2346
2267
|
_cartItems$6,
|
|
2347
2268
|
_this$shopStore$get2;
|
|
2348
2269
|
var resources_code, startDate, endDate, resources, cartItems, resourceIds, resourcesTypeId, isSingleResource, maxCutOffTime, maxCutOffTimeValue, duration, accountList, checkDuration, resourcesUseableMap, hasFlexibleDuration, operating_day_boundary, maxBlockThreshold, calculateCapacityFromCartItems, maxCapacity, arr, today, _loop2, i;
|
|
2349
|
-
return _regeneratorRuntime().wrap(function
|
|
2350
|
-
while (1) switch (
|
|
2270
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context25) {
|
|
2271
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2351
2272
|
case 0:
|
|
2352
2273
|
resources_code = _ref10.resources_code, startDate = _ref10.startDate, endDate = _ref10.endDate;
|
|
2353
2274
|
// 如果 end_date 距离start_date小于 30 天,自动追加 end_date 为今天往后的 30 天
|
|
@@ -2355,7 +2276,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2355
2276
|
endDate = dayjs(startDate).add(30, 'day').format('YYYY-MM-DD');
|
|
2356
2277
|
}
|
|
2357
2278
|
// 预请求资源数据,防止日期超过之前选择的范围
|
|
2358
|
-
|
|
2279
|
+
_context25.next = 4;
|
|
2359
2280
|
return this.getAvailableDate({
|
|
2360
2281
|
startDate: startDate,
|
|
2361
2282
|
endDate: endDate,
|
|
@@ -2401,10 +2322,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2401
2322
|
|
|
2402
2323
|
// 保护: 如果 resources 为空则直接 return
|
|
2403
2324
|
if (resources.length) {
|
|
2404
|
-
|
|
2325
|
+
_context25.next = 14;
|
|
2405
2326
|
break;
|
|
2406
2327
|
}
|
|
2407
|
-
return
|
|
2328
|
+
return _context25.abrupt("return", []);
|
|
2408
2329
|
case 14:
|
|
2409
2330
|
duration = 0; // duration = 不同账号的最长时间
|
|
2410
2331
|
accountList = this.store.accountList.getAccounts();
|
|
@@ -2438,10 +2359,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2438
2359
|
// 如果 cartItem 上既没有时间,也没有资源,认为外部属于异常调用,直接丢一个空数组出去
|
|
2439
2360
|
// 同时 session 类商品的流程也不应该调用这个方法
|
|
2440
2361
|
if (!(!(cartItems !== null && cartItems !== void 0 && (_cartItems$5 = cartItems[0]) !== null && _cartItems$5 !== void 0 && _cartItems$5.start_date) && !(cartItems !== null && cartItems !== void 0 && (_cartItems$6 = cartItems[0]) !== null && _cartItems$6 !== void 0 && _cartItems$6.resource_id) || !(cartItems !== null && cartItems !== void 0 && cartItems[0].duration))) {
|
|
2441
|
-
|
|
2362
|
+
_context25.next = 20;
|
|
2442
2363
|
break;
|
|
2443
2364
|
}
|
|
2444
|
-
return
|
|
2365
|
+
return _context25.abrupt("return", []);
|
|
2445
2366
|
case 20:
|
|
2446
2367
|
resourcesUseableMap = {};
|
|
2447
2368
|
hasFlexibleDuration = cartItems.some(function (item) {
|
|
@@ -2495,8 +2416,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2495
2416
|
today = dayjs().startOf('day'); // 计算 start_date 到 end_date 之间的所有日期,遍历他们并且计算每一天的可用
|
|
2496
2417
|
_loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() {
|
|
2497
2418
|
var currentDate, theDateResources, resourcesMap, timeSlots;
|
|
2498
|
-
return _regeneratorRuntime().wrap(function _loop2$(
|
|
2499
|
-
while (1) switch (
|
|
2419
|
+
return _regeneratorRuntime().wrap(function _loop2$(_context24) {
|
|
2420
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2500
2421
|
case 0:
|
|
2501
2422
|
currentDate = i.format('YYYY-MM-DD');
|
|
2502
2423
|
theDateResources = _this13.store.date.getResourcesListByDate(currentDate);
|
|
@@ -2508,7 +2429,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2508
2429
|
});
|
|
2509
2430
|
resourcesMap = getResourcesMap(resources); // 如果日期已经过期则直接标记为不可用
|
|
2510
2431
|
if (!i.isBefore(today)) {
|
|
2511
|
-
|
|
2432
|
+
_context24.next = 7;
|
|
2512
2433
|
break;
|
|
2513
2434
|
}
|
|
2514
2435
|
arr.push({
|
|
@@ -2517,7 +2438,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2517
2438
|
week: i.format('ddd'),
|
|
2518
2439
|
weekNum: i.day()
|
|
2519
2440
|
});
|
|
2520
|
-
return
|
|
2441
|
+
return _context24.abrupt("return", 1);
|
|
2521
2442
|
case 7:
|
|
2522
2443
|
timeSlots = getTimeSlicesByResources({
|
|
2523
2444
|
resourceIds: resourceIds,
|
|
@@ -2549,36 +2470,36 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2549
2470
|
}
|
|
2550
2471
|
case 9:
|
|
2551
2472
|
case "end":
|
|
2552
|
-
return
|
|
2473
|
+
return _context24.stop();
|
|
2553
2474
|
}
|
|
2554
2475
|
}, _loop2);
|
|
2555
2476
|
});
|
|
2556
2477
|
i = dayjs(startDate);
|
|
2557
2478
|
case 32:
|
|
2558
2479
|
if (!i.isBefore(dayjs(endDate))) {
|
|
2559
|
-
|
|
2480
|
+
_context25.next = 39;
|
|
2560
2481
|
break;
|
|
2561
2482
|
}
|
|
2562
|
-
return
|
|
2483
|
+
return _context25.delegateYield(_loop2(), "t0", 34);
|
|
2563
2484
|
case 34:
|
|
2564
|
-
if (!
|
|
2565
|
-
|
|
2485
|
+
if (!_context25.t0) {
|
|
2486
|
+
_context25.next = 36;
|
|
2566
2487
|
break;
|
|
2567
2488
|
}
|
|
2568
|
-
return
|
|
2489
|
+
return _context25.abrupt("continue", 36);
|
|
2569
2490
|
case 36:
|
|
2570
2491
|
i = i.add(1, 'day');
|
|
2571
|
-
|
|
2492
|
+
_context25.next = 32;
|
|
2572
2493
|
break;
|
|
2573
2494
|
case 39:
|
|
2574
|
-
return
|
|
2495
|
+
return _context25.abrupt("return", arr);
|
|
2575
2496
|
case 40:
|
|
2576
2497
|
case "end":
|
|
2577
|
-
return
|
|
2498
|
+
return _context25.stop();
|
|
2578
2499
|
}
|
|
2579
|
-
},
|
|
2500
|
+
}, _callee24, this);
|
|
2580
2501
|
}));
|
|
2581
|
-
function getTimeSlotByAllResourcesForDate(
|
|
2502
|
+
function getTimeSlotByAllResourcesForDate(_x19) {
|
|
2582
2503
|
return _getTimeSlotByAllResourcesForDate.apply(this, arguments);
|
|
2583
2504
|
}
|
|
2584
2505
|
return getTimeSlotByAllResourcesForDate;
|
|
@@ -2759,42 +2680,42 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2759
2680
|
}, {
|
|
2760
2681
|
key: "openProductDetail",
|
|
2761
2682
|
value: function () {
|
|
2762
|
-
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2683
|
+
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(productId) {
|
|
2763
2684
|
var targetProductData, newScheduleArr, dateRange;
|
|
2764
|
-
return _regeneratorRuntime().wrap(function
|
|
2765
|
-
while (1) switch (
|
|
2685
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context26) {
|
|
2686
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2766
2687
|
case 0:
|
|
2767
|
-
|
|
2688
|
+
_context26.next = 2;
|
|
2768
2689
|
return this.store.products.getProduct(productId);
|
|
2769
2690
|
case 2:
|
|
2770
|
-
targetProductData =
|
|
2691
|
+
targetProductData = _context26.sent;
|
|
2771
2692
|
if (!targetProductData) {
|
|
2772
|
-
|
|
2693
|
+
_context26.next = 17;
|
|
2773
2694
|
break;
|
|
2774
2695
|
}
|
|
2775
2696
|
this.store.currentProduct = targetProductData;
|
|
2776
2697
|
this.store.currentProductMeta = {};
|
|
2777
2698
|
// 资源预加载,如果是 duration 类型的商品,且是先选日期的流程,在这里预拉取资源数据
|
|
2778
2699
|
if (!targetProductData['schedule.ids']) {
|
|
2779
|
-
|
|
2700
|
+
_context26.next = 12;
|
|
2780
2701
|
break;
|
|
2781
2702
|
}
|
|
2782
2703
|
newScheduleArr = this.getScheduleDataByIds(targetProductData['schedule.ids']);
|
|
2783
2704
|
if (!this.store.currentProductMeta) this.store.currentProductMeta = {};
|
|
2784
2705
|
this.store.currentProductMeta.schedule = newScheduleArr;
|
|
2785
|
-
|
|
2706
|
+
_context26.next = 17;
|
|
2786
2707
|
break;
|
|
2787
2708
|
case 12:
|
|
2788
2709
|
if (!targetProductData.duration) {
|
|
2789
|
-
|
|
2710
|
+
_context26.next = 17;
|
|
2790
2711
|
break;
|
|
2791
2712
|
}
|
|
2792
2713
|
dateRange = this.store.date.getDateRange(); // 如果不是先选日期的流程 duration 商品就啥也不做
|
|
2793
2714
|
if (dateRange !== null && dateRange !== void 0 && dateRange.length) {
|
|
2794
|
-
|
|
2715
|
+
_context26.next = 16;
|
|
2795
2716
|
break;
|
|
2796
2717
|
}
|
|
2797
|
-
return
|
|
2718
|
+
return _context26.abrupt("return");
|
|
2798
2719
|
case 16:
|
|
2799
2720
|
// this.store.date.getResourceDates({
|
|
2800
2721
|
// query: {
|
|
@@ -2810,11 +2731,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2810
2731
|
});
|
|
2811
2732
|
case 17:
|
|
2812
2733
|
case "end":
|
|
2813
|
-
return
|
|
2734
|
+
return _context26.stop();
|
|
2814
2735
|
}
|
|
2815
|
-
},
|
|
2736
|
+
}, _callee25, this);
|
|
2816
2737
|
}));
|
|
2817
|
-
function openProductDetail(
|
|
2738
|
+
function openProductDetail(_x20) {
|
|
2818
2739
|
return _openProductDetail.apply(this, arguments);
|
|
2819
2740
|
}
|
|
2820
2741
|
return openProductDetail;
|
|
@@ -4065,41 +3986,41 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4065
3986
|
}, {
|
|
4066
3987
|
key: "getProductTypeById",
|
|
4067
3988
|
value: function () {
|
|
4068
|
-
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3989
|
+
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(id) {
|
|
4069
3990
|
var productData, _productData$schedule;
|
|
4070
|
-
return _regeneratorRuntime().wrap(function
|
|
4071
|
-
while (1) switch (
|
|
3991
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context27) {
|
|
3992
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
4072
3993
|
case 0:
|
|
4073
|
-
|
|
3994
|
+
_context27.next = 2;
|
|
4074
3995
|
return this.store.products.getProduct(id);
|
|
4075
3996
|
case 2:
|
|
4076
|
-
productData =
|
|
3997
|
+
productData = _context27.sent;
|
|
4077
3998
|
if (!productData) {
|
|
4078
|
-
|
|
3999
|
+
_context27.next = 9;
|
|
4079
4000
|
break;
|
|
4080
4001
|
}
|
|
4081
4002
|
if (!productData.duration) {
|
|
4082
|
-
|
|
4003
|
+
_context27.next = 6;
|
|
4083
4004
|
break;
|
|
4084
4005
|
}
|
|
4085
|
-
return
|
|
4006
|
+
return _context27.abrupt("return", 'duration');
|
|
4086
4007
|
case 6:
|
|
4087
4008
|
if (!((_productData$schedule = productData['schedule.ids']) !== null && _productData$schedule !== void 0 && _productData$schedule.length)) {
|
|
4088
|
-
|
|
4009
|
+
_context27.next = 8;
|
|
4089
4010
|
break;
|
|
4090
4011
|
}
|
|
4091
|
-
return
|
|
4012
|
+
return _context27.abrupt("return", 'session');
|
|
4092
4013
|
case 8:
|
|
4093
|
-
return
|
|
4014
|
+
return _context27.abrupt("return", 'normal');
|
|
4094
4015
|
case 9:
|
|
4095
|
-
return
|
|
4016
|
+
return _context27.abrupt("return", 'normal');
|
|
4096
4017
|
case 10:
|
|
4097
4018
|
case "end":
|
|
4098
|
-
return
|
|
4019
|
+
return _context27.stop();
|
|
4099
4020
|
}
|
|
4100
|
-
},
|
|
4021
|
+
}, _callee26, this);
|
|
4101
4022
|
}));
|
|
4102
|
-
function getProductTypeById(
|
|
4023
|
+
function getProductTypeById(_x21) {
|
|
4103
4024
|
return _getProductTypeById.apply(this, arguments);
|
|
4104
4025
|
}
|
|
4105
4026
|
return getProductTypeById;
|
|
@@ -4219,10 +4140,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4219
4140
|
}, {
|
|
4220
4141
|
key: "getTimeslotsScheduleByDateRange",
|
|
4221
4142
|
value: (function () {
|
|
4222
|
-
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4143
|
+
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(_ref16) {
|
|
4223
4144
|
var startDate, endDate, scheduleIds, resources, dates, currentDate, end, results, _i5, _dates, date;
|
|
4224
|
-
return _regeneratorRuntime().wrap(function
|
|
4225
|
-
while (1) switch (
|
|
4145
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
4146
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
4226
4147
|
case 0:
|
|
4227
4148
|
startDate = _ref16.startDate, endDate = _ref16.endDate, scheduleIds = _ref16.scheduleIds, resources = _ref16.resources;
|
|
4228
4149
|
console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
|
|
@@ -4249,14 +4170,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4249
4170
|
resources: resources
|
|
4250
4171
|
});
|
|
4251
4172
|
}
|
|
4252
|
-
return
|
|
4173
|
+
return _context28.abrupt("return", results);
|
|
4253
4174
|
case 9:
|
|
4254
4175
|
case "end":
|
|
4255
|
-
return
|
|
4176
|
+
return _context28.stop();
|
|
4256
4177
|
}
|
|
4257
|
-
},
|
|
4178
|
+
}, _callee27, this);
|
|
4258
4179
|
}));
|
|
4259
|
-
function getTimeslotsScheduleByDateRange(
|
|
4180
|
+
function getTimeslotsScheduleByDateRange(_x22) {
|
|
4260
4181
|
return _getTimeslotsScheduleByDateRange.apply(this, arguments);
|
|
4261
4182
|
}
|
|
4262
4183
|
return getTimeslotsScheduleByDateRange;
|
|
@@ -4264,7 +4185,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4264
4185
|
}, {
|
|
4265
4186
|
key: "getAvailableDateForSessionOptimize",
|
|
4266
4187
|
value: function () {
|
|
4267
|
-
var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4188
|
+
var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
4268
4189
|
var _this$store$currentPr3, _this$store$currentPr4, _tempProducts;
|
|
4269
4190
|
var params,
|
|
4270
4191
|
startDate,
|
|
@@ -4284,11 +4205,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4284
4205
|
allProductResources,
|
|
4285
4206
|
targetSchedules,
|
|
4286
4207
|
_loop8,
|
|
4287
|
-
|
|
4288
|
-
return _regeneratorRuntime().wrap(function
|
|
4289
|
-
while (1) switch (
|
|
4208
|
+
_args30 = arguments;
|
|
4209
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context30) {
|
|
4210
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
4290
4211
|
case 0:
|
|
4291
|
-
params =
|
|
4212
|
+
params = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {};
|
|
4292
4213
|
// 开始日期如果小于今天,直接以今天当做开始日期
|
|
4293
4214
|
startDate = params.startDate, endDate = params.endDate; // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天 且 endDate 小于或等于今天,需要把 startDate 置为今天
|
|
4294
4215
|
if (dayjs(startDate).isBefore(dayjs(), 'day') && (dayjs(endDate).isAfter(dayjs(), 'day') || dayjs(endDate).isSame(dayjs(), 'day'))) {
|
|
@@ -4313,15 +4234,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4313
4234
|
// 先去读缓存结果,因为正常 UI 调用的是 7 天,而下面我会直接计算 30 天(最少也是 14 天),所以先去读缓存结果,如果缓存结果存在,则直接返回
|
|
4314
4235
|
cache = (_this$store$currentPr3 = this.store.currentProductMeta) === null || _this$store$currentPr3 === void 0 ? void 0 : _this$store$currentPr3['timeSlotBySchedule'];
|
|
4315
4236
|
if (!cache) {
|
|
4316
|
-
|
|
4237
|
+
_context30.next = 13;
|
|
4317
4238
|
break;
|
|
4318
4239
|
}
|
|
4319
4240
|
if (!(dayjs(params.startDate).isSameOrAfter(dayjs(cache.startDate), 'day') && dayjs(params.endDate).isSameOrBefore(dayjs(cache.endDate), 'day'))) {
|
|
4320
|
-
|
|
4241
|
+
_context30.next = 13;
|
|
4321
4242
|
break;
|
|
4322
4243
|
}
|
|
4323
4244
|
this.store.date.setDateList(cache.dateList);
|
|
4324
|
-
return
|
|
4245
|
+
return _context30.abrupt("return", {
|
|
4325
4246
|
dateList: cache.dateList,
|
|
4326
4247
|
firstAvailableDate: cache.firstAvailableDate
|
|
4327
4248
|
});
|
|
@@ -4331,7 +4252,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4331
4252
|
schedule = (_this$store$currentPr4 = this.store.currentProductMeta) === null || _this$store$currentPr4 === void 0 ? void 0 : _this$store$currentPr4['schedule'];
|
|
4332
4253
|
filteredSchedule = filterScheduleByDateRange(schedule, startDate || '', endDate || ''); // 1.后端返回的数据,确定资源在每一天的可用和使用情况
|
|
4333
4254
|
tempResourceIds = getResourcesIdsByProduct(tempProducts);
|
|
4334
|
-
|
|
4255
|
+
_context30.next = 19;
|
|
4335
4256
|
return this.store.date.fetchResourceDates({
|
|
4336
4257
|
query: {
|
|
4337
4258
|
start_date: startDate || '',
|
|
@@ -4340,7 +4261,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4340
4261
|
}
|
|
4341
4262
|
});
|
|
4342
4263
|
case 19:
|
|
4343
|
-
res =
|
|
4264
|
+
res = _context30.sent;
|
|
4344
4265
|
// 2. 商品 schedule 数据,确定日程在每一天的时间片
|
|
4345
4266
|
// 3. 把后端返回的和 schedule 的数据进行合并,确定每一天的可用和使用情况
|
|
4346
4267
|
dates = [];
|
|
@@ -4362,8 +4283,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4362
4283
|
targetSchedules = this.store.schedule.getScheduleListByIds(tempProducts['schedule.ids']);
|
|
4363
4284
|
_loop8 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop8() {
|
|
4364
4285
|
var currentDateStr, status, summaryCount, availableCount, _checkSessionProductL, latestStartDate, earliestEndDate, scheduleByDate, minTimeMaxTime, scheduleTimeSlots, timesSlotCanUse, dateStatus, usageRatio;
|
|
4365
|
-
return _regeneratorRuntime().wrap(function _loop8$(
|
|
4366
|
-
while (1) switch (
|
|
4286
|
+
return _regeneratorRuntime().wrap(function _loop8$(_context29) {
|
|
4287
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
4367
4288
|
case 0:
|
|
4368
4289
|
currentDateStr = currentDate.format('YYYY-MM-DD');
|
|
4369
4290
|
status = 'available';
|
|
@@ -4522,32 +4443,32 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4522
4443
|
|
|
4523
4444
|
// 如果 firstAvailableDate 距离 startDate 大于 14 天了,则后面就不需要再找了,也是一种性能保护
|
|
4524
4445
|
if (!(firstAvailableDate && dayjs(currentDate).diff(dayjs(startDate), 'day') > 31)) {
|
|
4525
|
-
|
|
4446
|
+
_context29.next = 12;
|
|
4526
4447
|
break;
|
|
4527
4448
|
}
|
|
4528
|
-
return
|
|
4449
|
+
return _context29.abrupt("return", 1);
|
|
4529
4450
|
case 12:
|
|
4530
4451
|
currentDate = dayjs(currentDate).add(1, 'day');
|
|
4531
4452
|
case 13:
|
|
4532
4453
|
case "end":
|
|
4533
|
-
return
|
|
4454
|
+
return _context29.stop();
|
|
4534
4455
|
}
|
|
4535
4456
|
}, _loop8);
|
|
4536
4457
|
});
|
|
4537
4458
|
case 28:
|
|
4538
4459
|
if (!(dayjs(currentDate).isBefore(dayjs(endDate), 'day') || dayjs(currentDate).isSame(dayjs(endDate), 'day'))) {
|
|
4539
|
-
|
|
4460
|
+
_context30.next = 34;
|
|
4540
4461
|
break;
|
|
4541
4462
|
}
|
|
4542
|
-
return
|
|
4463
|
+
return _context30.delegateYield(_loop8(), "t0", 30);
|
|
4543
4464
|
case 30:
|
|
4544
|
-
if (!
|
|
4545
|
-
|
|
4465
|
+
if (!_context30.t0) {
|
|
4466
|
+
_context30.next = 32;
|
|
4546
4467
|
break;
|
|
4547
4468
|
}
|
|
4548
|
-
return
|
|
4469
|
+
return _context30.abrupt("break", 34);
|
|
4549
4470
|
case 32:
|
|
4550
|
-
|
|
4471
|
+
_context30.next = 28;
|
|
4551
4472
|
break;
|
|
4552
4473
|
case 34:
|
|
4553
4474
|
// 最终把资源数据也加到日期内
|
|
@@ -4562,15 +4483,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4562
4483
|
startDate: startDate,
|
|
4563
4484
|
endDate: dayjs(currentDate).format('YYYY-MM-DD')
|
|
4564
4485
|
};
|
|
4565
|
-
return
|
|
4486
|
+
return _context30.abrupt("return", {
|
|
4566
4487
|
dateList: dates,
|
|
4567
4488
|
firstAvailableDate: firstAvailableDate
|
|
4568
4489
|
});
|
|
4569
4490
|
case 39:
|
|
4570
4491
|
case "end":
|
|
4571
|
-
return
|
|
4492
|
+
return _context30.stop();
|
|
4572
4493
|
}
|
|
4573
|
-
},
|
|
4494
|
+
}, _callee28, this);
|
|
4574
4495
|
}));
|
|
4575
4496
|
function getAvailableDateForSessionOptimize() {
|
|
4576
4497
|
return _getAvailableDateForSessionOptimize.apply(this, arguments);
|
|
@@ -4617,18 +4538,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4617
4538
|
}, {
|
|
4618
4539
|
key: "getContactInfo",
|
|
4619
4540
|
value: (function () {
|
|
4620
|
-
var _getContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4621
|
-
return _regeneratorRuntime().wrap(function
|
|
4622
|
-
while (1) switch (
|
|
4541
|
+
var _getContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
4542
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context31) {
|
|
4543
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
4623
4544
|
case 0:
|
|
4624
|
-
return
|
|
4545
|
+
return _context31.abrupt("return", this.request.get('/customer/metadata', params));
|
|
4625
4546
|
case 1:
|
|
4626
4547
|
case "end":
|
|
4627
|
-
return
|
|
4548
|
+
return _context31.stop();
|
|
4628
4549
|
}
|
|
4629
|
-
},
|
|
4550
|
+
}, _callee29, this);
|
|
4630
4551
|
}));
|
|
4631
|
-
function getContactInfo(
|
|
4552
|
+
function getContactInfo(_x23) {
|
|
4632
4553
|
return _getContactInfo.apply(this, arguments);
|
|
4633
4554
|
}
|
|
4634
4555
|
return getContactInfo;
|