@pisell/pisellos 2.1.159 → 2.1.161
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/Order/index.d.ts +0 -1
- package/dist/modules/Order/index.js +1 -18
- package/dist/modules/Order/types.d.ts +0 -2
- 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 -7
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +1 -2
- package/dist/plugins/window.d.ts +0 -1
- package/dist/solution/BookingByStep/index.d.ts +0 -15
- package/dist/solution/BookingByStep/index.js +204 -276
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/ScanOrder/types.d.ts +0 -1
- package/dist/solution/VenueBooking/index.d.ts +0 -19
- package/dist/solution/VenueBooking/index.js +733 -963
- package/dist/solution/VenueBooking/types.d.ts +0 -2
- package/dist/types/index.d.ts +0 -1
- package/lib/modules/Order/index.d.ts +0 -1
- package/lib/modules/Order/index.js +0 -14
- package/lib/modules/Order/types.d.ts +0 -2
- 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 -7
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +1 -3
- package/lib/plugins/window.d.ts +0 -1
- package/lib/solution/BookingByStep/index.d.ts +0 -15
- package/lib/solution/BookingByStep/index.js +0 -39
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/ScanOrder/types.d.ts +0 -1
- package/lib/solution/VenueBooking/index.d.ts +0 -19
- package/lib/solution/VenueBooking/index.js +16 -134
- package/lib/solution/VenueBooking/types.d.ts +0 -2
- package/lib/types/index.d.ts +0 -1
- package/package.json +2 -2
- 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/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
|
@@ -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,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1040
977
|
}, {
|
|
1041
978
|
key: "submitOrder",
|
|
1042
979
|
value: function () {
|
|
1043
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
980
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(extraData) {
|
|
1044
981
|
var _this$otherParams4;
|
|
1045
982
|
var cartItems, newCartItems, type;
|
|
1046
|
-
return _regeneratorRuntime().wrap(function
|
|
1047
|
-
while (1) switch (
|
|
983
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
984
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1048
985
|
case 0:
|
|
1049
986
|
cartItems = this.store.cart.getItems();
|
|
1050
987
|
newCartItems = cloneDeep(cartItems); // 先整个临时的逻辑,把购物车里所有商品的资源给他格式化一下
|
|
@@ -1074,7 +1011,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1074
1011
|
}))) {
|
|
1075
1012
|
type = 'virtual';
|
|
1076
1013
|
}
|
|
1077
|
-
return
|
|
1014
|
+
return _context19.abrupt("return", this.store.order.submitOrder({
|
|
1078
1015
|
query: {
|
|
1079
1016
|
cartItems: newCartItems,
|
|
1080
1017
|
type: type,
|
|
@@ -1085,11 +1022,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1085
1022
|
}));
|
|
1086
1023
|
case 6:
|
|
1087
1024
|
case "end":
|
|
1088
|
-
return
|
|
1025
|
+
return _context19.stop();
|
|
1089
1026
|
}
|
|
1090
|
-
},
|
|
1027
|
+
}, _callee19, this);
|
|
1091
1028
|
}));
|
|
1092
|
-
function submitOrder(
|
|
1029
|
+
function submitOrder(_x17) {
|
|
1093
1030
|
return _submitOrder.apply(this, arguments);
|
|
1094
1031
|
}
|
|
1095
1032
|
return submitOrder;
|
|
@@ -1097,14 +1034,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1097
1034
|
}, {
|
|
1098
1035
|
key: "pay",
|
|
1099
1036
|
value: function () {
|
|
1100
|
-
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1101
|
-
return _regeneratorRuntime().wrap(function
|
|
1102
|
-
while (1) switch (
|
|
1037
|
+
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1038
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1039
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1103
1040
|
case 0:
|
|
1104
1041
|
case "end":
|
|
1105
|
-
return
|
|
1042
|
+
return _context20.stop();
|
|
1106
1043
|
}
|
|
1107
|
-
},
|
|
1044
|
+
}, _callee20);
|
|
1108
1045
|
}));
|
|
1109
1046
|
function pay() {
|
|
1110
1047
|
return _pay.apply(this, arguments);
|
|
@@ -1114,14 +1051,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1114
1051
|
}, {
|
|
1115
1052
|
key: "getPayInfo",
|
|
1116
1053
|
value: function () {
|
|
1117
|
-
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1118
|
-
return _regeneratorRuntime().wrap(function
|
|
1119
|
-
while (1) switch (
|
|
1054
|
+
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1055
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1056
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1120
1057
|
case 0:
|
|
1121
1058
|
case "end":
|
|
1122
|
-
return
|
|
1059
|
+
return _context21.stop();
|
|
1123
1060
|
}
|
|
1124
|
-
},
|
|
1061
|
+
}, _callee21);
|
|
1125
1062
|
}));
|
|
1126
1063
|
function getPayInfo() {
|
|
1127
1064
|
return _getPayInfo.apply(this, arguments);
|
|
@@ -1131,15 +1068,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1131
1068
|
}, {
|
|
1132
1069
|
key: "setOtherParams",
|
|
1133
1070
|
value: function () {
|
|
1134
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1071
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
1135
1072
|
var _ref5,
|
|
1136
1073
|
_ref5$cover,
|
|
1137
1074
|
cover,
|
|
1138
|
-
|
|
1139
|
-
return _regeneratorRuntime().wrap(function
|
|
1140
|
-
while (1) switch (
|
|
1075
|
+
_args22 = arguments;
|
|
1076
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1077
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1141
1078
|
case 0:
|
|
1142
|
-
_ref5 =
|
|
1079
|
+
_ref5 = _args22.length > 1 && _args22[1] !== undefined ? _args22[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
|
|
1143
1080
|
if (cover) {
|
|
1144
1081
|
this.otherParams = params;
|
|
1145
1082
|
} else {
|
|
@@ -1147,11 +1084,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1147
1084
|
}
|
|
1148
1085
|
case 2:
|
|
1149
1086
|
case "end":
|
|
1150
|
-
return
|
|
1087
|
+
return _context22.stop();
|
|
1151
1088
|
}
|
|
1152
|
-
},
|
|
1089
|
+
}, _callee22, this);
|
|
1153
1090
|
}));
|
|
1154
|
-
function setOtherParams(
|
|
1091
|
+
function setOtherParams(_x18) {
|
|
1155
1092
|
return _setOtherParams.apply(this, arguments);
|
|
1156
1093
|
}
|
|
1157
1094
|
return setOtherParams;
|
|
@@ -1159,16 +1096,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1159
1096
|
}, {
|
|
1160
1097
|
key: "getOtherParams",
|
|
1161
1098
|
value: function () {
|
|
1162
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1163
|
-
return _regeneratorRuntime().wrap(function
|
|
1164
|
-
while (1) switch (
|
|
1099
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1100
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1101
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1165
1102
|
case 0:
|
|
1166
|
-
return
|
|
1103
|
+
return _context23.abrupt("return", this.otherParams);
|
|
1167
1104
|
case 1:
|
|
1168
1105
|
case "end":
|
|
1169
|
-
return
|
|
1106
|
+
return _context23.stop();
|
|
1170
1107
|
}
|
|
1171
|
-
},
|
|
1108
|
+
}, _callee23, this);
|
|
1172
1109
|
}));
|
|
1173
1110
|
function getOtherParams() {
|
|
1174
1111
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -1257,15 +1194,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1257
1194
|
account = activeAccount;
|
|
1258
1195
|
}
|
|
1259
1196
|
}
|
|
1260
|
-
try {
|
|
1261
|
-
this.store.holder.ensureFormByProduct({
|
|
1262
|
-
product: productData,
|
|
1263
|
-
shop_id: (productData === null || productData === void 0 ? void 0 : productData.shop_id) || '',
|
|
1264
|
-
useCache: true
|
|
1265
|
-
});
|
|
1266
|
-
} catch (error) {
|
|
1267
|
-
console.error('[BookingByStep] 加载 holder 表单失败', error);
|
|
1268
|
-
}
|
|
1269
1197
|
var flag = this.store.cart.mergeCartItemByRowKey({
|
|
1270
1198
|
rowKey: rowKey,
|
|
1271
1199
|
quantity: quantity,
|
|
@@ -2341,14 +2269,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2341
2269
|
}, {
|
|
2342
2270
|
key: "getTimeSlotByAllResourcesForDate",
|
|
2343
2271
|
value: function () {
|
|
2344
|
-
var _getTimeSlotByAllResourcesForDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2272
|
+
var _getTimeSlotByAllResourcesForDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(_ref10) {
|
|
2345
2273
|
var _this13 = this,
|
|
2346
2274
|
_cartItems$5,
|
|
2347
2275
|
_cartItems$6,
|
|
2348
2276
|
_this$shopStore$get2;
|
|
2349
2277
|
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;
|
|
2350
|
-
return _regeneratorRuntime().wrap(function
|
|
2351
|
-
while (1) switch (
|
|
2278
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context25) {
|
|
2279
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2352
2280
|
case 0:
|
|
2353
2281
|
resources_code = _ref10.resources_code, startDate = _ref10.startDate, endDate = _ref10.endDate;
|
|
2354
2282
|
// 如果 end_date 距离start_date小于 30 天,自动追加 end_date 为今天往后的 30 天
|
|
@@ -2356,7 +2284,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2356
2284
|
endDate = dayjs(startDate).add(30, 'day').format('YYYY-MM-DD');
|
|
2357
2285
|
}
|
|
2358
2286
|
// 预请求资源数据,防止日期超过之前选择的范围
|
|
2359
|
-
|
|
2287
|
+
_context25.next = 4;
|
|
2360
2288
|
return this.getAvailableDate({
|
|
2361
2289
|
startDate: startDate,
|
|
2362
2290
|
endDate: endDate,
|
|
@@ -2402,10 +2330,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2402
2330
|
|
|
2403
2331
|
// 保护: 如果 resources 为空则直接 return
|
|
2404
2332
|
if (resources.length) {
|
|
2405
|
-
|
|
2333
|
+
_context25.next = 14;
|
|
2406
2334
|
break;
|
|
2407
2335
|
}
|
|
2408
|
-
return
|
|
2336
|
+
return _context25.abrupt("return", []);
|
|
2409
2337
|
case 14:
|
|
2410
2338
|
duration = 0; // duration = 不同账号的最长时间
|
|
2411
2339
|
accountList = this.store.accountList.getAccounts();
|
|
@@ -2439,10 +2367,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2439
2367
|
// 如果 cartItem 上既没有时间,也没有资源,认为外部属于异常调用,直接丢一个空数组出去
|
|
2440
2368
|
// 同时 session 类商品的流程也不应该调用这个方法
|
|
2441
2369
|
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))) {
|
|
2442
|
-
|
|
2370
|
+
_context25.next = 20;
|
|
2443
2371
|
break;
|
|
2444
2372
|
}
|
|
2445
|
-
return
|
|
2373
|
+
return _context25.abrupt("return", []);
|
|
2446
2374
|
case 20:
|
|
2447
2375
|
resourcesUseableMap = {};
|
|
2448
2376
|
hasFlexibleDuration = cartItems.some(function (item) {
|
|
@@ -2496,8 +2424,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2496
2424
|
today = dayjs().startOf('day'); // 计算 start_date 到 end_date 之间的所有日期,遍历他们并且计算每一天的可用
|
|
2497
2425
|
_loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() {
|
|
2498
2426
|
var currentDate, theDateResources, resourcesMap, timeSlots;
|
|
2499
|
-
return _regeneratorRuntime().wrap(function _loop2$(
|
|
2500
|
-
while (1) switch (
|
|
2427
|
+
return _regeneratorRuntime().wrap(function _loop2$(_context24) {
|
|
2428
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2501
2429
|
case 0:
|
|
2502
2430
|
currentDate = i.format('YYYY-MM-DD');
|
|
2503
2431
|
theDateResources = _this13.store.date.getResourcesListByDate(currentDate);
|
|
@@ -2509,7 +2437,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2509
2437
|
});
|
|
2510
2438
|
resourcesMap = getResourcesMap(resources); // 如果日期已经过期则直接标记为不可用
|
|
2511
2439
|
if (!i.isBefore(today)) {
|
|
2512
|
-
|
|
2440
|
+
_context24.next = 7;
|
|
2513
2441
|
break;
|
|
2514
2442
|
}
|
|
2515
2443
|
arr.push({
|
|
@@ -2518,7 +2446,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2518
2446
|
week: i.format('ddd'),
|
|
2519
2447
|
weekNum: i.day()
|
|
2520
2448
|
});
|
|
2521
|
-
return
|
|
2449
|
+
return _context24.abrupt("return", 1);
|
|
2522
2450
|
case 7:
|
|
2523
2451
|
timeSlots = getTimeSlicesByResources({
|
|
2524
2452
|
resourceIds: resourceIds,
|
|
@@ -2550,36 +2478,36 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2550
2478
|
}
|
|
2551
2479
|
case 9:
|
|
2552
2480
|
case "end":
|
|
2553
|
-
return
|
|
2481
|
+
return _context24.stop();
|
|
2554
2482
|
}
|
|
2555
2483
|
}, _loop2);
|
|
2556
2484
|
});
|
|
2557
2485
|
i = dayjs(startDate);
|
|
2558
2486
|
case 32:
|
|
2559
2487
|
if (!i.isBefore(dayjs(endDate))) {
|
|
2560
|
-
|
|
2488
|
+
_context25.next = 39;
|
|
2561
2489
|
break;
|
|
2562
2490
|
}
|
|
2563
|
-
return
|
|
2491
|
+
return _context25.delegateYield(_loop2(), "t0", 34);
|
|
2564
2492
|
case 34:
|
|
2565
|
-
if (!
|
|
2566
|
-
|
|
2493
|
+
if (!_context25.t0) {
|
|
2494
|
+
_context25.next = 36;
|
|
2567
2495
|
break;
|
|
2568
2496
|
}
|
|
2569
|
-
return
|
|
2497
|
+
return _context25.abrupt("continue", 36);
|
|
2570
2498
|
case 36:
|
|
2571
2499
|
i = i.add(1, 'day');
|
|
2572
|
-
|
|
2500
|
+
_context25.next = 32;
|
|
2573
2501
|
break;
|
|
2574
2502
|
case 39:
|
|
2575
|
-
return
|
|
2503
|
+
return _context25.abrupt("return", arr);
|
|
2576
2504
|
case 40:
|
|
2577
2505
|
case "end":
|
|
2578
|
-
return
|
|
2506
|
+
return _context25.stop();
|
|
2579
2507
|
}
|
|
2580
|
-
},
|
|
2508
|
+
}, _callee24, this);
|
|
2581
2509
|
}));
|
|
2582
|
-
function getTimeSlotByAllResourcesForDate(
|
|
2510
|
+
function getTimeSlotByAllResourcesForDate(_x19) {
|
|
2583
2511
|
return _getTimeSlotByAllResourcesForDate.apply(this, arguments);
|
|
2584
2512
|
}
|
|
2585
2513
|
return getTimeSlotByAllResourcesForDate;
|
|
@@ -2760,42 +2688,42 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2760
2688
|
}, {
|
|
2761
2689
|
key: "openProductDetail",
|
|
2762
2690
|
value: function () {
|
|
2763
|
-
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2691
|
+
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(productId) {
|
|
2764
2692
|
var targetProductData, newScheduleArr, dateRange;
|
|
2765
|
-
return _regeneratorRuntime().wrap(function
|
|
2766
|
-
while (1) switch (
|
|
2693
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context26) {
|
|
2694
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2767
2695
|
case 0:
|
|
2768
|
-
|
|
2696
|
+
_context26.next = 2;
|
|
2769
2697
|
return this.store.products.getProduct(productId);
|
|
2770
2698
|
case 2:
|
|
2771
|
-
targetProductData =
|
|
2699
|
+
targetProductData = _context26.sent;
|
|
2772
2700
|
if (!targetProductData) {
|
|
2773
|
-
|
|
2701
|
+
_context26.next = 17;
|
|
2774
2702
|
break;
|
|
2775
2703
|
}
|
|
2776
2704
|
this.store.currentProduct = targetProductData;
|
|
2777
2705
|
this.store.currentProductMeta = {};
|
|
2778
2706
|
// 资源预加载,如果是 duration 类型的商品,且是先选日期的流程,在这里预拉取资源数据
|
|
2779
2707
|
if (!targetProductData['schedule.ids']) {
|
|
2780
|
-
|
|
2708
|
+
_context26.next = 12;
|
|
2781
2709
|
break;
|
|
2782
2710
|
}
|
|
2783
2711
|
newScheduleArr = this.getScheduleDataByIds(targetProductData['schedule.ids']);
|
|
2784
2712
|
if (!this.store.currentProductMeta) this.store.currentProductMeta = {};
|
|
2785
2713
|
this.store.currentProductMeta.schedule = newScheduleArr;
|
|
2786
|
-
|
|
2714
|
+
_context26.next = 17;
|
|
2787
2715
|
break;
|
|
2788
2716
|
case 12:
|
|
2789
2717
|
if (!targetProductData.duration) {
|
|
2790
|
-
|
|
2718
|
+
_context26.next = 17;
|
|
2791
2719
|
break;
|
|
2792
2720
|
}
|
|
2793
2721
|
dateRange = this.store.date.getDateRange(); // 如果不是先选日期的流程 duration 商品就啥也不做
|
|
2794
2722
|
if (dateRange !== null && dateRange !== void 0 && dateRange.length) {
|
|
2795
|
-
|
|
2723
|
+
_context26.next = 16;
|
|
2796
2724
|
break;
|
|
2797
2725
|
}
|
|
2798
|
-
return
|
|
2726
|
+
return _context26.abrupt("return");
|
|
2799
2727
|
case 16:
|
|
2800
2728
|
// this.store.date.getResourceDates({
|
|
2801
2729
|
// query: {
|
|
@@ -2811,11 +2739,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2811
2739
|
});
|
|
2812
2740
|
case 17:
|
|
2813
2741
|
case "end":
|
|
2814
|
-
return
|
|
2742
|
+
return _context26.stop();
|
|
2815
2743
|
}
|
|
2816
|
-
},
|
|
2744
|
+
}, _callee25, this);
|
|
2817
2745
|
}));
|
|
2818
|
-
function openProductDetail(
|
|
2746
|
+
function openProductDetail(_x20) {
|
|
2819
2747
|
return _openProductDetail.apply(this, arguments);
|
|
2820
2748
|
}
|
|
2821
2749
|
return openProductDetail;
|
|
@@ -4066,41 +3994,41 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4066
3994
|
}, {
|
|
4067
3995
|
key: "getProductTypeById",
|
|
4068
3996
|
value: function () {
|
|
4069
|
-
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3997
|
+
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(id) {
|
|
4070
3998
|
var productData, _productData$schedule;
|
|
4071
|
-
return _regeneratorRuntime().wrap(function
|
|
4072
|
-
while (1) switch (
|
|
3999
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context27) {
|
|
4000
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
4073
4001
|
case 0:
|
|
4074
|
-
|
|
4002
|
+
_context27.next = 2;
|
|
4075
4003
|
return this.store.products.getProduct(id);
|
|
4076
4004
|
case 2:
|
|
4077
|
-
productData =
|
|
4005
|
+
productData = _context27.sent;
|
|
4078
4006
|
if (!productData) {
|
|
4079
|
-
|
|
4007
|
+
_context27.next = 9;
|
|
4080
4008
|
break;
|
|
4081
4009
|
}
|
|
4082
4010
|
if (!productData.duration) {
|
|
4083
|
-
|
|
4011
|
+
_context27.next = 6;
|
|
4084
4012
|
break;
|
|
4085
4013
|
}
|
|
4086
|
-
return
|
|
4014
|
+
return _context27.abrupt("return", 'duration');
|
|
4087
4015
|
case 6:
|
|
4088
4016
|
if (!((_productData$schedule = productData['schedule.ids']) !== null && _productData$schedule !== void 0 && _productData$schedule.length)) {
|
|
4089
|
-
|
|
4017
|
+
_context27.next = 8;
|
|
4090
4018
|
break;
|
|
4091
4019
|
}
|
|
4092
|
-
return
|
|
4020
|
+
return _context27.abrupt("return", 'session');
|
|
4093
4021
|
case 8:
|
|
4094
|
-
return
|
|
4022
|
+
return _context27.abrupt("return", 'normal');
|
|
4095
4023
|
case 9:
|
|
4096
|
-
return
|
|
4024
|
+
return _context27.abrupt("return", 'normal');
|
|
4097
4025
|
case 10:
|
|
4098
4026
|
case "end":
|
|
4099
|
-
return
|
|
4027
|
+
return _context27.stop();
|
|
4100
4028
|
}
|
|
4101
|
-
},
|
|
4029
|
+
}, _callee26, this);
|
|
4102
4030
|
}));
|
|
4103
|
-
function getProductTypeById(
|
|
4031
|
+
function getProductTypeById(_x21) {
|
|
4104
4032
|
return _getProductTypeById.apply(this, arguments);
|
|
4105
4033
|
}
|
|
4106
4034
|
return getProductTypeById;
|
|
@@ -4220,10 +4148,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4220
4148
|
}, {
|
|
4221
4149
|
key: "getTimeslotsScheduleByDateRange",
|
|
4222
4150
|
value: (function () {
|
|
4223
|
-
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4151
|
+
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(_ref16) {
|
|
4224
4152
|
var startDate, endDate, scheduleIds, resources, dates, currentDate, end, results, _i5, _dates, date;
|
|
4225
|
-
return _regeneratorRuntime().wrap(function
|
|
4226
|
-
while (1) switch (
|
|
4153
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
4154
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
4227
4155
|
case 0:
|
|
4228
4156
|
startDate = _ref16.startDate, endDate = _ref16.endDate, scheduleIds = _ref16.scheduleIds, resources = _ref16.resources;
|
|
4229
4157
|
console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
|
|
@@ -4250,14 +4178,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4250
4178
|
resources: resources
|
|
4251
4179
|
});
|
|
4252
4180
|
}
|
|
4253
|
-
return
|
|
4181
|
+
return _context28.abrupt("return", results);
|
|
4254
4182
|
case 9:
|
|
4255
4183
|
case "end":
|
|
4256
|
-
return
|
|
4184
|
+
return _context28.stop();
|
|
4257
4185
|
}
|
|
4258
|
-
},
|
|
4186
|
+
}, _callee27, this);
|
|
4259
4187
|
}));
|
|
4260
|
-
function getTimeslotsScheduleByDateRange(
|
|
4188
|
+
function getTimeslotsScheduleByDateRange(_x22) {
|
|
4261
4189
|
return _getTimeslotsScheduleByDateRange.apply(this, arguments);
|
|
4262
4190
|
}
|
|
4263
4191
|
return getTimeslotsScheduleByDateRange;
|
|
@@ -4265,7 +4193,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4265
4193
|
}, {
|
|
4266
4194
|
key: "getAvailableDateForSessionOptimize",
|
|
4267
4195
|
value: function () {
|
|
4268
|
-
var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4196
|
+
var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
4269
4197
|
var _this$store$currentPr3, _this$store$currentPr4, _tempProducts;
|
|
4270
4198
|
var params,
|
|
4271
4199
|
startDate,
|
|
@@ -4285,11 +4213,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4285
4213
|
allProductResources,
|
|
4286
4214
|
targetSchedules,
|
|
4287
4215
|
_loop8,
|
|
4288
|
-
|
|
4289
|
-
return _regeneratorRuntime().wrap(function
|
|
4290
|
-
while (1) switch (
|
|
4216
|
+
_args30 = arguments;
|
|
4217
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context30) {
|
|
4218
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
4291
4219
|
case 0:
|
|
4292
|
-
params =
|
|
4220
|
+
params = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {};
|
|
4293
4221
|
// 开始日期如果小于今天,直接以今天当做开始日期
|
|
4294
4222
|
startDate = params.startDate, endDate = params.endDate; // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天 且 endDate 小于或等于今天,需要把 startDate 置为今天
|
|
4295
4223
|
if (dayjs(startDate).isBefore(dayjs(), 'day') && (dayjs(endDate).isAfter(dayjs(), 'day') || dayjs(endDate).isSame(dayjs(), 'day'))) {
|
|
@@ -4314,15 +4242,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4314
4242
|
// 先去读缓存结果,因为正常 UI 调用的是 7 天,而下面我会直接计算 30 天(最少也是 14 天),所以先去读缓存结果,如果缓存结果存在,则直接返回
|
|
4315
4243
|
cache = (_this$store$currentPr3 = this.store.currentProductMeta) === null || _this$store$currentPr3 === void 0 ? void 0 : _this$store$currentPr3['timeSlotBySchedule'];
|
|
4316
4244
|
if (!cache) {
|
|
4317
|
-
|
|
4245
|
+
_context30.next = 13;
|
|
4318
4246
|
break;
|
|
4319
4247
|
}
|
|
4320
4248
|
if (!(dayjs(params.startDate).isSameOrAfter(dayjs(cache.startDate), 'day') && dayjs(params.endDate).isSameOrBefore(dayjs(cache.endDate), 'day'))) {
|
|
4321
|
-
|
|
4249
|
+
_context30.next = 13;
|
|
4322
4250
|
break;
|
|
4323
4251
|
}
|
|
4324
4252
|
this.store.date.setDateList(cache.dateList);
|
|
4325
|
-
return
|
|
4253
|
+
return _context30.abrupt("return", {
|
|
4326
4254
|
dateList: cache.dateList,
|
|
4327
4255
|
firstAvailableDate: cache.firstAvailableDate
|
|
4328
4256
|
});
|
|
@@ -4332,7 +4260,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4332
4260
|
schedule = (_this$store$currentPr4 = this.store.currentProductMeta) === null || _this$store$currentPr4 === void 0 ? void 0 : _this$store$currentPr4['schedule'];
|
|
4333
4261
|
filteredSchedule = filterScheduleByDateRange(schedule, startDate || '', endDate || ''); // 1.后端返回的数据,确定资源在每一天的可用和使用情况
|
|
4334
4262
|
tempResourceIds = getResourcesIdsByProduct(tempProducts);
|
|
4335
|
-
|
|
4263
|
+
_context30.next = 19;
|
|
4336
4264
|
return this.store.date.fetchResourceDates({
|
|
4337
4265
|
query: {
|
|
4338
4266
|
start_date: startDate || '',
|
|
@@ -4341,7 +4269,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4341
4269
|
}
|
|
4342
4270
|
});
|
|
4343
4271
|
case 19:
|
|
4344
|
-
res =
|
|
4272
|
+
res = _context30.sent;
|
|
4345
4273
|
// 2. 商品 schedule 数据,确定日程在每一天的时间片
|
|
4346
4274
|
// 3. 把后端返回的和 schedule 的数据进行合并,确定每一天的可用和使用情况
|
|
4347
4275
|
dates = [];
|
|
@@ -4363,8 +4291,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4363
4291
|
targetSchedules = this.store.schedule.getScheduleListByIds(tempProducts['schedule.ids']);
|
|
4364
4292
|
_loop8 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop8() {
|
|
4365
4293
|
var currentDateStr, status, summaryCount, availableCount, _checkSessionProductL, latestStartDate, earliestEndDate, scheduleByDate, minTimeMaxTime, scheduleTimeSlots, timesSlotCanUse, dateStatus, usageRatio;
|
|
4366
|
-
return _regeneratorRuntime().wrap(function _loop8$(
|
|
4367
|
-
while (1) switch (
|
|
4294
|
+
return _regeneratorRuntime().wrap(function _loop8$(_context29) {
|
|
4295
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
4368
4296
|
case 0:
|
|
4369
4297
|
currentDateStr = currentDate.format('YYYY-MM-DD');
|
|
4370
4298
|
status = 'available';
|
|
@@ -4523,32 +4451,32 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4523
4451
|
|
|
4524
4452
|
// 如果 firstAvailableDate 距离 startDate 大于 14 天了,则后面就不需要再找了,也是一种性能保护
|
|
4525
4453
|
if (!(firstAvailableDate && dayjs(currentDate).diff(dayjs(startDate), 'day') > 31)) {
|
|
4526
|
-
|
|
4454
|
+
_context29.next = 12;
|
|
4527
4455
|
break;
|
|
4528
4456
|
}
|
|
4529
|
-
return
|
|
4457
|
+
return _context29.abrupt("return", 1);
|
|
4530
4458
|
case 12:
|
|
4531
4459
|
currentDate = dayjs(currentDate).add(1, 'day');
|
|
4532
4460
|
case 13:
|
|
4533
4461
|
case "end":
|
|
4534
|
-
return
|
|
4462
|
+
return _context29.stop();
|
|
4535
4463
|
}
|
|
4536
4464
|
}, _loop8);
|
|
4537
4465
|
});
|
|
4538
4466
|
case 28:
|
|
4539
4467
|
if (!(dayjs(currentDate).isBefore(dayjs(endDate), 'day') || dayjs(currentDate).isSame(dayjs(endDate), 'day'))) {
|
|
4540
|
-
|
|
4468
|
+
_context30.next = 34;
|
|
4541
4469
|
break;
|
|
4542
4470
|
}
|
|
4543
|
-
return
|
|
4471
|
+
return _context30.delegateYield(_loop8(), "t0", 30);
|
|
4544
4472
|
case 30:
|
|
4545
|
-
if (!
|
|
4546
|
-
|
|
4473
|
+
if (!_context30.t0) {
|
|
4474
|
+
_context30.next = 32;
|
|
4547
4475
|
break;
|
|
4548
4476
|
}
|
|
4549
|
-
return
|
|
4477
|
+
return _context30.abrupt("break", 34);
|
|
4550
4478
|
case 32:
|
|
4551
|
-
|
|
4479
|
+
_context30.next = 28;
|
|
4552
4480
|
break;
|
|
4553
4481
|
case 34:
|
|
4554
4482
|
// 最终把资源数据也加到日期内
|
|
@@ -4563,15 +4491,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4563
4491
|
startDate: startDate,
|
|
4564
4492
|
endDate: dayjs(currentDate).format('YYYY-MM-DD')
|
|
4565
4493
|
};
|
|
4566
|
-
return
|
|
4494
|
+
return _context30.abrupt("return", {
|
|
4567
4495
|
dateList: dates,
|
|
4568
4496
|
firstAvailableDate: firstAvailableDate
|
|
4569
4497
|
});
|
|
4570
4498
|
case 39:
|
|
4571
4499
|
case "end":
|
|
4572
|
-
return
|
|
4500
|
+
return _context30.stop();
|
|
4573
4501
|
}
|
|
4574
|
-
},
|
|
4502
|
+
}, _callee28, this);
|
|
4575
4503
|
}));
|
|
4576
4504
|
function getAvailableDateForSessionOptimize() {
|
|
4577
4505
|
return _getAvailableDateForSessionOptimize.apply(this, arguments);
|
|
@@ -4618,18 +4546,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4618
4546
|
}, {
|
|
4619
4547
|
key: "getContactInfo",
|
|
4620
4548
|
value: (function () {
|
|
4621
|
-
var _getContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4622
|
-
return _regeneratorRuntime().wrap(function
|
|
4623
|
-
while (1) switch (
|
|
4549
|
+
var _getContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
4550
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context31) {
|
|
4551
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
4624
4552
|
case 0:
|
|
4625
|
-
return
|
|
4553
|
+
return _context31.abrupt("return", this.request.get('/customer/metadata', params));
|
|
4626
4554
|
case 1:
|
|
4627
4555
|
case "end":
|
|
4628
|
-
return
|
|
4556
|
+
return _context31.stop();
|
|
4629
4557
|
}
|
|
4630
|
-
},
|
|
4558
|
+
}, _callee29, this);
|
|
4631
4559
|
}));
|
|
4632
|
-
function getContactInfo(
|
|
4560
|
+
function getContactInfo(_x23) {
|
|
4633
4561
|
return _getContactInfo.apply(this, arguments);
|
|
4634
4562
|
}
|
|
4635
4563
|
return getContactInfo;
|