@pisell/pisellos 0.0.332 → 0.0.333

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.
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
342
342
  };
343
343
  setOtherData(key: string, value: any): void;
344
344
  getOtherData(key: string): any;
345
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
345
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
346
346
  /**
347
347
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
348
348
  *
@@ -1195,8 +1195,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1195
1195
  this.addProductCheck({
1196
1196
  date: date
1197
1197
  });
1198
- // 如果 quantity 大于 1,则进入购物车拆散成多条数据
1199
- if (addItemParams.quantity > 1) {
1198
+ // 如果 quantity 大于 1,且是预约商品,则进入购物车拆散成多条数据
1199
+ if (addItemParams.quantity > 1 && !isNormalProduct(productData.origin)) {
1200
1200
  for (var i = 0; i < addItemParams.quantity; i++) {
1201
1201
  var newAddItemParams = cloneDeep(addItemParams);
1202
1202
  newAddItemParams.quantity = 1;
@@ -343,7 +343,8 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
343
343
  resourcesInType.forEach(function (resource) {
344
344
  // 过滤出在时间段内的资源时间片
345
345
  var availableTimes = resource.times.filter(function (time) {
346
- return !dayjs(time.start_at).isAfter(dayjs(timeSlotStart), 'minute') && !dayjs(time.end_at).isBefore(dayjs(timeSlotEnd), 'minute') || dayjs(time.start_at).isBefore(dayjs(timeSlotEnd), 'minute') && dayjs(time.end_at).isAfter(dayjs(timeSlotStart), 'minute');
346
+ var _time$event_list;
347
+ return !dayjs(time.start_at).isAfter(dayjs(timeSlotStart), 'minute') && !dayjs(time.end_at).isBefore(dayjs(timeSlotEnd), 'minute') || dayjs(time.start_at).isBefore(dayjs(timeSlotEnd), 'minute') && dayjs(time.end_at).isAfter(dayjs(timeSlotStart), 'minute') && ((_time$event_list = time.event_list) === null || _time$event_list === void 0 ? void 0 : _time$event_list.length) === 0;
347
348
  });
348
349
  if (availableTimes.length > 0) {
349
350
  availableResourceCount++;
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
342
342
  };
343
343
  setOtherData(key: string, value: any): void;
344
344
  getOtherData(key: string): any;
345
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
345
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
346
346
  /**
347
347
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
348
348
  *
@@ -636,7 +636,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
636
636
  addItemParams.account = account;
637
637
  }
638
638
  this.addProductCheck({ date });
639
- if (addItemParams.quantity > 1) {
639
+ if (addItemParams.quantity > 1 && !(0, import_utils5.isNormalProduct)(productData.origin)) {
640
640
  for (let i = 0; i < addItemParams.quantity; i++) {
641
641
  const newAddItemParams = (0, import_lodash_es.cloneDeep)(addItemParams);
642
642
  newAddItemParams.quantity = 1;
@@ -248,7 +248,8 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
248
248
  let availableResourceCount = 0;
249
249
  resourcesInType.forEach((resource) => {
250
250
  const availableTimes = resource.times.filter((time) => {
251
- return !(0, import_dayjs.default)(time.start_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute") && !(0, import_dayjs.default)(time.end_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") || (0, import_dayjs.default)(time.start_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") && (0, import_dayjs.default)(time.end_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute");
251
+ var _a2;
252
+ return !(0, import_dayjs.default)(time.start_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute") && !(0, import_dayjs.default)(time.end_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") || (0, import_dayjs.default)(time.start_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") && (0, import_dayjs.default)(time.end_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute") && ((_a2 = time.event_list) == null ? void 0 : _a2.length) === 0;
252
253
  });
253
254
  if (availableTimes.length > 0) {
254
255
  availableResourceCount++;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.332",
4
+ "version": "0.0.333",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",