@pisell/pisellos 2.1.154 → 2.1.156

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.
Files changed (54) hide show
  1. package/dist/modules/Holder/index.d.ts +48 -0
  2. package/dist/modules/Holder/index.js +639 -0
  3. package/dist/modules/Holder/types.d.ts +123 -0
  4. package/dist/modules/Holder/types.js +1 -0
  5. package/dist/modules/Holder/utils.d.ts +13 -0
  6. package/dist/modules/Holder/utils.js +34 -0
  7. package/dist/modules/Order/index.d.ts +2 -1
  8. package/dist/modules/Order/index.js +18 -1
  9. package/dist/modules/Order/types.d.ts +2 -0
  10. package/dist/modules/Order/utils.d.ts +10 -0
  11. package/dist/modules/Order/utils.js +35 -3
  12. package/dist/modules/Product/types.d.ts +7 -0
  13. package/dist/modules/index.d.ts +1 -0
  14. package/dist/modules/index.js +2 -1
  15. package/dist/plugins/window.d.ts +1 -0
  16. package/dist/solution/BookingByStep/index.d.ts +16 -1
  17. package/dist/solution/BookingByStep/index.js +276 -204
  18. package/dist/solution/BookingByStep/types.d.ts +2 -1
  19. package/dist/solution/BookingByStep/types.js +3 -1
  20. package/dist/solution/ScanOrder/index.d.ts +2 -6
  21. package/dist/solution/ScanOrder/index.js +57 -250
  22. package/dist/solution/ScanOrder/types.d.ts +2 -20
  23. package/dist/solution/VenueBooking/index.d.ts +19 -0
  24. package/dist/solution/VenueBooking/index.js +963 -733
  25. package/dist/solution/VenueBooking/types.d.ts +2 -0
  26. package/dist/types/index.d.ts +1 -0
  27. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  28. package/lib/modules/Holder/index.d.ts +48 -0
  29. package/lib/modules/Holder/index.js +401 -0
  30. package/lib/modules/Holder/types.d.ts +123 -0
  31. package/lib/modules/Holder/types.js +17 -0
  32. package/lib/modules/Holder/utils.d.ts +13 -0
  33. package/lib/modules/Holder/utils.js +71 -0
  34. package/lib/modules/Order/index.d.ts +2 -1
  35. package/lib/modules/Order/index.js +14 -0
  36. package/lib/modules/Order/types.d.ts +2 -0
  37. package/lib/modules/Order/utils.d.ts +10 -0
  38. package/lib/modules/Order/utils.js +36 -5
  39. package/lib/modules/Product/types.d.ts +7 -0
  40. package/lib/modules/index.d.ts +1 -0
  41. package/lib/modules/index.js +3 -1
  42. package/lib/plugins/window.d.ts +1 -0
  43. package/lib/solution/BookingByStep/index.d.ts +16 -1
  44. package/lib/solution/BookingByStep/index.js +39 -0
  45. package/lib/solution/BookingByStep/types.d.ts +2 -1
  46. package/lib/solution/BookingByStep/types.js +5 -0
  47. package/lib/solution/ScanOrder/index.d.ts +2 -6
  48. package/lib/solution/ScanOrder/index.js +47 -212
  49. package/lib/solution/ScanOrder/types.d.ts +2 -20
  50. package/lib/solution/VenueBooking/index.d.ts +19 -0
  51. package/lib/solution/VenueBooking/index.js +134 -16
  52. package/lib/solution/VenueBooking/types.d.ts +2 -0
  53. package/lib/types/index.d.ts +1 -0
  54. package/package.json +1 -1
@@ -118,7 +118,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
118
118
  this.otherData = ((_data$this$otherParam = data[this.otherParams.cacheId]) === null || _data$this$otherParam === void 0 || (_data$this$otherParam = _data$this$otherParam[this.name]) === null || _data$this$otherParam === void 0 ? void 0 : _data$this$otherParam['otherData']) || {};
119
119
  }
120
120
  }
121
- moduleArr = ['accountList', 'cart', 'schedule', 'summary', 'step', 'products', 'date', 'order'];
121
+ moduleArr = ['accountList', 'holder', 'cart', 'schedule', 'summary', 'step', 'products', 'date', 'order'];
122
122
  moduleArr.forEach(function (step) {
123
123
  var targetModule = createModule(step, _this2.name);
124
124
  if (targetModule) {
@@ -644,14 +644,59 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
644
644
  return _fetchHolderAccountsAsync.apply(this, arguments);
645
645
  }
646
646
  return fetchHolderAccountsAsync;
647
- }() // 设置日期范围,注入到日期模块中
647
+ }()
648
+ /**
649
+ * 获取 holder 表单 map
650
+ */
648
651
  )
649
652
  }, {
650
- key: "setDateRange",
651
- value: function () {
652
- var _setDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(dateRange) {
653
+ key: "getHolderFormMap",
654
+ value: function getHolderFormMap() {
655
+ return this.store.holder.getHolderFormMap();
656
+ }
657
+
658
+ /**
659
+ * 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
660
+ */
661
+ }, {
662
+ key: "refreshAllHolderFormRecords",
663
+ value: (function () {
664
+ var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
653
665
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
654
666
  while (1) switch (_context10.prev = _context10.next) {
667
+ case 0:
668
+ return _context10.abrupt("return", this.store.holder.refreshAllFormRecords({
669
+ customer_id: params === null || params === void 0 ? void 0 : params.customer_id,
670
+ useCache: false
671
+ }));
672
+ case 1:
673
+ case "end":
674
+ return _context10.stop();
675
+ }
676
+ }, _callee10, this);
677
+ }));
678
+ function refreshAllHolderFormRecords(_x12) {
679
+ return _refreshAllHolderFormRecords.apply(this, arguments);
680
+ }
681
+ return refreshAllHolderFormRecords;
682
+ }()
683
+ /**
684
+ * 添加表单记录
685
+ */
686
+ )
687
+ }, {
688
+ key: "appendFormRecord",
689
+ value: function appendFormRecord(params) {
690
+ return this.store.holder.appendFormRecord(params);
691
+ }
692
+
693
+ // 设置日期范围,注入到日期模块中
694
+ }, {
695
+ key: "setDateRange",
696
+ value: function () {
697
+ var _setDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(dateRange) {
698
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
699
+ while (1) switch (_context11.prev = _context11.next) {
655
700
  case 0:
656
701
  this.store.date.setDateRange(dateRange);
657
702
  // 日期数据变更后,如果购物车里有数据,需要更新购物车里的报价单的价格
@@ -660,11 +705,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
660
705
  }
661
706
  case 2:
662
707
  case "end":
663
- return _context10.stop();
708
+ return _context11.stop();
664
709
  }
665
- }, _callee10, this);
710
+ }, _callee11, this);
666
711
  }));
