@pisell/pisellos 2.1.62 → 2.1.63

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.
@@ -188,7 +188,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
188
188
  tags: ['good_pass', 'product_discount_card'],
189
189
  available: 1,
190
190
  relation_product: 1,
191
- with: ['extensionData', 'holder.detail'],
191
+ with: ['extensionData', 'customScheduleSnapshot', 'holder.detail'],
192
192
  order_behavior_count: 1,
193
193
  order_behavior_count_customer_id: customerId || 1
194
194
  });
@@ -421,6 +421,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
421
421
  product = flatItem.product;
422
422
  originProduct = flatItem.originProduct;
423
423
  } else {
424
+ var _flatItem$parentProdu;
424
425
  // bundle子商品:构造虚拟商品对象
425
426
  product = {
426
427
  _id: flatItem._id,
@@ -431,7 +432,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
431
432
  total: flatItem.total,
432
433
  origin_total: flatItem.origin_total,
433
434
  booking_id: flatItem.booking_id,
434
- discount_list: flatItem.discount_list || []
435
+ discount_list: flatItem.discount_list || [],
436
+ startDate: (_flatItem$parentProdu = flatItem.parentProduct) === null || _flatItem$parentProdu === void 0 ? void 0 : _flatItem$parentProdu.startDate
435
437
  };
436
438
  originProduct = flatItem.originProduct;
437
439
  }
@@ -506,7 +508,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
506
508
  product = flatItem.product;
507
509
  originProduct = flatItem.originProduct;
508
510
  } else {
509
- var _flatItem$bundleItem2, _flatItem$bundleItem3, _flatItem$bundleItem4;
511
+ var _flatItem$bundleItem2, _flatItem$bundleItem3, _flatItem$bundleItem4, _flatItem$parentProdu2;
510
512
  // bundle子商品
511
513
  product = {
512
514
  _id: flatItem._id,
@@ -518,7 +520,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
518
520
  original_price: flatItem === null || flatItem === void 0 || (_flatItem$bundleItem2 = flatItem.bundleItem) === null || _flatItem$bundleItem2 === void 0 ? void 0 : _flatItem$bundleItem2.original_price,
519
521
  origin_total: flatItem === null || flatItem === void 0 || (_flatItem$bundleItem3 = flatItem.bundleItem) === null || _flatItem$bundleItem3 === void 0 ? void 0 : _flatItem$bundleItem3.original_price,
520
522
  booking_id: flatItem.booking_id,
521
- discount_list: (flatItem === null || flatItem === void 0 || (_flatItem$bundleItem4 = flatItem.bundleItem) === null || _flatItem$bundleItem4 === void 0 ? void 0 : _flatItem$bundleItem4.discount_list) || []
523
+ discount_list: (flatItem === null || flatItem === void 0 || (_flatItem$bundleItem4 = flatItem.bundleItem) === null || _flatItem$bundleItem4 === void 0 ? void 0 : _flatItem$bundleItem4.discount_list) || [],
524
+ startDate: (_flatItem$parentProdu2 = flatItem.parentProduct) === null || _flatItem$parentProdu2 === void 0 ? void 0 : _flatItem$parentProdu2.startDate
522
525
  };
523
526
  originProduct = flatItem.originProduct;
524
527
  }
@@ -630,11 +633,11 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
630
633
  }
631
634
  // bundle子商品:检查自己的 discount_list 或父主商品的 discount_list
