@pisell/pisellos 0.0.551 → 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 +1 -1
- package/dist/modules/Order/index.js +5 -1
- package/dist/modules/Order/utils.d.ts +2 -1
- package/dist/modules/Order/utils.js +21 -17
- package/dist/solution/BookingByStep/index.d.ts +8 -2
- package/dist/solution/BookingByStep/index.js +251 -212
- package/dist/solution/ScanOrder/types.d.ts +1 -0
- package/dist/solution/VenueBooking/index.d.ts +5 -2
- package/dist/solution/VenueBooking/index.js +684 -656
- 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 +1 -1
- package/lib/modules/Order/index.js +4 -1
- package/lib/modules/Order/utils.d.ts +2 -1
- package/lib/modules/Order/utils.js +11 -7
- package/lib/solution/BookingByStep/index.d.ts +8 -2
- package/lib/solution/BookingByStep/index.js +22 -10
- package/lib/solution/ScanOrder/types.d.ts +1 -0
- package/lib/solution/VenueBooking/index.d.ts +5 -2
- package/lib/solution/VenueBooking/index.js +37 -16
- package/package.json +1 -1
|
@@ -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
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
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) || '';
|
|
924
951
|
}
|
|
925
|
-
|
|
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,16 +1257,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1213
1257
|
}
|
|
1214
1258
|
}
|
|
1215
1259
|
try {
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
customer_id: Number(customer.id),
|
|
1222
|
-
shop_id: (productData === null || productData === void 0 ? void 0 : productData.shop_id) || '',
|
|
1223
|
-
useCache: true
|
|
1224
|
-
});
|
|
1225
|
-
}
|
|
1260
|
+
this.store.holder.ensureFormByProduct({
|
|
1261
|
+
product: productData,
|
|
1262
|
+
shop_id: (productData === null || productData === void 0 ? void 0 : productData.shop_id) || '',
|
|
1263
|
+
useCache: true
|
|
1264
|
+
});
|
|
1226
1265
|
} catch (error) {
|
|
1227
1266
|
console.error('[BookingByStep] 加载 holder 表单失败', error);
|
|
1228
1267
|
}
|
|
@@ -2304,14 +2343,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2304
2343
|
}, {
|
|
2305
2344
|
key: "getTimeSlotByAllResourcesForDate",
|
|
2306
2345
|
value: function () {
|
|
2307
|
-
var _getTimeSlotByAllResourcesForDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2346
|
+
var _getTimeSlotByAllResourcesForDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(_ref10) {
|
|
2308
2347
|
var _this13 = this,
|
|
2309
2348
|
_cartItems$5,
|
|
2310
2349
|
_cartItems$6,
|
|
2311
2350
|
_this$shopStore$get2;
|
|
2312
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;
|
|
2313
|
-
return _regeneratorRuntime().wrap(function
|
|
2314
|
-
while (1) switch (
|
|
2352
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context26) {
|
|
2353
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2315
2354
|
case 0:
|
|
2316
2355
|
resources_code = _ref10.resources_code, startDate = _ref10.startDate, endDate = _ref10.endDate;
|
|
2317
2356
|
// 如果 end_date 距离start_date小于 30 天,自动追加 end_date 为今天往后的 30 天
|
|
@@ -2319,7 +2358,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2319
2358
|
endDate = dayjs(startDate).add(30, 'day').format('YYYY-MM-DD');
|
|
2320
2359
|
}
|
|
2321
2360
|
// 预请求资源数据,防止日期超过之前选择的范围
|
|
2322
|
-
|
|
2361
|
+
_context26.next = 4;
|
|
2323
2362
|
return this.getAvailableDate({
|
|
2324
2363
|
startDate: startDate,
|
|
2325
2364
|
endDate: endDate,
|
|
@@ -2365,10 +2404,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2365
2404
|
|
|
2366
2405
|
// 保护: 如果 resources 为空则直接 return
|
|
2367
2406
|
if (resources.length) {
|
|
2368
|
-
|
|
2407
|
+
_context26.next = 14;
|
|
2369
2408
|
break;
|
|
2370
2409
|
}
|
|
2371
|
-
return
|
|
2410
|
+
return _context26.abrupt("return", []);
|
|
2372
2411
|
case 14:
|
|
2373
2412
|
duration = 0; // duration = 不同账号的最长时间
|
|
2374
2413
|
accountList = this.store.accountList.getAccounts();
|
|
@@ -2402,10 +2441,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2402
2441
|
// 如果 cartItem 上既没有时间,也没有资源,认为外部属于异常调用,直接丢一个空数组出去
|
|
2403
2442
|
// 同时 session 类商品的流程也不应该调用这个方法
|
|
2404
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))) {
|
|
2405
|
-
|
|
2444
|
+
_context26.next = 20;
|
|
2406
2445
|
break;
|
|
2407
2446
|
}
|
|
2408
|
-
return
|
|
2447
|
+
return _context26.abrupt("return", []);
|
|
2409
2448
|
case 20:
|
|
2410
2449
|
resourcesUseableMap = {};
|
|
2411
2450
|
hasFlexibleDuration = cartItems.some(function (item) {
|
|
@@ -2459,8 +2498,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2459
2498
|
today = dayjs().startOf('day'); // 计算 start_date 到 end_date 之间的所有日期,遍历他们并且计算每一天的可用
|
|
2460
2499
|
_loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() {
|
|
2461
2500
|
var currentDate, theDateResources, resourcesMap, timeSlots;
|
|
2462
|
-
return _regeneratorRuntime().wrap(function _loop2$(
|
|
2463
|
-
while (1) switch (
|
|
2501
|
+
return _regeneratorRuntime().wrap(function _loop2$(_context25) {
|
|
2502
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2464
2503
|
case 0:
|
|
2465
2504
|
currentDate = i.format('YYYY-MM-DD');
|
|
2466
2505
|
theDateResources = _this13.store.date.getResourcesListByDate(currentDate);
|
|
@@ -2472,7 +2511,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2472
2511
|
});
|
|
2473
2512
|
resourcesMap = getResourcesMap(resources); // 如果日期已经过期则直接标记为不可用
|
|
2474
2513
|
if (!i.isBefore(today)) {
|
|
2475
|
-
|
|
2514
|
+
_context25.next = 7;
|
|
2476
2515
|
break;
|
|
2477
2516
|
}
|
|
2478
2517
|
arr.push({
|
|
@@ -2481,7 +2520,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2481
2520
|
week: i.format('ddd'),
|
|
2482
2521
|
weekNum: i.day()
|
|
2483
2522
|
});
|
|
2484
|
-
return
|
|
2523
|
+
return _context25.abrupt("return", 1);
|
|
2485
2524
|
case 7:
|
|
2486
2525
|
timeSlots = getTimeSlicesByResources({
|
|
2487
2526
|
resourceIds: resourceIds,
|
|
@@ -2513,36 +2552,36 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2513
2552
|
}
|
|
2514
2553
|
case 9:
|
|
2515
2554
|
case "end":
|
|
2516
|
-
return
|
|
2555
|
+
return _context25.stop();
|
|
2517
2556
|
}
|
|
2518
2557
|
}, _loop2);
|
|
2519
2558
|
});
|
|
2520
2559
|
i = dayjs(startDate);
|
|
2521
2560
|
case 32:
|
|
2522
2561
|
if (!i.isBefore(dayjs(endDate))) {
|
|
2523
|
-
|
|
2562
|
+
_context26.next = 39;
|
|
2524
2563
|
break;
|
|
2525
2564
|
}
|
|
2526
|
-
return
|
|
2565
|
+
return _context26.delegateYield(_loop2(), "t0", 34);
|
|
2527
2566
|
case 34:
|
|
2528
|
-
if (!
|
|
2529
|
-
|
|
2567
|
+
if (!_context26.t0) {
|
|
2568
|
+
_context26.next = 36;
|
|
2530
2569
|
break;
|
|
2531
2570
|
}
|
|
2532
|
-
return
|
|
2571
|
+
return _context26.abrupt("continue", 36);
|
|
2533
2572
|
case 36:
|
|
2534
2573
|
i = i.add(1, 'day');
|
|
2535
|
-
|
|
2574
|
+
_context26.next = 32;
|
|
2536
2575
|
break;
|
|
2537
2576
|
case 39:
|
|
2538
|
-
return
|
|
2577
|
+
return _context26.abrupt("return", arr);
|
|
2539
2578
|
case 40:
|
|
2540
2579
|
case "end":
|
|
2541
|
-
return
|
|
2580
|
+
return _context26.stop();
|
|
2542
2581
|
}
|
|
2543
|
-
},
|
|
2582
|
+
}, _callee25, this);
|
|
2544
2583
|
}));
|
|
2545
|
-
function getTimeSlotByAllResourcesForDate(
|
|
2584
|
+
function getTimeSlotByAllResourcesForDate(_x20) {
|
|
2546
2585
|
return _getTimeSlotByAllResourcesForDate.apply(this, arguments);
|
|
2547
2586
|
}
|
|
2548
2587
|
return getTimeSlotByAllResourcesForDate;
|
|
@@ -2723,42 +2762,42 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2723
2762
|
}, {
|
|
2724
2763
|
key: "openProductDetail",
|
|
2725
2764
|
value: function () {
|
|
2726
|
-
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2765
|
+
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(productId) {
|
|
2727
2766
|
var targetProductData, newScheduleArr, dateRange;
|
|
2728
|
-
return _regeneratorRuntime().wrap(function
|
|
2729
|
-
while (1) switch (
|
|
2767
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context27) {
|
|
2768
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2730
2769
|
case 0:
|
|
2731
|
-
|
|
2770
|
+
_context27.next = 2;
|
|
2732
2771
|
return this.store.products.getProduct(productId);
|
|
2733
2772
|
case 2:
|
|
2734
|
-
targetProductData =
|
|
2773
|
+
targetProductData = _context27.sent;
|
|
2735
2774
|
if (!targetProductData) {
|
|
2736
|
-
|
|
2775
|
+
_context27.next = 17;
|
|
2737
2776
|
break;
|
|
2738
2777
|
}
|
|
2739
2778
|
this.store.currentProduct = targetProductData;
|
|
2740
2779
|
this.store.currentProductMeta = {};
|
|
2741
2780
|
// 资源预加载,如果是 duration 类型的商品,且是先选日期的流程,在这里预拉取资源数据
|
|
2742
2781
|
if (!targetProductData['schedule.ids']) {
|
|
2743
|
-
|
|
2782
|
+
_context27.next = 12;
|
|
2744
2783
|
break;
|
|
2745
2784
|
}
|
|
2746
2785
|
newScheduleArr = this.getScheduleDataByIds(targetProductData['schedule.ids']);
|
|
2747
2786
|
if (!this.store.currentProductMeta) this.store.currentProductMeta = {};
|
|
2748
2787
|
this.store.currentProductMeta.schedule = newScheduleArr;
|
|
2749
|
-
|
|
2788
|
+
_context27.next = 17;
|
|
2750
2789
|
break;
|
|
2751
2790
|
case 12:
|
|
2752
2791
|
if (!targetProductData.duration) {
|
|
2753
|
-
|
|
2792
|
+
_context27.next = 17;
|
|
2754
2793
|
break;
|
|
2755
2794
|
}
|
|
2756
2795
|
dateRange = this.store.date.getDateRange(); // 如果不是先选日期的流程 duration 商品就啥也不做
|
|
2757
2796
|
if (dateRange !== null && dateRange !== void 0 && dateRange.length) {
|
|
2758
|
-
|
|
2797
|
+
_context27.next = 16;
|
|
2759
2798
|
break;
|
|
2760
2799
|
}
|
|
2761
|
-
return
|
|
2800
|
+
return _context27.abrupt("return");
|
|
2762
2801
|
case 16:
|
|
2763
2802
|
// this.store.date.getResourceDates({
|
|
2764
2803
|
// query: {
|
|
@@ -2774,11 +2813,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2774
2813
|
});
|
|
2775
2814
|
case 17:
|
|
2776
2815
|
case "end":
|
|
2777
|
-
return
|
|
2816
|
+
return _context27.stop();
|
|
2778
2817
|
}
|
|
2779
|
-
},
|
|
2818
|
+
}, _callee26, this);
|
|
2780
2819
|
}));
|
|
2781
|
-
function openProductDetail(
|
|
2820
|
+
function openProductDetail(_x21) {
|
|
2782
2821
|
return _openProductDetail.apply(this, arguments);
|
|
2783
2822
|
}
|
|
2784
2823
|
return openProductDetail;
|
|
@@ -4029,41 +4068,41 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4029
4068
|
}, {
|
|
4030
4069
|
key: "getProductTypeById",
|
|
4031
4070
|
value: function () {
|
|
4032
|
-
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4071
|
+
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(id) {
|
|
4033
4072
|
var productData, _productData$schedule;
|
|
4034
|
-
return _regeneratorRuntime().wrap(function
|
|
4035
|
-
while (1) switch (
|
|
4073
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
4074
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
4036
4075
|
case 0:
|
|
4037
|
-
|
|
4076
|
+
_context28.next = 2;
|
|
4038
4077
|
return this.store.products.getProduct(id);
|
|
4039
4078
|
case 2:
|
|
4040
|
-
productData =
|
|
4079
|
+
productData = _context28.sent;
|
|
4041
4080
|
if (!productData) {
|
|
4042
|
-
|
|
4081
|
+
_context28.next = 9;
|
|
4043
4082
|
break;
|
|
4044
4083
|
}
|
|
4045
4084
|
if (!productData.duration) {
|
|
4046
|
-
|
|
4085
|
+
_context28.next = 6;
|
|
4047
4086
|
break;
|
|
4048
4087
|
}
|
|
4049
|
-
return
|
|
4088
|
+
return _context28.abrupt("return", 'duration');
|
|
4050
4089
|
case 6:
|
|
4051
4090
|
if (!((_productData$schedule = productData['schedule.ids']) !== null && _productData$schedule !== void 0 && _productData$schedule.length)) {
|
|
4052
|
-
|
|
4091
|
+
_context28.next = 8;
|
|
4053
4092
|
break;
|
|
4054
4093
|
}
|
|
4055
|
-
return
|
|
4094
|
+
return _context28.abrupt("return", 'session');
|
|
4056
4095
|
case 8:
|
|
4057
|
-
return
|
|
4096
|
+
return _context28.abrupt("return", 'normal');
|
|
4058
4097
|
case 9:
|
|
4059
|
-
return
|
|
4098
|
+
return _context28.abrupt("return", 'normal');
|
|
4060
4099
|
case 10:
|
|
4061
4100
|
case "end":
|
|
4062
|
-
return
|
|
4101
|
+
return _context28.stop();
|
|
4063
4102
|
}
|
|
4064
|
-
},
|
|
4103
|
+
}, _callee27, this);
|
|
4065
4104
|
}));
|
|
4066
|
-
function getProductTypeById(
|
|
4105
|
+
function getProductTypeById(_x22) {
|
|
4067
4106
|
return _getProductTypeById.apply(this, arguments);
|
|
4068
4107
|
}
|
|
4069
4108
|
return getProductTypeById;
|
|
@@ -4183,10 +4222,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4183
4222
|
}, {
|
|
4184
4223
|
key: "getTimeslotsScheduleByDateRange",
|
|
4185
4224
|
value: (function () {
|
|
4186
|
-
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4225
|
+
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(_ref16) {
|
|
4187
4226
|
var startDate, endDate, scheduleIds, resources, dates, currentDate, end, results, _i5, _dates, date;
|
|
4188
|
-
return _regeneratorRuntime().wrap(function
|
|
4189
|
-
while (1) switch (
|
|
4227
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context29) {
|
|
4228
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
4190
4229
|
case 0:
|
|
4191
4230
|
startDate = _ref16.startDate, endDate = _ref16.endDate, scheduleIds = _ref16.scheduleIds, resources = _ref16.resources;
|
|
4192
4231
|
console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
|
|
@@ -4213,14 +4252,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4213
4252
|
resources: resources
|
|
4214
4253
|
});
|
|
4215
4254
|
}
|
|
4216
|
-
return
|
|
4255
|
+
return _context29.abrupt("return", results);
|
|
4217
4256
|
case 9:
|
|
4218
4257
|
case "end":
|
|
4219
|
-
return
|
|
4258
|
+
return _context29.stop();
|
|
4220
4259
|
}
|
|
4221
|
-
},
|
|
4260
|
+
}, _callee28, this);
|
|
4222
4261
|
}));
|
|
4223
|
-
function getTimeslotsScheduleByDateRange(
|
|
4262
|
+
function getTimeslotsScheduleByDateRange(_x23) {
|
|
4224
4263
|
return _getTimeslotsScheduleByDateRange.apply(this, arguments);
|
|
4225
4264
|
}
|
|
4226
4265
|
return getTimeslotsScheduleByDateRange;
|
|
@@ -4228,7 +4267,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4228
4267
|
}, {
|
|
4229
4268
|
key: "getAvailableDateForSessionOptimize",
|
|
4230
4269
|
value: function () {
|
|
4231
|
-
var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4270
|
+
var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
4232
4271
|
var _this$store$currentPr3, _this$store$currentPr4, _tempProducts;
|
|
4233
4272
|
var params,
|
|
4234
4273
|
startDate,
|
|
@@ -4248,11 +4287,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4248
4287
|
allProductResources,
|
|
4249
4288
|
targetSchedules,
|
|
4250
4289
|
_loop8,
|
|
4251
|
-
|
|
4252
|
-
return _regeneratorRuntime().wrap(function
|
|
4253
|
-
while (1) switch (
|
|
4290
|
+
_args31 = arguments;
|
|
4291
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context31) {
|
|
4292
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
4254
4293
|
case 0:
|
|
4255
|
-
params =
|
|
4294
|
+
params = _args31.length > 0 && _args31[0] !== undefined ? _args31[0] : {};
|
|
4256
4295
|
// 开始日期如果小于今天,直接以今天当做开始日期
|
|
4257
4296
|
startDate = params.startDate, endDate = params.endDate; // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天 且 endDate 小于或等于今天,需要把 startDate 置为今天
|
|
4258
4297
|
if (dayjs(startDate).isBefore(dayjs(), 'day') && (dayjs(endDate).isAfter(dayjs(), 'day') || dayjs(endDate).isSame(dayjs(), 'day'))) {
|
|
@@ -4277,15 +4316,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4277
4316
|
// 先去读缓存结果,因为正常 UI 调用的是 7 天,而下面我会直接计算 30 天(最少也是 14 天),所以先去读缓存结果,如果缓存结果存在,则直接返回
|
|
4278
4317
|
cache = (_this$store$currentPr3 = this.store.currentProductMeta) === null || _this$store$currentPr3 === void 0 ? void 0 : _this$store$currentPr3['timeSlotBySchedule'];
|
|
4279
4318
|
if (!cache) {
|
|
4280
|
-
|
|
4319
|
+
_context31.next = 13;
|
|
4281
4320
|
break;
|
|
4282
4321
|
}
|
|
4283
4322
|
if (!(dayjs(params.startDate).isSameOrAfter(dayjs(cache.startDate), 'day') && dayjs(params.endDate).isSameOrBefore(dayjs(cache.endDate), 'day'))) {
|
|
4284
|
-
|
|
4323
|
+
_context31.next = 13;
|
|
4285
4324
|
break;
|
|
4286
4325
|
}
|
|
4287
4326
|
this.store.date.setDateList(cache.dateList);
|
|
4288
|
-
return
|
|
4327
|
+
return _context31.abrupt("return", {
|
|
4289
4328
|
dateList: cache.dateList,
|
|
4290
4329
|
firstAvailableDate: cache.firstAvailableDate
|
|
4291
4330
|
});
|
|
@@ -4295,7 +4334,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4295
4334
|
schedule = (_this$store$currentPr4 = this.store.currentProductMeta) === null || _this$store$currentPr4 === void 0 ? void 0 : _this$store$currentPr4['schedule'];
|
|
4296
4335
|
filteredSchedule = filterScheduleByDateRange(schedule, startDate || '', endDate || ''); // 1.后端返回的数据,确定资源在每一天的可用和使用情况
|
|
4297
4336
|
tempResourceIds = getResourcesIdsByProduct(tempProducts);
|
|
4298
|
-
|
|
4337
|
+
_context31.next = 19;
|
|
4299
4338
|
return this.store.date.fetchResourceDates({
|
|
4300
4339
|
query: {
|
|
4301
4340
|
start_date: startDate || '',
|
|
@@ -4304,7 +4343,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4304
4343
|
}
|
|
4305
4344
|
});
|
|
4306
4345
|
case 19:
|
|
4307
|
-
res =
|
|
4346
|
+
res = _context31.sent;
|
|
4308
4347
|
// 2. 商品 schedule 数据,确定日程在每一天的时间片
|
|
4309
4348
|
// 3. 把后端返回的和 schedule 的数据进行合并,确定每一天的可用和使用情况
|
|
4310
4349
|
dates = [];
|
|
@@ -4326,8 +4365,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4326
4365
|
targetSchedules = this.store.schedule.getScheduleListByIds(tempProducts['schedule.ids']);
|
|
4327
4366
|
_loop8 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop8() {
|
|
4328
4367
|
var currentDateStr, status, summaryCount, availableCount, _checkSessionProductL, latestStartDate, earliestEndDate, scheduleByDate, minTimeMaxTime, scheduleTimeSlots, timesSlotCanUse, dateStatus, usageRatio;
|
|
4329
|
-
return _regeneratorRuntime().wrap(function _loop8$(
|
|
4330
|
-
while (1) switch (
|
|
4368
|
+
return _regeneratorRuntime().wrap(function _loop8$(_context30) {
|
|
4369
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
4331
4370
|
case 0:
|
|
4332
4371
|
currentDateStr = currentDate.format('YYYY-MM-DD');
|
|
4333
4372
|
status = 'available';
|
|
@@ -4486,32 +4525,32 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4486
4525
|
|
|
4487
4526
|
// 如果 firstAvailableDate 距离 startDate 大于 14 天了,则后面就不需要再找了,也是一种性能保护
|
|
4488
4527
|
if (!(firstAvailableDate && dayjs(currentDate).diff(dayjs(startDate), 'day') > 31)) {
|
|
4489
|
-
|
|
4528
|
+
_context30.next = 12;
|
|
4490
4529
|
break;
|
|
4491
4530
|
}
|
|
4492
|
-
return
|
|
4531
|
+
return _context30.abrupt("return", 1);
|
|
4493
4532
|
case 12:
|
|
4494
4533
|
currentDate = dayjs(currentDate).add(1, 'day');
|
|
4495
4534
|
case 13:
|
|
4496
4535
|
case "end":
|
|
4497
|
-
return
|
|
4536
|
+
return _context30.stop();
|
|
4498
4537
|
}
|
|
4499
4538
|
}, _loop8);
|
|
4500
4539
|
});
|
|
4501
4540
|
case 28:
|
|
4502
4541
|
if (!(dayjs(currentDate).isBefore(dayjs(endDate), 'day') || dayjs(currentDate).isSame(dayjs(endDate), 'day'))) {
|
|
4503
|
-
|
|
4542
|
+
_context31.next = 34;
|
|
4504
4543
|
break;
|
|
4505
4544
|
}
|
|
4506
|
-
return
|
|
4545
|
+
return _context31.delegateYield(_loop8(), "t0", 30);
|
|
4507
4546
|
case 30:
|
|
4508
|
-
if (!
|
|
4509
|
-
|
|
4547
|
+
if (!_context31.t0) {
|
|
4548
|
+
_context31.next = 32;
|
|
4510
4549
|
break;
|
|
4511
4550
|
}
|
|
4512
|
-
return
|
|
4551
|
+
return _context31.abrupt("break", 34);
|
|
4513
4552
|
case 32:
|
|
4514
|
-
|
|
4553
|
+
_context31.next = 28;
|
|
4515
4554
|
break;
|
|
4516
4555
|
case 34:
|
|
4517
4556
|
// 最终把资源数据也加到日期内
|
|
@@ -4526,15 +4565,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4526
4565
|
startDate: startDate,
|
|
4527
4566
|
endDate: dayjs(currentDate).format('YYYY-MM-DD')
|
|
4528
4567
|
};
|
|
4529
|
-
return
|
|
4568
|
+
return _context31.abrupt("return", {
|
|
4530
4569
|
dateList: dates,
|
|
4531
4570
|
firstAvailableDate: firstAvailableDate
|
|
4532
4571
|
});
|
|
4533
4572
|
case 39:
|
|
4534
4573
|
case "end":
|
|
4535
|
-
return
|
|
4574
|
+
return _context31.stop();
|
|
4536
4575
|
}
|
|
4537
|
-
},
|
|
4576
|
+
}, _callee29, this);
|
|
4538
4577
|
}));
|
|
4539
4578
|
function getAvailableDateForSessionOptimize() {
|
|
4540
4579
|
return _getAvailableDateForSessionOptimize.apply(this, arguments);
|
|
@@ -4581,18 +4620,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4581
4620
|
}, {
|
|
4582
4621
|
key: "getContactInfo",
|
|
4583
4622
|
value: (function () {
|
|
4584
|
-
var _getContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4585
|
-
return _regeneratorRuntime().wrap(function
|
|
4586
|
-
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) {
|
|
4587
4626
|
case 0:
|
|
4588
|
-
return
|
|
4627
|
+
return _context32.abrupt("return", this.request.get('/customer/metadata', params));
|
|
4589
4628
|
case 1:
|
|
4590
4629
|
case "end":
|
|
4591
|
-
return
|
|
4630
|
+
return _context32.stop();
|
|
4592
4631
|
}
|
|
4593
|
-
},
|
|
4632
|
+
}, _callee30, this);
|
|
4594
4633
|
}));
|
|
4595
|
-
function getContactInfo(
|
|
4634
|
+
function getContactInfo(_x24) {
|
|
4596
4635
|
return _getContactInfo.apply(this, arguments);
|
|
4597
4636
|
}
|
|
4598
4637
|
return getContactInfo;
|