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