@pisell/pisellos 1.0.140 → 1.0.142
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/Discount/types.d.ts +1 -1
- package/dist/modules/Rules/index.js +9 -9
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +46 -43
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/lib/modules/Discount/types.d.ts +1 -1
- package/lib/modules/Rules/index.js +6 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +6 -4
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@ interface PackageSubItemUsageRules {
|
|
|
19
19
|
type: 'universal_discount' | 'package_exclusive' | 'single_item_promo' | 'custom_usage_rules';
|
|
20
20
|
rules: ("original_price" | "markup_price")[];
|
|
21
21
|
package_scope?: {
|
|
22
|
-
type: 'all_packages' | 'specific_packages';
|
|
22
|
+
type: 'all_packages' | 'specific_packages' | 'product_all' | 'products';
|
|
23
23
|
exclude_bundle_product_ids: number[];
|
|
24
24
|
include_bundle_product_ids: number[];
|
|
25
25
|
filter: 0 | 1;
|
|
@@ -2254,12 +2254,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2254
2254
|
return true; // 单独购买时可用
|
|
2255
2255
|
}
|
|
2256
2256
|
if (isBundleItem) {
|
|
2257
|
-
var _flatItem$bundleItem8, _flatItem$bundleItem9, _flatItem$originProdu, _flatItem$
|
|
2257
|
+
var _flatItem$bundleItem8, _flatItem$bundleItem9, _flatItem$originProdu, _flatItem$parentProdu11;
|
|
2258
2258
|
// 套餐中购买时,判断是否为原价
|
|
2259
2259
|
var priceType = (_flatItem$bundleItem8 = flatItem.bundleItem) === null || _flatItem$bundleItem8 === void 0 ? void 0 : _flatItem$bundleItem8.price_type;
|
|
2260
2260
|
var priceTypeExt = (_flatItem$bundleItem9 = flatItem.bundleItem) === null || _flatItem$bundleItem9 === void 0 ? void 0 : _flatItem$bundleItem9.price_type_ext;
|
|
2261
2261
|
// 主商品id
|
|
2262
|
-
var mainProductId = (flatItem === null || flatItem === void 0 || (_flatItem$originProdu = flatItem.originProduct) === null || _flatItem$originProdu === void 0 ? void 0 : _flatItem$originProdu.
|
|
2262
|
+
var mainProductId = (flatItem === null || flatItem === void 0 || (_flatItem$originProdu = flatItem.originProduct) === null || _flatItem$originProdu === void 0 || (_flatItem$originProdu = _flatItem$originProdu._productOrigin) === null || _flatItem$originProdu === void 0 ? void 0 : _flatItem$originProdu.id) || (flatItem === null || flatItem === void 0 || (_flatItem$parentProdu11 = flatItem.parentProduct) === null || _flatItem$parentProdu11 === void 0 ? void 0 : _flatItem$parentProdu11.id) || 0;
|
|
2263
2263
|
// original_price 对应:
|
|
2264
2264
|
// 1. price_type: "markup" && price_type_ext: "product_price"
|
|
2265
2265
|
// markup_price 对应:
|
|
@@ -2278,8 +2278,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2278
2278
|
// 套餐适用范围校验
|
|
2279
2279
|
var isScopeValid = false;
|
|
2280
2280
|
|
|
2281
|
-
//
|
|
2282
|
-
if (scopeType === 'all_packages') {
|
|
2281
|
+
// 排除套餐判断, product_all值兼容旧数据
|
|
2282
|
+
if (scopeType === 'all_packages' || scopeType === 'product_all') {
|
|
2283
2283
|
// 所有套餐可用
|
|
2284
2284
|
if (!filter) {
|
|
2285
2285
|
isScopeValid = true;
|
|
@@ -2288,8 +2288,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2288
2288
|
}
|
|
2289
2289
|
}
|
|
2290
2290
|
|
|
2291
|
-
//
|
|
2292
|
-
if (scopeType === 'specific_packages') {
|
|
2291
|
+
// 包含套餐判断, products值兼容旧数据
|
|
2292
|
+
if (scopeType === 'specific_packages' || scopeType === 'products') {
|
|
2293
2293
|
isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
|
|
2294
2294
|
}
|
|
2295
2295
|
|
|
@@ -2324,10 +2324,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2324
2324
|
return false; // 单独购买时不可用
|
|
2325
2325
|
}
|
|
2326
2326
|
if (isBundleItem) {
|
|
2327
|
-
var _flatItem$
|
|
2327
|
+
var _flatItem$bundleItem10, _flatItem$bundleItem11;
|
|
2328
2328
|
// 套餐中购买时,判断是否为原价
|
|
2329
|
-
var _priceType = (_flatItem$
|
|
2330
|
-
var _priceTypeExt = (_flatItem$
|
|
2329
|
+
var _priceType = (_flatItem$bundleItem10 = flatItem.bundleItem) === null || _flatItem$bundleItem10 === void 0 ? void 0 : _flatItem$bundleItem10.price_type;
|
|
2330
|
+
var _priceTypeExt = (_flatItem$bundleItem11 = flatItem.bundleItem) === null || _flatItem$bundleItem11 === void 0 ? void 0 : _flatItem$bundleItem11.price_type_ext;
|
|
2331
2331
|
|
|
2332
2332
|
// original_price 对应:
|
|
2333
2333
|
// 1. price_type: "markup" && price_type_ext: "product_price"
|
|
@@ -302,7 +302,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
302
302
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
303
303
|
errorList: any[];
|
|
304
304
|
};
|
|
305
|
-
getTimeSlotByAllResources(resources_code: string): any[];
|
|
305
|
+
getTimeSlotByAllResources(resources_code: string, split?: number): any[];
|
|
306
306
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
307
307
|
resources_code: string;
|
|
308
308
|
startDate: string;
|
|
@@ -2009,7 +2009,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2009
2009
|
return n.code === resources_code;
|
|
2010
2010
|
})) === null || _productResources$fin === void 0 ? void 0 : _productResources$fin.renderList;
|
|
2011
2011
|
if (targetRenderList && targetRenderList.length > 0) {
|
|
2012
|
-
var _item$_origin$resourc2;
|
|
2012
|
+
var _item$_origin$resourc2, _dateRange$5, _item$duration2, _item$_productOrigin6;
|
|
2013
2013
|
// 如果购物车里已经有同类型的 form_id 的资源了,则不处理
|
|
2014
2014
|
if ((_item$_origin$resourc2 = item._origin.resources) !== null && _item$_origin$resourc2 !== void 0 && _item$_origin$resourc2.some(function (n) {
|
|
2015
2015
|
return n.form_id === targetRenderList[0].form_id;
|
|
@@ -2019,7 +2019,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2019
2019
|
var fastestResource = findFastestAvailableResource({
|
|
2020
2020
|
resources: targetRenderList,
|
|
2021
2021
|
currentCapacity: currentCapacity,
|
|
2022
|
-
countMap: selectResourcesMap
|
|
2022
|
+
countMap: selectResourcesMap,
|
|
2023
|
+
targetDate: dateRange === null || dateRange === void 0 || (_dateRange$5 = dateRange[0]) === null || _dateRange$5 === void 0 ? void 0 : _dateRange$5.date,
|
|
2024
|
+
durationMinutes: (item === null || item === void 0 || (_item$duration2 = item.duration) === null || _item$duration2 === void 0 ? void 0 : _item$duration2.value) || (item === null || item === void 0 || (_item$_productOrigin6 = item._productOrigin) === null || _item$_productOrigin6 === void 0 || (_item$_productOrigin6 = _item$_productOrigin6.duration) === null || _item$_productOrigin6 === void 0 ? void 0 : _item$_productOrigin6.value) || 10
|
|
2023
2025
|
});
|
|
2024
2026
|
var targetResource = fastestResource || targetRenderList[0];
|
|
2025
2027
|
targetResource.capacity = currentCapacity;
|
|
@@ -2070,6 +2072,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2070
2072
|
_cartItems$,
|
|
2071
2073
|
_cartItems$2,
|
|
2072
2074
|
_this$shopStore$get;
|
|
2075
|
+
var split = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
|
|
2073
2076
|
var dateRange = this.store.date.getDateRange();
|
|
2074
2077
|
// 取出购物车中所有一已选择的第一步资源
|
|
2075
2078
|
var resources = [];
|
|
@@ -2085,8 +2088,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2085
2088
|
var maxCutOffTime = undefined;
|
|
2086
2089
|
var maxCutOffTimeValue = dayjs();
|
|
2087
2090
|
cartItems.forEach(function (item) {
|
|
2088
|
-
var _item$
|
|
2089
|
-
(_item$
|
|
2091
|
+
var _item$_productOrigin7, _item$_productOrigin8, _item$_productOrigin9, _item$_productOrigin10;
|
|
2092
|
+
(_item$_productOrigin7 = item._productOrigin) === null || _item$_productOrigin7 === void 0 || (_item$_productOrigin7 = _item$_productOrigin7.product_resource) === null || _item$_productOrigin7 === void 0 || (_item$_productOrigin7 = _item$_productOrigin7.resources) === null || _item$_productOrigin7 === void 0 || _item$_productOrigin7.forEach(function (n) {
|
|
2090
2093
|
// TODO: 少了个 status 的判断
|
|
2091
2094
|
if (n.code === resources_code) {
|
|
2092
2095
|
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
@@ -2099,10 +2102,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2099
2102
|
if (item.resource_id && !resourceIds.includes(item.resource_id)) {
|
|
2100
2103
|
resourceIds.push(item.resource_id);
|
|
2101
2104
|
}
|
|
2102
|
-
resourcesTypeId = item === null || item === void 0 || (_item$
|
|
2105
|
+
resourcesTypeId = item === null || item === void 0 || (_item$_productOrigin8 = item._productOrigin) === null || _item$_productOrigin8 === void 0 || (_item$_productOrigin8 = _item$_productOrigin8.product_resource) === null || _item$_productOrigin8 === void 0 || (_item$_productOrigin8 = _item$_productOrigin8.resources) === null || _item$_productOrigin8 === void 0 || (_item$_productOrigin8 = _item$_productOrigin8.find(function (n) {
|
|
2103
2106
|
return n.code === resources_code;
|
|
2104
|
-
})) === null || _item$
|
|
2105
|
-
if ((_item$
|
|
2107
|
+
})) === null || _item$_productOrigin8 === void 0 ? void 0 : _item$_productOrigin8.id;
|
|
2108
|
+
if ((_item$_productOrigin9 = item._productOrigin) !== null && _item$_productOrigin9 !== void 0 && _item$_productOrigin9.cut_off_time && ((_item$_productOrigin10 = item._productOrigin) === null || _item$_productOrigin10 === void 0 ? void 0 : _item$_productOrigin10.cut_off_time.type) === 'advance') {
|
|
2106
2109
|
var currentCutOffTime = dayjs().add(item._productOrigin.cut_off_time.unit, item._productOrigin.cut_off_time.unit_type);
|
|
2107
2110
|
if (currentCutOffTime.isAfter(maxCutOffTimeValue, 'minute')) {
|
|
2108
2111
|
maxCutOffTimeValue = currentCutOffTime;
|
|
@@ -2152,13 +2155,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2152
2155
|
cartItems.forEach(function (item) {
|
|
2153
2156
|
// 单个预约累加账号 多个预约取最大值
|
|
2154
2157
|
if (isSingleResource) {
|
|
2155
|
-
var _item$_productOrigin10;
|
|
2156
|
-
accountDuration += ((_item$_productOrigin10 = item._productOrigin) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.duration) === null || _item$_productOrigin10 === void 0 ? void 0 : _item$_productOrigin10.value) || 10;
|
|
2157
|
-
} else {
|
|
2158
2158
|
var _item$_productOrigin11;
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2159
|
+
accountDuration += ((_item$_productOrigin11 = item._productOrigin) === null || _item$_productOrigin11 === void 0 || (_item$_productOrigin11 = _item$_productOrigin11.duration) === null || _item$_productOrigin11 === void 0 ? void 0 : _item$_productOrigin11.value) || 10;
|
|
2160
|
+
} else {
|
|
2161
|
+
var _item$_productOrigin12;
|
|
2162
|
+
if (accountDuration < (((_item$_productOrigin12 = item._productOrigin) === null || _item$_productOrigin12 === void 0 || (_item$_productOrigin12 = _item$_productOrigin12.duration) === null || _item$_productOrigin12 === void 0 ? void 0 : _item$_productOrigin12.value) || 10)) {
|
|
2163
|
+
var _item$_productOrigin13;
|
|
2164
|
+
accountDuration = ((_item$_productOrigin13 = item._productOrigin) === null || _item$_productOrigin13 === void 0 || (_item$_productOrigin13 = _item$_productOrigin13.duration) === null || _item$_productOrigin13 === void 0 ? void 0 : _item$_productOrigin13.value) || 10;
|
|
2162
2165
|
}
|
|
2163
2166
|
}
|
|
2164
2167
|
});
|
|
@@ -2195,8 +2198,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2195
2198
|
}
|
|
2196
2199
|
var resourcesUseableMap = {};
|
|
2197
2200
|
var hasFlexibleDuration = cartItems.some(function (item) {
|
|
2198
|
-
var _item$
|
|
2199
|
-
return ((_item$
|
|
2201
|
+
var _item$_productOrigin14;
|
|
2202
|
+
return ((_item$_productOrigin14 = item._productOrigin) === null || _item$_productOrigin14 === void 0 || (_item$_productOrigin14 = _item$_productOrigin14.duration) === null || _item$_productOrigin14 === void 0 ? void 0 : _item$_productOrigin14.type) === 'flexible';
|
|
2200
2203
|
});
|
|
2201
2204
|
var operating_day_boundary = (_this$shopStore$get = this.shopStore.get('core')) === null || _this$shopStore$get === void 0 || (_this$shopStore$get = _this$shopStore$get.core) === null || _this$shopStore$get === void 0 ? void 0 : _this$shopStore$get.operating_day_boundary;
|
|
2202
2205
|
|
|
@@ -2204,11 +2207,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2204
2207
|
var maxBlockThreshold = 0;
|
|
2205
2208
|
if (hasFlexibleDuration) {
|
|
2206
2209
|
maxBlockThreshold = cartItems.reduce(function (max, item) {
|
|
2207
|
-
var _item$
|
|
2210
|
+
var _item$_productOrigin15;
|
|
2208
2211
|
// 如果开启了灵活时长商品配置,则取 block_threshold 的值
|
|
2209
|
-
if ((_item$
|
|
2210
|
-
var _item$
|
|
2211
|
-
return Math.max(max, ((_item$
|
|
2212
|
+
if ((_item$_productOrigin15 = item._productOrigin) !== null && _item$_productOrigin15 !== void 0 && (_item$_productOrigin15 = _item$_productOrigin15.duration) !== null && _item$_productOrigin15 !== void 0 && (_item$_productOrigin15 = _item$_productOrigin15.flexible_config) !== null && _item$_productOrigin15 !== void 0 && _item$_productOrigin15.is_enable_minimum_duration) {
|
|
2213
|
+
var _item$_productOrigin16;
|
|
2214
|
+
return Math.max(max, ((_item$_productOrigin16 = item._productOrigin) === null || _item$_productOrigin16 === void 0 || (_item$_productOrigin16 = _item$_productOrigin16.duration) === null || _item$_productOrigin16 === void 0 || (_item$_productOrigin16 = _item$_productOrigin16.flexible_config) === null || _item$_productOrigin16 === void 0 ? void 0 : _item$_productOrigin16.block_threshold) || 0);
|
|
2212
2215
|
}
|
|
2213
2216
|
return 0;
|
|
2214
2217
|
}, 0);
|
|
@@ -2253,7 +2256,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2253
2256
|
resourcesMap: resourcesMap,
|
|
2254
2257
|
duration: duration,
|
|
2255
2258
|
currentDate: dateRange[0].date,
|
|
2256
|
-
split:
|
|
2259
|
+
split: split,
|
|
2257
2260
|
resourcesUseableMap: resourcesUseableMap,
|
|
2258
2261
|
capacity: maxCapacity,
|
|
2259
2262
|
cut_off_time: maxCutOffTime,
|
|
@@ -2300,8 +2303,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2300
2303
|
maxCutOffTime = undefined;
|
|
2301
2304
|
maxCutOffTimeValue = dayjs();
|
|
2302
2305
|
cartItems.forEach(function (item) {
|
|
2303
|
-
var _item$
|
|
2304
|
-
(_item$
|
|
2306
|
+
var _item$_productOrigin17, _item$_productOrigin18, _item$_productOrigin19, _item$_productOrigin20;
|
|
2307
|
+
(_item$_productOrigin17 = item._productOrigin) === null || _item$_productOrigin17 === void 0 || (_item$_productOrigin17 = _item$_productOrigin17.product_resource) === null || _item$_productOrigin17 === void 0 || (_item$_productOrigin17 = _item$_productOrigin17.resources) === null || _item$_productOrigin17 === void 0 || _item$_productOrigin17.forEach(function (n) {
|
|
2305
2308
|
// TODO: 少了个 status 的判断
|
|
2306
2309
|
if (n.code === resources_code) {
|
|
2307
2310
|
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
@@ -2314,10 +2317,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2314
2317
|
if (item.resource_id && !resourceIds.includes(item.resource_id)) {
|
|
2315
2318
|
resourceIds.push(item.resource_id);
|
|
2316
2319
|
}
|
|
2317
|
-
resourcesTypeId = item === null || item === void 0 || (_item$
|
|
2320
|
+
resourcesTypeId = item === null || item === void 0 || (_item$_productOrigin18 = item._productOrigin) === null || _item$_productOrigin18 === void 0 || (_item$_productOrigin18 = _item$_productOrigin18.product_resource) === null || _item$_productOrigin18 === void 0 || (_item$_productOrigin18 = _item$_productOrigin18.resources) === null || _item$_productOrigin18 === void 0 || (_item$_productOrigin18 = _item$_productOrigin18.find(function (n) {
|
|
2318
2321
|
return n.code === resources_code;
|
|
2319
|
-
})) === null || _item$
|
|
2320
|
-
if ((_item$
|
|
2322
|
+
})) === null || _item$_productOrigin18 === void 0 ? void 0 : _item$_productOrigin18.id;
|
|
2323
|
+
if ((_item$_productOrigin19 = item._productOrigin) !== null && _item$_productOrigin19 !== void 0 && _item$_productOrigin19.cut_off_time && ((_item$_productOrigin20 = item._productOrigin) === null || _item$_productOrigin20 === void 0 ? void 0 : _item$_productOrigin20.cut_off_time.type) === 'advance') {
|
|
2321
2324
|
var currentCutOffTime = dayjs().add(item._productOrigin.cut_off_time.unit, item._productOrigin.cut_off_time.unit_type);
|
|
2322
2325
|
if (currentCutOffTime.isAfter(maxCutOffTimeValue, 'minute')) {
|
|
2323
2326
|
maxCutOffTimeValue = currentCutOffTime;
|
|
@@ -2340,13 +2343,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2340
2343
|
cartItems.forEach(function (item) {
|
|
2341
2344
|
// 单个预约累加账号 多个预约取最大值
|
|
2342
2345
|
if (isSingleResource) {
|
|
2343
|
-
var _item$_productOrigin20;
|
|
2344
|
-
accountDuration += ((_item$_productOrigin20 = item._productOrigin) === null || _item$_productOrigin20 === void 0 || (_item$_productOrigin20 = _item$_productOrigin20.duration) === null || _item$_productOrigin20 === void 0 ? void 0 : _item$_productOrigin20.value) || 10;
|
|
2345
|
-
} else {
|
|
2346
2346
|
var _item$_productOrigin21;
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2347
|
+
accountDuration += ((_item$_productOrigin21 = item._productOrigin) === null || _item$_productOrigin21 === void 0 || (_item$_productOrigin21 = _item$_productOrigin21.duration) === null || _item$_productOrigin21 === void 0 ? void 0 : _item$_productOrigin21.value) || 10;
|
|
2348
|
+
} else {
|
|
2349
|
+
var _item$_productOrigin22;
|
|
2350
|
+
if (accountDuration < (((_item$_productOrigin22 = item._productOrigin) === null || _item$_productOrigin22 === void 0 || (_item$_productOrigin22 = _item$_productOrigin22.duration) === null || _item$_productOrigin22 === void 0 ? void 0 : _item$_productOrigin22.value) || 10)) {
|
|
2351
|
+
var _item$_productOrigin23;
|
|
2352
|
+
accountDuration = ((_item$_productOrigin23 = item._productOrigin) === null || _item$_productOrigin23 === void 0 || (_item$_productOrigin23 = _item$_productOrigin23.duration) === null || _item$_productOrigin23 === void 0 ? void 0 : _item$_productOrigin23.value) || 10;
|
|
2350
2353
|
}
|
|
2351
2354
|
}
|
|
2352
2355
|
});
|
|
@@ -2372,18 +2375,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2372
2375
|
case 20:
|
|
2373
2376
|
resourcesUseableMap = {};
|
|
2374
2377
|
hasFlexibleDuration = cartItems.some(function (item) {
|
|
2375
|
-
var _item$
|
|
2376
|
-
return ((_item$
|
|
2378
|
+
var _item$_productOrigin24;
|
|
2379
|
+
return ((_item$_productOrigin24 = item._productOrigin) === null || _item$_productOrigin24 === void 0 || (_item$_productOrigin24 = _item$_productOrigin24.duration) === null || _item$_productOrigin24 === void 0 ? void 0 : _item$_productOrigin24.type) === 'flexible';
|
|
2377
2380
|
});
|
|
2378
2381
|
operating_day_boundary = (_this$shopStore$get2 = this.shopStore.get('core')) === null || _this$shopStore$get2 === void 0 || (_this$shopStore$get2 = _this$shopStore$get2.core) === null || _this$shopStore$get2 === void 0 ? void 0 : _this$shopStore$get2.operating_day_boundary; // 如果有 hasFlexibleDuration,需要把动态时长商品(可能是多个,取最长的那个最低禁止购买时长)的最低禁止购买时长作为 split 的值
|
|
2379
2382
|
maxBlockThreshold = 0;
|
|
2380
2383
|
if (hasFlexibleDuration) {
|
|
2381
2384
|
maxBlockThreshold = cartItems.reduce(function (max, item) {
|
|
2382
|
-
var _item$
|
|
2385
|
+
var _item$_productOrigin25;
|
|
2383
2386
|
// 如果开启了灵活时长商品配置,则取 block_threshold 的值
|
|
2384
|
-
if ((_item$
|
|
2385
|
-
var _item$
|
|
2386
|
-
return Math.max(max, ((_item$
|
|
2387
|
+
if ((_item$_productOrigin25 = item._productOrigin) !== null && _item$_productOrigin25 !== void 0 && (_item$_productOrigin25 = _item$_productOrigin25.duration) !== null && _item$_productOrigin25 !== void 0 && (_item$_productOrigin25 = _item$_productOrigin25.flexible_config) !== null && _item$_productOrigin25 !== void 0 && _item$_productOrigin25.is_enable_minimum_duration) {
|
|
2388
|
+
var _item$_productOrigin26;
|
|
2389
|
+
return Math.max(max, ((_item$_productOrigin26 = item._productOrigin) === null || _item$_productOrigin26 === void 0 || (_item$_productOrigin26 = _item$_productOrigin26.duration) === null || _item$_productOrigin26 === void 0 || (_item$_productOrigin26 = _item$_productOrigin26.flexible_config) === null || _item$_productOrigin26 === void 0 ? void 0 : _item$_productOrigin26.block_threshold) || 0);
|
|
2387
2390
|
}
|
|
2388
2391
|
return 0;
|
|
2389
2392
|
}, 0);
|
|
@@ -2544,10 +2547,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2544
2547
|
var osWarnTips = [];
|
|
2545
2548
|
var newResources = cloneDeep(item._origin.resources);
|
|
2546
2549
|
newResources.forEach(function (resource) {
|
|
2547
|
-
var _item$
|
|
2550
|
+
var _item$_productOrigin27;
|
|
2548
2551
|
// 如果商品配置的是灵活时长,开始时间设置为提交的时间,结束时间从资源的可用最晚时间和店铺营业结束时间里取一个最早的
|
|
2549
|
-
if (((_item$
|
|
2550
|
-
var _allResources$find, _item$
|
|
2552
|
+
if (((_item$_productOrigin27 = item._productOrigin) === null || _item$_productOrigin27 === void 0 || (_item$_productOrigin27 = _item$_productOrigin27.duration) === null || _item$_productOrigin27 === void 0 ? void 0 : _item$_productOrigin27.type) === 'flexible') {
|
|
2553
|
+
var _allResources$find, _item$_productOrigin28, _item$_productOrigin29;
|
|
2551
2554
|
item.duration = {
|
|
2552
2555
|
type: 'minutes',
|
|
2553
2556
|
value: 10
|
|
@@ -2630,15 +2633,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2630
2633
|
resource.endTime = formattedEndTime.format('YYYY-MM-DD HH:mm');
|
|
2631
2634
|
// 如果是动态时长商品,并且当前选择的时间的结束时间小于了最低提示时长(warningThreshold),则追加一个提示
|
|
2632
2635
|
// 如果currentStartTime + warningThreshold 大于 currentEndTime,且 osWarnTips 没有pisell2.product.card.closing-soon.warning 这一项,则加入这一项
|
|
2633
|
-
if ((_item$
|
|
2636
|
+
if ((_item$_productOrigin28 = item._productOrigin) !== null && _item$_productOrigin28 !== void 0 && (_item$_productOrigin28 = _item$_productOrigin28.duration) !== null && _item$_productOrigin28 !== void 0 && (_item$_productOrigin28 = _item$_productOrigin28.flexible_config) !== null && _item$_productOrigin28 !== void 0 && _item$_productOrigin28.is_enable_minimum_duration && dayjs(currentStartTime).add(((_item$_productOrigin29 = item._productOrigin) === null || _item$_productOrigin29 === void 0 || (_item$_productOrigin29 = _item$_productOrigin29.duration) === null || _item$_productOrigin29 === void 0 || (_item$_productOrigin29 = _item$_productOrigin29.flexible_config) === null || _item$_productOrigin29 === void 0 ? void 0 : _item$_productOrigin29.warning_threshold) || 0, 'minutes').isAfter(dayjs(formattedEndTime))) {
|
|
2634
2637
|
if (!osWarnTips.includes('pisell2.product.card.closing-soon.warning')) {
|
|
2635
2638
|
osWarnTips.push('pisell2.product.card.closing-soon.warning');
|
|
2636
2639
|
}
|
|
2637
2640
|
}
|
|
2638
2641
|
} else {
|
|
2639
|
-
var _item$
|
|
2642
|
+
var _item$_productOrigin30;
|
|
2640
2643
|
resource.startTime = currentStartTime;
|
|
2641
|
-
resource.endTime = dayjs(currentStartTime).add(((_item$
|
|
2644
|
+
resource.endTime = dayjs(currentStartTime).add(((_item$_productOrigin30 = item._productOrigin) === null || _item$_productOrigin30 === void 0 || (_item$_productOrigin30 = _item$_productOrigin30.duration) === null || _item$_productOrigin30 === void 0 ? void 0 : _item$_productOrigin30.value) || 10, 'minutes').format('YYYY-MM-DD HH:mm');
|
|
2642
2645
|
}
|
|
2643
2646
|
// delete resource.times;
|
|
2644
2647
|
});
|
|
@@ -19,10 +19,12 @@ export declare function calculateResourceAvailableTime({ resource, timeSlots, cu
|
|
|
19
19
|
* @param countMap 已预约数量映射
|
|
20
20
|
* @returns 最快可用的资源
|
|
21
21
|
*/
|
|
22
|
-
export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, }: {
|
|
22
|
+
export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, targetDate, durationMinutes, }: {
|
|
23
23
|
resources: ResourceItem[];
|
|
24
24
|
currentCapacity?: number;
|
|
25
25
|
countMap?: Record<number, number>;
|
|
26
|
+
targetDate?: string | Dayjs;
|
|
27
|
+
durationMinutes?: number;
|
|
26
28
|
}): ResourceItem | null;
|
|
27
29
|
/**
|
|
28
30
|
* 给定一个时间列表,通过开始和结束时间过滤出符合条件的时间段
|
|
@@ -91,8 +91,14 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
91
91
|
_ref2$currentCapacity = _ref2.currentCapacity,
|
|
92
92
|
currentCapacity = _ref2$currentCapacity === void 0 ? 1 : _ref2$currentCapacity,
|
|
93
93
|
_ref2$countMap = _ref2.countMap,
|
|
94
|
-
countMap = _ref2$countMap === void 0 ? {} : _ref2$countMap
|
|
94
|
+
countMap = _ref2$countMap === void 0 ? {} : _ref2$countMap,
|
|
95
|
+
targetDate = _ref2.targetDate,
|
|
96
|
+
_ref2$durationMinutes = _ref2.durationMinutes,
|
|
97
|
+
durationMinutes = _ref2$durationMinutes === void 0 ? 30 : _ref2$durationMinutes;
|
|
95
98
|
var currentTime = dayjs();
|
|
99
|
+
var resolvedDuration = durationMinutes > 0 ? durationMinutes : 30;
|
|
100
|
+
var targetDay = targetDate ? dayjs(targetDate) : currentTime;
|
|
101
|
+
var isTargetDayToday = targetDay.isSame(currentTime, 'day');
|
|
96
102
|
var fastestTime = null;
|
|
97
103
|
var fastestResources = [];
|
|
98
104
|
console.log('[TimeslotUtils] 查找最快可用资源:', {
|
|
@@ -108,17 +114,18 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
108
114
|
try {
|
|
109
115
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
110
116
|
var _resource = _step2.value;
|
|
111
|
-
//
|
|
112
|
-
var
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
// 获取资源在目标日期且还在工作时间内的时间段
|
|
118
|
+
var targetDayTimes = _resource.times.filter(function (time) {
|
|
119
|
+
var isSameTargetDay = dayjs(time.start_at).isSame(targetDay, 'day');
|
|
120
|
+
if (!isSameTargetDay) return false;
|
|
121
|
+
if (!isTargetDayToday) return true;
|
|
122
|
+
return dayjs(time.end_at).isAfter(currentTime);
|
|
116
123
|
});
|
|
117
|
-
if (
|
|
124
|
+
if (targetDayTimes.length === 0) {
|
|
118
125
|
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, ") \u4ECA\u65E5\u65E0\u53EF\u7528\u65F6\u95F4\u6BB5"));
|
|
119
126
|
continue;
|
|
120
127
|
}
|
|
121
|
-
var _iterator4 = _createForOfIteratorHelper(
|
|
128
|
+
var _iterator4 = _createForOfIteratorHelper(targetDayTimes),
|
|
122
129
|
_step4;
|
|
123
130
|
try {
|
|
124
131
|
var _loop = function _loop() {
|
|
@@ -128,7 +135,7 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
128
135
|
var workEndTime = dayjs(time.end_at);
|
|
129
136
|
|
|
130
137
|
// 确定检查的起始时间(当前时间 vs 工作开始时间)
|
|
131
|
-
var nextAvailableTime = currentTime.
|
|
138
|
+
var nextAvailableTime = isTargetDayToday && currentTime.isAfter(workStartTime) ? currentTime : workStartTime;
|
|
132
139
|
console.log("[TimeslotUtils] \u68C0\u67E5\u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, "):"), {
|
|
133
140
|
workTime: "".concat(workStartTime.format('HH:mm'), "-").concat(workEndTime.format('HH:mm')),
|
|
134
141
|
checkStartTime: nextAvailableTime.format('HH:mm:ss'),
|
|
@@ -165,7 +172,7 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
165
172
|
// 检查资源类型和容量
|
|
166
173
|
if (_resource.resourceType === 'single' || (_resource.capacity || 1) === 1) {
|
|
167
174
|
// 单人预约资源:检查时间冲突
|
|
168
|
-
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(
|
|
175
|
+
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(resolvedDuration, 'minute'))) {
|
|
169
176
|
// 有冲突,使用事件结束时间
|
|
170
177
|
finalAvailableTime = _eventEnd;
|
|
171
178
|
console.log("[TimeslotUtils] \u53D1\u73B0\u65F6\u95F4\u51B2\u7A81\uFF0C\u8C03\u6574\u5230: ".concat(finalAvailableTime.format('HH:mm:ss')));
|
|
@@ -177,7 +184,7 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
177
184
|
var eventUsedCapacity = _event.pax || 1;
|
|
178
185
|
|
|
179
186
|
// 如果在事件时间范围内,检查容量是否足够
|
|
180
|
-
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(
|
|
187
|
+
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(resolvedDuration, 'minute'))) {
|
|
181
188
|
var totalRequiredCapacity = currentUsedCapacity + currentCapacity + eventUsedCapacity;
|
|
182
189
|
if (totalRequiredCapacity > totalCapacity) {
|
|
183
190
|
// 容量不足,使用事件结束时间
|
|
@@ -194,7 +201,7 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
194
201
|
} finally {
|
|
195
202
|
_iterator5.f();
|
|
196
203
|
}
|
|
197
|
-
if (finalAvailableTime.isAfter(workEndTime)) {
|
|
204
|
+
if (finalAvailableTime.add(resolvedDuration, 'minute').isAfter(workEndTime)) {
|
|
198
205
|
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, " \u53EF\u7528\u65F6\u95F4\u8D85\u51FA\u5DE5\u4F5C\u65F6\u95F4\uFF0C\u8DF3\u8FC7"));
|
|
199
206
|
return 0; // continue
|
|
200
207
|
}
|
|
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
115
115
|
* 获取当前的客户搜索条件
|
|
116
116
|
* @returns 当前搜索条件
|
|
117
117
|
*/
|
|
118
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
118
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
119
119
|
/**
|
|
120
120
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
121
121
|
* @returns 客户状态
|
|
@@ -19,7 +19,7 @@ interface PackageSubItemUsageRules {
|
|
|
19
19
|
type: 'universal_discount' | 'package_exclusive' | 'single_item_promo' | 'custom_usage_rules';
|
|
20
20
|
rules: ("original_price" | "markup_price")[];
|
|
21
21
|
package_scope?: {
|
|
22
|
-
type: 'all_packages' | 'specific_packages';
|
|
22
|
+
type: 'all_packages' | 'specific_packages' | 'product_all' | 'products';
|
|
23
23
|
exclude_bundle_product_ids: number[];
|
|
24
24
|
include_bundle_product_ids: number[];
|
|
25
25
|
filter: 0 | 1;
|
|
@@ -1786,7 +1786,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1786
1786
|
* @returns 是否可用
|
|
1787
1787
|
*/
|
|
1788
1788
|
checkPackageSubItemUsageRules(discount, flatItem) {
|
|
1789
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1789
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1790
1790
|
const limitedData = discount.limited_relation_product_data;
|
|
1791
1791
|
const usageRules = limitedData == null ? void 0 : limitedData.package_sub_item_usage_rules;
|
|
1792
1792
|
const rules = ["original_price", ...(usageRules == null ? void 0 : usageRules.rules) || []];
|
|
@@ -1808,7 +1808,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1808
1808
|
if (isBundleItem) {
|
|
1809
1809
|
const priceType = (_a = flatItem.bundleItem) == null ? void 0 : _a.price_type;
|
|
1810
1810
|
const priceTypeExt = (_b = flatItem.bundleItem) == null ? void 0 : _b.price_type_ext;
|
|
1811
|
-
const mainProductId = ((_c = flatItem == null ? void 0 : flatItem.originProduct) == null ? void 0 : _c.
|
|
1811
|
+
const mainProductId = ((_d = (_c = flatItem == null ? void 0 : flatItem.originProduct) == null ? void 0 : _c._productOrigin) == null ? void 0 : _d.id) || ((_e = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _e.id) || 0;
|
|
1812
1812
|
const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
|
|
1813
1813
|
const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
|
|
1814
1814
|
if (rules.length > 0) {
|
|
@@ -1816,14 +1816,14 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1816
1816
|
const _isMarkupPrice = isMarkupPrice && rules.includes("markup_price");
|
|
1817
1817
|
const isPriceValid = _isOriginalPrice || _isMarkupPrice;
|
|
1818
1818
|
let isScopeValid = false;
|
|
1819
|
-
if (scopeType === "all_packages") {
|
|
1819
|
+
if (scopeType === "all_packages" || scopeType === "product_all") {
|
|
1820
1820
|
if (!filter) {
|
|
1821
1821
|
isScopeValid = true;
|
|
1822
1822
|
} else {
|
|
1823
1823
|
isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
|
|
1824
1824
|
}
|
|
1825
1825
|
}
|
|
1826
|
-
if (scopeType === "specific_packages") {
|
|
1826
|
+
if (scopeType === "specific_packages" || scopeType === "products") {
|
|
1827
1827
|
isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
|
|
1828
1828
|
}
|
|
1829
1829
|
if (isPriceValid && isScopeValid) {
|
|
@@ -1840,8 +1840,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1840
1840
|
return false;
|
|
1841
1841
|
}
|
|
1842
1842
|
if (isBundleItem) {
|
|
1843
|
-
const priceType = (
|
|
1844
|
-
const priceTypeExt = (
|
|
1843
|
+
const priceType = (_f = flatItem.bundleItem) == null ? void 0 : _f.price_type;
|
|
1844
|
+
const priceTypeExt = (_g = flatItem.bundleItem) == null ? void 0 : _g.price_type_ext;
|
|
1845
1845
|
const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
|
|
1846
1846
|
const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
|
|
1847
1847
|
if (rules.length > 0) {
|
|
@@ -302,7 +302,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
302
302
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
303
303
|
errorList: any[];
|
|
304
304
|
};
|
|
305
|
-
getTimeSlotByAllResources(resources_code: string): any[];
|
|
305
|
+
getTimeSlotByAllResources(resources_code: string, split?: number): any[];
|
|
306
306
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
307
307
|
resources_code: string;
|
|
308
308
|
startDate: string;
|
|
@@ -1236,7 +1236,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1236
1236
|
}
|
|
1237
1237
|
);
|
|
1238
1238
|
cartItems2.forEach((item, index) => {
|
|
1239
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1239
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
1240
1240
|
const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
|
|
1241
1241
|
const hasOriginTimeSlot = Boolean(item._origin.start_time) && Boolean(item._origin.end_time) && !(timeSlots == null ? void 0 : timeSlots.start_time);
|
|
1242
1242
|
if (hasOriginTimeSlot) {
|
|
@@ -1369,7 +1369,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1369
1369
|
const fastestResource = (0, import_timeslots.findFastestAvailableResource)({
|
|
1370
1370
|
resources: targetRenderList,
|
|
1371
1371
|
currentCapacity,
|
|
1372
|
-
countMap: selectResourcesMap
|
|
1372
|
+
countMap: selectResourcesMap,
|
|
1373
|
+
targetDate: (_k = dateRange == null ? void 0 : dateRange[0]) == null ? void 0 : _k.date,
|
|
1374
|
+
durationMinutes: ((_l = item == null ? void 0 : item.duration) == null ? void 0 : _l.value) || ((_n = (_m = item == null ? void 0 : item._productOrigin) == null ? void 0 : _m.duration) == null ? void 0 : _n.value) || 10
|
|
1373
1375
|
});
|
|
1374
1376
|
const targetResource = fastestResource || targetRenderList[0];
|
|
1375
1377
|
targetResource.capacity = currentCapacity;
|
|
@@ -1406,7 +1408,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1406
1408
|
return { errorList };
|
|
1407
1409
|
}
|
|
1408
1410
|
// 从购物车中获取已经分配好第一步资源的所有时间片
|
|
1409
|
-
getTimeSlotByAllResources(resources_code) {
|
|
1411
|
+
getTimeSlotByAllResources(resources_code, split = 10) {
|
|
1410
1412
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1411
1413
|
let dateRange = this.store.date.getDateRange();
|
|
1412
1414
|
const resources = [];
|
|
@@ -1564,7 +1566,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1564
1566
|
resourcesMap,
|
|
1565
1567
|
duration,
|
|
1566
1568
|
currentDate: dateRange[0].date,
|
|
1567
|
-
split
|
|
1569
|
+
split,
|
|
1568
1570
|
resourcesUseableMap,
|
|
1569
1571
|
capacity: maxCapacity,
|
|
1570
1572
|
cut_off_time: maxCutOffTime,
|
|
@@ -19,10 +19,12 @@ export declare function calculateResourceAvailableTime({ resource, timeSlots, cu
|
|
|
19
19
|
* @param countMap 已预约数量映射
|
|
20
20
|
* @returns 最快可用的资源
|
|
21
21
|
*/
|
|
22
|
-
export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, }: {
|
|
22
|
+
export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, targetDate, durationMinutes, }: {
|
|
23
23
|
resources: ResourceItem[];
|
|
24
24
|
currentCapacity?: number;
|
|
25
25
|
countMap?: Record<number, number>;
|
|
26
|
+
targetDate?: string | Dayjs;
|
|
27
|
+
durationMinutes?: number;
|
|
26
28
|
}): ResourceItem | null;
|
|
27
29
|
/**
|
|
28
30
|
* 给定一个时间列表,通过开始和结束时间过滤出符合条件的时间段
|
|
@@ -77,10 +77,15 @@ function calculateResourceAvailableTime({
|
|
|
77
77
|
function findFastestAvailableResource({
|
|
78
78
|
resources,
|
|
79
79
|
currentCapacity = 1,
|
|
80
|
-
countMap = {}
|
|
80
|
+
countMap = {},
|
|
81
|
+
targetDate,
|
|
82
|
+
durationMinutes = 30
|
|
81
83
|
}) {
|
|
82
84
|
var _a, _b, _c;
|
|
83
85
|
const currentTime = (0, import_dayjs.default)();
|
|
86
|
+
const resolvedDuration = durationMinutes > 0 ? durationMinutes : 30;
|
|
87
|
+
const targetDay = targetDate ? (0, import_dayjs.default)(targetDate) : currentTime;
|
|
88
|
+
const isTargetDayToday = targetDay.isSame(currentTime, "day");
|
|
84
89
|
let fastestTime = null;
|
|
85
90
|
let fastestResources = [];
|
|
86
91
|
console.log("[TimeslotUtils] 查找最快可用资源:", {
|
|
@@ -90,19 +95,22 @@ function findFastestAvailableResource({
|
|
|
90
95
|
countMap
|
|
91
96
|
});
|
|
92
97
|
for (const resource of resources) {
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
const targetDayTimes = resource.times.filter((time) => {
|
|
99
|
+
const isSameTargetDay = (0, import_dayjs.default)(time.start_at).isSame(targetDay, "day");
|
|
100
|
+
if (!isSameTargetDay)
|
|
101
|
+
return false;
|
|
102
|
+
if (!isTargetDayToday)
|
|
103
|
+
return true;
|
|
104
|
+
return (0, import_dayjs.default)(time.end_at).isAfter(currentTime);
|
|
97
105
|
});
|
|
98
|
-
if (
|
|
106
|
+
if (targetDayTimes.length === 0) {
|
|
99
107
|
console.log(`[TimeslotUtils] 资源 ${resource.id}(${resource.main_field}) 今日无可用时间段`);
|
|
100
108
|
continue;
|
|
101
109
|
}
|
|
102
|
-
for (const time of
|
|
110
|
+
for (const time of targetDayTimes) {
|
|
103
111
|
const workStartTime = (0, import_dayjs.default)(time.start_at);
|
|
104
112
|
const workEndTime = (0, import_dayjs.default)(time.end_at);
|
|
105
|
-
let nextAvailableTime = currentTime.
|
|
113
|
+
let nextAvailableTime = isTargetDayToday && currentTime.isAfter(workStartTime) ? currentTime : workStartTime;
|
|
106
114
|
console.log(`[TimeslotUtils] 检查资源 ${resource.id}(${resource.main_field}):`, {
|
|
107
115
|
workTime: `${workStartTime.format("HH:mm")}-${workEndTime.format("HH:mm")}`,
|
|
108
116
|
checkStartTime: nextAvailableTime.format("HH:mm:ss"),
|
|
@@ -126,7 +134,7 @@ function findFastestAvailableResource({
|
|
|
126
134
|
pax: event.pax || 1
|
|
127
135
|
});
|
|
128
136
|
if (resource.resourceType === "single" || (resource.capacity || 1) === 1) {
|
|
129
|
-
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(
|
|
137
|
+
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
|
|
130
138
|
finalAvailableTime = eventEnd;
|
|
131
139
|
console.log(`[TimeslotUtils] 发现时间冲突,调整到: ${finalAvailableTime.format("HH:mm:ss")}`);
|
|
132
140
|
}
|
|
@@ -134,7 +142,7 @@ function findFastestAvailableResource({
|
|
|
134
142
|
const totalCapacity = resource.capacity || 0;
|
|
135
143
|
const currentUsedCapacity = countMap[resource.id] || 0;
|
|
136
144
|
const eventUsedCapacity = event.pax || 1;
|
|
137
|
-
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(
|
|
145
|
+
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
|
|
138
146
|
const totalRequiredCapacity = currentUsedCapacity + currentCapacity + eventUsedCapacity;
|
|
139
147
|
if (totalRequiredCapacity > totalCapacity) {
|
|
140
148
|
finalAvailableTime = eventEnd;
|
|
@@ -143,7 +151,7 @@ function findFastestAvailableResource({
|
|
|
143
151
|
}
|
|
144
152
|
}
|
|
145
153
|
}
|
|
146
|
-
if (finalAvailableTime.isAfter(workEndTime)) {
|
|
154
|
+
if (finalAvailableTime.add(resolvedDuration, "minute").isAfter(workEndTime)) {
|
|
147
155
|
console.log(`[TimeslotUtils] 资源 ${resource.id} 可用时间超出工作时间,跳过`);
|
|
148
156
|
continue;
|
|
149
157
|
}
|
|
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
115
115
|
* 获取当前的客户搜索条件
|
|
116
116
|
* @returns 当前搜索条件
|
|
117
117
|
*/
|
|
118
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
118
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
119
119
|
/**
|
|
120
120
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
121
121
|
* @returns 客户状态
|