632
635
  if (flatItem.type === 'bundle') {
633
- var _product$discount_lis7, _flatItem$parentProdu;
636
+ var _product$discount_lis7, _flatItem$parentProdu3;
634
637
  if ((_product$discount_lis7 = product.discount_list) !== null && _product$discount_lis7 !== void 0 && _product$discount_lis7.some(function (item) {
635
638
  var _item$discount2;
636
639
  return ((_item$discount2 = item.discount) === null || _item$discount2 === void 0 ? void 0 : _item$discount2.resource_id) === options.discountId;
637
- }) || (_flatItem$parentProdu = flatItem.parentProduct) !== null && _flatItem$parentProdu !== void 0 && (_flatItem$parentProdu = _flatItem$parentProdu.discount_list) !== null && _flatItem$parentProdu !== void 0 && _flatItem$parentProdu.some(function (item) {
640
+ }) || (_flatItem$parentProdu3 = flatItem.parentProduct) !== null && _flatItem$parentProdu3 !== void 0 && (_flatItem$parentProdu3 = _flatItem$parentProdu3.discount_list) !== null && _flatItem$parentProdu3 !== void 0 && _flatItem$parentProdu3.some(function (item) {
638
641
  var _item$discount3;
639
642
  return ((_item$discount3 = item.discount) === null || _item$discount3 === void 0 ? void 0 : _item$discount3.resource_id) === options.discountId;
640
643
  })) {
@@ -656,14 +659,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
656
659
  }
657
660
  // bundle子商品:检查自己的 discount_list 或父主商品的 discount_list
658
661
  if (flatItem.type === 'bundle') {
659
- var _product$discount_lis9, _flatItem$parentProdu2;
662
+ var _product$discount_lis9, _flatItem$parentProdu4;
660
663
  if ((_product$discount_lis9 = product.discount_list) !== null && _product$discount_lis9 !== void 0 && _product$discount_lis9.some(function (item) {
661
664
  var _options$selectedList2;
662
665
  return options === null || options === void 0 || (_options$selectedList2 = options.selectedList) === null || _options$selectedList2 === void 0 ? void 0 : _options$selectedList2.some(function (n) {
663
666
  var _item$discount5;
664
667
  return n.discountId === ((_item$discount5 = item.discount) === null || _item$discount5 === void 0 ? void 0 : _item$discount5.resource_id);
665
668
  });
666
- }) || (_flatItem$parentProdu2 = flatItem.parentProduct) !== null && _flatItem$parentProdu2 !== void 0 && (_flatItem$parentProdu2 = _flatItem$parentProdu2.discount_list) !== null && _flatItem$parentProdu2 !== void 0 && _flatItem$parentProdu2.some(function (item) {
669
+ }) || (_flatItem$parentProdu4 = flatItem.parentProduct) !== null && _flatItem$parentProdu4 !== void 0 && (_flatItem$parentProdu4 = _flatItem$parentProdu4.discount_list) !== null && _flatItem$parentProdu4 !== void 0 && _flatItem$parentProdu4.some(function (item) {
667
670
  var _options$selectedList3;
668
671
  return options === null || options === void 0 || (_options$selectedList3 = options.selectedList) === null || _options$selectedList3 === void 0 ? void 0 : _options$selectedList3.some(function (n) {
669
672
  var _item$discount6;
@@ -899,7 +902,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
899
902
  }));
900
903
  }
901
904
  } else {
902
- var _selectedDiscount3$me, _flatItem$parentProdu3;
905
+ var _selectedDiscount3$me, _flatItem$parentProdu5;
903
906
  // 折扣卡:不拆分数量,直接应用
904
907
  var _selectedDiscount3 = selectedDiscountCard || applicableDiscounts[0];
905
908
  usedDiscounts.set(_selectedDiscount3.id, true);
@@ -925,7 +928,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
925
928
  custom_product_bundle_map_id: _uniqueId,
926
929
  num: product.num || 1
927
930
  },
928
- _num: (product.num || 1) * ((flatItem === null || flatItem === void 0 || (_flatItem$parentProdu3 = flatItem.parentProduct) === null || _flatItem$parentProdu3 === void 0 ? void 0 : _flatItem$parentProdu3.num) || 1)
931
+ _num: (product.num || 1) * ((flatItem === null || flatItem === void 0 || (_flatItem$parentProdu5 = flatItem.parentProduct) === null || _flatItem$parentProdu5 === void 0 ? void 0 : _flatItem$parentProdu5.num) || 1)
929
932
  };
930
933
 
931
934
  // 记录实际应用的折扣
@@ -315,6 +315,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
315
315
  end_at: dayjs.Dayjs;
316
316
  count: number;
317
317
  left: number;
318
+ summaryCount: number;
318
319
  }[];
