@pisell/pisellos 2.1.100 → 2.1.101

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 (80) hide show
  1. package/dist/effects/index.d.ts +2 -2
  2. package/dist/modules/Customer/types.d.ts +1 -1
  3. package/dist/modules/Payment/types.d.ts +7 -7
  4. package/dist/modules/Rules/types.d.ts +1 -1
  5. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  6. package/dist/modules/Schedule/type.d.ts +7 -7
  7. package/dist/modules/Schedule/types.d.ts +9 -9
  8. package/dist/solution/BookingByStep/index.d.ts +1 -1
  9. package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
  10. package/dist/solution/ShopDiscount/types.d.ts +1 -1
  11. package/dist/solution/ShopDiscount/utils.d.ts +2 -2
  12. package/dist/types/index.d.ts +1 -1
  13. package/dist/utils/task.d.ts +2 -2
  14. package/dist/utils/watch.d.ts +2 -2
  15. package/lib/core/index.js +28 -27
  16. package/lib/effects/index.d.ts +2 -2
  17. package/lib/effects/index.js +7 -3
  18. package/lib/modules/Account/index.js +10 -9
  19. package/lib/modules/AccountList/index.js +11 -14
  20. package/lib/modules/BaseModule.js +3 -6
  21. package/lib/modules/Cart/index.js +9 -14
  22. package/lib/modules/Cart/utils/cartProduct.js +6 -3
  23. package/lib/modules/Customer/constants.js +1 -1
  24. package/lib/modules/Customer/index.js +15 -18
  25. package/lib/modules/Customer/types.d.ts +1 -1
  26. package/lib/modules/Date/index.js +6 -10
  27. package/lib/modules/Date/types.js +0 -1
  28. package/lib/modules/Discount/index.js +6 -11
  29. package/lib/modules/Guests/index.js +15 -10
  30. package/lib/modules/Order/index.js +7 -10
  31. package/lib/modules/Payment/cash.js +1 -1
  32. package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
  33. package/lib/modules/Payment/eftpos.js +1 -1
  34. package/lib/modules/Payment/index.js +73 -84
  35. package/lib/modules/Payment/types.d.ts +7 -7
  36. package/lib/modules/Payment/utils.js +6 -3
  37. package/lib/modules/Payment/walletpass.js +31 -31
  38. package/lib/modules/Product/index.js +5 -6
  39. package/lib/modules/ProductList/index.js +3 -5
  40. package/lib/modules/Resource/index.js +12 -8
  41. package/lib/modules/Rules/index.js +35 -21
  42. package/lib/modules/Rules/types.d.ts +1 -1
  43. package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  44. package/lib/modules/Schedule/index.js +5 -8
  45. package/lib/modules/Schedule/type.d.ts +7 -7
  46. package/lib/modules/Schedule/types.d.ts +9 -9
  47. package/lib/modules/Schedule/utils.js +4 -2
  48. package/lib/modules/Step/index.js +4 -7
  49. package/lib/modules/Summary/index.js +4 -9
  50. package/lib/modules/Summary/utils.js +16 -8
  51. package/lib/plugins/request.js +33 -34
  52. package/lib/plugins/window.js +113 -101
  53. package/lib/solution/BookingByStep/index.d.ts +1 -1
  54. package/lib/solution/BookingByStep/index.js +177 -110
  55. package/lib/solution/BookingByStep/utils/capacity.js +16 -11
  56. package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
  57. package/lib/solution/BookingByStep/utils/resources.js +8 -4
  58. package/lib/solution/BookingByStep/utils/stock.js +6 -3
  59. package/lib/solution/BookingByStep/utils/timeslots.js +27 -24
  60. package/lib/solution/BookingTicket/index.js +14 -19
  61. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
  62. package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
  63. package/lib/solution/BookingTicket/utils/scan/index.js +1 -3
  64. package/lib/solution/BookingTicket/utils/scan/scanCache.js +9 -10
  65. package/lib/solution/BuyTickets/index.js +15 -15
  66. package/lib/solution/Checkout/index.js +211 -216
  67. package/lib/solution/Checkout/utils/index.js +22 -18
  68. package/lib/solution/RegisterAndLogin/config.js +2 -2
  69. package/lib/solution/RegisterAndLogin/index.js +110 -114
  70. package/lib/solution/RegisterAndLogin/utils.js +9 -9
  71. package/lib/solution/ShopDiscount/index.js +13 -16
  72. package/lib/solution/ShopDiscount/types.d.ts +1 -1
  73. package/lib/solution/ShopDiscount/utils.d.ts +2 -2
  74. package/lib/solution/ShopDiscount/utils.js +2 -1
  75. package/lib/types/index.d.ts +1 -1
  76. package/lib/utils/task.d.ts +2 -2
  77. package/lib/utils/task.js +3 -3
  78. package/lib/utils/watch.d.ts +2 -2
  79. package/lib/utils/watch.js +7 -5
  80. package/package.json +17 -16
@@ -52,33 +52,29 @@ var import_stock = require("./utils/stock");
52
52
  import_dayjs.default.extend(import_isSameOrBefore.default);
53
53
  import_dayjs.default.extend(import_isSameOrAfter.default);
54
54
  var BookingByStepImpl = class extends import_BaseModule.BaseModule {
55
- defaultName = "bookingByStep";
56
- defaultVersion = "1.0.0";
57
- isSolution = true;
58
- request;
59
- window;
60
- shopStore;
61
- store;
62
- otherParams = {};
63
- cacheId;
64
- otherData = {};
65
- // 提供给 UI 层的临时数据存储,会进缓存
66
- platform;
55
+ constructor() {
56
+ super(...arguments);
57
+ this.defaultName = "bookingByStep";
58
+ this.defaultVersion = "1.0.0";
59
+ this.isSolution = true;
60
+ this.otherParams = {};
61
+ this.otherData = {};
62
+ }
67
63
  // 平台类型,用于判断是 PC / H5
68
64
  async initialize(core, options) {
69
65
  var _a, _b, _c, _d, _e;
70
66
  this.core = core;
71
67
  this.store = options.store || {};
72
68
  this.otherParams = options.otherParams || {};
73
- console.log("[BookingByStep] \u521D\u59CB\u5316\u5B8C\u6210");
69
+ console.log("[BookingByStep] 初始化完成");
74
70
  this.request = core.getPlugin("request");
75
71
  this.window = core.getPlugin("window");
76
72
  this.shopStore = core.getPlugin("shopStore");
77
73
  if (!this.request) {
78
- throw new Error("bookingByStep\u89E3\u51B3\u65B9\u6848\u9700\u8981 request \u63D2\u4EF6\u652F\u6301");
74
+ throw new Error("bookingByStep解决方案需要 request 插件支持");
79
75
  }
80
76
  if (!this.shopStore) {
81
- throw new Error("SummaryModule \u9700\u8981 shopStore \u63D2\u4EF6\u652F\u6301");
77
+ throw new Error("SummaryModule 需要 shopStore 插件支持");
82
78
  }
83
79
  let targetCacheData = {};
84
80
  this.cacheId = (_a = this.otherParams) == null ? void 0 : _a.cacheId;
@@ -116,7 +112,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
116
112
  }
117
113
  });
