@pisell/pisellos 2.1.98 → 2.1.100

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