319
320
  /**
320
321
  * 找到多个资源的公共可用时间段
@@ -2470,10 +2470,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2470
2470
  var resourcesUseableMap = {};
2471
2471
  var count = 0;
2472
2472
  var bookingLeft = 0;
2473
+ var summaryCount = 0;
2473
2474
  // 遍历所有资源
2474
2475
  allProductResources === null || allProductResources === void 0 || allProductResources.forEach(function (m) {
2475
2476
  // 遍历所有资源的上工时间片
2476
2477
  var currentResourcesCount = 0;
2478
+ var currentResourcesSummaryCount = 0;
2477
2479
  var currentResourcesTimeSlotCanUsedArr = [];
2478
2480
  // m.times 需要做个过滤,假设 timeSlice.start_at 是 09:30 timeSlice.end_at 是 11:30
2479
2481
  // time 是 time.start_at = 2025-05-26 10:30, time.end_at = 2025-05-26 12:30
@@ -2511,6 +2513,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2511
2513
  if (res.usable && res.remainingCapacity >= count && !m.onlyComputed) {
2512
2514
  currentResourcesCount = res.remainingCapacity;
2513
2515
  }
2516
+ if (res.usable && !m.onlyComputed && res.remainingCapacity >= currentResourcesSummaryCount) {
2517
+ currentResourcesSummaryCount = res.remainingCapacity;
2518
+ }
2514
2519
  currentResourcesTimeSlotCanUsedArr.push(res.usable);
2515
2520
  });
2516
2521
  // 在已经选定时间的情况下,只要canUseTime如果有一个 false 那就不可用
@@ -2524,6 +2529,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2524
2529
  }
2525
2530
  if (!m.onlyComputed) {
2526
2531
  bookingLeft += 1;
2532
+ summaryCount += currentResourcesSummaryCount;
2527
2533
  }
2528
2534
  }
2529
2535
  });
@@ -2543,6 +2549,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2543
2549
  if (sameCartItems.length > 0 && sameCartItems.length >= currentResourcesSet.size || sameCartItems.length > bookingLeft) {
2544
2550
  bookingLeft = 0;
2545
2551
  count = 0;
2552
+ summaryCount = 0;
2546
2553
  }
2547
2554
  // 规则 2
2548
2555
  var otherCartItems = cartItems.filter(function (m) {
@@ -2577,6 +2584,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2577
2584
  if (currentResourcesSet.size > 0 && otherCartItems.length + sameCartItems.length >= currentResourcesSet.size) {
2578
2585
  bookingLeft = 0;
2579
2586
  count = 0;
2587
+ summaryCount = 0;
2580
2588
  }
2581
2589
  } else {
2582
2590
  // 多个预约的检测规则:
@@ -2594,6 +2602,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2594
2602
  if (sameCartNeedCapacity >= currentProductResourcesCapacity) {
2595
2603
  bookingLeft = 0;
2596
2604
  count = 0;
2605
+ summaryCount = 0;
2597
2606
  }
2598
2607
  // 规则2、不管是不是跟我一样的商品,只需要跟我当前商品有同一种类型的资源的同一时间的,把所有购物车的 capacity 之和 和 所有当前类型资源的 capacity 之和比较,如果超过了resourcesCapacity,则不可用
2599
2608
  // const otherCartItems = cartItems.filter((m) => m._productOrigin?.id?.toString() !== targetProductData?.id?.toString() && m.start_time === item.start && m.end_time === item.end);
@@ -2656,6 +2665,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2656
2665
  if (otherCartNeedCapacity + usedCapacity >= currentTypeResourcesCapacity) {
2657
2666
  bookingLeft = 0;
2658
2667
  count = 0;
2668
+ summaryCount = 0;
2659
2669
  }
2660
2670
  }
2661
2671
  });
@@ -2667,7 +2677,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2667
2677
  start_at: startDayJs,
2668
2678
  end_at: endDayJs,
2669
2679
  count: count,
2670
- left: bookingLeft
2680
+ left: bookingLeft,
2681
+ summaryCount: summaryCount
2671
2682
  };
2672
2683
  });
2673
2684
  return formatScheduleTimeSlots;
@@ -109,7 +109,7 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
109
109
  tags: ["good_pass", "product_discount_card"],
110
110
  available: 1,
111
111
  relation_product: 1,
112
- with: ["extensionData", "holder.detail"],
112
+ with: ["extensionData", "customScheduleSnapshot", "holder.detail"],
113
113
  order_behavior_count: 1,
114
114
  order_behavior_count_customer_id: customerId || 1
115
115
  });
@@ -273,6 +273,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
273
273
  const processedProductsMap = /* @__PURE__ */ new Map();