118
114
  } else {
119
- throw new Error(`\u6A21\u5757 ${step} \u4E0D\u5B58\u5728`);
115
+ throw new Error(`模块 ${step} 不存在`);
120
116
  }
121
117
  });
122
118
  this.store.schedule.loadAllSchedule();
@@ -492,7 +488,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
492
488
  this.updateQuotationPriceAndCart(date);
493
489
  }
494
490
  } else {
495
- throw new Error(`\u6CA1\u6709\u627E\u5230${accountId}\u8D26\u6237`);
491
+ throw new Error(`没有找到${accountId}账户`);
496
492
  }
497
493
  }
498
494
  // 生成购物车的正规数据
@@ -702,7 +698,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
702
698
  updateCart(params) {
703
699
  const targetCartItem = this.store.cart.getItem(params._id);
704
700
  if (!targetCartItem) {
705
- throw new Error(`\u6CA1\u6709\u627E\u5230${params._id}\u8D2D\u7269\u8F66\u5546\u54C1`);
701
+ throw new Error(`没有找到${params._id}购物车商品`);
706
702
  }
707
703
  this.beforeUpdateCart(params, targetCartItem);
708
704
  this.store.cart.updateItem(params);
@@ -729,13 +725,15 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
729
725
  const dateRange = this.store.date.getDateRange();
730
726
  if (dateRange == null ? void 0 : dateRange.length) {
731
727
  dateRange.forEach((n) => {
732
- if (n.resource) allOriginResources.push(...n.resource);
728
+ if (n.resource)
729
+ allOriginResources.push(...n.resource);
733
730
  });
734
731
  }
735
732
  if (!allOriginResources.length) {
736
733
  const dateList = this.store.date.getDateList();
737
734
  dateList == null ? void 0 : dateList.forEach((n) => {
738
- if (n.resource) allOriginResources.push(...n.resource);
735
+ if (n.resource)
736
+ allOriginResources.push(...n.resource);
739
737
  });
740
738
  }
741
739
  if (params.resources) {
@@ -864,7 +862,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
864
862
  const resources = [];
865
863
  if (dateRange == null ? void 0 : dateRange.length) {
866
864
  dateRange.forEach((n) => {
867
- if (n.resource) resources.push(...n.resource);
865
+ if (n.resource)
866
+ resources.push(...n.resource);
868
867
  });
869
868
  }
870
869
  const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils5.isNormalProduct)(n._productOrigin));
@@ -878,7 +877,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
878
877
  } else {
879
878
  const dateList = this.store.date.getDateList();
880
879
  dateList == null ? void 0 : dateList.forEach((n) => {
881
- if (n.resource) resources.push(...n.resource);
880
+ if (n.resource)
881
+ resources.push(...n.resource);
882
882
  });
883
883
  }
884
884
  }
@@ -947,7 +947,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
947
947
  }
948
948
  return res.usable;
949
949
  });
950
- if (m.onlyComputed) return false;
950
+ if (m.onlyComputed)
951
+ return false;
951
952
  return !canUseArr.some((n2) => n2 === false);
952
953
  });
953
954
  });
