@pisell/pisellos 2.0.41 → 2.0.43

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.
@@ -330,7 +330,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
330
330
  // 找到适用于此商品的所有优惠券,仅考虑isSelected不为false的优惠券
331
331
  var applicableDiscounts = sortedDiscountList.filter(function (discount) {
332
332
  // 如果商品价格为 0,其实不需要使用任何优惠券,直接 return true
333
- if (Number(product.price) === 0 || !product.price) return false;
333
+ if (Number(product.price) === 0 && discount.tag === 'good_pass' || Number(product.total) === 0 && discount.tag !== 'good_pass' || !product.price) return false;
334
334
  // 如果优惠券已被使用,则跳过
335
335
  var targetUsedDiscounts = usedDiscounts.get(discount.id);
336
336
  if (targetUsedDiscounts && (discount.tag || discount.type) === 'good_pass') return false;
@@ -1191,6 +1191,21 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1191
1191
  _this6.store.cart.removeItem(n._id);
1192
1192
  });
1193
1193
  }
1194
+ // 如果 date.startTime 和 dateRange 里的 startTime 不一样,需要修正 dateRange
1195
+ var dateRange = this.store.date.getDateRange();
1196
+ if (dateRange !== null && dateRange !== void 0 && dateRange[0] && !dayjs(dateRange[0].date).isSame(dayjs(date.startTime), 'day')) {
1197
+ this.setDateRange([{
1198
+ date: dayjs(date.startTime).format('YYYY-MM-DD'),
1199
+ status: 'available',
1200
+ week: '',
1201
+ weekNum: 0
1202
+ }, {
1203
+ date: dayjs(date.endTime).format('YYYY-MM-DD'),
1204
+ status: 'available',
1205
+ week: '',
1206
+ weekNum: 0
1207
+ }]);
1208
+ }
1194
1209
  }
1195
1210
  }
1196
1211
  }, {
@@ -2809,7 +2824,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2809
2824
  });
2810
2825
 
2811
2826
  // 如果 firstAvailableDate 距离 startDate 大于 14 天了,则后面就不需要再找了,也是一种性能保护
2812
- if (!(firstAvailableDate && dayjs(currentDate).diff(dayjs(startDate), 'day') > 14)) {
2827
+ if (!(firstAvailableDate && dayjs(currentDate).diff(dayjs(startDate), 'day') > 31)) {
2813
2828
  _context28.next = 9;
2814
2829
  break;
2815
2830
  }
@@ -504,7 +504,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
504
504
  return n.id === id;
505
505
  });
506
506
  var product = (_this3$hooks2 = _this3.hooks) === null || _this3$hooks2 === void 0 ? void 0 : _this3$hooks2.getProduct(targetProduct);
507
- return Number(product === null || product === void 0 ? void 0 : product.price) === 0;
507
+ return Number(product === null || product === void 0 ? void 0 : product.total) === 0;
508
508
  };
509
509
  var isAllProductUsedOrFree = (_item$applicableProdu = item.applicableProductIds) === null || _item$applicableProdu === void 0 ? void 0 : _item$applicableProdu.every(function (id) {
510
510
  var _item$applicableProdu2;
@@ -213,7 +213,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
213
213
  return;
214
214
  }
215
215
  const applicableDiscounts = sortedDiscountList.filter((discount) => {
216
- if (Number(product.price) === 0 || !product.price)
216
+ if (Number(product.price) === 0 && discount.tag === "good_pass" || Number(product.total) === 0 && discount.tag !== "good_pass" || !product.price)
217
217
  return false;
218
218
  const targetUsedDiscounts = usedDiscounts.get(discount.id);
219
219
  if (targetUsedDiscounts && (discount.tag || discount.type) === "good_pass")
@@ -637,6 +637,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
637
637
  this.store.cart.removeItem(n._id);
638
638
  });
639
639
  }
640
+ const dateRange = this.store.date.getDateRange();
641
+ if ((dateRange == null ? void 0 : dateRange[0]) && !(0, import_dayjs.default)(dateRange[0].date).isSame((0, import_dayjs.default)(date.startTime), "day")) {
642
+ this.setDateRange([
643
+ { date: (0, import_dayjs.default)(date.startTime).format("YYYY-MM-DD"), status: "available", week: "", weekNum: 0 },
644
+ { date: (0, import_dayjs.default)(date.endTime).format("YYYY-MM-DD"), status: "available", week: "", weekNum: 0 }
645
+ ]);
646
+ }
640
647
  }
641
648
  }
642
649
  beforeUpdateCart(params, targetCartItem) {
@@ -2010,7 +2017,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2010
2017
  weekNum: (0, import_dayjs.default)(currentDate).day(),
2011
2018
  status
2012
2019
  });
2013
- if (firstAvailableDate && (0, import_dayjs.default)(currentDate).diff((0, import_dayjs.default)(startDate), "day") > 14) {
2020
+ if (firstAvailableDate && (0, import_dayjs.default)(currentDate).diff((0, import_dayjs.default)(startDate), "day") > 31) {
2014
2021
  break;
2015
2022
  }
2016
2023
  currentDate = (0, import_dayjs.default)(currentDate).add(1, "day");
@@ -346,7 +346,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
346
346
  var _a3;
347
347
  const targetProduct = productList.find((n) => n.id === id);
348
348
  const product = (_a3 = this.hooks) == null ? void 0 : _a3.getProduct(targetProduct);
349
- return Number(product == null ? void 0 : product.price) === 0;
349
+ return Number(product == null ? void 0 : product.total) === 0;
350
350
  };
351
351
  const isAllProductUsedOrFree = (_a2 = item.applicableProductIds) == null ? void 0 : _a2.every((id) => {
352
352
  var _a3;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.0.41",
4
+ "version": "2.0.43",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",