667
- function setDateRange(_x12) {
712
+ function setDateRange(_x13) {
668
713
  return _setDateRange.apply(this, arguments);
669
714
  }
670
715
  return setDateRange;
@@ -679,16 +724,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
679
724
  }, {
680
725
  key: "getDateRange",
681
726
  value: function () {
682
- var _getDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
683
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
684
- while (1) switch (_context11.prev = _context11.next) {
727
+ var _getDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
728
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
729
+ while (1) switch (_context12.prev = _context12.next) {
685
730
  case 0:
686
- return _context11.abrupt("return", this.store.date.getDateRange());
731
+ return _context12.abrupt("return", this.store.date.getDateRange());
687
732
  case 1:
688
733
  case "end":
689
- return _context11.stop();
734
+ return _context12.stop();
690
735
  }
691
- }, _callee11, this);
736
+ }, _callee12, this);
692
737
  }));
693
738
  function getDateRange() {
694
739
  return _getDateRange.apply(this, arguments);
@@ -705,7 +750,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
705
750
  }, {
706
751
  key: "getAvailableDate",
707
752
  value: function () {
708
- var _getAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
753
+ var _getAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
709
754
  var _this4 = this,
710
755
  _dateRange$,
711
756
  _dateRange$2,
@@ -727,11 +772,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
727
772
  rules,
728
773
  resourcesMap,
729
774
  res,
730
- _args12 = arguments;
731
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
732
- while (1) switch (_context12.prev = _context12.next) {
775
+ _args13 = arguments;
776
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
777
+ while (1) switch (_context13.prev = _context13.next) {
733
778
  case 0:
734
- params = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
779
+ params = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
735
780
  // 开始日期如果小于今天,直接以今天当做开始日期
736
781
  products = params.products, startDate = params.startDate, endDate = params.endDate, type = params.type, _params$useCache = params.useCache, useCache = _params$useCache === void 0 ? true : _params$useCache; // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天 且 endDate 小于或等于今天,需要把 startDate 置为今天
737
782
  if (dayjs(startDate).isBefore(dayjs(), 'day') && (dayjs(endDate).isAfter(dayjs(), 'day') || dayjs(endDate).isSame(dayjs(), 'day'))) {
@@ -758,15 +803,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
758
803
  tempStartDate = startDate || (dateRange === null || dateRange === void 0 || (_dateRange$ = dateRange[0]) === null || _dateRange$ === void 0 ? void 0 : _dateRange$.date);
759
804
  tempEndDate = endDate || (dateRange === null || dateRange === void 0 || (_dateRange$2 = dateRange[1]) === null || _dateRange$2 === void 0 ? void 0 : _dateRange$2.date) || (dateRange === null || dateRange === void 0 || (_dateRange$3 = dateRange[0]) === null || _dateRange$3 === void 0 ? void 0 : _dateRange$3.date);
760
805
  if (tempProducts.length) {
761
- _context12.next = 11;
806
+ _context13.next = 11;
762
807
  break;
763
808
  }
764
- return _context12.abrupt("return", []);
809
+ return _context13.abrupt("return", []);
765
810
  case 11:
766
811
  // 在这里需要把能收集到的数据都收集上来,拼装好给 date 模块去查询
767
812
  _ref4 = getAvailableProductResources(tempProducts) || {}, resourceIds = _ref4.resourceIds, rules = _ref4.rules, resourcesMap = _ref4.resourcesMap;
768
813
  this.otherParams.currentResourcesMap = resourcesMap;
769
- _context12.next = 15;
814
+ _context13.next = 15;
770
815
  return this.store.date.getResourceDates({
771
816
  url: params.url,
772
817
  query: {
@@ -779,13 +824,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
779
824
  useCache: useCache
780
825
  });
781
826
  case 15:
782
- res = _context12.sent;
783
- return _context12.abrupt("return", res);
827
+ res = _context13.sent;
828
+ return _context13.abrupt("return", res);
784
829
  case 17:
785
830
  case "end":
786
- return _context12.stop();
831
+ return _context13.stop();
787
832
  }
788
- }, _callee12, this);
833
+ }, _callee13, this);
789
834
  }));
790
835
  function getAvailableDate() {
791
836
  return _getAvailableDate.apply(this, arguments);
@@ -798,22 +843,22 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
798
843
  }, {
799
844
  key: "getSummary",
800
845
  value: (function () {
801
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
846
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
802
847
  var cartItems, summary;
803
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
804
- while (1) switch (_context13.prev = _context13.next) {
848
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
849
+ while (1) switch (_context14.prev = _context14.next) {
805
850
  case 0:
806
851
  cartItems = this.store.cart.getItems();
807
- _context13.next = 3;
852
+ _context14.next = 3;
808
853
  return this.store.summary.getSummary(cartItems);
809
854
  case 3:
810
- summary = _context13.sent;
811
- return _context13.abrupt("return", summary);
855
+ summary = _context14.sent;
856
+ return _context14.abrupt("return", summary);
812
857
  case 5:
813
858
  case "end":
814
- return _context13.stop();
859
+ return _context14.stop();
815
860
  }
816
- }, _callee13, this);
861
+ }, _callee14, this);
817
862
  }));
