@pisell/pisellos 1.0.131 → 1.0.133

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.
@@ -1819,7 +1819,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1819
1819
  timeSlots: timeSlots,
1820
1820
  currentCapacity: totalCapacity + (capacity || 0)
1821
1821
  });
1822
- if (canUseTime && !n.onlyComputed && currentResourceIdleTime > targetResourceTime) {
1822
+ if (canUseTime && !n.onlyComputed && currentResourceIdleTime > targetResourceTime && n.capacity >= (capacity || 0)) {
1823
1823
  targetResource = n;
1824
1824
  targetResourceTime = currentResourceIdleTime;
1825
1825
  return 1; // break
@@ -2214,6 +2214,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2214
2214
  // 计算容量的辅助函数
2215
2215
  var calculateCapacityFromCartItems = function calculateCapacityFromCartItems(items) {
2216
2216
  var _items$0$_resourceOri;
2217
+ if (items.length === 0) return 0;
2217
2218
  // 还需要增加一个判断,maxCapacity 必须是我单个人里选择的资源只有同一种的情况下才可以累加,否则单个账号都是 1
2218
2219
  var firstResource = (_items$0$_resourceOri = items[0]._resourceOrigin) === null || _items$0$_resourceOri === void 0 ? void 0 : _items$0$_resourceOri[0].id;
2219
2220
  var sameResourceLength = items.filter(function (item) {
@@ -2388,6 +2389,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2388
2389
  // 计算容量的辅助函数
2389
2390
  calculateCapacityFromCartItems = function calculateCapacityFromCartItems(items) {
2390
2391
  var _items$0$_resourceOri2;
2392
+ if (items.length === 0) return 0;
2391
2393
  // 还需要增加一个判断,maxCapacity 必须是我单个人里选择的资源只有同一种的情况下才可以累加,否则单个账号都是 1
2392
2394
  var firstResource = (_items$0$_resourceOri2 = items[0]._resourceOrigin) === null || _items$0$_resourceOri2 === void 0 ? void 0 : _items$0$_resourceOri2[0].id;
2393
2395
  var sameResourceLength = items.filter(function (item) {
@@ -2565,8 +2567,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2565
2567
  _step3;
2566
2568
  try {
2567
2569
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
2570
+ var _time$event_list;
2568
2571
  var time = _step3.value;
2569
- var _iterator4 = _createForOfIteratorHelper(time.event_list || []),
2572
+ var blockedTimes = (_time$event_list = time.event_list) === null || _time$event_list === void 0 ? void 0 : _time$event_list.filter(function (event) {
2573
+ return event.type !== 'schedule_event';
2574
+ });
2575
+ var _iterator4 = _createForOfIteratorHelper(blockedTimes || []),
2570
2576
  _step4;
2571
2577
  try {
2572
2578
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
@@ -349,7 +349,8 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
349
349
  return dayjs(current.end_at).isAfter(dayjs(latest.end_at)) ? current : latest;
350
350
  }, d.times[0]);
351
351
  // TODO,在这拉时间切片出来,如果可用 timeSlots.length > 1 才可以被选择
352
- return dayjs(latestTime.end_at).isAfter(dayjs());
352
+ // 当前资源的配置容量需要大于当前需求的 capacity
353
+ return dayjs(latestTime.end_at).isAfter(dayjs()) && d.capacity >= capacity;
353
354
  });
354
355
  item.form_id = form_id;
355
356
  acc.push(item);
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
115
115
  * 获取当前的客户搜索条件
116
116
  * @returns 当前搜索条件
117
117
  */
118
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
118
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
119
119
  /**
120
120
  * 获取客户列表状态(包含滚动加载相关状态)
121
121
  * @returns 客户状态
@@ -1182,7 +1182,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1182
1182
  timeSlots,
1183
1183
  currentCapacity: totalCapacity + (capacity || 0)
1184
1184
  });
1185
- if (canUseTime && !n.onlyComputed && currentResourceIdleTime > targetResourceTime) {
1185
+ if (canUseTime && !n.onlyComputed && currentResourceIdleTime > targetResourceTime && n.capacity >= (capacity || 0)) {
1186
1186
  targetResource = n;
1187
1187
  targetResourceTime = currentResourceIdleTime;
1188
1188
  break;
@@ -1534,6 +1534,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1534
1534
  }
1535
1535
  const calculateCapacityFromCartItems = (items) => {
1536
1536
  var _a2;
1537
+ if (items.length === 0)
1538
+ return 0;
1537
1539
  const firstResource = (_a2 = items[0]._resourceOrigin) == null ? void 0 : _a2[0].id;
1538
1540
  const sameResourceLength = items.filter((item) => {
1539
1541
  var _a3;
@@ -1667,6 +1669,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1667
1669
  }
1668
1670
  const calculateCapacityFromCartItems = (items) => {
1669
1671
  var _a2;
1672
+ if (items.length === 0)
1673
+ return 0;
1670
1674
  const firstResource = (_a2 = items[0]._resourceOrigin) == null ? void 0 : _a2[0].id;
1671
1675
  const sameResourceLength = items.filter((item) => {
1672
1676
  var _a3;
@@ -1771,10 +1775,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1771
1775
  currentStartTime: currentStartTime2,
1772
1776
  times
1773
1777
  }) {
1778
+ var _a4;
1774
1779
  const currentStart = (0, import_dayjs.default)(currentStartTime2);
1775
1780
  let earliestBlockStart;
1776
1781
  for (const time of times || []) {
1777
- for (const event of time.event_list || []) {
1782
+ const blockedTimes = (_a4 = time.event_list) == null ? void 0 : _a4.filter((event) => event.type !== "schedule_event");
1783
+ for (const event of blockedTimes || []) {
1778
1784
  const eventStart = (0, import_dayjs.default)(event.start_at);
1779
1785
  const eventEnd = (0, import_dayjs.default)(event.end_at);
1780
1786
  if (eventStart.isBefore(currentStart) && eventEnd.isAfter(currentStart)) {
@@ -298,7 +298,7 @@ var getResourcesByProduct = (resourcesMap, resources, selectedResources, capacit
298
298
  const latestTime = d.times.reduce((latest, current) => {
299
299
  return (0, import_dayjs.default)(current.end_at).isAfter((0, import_dayjs.default)(latest.end_at)) ? current : latest;
300
300
  }, d.times[0]);
301
- return (0, import_dayjs.default)(latestTime.end_at).isAfter((0, import_dayjs.default)());
301
+ return (0, import_dayjs.default)(latestTime.end_at).isAfter((0, import_dayjs.default)()) && d.capacity >= capacity;
302
302
  });
303
303
  item.form_id = form_id;
304
304
  acc.push(item);
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
115
115
  * 获取当前的客户搜索条件
116
116
  * @returns 当前搜索条件
117
117
  */
118
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
118
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
119
119
  /**
120
120
  * 获取客户列表状态(包含滚动加载相关状态)
121
121
  * @returns 客户状态
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "1.0.131",
4
+ "version": "1.0.133",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",