274
274
  const appliedDiscountProducts = /* @__PURE__ */ new Map();
275
275
  sortedFlattenedList.forEach((flatItem) => {
276
+ var _a;
276
277
  let product, originProduct;
277
278
  if (flatItem.type === "main") {
278
279
  product = flatItem.product;
@@ -287,12 +288,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
287
288
  total: flatItem.total,
288
289
  origin_total: flatItem.origin_total,
289
290
  booking_id: flatItem.booking_id,
290
- discount_list: flatItem.discount_list || []
291
+ discount_list: flatItem.discount_list || [],
292
+ startDate: (_a = flatItem.parentProduct) == null ? void 0 : _a.startDate
291
293
  };
292
294
  originProduct = flatItem.originProduct;
293
295
  }
294
296
  addModeDiscount.forEach((discount) => {
295
- var _a, _b, _c, _d, _e, _f;
297
+ var _a2, _b, _c, _d, _e, _f;
296
298
  const limitedData = discount == null ? void 0 : discount.limited_relation_product_data;
297
299
  const _tempVar = (flatItem == null ? void 0 : flatItem.type) === "bundle" ? flatItem == null ? void 0 : flatItem.parentProduct : flatItem == null ? void 0 : flatItem.product;
298
300
  const isHolderMatch = this.checkHolderMatch(
@@ -306,7 +308,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
306
308
  let timeLimit = true;
307
309
  timeLimit = !!(0, import_utils.filterDiscountListByBookingTime)([discount], ((product == null ? void 0 : product.startDate) || (0, import_dayjs.default)()).format("YYYY-MM-DD HH:mm:ss")).length;
308
310
  const isLimitedProduct = (limitedData.type === "product_all" || limitedData.product_ids && limitedData.product_ids.includes(product.id)) && isHolderMatch;
309
- const isAvailableProduct = flatItem.type === "main" ? !((product == null ? void 0 : product.booking_id) && ((_a = product == null ? void 0 : product.discount_list) == null ? void 0 : _a.length) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.every((discount2) => discount2.id && ["good_pass", "discount_card", "product_discount_card"].includes(discount2.tag || discount2.type)))) : !((flatItem == null ? void 0 : flatItem.booking_id) && ((_d = (_c = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _c.metadata) == null ? void 0 : _d.custom_product_bundle_map_id));
311
+ const isAvailableProduct = flatItem.type === "main" ? !((product == null ? void 0 : product.booking_id) && ((_a2 = product == null ? void 0 : product.discount_list) == null ? void 0 : _a2.length) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.every((discount2) => discount2.id && ["good_pass", "discount_card", "product_discount_card"].includes(discount2.tag || discount2.type)))) : !((flatItem == null ? void 0 : flatItem.booking_id) && ((_d = (_c = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _c.metadata) == null ? void 0 : _d.custom_product_bundle_map_id));
310
312
  const isBundleAvailable = this.checkPackageSubItemUsageRules(discount, flatItem);
311
313
  if (isAvailableProduct && isLimitedProduct && timeLimit && isBundleAvailable) {
312
314
  (_e = discountApplicability.get(discount.id)) == null ? void 0 : _e.push(product.id);
@@ -338,7 +340,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
338
340
  });
339
341
  const processedFlatItemsMap = /* @__PURE__ */ new Map();
340
342
  sortedFlattenedList.forEach((flatItem, index) => {
341
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
343
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
342
344
  let product, originProduct;
343
345
  if (flatItem.type === "main") {
344
346
  product = flatItem.product;
@@ -354,11 +356,12 @@ var RulesModule = class extends import_BaseModule.BaseModule {
354
356
  original_price: (_a = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _a.original_price,
355
357
  origin_total: (_b = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _b.original_price,
356
358
  booking_id: flatItem.booking_id,
357
- discount_list: ((_c = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _c.discount_list) || []
359
+ discount_list: ((_c = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _c.discount_list) || [],
360
+ startDate: (_d = flatItem.parentProduct) == null ? void 0 : _d.startDate
358
361
  };
359
362
  originProduct = flatItem.originProduct;
360
363
  }
361
- if ((product == null ? void 0 : product.booking_id) && ((_d = product.discount_list) == null ? void 0 : _d.length) && ((_e = product == null ? void 0 : product.discount_list) == null ? void 0 : _e.every((discount) => discount.id && ["good_pass", "discount_card", "product_discount_card"].includes(discount.tag || discount.type)))) {
364
+ if ((product == null ? void 0 : product.booking_id) && ((_e = product.discount_list) == null ? void 0 : _e.length) && ((_f = product == null ? void 0 : product.discount_list) == null ? void 0 : _f.every((discount) => discount.id && ["good_pass", "discount_card", "product_discount_card"].includes(discount.tag || discount.type)))) {
362
365
  if (flatItem.type === "main") {
363
366
  processedProductsMap.set(product._id, [originProduct]);
364
367
  } else {
@@ -418,28 +421,28 @@ var RulesModule = class extends import_BaseModule.BaseModule {
418
421
  isManualDiscount = typeof product.isManualDiscount === "boolean" ? product.isManualDiscount : product.total != product.origin_total && (product.bundle || []).every((item) => {
419
422
  var _a2;
420
423
  return !((_a2 = item.discount_list || []) == null ? void 0 : _a2.length);
421
- }) && (!((_f = product.discount_list) == null ? void 0 : _f.length) || ((_h = (_g = product == null ? void 0 : product.discount_list) == null ? void 0 : _g.every) == null ? void 0 : _h.call(_g, (item) => item.type === "product")));
424
+ }) && (!((_g = product.discount_list) == null ? void 0 : _g.length) || ((_i = (_h = product == null ? void 0 : product.discount_list) == null ? void 0 : _h.every) == null ? void 0 : _i.call(_h, (item) => item.type === "product")));
422
425
  } else {
423
426
  const parentProduct = flatItem.parentProduct;
424
427
  if (parentProduct) {
425
428
  isManualDiscount = typeof parentProduct.isManualDiscount === "boolean" ? parentProduct.isManualDiscount : parentProduct.total != parentProduct.origin_total && (parentProduct.bundle || []).every((item) => {
426
429
  var _a2;
427
430
  return !((_a2 = item.discount_list || []) == null ? void 0 : _a2.length);
428
- }) && (!((_i = parentProduct.discount_list) == null ? void 0 : _i.length) || ((_k = (_j = parentProduct == null ? void 0 : parentProduct.discount_list) == null ? void 0 : _j.every) == null ? void 0 : _k.call(_j, (item) => item.type === "product")));
431
+ }) && (!((_j = parentProduct.discount_list) == null ? void 0 : _j.length) || ((_l = (_k = parentProduct == null ? void 0 : parentProduct.discount_list) == null ? void 0 : _k.every) == null ? void 0 : _l.call(_k, (item) => item.type === "product")));
429
432
  }
430
433
  }
431
434
  if (options == null ? void 0 : options.discountId) {
432
- if (flatItem.type === "main" && ((_l = product.discount_list) == null ? void 0 : _l.some((item) => {
435
+ if (flatItem.type === "main" && ((_m = product.discount_list) == null ? void 0 : _m.some((item) => {
433
436
  var _a2;
434
437
  return ((_a2 = item.discount) == null ? void 0 : _a2.resource_id) === options.discountId;
435
438
  }))) {
436
439
  isManualDiscount = false;
437
440
  }
438
441
  if (flatItem.type === "bundle") {
439
- if (((_m = product.discount_list) == null ? void 0 : _m.some((item) => {
442
+ if (((_n = product.discount_list) == null ? void 0 : _n.some((item) => {
440
443
  var _a2;
441
444
  return ((_a2 = item.discount) == null ? void 0 : _a2.resource_id) === options.discountId;
442
- })) || ((_o = (_n = flatItem.parentProduct) == null ? void 0 : _n.discount_list) == null ? void 0 : _o.some((item) => {
445
+ })) || ((_p = (_o = flatItem.parentProduct) == null ? void 0 : _o.discount_list) == null ? void 0 : _p.some((item) => {
443
446
  var _a2;
444
447
  return ((_a2 = item.discount) == null ? void 0 : _a2.resource_id) === options.discountId;
445
448
  }))) {
@@ -448,7 +451,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
448
451
  }
449
452
  }
450
453
  if (options == null ? void 0 : options.selectedList) {
451
- if (flatItem.type === "main" && ((_p = product.discount_list) == null ? void 0 : _p.some((item) => {
454
+ if (flatItem.type === "main" && ((_q = product.discount_list) == null ? void 0 : _q.some((item) => {
452
455
  var _a2;
453
456
  return (_a2 = options == null ? void 0 : options.selectedList) == null ? void 0 : _a2.some((n) => {
454
457
  var _a3;
@@ -458,13 +461,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
458
461
  isManualDiscount = false;
459
462
  }
460
463
  if (flatItem.type === "bundle") {
461
- if (((_q = product.discount_list) == null ? void 0 : _q.some((item) => {
464
+ if (((_r = product.discount_list) == null ? void 0 : _r.some((item) => {
462
465
  var _a2;
463
466
  return (_a2 = options == null ? void 0 : options.selectedList) == null ? void 0 : _a2.some((n) => {
464
467
  var _a3;
465
468
  return n.discountId === ((_a3 = item.discount) == null ? void 0 : _a3.resource_id);
466
469
  });
467
- })) || ((_s = (_r = flatItem.parentProduct) == null ? void 0 : _r.discount_list) == null ? void 0 : _s.some((item) => {
470
+ })) || ((_t = (_s = flatItem.parentProduct) == null ? void 0 : _s.discount_list) == null ? void 0 : _t.some((item) => {
468
471
  var _a2;
469
472
  return (_a2 = options == null ? void 0 : options.selectedList) == null ? void 0 : _a2.some((n) => {
470
473
  var _a3;
@@ -551,10 +554,10 @@ var RulesModule = class extends import_BaseModule.BaseModule {
551
554
  usedDiscounts.set(selectedDiscount2.id, true);
552
555
  const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
553
556
  let productOriginTotal = product.origin_total || product.total || 0;
554
- if (((_t = product.discount_list) == null ? void 0 : _t.length) && product.origin_total) {
557
+ if (((_u = product.discount_list) == null ? void 0 : _u.length) && product.origin_total) {
555
558
  productOriginTotal = product.origin_total;
556
559
  }
557
- if (Number(((_u = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _u.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
560
+ if (Number(((_v = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _v.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
558
561
  productOriginTotal = product.total;
559
562
  }
560
563
  const targetProductTotal = (0, import_utils.getDiscountAmount)(selectedDiscount2, product.price, product.price);
@@ -565,7 +568,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
565
568
  amount,
566
569
  type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : discountType,
567
570
  discount: {
568
- discount_card_type: (_v = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _v.discount_card_type,
571
+ discount_card_type: (_w = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _w.discount_card_type,
569
572
  fixed_amount: amount,
570
573
  resource_id: selectedDiscount2.id,
571
574
  title: selectedDiscount2.format_title,
@@ -687,7 +690,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
687
690
  amount: new import_decimal.default(productOriginTotal).minus(targetProductTotal).toNumber() * (product.num || 1),
688
691
  type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
689
692
  discount: {
690
- discount_card_type: (_w = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _w.discount_card_type,
693
+ discount_card_type: (_x = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _x.discount_card_type,
691
694
  fixed_amount: new import_decimal.default(productOriginTotal).minus(targetProductTotal).toNumber(),
692
695
  resource_id: selectedDiscount2.id,
693
696
  title: selectedDiscount2.format_title,
@@ -700,7 +703,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
700
703
  custom_product_bundle_map_id: uniqueId,
701
704
  num: product.num || 1
702
705
  },
703
- _num: (product.num || 1) * (((_x = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _x.num) || 1)
706
+ _num: (product.num || 1) * (((_y = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _y.num) || 1)
704
707
  };
705
708
  const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
706
709
  appliedProducts.push(discountDetail);
@@ -315,6 +315,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
315
315
  end_at: dayjs.Dayjs;
316
316
  count: number;
317
317
  left: number;
318
+ summaryCount: number;
318
319
  }[];
319
320
  /**
320
321
  * 找到多个资源的公共可用时间段
@@ -1735,8 +1735,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1735
1735
  const resourcesUseableMap = {};
1736
1736
  let count = 0;
1737
1737
  let bookingLeft = 0;
1738
+ let summaryCount = 0;
1738
1739
  allProductResources == null ? void 0 : allProductResources.forEach((m) => {
1739
1740
  let currentResourcesCount = 0;
1741
+ let currentResourcesSummaryCount = 0;
1740
1742
  const currentResourcesTimeSlotCanUsedArr = [];
1741
1743
  const mTimes = m.times.filter((n) => {
1742
1744
  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") || (0, import_dayjs.default)(n.start_at).isBefore((0, import_dayjs.default)(item.end), "minute") && (0, import_dayjs.default)(n.end_at).isAfter((0, import_dayjs.default)(item.start), "minute");
@@ -1764,6 +1766,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1764
1766
  if (res.usable && res.remainingCapacity >= count && !m.onlyComputed) {
1765
1767
  currentResourcesCount = res.remainingCapacity;
1766
1768
  }
1769
+ if (res.usable && !m.onlyComputed && res.remainingCapacity >= currentResourcesSummaryCount) {
1770
+ currentResourcesSummaryCount = res.remainingCapacity;
1771
+ }
1767
1772
  currentResourcesTimeSlotCanUsedArr.push(res.usable);
1768
1773
  });
1769
1774
  if (!currentResourcesTimeSlotCanUsedArr.some(
@@ -1775,6 +1780,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1775
1780
  }
1776
1781
  if (!m.onlyComputed) {
1777
1782
  bookingLeft += 1;
1783
+ summaryCount += currentResourcesSummaryCount;
1778
1784
  }
1779
1785
  }
1780
1786
  });
@@ -1789,6 +1795,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1789
1795
  if (sameCartItems.length > 0 && sameCartItems.length >= currentResourcesSet.size || sameCartItems.length > bookingLeft) {
1790
1796
  bookingLeft = 0;
1791
1797
  count = 0;
1798
+ summaryCount = 0;
1792
1799
  }
1793
1800
  const otherCartItems = cartItems2.filter((m) => {
1794
1801
  var _a2, _b2, _c2;
@@ -1814,6 +1821,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1814
1821
  if (currentResourcesSet.size > 0 && otherCartItems.length + sameCartItems.length >= currentResourcesSet.size) {
1815
1822
  bookingLeft = 0;
1816
1823
  count = 0;
1824
+ summaryCount = 0;
1817
1825
  }
1818
1826
  } else {
1819
1827
  const sameCartItems = cartItems2.filter((m) => {
@@ -1825,6 +1833,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1825
1833
  if (sameCartNeedCapacity >= currentProductResourcesCapacity) {
1826
1834
  bookingLeft = 0;
1827
1835
  count = 0;
1836
+ summaryCount = 0;
1828
1837
  }
1829
1838
  const otherSameTimesCartItems = cartItems2.filter((m) => `${m.start_date} ${m.start_time}` === item.start && `${m.start_date} ${m.end_time}` === item.end);
1830
1839
  const otherCartNeedCapacity = otherSameTimesCartItems.reduce((acc, curr) => acc + (0, import_capacity.getCapacityInfoByCartItem)(curr).currentCapacity, 0);
@@ -1869,6 +1878,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1869
1878
  if (otherCartNeedCapacity + usedCapacity >= currentTypeResourcesCapacity) {
1870
1879
  bookingLeft = 0;
1871
1880
  count = 0;
1881
+ summaryCount = 0;
1872
1882
  }
1873
1883
  }
1874
1884
  });
@@ -1880,7 +1890,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1880
1890
  start_at: startDayJs,
1881
1891
  end_at: endDayJs,
1882
1892
  count,
1883
- left: bookingLeft
1893
+ left: bookingLeft,
1894
+ summaryCount
1884
1895
  };
1885
1896
  });
1886
1897
  return formatScheduleTimeSlots;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.62",
4
+ "version": "2.1.63",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",