@pisell/pisellos 2.1.30 → 2.1.31
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.
- package/dist/modules/ProductList/index.js +3 -2
- package/dist/solution/BookingByStep/index.d.ts +17 -1
- package/dist/solution/BookingByStep/index.js +466 -21
- package/dist/solution/BookingByStep/utils/capacity.d.ts +7 -2
- package/dist/solution/BookingByStep/utils/capacity.js +24 -8
- package/lib/modules/ProductList/index.js +3 -2
- package/lib/solution/BookingByStep/index.d.ts +17 -1
- package/lib/solution/BookingByStep/index.js +311 -39
- package/lib/solution/BookingByStep/utils/capacity.d.ts +7 -2
- package/lib/solution/BookingByStep/utils/capacity.js +21 -8
- package/package.json +1 -1
|
@@ -60,7 +60,9 @@ export var formatDefaultCapacitys = function formatDefaultCapacitys(_ref) {
|
|
|
60
60
|
* @Author: zhiwei.Wang
|
|
61
61
|
*/
|
|
62
62
|
export var getSumCapacity = function getSumCapacity(_ref2) {
|
|
63
|
-
var capacity = _ref2.capacity
|
|
63
|
+
var capacity = _ref2.capacity,
|
|
64
|
+
_ref2$num = _ref2.num,
|
|
65
|
+
num = _ref2$num === void 0 ? 1 : _ref2$num;
|
|
64
66
|
var sum = 0;
|
|
65
67
|
var _iterator = _createForOfIteratorHelper(capacity || []),
|
|
66
68
|
_step;
|
|
@@ -74,7 +76,7 @@ export var getSumCapacity = function getSumCapacity(_ref2) {
|
|
|
74
76
|
} finally {
|
|
75
77
|
_iterator.f();
|
|
76
78
|
}
|
|
77
|
-
return sum;
|
|
79
|
+
return sum * num;
|
|
78
80
|
};
|
|
79
81
|
|
|
80
82
|
/**
|
|
@@ -91,7 +93,8 @@ export function getCapacityInfoByCartItem(targetCartItem) {
|
|
|
91
93
|
product_bundle: targetCartItem._origin.product.product_bundle
|
|
92
94
|
});
|
|
93
95
|
var currentCapacity = getSumCapacity({
|
|
94
|
-
capacity: formatCapacity
|
|
96
|
+
capacity: formatCapacity,
|
|
97
|
+
num: (targetCartItem === null || targetCartItem === void 0 ? void 0 : targetCartItem.num) || 1
|
|
95
98
|
});
|
|
96
99
|
return {
|
|
97
100
|
formatCapacity: formatCapacity,
|
|
@@ -262,7 +265,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
262
265
|
if (needsThisResourceType) {
|
|
263
266
|
// 需要判断是单个预约还是多个预约,如果是单个预约,不用加 capacity,只用+1
|
|
264
267
|
if (selectType === 'single') {
|
|
265
|
-
requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + 1;
|
|
268
|
+
requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + ((cartItem === null || cartItem === void 0 ? void 0 : cartItem.num) || 1);
|
|
266
269
|
} else {
|
|
267
270
|
requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + currentCapacity;
|
|
268
271
|
}
|
|
@@ -327,7 +330,11 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
327
330
|
if (totalAvailableCapacity < requiredCapacity) {
|
|
328
331
|
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u5BB9\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(totalAvailableCapacity));
|
|
329
332
|
return {
|
|
330
|
-
v:
|
|
333
|
+
v: {
|
|
334
|
+
success: false,
|
|
335
|
+
required: requiredCapacity,
|
|
336
|
+
available: totalAvailableCapacity
|
|
337
|
+
}
|
|
331
338
|
};
|
|
332
339
|
}
|
|
333
340
|
} else {
|
|
@@ -336,7 +343,8 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
336
343
|
resourcesInType.forEach(function (resource) {
|
|
337
344
|
// 过滤出在时间段内的资源时间片
|
|
338
345
|
var availableTimes = resource.times.filter(function (time) {
|
|
339
|
-
|
|
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;
|
|
340
348
|
});
|
|
341
349
|
if (availableTimes.length > 0) {
|
|
342
350
|
availableResourceCount++;
|
|
@@ -346,7 +354,11 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
346
354
|
if (availableResourceCount < requiredCapacity) {
|
|
347
355
|
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u6570\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(availableResourceCount));
|
|
348
356
|
return {
|
|
349
|
-
v:
|
|
357
|
+
v: {
|
|
358
|
+
success: false,
|
|
359
|
+
required: requiredCapacity,
|
|
360
|
+
available: availableResourceCount
|
|
361
|
+
}
|
|
350
362
|
};
|
|
351
363
|
}
|
|
352
364
|
}
|
|
@@ -357,5 +369,9 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
357
369
|
if (_ret === 0) continue;
|
|
358
370
|
if (_ret) return _ret.v;
|
|
359
371
|
}
|
|
360
|
-
return
|
|
372
|
+
return {
|
|
373
|
+
success: true,
|
|
374
|
+
required: 0,
|
|
375
|
+
available: 0
|
|
376
|
+
};
|
|
361
377
|
}
|
|
@@ -96,9 +96,10 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
96
96
|
with_count,
|
|
97
97
|
// client_schedule_ids: schedule_ids,
|
|
98
98
|
schedule_date,
|
|
99
|
+
application_code: (_b = this.otherParams) == null ? void 0 : _b.channel,
|
|
100
|
+
is_eject: 1,
|
|
99
101
|
with_schedule,
|
|
100
|
-
schedule_datetime
|
|
101
|
-
application_code: (_b = this.otherParams) == null ? void 0 : _b.channel
|
|
102
|
+
schedule_datetime
|
|
102
103
|
},
|
|
103
104
|
{ useCache: true }
|
|
104
105
|
);
|
|
@@ -324,9 +324,25 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
324
324
|
success: boolean;
|
|
325
325
|
minAvailableCount: number;
|
|
326
326
|
};
|
|
327
|
+
/**
|
|
328
|
+
* 将 ProductData 转换为 CartItem,但不添加到购物车
|
|
329
|
+
* 参考 addProductToCart 方法的实现
|
|
330
|
+
*/
|
|
331
|
+
private convertProductToCartItem;
|
|
332
|
+
checkMaxDurationCapacityForDetailNums({ product, date, account, }: {
|
|
333
|
+
product: ProductData;
|
|
334
|
+
date?: {
|
|
335
|
+
startTime: string;
|
|
336
|
+
endTime: string;
|
|
337
|
+
} | null;
|
|
338
|
+
account?: Account | null;
|
|
339
|
+
}): {
|
|
340
|
+
success: boolean;
|
|
341
|
+
minAvailableCount: number;
|
|
342
|
+
};
|
|
327
343
|
setOtherData(key: string, value: any): void;
|
|
328
344
|
getOtherData(key: string): any;
|
|
329
|
-
getProductTypeById(id: number): Promise<"
|
|
345
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
330
346
|
/**
|
|
331
347
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
332
348
|
*
|