@pisell/pisellos 0.0.274 → 0.0.275

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.
@@ -44,7 +44,7 @@ import { handleAvailableDateByResource } from "../../modules/Date/utils";
44
44
  import { areAllNormalProducts, isNormalProduct } from "../../modules/Product/utils";
45
45
  import { calculateResourceAvailableTime, filterConditionTimeSlots, findFastestAvailableResource } from "./utils/timeslots";
46
46
  import { updateAllCartItemPrice } from "../../modules/Cart/utils/changePrice";
47
- import { getCapacityInfoByCartItem, checkSubResourcesCapacity, checkResourceCanUseByCapacity, getResourcesIdsByProduct, checkTimeSlotCapacity } from "./utils/capacity";
47
+ import { getCapacityInfoByCartItem, checkSubResourcesCapacity, checkResourceCanUseByCapacity, calculateCartItemsCapacityUsageByResourceType, getResourcesIdsByProduct, checkTimeSlotCapacity } from "./utils/capacity";
48
48
  import { checkProductStock } from "./utils/stock";
49
49
  export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
50
50
  _inherits(BookingByStepImpl, _BaseModule);
@@ -2367,9 +2367,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2367
2367
  }, {
2368
2368
  key: "getTimeslotBySchedule",
2369
2369
  value: function getTimeslotBySchedule(_ref10) {
2370
- var _this$store$currentPr2,
2371
- _targetProductData$pr,
2372
- _this14 = this;
2370
+ var _this$store$currentPr2, _targetProductData$pr;
2373
2371
  var date = _ref10.date,
2374
2372
  scheduleIds = _ref10.scheduleIds,
2375
2373
  resources = _ref10.resources,
@@ -2417,191 +2415,139 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2417
2415
  var formatScheduleTimeSlots = scheduleTimeSlots.map(function (item) {
2418
2416
  // 用来计算资源的可使用情况,针对单个schedule 时间片
2419
2417
  var resourcesUseableMap = {};
2420
- var count = 0;
2421
- var bookingLeft = 0;
2422
- // 遍历所有资源
2423
- allProductResources === null || allProductResources === void 0 || allProductResources.forEach(function (m) {
2424
- // 遍历所有资源的上工时间片
2425
- var currentResourcesCount = 0;
2426
- var currentResourcesTimeSlotCanUsedArr = [];
2427
- // m.times 需要做个过滤,假设 timeSlice.start_at 是 09:30 timeSlice.end_at 是 11:30
2428
- // time 是 time.start_at = 2025-05-26 10:30, time.end_at = 2025-05-26 12:30
2429
- // 需要判断 time 的开始结束时间 是否包含timeSlice的开始结束时间
2430
-
2431
- // n.start_at 是 2025-06-30 15:00 end_at 2025-06-30 17:00
2432
- // item.start 是 2025-06-30 16:00 item.end 是 2025-06-30 19:00
2433
- // 需要判断 n.start_at 和 n.end_at 是否在 item.start 和 item.end 之间
2434
- // 如果 n.start_at 和 n.end_at 在 item.start 和 item.end 有交集,则此时间需要计算
2435
- var mTimes = m.times.filter(function (n) {
2436
- return !dayjs(n.start_at).isAfter(dayjs(item.start), 'minute') && !dayjs(n.end_at).isBefore(dayjs(item.end), 'minute') || dayjs(n.start_at).isBefore(dayjs(item.end), 'minute') && dayjs(n.end_at).isAfter(dayjs(item.start), 'minute');
2437
- });
2438
- // 如果在这个区间的时间一个都没有,可以直接认为这个资源不可用
2439
- if (mTimes.length === 0) {
2440
- return;
2441
- }
2442
- mTimes.forEach(function (childTiem) {
2443
- // 挨个去匹配某个工作时间段结合当前日程时间,资源能不能用,有多少容量能用
2444
- var res = getIsUsableByTimeItem({
2445
- timeSlice: {
2446
- start_time: item.start,
2447
- end_time: item.end,
2448
- start_at: dayjs(item.start),
2449
- end_at: dayjs(item.end)
2450
- },
2451
- time: childTiem,
2452
- resource: m,
2453
- currentCount: 1,
2454
- resourcesUseableMap: resourcesUseableMap,
2455
- cut_off_time: targetProductData === null || targetProductData === void 0 ? void 0 : targetProductData.cut_off_time
2456
- });
2457
- if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[m.id]) !== false && res.reason !== 'capacityOnly') {
2458
- resourcesUseableMap[m.id] = res.usable;
2459
- }
2460
- if (res.usable && res.remainingCapacity >= count && !m.onlyComputed) {
2461
- currentResourcesCount = res.remainingCapacity;
2462
- }
2463
- currentResourcesTimeSlotCanUsedArr.push(res.usable);
2464
- });
2465
- // 在已经选定时间的情况下,只要canUseTime如果有一个 false 那就不可用
2466
- if (!currentResourcesTimeSlotCanUsedArr.some(function (n) {
2467
- return n === false;
2468
- }) &&
2469
- // 只统计第一种资源的容量和 left
2470
- m.form_id === firstEnabledResourceId) {
2471
- if (currentResourcesCount >= count) {
2472
- count = currentResourcesCount;
2473
- }
2474
- if (!m.onlyComputed) {
2475
- bookingLeft += 1;
2476
- }
2418
+
2419
+ // 按资源类型分组
2420
+ var resourceTypeMap = {};
2421
+ allProductResources === null || allProductResources === void 0 || allProductResources.forEach(function (resource) {
2422
+ var _resource$form_id;
2423
+ var formId = ((_resource$form_id = resource.form_id) === null || _resource$form_id === void 0 ? void 0 : _resource$form_id.toString()) || 'default';
2424
+ if (!resourceTypeMap[formId]) {
2425
+ resourceTypeMap[formId] = [];
2477
2426
  }
2427
+ resourceTypeMap[formId].push(resource);
2478
2428
  });
2479
- // 容量检测
2480
- var cartItems = _this14.store.cart.getItems();
2481
- productResources.forEach(function (n) {
2482
- // 单个预约检测规则:
2483
- // 1、跟我一样的商品同一时间在购物车里不可以超过我最少的那种资源的关联的资源个数
2484
- // 2、跟我不一样的商品,只需要跟我当前商品有同一种类型的资源的同一时间的,她配置了几个资源的个数+我配置了几个资源的个数,然后购物车里有几个这样的商品,对应的资源做一个去重,不超过这个去重以后的总数
2485
- if (n.type === 'single') {
2486
- var currentResourcesSet = new Set([].concat(_toConsumableArray(n.optional_resource), _toConsumableArray(n.default_resource)));
2487
- // 规则 1
2488
- var sameCartItems = cartItems.filter(function (m) {
2489
- var _m$_productOrigin, _targetProductData$id;
2490
- return ((_m$_productOrigin = m._productOrigin) === null || _m$_productOrigin === void 0 || (_m$_productOrigin = _m$_productOrigin.id) === null || _m$_productOrigin === void 0 ? void 0 : _m$_productOrigin.toString()) === (targetProductData === null || targetProductData === void 0 || (_targetProductData$id = targetProductData.id) === null || _targetProductData$id === void 0 ? void 0 : _targetProductData$id.toString()) && "".concat(m.start_date, " ").concat(m.start_time) === item.start && "".concat(m.start_date, " ").concat(m.end_time) === item.end;
2491
- });
2492
- if (sameCartItems.length > 0 && sameCartItems.length >= currentResourcesSet.size || sameCartItems.length > bookingLeft) {
2493
- bookingLeft = 0;
2494
- count = 0;
2495
- }
2496
- // 规则 2
2497
- var otherCartItems = cartItems.filter(function (m) {
2498
- var _m$_productOrigin2, _targetProductData$id2;
2499
- return ((_m$_productOrigin2 = m._productOrigin) === null || _m$_productOrigin2 === void 0 || (_m$_productOrigin2 = _m$_productOrigin2.id) === null || _m$_productOrigin2 === void 0 ? void 0 : _m$_productOrigin2.toString()) !== (targetProductData === null || targetProductData === void 0 || (_targetProductData$id2 = targetProductData.id) === null || _targetProductData$id2 === void 0 ? void 0 : _targetProductData$id2.toString()) && "".concat(m.start_date, " ").concat(m.start_time) === item.start && "".concat(m.start_date, " ").concat(m.end_time) === item.end;
2500
- });
2501
- otherCartItems.forEach(function (m) {
2502
- var _m$_productOrigin3;
2503
- var sameTypeResources = (_m$_productOrigin3 = m._productOrigin) === null || _m$_productOrigin3 === void 0 || (_m$_productOrigin3 = _m$_productOrigin3.product_resource) === null || _m$_productOrigin3 === void 0 || (_m$_productOrigin3 = _m$_productOrigin3.resources) === null || _m$_productOrigin3 === void 0 ? void 0 : _m$_productOrigin3.find(function (m) {
2504
- return m.type === n.type;
2505
- });
2506
- var sameTypeResourcesSet = new Set([].concat(_toConsumableArray((sameTypeResources === null || sameTypeResources === void 0 ? void 0 : sameTypeResources.optional_resource) || []), _toConsumableArray((sameTypeResources === null || sameTypeResources === void 0 ? void 0 : sameTypeResources.default_resource) || [])));
2507
- // 把sameTypeResourcesSet 加到currentResourcesSet
2508
- sameTypeResourcesSet.forEach(function (resource) {
2509
- return currentResourcesSet.add(resource);
2429
+
2430
+ // 计算购物车中商品的容量占用情况
2431
+ var cartCapacityUsage = calculateCartItemsCapacityUsageByResourceType({
2432
+ cartItems: cartItems,
2433
+ timeSlotStart: item.start,
2434
+ timeSlotEnd: item.end,
2435
+ allProductResources: allProductResources || []
2436
+ });
2437
+
2438
+ // 计算每种资源类型的可用容量
2439
+ var minAvailableCount = Number.MAX_SAFE_INTEGER;
2440
+ var totalBookingLeft = 0;
2441
+ var hasAnyAvailableResource = false;
2442
+ Object.keys(resourceTypeMap).forEach(function (formId) {
2443
+ var resourcesInType = resourceTypeMap[formId];
2444
+ if (resourcesInType.length === 0) return;
2445
+
2446
+ // 确定这种资源类型的预约类型(取第一个资源的类型)
2447
+ var firstResource = resourcesInType[0];
2448
+ var isMultipleBooking = firstResource.resourceType === 'multiple';
2449
+ var cartUsageForThisType = cartCapacityUsage[formId] || 0;
2450
+ if (isMultipleBooking) {
2451
+ // 多个预约:计算所有资源的总可用容量
2452
+ var totalAvailableCapacity = 0;
2453
+ var availableResourceCount = 0;
2454
+ resourcesInType.forEach(function (resource) {
2455
+ var mTimes = resource.times.filter(function (n) {
2456
+ return !dayjs(n.start_at).isAfter(dayjs(item.start), 'minute') && !dayjs(n.end_at).isBefore(dayjs(item.end), 'minute') || dayjs(n.start_at).isBefore(dayjs(item.end), 'minute') && dayjs(n.end_at).isAfter(dayjs(item.start), 'minute');
2510
2457
  });
2511
- });
2512
- // 先确定是否每一个currentResourcesSet在这个时间点的 event_list 都是空的,如果不是空的还需要把他踢出currentResourcesSet
2513
- var currentDataResources = _this14.store.date.getResourcesListByDate(dayjs(item.start).format('YYYY-MM-DD'));
2514
- currentDataResources === null || currentDataResources === void 0 || currentDataResources.forEach(function (m) {
2515
- if (currentResourcesSet.has(m.id)) {
2516
- var mTimes = m.times.filter(function (n) {
2517
- return !dayjs(n.start_at).isAfter(dayjs(item.start), 'minute') && !dayjs(n.end_at).isBefore(dayjs(item.end), 'minute') || dayjs(n.start_at).isBefore(dayjs(item.end), 'minute') && dayjs(n.end_at).isAfter(dayjs(item.start), 'minute');
2458
+ if (mTimes.length === 0) return;
2459
+ var resourceAvailableCapacity = 0;
2460
+ mTimes.forEach(function (childTime) {
2461
+ var res = getIsUsableByTimeItem({
2462
+ timeSlice: {
2463
+ start_time: item.start,
2464
+ end_time: item.end,
2465
+ start_at: dayjs(item.start),
2466
+ end_at: dayjs(item.end)
2467
+ },
2468
+ time: childTime,
2469
+ resource: resource,
2470
+ currentCount: 1,
2471
+ resourcesUseableMap: resourcesUseableMap,
2472
+ cut_off_time: targetProductData === null || targetProductData === void 0 ? void 0 : targetProductData.cut_off_time
2518
2473
  });
2519
- if (!mTimes.length || mTimes.some(function (n) {
2520
- return n.event_list.length;
2521
- })) {
2522
- currentResourcesSet.delete(m.id);
2474
+ if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[resource.id]) !== false && res.reason !== 'capacityOnly') {
2475
+ resourcesUseableMap[resource.id] = res.usable;
2523
2476
  }
2524
- }
2525
- });
2526
- if (currentResourcesSet.size > 0 && otherCartItems.length + sameCartItems.length >= currentResourcesSet.size) {
2527
- bookingLeft = 0;
2528
- count = 0;
2529
- }
2530
- } else {
2531
- // 多个预约的检测规则:
2532
- // 规则1、跟我一样的商品同一时间在购物车需要的容量总数不可以超过我配置的资源的 capacity 之和
2533
- var _sameCartItems = cartItems.filter(function (m) {
2534
- var _m$_productOrigin4, _targetProductData$id3;
2535
- return ((_m$_productOrigin4 = m._productOrigin) === null || _m$_productOrigin4 === void 0 || (_m$_productOrigin4 = _m$_productOrigin4.id) === null || _m$_productOrigin4 === void 0 ? void 0 : _m$_productOrigin4.toString()) === (targetProductData === null || targetProductData === void 0 || (_targetProductData$id3 = targetProductData.id) === null || _targetProductData$id3 === void 0 ? void 0 : _targetProductData$id3.toString()) && "".concat(m.start_date, " ").concat(m.start_time) === item.start && "".concat(m.start_date, " ").concat(m.end_time) === item.end;
2536
- });
2537
- var sameCartNeedCapacity = _sameCartItems.reduce(function (acc, curr) {
2538
- return acc + getCapacityInfoByCartItem(curr).currentCapacity;
2539
- }, 0);
2540
- var currentProductResourcesCapacity = n.renderList.reduce(function (acc, curr) {
2541
- return !curr.onlyComputed ? acc + curr.capacity || 0 : acc;
2542
- }, 0);
2543
- if (sameCartNeedCapacity >= currentProductResourcesCapacity) {
2544
- bookingLeft = 0;
2545
- count = 0;
2546
- }
2547
- // 规则2、不管是不是跟我一样的商品,只需要跟我当前商品有同一种类型的资源的同一时间的,把所有购物车的 capacity 之和 和 所有当前类型资源的 capacity 之和比较,如果超过了resourcesCapacity,则不可用
2548
- // const otherCartItems = cartItems.filter((m) => m._productOrigin?.id?.toString() !== targetProductData?.id?.toString() && m.start_time === item.start && m.end_time === item.end);
2549
- var otherSameTimesCartItems = cartItems.filter(function (m) {
2550
- return "".concat(m.start_date, " ").concat(m.start_time) === item.start && "".concat(m.start_date, " ").concat(m.end_time) === item.end;
2551
- });
2552
- var otherCartNeedCapacity = otherSameTimesCartItems.reduce(function (acc, curr) {
2553
- return acc + getCapacityInfoByCartItem(curr).currentCapacity;
2554
- }, 0);
2555
- var allRenderList = _toConsumableArray(n.renderList.filter(function (m) {
2556
- return !m.onlyComputed;
2557
- }));
2558
- otherSameTimesCartItems.forEach(function (m) {
2559
- var _m$_productOrigin5;
2560
- var productResources = getResourcesByProduct(getResourcesMap((targetResourceDate === null || targetResourceDate === void 0 ? void 0 : targetResourceDate.resource) || []), ((_m$_productOrigin5 = m._productOrigin) === null || _m$_productOrigin5 === void 0 || (_m$_productOrigin5 = _m$_productOrigin5.product_resource) === null || _m$_productOrigin5 === void 0 ? void 0 : _m$_productOrigin5.resources) || [], selectedResources, 1);
2561
- productResources.forEach(function (m) {
2562
- if (m.id === n.id) {
2563
- m.renderList.forEach(function (n) {
2564
- if (!n.onlyComputed && !allRenderList.find(function (m) {
2565
- return m.id === n.id;
2566
- })) {
2567
- allRenderList.push(n);
2568
- }
2569
- });
2477
+ if (res.usable && !resource.onlyComputed) {
2478
+ resourceAvailableCapacity = Math.max(resourceAvailableCapacity, res.remainingCapacity);
2479
+ availableResourceCount++;
2570
2480
  }
2571
2481
  });
2482
+ totalAvailableCapacity += resourceAvailableCapacity;
2572
2483
  });
2573
- var currentTypeResourcesCapacity = allRenderList.reduce(function (acc, curr) {
2574
- return acc + curr.capacity || 0;
2575
- }, 0);
2576
- // 计算当前时间段内所有资源的已使用容量
2577
- var usedCapacity = allRenderList.reduce(function (acc, curr) {
2578
- var mTimes = curr.times.filter(function (n) {
2484
+
2485
+ // 减去购物车中已占用的容量
2486
+ var netAvailableCapacity = Math.max(0, totalAvailableCapacity - cartUsageForThisType);
2487
+ if (netAvailableCapacity < minAvailableCount) {
2488
+ minAvailableCount = netAvailableCapacity;
2489
+ }
2490
+ if (netAvailableCapacity > 0) {
2491
+ hasAnyAvailableResource = true;
2492
+ }
2493
+ } else {
2494
+ // 单个预约:计算可用资源个数
2495
+ var _availableResourceCount = 0;
2496
+ resourcesInType.forEach(function (resource) {
2497
+ var mTimes = resource.times.filter(function (n) {
2579
2498
  return !dayjs(n.start_at).isAfter(dayjs(item.start), 'minute') && !dayjs(n.end_at).isBefore(dayjs(item.end), 'minute') || dayjs(n.start_at).isBefore(dayjs(item.end), 'minute') && dayjs(n.end_at).isAfter(dayjs(item.start), 'minute');
2580
2499
  });
2581
- mTimes.forEach(function (n) {
2582
- var _n$event_list;
2583
- acc += (_n$event_list = n.event_list) === null || _n$event_list === void 0 ? void 0 : _n$event_list.reduce(function (acc, curr) {
2584
- return acc + curr.pax;
2585
- }, 0);
2500
+ if (mTimes.length === 0) return;
2501
+ var isResourceAvailable = false;
2502
+ mTimes.forEach(function (childTime) {
2503
+ var res = getIsUsableByTimeItem({
2504
+ timeSlice: {
2505
+ start_time: item.start,
2506
+ end_time: item.end,
2507
+ start_at: dayjs(item.start),
2508
+ end_at: dayjs(item.end)
2509
+ },
2510
+ time: childTime,
2511
+ resource: resource,
2512
+ currentCount: 1,
2513
+ resourcesUseableMap: resourcesUseableMap,
2514
+ cut_off_time: targetProductData === null || targetProductData === void 0 ? void 0 : targetProductData.cut_off_time
2515
+ });
2516
+ if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[resource.id]) !== false && res.reason !== 'capacityOnly') {
2517
+ resourcesUseableMap[resource.id] = res.usable;
2518
+ }
2519
+ if (res.usable && !resource.onlyComputed) {
2520
+ isResourceAvailable = true;
2521
+ }
2586
2522
  });
2587
- return acc;
2588
- }, 0);
2589
- // 如果已使用容量超过了当前类型资源的容量,则不可用
2590
- if (sameCartNeedCapacity + otherCartNeedCapacity + usedCapacity >= currentTypeResourcesCapacity) {
2591
- bookingLeft = 0;
2592
- count = 0;
2523
+ if (isResourceAvailable) {
2524
+ _availableResourceCount++;
2525
+ }
2526
+ });
2527
+
2528
+ // 减去购物车中需要占用的资源个数
2529
+ var netAvailableResources = Math.max(0, _availableResourceCount - cartUsageForThisType);
2530
+ if (netAvailableResources < minAvailableCount) {
2531
+ minAvailableCount = netAvailableResources;
2532
+ }
2533
+ if (netAvailableResources > 0) {
2534
+ hasAnyAvailableResource = true;
2593
2535
  }
2536
+ totalBookingLeft += netAvailableResources;
2594
2537
  }
2595
2538
  });
2596
2539
  var startDayJs = dayjs(item.start);
2597
2540
  var endDayJs = dayjs(item.end);
2541
+
2542
+ // 最终的可用容量是所有资源类型中最小的那个
2543
+ var finalCount = hasAnyAvailableResource ? minAvailableCount === Number.MAX_SAFE_INTEGER ? 0 : minAvailableCount : 0;
2598
2544
  return {
2599
2545
  start_time: startDayJs.format('HH:mm'),
2600
2546
  end_time: endDayJs.format('HH:mm'),
2601
2547
  start_at: startDayJs,
2602
2548
  end_at: endDayJs,
2603
- count: count,
2604
- left: bookingLeft
2549
+ count: finalCount,
2550
+ left: Math.max(0, totalBookingLeft)
2605
2551
  };
2606
2552
  });
2607
2553
  return formatScheduleTimeSlots;
@@ -2611,16 +2557,100 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2611
2557
  // 时长类商品关联的资源为多个预约时,在点击进入"选择资源"步骤之前,需要检测当前所有资源的总容量
2612
2558
  // 选择商品数量大于所有资源配置的总容量时,不能进入下一步,需要在"选择商品"这一步时提示。
2613
2559
  // 注意 资源分为多个种类,需要每个种类单独检测,不能一股脑把所有资源的容量加起来检测
2560
+ /**
2561
+ * 找到多个资源的公共可用时间段
2562
+ */
2563
+ }, {
2564
+ key: "findCommonAvailableTimeSlots",
2565
+ value: function findCommonAvailableTimeSlots(resources) {
2566
+ if (resources.length === 0) return [];
2567
+ console.log("\u8BA1\u7B97 ".concat(resources.length, " \u4E2A\u8D44\u6E90\u7684\u516C\u5171\u65F6\u95F4\u6BB5"));
2568
+
2569
+ // 收集所有资源的时间段,转换为统一的时间格式
2570
+ var allTimeSlots = resources.map(function (resource) {
2571
+ return resource.times.map(function (time) {
2572
+ return {
2573
+ start: dayjs(time.start_at),
2574
+ end: dayjs(time.end_at)
2575
+ };
2576
+ });
2577
+ });
2578
+ console.log('所有资源的时间段:', allTimeSlots.map(function (slots) {
2579
+ return slots.map(function (slot) {
2580
+ return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
2581
+ });
2582
+ }));
2583
+
2584
+ // 找到公共时间段的交集
2585
+ var commonSlots = allTimeSlots[0]; // 从第一个资源的时间段开始
2586
+ console.log('初始公共时间段:', commonSlots.map(function (slot) {
2587
+ return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
2588
+ }));
2589
+
2590
+ // 与其他资源的时间段求交集
2591
+ var _loop2 = function _loop2() {
2592
+ var currentResourceSlots = allTimeSlots[i];
2593
+ var intersections = [];
2594
+
2595
+ // 计算当前公共时间段与下一个资源时间段的交集
2596
+ commonSlots.forEach(function (commonSlot) {
2597
+ currentResourceSlots.forEach(function (currentSlot) {
2598
+ var overlapStart = commonSlot.start.isAfter(currentSlot.start) ? commonSlot.start : currentSlot.start;
2599
+ var overlapEnd = commonSlot.end.isBefore(currentSlot.end) ? commonSlot.end : currentSlot.end;
2600
+
2601
+ // 如果有重叠时间且重叠时间大于0
2602
+ if (overlapStart.isBefore(overlapEnd)) {
2603
+ intersections.push({
2604
+ start: overlapStart,
2605
+ end: overlapEnd
2606
+ });
2607
+ }
2608
+ });
2609
+ });
2610
+ commonSlots = intersections;
2611
+ console.log("\u4E0E\u8D44\u6E90".concat(i, "\u6C42\u4EA4\u96C6\u540E\u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonSlots.map(function (slot) {
2612
+ return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
2613
+ }));
2614
+
2615
+ // 如果没有公共时间段,直接返回
2616
+ if (commonSlots.length === 0) {
2617
+ console.log('没有找到公共时间段');
2618
+ return {
2619
+ v: []
2620
+ };
2621
+ }
2622
+ },
2623
+ _ret2;
2624
+ for (var i = 1; i < allTimeSlots.length; i++) {
2625
+ _ret2 = _loop2();
2626
+ if (_ret2) return _ret2.v;
2627
+ }
2628
+
2629
+ // 格式化返回结果
2630
+ var result = commonSlots.map(function (slot) {
2631
+ return {
2632
+ startTime: slot.start.format('HH:mm'),
2633
+ endTime: slot.end.format('HH:mm')
2634
+ };
2635
+ });
2636
+ console.log('最终公共时间段:', result);
2637
+ return result;
2638
+ }
2614
2639
  }, {
2615
2640
  key: "checkMaxDurationCapacity",
2616
2641
  value: function checkMaxDurationCapacity() {
2617
- var _this15 = this;
2642
+ var _this14 = this;
2618
2643
  var cartItems = cloneDeep(this.store.cart.getItems());
2619
- if (cartItems.length === 0) return true;
2644
+ if (cartItems.length === 0) return {
2645
+ success: true,
2646
+ minAvailableCount: 0
2647
+ };
2620
2648
 
2621
2649
  // 将购物车商品分为有时间的和没有时间的
2622
2650
  var itemsWithTime = [];
2623
2651
  var itemsWithoutTime = [];
2652
+ // 记录每种资源类型的可用数量
2653
+ var availableCountsByResourceType = [];
2624
2654
  cartItems.forEach(function (cartItem) {
2625
2655
  if (cartItem.start_time && cartItem.end_time && cartItem.start_date) {
2626
2656
  itemsWithTime.push(cartItem);
@@ -2655,48 +2685,215 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2655
2685
  });
2656
2686
  });
2657
2687
 
2658
- // 为每种资源类型获取公共可用时间
2659
- var _loop2 = function _loop2() {
2688
+ // 为每种资源类型检查容量
2689
+ var dateRange = this.store.date.getDateRange();
2690
+ if (!dateRange || dateRange.length === 0) return {
2691
+ success: false,
2692
+ minAvailableCount: 0
2693
+ };
2694
+ var resourcesDates = this.store.date.getDateList();
2695
+ var targetResourceDate = resourcesDates.find(function (n) {
2696
+ return n.date === dateRange[0].date;
2697
+ });
2698
+ if (!targetResourceDate) return {
2699
+ success: false,
2700
+ minAvailableCount: 0
2701
+ };
2702
+ var resourcesMap = getResourcesMap(targetResourceDate.resource || []);
2703
+
2704
+ // 从购物车商品中获取资源类型配置,建立 resourceCode 到 form_id 的映射关系
2705
+ var resourceCodeToFormIdMap = {};
2706
+
2707
+ // 遍历购物车中的商品,收集所有资源类型配置
2708
+ Object.values(itemsByResourceType).flat().forEach(function (cartItem) {
2709
+ var _cartItem$_productOri11;
2710
+ if ((_cartItem$_productOri11 = cartItem._productOrigin) !== null && _cartItem$_productOri11 !== void 0 && (_cartItem$_productOri11 = _cartItem$_productOri11.product_resource) !== null && _cartItem$_productOri11 !== void 0 && _cartItem$_productOri11.resources) {
2711
+ cartItem._productOrigin.product_resource.resources.forEach(function (resourceConfig) {
2712
+ // 只处理启用的资源类型 (status === 1)
2713
+ if (resourceConfig.status === 1 && resourceConfig.code) {
2714
+ var _resourceConfig$id, _resourceConfig$resou;
2715
+ var formId = ((_resourceConfig$id = resourceConfig.id) === null || _resourceConfig$id === void 0 ? void 0 : _resourceConfig$id.toString()) || ((_resourceConfig$resou = resourceConfig.resource_type_id) === null || _resourceConfig$resou === void 0 ? void 0 : _resourceConfig$resou.toString());
2716
+ if (formId) {
2717
+ resourceCodeToFormIdMap[resourceConfig.code] = formId;
2718
+ }
2719
+ }
2720
+ });
2721
+ }
2722
+ });
2723
+ var hasCapacityIssue = false;
2724
+ var resourceCapacityInfo = [];
2725
+
2726
+ // 先检查所有资源类型,收集可用数量信息
2727
+ var _loop3 = function _loop3() {
2728
+ var _resourceTypeConfig;
2660
2729
  var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
2661
2730
  resourceCode = _Object$entries$_i[0],
2662
2731
  items = _Object$entries$_i[1];
2732
+ // 获取该资源类型对应的 form_id
2733
+ var targetFormId = resourceCodeToFormIdMap[resourceCode];
2734
+ if (!targetFormId) {
2735
+ console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u627E\u4E0D\u5230\u5BF9\u5E94\u7684 form_id"));
2736
+ return {
2737
+ v: {
2738
+ success: false,
2739
+ minAvailableCount: 0
2740
+ }
2741
+ };
2742
+ }
2743
+
2744
+ // 获取该资源类型的所有资源
2745
+ var resourcesOfThisType = [];
2746
+ items.forEach(function (cartItem) {
2747
+ var productResourceIds = getResourcesIdsByProduct(cartItem._productOrigin);
2748
+ productResourceIds.forEach(function (resourceId) {
2749
+ var _resource$form_id2;
2750
+ var resource = resourcesMap[resourceId];
2751
+ if (resource && ((_resource$form_id2 = resource.form_id) === null || _resource$form_id2 === void 0 ? void 0 : _resource$form_id2.toString()) === targetFormId) {
2752
+ // 避免重复添加同一个资源
2753
+ if (!resourcesOfThisType.find(function (r) {
2754
+ return r.id === resource.id;
2755
+ })) {
2756
+ resourcesOfThisType.push(resource);
2757
+ }
2758
+ }
2759
+ });
2760
+ });
2761
+ if (resourcesOfThisType.length === 0) {
2762
+ console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u627E\u5230\u53EF\u7528\u8D44\u6E90"));
2763
+ return {
2764
+ v: {
2765
+ success: false,
2766
+ minAvailableCount: 0
2767
+ }
2768
+ };
2769
+ }
2770
+
2771
+ // 检查资源类型(单个预约 vs 多个预约)
2772
+ // 从商品配置中获取资源类型信息
2773
+ var resourceTypeConfig = null;
2774
+ var _iterator3 = _createForOfIteratorHelper(items),
2775
+ _step3;
2663
2776
  try {
2664
- var commonTimeSlots = _this15.getTimeSlotByAllResources(resourceCode);
2665
- if (commonTimeSlots && commonTimeSlots.length > 0) {
2666
- // 使用第一个可用时间片
2667
- var firstTimeSlot = commonTimeSlots[0];
2668
- var startDate = dayjs(firstTimeSlot.start_at).format('YYYY-MM-DD');
2669
- var startTime = firstTimeSlot.start_time;
2670
- var endTime = firstTimeSlot.end_time;
2671
-
2672
- // 为这些商品设置时间信息(创建副本,不修改原始数据)
2673
- items.forEach(function (cartItem) {
2674
- var processedItem = _objectSpread(_objectSpread({}, cartItem), {}, {
2675
- start_date: startDate,
2676
- start_time: startTime,
2677
- end_time: endTime,
2678
- end_date: startDate
2777
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
2778
+ var _cartItem$_productOri12;
2779
+ var cartItem = _step3.value;
2780
+ if ((_cartItem$_productOri12 = cartItem._productOrigin) !== null && _cartItem$_productOri12 !== void 0 && (_cartItem$_productOri12 = _cartItem$_productOri12.product_resource) !== null && _cartItem$_productOri12 !== void 0 && _cartItem$_productOri12.resources) {
2781
+ resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(function (r) {
2782
+ return r.code === resourceCode && r.status === 1;
2679
2783
  });
2680
- processedItemsWithoutTime.push(processedItem);
2681
- });
2682
- } else {
2683
- // 如果没有公共可用时间,说明容量不足
2684
- console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u516C\u5171\u53EF\u7528\u65F6\u95F4"));
2685
- return {
2686
- v: false
2687
- };
2784
+ if (resourceTypeConfig) break;
2785
+ }
2688
2786
  }
2689
- } catch (error) {
2690
- console.warn("\u83B7\u53D6\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u516C\u5171\u53EF\u7528\u65F6\u95F4\u5931\u8D25:"), error);
2691
- // 如果获取公共时间失败,继续处理其他资源类型
2692
- return 0; // continue
2787
+ } catch (err) {
2788
+ _iterator3.e(err);
2789
+ } finally {
2790
+ _iterator3.f();
2791
+ }
2792
+ var isMultipleBooking = ((_resourceTypeConfig = resourceTypeConfig) === null || _resourceTypeConfig === void 0 ? void 0 : _resourceTypeConfig.type) === 'multiple';
2793
+ var totalAvailable;
2794
+ var requiredAmount;
2795
+ var availableAmount;
2796
+ if (isMultipleBooking) {
2797
+ // 多个预约:计算容量
2798
+ totalAvailable = resourcesOfThisType.reduce(function (sum, resource) {
2799
+ return sum + (resource.capacity || 0);
2800
+ }, 0);
2801
+ requiredAmount = items.reduce(function (sum, cartItem) {
2802
+ var _getCapacityInfoByCar7 = getCapacityInfoByCartItem(cartItem),
2803
+ currentCapacity = _getCapacityInfoByCar7.currentCapacity;
2804
+ return sum + currentCapacity;
2805
+ }, 0);
2806
+ availableAmount = Math.max(0, totalAvailable - requiredAmount);
2807
+ } else {
2808
+ // 单个预约:计算资源个数
2809
+ totalAvailable = resourcesOfThisType.length;
2810
+ requiredAmount = items.reduce(function (sum, cartItem) {
2811
+ return sum + (cartItem.num || 1);
2812
+ }, 0);
2813
+ availableAmount = Math.max(0, totalAvailable - requiredAmount);
2693
2814
  }
2815
+
2816
+ // 记录资源容量信息
2817
+ resourceCapacityInfo.push({
2818
+ code: resourceCode,
2819
+ available: availableAmount,
2820
+ total: totalAvailable,
2821
+ required: requiredAmount,
2822
+ isMultiple: isMultipleBooking
2823
+ });
2824
+ availableCountsByResourceType.push(availableAmount);
2825
+
2826
+ // 检查是否有容量问题
2827
+ if (requiredAmount > totalAvailable) {
2828
+ hasCapacityIssue = true;
2829
+ console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " ").concat(isMultipleBooking ? '容量' : '资源数量', "\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredAmount, ", \u603B\u5171 ").concat(totalAvailable));
2830
+ }
2831
+
2832
+ // 为通过检测的商品分配一个公共可用时间段
2833
+ console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u8D44\u6E90\u65F6\u95F4\u4FE1\u606F:"), resourcesOfThisType.map(function (r) {
2834
+ return {
2835
+ id: r.id,
2836
+ times: r.times.map(function (t) {
2837
+ return "".concat(t.start_at, " - ").concat(t.end_at);
2838
+ })
2839
+ };
2840
+ }));
2841
+
2842
+ // 找到所有资源都可用的时间段
2843
+ var commonTimeSlots = _this14.findCommonAvailableTimeSlots(resourcesOfThisType);
2844
+ console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonTimeSlots);
2845
+ if (commonTimeSlots.length === 0) {
2846
+ console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u516C\u5171\u53EF\u7528\u65F6\u95F4\u6BB5"));
2847
+ return {
2848
+ v: {
2849
+ success: false,
2850
+ minAvailableCount: 0
2851
+ }
2852
+ };
2853
+ }
2854
+
2855
+ // 使用第一个公共可用时间段
2856
+ var firstCommonSlot = commonTimeSlots[0];
2857
+ console.log("\u4F7F\u7528\u516C\u5171\u65F6\u95F4\u6BB5: ".concat(firstCommonSlot.startTime, " - ").concat(firstCommonSlot.endTime));
2858
+ items.forEach(function (cartItem) {
2859
+ var processedItem = _objectSpread(_objectSpread({}, cartItem), {}, {
2860
+ start_date: dateRange[0].date,
2861
+ start_time: firstCommonSlot.startTime,
2862
+ end_time: firstCommonSlot.endTime,
2863
+ end_date: dateRange[0].date
2864
+ });
2865
+ processedItemsWithoutTime.push(processedItem);
2866
+ });
2694
2867
  },
2695
- _ret2;
2868
+ _ret3;
2696
2869
  for (var _i = 0, _Object$entries = Object.entries(itemsByResourceType); _i < _Object$entries.length; _i++) {
2697
- _ret2 = _loop2();
2698
- if (_ret2 === 0) continue;
2699
- if (_ret2) return _ret2.v;
2870
+ _ret3 = _loop3();
2871
+ if (_ret3) return _ret3.v;
2872
+ }
2873
+
2874
+ // 如果有容量问题,找出限制最严格的资源类型,返回其总容量
2875
+ if (hasCapacityIssue) {
2876
+ // 找出超出容量的资源类型中,总容量最少的那个
2877
+ var overCapacityResources = resourceCapacityInfo.filter(function (info) {
2878
+ return info.required > info.total;
2879
+ });
2880
+ if (overCapacityResources.length > 0) {
2881
+ var _minTotalCapacity = Math.min.apply(Math, _toConsumableArray(overCapacityResources.map(function (info) {
2882
+ return info.total;
2883
+ })));
2884
+ return {
2885
+ success: false,
2886
+ minAvailableCount: _minTotalCapacity
2887
+ };
2888
+ }
2889
+ // 如果没有超出容量的(理论上不应该发生),返回总容量最少的
2890
+ var minTotalCapacity = Math.min.apply(Math, _toConsumableArray(resourceCapacityInfo.map(function (info) {
2891
+ return info.total;
2892
+ })));
2893
+ return {
2894
+ success: false,
2895
+ minAvailableCount: minTotalCapacity
2896
+ };
2700
2897
  }
2701
2898
  }
2702
2899
 
@@ -2715,7 +2912,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2715
2912
  });
2716
2913
 
2717
2914
  // 检查每个时间段是否有足够的资源容量
2718
- var _loop3 = function _loop3() {
2915
+ var _loop4 = function _loop4() {
2719
2916
  var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
2720
2917
  timeSlotKey = _Object$entries2$_i[0],
2721
2918
  itemsInTimeSlot = _Object$entries2$_i[1];
@@ -2733,8 +2930,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2733
2930
  var resourcesIdSet = new Set();
2734
2931
 
2735
2932
  // 获取资源数据
2736
- var dateRange = _this15.store.date.getDateRange();
2737
- var resourcesDates = _this15.store.date.getDateList();
2933
+ var dateRange = _this14.store.date.getDateRange();
2934
+ var resourcesDates = _this14.store.date.getDateList();
2738
2935
  var targetResourceDate = resourcesDates.find(function (n) {
2739
2936
  return n.date === startDate;
2740
2937
  });
@@ -2755,18 +2952,29 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2755
2952
 
2756
2953
  // 按资源类型分组检查容量
2757
2954
  if (!checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, itemsInTimeSlot, allResourcesForTimeSlot)) {
2955
+ // 如果有可用数量记录,返回最小值;否则返回 0
2956
+ var _minAvailableCount = availableCountsByResourceType.length > 0 ? Math.min.apply(Math, availableCountsByResourceType) : 0;
2758
2957
  return {
2759
- v: false
2958
+ v: {
2959
+ success: false,
2960
+ minAvailableCount: _minAvailableCount
2961
+ }
2760
2962
  };
2761
2963
  }
2762
2964
  },
2763
- _ret3;
2965
+ _ret4;
2764
2966
  for (var _i2 = 0, _Object$entries2 = Object.entries(cartItemsByTimeSlot); _i2 < _Object$entries2.length; _i2++) {
2765
- _ret3 = _loop3();
2766
- if (_ret3 === 0) continue;
2767
- if (_ret3) return _ret3.v;
2967
+ _ret4 = _loop4();
2968
+ if (_ret4 === 0) continue;
2969
+ if (_ret4) return _ret4.v;
2768
2970
  }
2769
- return true;
2971
+
2972
+ // 全部通过检测,返回成功和最小可用数量
2973
+ var minAvailableCount = availableCountsByResourceType.length > 0 ? Math.min.apply(Math, availableCountsByResourceType) : 0;
2974
+ return {
2975
+ success: true,
2976
+ minAvailableCount: minAvailableCount
2977
+ };
2770
2978
  }
2771
2979
  }, {
2772
2980
  key: "setOtherData",
@@ -2839,7 +3047,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2839
3047
  }, {
2840
3048
  key: "getResourcesByCartItemAndCode",
2841
3049
  value: function getResourcesByCartItemAndCode(cartItemId, resourceCode) {
2842
- var _cartItem$_productOri11;
3050
+ var _cartItem$_productOri13;
2843
3051
  var dateRange = this.store.date.getDateRange();
2844
3052
  var resources = [];
2845
3053
  if (dateRange !== null && dateRange !== void 0 && dateRange.length) {
@@ -2862,16 +3070,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2862
3070
  });
2863
3071
  if (!cartItem) return [];
2864
3072
  var selectedResources = [];
2865
- var _getCapacityInfoByCar7 = getCapacityInfoByCartItem(cartItem),
2866
- currentCapacity = _getCapacityInfoByCar7.currentCapacity,
2867
- formatCapacity = _getCapacityInfoByCar7.formatCapacity;
3073
+ var _getCapacityInfoByCar8 = getCapacityInfoByCartItem(cartItem),
3074
+ currentCapacity = _getCapacityInfoByCar8.currentCapacity,
3075
+ formatCapacity = _getCapacityInfoByCar8.formatCapacity;
2868
3076
  cartItem._origin.metadata.capacity = formatCapacity;
2869
3077
  if (cartItem.holder_id) {
2870
3078
  selectedResources = getOthersSelectedResources(cartItems, cartItem.holder_id, resourcesMap);
2871
3079
  } else {
2872
3080
  selectedResources = getOthersCartSelectedResources(cartItems, cartItem._id, resourcesMap);
2873
3081
  }
2874
- var productResources = getResourcesByProduct(resourcesMap, ((_cartItem$_productOri11 = cartItem._productOrigin) === null || _cartItem$_productOri11 === void 0 || (_cartItem$_productOri11 = _cartItem$_productOri11.product_resource) === null || _cartItem$_productOri11 === void 0 ? void 0 : _cartItem$_productOri11.resources) || [], selectedResources, currentCapacity);
3082
+ var productResources = getResourcesByProduct(resourcesMap, ((_cartItem$_productOri13 = cartItem._productOrigin) === null || _cartItem$_productOri13 === void 0 || (_cartItem$_productOri13 = _cartItem$_productOri13.product_resource) === null || _cartItem$_productOri13 === void 0 ? void 0 : _cartItem$_productOri13.resources) || [], selectedResources, currentCapacity);
2875
3083
  var targetResource = productResources.find(function (resource) {
2876
3084
  return resource.code === resourceCode;
2877
3085
  });
@@ -2894,7 +3102,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2894
3102
  });
2895
3103
  if (mTimes.length === 0) return false;
2896
3104
  var canUseArr = mTimes.map(function (item) {
2897
- var _cartItem$_productOri12;
3105
+ var _cartItem$_productOri14;
2898
3106
  var res = getIsUsableByTimeItem({
2899
3107
  timeSlice: {
2900
3108
  start_time: startTime.format('HH:mm'),
@@ -2906,7 +3114,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2906
3114
  resource: m,
2907
3115
  currentCount: currentCapacity || 0,
2908
3116
  resourcesUseableMap: resourcesUseableMap,
2909
- cut_off_time: (_cartItem$_productOri12 = cartItem._productOrigin) === null || _cartItem$_productOri12 === void 0 ? void 0 : _cartItem$_productOri12.cut_off_time
3117
+ cut_off_time: (_cartItem$_productOri14 = cartItem._productOrigin) === null || _cartItem$_productOri14 === void 0 ? void 0 : _cartItem$_productOri14.cut_off_time
2910
3118
  });
2911
3119
  if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[m.id]) !== false && res.reason !== 'capacityOnly') {
2912
3120
  resourcesUseableMap[m.id] = res.usable;
@@ -2920,12 +3128,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2920
3128
  });
2921
3129
  } else {
2922
3130
  targetResource.renderList = targetResource.renderList.filter(function (n) {
2923
- var _cartItem$_productOri13;
3131
+ var _cartItem$_productOri15;
2924
3132
  var recordCount = n.capacity || 0;
2925
3133
  if (n.onlyComputed) return false;
2926
3134
  var timeSlots = getTimeSlicesByResource({
2927
3135
  resource: n,
2928
- duration: ((_cartItem$_productOri13 = cartItem._productOrigin) === null || _cartItem$_productOri13 === void 0 || (_cartItem$_productOri13 = _cartItem$_productOri13.duration) === null || _cartItem$_productOri13 === void 0 ? void 0 : _cartItem$_productOri13.value) || 10,
3136
+ duration: ((_cartItem$_productOri15 = cartItem._productOrigin) === null || _cartItem$_productOri15 === void 0 || (_cartItem$_productOri15 = _cartItem$_productOri15.duration) === null || _cartItem$_productOri15 === void 0 ? void 0 : _cartItem$_productOri15.value) || 10,
2929
3137
  split: 10,
2930
3138
  currentDate: dateRange[0].date
2931
3139
  });
@@ -3007,7 +3215,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
3007
3215
  openResources,
3008
3216
  allProductResources,
3009
3217
  targetSchedules,
3010
- _loop4,
3218
+ _loop5,
3011
3219
  _args28 = arguments;
3012
3220
  return _regeneratorRuntime().wrap(function _callee27$(_context28) {
3013
3221
  while (1) switch (_context28.prev = _context28.next) {
@@ -3084,9 +3292,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
3084
3292
  }
3085
3293
  });
3086
3294
  targetSchedules = this.store.schedule.getScheduleListByIds(tempProducts['schedule.ids']);
3087
- _loop4 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop4() {
3295
+ _loop5 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop5() {
3088
3296
  var currentDateStr, status, _checkSessionProductL, latestStartDate, earliestEndDate, scheduleByDate, minTimeMaxTime, scheduleTimeSlots, timesSlotCanUse;
3089
- return _regeneratorRuntime().wrap(function _loop4$(_context27) {
3297
+ return _regeneratorRuntime().wrap(function _loop5$(_context27) {
3090
3298
  while (1) switch (_context27.prev = _context27.next) {
3091
3299
  case 0:
3092
3300
  currentDateStr = currentDate.format('YYYY-MM-DD');
@@ -3189,14 +3397,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
3189
3397
  case "end":
3190
3398
  return _context27.stop();
3191
3399
  }
3192
- }, _loop4);
3400
+ }, _loop5);
3193
3401
  });
3194
3402
  case 28:
3195
3403
  if (!(dayjs(currentDate).isBefore(dayjs(endDate), 'day') || dayjs(currentDate).isSame(dayjs(endDate), 'day'))) {
3196
3404
  _context28.next = 34;
3197
3405
  break;
3198
3406
  }
3199
- return _context28.delegateYield(_loop4(), "t0", 30);
3407
+ return _context28.delegateYield(_loop5(), "t0", 30);
3200
3408
  case 30:
3201
3409
  if (!_context28.t0) {
3202
3410
  _context28.next = 32;