@@ -959,7 +960,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
959
960
  item.renderList = item.renderList.filter((n) => {
960
961
  var _a2, _b2, _c2;
961
962
  const recordCount = n.capacity || 0;
962
- if (n.onlyComputed) return false;
963
+ if (n.onlyComputed)
964
+ return false;
963
965
  const timeSlots = (0, import_resources.getTimeSlicesByResource)({
964
966
  resource: n,
965
967
  duration: ((_b2 = (_a2 = cartItem._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) || 10,
@@ -1013,12 +1015,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1013
1015
  const dateRange = this.store.date.getDateRange();
1014
1016
  const resources = [];
1015
1017
  dateRange.forEach((n) => {
1016
- if (n.resource) resources.push(...n.resource);
1018
+ if (n.resource)
1019
+ resources.push(...n.resource);
1017
1020
  });
1018
1021
  const resourcesMap = (0, import_utils2.getResourcesMap)(resources);
1019
1022
  const targetCartItem = cartItems.find((n) => n._id === id);
1020
1023
  if (!targetCartItem) {
1021
- throw new Error(`\u6CA1\u6709\u627E\u5230${id}\u8D2D\u7269\u8F66\u5546\u54C1`);
1024
+ throw new Error(`没有找到${id}购物车商品`);
1022
1025
  }
1023
1026
  let selectedResources = [];
1024
1027
  const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(targetCartItem);
@@ -1044,7 +1047,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1044
1047
  productResources.forEach((item) => {
1045
1048
  item.renderList = item.renderList.filter((n) => {
1046
1049
  const recordCount = n.capacity || 0;
1047
- if (n.onlyComputed) return false;
1050
+ if (n.onlyComputed)
1051
+ return false;
1048
1052
  return recordCount >= currentCapacity;
1049
1053
  });
1050
1054
  });
@@ -1087,7 +1091,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1087
1091
  let AllResources = [];
1088
1092
  if (dateRange == null ? void 0 : dateRange.length) {
1089
1093
  dateRange.forEach((n) => {
1090
- if (n.resource) AllResources.push(...n.resource);
1094
+ if (n.resource)
1095
+ AllResources.push(...n.resource);
1091
1096
  });
1092
1097
  }
1093
1098
  if (!AllResources.length) {
@@ -1100,7 +1105,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1100
1105
  } else {
1101
1106
  const dateList = this.store.date.getDateList();
1102
1107
  dateList.forEach((n) => {
1103
- if (n.resource) AllResources.push(...n.resource);
1108
+ if (n.resource)
1109
+ AllResources.push(...n.resource);
1104
1110
  });
1105
1111
  }
1106
1112
  }
@@ -1122,8 +1128,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1122
1128
  var _a2, _b2, _c2, _d;
1123
1129
  const aIsCombined = ((_b2 = (_a2 = a.metadata) == null ? void 0 : _a2.combined_resource) == null ? void 0 : _b2.status) === 1;
1124
1130
  const bIsCombined = ((_d = (_c2 = b.metadata) == null ? void 0 : _c2.combined_resource) == null ? void 0 : _d.status) === 1;
1125
- if (aIsCombined && !bIsCombined) return 1;
1126
- if (!aIsCombined && bIsCombined) return -1;
1131
+ if (aIsCombined && !bIsCombined)
1132
+ return 1;
1133
+ if (!aIsCombined && bIsCombined)
1134
+ return -1;
1127
1135
  return 0;
1128
1136
  });
1129
1137
  const resourcesUseableMap = [
@@ -1210,7 +1218,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1210
1218
  const resources = [];
1211
1219
  if ((_a = dateRange == null ? void 0 : dateRange[0]) == null ? void 0 : _a.date) {
1212
1220
  dateRange.forEach((n) => {
1213
- if (n.resource) resources.push(...n.resource);
1221
+ if (n.resource)
1222
+ resources.push(...n.resource);
1214
1223
  });
1215
1224
  }
1216
1225
  const errorList = [];
@@ -1343,7 +1352,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1343
1352
  productResources.forEach((item2) => {
1344
1353
  item2.renderList = item2.renderList.filter((n) => {
1345
1354
  const recordCount = (n.capacity || 0) - (selectResourcesMap[n.id] || 0);
1346
- if (n.onlyComputed) return false;
1355
+ if (n.onlyComputed)
1356
+ return false;
1347
1357
  return recordCount >= currentCapacity;
1348
1358
  });
1349
1359
  });
@@ -1523,7 +1533,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1523
1533
  }
1524
1534
  const calculateCapacityFromCartItems = (items) => {
1525
1535
  var _a2;
1526
- if (items.length === 0) return 0;
1536
+ if (items.length === 0)
1537
+ return 0;
1527
1538
  const firstResource = (_a2 = items[0]._resourceOrigin) == null ? void 0 : _a2[0].id;
1528
1539
  const sameResourceLength = items.filter((item) => {
1529
1540
  var _a3;
@@ -1606,7 +1617,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1606
1617
  }
1607
1618
  }
1608
1619
  });
1609
- if (!resources.length) return [];
1620
+ if (!resources.length)
1621
+ return [];
1610
1622
  let duration = 0;
1611
1623
  const accountList = this.store.accountList.getAccounts();
1612
1624
  const checkDuration = (cartItems2) => {
@@ -1656,7 +1668,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1656
1668
  }
1657
1669
  const calculateCapacityFromCartItems = (items) => {
1658
1670
  var _a2;
1659
- if (items.length === 0) return 0;
1671
+ if (items.length === 0)
1672
+ return 0;
1660
1673
  const firstResource = (_a2 = items[0]._resourceOrigin) == null ? void 0 : _a2[0].id;
1661
1674
  const sameResourceLength = items.filter((item) => {
1662
1675
  var _a3;
@@ -1877,11 +1890,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1877
1890
  const newScheduleArr = this.getScheduleDataByIds(
1878
1891
  targetProductData["schedule.ids"]
1879
1892
  );
1880
- if (!this.store.currentProductMeta) this.store.currentProductMeta = {};
1893
+ if (!this.store.currentProductMeta)
1894
+ this.store.currentProductMeta = {};
1881
1895
  this.store.currentProductMeta.schedule = newScheduleArr;
1882
1896
  } else if (targetProductData.duration) {
1883
1897
  const dateRange = this.store.date.getDateRange();
1884
- if (!(dateRange == null ? void 0 : dateRange.length)) return;
1898
+ if (!(dateRange == null ? void 0 : dateRange.length))
1899
+ return;
1885
1900
  this.getAvailableDate({
1886
1901
  startDate: dateRange[0].date,
1887
1902
  endDate: dateRange[dateRange.length - 1].date,
@@ -1940,8 +1955,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1940
1955
  var _a2, _b2, _c2, _d2;
1941
1956
  const aIsCombined = ((_b2 = (_a2 = a.metadata) == null ? void 0 : _a2.combined_resource) == null ? void 0 : _b2.status) === 1;
1942
1957
  const bIsCombined = ((_d2 = (_c2 = b.metadata) == null ? void 0 : _c2.combined_resource) == null ? void 0 : _d2.status) === 1;
1943
- if (aIsCombined && !bIsCombined) return 1;
1944
- if (!aIsCombined && bIsCombined) return -1;
1958
+ if (aIsCombined && !bIsCombined)
1959
+ return 1;
1960
+ if (!aIsCombined && bIsCombined)
1961
+ return -1;
1945
1962
  return 0;
1946
1963
  });
1947
1964
  const enabledResourceTypeConfigs = ((_d = (_c = targetProductData == null ? void 0 : targetProductData.product_resource) == null ? void 0 : _c.resources) == null ? void 0 : _d.filter(
@@ -1963,7 +1980,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1963
1980
  });
1964
1981
  allProductResources == null ? void 0 : allProductResources.forEach((m) => {
1965
1982
  const currentResourceTypeConfig = resourceTypeConfigById.get(m.form_id);
1966
- if (!currentResourceTypeConfig) return;
1983
+ if (!currentResourceTypeConfig)
1984
+ return;
1967
1985
  let currentResourceMaxRemainingCapacity = 0;
1968
1986
  let isAllTimeSlicesUsable = true;
1969
1987
  const mTimes = m.times.filter((n) => {
@@ -1981,7 +1999,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1981
1999
  };
1982
2000
  if (currentResourceTypeConfig.type === "multiple")
1983
2001
  currentStats2.summaryConfigCount += m.capacity;
1984
- else currentStats2.summaryConfigCount += 1;
2002
+ else
2003
+ currentStats2.summaryConfigCount += 1;
1985
2004
  statsByResourceType[m.form_id] = currentStats2;
1986
2005
  }
1987
2006
  mTimes.forEach((childTiem) => {
@@ -2001,14 +2020,17 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2001
2020
  if ((resourcesUseableMap == null ? void 0 : resourcesUseableMap[m.id]) !== false && res.reason !== "capacityOnly") {
2002
2021
  resourcesUseableMap[m.id] = res.usable;
2003
2022
  }
2004
- if (!res.usable) isAllTimeSlicesUsable = false;
2023
+ if (!res.usable)
2024
+ isAllTimeSlicesUsable = false;
2005
2025
  if (res.usable && !m.onlyComputed) {
2006
2026
  if (res.remainingCapacity > currentResourceMaxRemainingCapacity)
2007
2027
  currentResourceMaxRemainingCapacity = res.remainingCapacity;
2008
2028
  }
2009
2029
  });
2010
- if (!isAllTimeSlicesUsable) return;
2011
- if (m.onlyComputed) return;
2030
+ if (!isAllTimeSlicesUsable)
2031
+ return;
2032
+ if (m.onlyComputed)
2033
+ return;
2012
2034
  const currentStats = statsByResourceType[m.form_id] || {
2013
2035
  count: 0,
2014
2036
  left: 0,
@@ -2026,7 +2048,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2026
2048
  const cartItems2 = this.store.cart.getItems();
2027
2049
  productResources.forEach((n) => {
2028
2050
  const currentResourceTypeConfig = resourceTypeConfigById.get(n.id);
2029
- if (!currentResourceTypeConfig) return;
2051
+ if (!currentResourceTypeConfig)
2052
+ return;
2030
2053
  const currentStats = statsByResourceType[n.id] || {
2031
2054
  count: 0,
2032
2055
  left: 0,
@@ -2158,19 +2181,26 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2158
2181
  } : { count: 0, left: 0, summaryCount: 0, summaryConfigCount: 0 };
2159
2182
  const bottleneckConfig = bottleneckResourceTypeId !== void 0 ? resourceTypeConfigById.get(bottleneckResourceTypeId) : void 0;
2160
2183
  let status = "sold_out";
2161
- if (bottleneckStats.left === 0) status = "sold_out";
2184
+ if (bottleneckStats.left === 0)
2185
+ status = "sold_out";
2162
2186
  else if (!bottleneckConfig || bottleneckStats.summaryConfigCount === 0)
2163
2187
  status = "sold_out";
2164
2188
  else if (bottleneckConfig.type === "multiple") {
2165
2189
  const usageRatio = bottleneckStats.summaryCount / bottleneckStats.summaryConfigCount;
2166
- if (usageRatio > 0.5) status = "lots_of_space";
2167
- else if (bottleneckStats.summaryCount > 0) status = "filling_up_fast";
2168
- else status = "sold_out";
2190
+ if (usageRatio > 0.5)
2191
+ status = "lots_of_space";
2192
+ else if (bottleneckStats.summaryCount > 0)
2193
+ status = "filling_up_fast";
2194
+ else
2195
+ status = "sold_out";
2169
2196
  } else {
2170
2197
  const usageRatio = bottleneckStats.left / bottleneckStats.summaryConfigCount;
2171
- if (usageRatio > 0.5) status = "lots_of_space";
2172
- else if (bottleneckStats.count > 0) status = "filling_up_fast";
2173
- else status = "sold_out";
2198
+ if (usageRatio > 0.5)
2199
+ status = "lots_of_space";
2200
+ else if (bottleneckStats.count > 0)
2201
+ status = "filling_up_fast";
2202
+ else
2203
+ status = "sold_out";
2174
2204
  }
2175
2205
  return {
2176
2206
  start_time: startDayJs.format("HH:mm"),
@@ -2193,19 +2223,20 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2193
2223
  * 找到多个资源的公共可用时间段
2194
2224
  */
2195
2225
  findCommonAvailableTimeSlots(resources) {
2196
- if (resources.length === 0) return [];
2197
- console.log(`\u8BA1\u7B97 ${resources.length} \u4E2A\u8D44\u6E90\u7684\u516C\u5171\u65F6\u95F4\u6BB5`);
2226
+ if (resources.length === 0)
2227
+ return [];
2228
+ console.log(`计算 ${resources.length} 个资源的公共时间段`);
2198
2229
  const allTimeSlots = resources.map(
2199
2230
  (resource) => resource.times.map((time) => ({
2200
2231
  start: (0, import_dayjs.default)(time.start_at),
2201
2232
  end: (0, import_dayjs.default)(time.end_at)
2202
2233
  }))
2203
2234
  );
2204
- console.log("\u6240\u6709\u8D44\u6E90\u7684\u65F6\u95F4\u6BB5:", allTimeSlots.map(
2235
+ console.log("所有资源的时间段:", allTimeSlots.map(
2205
2236
  (slots) => slots.map((slot) => `${slot.start.format("HH:mm")}-${slot.end.format("HH:mm")}`)
2206
2237
  ));
2207
2238
  let commonSlots = allTimeSlots[0];
2208
- console.log("\u521D\u59CB\u516C\u5171\u65F6\u95F4\u6BB5:", commonSlots.map((slot) => `${slot.start.format("HH:mm")}-${slot.end.format("HH:mm")}`));
2239
+ console.log("初始公共时间段:", commonSlots.map((slot) => `${slot.start.format("HH:mm")}-${slot.end.format("HH:mm")}`));
2209
2240
  for (let i = 1; i < allTimeSlots.length; i++) {
2210
2241
  const currentResourceSlots = allTimeSlots[i];
2211
2242
  const intersections = [];
@@ -2222,23 +2253,24 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2222
2253
  });
2223
2254
  });
2224
2255
  if (intersections.length === 0) {
2225
- console.log(`\u8D44\u6E90${i}\u4E0E\u5F53\u524D\u516C\u5171\u65F6\u95F4\u6BB5\u65E0\u4EA4\u96C6\uFF0C\u8DF3\u8FC7\u8BE5\u8D44\u6E90`);
2256
+ console.log(`资源${i}与当前公共时间段无交集,跳过该资源`);
2226
2257
  continue;
2227
2258
  }
2228
2259
  commonSlots = intersections;
2229
- console.log(`\u4E0E\u8D44\u6E90${i}\u6C42\u4EA4\u96C6\u540E\u7684\u516C\u5171\u65F6\u95F4\u6BB5:`, commonSlots.map((slot) => `${slot.start.format("HH:mm")}-${slot.end.format("HH:mm")}`));
2260
+ console.log(`与资源${i}求交集后的公共时间段:`, commonSlots.map((slot) => `${slot.start.format("HH:mm")}-${slot.end.format("HH:mm")}`));
2230
2261
  }
2231
2262
  const result = commonSlots.map((slot) => ({
2232
2263
  startTime: slot.start.format("HH:mm"),
2233
2264
  endTime: slot.end.format("HH:mm")
2234
2265
  }));
2235
- console.log("\u6700\u7EC8\u516C\u5171\u65F6\u95F4\u6BB5:", result);
2266
+ console.log("最终公共时间段:", result);
2236
2267
  return result;
2237
2268
  }
2238
2269
  checkMaxDurationCapacity() {
2239
2270
  var _a, _b;
2240
2271
  const cartItems = this.store.cart.getItems().filter((item) => !(0, import_utils5.isNormalProduct)(item._productOrigin));
2241
- if (cartItems.length === 0) return { success: true, minAvailableCount: 0 };
2272
+ if (cartItems.length === 0)
2273
+ return { success: true, minAvailableCount: 0 };
2242
2274
  const itemsWithTime = [];
2243
2275
  const itemsWithoutTime = [];
2244
2276
  const availableCountsByResourceType = [];
@@ -2254,7 +2286,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2254
2286
  const itemsByResourceType = {};
2255
2287
  itemsWithoutTime.forEach((cartItem) => {
2256
2288
  var _a2;
2257
- if (!cartItem._productOrigin) return;
2289
+ if (!cartItem._productOrigin)
2290
+ return;
2258
2291
  const resourceTypes = ((_a2 = cartItem._productOrigin.product_resource) == null ? void 0 : _a2.resources) || [];
2259
2292
  resourceTypes.forEach((resourceType) => {
2260
2293
  var _a3;
@@ -2273,10 +2306,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2273
2306
  });
2274
2307
  });
2275
2308
  const dateRange = this.store.date.getDateRange();
2276
- if (!dateRange || dateRange.length === 0) return { success: false, minAvailableCount: 0 };
2309
+ if (!dateRange || dateRange.length === 0)
2310
+ return { success: false, minAvailableCount: 0 };
2277
2311
  const resourcesDates = this.store.date.getDateList();
2278
2312
  const targetResourceDate = resourcesDates.find((n) => n.date === dateRange[0].date);
2279
- if (!targetResourceDate) return { success: false, minAvailableCount: 0 };
2313
+ if (!targetResourceDate)
2314
+ return { success: false, minAvailableCount: 0 };
2280
2315
  const resourcesMap = (0, import_utils2.getResourcesMap)(targetResourceDate.resource || []);
2281
2316
  const resourceCodeToFormIdMap = {};
2282
2317
  Object.values(itemsByResourceType).flat().forEach((cartItem) => {
@@ -2299,7 +2334,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2299
2334
  for (const [resourceCode, items] of Object.entries(itemsByResourceType)) {
2300
2335
  const targetFormId = resourceCodeToFormIdMap[resourceCode];
2301
2336
  if (!targetFormId) {
2302
- console.log(`\u8D44\u6E90\u7C7B\u578B ${resourceCode} \u627E\u4E0D\u5230\u5BF9\u5E94\u7684 form_id`);
2337
+ console.log(`资源类型 ${resourceCode} 找不到对应的 form_id`);
2303
2338
  return { success: false, minAvailableCount: 0 };
2304
2339
  }
2305
2340
  const resourcesOfThisType = [];
@@ -2316,7 +2351,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2316
2351
  });
2317
2352
  });
2318
2353
  if (resourcesOfThisType.length === 0) {
2319
- console.log(`\u8D44\u6E90\u7C7B\u578B ${resourceCode} \u6CA1\u6709\u627E\u5230\u53EF\u7528\u8D44\u6E90`);
2354
+ console.log(`资源类型 ${resourceCode} 没有找到可用资源`);
2320
2355
  return { success: false, minAvailableCount: 0 };
2321
2356
  }
2322
2357
  let resourceTypeConfig = null;
@@ -2325,7 +2360,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2325
2360
  resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(
2326
2361
  (r) => r.code === resourceCode && r.status === 1
2327
2362
  );
2328
- if (resourceTypeConfig) break;
2363
+ if (resourceTypeConfig)
2364
+ break;
2329
2365
  }
2330
2366
  }
2331
2367
  const isMultipleBooking = (resourceTypeConfig == null ? void 0 : resourceTypeConfig.type) === "multiple";
@@ -2358,20 +2394,20 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2358
2394
  availableCountsByResourceType.push(availableAmount);
2359
2395
  if (requiredAmount > totalAvailable) {
2360
2396
  hasCapacityIssue = true;
2361
- console.log(`\u8D44\u6E90\u7C7B\u578B ${resourceCode} ${isMultipleBooking ? "\u5BB9\u91CF" : "\u8D44\u6E90\u6570\u91CF"}\u4E0D\u8DB3: \u9700\u8981 ${requiredAmount}, \u603B\u5171 ${totalAvailable}`);
2397
+ console.log(`资源类型 ${resourceCode} ${isMultipleBooking ? "容量" : "资源数量"}不足: 需要 ${requiredAmount}, 总共 ${totalAvailable}`);
2362
2398
  }
2363
- console.log(`\u8D44\u6E90\u7C7B\u578B ${resourceCode} \u7684\u8D44\u6E90\u65F6\u95F4\u4FE1\u606F:`, resourcesOfThisType.map((r) => ({
2399
+ console.log(`资源类型 ${resourceCode} 的资源时间信息:`, resourcesOfThisType.map((r) => ({
2364
2400
  id: r.id,
2365
2401
  times: r.times.map((t) => `${t.start_at} - ${t.end_at}`)
2366
2402
  })));
2367
2403
  const commonTimeSlots = this.findCommonAvailableTimeSlots(resourcesOfThisType);
2368
- console.log(`\u8D44\u6E90\u7C7B\u578B ${resourceCode} \u7684\u516C\u5171\u65F6\u95F4\u6BB5:`, commonTimeSlots);
2404
+ console.log(`资源类型 ${resourceCode} 的公共时间段:`, commonTimeSlots);
2369
2405
  if (commonTimeSlots.length === 0) {
2370
- console.log(`\u8D44\u6E90\u7C7B\u578B ${resourceCode} \u6CA1\u6709\u516C\u5171\u53EF\u7528\u65F6\u95F4\u6BB5`);
2406
+ console.log(`资源类型 ${resourceCode} 没有公共可用时间段`);
2371
2407
  return { success: false, minAvailableCount: 0 };
2372
2408
  }
2373
2409
  const firstCommonSlot = commonTimeSlots[0];
2374
- console.log(`\u4F7F\u7528\u516C\u5171\u65F6\u95F4\u6BB5: ${firstCommonSlot.startTime} - ${firstCommonSlot.endTime}`);
2410
+ console.log(`使用公共时间段: ${firstCommonSlot.startTime} - ${firstCommonSlot.endTime}`);
2375
2411
  items.forEach((cartItem) => {
2376
2412
  if (!processedCartItemIds.has(cartItem._id)) {
2377
2413
  processedCartItemIds.add(cartItem._id);
@@ -2399,7 +2435,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2399
2435
  const allProcessedItems = [...itemsWithTime, ...processedItemsWithoutTime];
2400
2436
  const cartItemsByTimeSlot = {};
2401
2437
  allProcessedItems.forEach((cartItem) => {
2402
- if (!cartItem.start_time || !cartItem.end_time || !cartItem.start_date) return;
2438
+ if (!cartItem.start_time || !cartItem.end_time || !cartItem.start_date)
2439
+ return;
2403
2440
  const timeSlotKey = `${cartItem.start_date}_${cartItem.start_time}_${cartItem.end_date || cartItem.start_date}_${cartItem.end_time}`;
2404
2441
  if (!cartItemsByTimeSlot[timeSlotKey]) {
2405
2442
  cartItemsByTimeSlot[timeSlotKey] = [];
@@ -2415,10 +2452,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2415
2452
  const dateRange = this.store.date.getDateRange();
2416
2453
  const resourcesDates = this.store.date.getDateList();
2417
2454
  const targetResourceDate = resourcesDates.find((n) => n.date === startDate);
2418
- if (!targetResourceDate) continue;
2455
+ if (!targetResourceDate)
2456
+ continue;
2419
2457
  const resourcesMap = (0, import_utils2.getResourcesMap)(targetResourceDate.resource || []);
2420
2458
  itemsInTimeSlot.forEach((cartItem) => {
2421
- if (!cartItem._productOrigin) return;
2459
+ if (!cartItem._productOrigin)
2460
+ return;
2422
2461
  const productResourceIds = (0, import_capacity.getResourcesIdsByProduct)(cartItem._productOrigin);
2423
2462
  productResourceIds.forEach((resourceId) => {
2424
2463
  if (resourcesMap[resourceId] && !resourcesIdSet.has(resourceId)) {
@@ -2497,7 +2536,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2497
2536
  const cartItems = this.store.cart.getItems().filter((item) => !(0, import_utils5.isNormalProduct)(item._productOrigin));
2498
2537
  const currentCartItem = this.convertProductToCartItem({ product, date, account });
2499
2538
  cartItems.push(currentCartItem);
2500
- if (cartItems.length === 0) return { success: true, minAvailableCount: 0 };
2539
+ if (cartItems.length === 0)
2540
+ return { success: true, minAvailableCount: 0 };
2501
2541
  const itemsWithTime = [];
2502
2542
  const itemsWithoutTime = [];
2503
2543
  const availableCountsByResourceType = [];
@@ -2513,7 +2553,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2513
2553
  const itemsByResourceType = {};
2514
2554
  itemsWithoutTime.forEach((cartItem) => {
2515
2555
  var _a2;
2516
- if (!cartItem._productOrigin) return;
2556
+ if (!cartItem._productOrigin)
2557
+ return;
2517
2558
  const resourceTypes = ((_a2 = cartItem._productOrigin.product_resource) == null ? void 0 : _a2.resources) || [];
2518
2559
  resourceTypes.forEach((resourceType) => {
2519
2560
  var _a3;
@@ -2529,10 +2570,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2529
2570
  });
2530
2571
  });
2531
2572
  const dateRange = this.store.date.getDateRange();
2532
- if (!dateRange || dateRange.length === 0) return { success: false, minAvailableCount: 0 };
2573
+ if (!dateRange || dateRange.length === 0)
2574
+ return { success: false, minAvailableCount: 0 };
2533
2575
  const resourcesDates = this.store.date.getDateList();
2534
2576
  const targetResourceDate = resourcesDates.find((n) => n.date === dateRange[0].date);
2535
- if (!targetResourceDate) return { success: false, minAvailableCount: 0 };
2577
+ if (!targetResourceDate)
2578
+ return { success: false, minAvailableCount: 0 };
2536
2579
  const resourcesMap = (0, import_utils2.getResourcesMap)(targetResourceDate.resource || []);
2537
2580
  const resourceCodeToFormIdMap = {};
2538
2581
  Object.values(itemsByResourceType).flat().forEach((cartItem) => {
@@ -2555,7 +2598,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2555
2598
  for (const [resourceCode, items] of Object.entries(itemsByResourceType)) {
2556
2599
  const targetFormId = resourceCodeToFormIdMap[resourceCode];
2557
2600
  if (!targetFormId) {
2558
- console.log(`\u8D44\u6E90\u7C7B\u578B ${resourceCode} \u627E\u4E0D\u5230\u5BF9\u5E94\u7684 form_id`);
2601
+ console.log(`资源类型 ${resourceCode} 找不到对应的 form_id`);
2559
2602
  return { success: false, minAvailableCount: 0 };
2560
2603
  }
2561
2604
  const resourcesOfThisType = [];
@@ -2572,7 +2615,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2572
2615
  });
2573
2616
  });
2574
2617
  if (resourcesOfThisType.length === 0) {
2575
- console.log(`\u8D44\u6E90\u7C7B\u578B ${resourceCode} \u6CA1\u6709\u627E\u5230\u53EF\u7528\u8D44\u6E90`);
2618
+ console.log(`资源类型 ${resourceCode} 没有找到可用资源`);
2576
2619
  return { success: false, minAvailableCount: 0 };
2577
2620
  }
2578
2621
  let resourceTypeConfig = null;
@@ -2581,7 +2624,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2581
2624
  resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(
2582
2625
  (r) => r.code === resourceCode && r.status === 1
2583
2626
  );
2584
- if (resourceTypeConfig) break;
2627
+ if (resourceTypeConfig)
2628
+ break;
2585
2629
  }
2586
2630
  }
2587
2631
  const isMultipleBooking = (resourceTypeConfig == null ? void 0 : resourceTypeConfig.type) === "multiple";
@@ -2614,20 +2658,20 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2614
2658
  availableCountsByResourceType.push(availableAmount);
2615
2659
  if (requiredAmount > totalAvailable) {
2616
2660
  hasCapacityIssue = true;
2617
- console.log(`\u8D44\u6E90\u7C7B\u578B ${resourceCode} ${isMultipleBooking ? "\u5BB9\u91CF" : "\u8D44\u6E90\u6570\u91CF"}\u4E0D\u8DB3: \u9700\u8981 ${requiredAmount}, \u603B\u5171 ${totalAvailable}`);
2661
+ console.log(`资源类型 ${resourceCode} ${isMultipleBooking ? "容量" : "资源数量"}不足: 需要 ${requiredAmount}, 总共 ${totalAvailable}`);
2618
2662
  }
2619
- console.log(`\u8D44\u6E90\u7C7B\u578B ${resourceCode} \u7684\u8D44\u6E90\u65F6\u95F4\u4FE1\u606F:`, resourcesOfThisType.map((r) => ({
2663
+ console.log(`资源类型 ${resourceCode} 的资源时间信息:`, resourcesOfThisType.map((r) => ({
2620
2664
  id: r.id,
2621
2665
  times: r.times.map((t) => `${t.start_at} - ${t.end_at}`)
2622
2666
  })));
2623
2667
  const commonTimeSlots = this.findCommonAvailableTimeSlots(resourcesOfThisType);
2624
- console.log(`\u8D44\u6E90\u7C7B\u578B ${resourceCode} \u7684\u516C\u5171\u65F6\u95F4\u6BB5:`, commonTimeSlots);
2668
+ console.log(`资源类型 ${resourceCode} 的公共时间段:`, commonTimeSlots);
2625
2669
  if (commonTimeSlots.length === 0) {
2626
- console.log(`\u8D44\u6E90\u7C7B\u578B ${resourceCode} \u6CA1\u6709\u516C\u5171\u53EF\u7528\u65F6\u95F4\u6BB5`);
2670
+ console.log(`资源类型 ${resourceCode} 没有公共可用时间段`);
2627
2671
  return { success: false, minAvailableCount: 0 };
2628
2672
  }
2629
2673
  const firstCommonSlot = commonTimeSlots[0];
2630
- console.log(`\u4F7F\u7528\u516C\u5171\u65F6\u95F4\u6BB5: ${firstCommonSlot.startTime} - ${firstCommonSlot.endTime}`);
2674
+ console.log(`使用公共时间段: ${firstCommonSlot.startTime} - ${firstCommonSlot.endTime}`);
2631
2675
  items.forEach((cartItem) => {
2632
2676
  if (!processedCartItemIds.has(cartItem._id)) {
2633
2677
  processedCartItemIds.add(cartItem._id);
@@ -2655,7 +2699,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2655
2699
  const allProcessedItems = [...itemsWithTime, ...processedItemsWithoutTime];
2656
2700
  const cartItemsByTimeSlot = {};
2657
2701
  allProcessedItems.forEach((cartItem) => {
2658
- if (!cartItem.start_time || !cartItem.end_time || !cartItem.start_date) return;
2702
+ if (!cartItem.start_time || !cartItem.end_time || !cartItem.start_date)
2703
+ return;
2659
2704
  const timeSlotKey = `${cartItem.start_date}_${cartItem.start_time}_${cartItem.end_date || cartItem.start_date}_${cartItem.end_time}`;
2660
2705
  if (!cartItemsByTimeSlot[timeSlotKey]) {
2661
2706
  cartItemsByTimeSlot[timeSlotKey] = [];
@@ -2670,10 +2715,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2670
2715
  const resourcesIdSet = /* @__PURE__ */ new Set();
2671
2716
  const resourcesDates = this.store.date.getDateList();
2672
2717
  const targetResourceDate = resourcesDates.find((n) => n.date === startDate);
2673
- if (!targetResourceDate) continue;
2718
+ if (!targetResourceDate)
2719
+ continue;
2674
2720
  const resourcesMap = (0, import_utils2.getResourcesMap)(targetResourceDate.resource || []);
2675
2721
  itemsInTimeSlot.forEach((cartItem) => {
2676
- if (!cartItem._productOrigin) return;
2722
+ if (!cartItem._productOrigin)
2723
+ return;
2677
2724
  const productResourceIds = (0, import_capacity.getResourcesIdsByProduct)(cartItem._productOrigin);
2678
2725
  productResourceIds.forEach((resourceId) => {
2679
2726
  if (resourcesMap[resourceId] && !resourcesIdSet.has(resourceId)) {
@@ -2730,19 +2777,22 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2730
2777
  const resources = [];
2731
2778
  if (dateRange == null ? void 0 : dateRange.length) {
2732
2779
  dateRange.forEach((n) => {
2733
- if (n.resource) resources.push(...n.resource);
2780
+ if (n.resource)
2781
+ resources.push(...n.resource);
2734
2782
  });
2735
2783
  }
2736
2784
  if (!resources.length) {
2737
2785
  const dateList = this.store.date.getDateList();
2738
2786
  dateList.forEach((n) => {
2739
- if (n.resource) resources.push(...n.resource);
2787
+ if (n.resource)
2788
+ resources.push(...n.resource);
2740
2789
  });
2741
2790
  }
2742
2791
  const resourcesMap = (0, import_utils2.getResourcesMap)((0, import_lodash_es.cloneDeep)(resources));
2743
2792
  const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils5.isNormalProduct)(n._productOrigin));
2744
2793
  const cartItem = cartItems.find((item) => item._id === cartItemId);
2745
- if (!cartItem) return [];
2794
+ if (!cartItem)
2795
+ return [];
2746
2796
  let selectedResources = [];
2747
2797
  const { currentCapacity, formatCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(cartItem);
2748
2798
  cartItem._origin.metadata.capacity = formatCapacity;
@@ -2768,7 +2818,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2768
2818
  const targetResource = productResources.find(
2769
2819
  (resource) => resource.code === resourceCode
2770
2820
  );
2771
- if (!targetResource) return [];
2821
+ if (!targetResource)
2822
+ return [];
2772
2823
  if (cartItem._origin.start_time) {
2773
2824
  const startTime = (0, import_dayjs.default)(
2774
2825
  `${cartItem._origin.start_date} ${cartItem._origin.start_time}`
@@ -2782,8 +2833,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2782
2833
  var _a2, _b2, _c, _d;
2783
2834
  const aIsCombined = ((_b2 = (_a2 = a.metadata) == null ? void 0 : _a2.combined_resource) == null ? void 0 : _b2.status) === 1;
2784
2835
  const bIsCombined = ((_d = (_c = b.metadata) == null ? void 0 : _c.combined_resource) == null ? void 0 : _d.status) === 1;
2785
- if (aIsCombined && !bIsCombined) return 1;
2786
- if (!aIsCombined && bIsCombined) return -1;
2836
+ if (aIsCombined && !bIsCombined)
2837
+ return 1;
2838
+ if (!aIsCombined && bIsCombined)
2839
+ return -1;
2787
2840
  return 0;
2788
2841
  }
2789
2842
  );
@@ -2791,7 +2844,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2791
2844
  const mTimes = m.times.filter((n) => {
2792
2845
  return !(0, import_dayjs.default)(n.start_at).isAfter((0, import_dayjs.default)(startTime)) && !(0, import_dayjs.default)(n.end_at).isBefore((0, import_dayjs.default)(endTime));
2793
2846
  });
2794
- if (mTimes.length === 0) return false;
2847
+ if (mTimes.length === 0)
2848
+ return false;
2795
2849
  const canUseArr = mTimes.map((item) => {
2796
2850
  var _a2;
2797
2851
  const res = (0, import_resources.getIsUsableByTimeItem)({
@@ -2812,14 +2866,16 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2812
2866
  }
2813
2867
  return res.usable;
2814
2868
  });
2815
- if (m.onlyComputed) return false;
2869
+ if (m.onlyComputed)
2870
+ return false;
2816
2871
  return !canUseArr.some((n) => n === false);
2817
2872
  });
2818
2873
  } else {
2819
2874
  targetResource.renderList = targetResource.renderList.filter((n) => {
2820
2875
  var _a2, _b2;
2821
2876
  const recordCount = n.capacity || 0;
2822
- if (n.onlyComputed) return false;
2877
+ if (n.onlyComputed)
2878
+ return false;
2823
2879
  const timeSlots = (0, import_resources.getTimeSlicesByResource)({
2824
2880
  resource: n,
2825
2881
  duration: ((_b2 = (_a2 = cartItem._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) || 10,
@@ -2985,7 +3041,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2985
3041
  const mTimes = m.times.filter((n) => {
2986
3042
  return !(0, import_dayjs.default)(n.start_at).isAfter((0, import_dayjs.default)(item.start), "minute") && !(0, import_dayjs.default)(n.end_at).isBefore((0, import_dayjs.default)(item.end), "minute");
2987
3043
  });
2988
- if (mTimes.length === 0) return;
3044
+ if (mTimes.length === 0)
3045
+ return;
2989
3046
  if (!m.onlyComputed) {
2990
3047
  if (resource.type === "multiple") {
2991
3048
  summaryCount += m.capacity;
@@ -2995,7 +3052,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2995
3052
  }
2996
3053
  let isAnyTimeSliceUseable = false;
2997
3054
  mTimes.forEach((childTiem) => {
2998
- if (isAnyTimeSliceUseable) return;
3055
+ if (isAnyTimeSliceUseable)
3056
+ return;
2999
3057
  const res2 = (0, import_resources.getIsUsableByTimeItem)({
3000
3058
  timeSlice: {
3001
3059
  start_time: item.start,
@@ -3022,11 +3080,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
3022
3080
  }
3023
3081
  ;
3024
3082
  });
3025
- if (isAnyTimeSliceUseable) isAnyResourceUseableInType = true;
3083
+ if (isAnyTimeSliceUseable)
3084
+ isAnyResourceUseableInType = true;
3026
3085
  });
3027
- if (!isAnyResourceUseableInType) isAllResourceTypesUseable = false;
3086
+ if (!isAnyResourceUseableInType)
3087
+ isAllResourceTypesUseable = false;
3028
3088
  });
3029
- if (isAllResourceTypesUseable) timesSlotCanUse = true;
3089
+ if (isAllResourceTypesUseable)
3090
+ timesSlotCanUse = true;
3030
3091
  });
3031
3092
  if (!timesSlotCanUse) {
3032
3093
  status = "unavailable";
@@ -3037,12 +3098,16 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
3037
3098
  }
3038
3099
  let dateStatus;
3039
3100
  if (status === "unavailable") {
3040
- if (availableCount === 0 && summaryCount > 0) dateStatus = "sold_out";
3041
- else dateStatus = "unavailable";
3101
+ if (availableCount === 0 && summaryCount > 0)
3102
+ dateStatus = "sold_out";
3103
+ else
3104
+ dateStatus = "unavailable";
3042
3105
  } else {
3043
3106
  const usageRatio = availableCount / summaryCount;
3044
- if (usageRatio > 0.5) dateStatus = "lots_of_space";
3045
- else dateStatus = "filling_up_fast";
3107
+ if (usageRatio > 0.5)
3108
+ dateStatus = "lots_of_space";
3109
+ else
3110
+ dateStatus = "filling_up_fast";
3046
3111
  }
3047
3112
  dates.push({
3048
3113
  date: (0, import_dayjs.default)(currentDate).format("YYYY-MM-DD"),
@@ -3059,7 +3124,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
3059
3124
  }
3060
3125
  dates = (0, import_utils4.handleAvailableDateByResource)(res.data, dates);
3061
3126
  this.store.date.setDateList(dates);
3062
- if (!this.store.currentProductMeta) this.store.currentProductMeta = {};
3127
+ if (!this.store.currentProductMeta)
3128
+ this.store.currentProductMeta = {};
3063
3129
  this.store.currentProductMeta.timeSlotBySchedule = {
3064
3130
  dateList: dates,
3065
3131
  firstAvailableDate,
@@ -3083,7 +3149,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
3083
3149
  });
3084
3150
  }
3085
3151
  isTargetNormalProduct(product) {
3086
- if (!product) return false;
3152
+ if (!product)
3153
+ return false;
3087
3154
  return (0, import_utils5.isNormalProduct)(product);
3088
3155
  }
3089
3156
  isTargetCartIdNormalProduct(id) {