818
863
  function getSummary() {
819
864
  return _getSummary.apply(this, arguments);
@@ -827,18 +872,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
827
872
  }, {
828
873
  key: "getProtocol",
829
874
  value: (function () {
830
- var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(protocolId) {
831
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
832
- while (1) switch (_context14.prev = _context14.next) {
875
+ var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(protocolId) {
876
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
877
+ while (1) switch (_context15.prev = _context15.next) {
833
878
  case 0:
834
- return _context14.abrupt("return", this.store.summary.getProtocol(protocolId));
879
+ return _context15.abrupt("return", this.store.summary.getProtocol(protocolId));
835
880
  case 1:
836
881
  case "end":
837
- return _context14.stop();
882
+ return _context15.stop();
838
883
  }
839
- }, _callee14, this);
884
+ }, _callee15, this);
840
885
  }));
841
- function getProtocol(_x13) {
886
+ function getProtocol(_x14) {
842
887
  return _getProtocol.apply(this, arguments);
843
888
  }
844
889
  return getProtocol;
@@ -847,16 +892,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
847
892
  }, {
848
893
  key: "getProducts",
849
894
  value: function () {
850
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
851
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
852
- while (1) switch (_context15.prev = _context15.next) {
895
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
896
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
897
+ while (1) switch (_context16.prev = _context16.next) {
853
898
  case 0:
854
- return _context15.abrupt("return", this.store.products.getProducts());
899
+ return _context16.abrupt("return", this.store.products.getProducts());
855
900
  case 1:
856
901
  case "end":
857
- return _context15.stop();
902
+ return _context16.stop();
858
903
  }
859
- }, _callee15, this);
904
+ }, _callee16, this);
860
905
  }));
861
906
  function getProducts() {
862
907
  return _getProducts.apply(this, arguments);
@@ -866,15 +911,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
866
911
  }, {
867
912
  key: "setLoginAccount",
868
913
  value: function () {
869
- var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(accountId, accountInfo) {
914
+ var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(accountId, accountInfo) {
870
915
  var _this5 = this;
871
- var account, stateAccountId, cartItems, _this$store$date$getD2, date, normalProductCartItem;
872
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
873
- while (1) switch (_context16.prev = _context16.next) {
916
+ var account, stateAccountId, cartItems, _this$store$date$getD2, date, normalProductCartItem, customerId;
917
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
918
+ while (1) switch (_context17.prev = _context17.next) {
874
919
  case 0:
875
920
  account = this.store.accountList.getAccount(accountId);
876
921
  if (!account) {
877
- _context16.next = 11;
922
+ _context17.next = 23;
878
923
  break;
879
924
  }
880
925
  stateAccountId = account.getId();
@@ -891,29 +936,47 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
891
936
  }
892
937
  });
893
938
  this.store.accountList.updateAccountListById(stateAccountId, accountInfo);
894
- if (cartItems.length) {
895
- date = (_this$store$date$getD2 = this.store.date.getDateRange()) === null || _this$store$date$getD2 === void 0 || (_this$store$date$getD2 = _this$store$date$getD2[0]) === null || _this$store$date$getD2 === void 0 ? void 0 : _this$store$date$getD2.date;
896
- if (!date) {
897
- // 如果没有日期,则应该是 session 类先选商品的流程,直接从购物车里拿 start_date
898
- // 不能从购物车里第一个找时间,而是找到购物车里第一个有 start_date 的时间
899
- normalProductCartItem = cartItems.find(function (n) {
900
- return !isNormalProduct(n._productOrigin);
901
- });
902
- date = (normalProductCartItem === null || normalProductCartItem === void 0 ? void 0 : normalProductCartItem.start_date) || '';
903
- }
904
- this.updateQuotationPriceAndCart(date);
939
+ if (!cartItems.length) {
940
+ _context17.next = 21;
941
+ break;
942
+ }
943
+ date = (_this$store$date$getD2 = this.store.date.getDateRange()) === null || _this$store$date$getD2 === void 0 || (_this$store$date$getD2 = _this$store$date$getD2[0]) === null || _this$store$date$getD2 === void 0 ? void 0 : _this$store$date$getD2.date;
944
+ if (!date) {
945
+ // 如果没有日期,则应该是 session 类先选商品的流程,直接从购物车里拿 start_date
946
+ // 不能从购物车里第一个找时间,而是找到购物车里第一个有 start_date 的时间
947
+ normalProductCartItem = cartItems.find(function (n) {
948
+ return !isNormalProduct(n._productOrigin);
949
+ });
950
+ date = (normalProductCartItem === null || normalProductCartItem === void 0 ? void 0 : normalProductCartItem.start_date) || '';
905
951
  }
906
- _context16.next = 12;
952
+ this.updateQuotationPriceAndCart(date);
953
+
954
+ // 登录后刷新 holder 表单
955
+ _context17.prev = 12;
956
+ customerId = Number(accountInfo.id);
957
+ _context17.next = 16;
958
+ return this.refreshAllHolderFormRecords({
959
+ customer_id: customerId
960
+ });
961
+ case 16:
962
+ _context17.next = 21;
907
963
  break;
908
- case 11:
964
+ case 18:
965
+ _context17.prev = 18;
966
+ _context17.t0 = _context17["catch"](12);
967
+ console.error('[BookingByStep] 登录后刷新 holder 表单失败', _context17.t0);
968
+ case 21:
969
+ _context17.next = 24;
970
+ break;
971
+ case 23:
909
972
  throw new Error("\u6CA1\u6709\u627E\u5230".concat(accountId, "\u8D26\u6237"));
910
- case 12:
973
+ case 24:
911
974
  case "end":
912
- return _context16.stop();
975
+ return _context17.stop();
913
976
  }
914
- }, _callee16, this);
977
+ }, _callee17, this, [[12, 18]]);
915
978
  }));
