@pisell/pisellos 3.0.93 → 3.0.95
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/Cart/utils/changePrice.js +16 -9
- 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/Order/index.d.ts +1 -0
- package/dist/modules/Order/index.js +18 -1
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +35 -3
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +7 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +2 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/solution/BookingByStep/index.d.ts +16 -1
- package/dist/solution/BookingByStep/index.js +276 -204
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/ScanOrder/types.d.ts +1 -0
- package/dist/solution/VenueBooking/index.d.ts +19 -0
- package/dist/solution/VenueBooking/index.js +978 -748
- package/dist/solution/VenueBooking/types.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/lib/modules/Cart/utils/changePrice.js +13 -9
- 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/Order/index.d.ts +1 -0
- package/lib/modules/Order/index.js +14 -0
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +36 -5
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +7 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +3 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +16 -1
- package/lib/solution/BookingByStep/index.js +39 -0
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/ScanOrder/types.d.ts +1 -0
- package/lib/solution/VenueBooking/index.d.ts +19 -0
- package/lib/solution/VenueBooking/index.js +134 -16
- package/lib/solution/VenueBooking/types.d.ts +2 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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', 'payment'];
|
|
121
|
+
moduleArr = ['accountList', 'holder', 'cart', 'schedule', 'summary', 'step', 'products', 'date', 'order', 'payment'];
|
|
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,10 @@ 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) {
|
|
981
1044
|
var cartItems, newCartItems, type;
|
|
982
|
-
return _regeneratorRuntime().wrap(function
|
|
983
|
-
while (1) switch (
|
|
1045
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1046
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
984
1047
|
case 0:
|
|
985
1048
|
cartItems = this.store.cart.getItems();
|
|
986
1049
|
newCartItems = cloneDeep(cartItems); // 先整个临时的逻辑,把购物车里所有商品的资源给他格式化一下
|
|
@@ -1010,7 +1073,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1010
1073
|
}))) {
|
|
1011
1074
|
type = 'virtual';
|
|
1012
1075
|
}
|
|
1013
|
-
return
|
|
1076
|
+
return _context20.abrupt("return", this.store.order.submitOrder({
|
|
1014
1077
|
query: {
|
|
1015
1078
|
cartItems: newCartItems,
|
|
1016
1079
|
type: type,
|
|
@@ -1020,11 +1083,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1020
1083
|
}));
|
|
1021
1084
|
case 6:
|
|
1022
1085
|
case "end":
|
|
1023
|
-
return
|
|
1086
|
+
return _context20.stop();
|
|
1024
1087
|
}
|
|
1025
|
-
},
|
|
1088
|
+
}, _callee20, this);
|
|
1026
1089
|
}));
|
|
1027
|
-
function submitOrder(
|
|
1090
|
+
function submitOrder(_x18) {
|
|
1028
1091
|
return _submitOrder.apply(this, arguments);
|
|
1029
1092
|
}
|
|
1030
1093
|
return submitOrder;
|
|
@@ -1032,14 +1095,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1032
1095
|
}, {
|
|
1033
1096
|
key: "pay",
|
|
1034
1097
|
value: function () {
|
|
1035
|
-
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1036
|
-
return _regeneratorRuntime().wrap(function
|
|
1037
|
-
while (1) switch (
|
|
1098
|
+
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1099
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1100
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1038
1101
|
case 0:
|
|
1039
1102
|
case "end":
|
|
1040
|
-
return
|
|
1103
|
+
return _context21.stop();
|
|
1041
1104
|
}
|
|
1042
|
-
},
|
|
1105
|
+
}, _callee21);
|
|
1043
1106
|
}));
|
|
1044
1107
|
function pay() {
|
|
1045
1108
|
return _pay.apply(this, arguments);
|
|
@@ -1049,14 +1112,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1049
1112
|
}, {
|
|
1050
1113
|
key: "getPayInfo",
|
|
1051
1114
|
value: function () {
|
|
1052
|
-
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1053
|
-
return _regeneratorRuntime().wrap(function
|
|
1054
|
-
while (1) switch (
|
|
1115
|
+
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1116
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1117
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1055
1118
|
case 0:
|
|
1056
1119
|
case "end":
|
|
1057
|
-
return
|
|
1120
|
+
return _context22.stop();
|
|
1058
1121
|
}
|
|
1059
|
-
},
|
|
1122
|
+
}, _callee22);
|
|
1060
1123
|
}));
|
|
1061
1124
|
function getPayInfo() {
|
|
1062
1125
|
return _getPayInfo.apply(this, arguments);
|
|
@@ -1066,15 +1129,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1066
1129
|
}, {
|
|
1067
1130
|
key: "setOtherParams",
|
|
1068
1131
|
value: function () {
|
|
1069
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1132
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
1070
1133
|
var _ref5,
|
|
1071
1134
|
_ref5$cover,
|
|
1072
1135
|
cover,
|
|
1073
|
-
|
|
1074
|
-
return _regeneratorRuntime().wrap(function
|
|
1075
|
-
while (1) switch (
|
|
1136
|
+
_args23 = arguments;
|
|
1137
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1138
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1076
1139
|
case 0:
|
|
1077
|
-
_ref5 =
|
|
1140
|
+
_ref5 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
|
|
1078
1141
|
if (cover) {
|
|
1079
1142
|
this.otherParams = params;
|
|
1080
1143
|
} else {
|
|
@@ -1082,11 +1145,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1082
1145
|
}
|
|
1083
1146
|
case 2:
|
|
1084
1147
|
case "end":
|
|
1085
|
-
return
|
|
1148
|
+
return _context23.stop();
|
|
1086
1149
|
}
|
|
1087
|
-
},
|
|
1150
|
+
}, _callee23, this);
|
|
1088
1151
|
}));
|
|
1089
|
-
function setOtherParams(
|
|
1152
|
+
function setOtherParams(_x19) {
|
|
1090
1153
|
return _setOtherParams.apply(this, arguments);
|
|
1091
1154
|
}
|
|
1092
1155
|
return setOtherParams;
|
|
@@ -1094,16 +1157,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1094
1157
|
}, {
|
|
1095
1158
|
key: "getOtherParams",
|
|
1096
1159
|
value: function () {
|
|
1097
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1098
|
-
return _regeneratorRuntime().wrap(function
|
|
1099
|
-
while (1) switch (
|
|
1160
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1161
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1162
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1100
1163
|
case 0:
|
|
1101
|
-
return
|
|
1164
|
+
return _context24.abrupt("return", this.otherParams);
|
|
1102
1165
|
case 1:
|
|
1103
1166
|
case "end":
|
|
1104
|
-
return
|
|
1167
|
+
return _context24.stop();
|
|
1105
1168
|
}
|
|
1106
|
-
},
|
|
1169
|
+
}, _callee24, this);
|
|
1107
1170
|
}));
|
|
1108
1171
|
function getOtherParams() {
|
|
1109
1172
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -1192,6 +1255,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1192
1255
|
account = activeAccount;
|
|
1193
1256
|
}
|
|
1194
1257
|
}
|
|
1258
|
+
try {
|
|
1259
|
+
this.store.holder.ensureFormByProduct({
|
|
1260
|
+
product: productData,
|
|
1261
|
+
shop_id: (productData === null || productData === void 0 ? void 0 : productData.shop_id) || '',
|
|
1262
|
+
useCache: true
|
|
1263
|
+
});
|
|
1264
|
+
} catch (error) {
|
|
1265
|
+
console.error('[BookingByStep] 加载 holder 表单失败', error);
|
|
1266
|
+
}
|
|
1195
1267
|
var flag = this.store.cart.mergeCartItemByRowKey({
|
|
1196
1268
|
rowKey: rowKey,
|
|
1197
1269
|
quantity: quantity,
|
|
@@ -2259,14 +2331,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2259
2331
|
}, {
|
|
2260
2332
|
key: "getTimeSlotByAllResourcesForDate",
|
|
2261
2333
|
value: function () {
|
|
2262
|
-
var _getTimeSlotByAllResourcesForDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2334
|
+
var _getTimeSlotByAllResourcesForDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(_ref10) {
|
|
2263
2335
|
var _this13 = this,
|
|
2264
2336
|
_cartItems$5,
|
|
2265
2337
|
_cartItems$6,
|
|
2266
2338
|
_this$shopStore$get2;
|
|
2267
2339
|
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;
|
|
2268
|
-
return _regeneratorRuntime().wrap(function
|
|
2269
|
-
while (1) switch (
|
|
2340
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context26) {
|
|
2341
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2270
2342
|
case 0:
|
|
2271
2343
|
resources_code = _ref10.resources_code, startDate = _ref10.startDate, endDate = _ref10.endDate;
|
|
2272
2344
|
// 如果 end_date 距离start_date小于 30 天,自动追加 end_date 为今天往后的 30 天
|
|
@@ -2274,7 +2346,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2274
2346
|
endDate = dayjs(startDate).add(30, 'day').format('YYYY-MM-DD');
|
|
2275
2347
|
}
|
|
2276
2348
|
// 预请求资源数据,防止日期超过之前选择的范围
|
|
2277
|
-
|
|
2349
|
+
_context26.next = 4;
|
|
2278
2350
|
return this.getAvailableDate({
|
|
2279
2351
|
startDate: startDate,
|
|
2280
2352
|
endDate: endDate,
|
|
@@ -2320,10 +2392,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2320
2392
|
|
|
2321
2393
|
// 保护: 如果 resources 为空则直接 return
|
|
2322
2394
|
if (resources.length) {
|
|
2323
|
-
|
|
2395
|
+
_context26.next = 14;
|
|
2324
2396
|
break;
|
|
2325
2397
|
}
|
|
2326
|
-
return
|
|
2398
|
+
return _context26.abrupt("return", []);
|
|
2327
2399
|
case 14:
|
|
2328
2400
|
duration = 0; // duration = 不同账号的最长时间
|
|
2329
2401
|
accountList = this.store.accountList.getAccounts();
|
|
@@ -2357,10 +2429,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2357
2429
|
// 如果 cartItem 上既没有时间,也没有资源,认为外部属于异常调用,直接丢一个空数组出去
|
|
2358
2430
|
// 同时 session 类商品的流程也不应该调用这个方法
|
|
2359
2431
|
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))) {
|
|
2360
|
-
|
|
2432
|
+
_context26.next = 20;
|
|
2361
2433
|
break;
|
|
2362
2434
|
}
|
|
2363
|
-
return
|
|
2435
|
+
return _context26.abrupt("return", []);
|
|
2364
2436
|
case 20:
|
|
2365
2437
|
resourcesUseableMap = {};
|
|
2366
2438
|
hasFlexibleDuration = cartItems.some(function (item) {
|
|
@@ -2414,8 +2486,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2414
2486
|
today = dayjs().startOf('day'); // 计算 start_date 到 end_date 之间的所有日期,遍历他们并且计算每一天的可用
|
|
2415
2487
|
_loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() {
|
|
2416
2488
|
var currentDate, theDateResources, resourcesMap, timeSlots;
|
|
2417
|
-
return _regeneratorRuntime().wrap(function _loop2$(
|
|
2418
|
-
while (1) switch (
|
|
2489
|
+
return _regeneratorRuntime().wrap(function _loop2$(_context25) {
|
|
2490
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2419
2491
|
case 0:
|
|
2420
2492
|
currentDate = i.format('YYYY-MM-DD');
|
|
2421
2493
|
theDateResources = _this13.store.date.getResourcesListByDate(currentDate);
|
|
@@ -2427,7 +2499,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2427
2499
|
});
|
|
2428
2500
|
resourcesMap = getResourcesMap(resources); // 如果日期已经过期则直接标记为不可用
|
|
2429
2501
|
if (!i.isBefore(today)) {
|
|
2430
|
-
|
|
2502
|
+
_context25.next = 7;
|
|
2431
2503
|
break;
|
|
2432
2504
|
}
|
|
2433
2505
|
arr.push({
|
|
@@ -2436,7 +2508,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2436
2508
|
week: i.format('ddd'),
|
|
2437
2509
|
weekNum: i.day()
|
|
2438
2510
|
});
|
|
2439
|
-
return
|
|
2511
|
+
return _context25.abrupt("return", 1);
|
|
2440
2512
|
case 7:
|
|
2441
2513
|
timeSlots = getTimeSlicesByResources({
|
|
2442
2514
|
resourceIds: resourceIds,
|
|
@@ -2468,36 +2540,36 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2468
2540
|
}
|
|
2469
2541
|
case 9:
|
|
2470
2542
|
case "end":
|
|
2471
|
-
return
|
|
2543
|
+
return _context25.stop();
|
|
2472
2544
|
}
|
|
2473
2545
|
}, _loop2);
|
|
2474
2546
|
});
|
|
2475
2547
|
i = dayjs(startDate);
|
|
2476
2548
|
case 32:
|
|
2477
2549
|
if (!i.isBefore(dayjs(endDate))) {
|
|
2478
|
-
|
|
2550
|
+
_context26.next = 39;
|
|
2479
2551
|
break;
|
|
2480
2552
|
}
|
|
2481
|
-
return
|
|
2553
|
+
return _context26.delegateYield(_loop2(), "t0", 34);
|
|
2482
2554
|
case 34:
|
|
2483
|
-
if (!
|
|
2484
|
-
|
|
2555
|
+
if (!_context26.t0) {
|
|
2556
|
+
_context26.next = 36;
|
|
2485
2557
|
break;
|
|
2486
2558
|
}
|
|
2487
|
-
return
|
|
2559
|
+
return _context26.abrupt("continue", 36);
|
|
2488
2560
|
case 36:
|
|
2489
2561
|
i = i.add(1, 'day');
|
|
2490
|
-
|
|
2562
|
+
_context26.next = 32;
|
|
2491
2563
|
break;
|
|
2492
2564
|
case 39:
|
|
2493
|
-
return
|
|
2565
|
+
return _context26.abrupt("return", arr);
|
|
2494
2566
|
case 40:
|
|
2495
2567
|
case "end":
|
|
2496
|
-
return
|
|
2568
|
+
return _context26.stop();
|
|
2497
2569
|
}
|
|
2498
|
-
},
|
|
2570
|
+
}, _callee25, this);
|
|
2499
2571
|
}));
|
|
2500
|
-
function getTimeSlotByAllResourcesForDate(
|
|
2572
|
+
function getTimeSlotByAllResourcesForDate(_x20) {
|
|
2501
2573
|
return _getTimeSlotByAllResourcesForDate.apply(this, arguments);
|
|
2502
2574
|
}
|
|
2503
2575
|
return getTimeSlotByAllResourcesForDate;
|
|
@@ -2678,42 +2750,42 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2678
2750
|
}, {
|
|
2679
2751
|
key: "openProductDetail",
|
|
2680
2752
|
value: function () {
|
|
2681
|
-
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2753
|
+
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(productId) {
|
|
2682
2754
|
var targetProductData, newScheduleArr, dateRange;
|
|
2683
|
-
return _regeneratorRuntime().wrap(function
|
|
2684
|
-
while (1) switch (
|
|
2755
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context27) {
|
|
2756
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2685
2757
|
case 0:
|
|
2686
|
-
|
|
2758
|
+
_context27.next = 2;
|
|
2687
2759
|
return this.store.products.getProduct(productId);
|
|
2688
2760
|
case 2:
|
|
2689
|
-
targetProductData =
|
|
2761
|
+
targetProductData = _context27.sent;
|
|
2690
2762
|
if (!targetProductData) {
|
|
2691
|
-
|
|
2763
|
+
_context27.next = 17;
|
|
2692
2764
|
break;
|
|
2693
2765
|
}
|
|
2694
2766
|
this.store.currentProduct = targetProductData;
|
|
2695
2767
|
this.store.currentProductMeta = {};
|
|
2696
2768
|
// 资源预加载,如果是 duration 类型的商品,且是先选日期的流程,在这里预拉取资源数据
|
|
2697
2769
|
if (!targetProductData['schedule.ids']) {
|
|
2698
|
-
|
|
2770
|
+
_context27.next = 12;
|
|
2699
2771
|
break;
|
|
2700
2772
|
}
|
|
2701
2773
|
newScheduleArr = this.getScheduleDataByIds(targetProductData['schedule.ids']);
|
|
2702
2774
|
if (!this.store.currentProductMeta) this.store.currentProductMeta = {};
|
|
2703
2775
|
this.store.currentProductMeta.schedule = newScheduleArr;
|
|
2704
|
-
|
|
2776
|
+
_context27.next = 17;
|
|
2705
2777
|
break;
|
|
2706
2778
|
case 12:
|
|
2707
2779
|
if (!targetProductData.duration) {
|
|
2708
|
-
|
|
2780
|
+
_context27.next = 17;
|
|
2709
2781
|
break;
|
|
2710
2782
|
}
|
|
2711
2783
|
dateRange = this.store.date.getDateRange(); // 如果不是先选日期的流程 duration 商品就啥也不做
|
|
2712
2784
|
if (dateRange !== null && dateRange !== void 0 && dateRange.length) {
|
|
2713
|
-
|
|
2785
|
+
_context27.next = 16;
|
|
2714
2786
|
break;
|
|
2715
2787
|
}
|
|
2716
|
-
return
|
|
2788
|
+
return _context27.abrupt("return");
|
|
2717
2789
|
case 16:
|
|
2718
2790
|
// this.store.date.getResourceDates({
|
|
2719
2791
|
// query: {
|
|
@@ -2729,11 +2801,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2729
2801
|
});
|
|
2730
2802
|
case 17:
|
|
2731
2803
|
case "end":
|
|
2732
|
-
return
|
|
2804
|
+
return _context27.stop();
|
|
2733
2805
|
}
|
|
2734
|
-
},
|
|
2806
|
+
}, _callee26, this);
|
|
2735
2807
|
}));
|
|
2736
|
-
function openProductDetail(
|
|
2808
|
+
function openProductDetail(_x21) {
|
|
2737
2809
|
return _openProductDetail.apply(this, arguments);
|
|
2738
2810
|
}
|
|
2739
2811
|
return openProductDetail;
|
|
@@ -3984,41 +4056,41 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3984
4056
|
}, {
|
|
3985
4057
|
key: "getProductTypeById",
|
|
3986
4058
|
value: function () {
|
|
3987
|
-
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4059
|
+
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(id) {
|
|
3988
4060
|
var productData, _productData$schedule;
|
|
3989
|
-
return _regeneratorRuntime().wrap(function
|
|
3990
|
-
while (1) switch (
|
|
4061
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
4062
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3991
4063
|
case 0:
|
|
3992
|
-
|
|
4064
|
+
_context28.next = 2;
|
|
3993
4065
|
return this.store.products.getProduct(id);
|
|
3994
4066
|
case 2:
|
|
3995
|
-
productData =
|
|
4067
|
+
productData = _context28.sent;
|
|
3996
4068
|
if (!productData) {
|
|
3997
|
-
|
|
4069
|
+
_context28.next = 9;
|
|
3998
4070
|
break;
|
|
3999
4071
|
}
|
|
4000
4072
|
if (!productData.duration) {
|
|
4001
|
-
|
|
4073
|
+
_context28.next = 6;
|
|
4002
4074
|
break;
|
|
4003
4075
|
}
|
|
4004
|
-
return
|
|
4076
|
+
return _context28.abrupt("return", 'duration');
|
|
4005
4077
|
case 6:
|
|
4006
4078
|
if (!((_productData$schedule = productData['schedule.ids']) !== null && _productData$schedule !== void 0 && _productData$schedule.length)) {
|
|
4007
|
-
|
|
4079
|
+
_context28.next = 8;
|
|
4008
4080
|
break;
|
|
4009
4081
|
}
|
|
4010
|
-
return
|
|
4082
|
+
return _context28.abrupt("return", 'session');
|
|
4011
4083
|
case 8:
|
|
4012
|
-
return
|
|
4084
|
+
return _context28.abrupt("return", 'normal');
|
|
4013
4085
|
case 9:
|
|
4014
|
-
return
|
|
4086
|
+
return _context28.abrupt("return", 'normal');
|
|
4015
4087
|
case 10:
|
|
4016
4088
|
case "end":
|
|
4017
|
-
return
|
|
4089
|
+
return _context28.stop();
|
|
4018
4090
|
}
|
|
4019
|
-
},
|
|
4091
|
+
}, _callee27, this);
|
|
4020
4092
|
}));
|
|
4021
|
-
function getProductTypeById(
|
|
4093
|
+
function getProductTypeById(_x22) {
|
|
4022
4094
|
return _getProductTypeById.apply(this, arguments);
|
|
4023
4095
|
}
|
|
4024
4096
|
return getProductTypeById;
|
|
@@ -4138,10 +4210,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4138
4210
|
}, {
|
|
4139
4211
|
key: "getTimeslotsScheduleByDateRange",
|
|
4140
4212
|
value: (function () {
|
|
4141
|
-
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4213
|
+
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(_ref16) {
|
|
4142
4214
|
var startDate, endDate, scheduleIds, resources, dates, currentDate, end, results, _i5, _dates, date;
|
|
4143
|
-
return _regeneratorRuntime().wrap(function
|
|
4144
|
-
while (1) switch (
|
|
4215
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context29) {
|
|
4216
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
4145
4217
|
case 0:
|
|
4146
4218
|
startDate = _ref16.startDate, endDate = _ref16.endDate, scheduleIds = _ref16.scheduleIds, resources = _ref16.resources;
|
|
4147
4219
|
console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
|
|
@@ -4168,14 +4240,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4168
4240
|
resources: resources
|
|
4169
4241
|
});
|
|
4170
4242
|
}
|
|
4171
|
-
return
|
|
4243
|
+
return _context29.abrupt("return", results);
|
|
4172
4244
|
case 9:
|
|
4173
4245
|
case "end":
|
|
4174
|
-
return
|
|
4246
|
+
return _context29.stop();
|
|
4175
4247
|
}
|
|
4176
|
-
},
|
|
4248
|
+
}, _callee28, this);
|
|
4177
4249
|
}));
|
|
4178
|
-
function getTimeslotsScheduleByDateRange(
|
|
4250
|
+
function getTimeslotsScheduleByDateRange(_x23) {
|
|
4179
4251
|
return _getTimeslotsScheduleByDateRange.apply(this, arguments);
|
|
4180
4252
|
}
|
|
4181
4253
|
return getTimeslotsScheduleByDateRange;
|
|
@@ -4183,7 +4255,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4183
4255
|
}, {
|
|
4184
4256
|
key: "getAvailableDateForSessionOptimize",
|
|
4185
4257
|
value: function () {
|
|
4186
|
-
var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4258
|
+
var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
4187
4259
|
var _this$store$currentPr3, _this$store$currentPr4, _tempProducts;
|
|
4188
4260
|
var params,
|
|
4189
4261
|
startDate,
|
|
@@ -4203,11 +4275,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4203
4275
|
allProductResources,
|
|
4204
4276
|
targetSchedules,
|
|
4205
4277
|
_loop8,
|
|
4206
|
-
|
|
4207
|
-
return _regeneratorRuntime().wrap(function
|
|
4208
|
-
while (1) switch (
|
|
4278
|
+
_args31 = arguments;
|
|
4279
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context31) {
|
|
4280
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
4209
4281
|
case 0:
|
|
4210
|
-
params =
|
|
4282
|
+
params = _args31.length > 0 && _args31[0] !== undefined ? _args31[0] : {};
|
|
4211
4283
|
// 开始日期如果小于今天,直接以今天当做开始日期
|
|
4212
4284
|
startDate = params.startDate, endDate = params.endDate; // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天 且 endDate 小于或等于今天,需要把 startDate 置为今天
|
|
4213
4285
|
if (dayjs(startDate).isBefore(dayjs(), 'day') && (dayjs(endDate).isAfter(dayjs(), 'day') || dayjs(endDate).isSame(dayjs(), 'day'))) {
|
|
@@ -4232,15 +4304,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4232
4304
|
// 先去读缓存结果,因为正常 UI 调用的是 7 天,而下面我会直接计算 30 天(最少也是 14 天),所以先去读缓存结果,如果缓存结果存在,则直接返回
|
|
4233
4305
|
cache = (_this$store$currentPr3 = this.store.currentProductMeta) === null || _this$store$currentPr3 === void 0 ? void 0 : _this$store$currentPr3['timeSlotBySchedule'];
|
|
4234
4306
|
if (!cache) {
|
|
4235
|
-
|
|
4307
|
+
_context31.next = 13;
|
|
4236
4308
|
break;
|
|
4237
4309
|
}
|
|
4238
4310
|
if (!(dayjs(params.startDate).isSameOrAfter(dayjs(cache.startDate), 'day') && dayjs(params.endDate).isSameOrBefore(dayjs(cache.endDate), 'day'))) {
|
|
4239
|
-
|
|
4311
|
+
_context31.next = 13;
|
|
4240
4312
|
break;
|
|
4241
4313
|
}
|
|
4242
4314
|
this.store.date.setDateList(cache.dateList);
|
|
4243
|
-
return
|
|
4315
|
+
return _context31.abrupt("return", {
|
|
4244
4316
|
dateList: cache.dateList,
|
|
4245
4317
|
firstAvailableDate: cache.firstAvailableDate
|
|
4246
4318
|
});
|
|
@@ -4250,7 +4322,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4250
4322
|
schedule = (_this$store$currentPr4 = this.store.currentProductMeta) === null || _this$store$currentPr4 === void 0 ? void 0 : _this$store$currentPr4['schedule'];
|
|
4251
4323
|
filteredSchedule = filterScheduleByDateRange(schedule, startDate || '', endDate || ''); // 1.后端返回的数据,确定资源在每一天的可用和使用情况
|
|
4252
4324
|
tempResourceIds = getResourcesIdsByProduct(tempProducts);
|
|
4253
|
-
|
|
4325
|
+
_context31.next = 19;
|
|
4254
4326
|
return this.store.date.fetchResourceDates({
|
|
4255
4327
|
query: {
|
|
4256
4328
|
start_date: startDate || '',
|
|
@@ -4259,7 +4331,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4259
4331
|
}
|
|
4260
4332
|
});
|
|
4261
4333
|
case 19:
|
|
4262
|
-
res =
|
|
4334
|
+
res = _context31.sent;
|
|
4263
4335
|
// 2. 商品 schedule 数据,确定日程在每一天的时间片
|
|
4264
4336
|
// 3. 把后端返回的和 schedule 的数据进行合并,确定每一天的可用和使用情况
|
|
4265
4337
|
dates = [];
|
|
@@ -4281,8 +4353,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4281
4353
|
targetSchedules = this.store.schedule.getScheduleListByIds(tempProducts['schedule.ids']);
|
|
4282
4354
|
_loop8 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop8() {
|
|
4283
4355
|
var currentDateStr, status, summaryCount, availableCount, _checkSessionProductL, latestStartDate, earliestEndDate, scheduleByDate, minTimeMaxTime, scheduleTimeSlots, timesSlotCanUse, dateStatus, usageRatio;
|
|
4284
|
-
return _regeneratorRuntime().wrap(function _loop8$(
|
|
4285
|
-
while (1) switch (
|
|
4356
|
+
return _regeneratorRuntime().wrap(function _loop8$(_context30) {
|
|
4357
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
4286
4358
|
case 0:
|
|
4287
4359
|
currentDateStr = currentDate.format('YYYY-MM-DD');
|
|
4288
4360
|
status = 'available';
|
|
@@ -4441,32 +4513,32 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4441
4513
|
|
|
4442
4514
|
// 如果 firstAvailableDate 距离 startDate 大于 14 天了,则后面就不需要再找了,也是一种性能保护
|
|
4443
4515
|
if (!(firstAvailableDate && dayjs(currentDate).diff(dayjs(startDate), 'day') > 31)) {
|
|
4444
|
-
|
|
4516
|
+
_context30.next = 12;
|
|
4445
4517
|
break;
|
|
4446
4518
|
}
|
|
4447
|
-
return
|
|
4519
|
+
return _context30.abrupt("return", 1);
|
|
4448
4520
|
case 12:
|
|
4449
4521
|
currentDate = dayjs(currentDate).add(1, 'day');
|
|
4450
4522
|
case 13:
|
|
4451
4523
|
case "end":
|
|
4452
|
-
return
|
|
4524
|
+
return _context30.stop();
|
|
4453
4525
|
}
|
|
4454
4526
|
}, _loop8);
|
|
4455
4527
|
});
|
|
4456
4528
|
case 28:
|
|
4457
4529
|
if (!(dayjs(currentDate).isBefore(dayjs(endDate), 'day') || dayjs(currentDate).isSame(dayjs(endDate), 'day'))) {
|
|
4458
|
-
|
|
4530
|
+
_context31.next = 34;
|
|
4459
4531
|
break;
|
|
4460
4532
|
}
|
|
4461
|
-
return
|
|
4533
|
+
return _context31.delegateYield(_loop8(), "t0", 30);
|
|
4462
4534
|
case 30:
|
|
4463
|
-
if (!
|
|
4464
|
-
|
|
4535
|
+
if (!_context31.t0) {
|
|
4536
|
+
_context31.next = 32;
|
|
4465
4537
|
break;
|
|
4466
4538
|
}
|
|
4467
|
-
return
|
|
4539
|
+
return _context31.abrupt("break", 34);
|
|
4468
4540
|
case 32:
|
|
4469
|
-
|
|
4541
|
+
_context31.next = 28;
|
|
4470
4542
|
break;
|
|
4471
4543
|
case 34:
|
|
4472
4544
|
// 最终把资源数据也加到日期内
|
|
@@ -4481,15 +4553,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4481
4553
|
startDate: startDate,
|
|
4482
4554
|
endDate: dayjs(currentDate).format('YYYY-MM-DD')
|
|
4483
4555
|
};
|
|
4484
|
-
return
|
|
4556
|
+
return _context31.abrupt("return", {
|
|
4485
4557
|
dateList: dates,
|
|
4486
4558
|
firstAvailableDate: firstAvailableDate
|
|
4487
4559
|
});
|
|
4488
4560
|
case 39:
|
|
4489
4561
|
case "end":
|
|
4490
|
-
return
|
|
4562
|
+
return _context31.stop();
|
|
4491
4563
|
}
|
|
4492
|
-
},
|
|
4564
|
+
}, _callee29, this);
|
|
4493
4565
|
}));
|
|
4494
4566
|
function getAvailableDateForSessionOptimize() {
|
|
4495
4567
|
return _getAvailableDateForSessionOptimize.apply(this, arguments);
|
|
@@ -4536,18 +4608,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4536
4608
|
}, {
|
|
4537
4609
|
key: "getContactInfo",
|
|
4538
4610
|
value: (function () {
|
|
4539
|
-
var _getContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4540
|
-
return _regeneratorRuntime().wrap(function
|
|
4541
|
-
while (1) switch (
|
|
4611
|
+
var _getContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
4612
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context32) {
|
|
4613
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
4542
4614
|
case 0:
|
|
4543
|
-
return
|
|
4615
|
+
return _context32.abrupt("return", this.request.get('/customer/metadata', params));
|
|
4544
4616
|
case 1:
|
|
4545
4617
|
case "end":
|
|
4546
|
-
return
|
|
4618
|
+
return _context32.stop();
|
|
4547
4619
|
}
|
|
4548
|
-
},
|
|
4620
|
+
}, _callee30, this);
|
|
4549
4621
|
}));
|
|
4550
|
-
function getContactInfo(
|
|
4622
|
+
function getContactInfo(_x24) {
|
|
4551
4623
|
return _getContactInfo.apply(this, arguments);
|
|
4552
4624
|
}
|
|
4553
4625
|
return getContactInfo;
|