@pisell/pisellos 0.0.549 → 0.0.552
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Holder/index.d.ts +7 -1
- package/dist/modules/Holder/index.js +153 -14
- package/dist/modules/Holder/types.d.ts +9 -1
- package/dist/modules/Holder/utils.d.ts +7 -3
- package/dist/modules/Holder/utils.js +16 -2
- package/dist/modules/Order/index.d.ts +2 -1
- 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/plugins/window.d.ts +1 -0
- package/dist/solution/BookingByStep/index.d.ts +7 -1
- package/dist/solution/BookingByStep/index.js +246 -204
- package/dist/solution/ScanOrder/types.d.ts +1 -0
- package/dist/solution/VenueBooking/index.d.ts +20 -0
- package/dist/solution/VenueBooking/index.js +973 -730
- package/dist/solution/VenueBooking/types.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +7 -1
- package/lib/modules/Holder/index.js +75 -3
- package/lib/modules/Holder/types.d.ts +9 -1
- package/lib/modules/Holder/utils.d.ts +7 -3
- package/lib/modules/Holder/utils.js +18 -4
- package/lib/modules/Order/index.d.ts +2 -1
- 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/plugins/window.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +7 -1
- package/lib/solution/BookingByStep/index.js +17 -1
- package/lib/solution/ScanOrder/types.d.ts +1 -0
- package/lib/solution/VenueBooking/index.d.ts +20 -0
- package/lib/solution/VenueBooking/index.js +139 -10
- package/lib/solution/VenueBooking/types.d.ts +2 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -655,9 +655,35 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
655
655
|
return this.store.holder.getHolderFormMap();
|
|
656
656
|
}
|
|
657
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
|
+
}()
|
|
658
683
|
/**
|
|
659
684
|
* 添加表单记录
|
|
660
685
|
*/
|
|
686
|
+
)
|
|
661
687
|
}, {
|
|
662
688
|
key: "appendFormRecord",
|
|
663
689
|
value: function appendFormRecord(params) {
|
|
@@ -668,9 +694,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
668
694
|
}, {
|
|
669
695
|
key: "setDateRange",
|
|
670
696
|
value: function () {
|
|
671
|
-
var _setDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
672
|
-
return _regeneratorRuntime().wrap(function
|
|
673
|
-
while (1) switch (
|
|
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) {
|
|
674
700
|
case 0:
|
|
675
701
|
this.store.date.setDateRange(dateRange);
|
|
676
702
|
// 日期数据变更后,如果购物车里有数据,需要更新购物车里的报价单的价格
|
|
@@ -679,11 +705,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
679
705
|
}
|
|
680
706
|
case 2:
|
|
681
707
|
case "end":
|
|
682
|
-
return
|
|
708
|
+
return _context11.stop();
|
|
683
709
|
}
|
|
684
|
-
},
|
|
710
|
+
}, _callee11, this);
|
|
685
711
|
}));
|
|
686
|
-
function setDateRange(
|
|
712
|
+
function setDateRange(_x13) {
|
|
687
713
|
return _setDateRange.apply(this, arguments);
|
|
688
714
|
}
|
|
689
715
|
return setDateRange;
|
|
@@ -698,16 +724,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
698
724
|
}, {
|
|
699
725
|
key: "getDateRange",
|
|
700
726
|
value: function () {
|
|
701
|
-
var _getDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
702
|
-
return _regeneratorRuntime().wrap(function
|
|
703
|
-
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) {
|
|
704
730
|
case 0:
|
|
705
|
-
return
|
|
731
|
+
return _context12.abrupt("return", this.store.date.getDateRange());
|
|
706
732
|
case 1:
|
|
707
733
|
case "end":
|
|
708
|
-
return
|
|
734
|
+
return _context12.stop();
|
|
709
735
|
}
|
|
710
|
-
},
|
|
736
|
+
}, _callee12, this);
|
|
711
737
|
}));
|
|
712
738
|
function getDateRange() {
|
|
713
739
|
return _getDateRange.apply(this, arguments);
|
|
@@ -724,7 +750,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
724
750
|
}, {
|
|
725
751
|
key: "getAvailableDate",
|
|
726
752
|
value: function () {
|
|
727
|
-
var _getAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
753
|
+
var _getAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
728
754
|
var _this4 = this,
|
|
729
755
|
_dateRange$,
|
|
730
756
|
_dateRange$2,
|
|
@@ -746,11 +772,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
746
772
|
rules,
|
|
747
773
|
resourcesMap,
|
|
748
774
|
res,
|
|
749
|
-
|
|
750
|
-
return _regeneratorRuntime().wrap(function
|
|
751
|
-
while (1) switch (
|
|
775
|
+
_args13 = arguments;
|
|
776
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
777
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
752
778
|
case 0:
|
|
753
|
-
params =
|
|
779
|
+
params = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
|
|
754
780
|
// 开始日期如果小于今天,直接以今天当做开始日期
|
|
755
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 置为今天
|
|
756
782
|
if (dayjs(startDate).isBefore(dayjs(), 'day') && (dayjs(endDate).isAfter(dayjs(), 'day') || dayjs(endDate).isSame(dayjs(), 'day'))) {
|
|
@@ -777,15 +803,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
777
803
|
tempStartDate = startDate || (dateRange === null || dateRange === void 0 || (_dateRange$ = dateRange[0]) === null || _dateRange$ === void 0 ? void 0 : _dateRange$.date);
|
|
778
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);
|
|
779
805
|
if (tempProducts.length) {
|
|
780
|
-
|
|
806
|
+
_context13.next = 11;
|
|
781
807
|
break;
|
|
782
808
|
}
|
|
783
|
-
return
|
|
809
|
+
return _context13.abrupt("return", []);
|
|
784
810
|
case 11:
|
|
785
811
|
// 在这里需要把能收集到的数据都收集上来,拼装好给 date 模块去查询
|
|
786
812
|
_ref4 = getAvailableProductResources(tempProducts) || {}, resourceIds = _ref4.resourceIds, rules = _ref4.rules, resourcesMap = _ref4.resourcesMap;
|
|
787
813
|
this.otherParams.currentResourcesMap = resourcesMap;
|
|
788
|
-
|
|
814
|
+
_context13.next = 15;
|
|
789
815
|
return this.store.date.getResourceDates({
|
|
790
816
|
url: params.url,
|
|
791
817
|
query: {
|
|
@@ -798,13 +824,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
798
824
|
useCache: useCache
|
|
799
825
|
});
|
|
800
826
|
case 15:
|
|
801
|
-
res =
|
|
802
|
-
return
|
|
827
|
+
res = _context13.sent;
|
|
828
|
+
return _context13.abrupt("return", res);
|
|
803
829
|
case 17:
|
|
804
830
|
case "end":
|
|
805
|
-
return
|
|
831
|
+
return _context13.stop();
|
|
806
832
|
}
|
|
807
|
-
},
|
|
833
|
+
}, _callee13, this);
|
|
808
834
|
}));
|
|
809
835
|
function getAvailableDate() {
|
|
810
836
|
return _getAvailableDate.apply(this, arguments);
|
|
@@ -817,22 +843,22 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
817
843
|
}, {
|
|
818
844
|
key: "getSummary",
|
|
819
845
|
value: (function () {
|
|
820
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
846
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
821
847
|
var cartItems, summary;
|
|
822
|
-
return _regeneratorRuntime().wrap(function
|
|
823
|
-
while (1) switch (
|
|
848
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
849
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
824
850
|
case 0:
|
|
825
851
|
cartItems = this.store.cart.getItems();
|
|
826
|
-
|
|
852
|
+
_context14.next = 3;
|
|
827
853
|
return this.store.summary.getSummary(cartItems);
|
|
828
854
|
case 3:
|
|
829
|
-
summary =
|
|
830
|
-
return
|
|
855
|
+
summary = _context14.sent;
|
|
856
|
+
return _context14.abrupt("return", summary);
|
|
831
857
|
case 5:
|
|
832
858
|
case "end":
|
|
833
|
-
return
|
|
859
|
+
return _context14.stop();
|
|
834
860
|
}
|
|
835
|
-
},
|
|
861
|
+
}, _callee14, this);
|
|
836
862
|
}));
|
|
837
863
|
function getSummary() {
|
|
838
864
|
return _getSummary.apply(this, arguments);
|
|
@@ -846,18 +872,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
846
872
|
}, {
|
|
847
873
|
key: "getProtocol",
|
|
848
874
|
value: (function () {
|
|
849
|
-
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
850
|
-
return _regeneratorRuntime().wrap(function
|
|
851
|
-
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) {
|
|
852
878
|
case 0:
|
|
853
|
-
return
|
|
879
|
+
return _context15.abrupt("return", this.store.summary.getProtocol(protocolId));
|
|
854
880
|
case 1:
|
|
855
881
|
case "end":
|
|
856
|
-
return
|
|
882
|
+
return _context15.stop();
|
|
857
883
|
}
|
|
858
|
-
},
|
|
884
|
+
}, _callee15, this);
|
|
859
885
|
}));
|
|
860
|
-
function getProtocol(
|
|
886
|
+
function getProtocol(_x14) {
|
|
861
887
|
return _getProtocol.apply(this, arguments);
|
|
862
888
|
}
|
|
863
889
|
return getProtocol;
|
|
@@ -866,16 +892,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
866
892
|
}, {
|
|
867
893
|
key: "getProducts",
|
|
868
894
|
value: function () {
|
|
869
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
870
|
-
return _regeneratorRuntime().wrap(function
|
|
871
|
-
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) {
|
|
872
898
|
case 0:
|
|
873
|
-
return
|
|
899
|
+
return _context16.abrupt("return", this.store.products.getProducts());
|
|
874
900
|
case 1:
|
|
875
901
|
case "end":
|
|
876
|
-
return
|
|
902
|
+
return _context16.stop();
|
|
877
903
|
}
|
|
878
|
-
},
|
|
904
|
+
}, _callee16, this);
|
|
879
905
|
}));
|
|
880
906
|
function getProducts() {
|
|
881
907
|
return _getProducts.apply(this, arguments);
|
|
@@ -885,15 +911,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
885
911
|
}, {
|
|
886
912
|
key: "setLoginAccount",
|
|
887
913
|
value: function () {
|
|
888
|
-
var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
914
|
+
var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(accountId, accountInfo) {
|
|
889
915
|
var _this5 = this;
|
|
890
|
-
var account, stateAccountId, cartItems, _this$store$date$getD2, date, normalProductCartItem;
|
|
891
|
-
return _regeneratorRuntime().wrap(function
|
|
892
|
-
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) {
|
|
893
919
|
case 0:
|
|
894
920
|
account = this.store.accountList.getAccount(accountId);
|
|
895
921
|
if (!account) {
|
|
896
|
-
|
|
922
|
+
_context17.next = 23;
|
|
897
923
|
break;
|
|
898
924
|
}
|
|
899
925
|
stateAccountId = account.getId();
|
|
@@ -910,29 +936,47 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
910
936
|
}
|
|
911
937
|
});
|
|
912
938
|
this.store.accountList.updateAccountListById(stateAccountId, accountInfo);
|
|
913
|
-
if (cartItems.length) {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
// 如果没有日期,则应该是 session 类先选商品的流程,直接从购物车里拿 start_date
|
|
917
|
-
// 不能从购物车里第一个找时间,而是找到购物车里第一个有 start_date 的时间
|
|
918
|
-
normalProductCartItem = cartItems.find(function (n) {
|
|
919
|
-
return !isNormalProduct(n._productOrigin);
|
|
920
|
-
});
|
|
921
|
-
date = (normalProductCartItem === null || normalProductCartItem === void 0 ? void 0 : normalProductCartItem.start_date) || '';
|
|
922
|
-
}
|
|
923
|
-
this.updateQuotationPriceAndCart(date);
|
|
939
|
+
if (!cartItems.length) {
|
|
940
|
+
_context17.next = 21;
|
|
941
|
+
break;
|
|
924
942
|
}
|
|
925
|
-
|
|
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) || '';
|
|
951
|
+
}
|
|
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;
|
|
926
963
|
break;
|
|
927
|
-
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:
|
|
928
972
|
throw new Error("\u6CA1\u6709\u627E\u5230".concat(accountId, "\u8D26\u6237"));
|
|
929
|
-
case
|
|
973
|
+
case 24:
|
|
930
974
|
case "end":
|
|
931
|
-
return
|
|
975
|
+
return _context17.stop();
|
|
932
976
|
}
|
|
933
|
-
},
|
|
977
|
+
}, _callee17, this, [[12, 18]]);
|
|
934
978
|
}));
|
|
935
|
-
function setLoginAccount(
|
|
979
|
+
function setLoginAccount(_x15, _x16) {
|
|
936
980
|
return _setLoginAccount.apply(this, arguments);
|
|
937
981
|
}
|
|
938
982
|
return setLoginAccount;
|
|
@@ -940,14 +984,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
940
984
|
}, {
|
|
941
985
|
key: "generateCartData",
|
|
942
986
|
value: function () {
|
|
943
|
-
var _generateCartData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
944
|
-
return _regeneratorRuntime().wrap(function
|
|
945
|
-
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) {
|
|
946
990
|
case 0:
|
|
947
991
|
case "end":
|
|
948
|
-
return
|
|
992
|
+
return _context18.stop();
|
|
949
993
|
}
|
|
950
|
-
},
|
|
994
|
+
}, _callee18);
|
|
951
995
|
}));
|
|
952
996
|
function generateCartData() {
|
|
953
997
|
return _generateCartData.apply(this, arguments);
|
|
@@ -957,23 +1001,23 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
957
1001
|
}, {
|
|
958
1002
|
key: "getFreeProduct",
|
|
959
1003
|
value: function () {
|
|
960
|
-
var _getFreeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1004
|
+
var _getFreeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(id) {
|
|
961
1005
|
var res;
|
|
962
|
-
return _regeneratorRuntime().wrap(function
|
|
963
|
-
while (1) switch (
|
|
1006
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1007
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
964
1008
|
case 0:
|
|
965
|
-
|
|
1009
|
+
_context19.next = 2;
|
|
966
1010
|
return this.request.post("/pay/order/free-pay/".concat(id));
|
|
967
1011
|
case 2:
|
|
968
|
-
res =
|
|
969
|
-
return
|
|
1012
|
+
res = _context19.sent;
|
|
1013
|
+
return _context19.abrupt("return", res);
|
|
970
1014
|
case 4:
|
|
971
1015
|
case "end":
|
|
972
|
-
return
|
|
1016
|
+
return _context19.stop();
|
|
973
1017
|
}
|
|
974
|
-
},
|
|
1018
|
+
}, _callee19, this);
|
|
975
1019
|
}));
|
|
976
|
-
function getFreeProduct(
|
|
1020
|
+
function getFreeProduct(_x17) {
|
|
977
1021
|
return _getFreeProduct.apply(this, arguments);
|
|
978
1022
|
}
|
|
979
1023
|
return getFreeProduct;
|
|
@@ -996,11 +1040,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
996
1040
|
}, {
|
|
997
1041
|
key: "submitOrder",
|
|
998
1042
|
value: function () {
|
|
999
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1043
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(extraData) {
|
|
1000
1044
|
var _this$otherParams4;
|
|
1001
1045
|
var cartItems, newCartItems, type;
|
|
1002
|
-
return _regeneratorRuntime().wrap(function
|
|
1003
|
-
while (1) switch (
|
|
1046
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1047
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1004
1048
|
case 0:
|
|
1005
1049
|
cartItems = this.store.cart.getItems();
|
|
1006
1050
|
newCartItems = cloneDeep(cartItems); // 先整个临时的逻辑,把购物车里所有商品的资源给他格式化一下
|
|
@@ -1030,7 +1074,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1030
1074
|
}))) {
|
|
1031
1075
|
type = 'virtual';
|
|
1032
1076
|
}
|
|
1033
|
-
return
|
|
1077
|
+
return _context20.abrupt("return", this.store.order.submitOrder({
|
|
1034
1078
|
query: {
|
|
1035
1079
|
cartItems: newCartItems,
|
|
1036
1080
|
type: type,
|
|
@@ -1041,11 +1085,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1041
1085
|
}));
|
|
1042
1086
|
case 6:
|
|
1043
1087
|
case "end":
|
|
1044
|
-
return
|
|
1088
|
+
return _context20.stop();
|
|
1045
1089
|
}
|
|
1046
|
-
},
|
|
1090
|
+
}, _callee20, this);
|
|
1047
1091
|
}));
|
|
1048
|
-
function submitOrder(
|
|
1092
|
+
function submitOrder(_x18) {
|
|
1049
1093
|
return _submitOrder.apply(this, arguments);
|
|
1050
1094
|
}
|
|
1051
1095
|
return submitOrder;
|
|
@@ -1053,14 +1097,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1053
1097
|
}, {
|
|
1054
1098
|
key: "pay",
|
|
1055
1099
|
value: function () {
|
|
1056
|
-
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1057
|
-
return _regeneratorRuntime().wrap(function
|
|
1058
|
-
while (1) switch (
|
|
1100
|
+
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1101
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1102
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1059
1103
|
case 0:
|
|
1060
1104
|
case "end":
|
|
1061
|
-
return
|
|
1105
|
+
return _context21.stop();
|
|
1062
1106
|
}
|
|
1063
|
-
},
|
|
1107
|
+
}, _callee21);
|
|
1064
1108
|
}));
|
|
1065
1109
|
function pay() {
|
|
1066
1110
|
return _pay.apply(this, arguments);
|
|
@@ -1070,14 +1114,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1070
1114
|
}, {
|
|
1071
1115
|
key: "getPayInfo",
|
|
1072
1116
|
value: function () {
|
|
1073
|
-
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1074
|
-
return _regeneratorRuntime().wrap(function
|
|
1075
|
-
while (1) switch (
|
|
1117
|
+
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1118
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1119
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1076
1120
|
case 0:
|
|
1077
1121
|
case "end":
|
|
1078
|
-
return
|
|
1122
|
+
return _context22.stop();
|
|
1079
1123
|
}
|
|
1080
|
-
},
|
|
1124
|
+
}, _callee22);
|
|
1081
1125
|
}));
|
|
1082
1126
|
function getPayInfo() {
|
|
1083
1127
|
return _getPayInfo.apply(this, arguments);
|
|
@@ -1087,15 +1131,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1087
1131
|
}, {
|
|
1088
1132
|
key: "setOtherParams",
|
|
1089
1133
|
value: function () {
|
|
1090
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1134
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
1091
1135
|
var _ref5,
|
|
1092
1136
|
_ref5$cover,
|
|
1093
1137
|
cover,
|
|
1094
|
-
|
|
1095
|
-
return _regeneratorRuntime().wrap(function
|
|
1096
|
-
while (1) switch (
|
|
1138
|
+
_args23 = arguments;
|
|
1139
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1140
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1097
1141
|
case 0:
|
|
1098
|
-
_ref5 =
|
|
1142
|
+
_ref5 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
|
|
1099
1143
|
if (cover) {
|
|
1100
1144
|
this.otherParams = params;
|
|
1101
1145
|
} else {
|
|
@@ -1103,11 +1147,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1103
1147
|
}
|
|
1104
1148
|
case 2:
|
|
1105
1149
|
case "end":
|
|
1106
|
-
return
|
|
1150
|
+
return _context23.stop();
|
|
1107
1151
|
}
|
|
1108
|
-
},
|
|
1152
|
+
}, _callee23, this);
|
|
1109
1153
|
}));
|
|
1110
|
-
function setOtherParams(
|
|
1154
|
+
function setOtherParams(_x19) {
|
|
1111
1155
|
return _setOtherParams.apply(this, arguments);
|
|
1112
1156
|
}
|
|
1113
1157
|
return setOtherParams;
|
|
@@ -1115,16 +1159,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1115
1159
|
}, {
|
|
1116
1160
|
key: "getOtherParams",
|
|
1117
1161
|
value: function () {
|
|
1118
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1119
|
-
return _regeneratorRuntime().wrap(function
|
|
1120
|
-
while (1) switch (
|
|
1162
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1163
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1164
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1121
1165
|
case 0:
|
|
1122
|
-
return
|
|
1166
|
+
return _context24.abrupt("return", this.otherParams);
|
|
1123
1167
|
case 1:
|
|
1124
1168
|
case "end":
|
|
1125
|
-
return
|
|
1169
|
+
return _context24.stop();
|
|
1126
1170
|
}
|
|
1127
|
-
},
|
|
1171
|
+
}, _callee24, this);
|
|
1128
1172
|
}));
|
|
1129
1173
|
function getOtherParams() {
|
|
1130
1174
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -1213,10 +1257,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1213
1257
|
}
|
|
1214
1258
|
}
|
|
1215
1259
|
try {
|
|
1216
|
-
var _account;
|
|
1217
1260
|
this.store.holder.ensureFormByProduct({
|
|
1218
1261
|
product: productData,
|
|
1219
|
-
customer_id: (_account = account) !== null && _account !== void 0 && _account.id ? Number(account.id) : 16121,
|
|
1220
1262
|
shop_id: (productData === null || productData === void 0 ? void 0 : productData.shop_id) || '',
|
|
1221
1263
|
useCache: true
|
|
1222
1264
|
});
|
|
@@ -2301,14 +2343,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2301
2343
|
}, {
|
|
2302
2344
|
key: "getTimeSlotByAllResourcesForDate",
|
|
2303
2345
|
value: function () {
|
|
2304
|
-
var _getTimeSlotByAllResourcesForDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2346
|
+
var _getTimeSlotByAllResourcesForDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(_ref10) {
|
|
2305
2347
|
var _this13 = this,
|
|
2306
2348
|
_cartItems$5,
|
|
2307
2349
|
_cartItems$6,
|
|
2308
2350
|
_this$shopStore$get2;
|
|
2309
2351
|
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;
|
|
2310
|
-
return _regeneratorRuntime().wrap(function
|
|
2311
|
-
while (1) switch (
|
|
2352
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context26) {
|
|
2353
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2312
2354
|
case 0:
|
|
2313
2355
|
resources_code = _ref10.resources_code, startDate = _ref10.startDate, endDate = _ref10.endDate;
|
|
2314
2356
|
// 如果 end_date 距离start_date小于 30 天,自动追加 end_date 为今天往后的 30 天
|
|
@@ -2316,7 +2358,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2316
2358
|
endDate = dayjs(startDate).add(30, 'day').format('YYYY-MM-DD');
|
|
2317
2359
|
}
|
|
2318
2360
|
// 预请求资源数据,防止日期超过之前选择的范围
|
|
2319
|
-
|
|
2361
|
+
_context26.next = 4;
|
|
2320
2362
|
return this.getAvailableDate({
|
|
2321
2363
|
startDate: startDate,
|
|
2322
2364
|
endDate: endDate,
|
|
@@ -2362,10 +2404,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2362
2404
|
|
|
2363
2405
|
// 保护: 如果 resources 为空则直接 return
|
|
2364
2406
|
if (resources.length) {
|
|
2365
|
-
|
|
2407
|
+
_context26.next = 14;
|
|
2366
2408
|
break;
|
|
2367
2409
|
}
|
|
2368
|
-
return
|
|
2410
|
+
return _context26.abrupt("return", []);
|
|
2369
2411
|
case 14:
|
|
2370
2412
|
duration = 0; // duration = 不同账号的最长时间
|
|
2371
2413
|
accountList = this.store.accountList.getAccounts();
|
|
@@ -2399,10 +2441,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2399
2441
|
// 如果 cartItem 上既没有时间,也没有资源,认为外部属于异常调用,直接丢一个空数组出去
|
|
2400
2442
|
// 同时 session 类商品的流程也不应该调用这个方法
|
|
2401
2443
|
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))) {
|
|
2402
|
-
|
|
2444
|
+
_context26.next = 20;
|
|
2403
2445
|
break;
|
|
2404
2446
|
}
|
|
2405
|
-
return
|
|
2447
|
+
return _context26.abrupt("return", []);
|
|
2406
2448
|
case 20:
|
|
2407
2449
|
resourcesUseableMap = {};
|
|
2408
2450
|
hasFlexibleDuration = cartItems.some(function (item) {
|
|
@@ -2456,8 +2498,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2456
2498
|
today = dayjs().startOf('day'); // 计算 start_date 到 end_date 之间的所有日期,遍历他们并且计算每一天的可用
|
|
2457
2499
|
_loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() {
|
|
2458
2500
|
var currentDate, theDateResources, resourcesMap, timeSlots;
|
|
2459
|
-
return _regeneratorRuntime().wrap(function _loop2$(
|
|
2460
|
-
while (1) switch (
|
|
2501
|
+
return _regeneratorRuntime().wrap(function _loop2$(_context25) {
|
|
2502
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2461
2503
|
case 0:
|
|
2462
2504
|
currentDate = i.format('YYYY-MM-DD');
|
|
2463
2505
|
theDateResources = _this13.store.date.getResourcesListByDate(currentDate);
|
|
@@ -2469,7 +2511,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2469
2511
|
});
|
|
2470
2512
|
resourcesMap = getResourcesMap(resources); // 如果日期已经过期则直接标记为不可用
|
|
2471
2513
|
if (!i.isBefore(today)) {
|
|
2472
|
-
|
|
2514
|
+
_context25.next = 7;
|
|
2473
2515
|
break;
|
|
2474
2516
|
}
|
|
2475
2517
|
arr.push({
|
|
@@ -2478,7 +2520,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2478
2520
|
week: i.format('ddd'),
|
|
2479
2521
|
weekNum: i.day()
|
|
2480
2522
|
});
|
|
2481
|
-
return
|
|
2523
|
+
return _context25.abrupt("return", 1);
|
|
2482
2524
|
case 7:
|
|
2483
2525
|
timeSlots = getTimeSlicesByResources({
|
|
2484
2526
|
resourceIds: resourceIds,
|
|
@@ -2510,36 +2552,36 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2510
2552
|
}
|
|
2511
2553
|
case 9:
|
|
2512
2554
|
case "end":
|
|
2513
|
-
return
|
|
2555
|
+
return _context25.stop();
|
|
2514
2556
|
}
|
|
2515
2557
|
}, _loop2);
|
|
2516
2558
|
});
|
|
2517
2559
|
i = dayjs(startDate);
|
|
2518
2560
|
case 32:
|
|
2519
2561
|
if (!i.isBefore(dayjs(endDate))) {
|
|
2520
|
-
|
|
2562
|
+
_context26.next = 39;
|
|
2521
2563
|
break;
|
|
2522
2564
|
}
|
|
2523
|
-
return
|
|
2565
|
+
return _context26.delegateYield(_loop2(), "t0", 34);
|
|
2524
2566
|
case 34:
|
|
2525
|
-
if (!
|
|
2526
|
-
|
|
2567
|
+
if (!_context26.t0) {
|
|
2568
|
+
_context26.next = 36;
|
|
2527
2569
|
break;
|
|
2528
2570
|
}
|
|
2529
|
-
return
|
|
2571
|
+
return _context26.abrupt("continue", 36);
|
|
2530
2572
|
case 36:
|
|
2531
2573
|
i = i.add(1, 'day');
|
|
2532
|
-
|
|
2574
|
+
_context26.next = 32;
|
|
2533
2575
|
break;
|
|
2534
2576
|
case 39:
|
|
2535
|
-
return
|
|
2577
|
+
return _context26.abrupt("return", arr);
|
|
2536
2578
|
case 40:
|
|
2537
2579
|
case "end":
|
|
2538
|
-
return
|
|
2580
|
+
return _context26.stop();
|
|
2539
2581
|
}
|
|
2540
|
-
},
|
|
2582
|
+
}, _callee25, this);
|
|
2541
2583
|
}));
|
|
2542
|
-
function getTimeSlotByAllResourcesForDate(
|
|
2584
|
+
function getTimeSlotByAllResourcesForDate(_x20) {
|
|
2543
2585
|
return _getTimeSlotByAllResourcesForDate.apply(this, arguments);
|
|
2544
2586
|
}
|
|
2545
2587
|
return getTimeSlotByAllResourcesForDate;
|
|
@@ -2720,42 +2762,42 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2720
2762
|
}, {
|
|
2721
2763
|
key: "openProductDetail",
|
|
2722
2764
|
value: function () {
|
|
2723
|
-
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2765
|
+
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(productId) {
|
|
2724
2766
|
var targetProductData, newScheduleArr, dateRange;
|
|
2725
|
-
return _regeneratorRuntime().wrap(function
|
|
2726
|
-
while (1) switch (
|
|
2767
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context27) {
|
|
2768
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2727
2769
|
case 0:
|
|
2728
|
-
|
|
2770
|
+
_context27.next = 2;
|
|
2729
2771
|
return this.store.products.getProduct(productId);
|
|
2730
2772
|
case 2:
|
|
2731
|
-
targetProductData =
|
|
2773
|
+
targetProductData = _context27.sent;
|
|
2732
2774
|
if (!targetProductData) {
|
|
2733
|
-
|
|
2775
|
+
_context27.next = 17;
|
|
2734
2776
|
break;
|
|
2735
2777
|
}
|
|
2736
2778
|
this.store.currentProduct = targetProductData;
|
|
2737
2779
|
this.store.currentProductMeta = {};
|
|
2738
2780
|
// 资源预加载,如果是 duration 类型的商品,且是先选日期的流程,在这里预拉取资源数据
|
|
2739
2781
|
if (!targetProductData['schedule.ids']) {
|
|
2740
|
-
|
|
2782
|
+
_context27.next = 12;
|
|
2741
2783
|
break;
|
|
2742
2784
|
}
|
|
2743
2785
|
newScheduleArr = this.getScheduleDataByIds(targetProductData['schedule.ids']);
|
|
2744
2786
|
if (!this.store.currentProductMeta) this.store.currentProductMeta = {};
|
|
2745
2787
|
this.store.currentProductMeta.schedule = newScheduleArr;
|
|
2746
|
-
|
|
2788
|
+
_context27.next = 17;
|
|
2747
2789
|
break;
|
|
2748
2790
|
case 12:
|
|
2749
2791
|
if (!targetProductData.duration) {
|
|
2750
|
-
|
|
2792
|
+
_context27.next = 17;
|
|
2751
2793
|
break;
|
|
2752
2794
|
}
|
|
2753
2795
|
dateRange = this.store.date.getDateRange(); // 如果不是先选日期的流程 duration 商品就啥也不做
|
|
2754
2796
|
if (dateRange !== null && dateRange !== void 0 && dateRange.length) {
|
|
2755
|
-
|
|
2797
|
+
_context27.next = 16;
|
|
2756
2798
|
break;
|
|
2757
2799
|
}
|
|
2758
|
-
return
|
|
2800
|
+
return _context27.abrupt("return");
|
|
2759
2801
|
case 16:
|
|
2760
2802
|
// this.store.date.getResourceDates({
|
|
2761
2803
|
// query: {
|
|
@@ -2771,11 +2813,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2771
2813
|
});
|
|
2772
2814
|
case 17:
|
|
2773
2815
|
case "end":
|
|
2774
|
-
return
|
|
2816
|
+
return _context27.stop();
|
|
2775
2817
|
}
|
|
2776
|
-
},
|
|
2818
|
+
}, _callee26, this);
|
|
2777
2819
|
}));
|
|
2778
|
-
function openProductDetail(
|
|
2820
|
+
function openProductDetail(_x21) {
|
|
2779
2821
|
return _openProductDetail.apply(this, arguments);
|
|
2780
2822
|
}
|
|
2781
2823
|
return openProductDetail;
|
|
@@ -4026,41 +4068,41 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4026
4068
|
}, {
|
|
4027
4069
|
key: "getProductTypeById",
|
|
4028
4070
|
value: function () {
|
|
4029
|
-
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4071
|
+
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(id) {
|
|
4030
4072
|
var productData, _productData$schedule;
|
|
4031
|
-
return _regeneratorRuntime().wrap(function
|
|
4032
|
-
while (1) switch (
|
|
4073
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
4074
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
4033
4075
|
case 0:
|
|
4034
|
-
|
|
4076
|
+
_context28.next = 2;
|
|
4035
4077
|
return this.store.products.getProduct(id);
|
|
4036
4078
|
case 2:
|
|
4037
|
-
productData =
|
|
4079
|
+
productData = _context28.sent;
|
|
4038
4080
|
if (!productData) {
|
|
4039
|
-
|
|
4081
|
+
_context28.next = 9;
|
|
4040
4082
|
break;
|
|
4041
4083
|
}
|
|
4042
4084
|
if (!productData.duration) {
|
|
4043
|
-
|
|
4085
|
+
_context28.next = 6;
|
|
4044
4086
|
break;
|
|
4045
4087
|
}
|
|
4046
|
-
return
|
|
4088
|
+
return _context28.abrupt("return", 'duration');
|
|
4047
4089
|
case 6:
|
|
4048
4090
|
if (!((_productData$schedule = productData['schedule.ids']) !== null && _productData$schedule !== void 0 && _productData$schedule.length)) {
|
|
4049
|
-
|
|
4091
|
+
_context28.next = 8;
|
|
4050
4092
|
break;
|
|
4051
4093
|
}
|
|
4052
|
-
return
|
|
4094
|
+
return _context28.abrupt("return", 'session');
|
|
4053
4095
|
case 8:
|
|
4054
|
-
return
|
|
4096
|
+
return _context28.abrupt("return", 'normal');
|
|
4055
4097
|
case 9:
|
|
4056
|
-
return
|
|
4098
|
+
return _context28.abrupt("return", 'normal');
|
|
4057
4099
|
case 10:
|
|
4058
4100
|
case "end":
|
|
4059
|
-
return
|
|
4101
|
+
return _context28.stop();
|
|
4060
4102
|
}
|
|
4061
|
-
},
|
|
4103
|
+
}, _callee27, this);
|
|
4062
4104
|
}));
|
|
4063
|
-
function getProductTypeById(
|
|
4105
|
+
function getProductTypeById(_x22) {
|
|
4064
4106
|
return _getProductTypeById.apply(this, arguments);
|
|
4065
4107
|
}
|
|
4066
4108
|
return getProductTypeById;
|
|
@@ -4180,10 +4222,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4180
4222
|
}, {
|
|
4181
4223
|
key: "getTimeslotsScheduleByDateRange",
|
|
4182
4224
|
value: (function () {
|
|
4183
|
-
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4225
|
+
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(_ref16) {
|
|
4184
4226
|
var startDate, endDate, scheduleIds, resources, dates, currentDate, end, results, _i5, _dates, date;
|
|
4185
|
-
return _regeneratorRuntime().wrap(function
|
|
4186
|
-
while (1) switch (
|
|
4227
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context29) {
|
|
4228
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
4187
4229
|
case 0:
|
|
4188
4230
|
startDate = _ref16.startDate, endDate = _ref16.endDate, scheduleIds = _ref16.scheduleIds, resources = _ref16.resources;
|
|
4189
4231
|
console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
|
|
@@ -4210,14 +4252,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4210
4252
|
resources: resources
|
|
4211
4253
|
});
|
|
4212
4254
|
}
|
|
4213
|
-
return
|
|
4255
|
+
return _context29.abrupt("return", results);
|
|
4214
4256
|
case 9:
|
|
4215
4257
|
case "end":
|
|
4216
|
-
return
|
|
4258
|
+
return _context29.stop();
|
|
4217
4259
|
}
|
|
4218
|
-
},
|
|
4260
|
+
}, _callee28, this);
|
|
4219
4261
|
}));
|
|
4220
|
-
function getTimeslotsScheduleByDateRange(
|
|
4262
|
+
function getTimeslotsScheduleByDateRange(_x23) {
|
|
4221
4263
|
return _getTimeslotsScheduleByDateRange.apply(this, arguments);
|
|
4222
4264
|
}
|
|
4223
4265
|
return getTimeslotsScheduleByDateRange;
|
|
@@ -4225,7 +4267,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4225
4267
|
}, {
|
|
4226
4268
|
key: "getAvailableDateForSessionOptimize",
|
|
4227
4269
|
value: function () {
|
|
4228
|
-
var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4270
|
+
var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
4229
4271
|
var _this$store$currentPr3, _this$store$currentPr4, _tempProducts;
|
|
4230
4272
|
var params,
|
|
4231
4273
|
startDate,
|
|
@@ -4245,11 +4287,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4245
4287
|
allProductResources,
|
|
4246
4288
|
targetSchedules,
|
|
4247
4289
|
_loop8,
|
|
4248
|
-
|
|
4249
|
-
return _regeneratorRuntime().wrap(function
|
|
4250
|
-
while (1) switch (
|
|
4290
|
+
_args31 = arguments;
|
|
4291
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context31) {
|
|
4292
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
4251
4293
|
case 0:
|
|
4252
|
-
params =
|
|
4294
|
+
params = _args31.length > 0 && _args31[0] !== undefined ? _args31[0] : {};
|
|
4253
4295
|
// 开始日期如果小于今天,直接以今天当做开始日期
|
|
4254
4296
|
startDate = params.startDate, endDate = params.endDate; // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天 且 endDate 小于或等于今天,需要把 startDate 置为今天
|
|
4255
4297
|
if (dayjs(startDate).isBefore(dayjs(), 'day') && (dayjs(endDate).isAfter(dayjs(), 'day') || dayjs(endDate).isSame(dayjs(), 'day'))) {
|
|
@@ -4274,15 +4316,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4274
4316
|
// 先去读缓存结果,因为正常 UI 调用的是 7 天,而下面我会直接计算 30 天(最少也是 14 天),所以先去读缓存结果,如果缓存结果存在,则直接返回
|
|
4275
4317
|
cache = (_this$store$currentPr3 = this.store.currentProductMeta) === null || _this$store$currentPr3 === void 0 ? void 0 : _this$store$currentPr3['timeSlotBySchedule'];
|
|
4276
4318
|
if (!cache) {
|
|
4277
|
-
|
|
4319
|
+
_context31.next = 13;
|
|
4278
4320
|
break;
|
|
4279
4321
|
}
|
|
4280
4322
|
if (!(dayjs(params.startDate).isSameOrAfter(dayjs(cache.startDate), 'day') && dayjs(params.endDate).isSameOrBefore(dayjs(cache.endDate), 'day'))) {
|
|
4281
|
-
|
|
4323
|
+
_context31.next = 13;
|
|
4282
4324
|
break;
|
|
4283
4325
|
}
|
|
4284
4326
|
this.store.date.setDateList(cache.dateList);
|
|
4285
|
-
return
|
|
4327
|
+
return _context31.abrupt("return", {
|
|
4286
4328
|
dateList: cache.dateList,
|
|
4287
4329
|
firstAvailableDate: cache.firstAvailableDate
|
|
4288
4330
|
});
|
|
@@ -4292,7 +4334,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4292
4334
|
schedule = (_this$store$currentPr4 = this.store.currentProductMeta) === null || _this$store$currentPr4 === void 0 ? void 0 : _this$store$currentPr4['schedule'];
|
|
4293
4335
|
filteredSchedule = filterScheduleByDateRange(schedule, startDate || '', endDate || ''); // 1.后端返回的数据,确定资源在每一天的可用和使用情况
|
|
4294
4336
|
tempResourceIds = getResourcesIdsByProduct(tempProducts);
|
|
4295
|
-
|
|
4337
|
+
_context31.next = 19;
|
|
4296
4338
|
return this.store.date.fetchResourceDates({
|
|
4297
4339
|
query: {
|
|
4298
4340
|
start_date: startDate || '',
|
|
@@ -4301,7 +4343,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4301
4343
|
}
|
|
4302
4344
|
});
|
|
4303
4345
|
case 19:
|
|
4304
|
-
res =
|
|
4346
|
+
res = _context31.sent;
|
|
4305
4347
|
// 2. 商品 schedule 数据,确定日程在每一天的时间片
|
|
4306
4348
|
// 3. 把后端返回的和 schedule 的数据进行合并,确定每一天的可用和使用情况
|
|
4307
4349
|
dates = [];
|
|
@@ -4323,8 +4365,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4323
4365
|
targetSchedules = this.store.schedule.getScheduleListByIds(tempProducts['schedule.ids']);
|
|
4324
4366
|
_loop8 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop8() {
|
|
4325
4367
|
var currentDateStr, status, summaryCount, availableCount, _checkSessionProductL, latestStartDate, earliestEndDate, scheduleByDate, minTimeMaxTime, scheduleTimeSlots, timesSlotCanUse, dateStatus, usageRatio;
|
|
4326
|
-
return _regeneratorRuntime().wrap(function _loop8$(
|
|
4327
|
-
while (1) switch (
|
|
4368
|
+
return _regeneratorRuntime().wrap(function _loop8$(_context30) {
|
|
4369
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
4328
4370
|
case 0:
|
|
4329
4371
|
currentDateStr = currentDate.format('YYYY-MM-DD');
|
|
4330
4372
|
status = 'available';
|
|
@@ -4483,32 +4525,32 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4483
4525
|
|
|
4484
4526
|
// 如果 firstAvailableDate 距离 startDate 大于 14 天了,则后面就不需要再找了,也是一种性能保护
|
|
4485
4527
|
if (!(firstAvailableDate && dayjs(currentDate).diff(dayjs(startDate), 'day') > 31)) {
|
|
4486
|
-
|
|
4528
|
+
_context30.next = 12;
|
|
4487
4529
|
break;
|
|
4488
4530
|
}
|
|
4489
|
-
return
|
|
4531
|
+
return _context30.abrupt("return", 1);
|
|
4490
4532
|
case 12:
|
|
4491
4533
|
currentDate = dayjs(currentDate).add(1, 'day');
|
|
4492
4534
|
case 13:
|
|
4493
4535
|
case "end":
|
|
4494
|
-
return
|
|
4536
|
+
return _context30.stop();
|
|
4495
4537
|
}
|
|
4496
4538
|
}, _loop8);
|
|
4497
4539
|
});
|
|
4498
4540
|
case 28:
|
|
4499
4541
|
if (!(dayjs(currentDate).isBefore(dayjs(endDate), 'day') || dayjs(currentDate).isSame(dayjs(endDate), 'day'))) {
|
|
4500
|
-
|
|
4542
|
+
_context31.next = 34;
|
|
4501
4543
|
break;
|
|
4502
4544
|
}
|
|
4503
|
-
return
|
|
4545
|
+
return _context31.delegateYield(_loop8(), "t0", 30);
|
|
4504
4546
|
case 30:
|
|
4505
|
-
if (!
|
|
4506
|
-
|
|
4547
|
+
if (!_context31.t0) {
|
|
4548
|
+
_context31.next = 32;
|
|
4507
4549
|
break;
|
|
4508
4550
|
}
|
|
4509
|
-
return
|
|
4551
|
+
return _context31.abrupt("break", 34);
|
|
4510
4552
|
case 32:
|
|
4511
|
-
|
|
4553
|
+
_context31.next = 28;
|
|
4512
4554
|
break;
|
|
4513
4555
|
case 34:
|
|
4514
4556
|
// 最终把资源数据也加到日期内
|
|
@@ -4523,15 +4565,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4523
4565
|
startDate: startDate,
|
|
4524
4566
|
endDate: dayjs(currentDate).format('YYYY-MM-DD')
|
|
4525
4567
|
};
|
|
4526
|
-
return
|
|
4568
|
+
return _context31.abrupt("return", {
|
|
4527
4569
|
dateList: dates,
|
|
4528
4570
|
firstAvailableDate: firstAvailableDate
|
|
4529
4571
|
});
|
|
4530
4572
|
case 39:
|
|
4531
4573
|
case "end":
|
|
4532
|
-
return
|
|
4574
|
+
return _context31.stop();
|
|
4533
4575
|
}
|
|
4534
|
-
},
|
|
4576
|
+
}, _callee29, this);
|
|
4535
4577
|
}));
|
|
4536
4578
|
function getAvailableDateForSessionOptimize() {
|
|
4537
4579
|
return _getAvailableDateForSessionOptimize.apply(this, arguments);
|
|
@@ -4578,18 +4620,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4578
4620
|
}, {
|
|
4579
4621
|
key: "getContactInfo",
|
|
4580
4622
|
value: (function () {
|
|
4581
|
-
var _getContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4582
|
-
return _regeneratorRuntime().wrap(function
|
|
4583
|
-
while (1) switch (
|
|
4623
|
+
var _getContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
4624
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context32) {
|
|
4625
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
4584
4626
|
case 0:
|
|
4585
|
-
return
|
|
4627
|
+
return _context32.abrupt("return", this.request.get('/customer/metadata', params));
|
|
4586
4628
|
case 1:
|
|
4587
4629
|
case "end":
|
|
4588
|
-
return
|
|
4630
|
+
return _context32.stop();
|
|
4589
4631
|
}
|
|
4590
|
-
},
|
|
4632
|
+
}, _callee30, this);
|
|
4591
4633
|
}));
|
|
4592
|
-
function getContactInfo(
|
|
4634
|
+
function getContactInfo(_x24) {
|
|
4593
4635
|
return _getContactInfo.apply(this, arguments);
|
|
4594
4636
|
}
|
|
4595
4637
|
return getContactInfo;
|