916
- function setLoginAccount(_x14, _x15) {
979
+ function setLoginAccount(_x15, _x16) {
917
980
  return _setLoginAccount.apply(this, arguments);
918
981
  }
919
982
  return setLoginAccount;
@@ -921,14 +984,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
921
984
  }, {
922
985
  key: "generateCartData",
923
986
  value: function () {
924
- var _generateCartData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
925
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
926
- while (1) switch (_context17.prev = _context17.next) {
987
+ var _generateCartData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
988
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
989
+ while (1) switch (_context18.prev = _context18.next) {
927
990
  case 0:
928
991
  case "end":
929
- return _context17.stop();
992
+ return _context18.stop();
930
993
  }
931
- }, _callee17);
994
+ }, _callee18);
932
995
  }));
933
996
  function generateCartData() {
934
997
  return _generateCartData.apply(this, arguments);
@@ -938,23 +1001,23 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
938
1001
  }, {
939
1002
  key: "getFreeProduct",
940
1003
  value: function () {
941
- var _getFreeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(id) {
1004
+ var _getFreeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(id) {
942
1005
  var res;
943
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
944
- while (1) switch (_context18.prev = _context18.next) {
1006
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1007
+ while (1) switch (_context19.prev = _context19.next) {
945
1008
  case 0:
946
- _context18.next = 2;
1009
+ _context19.next = 2;
947
1010
  return this.request.post("/pay/order/free-pay/".concat(id));
948
1011
  case 2:
949
- res = _context18.sent;
950
- return _context18.abrupt("return", res);
1012
+ res = _context19.sent;
1013
+ return _context19.abrupt("return", res);
951
1014
  case 4:
952
1015
  case "end":
953
- return _context18.stop();
1016
+ return _context19.stop();
954
1017
  }
955
- }, _callee18, this);
1018
+ }, _callee19, this);
956
1019
  }));
957
- function getFreeProduct(_x16) {
1020
+ function getFreeProduct(_x17) {
958
1021
  return _getFreeProduct.apply(this, arguments);
959
1022
  }
960
1023
  return getFreeProduct;
@@ -977,11 +1040,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
977
1040
  }, {
978
1041
  key: "submitOrder",
979
1042
  value: function () {
980
- var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(extraData) {
1043
+ var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(extraData) {
981
1044
  var _this$otherParams4;
982
1045
  var cartItems, newCartItems, type;
983
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
984
- while (1) switch (_context19.prev = _context19.next) {
1046
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1047
+ while (1) switch (_context20.prev = _context20.next) {
985
1048
  case 0:
986
1049
  cartItems = this.store.cart.getItems();
987
1050
  newCartItems = cloneDeep(cartItems); // 先整个临时的逻辑,把购物车里所有商品的资源给他格式化一下
@@ -1011,7 +1074,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1011
1074
  }))) {
1012
1075
  type = 'virtual';
1013
1076
  }
1014
- return _context19.abrupt("return", this.store.order.submitOrder({
1077
+ return _context20.abrupt("return", this.store.order.submitOrder({
1015
1078
  query: {
1016
1079
  cartItems: newCartItems,
1017
1080
  type: type,
@@ -1022,11 +1085,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1022
1085
  }));
1023
1086
  case 6:
1024
1087
  case "end":
1025
- return _context19.stop();
1088
+ return _context20.stop();
1026
1089
  }
1027
- }, _callee19, this);
1090
+ }, _callee20, this);
1028
1091
  }));
1029
- function submitOrder(_x17) {
1092
+ function submitOrder(_x18) {
1030
1093
  return _submitOrder.apply(this, arguments);
1031
1094
  }
1032
1095
  return submitOrder;
@@ -1034,14 +1097,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1034
1097
  }, {
1035
1098
  key: "pay",
1036
1099
  value: function () {
1037
- var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1038
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1039
- while (1) switch (_context20.prev = _context20.next) {
1100
+ var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1101
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1102
+ while (1) switch (_context21.prev = _context21.next) {
1040
1103
  case 0:
1041
1104
  case "end":
1042
- return _context20.stop();
1105
+ return _context21.stop();
1043
1106
  }
1044
- }, _callee20);
1107
+ }, _callee21);
1045
1108
  }));
1046
1109
  function pay() {
1047
1110
  return _pay.apply(this, arguments);
@@ -1051,14 +1114,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1051
1114
  }, {
1052
1115
  key: "getPayInfo",
1053
1116
  value: function () {
1054
- var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1055
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1056
- while (1) switch (_context21.prev = _context21.next) {
1117
+ var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1118
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1119
+ while (1) switch (_context22.prev = _context22.next) {
1057
1120
  case 0:
1058
1121
  case "end":
1059
- return _context21.stop();
1122
+ return _context22.stop();
1060
1123
  }
1061
- }, _callee21);
1124
+ }, _callee22);
1062
1125
  }));
1063
1126
  function getPayInfo() {
1064
1127
  return _getPayInfo.apply(this, arguments);
@@ -1068,15 +1131,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1068
1131
  }, {
1069
1132
  key: "setOtherParams",
1070
1133
  value: function () {
1071
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
1134
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
1072
1135
  var _ref5,
1073
1136
  _ref5$cover,
1074
1137
  cover,
1075
- _args22 = arguments;
1076
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1077
- while (1) switch (_context22.prev = _context22.next) {
1138
+ _args23 = arguments;
1139
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1140
+ while (1) switch (_context23.prev = _context23.next) {
1078
1141
  case 0:
1079
- _ref5 = _args22.length > 1 && _args22[1] !== undefined ? _args22[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
1142
+ _ref5 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
1080
1143
  if (cover) {
1081
1144
  this.otherParams = params;
1082
1145
  } else {
@@ -1084,11 +1147,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1084
1147
  }
1085
1148
  case 2:
1086
1149
  case "end":
1087
- return _context22.stop();
1150
+ return _context23.stop();
1088
1151
  }
1089
- }, _callee22, this);
1152
+ }, _callee23, this);
1090
1153
  }));
1091
- function setOtherParams(_x18) {
1154
+ function setOtherParams(_x19) {
1092
1155
  return _setOtherParams.apply(this, arguments);
1093
1156
  }
1094
1157
  return setOtherParams;
@@ -1096,16 +1159,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1096
1159
  }, {
1097
1160
  key: "getOtherParams",
1098
1161
  value: function () {
1099
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1100
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1101
- while (1) switch (_context23.prev = _context23.next) {
1162
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1163
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1164
+ while (1) switch (_context24.prev = _context24.next) {
1102
1165
  case 0:
1103
- return _context23.abrupt("return", this.otherParams);
1166
+ return _context24.abrupt("return", this.otherParams);
1104
1167
  case 1:
1105
1168
  case "end":
1106
- return _context23.stop();
1169
+ return _context24.stop();
1107
1170
  }
1108
- }, _callee23, this);
1171
+ }, _callee24, this);
1109
1172
  }));
1110
1173
  function getOtherParams() {
1111
1174
  return _getOtherParams.apply(this, arguments);
@@ -1194,6 +1257,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1194
1257
  account = activeAccount;
1195
1258
  }
1196
1259
  }
1260
+ try {
1261
+ this.store.holder.ensureFormByProduct({
1262
+ product: productData,
1263
+ shop_id: (productData === null || productData === void 0 ? void 0 : productData.shop_id) || '',
1264
+ useCache: true
1265
+ });
1266
+ } catch (error) {
1267
+ console.error('[BookingByStep] 加载 holder 表单失败', error);
1268
+ }
1197
1269
  var flag = this.store.cart.mergeCartItemByRowKey({
1198
1270
  rowKey: rowKey,
1199
1271
  quantity: quantity,
@@ -2269,14 +2341,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2269
2341
  }, {
2270
2342
  key: "getTimeSlotByAllResourcesForDate",
2271
2343
  value: function () {
2272
- var _getTimeSlotByAllResourcesForDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(_ref10) {
2344
+ var _getTimeSlotByAllResourcesForDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(_ref10) {
2273
2345
  var _this13 = this,
2274
2346
  _cartItems$5,
2275
2347
  _cartItems$6,
2276
2348
  _this$shopStore$get2;
2277
2349
  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;
2278
- return _regeneratorRuntime().wrap(function _callee24$(_context25) {
2279
- while (1) switch (_context25.prev = _context25.next) {
2350
+ return _regeneratorRuntime().wrap(function _callee25$(_context26) {
2351
+ while (1) switch (_context26.prev = _context26.next) {
2280
2352
  case 0:
2281
2353
  resources_code = _ref10.resources_code, startDate = _ref10.startDate, endDate = _ref10.endDate;
2282
2354
  // 如果 end_date 距离start_date小于 30 天,自动追加 end_date 为今天往后的 30 天
@@ -2284,7 +2356,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2284
2356
  endDate = dayjs(startDate).add(30, 'day').format('YYYY-MM-DD');
2285
2357
  }
2286
2358
  // 预请求资源数据,防止日期超过之前选择的范围
2287
- _context25.next = 4;
2359
+ _context26.next = 4;
2288
2360
  return this.getAvailableDate({
2289
2361
  startDate: startDate,
2290
2362
  endDate: endDate,
@@ -2330,10 +2402,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2330
2402
 
2331
2403
  // 保护: 如果 resources 为空则直接 return
2332
2404
  if (resources.length) {
2333
- _context25.next = 14;
2405
+ _context26.next = 14;
2334
2406
  break;
2335
2407
  }
2336
- return _context25.abrupt("return", []);
2408
+ return _context26.abrupt("return", []);
2337
2409
  case 14:
2338
2410
  duration = 0; // duration = 不同账号的最长时间
2339
2411
  accountList = this.store.accountList.getAccounts();
@@ -2367,10 +2439,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2367
2439
  // 如果 cartItem 上既没有时间,也没有资源,认为外部属于异常调用,直接丢一个空数组出去
2368
2440
  // 同时 session 类商品的流程也不应该调用这个方法
2369
2441
  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))) {
2370
- _context25.next = 20;
2442
+ _context26.next = 20;
2371
2443
  break;
2372
2444
  }
2373
- return _context25.abrupt("return", []);
2445
+ return _context26.abrupt("return", []);
2374
2446
  case 20:
2375
2447
  resourcesUseableMap = {};
2376
2448
  hasFlexibleDuration = cartItems.some(function (item) {
@@ -2424,8 +2496,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2424
2496
  today = dayjs().startOf('day'); // 计算 start_date 到 end_date 之间的所有日期,遍历他们并且计算每一天的可用
2425
2497
  _loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() {
2426
2498
  var currentDate, theDateResources, resourcesMap, timeSlots;
2427
- return _regeneratorRuntime().wrap(function _loop2$(_context24) {
2428
- while (1) switch (_context24.prev = _context24.next) {
2499
+ return _regeneratorRuntime().wrap(function _loop2$(_context25) {
2500
+ while (1) switch (_context25.prev = _context25.next) {
2429
2501
  case 0:
2430
2502
  currentDate = i.format('YYYY-MM-DD');
2431
2503
  theDateResources = _this13.store.date.getResourcesListByDate(currentDate);
@@ -2437,7 +2509,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2437
2509
  });
2438
2510
  resourcesMap = getResourcesMap(resources); // 如果日期已经过期则直接标记为不可用
2439
2511
  if (!i.isBefore(today)) {
2440
- _context24.next = 7;
2512
+ _context25.next = 7;
2441
2513
  break;
2442
2514
  }
2443
2515
  arr.push({
@@ -2446,7 +2518,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2446
2518
  week: i.format('ddd'),
2447
2519
  weekNum: i.day()
2448
2520
  });
2449
- return _context24.abrupt("return", 1);
2521
+ return _context25.abrupt("return", 1);
2450
2522
  case 7:
2451
2523
  timeSlots = getTimeSlicesByResources({
2452
2524
  resourceIds: resourceIds,
@@ -2478,36 +2550,36 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2478
2550
  }
2479
2551
  case 9:
2480
2552
  case "end":
2481
- return _context24.stop();
2553
+ return _context25.stop();
2482
2554
  }
2483
2555
  }, _loop2);
2484
2556
  });
2485
2557
  i = dayjs(startDate);
2486
2558
  case 32:
2487
2559
  if (!i.isBefore(dayjs(endDate))) {
2488
- _context25.next = 39;
2560
+ _context26.next = 39;
2489
2561
  break;
2490
2562
  }
2491
- return _context25.delegateYield(_loop2(), "t0", 34);
2563
+ return _context26.delegateYield(_loop2(), "t0", 34);
2492
2564
  case 34:
2493
- if (!_context25.t0) {
2494
- _context25.next = 36;
2565
+ if (!_context26.t0) {
2566
+ _context26.next = 36;
2495
2567
  break;
2496
2568
  }
2497
- return _context25.abrupt("continue", 36);
2569
+ return _context26.abrupt("continue", 36);
2498
2570
  case 36:
2499
2571
  i = i.add(1, 'day');
2500
- _context25.next = 32;
2572
+ _context26.next = 32;
2501
2573
  break;
2502
2574
  case 39:
2503
- return _context25.abrupt("return", arr);
2575
+ return _context26.abrupt("return", arr);
2504
2576
  case 40:
2505
2577
  case "end":
2506
- return _context25.stop();
2578
+ return _context26.stop();
2507
2579
  }
2508
- }, _callee24, this);
2580
+ }, _callee25, this);
2509
2581
  }));
2510
- function getTimeSlotByAllResourcesForDate(_x19) {
2582
+ function getTimeSlotByAllResourcesForDate(_x20) {
2511
2583
  return _getTimeSlotByAllResourcesForDate.apply(this, arguments);
2512
2584
  }
2513
2585
  return getTimeSlotByAllResourcesForDate;
@@ -2688,42 +2760,42 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2688
2760
  }, {
2689
2761
  key: "openProductDetail",
2690
2762
  value: function () {
2691
- var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(productId) {
2763
+ var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(productId) {
2692
2764
  var targetProductData, newScheduleArr, dateRange;
2693
- return _regeneratorRuntime().wrap(function _callee25$(_context26) {
2694
- while (1) switch (_context26.prev = _context26.next) {
2765
+ return _regeneratorRuntime().wrap(function _callee26$(_context27) {
2766
+ while (1) switch (_context27.prev = _context27.next) {
2695
2767
  case 0:
2696
- _context26.next = 2;
2768
+ _context27.next = 2;
2697
2769
  return this.store.products.getProduct(productId);
2698
2770
  case 2:
2699
- targetProductData = _context26.sent;
2771
+ targetProductData = _context27.sent;
2700
2772
  if (!targetProductData) {
2701
- _context26.next = 17;
2773
+ _context27.next = 17;
2702
2774
  break;
2703
2775
  }
2704
2776
  this.store.currentProduct = targetProductData;
2705
2777
  this.store.currentProductMeta = {};
2706
2778
  // 资源预加载,如果是 duration 类型的商品,且是先选日期的流程,在这里预拉取资源数据
2707
2779
  if (!targetProductData['schedule.ids']) {
2708
- _context26.next = 12;
2780
+ _context27.next = 12;
2709
2781
  break;
2710
2782
  }
2711
2783
  newScheduleArr = this.getScheduleDataByIds(targetProductData['schedule.ids']);
2712
2784
  if (!this.store.currentProductMeta) this.store.currentProductMeta = {};
2713
2785
  this.store.currentProductMeta.schedule = newScheduleArr;
2714
- _context26.next = 17;
2786
+ _context27.next = 17;
2715
2787
  break;
2716
2788
  case 12:
2717
2789
  if (!targetProductData.duration) {
2718
- _context26.next = 17;
2790
+ _context27.next = 17;
2719
2791
  break;
2720
2792
  }
2721
2793
  dateRange = this.store.date.getDateRange(); // 如果不是先选日期的流程 duration 商品就啥也不做
2722
2794
  if (dateRange !== null && dateRange !== void 0 && dateRange.length) {
2723
- _context26.next = 16;
2795
+ _context27.next = 16;
2724
2796
  break;
2725
2797
  }
2726
- return _context26.abrupt("return");
2798
+ return _context27.abrupt("return");
2727
2799
  case 16:
2728
2800
  // this.store.date.getResourceDates({
2729
2801
  // query: {
@@ -2739,11 +2811,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2739
2811
  });
2740
2812
  case 17:
2741
2813
  case "end":
2742
- return _context26.stop();
2814
+ return _context27.stop();
2743
2815
  }
2744
- }, _callee25, this);
2816
+ }, _callee26, this);
2745
2817
  }));
2746
- function openProductDetail(_x20) {
2818
+ function openProductDetail(_x21) {
2747
2819
  return _openProductDetail.apply(this, arguments);
2748
2820
  }
2749
2821
  return openProductDetail;
@@ -3994,41 +4066,41 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
3994
4066
  }, {
3995
4067
  key: "getProductTypeById",
3996
4068
  value: function () {
3997
- var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(id) {
4069
+ var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(id) {
3998
4070
  var productData, _productData$schedule;
3999
- return _regeneratorRuntime().wrap(function _callee26$(_context27) {
4000
- while (1) switch (_context27.prev = _context27.next) {
4071
+ return _regeneratorRuntime().wrap(function _callee27$(_context28) {
4072
+ while (1) switch (_context28.prev = _context28.next) {
4001
4073
  case 0:
4002
- _context27.next = 2;
4074
+ _context28.next = 2;
4003
4075
  return this.store.products.getProduct(id);
4004
4076
  case 2:
4005
- productData = _context27.sent;
4077
+ productData = _context28.sent;
4006
4078
  if (!productData) {
4007
- _context27.next = 9;
4079
+ _context28.next = 9;
4008
4080
  break;
4009
4081
  }
4010
4082
  if (!productData.duration) {
4011
- _context27.next = 6;
4083
+ _context28.next = 6;
4012
4084
  break;
4013
4085
  }
4014
- return _context27.abrupt("return", 'duration');
4086
+ return _context28.abrupt("return", 'duration');
4015
4087
  case 6:
4016
4088
  if (!((_productData$schedule = productData['schedule.ids']) !== null && _productData$schedule !== void 0 && _productData$schedule.length)) {
4017
- _context27.next = 8;
4089
+ _context28.next = 8;
4018
4090
  break;
4019
4091
  }
4020
- return _context27.abrupt("return", 'session');
4092
+ return _context28.abrupt("return", 'session');
4021
4093
  case 8:
4022
- return _context27.abrupt("return", 'normal');
4094
+ return _context28.abrupt("return", 'normal');
4023
4095
  case 9:
4024
- return _context27.abrupt("return", 'normal');
4096
+ return _context28.abrupt("return", 'normal');
4025
4097
  case 10:
4026
4098
  case "end":
4027
- return _context27.stop();
4099
+ return _context28.stop();
4028
4100
  }
4029
- }, _callee26, this);
4101
+ }, _callee27, this);
4030
4102
  }));
4031
- function getProductTypeById(_x21) {
4103
+ function getProductTypeById(_x22) {
4032
4104
  return _getProductTypeById.apply(this, arguments);
4033
4105
  }
4034
4106
  return getProductTypeById;
@@ -4148,10 +4220,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
4148
4220
  }, {
4149
4221
  key: "getTimeslotsScheduleByDateRange",
4150
4222
  value: (function () {
4151
- var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(_ref16) {
4223
+ var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(_ref16) {
4152
4224
  var startDate, endDate, scheduleIds, resources, dates, currentDate, end, results, _i5, _dates, date;
4153
- return _regeneratorRuntime().wrap(function _callee27$(_context28) {
4154
- while (1) switch (_context28.prev = _context28.next) {
4225
+ return _regeneratorRuntime().wrap(function _callee28$(_context29) {
4226
+ while (1) switch (_context29.prev = _context29.next) {
4155
4227
  case 0:
4156
4228
  startDate = _ref16.startDate, endDate = _ref16.endDate, scheduleIds = _ref16.scheduleIds, resources = _ref16.resources;
4157
4229
  console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
@@ -4178,14 +4250,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
4178
4250
  resources: resources
4179
4251
  });
4180
4252
  }
4181
- return _context28.abrupt("return", results);
4253
+ return _context29.abrupt("return", results);
4182
4254
  case 9:
4183
4255
  case "end":
4184
- return _context28.stop();
4256
+ return _context29.stop();
4185
4257
  }
4186
- }, _callee27, this);
4258
+ }, _callee28, this);
4187
4259
  }));
4188
- function getTimeslotsScheduleByDateRange(_x22) {
4260
+ function getTimeslotsScheduleByDateRange(_x23) {
4189
4261
  return _getTimeslotsScheduleByDateRange.apply(this, arguments);
4190
4262
  }
4191
4263
  return getTimeslotsScheduleByDateRange;
@@ -4193,7 +4265,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
4193
4265
  }, {
4194
4266
  key: "getAvailableDateForSessionOptimize",
4195
4267
  value: function () {
4196
- var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
4268
+ var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
4197
4269
  var _this$store$currentPr3, _this$store$currentPr4, _tempProducts;
4198
4270
  var params,
4199
4271
  startDate,
@@ -4213,11 +4285,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
4213
4285
  allProductResources,
4214
4286
  targetSchedules,
4215
4287
  _loop8,
4216
- _args30 = arguments;
4217
- return _regeneratorRuntime().wrap(function _callee28$(_context30) {
4218
- while (1) switch (_context30.prev = _context30.next) {
4288
+ _args31 = arguments;
4289
+ return _regeneratorRuntime().wrap(function _callee29$(_context31) {
4290
+ while (1) switch (_context31.prev = _context31.next) {
4219
4291
  case 0:
4220
- params = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {};
4292
+ params = _args31.length > 0 && _args31[0] !== undefined ? _args31[0] : {};
4221
4293
  // 开始日期如果小于今天,直接以今天当做开始日期
4222
4294
  startDate = params.startDate, endDate = params.endDate; // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天 且 endDate 小于或等于今天,需要把 startDate 置为今天
4223
4295
  if (dayjs(startDate).isBefore(dayjs(), 'day') && (dayjs(endDate).isAfter(dayjs(), 'day') || dayjs(endDate).isSame(dayjs(), 'day'))) {
@@ -4242,15 +4314,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
4242
4314
  // 先去读缓存结果,因为正常 UI 调用的是 7 天,而下面我会直接计算 30 天(最少也是 14 天),所以先去读缓存结果,如果缓存结果存在,则直接返回
4243
4315
  cache = (_this$store$currentPr3 = this.store.currentProductMeta) === null || _this$store$currentPr3 === void 0 ? void 0 : _this$store$currentPr3['timeSlotBySchedule'];
4244
4316
  if (!cache) {
4245
- _context30.next = 13;
4317
+ _context31.next = 13;
4246
4318
  break;
4247
4319
  }
4248
4320
  if (!(dayjs(params.startDate).isSameOrAfter(dayjs(cache.startDate), 'day') && dayjs(params.endDate).isSameOrBefore(dayjs(cache.endDate), 'day'))) {
4249
- _context30.next = 13;
4321
+ _context31.next = 13;
4250
4322
  break;
4251
4323
  }
4252
4324
  this.store.date.setDateList(cache.dateList);
4253
- return _context30.abrupt("return", {
4325
+ return _context31.abrupt("return", {
4254
4326
  dateList: cache.dateList,
4255
4327
  firstAvailableDate: cache.firstAvailableDate
4256
4328
  });
@@ -4260,7 +4332,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
4260
4332
  schedule = (_this$store$currentPr4 = this.store.currentProductMeta) === null || _this$store$currentPr4 === void 0 ? void 0 : _this$store$currentPr4['schedule'];
4261
4333
  filteredSchedule = filterScheduleByDateRange(schedule, startDate || '', endDate || ''); // 1.后端返回的数据,确定资源在每一天的可用和使用情况
4262
4334
  tempResourceIds = getResourcesIdsByProduct(tempProducts);
4263
- _context30.next = 19;
4335
+ _context31.next = 19;
4264
4336
  return this.store.date.fetchResourceDates({
4265
4337
  query: {
4266
4338
  start_date: startDate || '',
@@ -4269,7 +4341,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
4269
4341
  }
4270
4342
  });
4271
4343
  case 19:
4272
- res = _context30.sent;
4344
+ res = _context31.sent;
4273
4345
  // 2. 商品 schedule 数据,确定日程在每一天的时间片
4274
4346
  // 3. 把后端返回的和 schedule 的数据进行合并,确定每一天的可用和使用情况
4275
4347
  dates = [];
@@ -4291,8 +4363,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
4291
4363
  targetSchedules = this.store.schedule.getScheduleListByIds(tempProducts['schedule.ids']);
4292
4364
  _loop8 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop8() {
4293
4365
  var currentDateStr, status, summaryCount, availableCount, _checkSessionProductL, latestStartDate, earliestEndDate, scheduleByDate, minTimeMaxTime, scheduleTimeSlots, timesSlotCanUse, dateStatus, usageRatio;
4294
- return _regeneratorRuntime().wrap(function _loop8$(_context29) {
4295
- while (1) switch (_context29.prev = _context29.next) {
4366
+ return _regeneratorRuntime().wrap(function _loop8$(_context30) {
4367
+ while (1) switch (_context30.prev = _context30.next) {
4296
4368
  case 0:
4297
4369
  currentDateStr = currentDate.format('YYYY-MM-DD');
4298
4370
  status = 'available';
@@ -4451,32 +4523,32 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
4451
4523
 
4452
4524
  // 如果 firstAvailableDate 距离 startDate 大于 14 天了,则后面就不需要再找了,也是一种性能保护
4453
4525
  if (!(firstAvailableDate && dayjs(currentDate).diff(dayjs(startDate), 'day') > 31)) {
4454
- _context29.next = 12;
4526
+ _context30.next = 12;
4455
4527
  break;
4456
4528
  }
4457
- return _context29.abrupt("return", 1);
4529
+ return _context30.abrupt("return", 1);
4458
4530
  case 12:
4459
4531
  currentDate = dayjs(currentDate).add(1, 'day');
4460
4532
  case 13:
4461
4533
  case "end":
4462
- return _context29.stop();
4534
+ return _context30.stop();
4463
4535
  }
4464
4536
  }, _loop8);
4465
4537
  });
4466
4538
  case 28:
4467
4539
  if (!(dayjs(currentDate).isBefore(dayjs(endDate), 'day') || dayjs(currentDate).isSame(dayjs(endDate), 'day'))) {
4468
- _context30.next = 34;
4540
+ _context31.next = 34;
4469
4541
  break;
4470
4542
  }
4471
- return _context30.delegateYield(_loop8(), "t0", 30);
4543
+ return _context31.delegateYield(_loop8(), "t0", 30);
4472
4544
  case 30:
4473
- if (!_context30.t0) {
4474
- _context30.next = 32;
4545
+ if (!_context31.t0) {
4546
+ _context31.next = 32;
4475
4547
  break;
4476
4548
  }
4477
- return _context30.abrupt("break", 34);
4549
+ return _context31.abrupt("break", 34);
4478
4550
  case 32:
4479
- _context30.next = 28;
4551
+ _context31.next = 28;
4480
4552
  break;
4481
4553
  case 34:
4482
4554
  // 最终把资源数据也加到日期内
@@ -4491,15 +4563,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
4491
4563
  startDate: startDate,
4492
4564
  endDate: dayjs(currentDate).format('YYYY-MM-DD')
4493
4565
  };
4494
- return _context30.abrupt("return", {
4566
+ return _context31.abrupt("return", {
4495
4567
  dateList: dates,
4496
4568
  firstAvailableDate: firstAvailableDate
4497
4569
  });
4498
4570
  case 39:
4499
4571
  case "end":
4500
- return _context30.stop();
4572
+ return _context31.stop();
4501
4573
  }
4502
- }, _callee28, this);
4574
+ }, _callee29, this);
4503
4575
  }));
4504
4576
  function getAvailableDateForSessionOptimize() {
4505
4577
  return _getAvailableDateForSessionOptimize.apply(this, arguments);
@@ -4546,18 +4618,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
4546
4618
  }, {
4547
4619
  key: "getContactInfo",
4548
4620
  value: (function () {
4549
- var _getContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
4550
- return _regeneratorRuntime().wrap(function _callee29$(_context31) {
4551
- while (1) switch (_context31.prev = _context31.next) {
4621
+ var _getContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
4622
+ return _regeneratorRuntime().wrap(function _callee30$(_context32) {
4623
+ while (1) switch (_context32.prev = _context32.next) {
4552
4624
  case 0:
4553
- return _context31.abrupt("return", this.request.get('/customer/metadata', params));
4625
+ return _context32.abrupt("return", this.request.get('/customer/metadata', params));
4554
4626
  case 1:
4555
4627
  case "end":
4556
- return _context31.stop();
4628
+ return _context32.stop();
4557
4629
  }
4558
- }, _callee29, this);
4630
+ }, _callee30, this);
4559
4631
  }));
4560
- function getContactInfo(_x23) {
4632
+ function getContactInfo(_x24) {
4561
4633
  return _getContactInfo.apply(this, arguments);
4562
4634
  }
4563
4635
  return getContactInfo;