@pisell/pisellos 2.1.112 → 2.1.114
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.
|
@@ -1789,7 +1789,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1789
1789
|
}
|
|
1790
1790
|
// 计算在时间片内有交集的预约容量总和
|
|
1791
1791
|
var totalCapacity = (countMap[n.id] || []).reduce(function (sum, item) {
|
|
1792
|
-
var hasOverlap =
|
|
1792
|
+
var hasOverlap = dayjs(item.time.start_at).isBefore(dayjs(timeSlots.end_at)) && dayjs(item.time.end_at).isAfter(dayjs(timeSlots.start_at));
|
|
1793
1793
|
return hasOverlap ? sum + item.pax : sum;
|
|
1794
1794
|
}, 0);
|
|
1795
1795
|
|
|
@@ -1896,8 +1896,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1896
1896
|
cartItems.forEach(function (item, index) {
|
|
1897
1897
|
var _getCapacityInfoByCar6 = getCapacityInfoByCartItem(item),
|
|
1898
1898
|
currentCapacity = _getCapacityInfoByCar6.currentCapacity;
|
|
1899
|
+
var hasOriginTimeSlot = Boolean(item._origin.start_time) && Boolean(item._origin.end_time) && !(timeSlots !== null && timeSlots !== void 0 && timeSlots.start_time);
|
|
1899
1900
|
// 如果商品已经有时间数据了,意味着是通过先选日期再选商品流程进来的,相当于时间切片已经选中了
|
|
1900
|
-
if (
|
|
1901
|
+
if (hasOriginTimeSlot) {
|
|
1901
1902
|
recordTimeSlots = {
|
|
1902
1903
|
start_time: item._origin.start_time,
|
|
1903
1904
|
end_time: item._origin.end_time,
|
|
@@ -1913,10 +1914,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1913
1914
|
return n.code === resources_code;
|
|
1914
1915
|
});
|
|
1915
1916
|
// 只有 duration 类商品且不含有灵活时间的商品需要这个操作
|
|
1916
|
-
if (index !== 0 && recordTimeSlots && (currentResourceConfig === null || currentResourceConfig === void 0 ? void 0 : currentResourceConfig.type) === 'single' && (_item$_productOrigin3 = item._productOrigin) !== null && _item$_productOrigin3 !== void 0 && _item$_productOrigin3.duration && !hasFlexibleProduct) {
|
|
1917
|
-
var _item$_productOrigin4
|
|
1918
|
-
var
|
|
1919
|
-
var
|
|
1917
|
+
if (index !== 0 && recordTimeSlots && (currentResourceConfig === null || currentResourceConfig === void 0 ? void 0 : currentResourceConfig.type) === 'single' && (_item$_productOrigin3 = item._productOrigin) !== null && _item$_productOrigin3 !== void 0 && _item$_productOrigin3.duration && !hasFlexibleProduct && !hasOriginTimeSlot) {
|
|
1918
|
+
var _item$_productOrigin4;
|
|
1919
|
+
var recordEndAt = recordTimeSlots.end_at ? dayjs(recordTimeSlots.end_at) : dayjs("".concat(item.start_date, " ").concat(recordTimeSlots.end_time));
|
|
1920
|
+
var start_at = recordEndAt;
|
|
1921
|
+
var end_at = start_at.add(((_item$_productOrigin4 = item._productOrigin) === null || _item$_productOrigin4 === void 0 || (_item$_productOrigin4 = _item$_productOrigin4.duration) === null || _item$_productOrigin4 === void 0 ? void 0 : _item$_productOrigin4.value) || 10, 'minutes');
|
|
1920
1922
|
recordTimeSlots = {
|
|
1921
1923
|
start_time: start_at.format('HH:mm'),
|
|
1922
1924
|
end_time: end_at.format('HH:mm'),
|
|
@@ -1960,13 +1962,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1960
1962
|
errorList.push(item._id);
|
|
1961
1963
|
}
|
|
1962
1964
|
} else {
|
|
1963
|
-
var _item$
|
|
1965
|
+
var _item$_productOrigin5, _productResources$fin;
|
|
1964
1966
|
// 这里必须每次循环重新读,避免前一次循环操作了购物车,导致数据变更
|
|
1965
1967
|
// 能进到这种逻辑,说明是 duration 类商品或者灵活时长商品,且是第一种资源,还没有确定时间
|
|
1966
1968
|
var allCartItems = cloneDeep(_this11.store.cart.getItems());
|
|
1967
1969
|
// 如果没有传递 timeSlots,代表是第一种资源,则直接拿商品的 duration,到资源列表里找一个公共可用的
|
|
1968
1970
|
var selectedResources = [];
|
|
1969
|
-
var _resources = cloneDeep(((_item$
|
|
1971
|
+
var _resources = cloneDeep(((_item$_productOrigin5 = item._productOrigin) === null || _item$_productOrigin5 === void 0 || (_item$_productOrigin5 = _item$_productOrigin5.product_resource) === null || _item$_productOrigin5 === void 0 ? void 0 : _item$_productOrigin5.resources) || []);
|
|
1970
1972
|
var currentResourcesRenderList = [];
|
|
1971
1973
|
_resources.forEach(function (n) {
|
|
1972
1974
|
var _n$renderList;
|
|
@@ -2082,8 +2084,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2082
2084
|
var maxCutOffTime = undefined;
|
|
2083
2085
|
var maxCutOffTimeValue = dayjs();
|
|
2084
2086
|
cartItems.forEach(function (item) {
|
|
2085
|
-
var _item$
|
|
2086
|
-
(_item$
|
|
2087
|
+
var _item$_productOrigin6, _item$_productOrigin7, _item$_productOrigin8, _item$_productOrigin9;
|
|
2088
|
+
(_item$_productOrigin6 = item._productOrigin) === null || _item$_productOrigin6 === void 0 || (_item$_productOrigin6 = _item$_productOrigin6.product_resource) === null || _item$_productOrigin6 === void 0 || (_item$_productOrigin6 = _item$_productOrigin6.resources) === null || _item$_productOrigin6 === void 0 || _item$_productOrigin6.forEach(function (n) {
|
|
2087
2089
|
// TODO: 少了个 status 的判断
|
|
2088
2090
|
if (n.code === resources_code) {
|
|
2089
2091
|
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
@@ -2096,10 +2098,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2096
2098
|
if (item.resource_id && !resourceIds.includes(item.resource_id)) {
|
|
2097
2099
|
resourceIds.push(item.resource_id);
|
|
2098
2100
|
}
|
|
2099
|
-
resourcesTypeId = item === null || item === void 0 || (_item$
|
|
2101
|
+
resourcesTypeId = item === null || item === void 0 || (_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 = _item$_productOrigin7.find(function (n) {
|
|
2100
2102
|
return n.code === resources_code;
|
|
2101
|
-
})) === null || _item$
|
|
2102
|
-
if ((_item$
|
|
2103
|
+
})) === null || _item$_productOrigin7 === void 0 ? void 0 : _item$_productOrigin7.id;
|
|
2104
|
+
if ((_item$_productOrigin8 = item._productOrigin) !== null && _item$_productOrigin8 !== void 0 && _item$_productOrigin8.cut_off_time && ((_item$_productOrigin9 = item._productOrigin) === null || _item$_productOrigin9 === void 0 ? void 0 : _item$_productOrigin9.cut_off_time.type) === 'advance') {
|
|
2103
2105
|
var currentCutOffTime = dayjs().add(item._productOrigin.cut_off_time.unit, item._productOrigin.cut_off_time.unit_type);
|
|
2104
2106
|
if (currentCutOffTime.isAfter(maxCutOffTimeValue, 'minute')) {
|
|
2105
2107
|
maxCutOffTimeValue = currentCutOffTime;
|
|
@@ -2149,13 +2151,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2149
2151
|
cartItems.forEach(function (item) {
|
|
2150
2152
|
// 单个预约累加账号 多个预约取最大值
|
|
2151
2153
|
if (isSingleResource) {
|
|
2152
|
-
var _item$
|
|
2153
|
-
accountDuration += ((_item$
|
|
2154
|
+
var _item$_productOrigin10;
|
|
2155
|
+
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;
|
|
2154
2156
|
} else {
|
|
2155
|
-
var _item$
|
|
2156
|
-
if (accountDuration < (((_item$
|
|
2157
|
-
var _item$
|
|
2158
|
-
accountDuration = ((_item$
|
|
2157
|
+
var _item$_productOrigin11;
|
|
2158
|
+
if (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)) {
|
|
2159
|
+
var _item$_productOrigin12;
|
|
2160
|
+
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;
|
|
2159
2161
|
}
|
|
2160
2162
|
}
|
|
2161
2163
|
});
|
|
@@ -2192,8 +2194,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2192
2194
|
}
|
|
2193
2195
|
var resourcesUseableMap = {};
|
|
2194
2196
|
var hasFlexibleDuration = cartItems.some(function (item) {
|
|
2195
|
-
var _item$
|
|
2196
|
-
return ((_item$
|
|
2197
|
+
var _item$_productOrigin13;
|
|
2198
|
+
return ((_item$_productOrigin13 = item._productOrigin) === null || _item$_productOrigin13 === void 0 || (_item$_productOrigin13 = _item$_productOrigin13.duration) === null || _item$_productOrigin13 === void 0 ? void 0 : _item$_productOrigin13.type) === 'flexible';
|
|
2197
2199
|
});
|
|
2198
2200
|
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;
|
|
2199
2201
|
|
|
@@ -2201,11 +2203,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2201
2203
|
var maxBlockThreshold = 0;
|
|
2202
2204
|
if (hasFlexibleDuration) {
|
|
2203
2205
|
maxBlockThreshold = cartItems.reduce(function (max, item) {
|
|
2204
|
-
var _item$
|
|
2206
|
+
var _item$_productOrigin14;
|
|
2205
2207
|
// 如果开启了灵活时长商品配置,则取 block_threshold 的值
|
|
2206
|
-
if ((_item$
|
|
2207
|
-
var _item$
|
|
2208
|
-
return Math.max(max, ((_item$
|
|
2208
|
+
if ((_item$_productOrigin14 = item._productOrigin) !== null && _item$_productOrigin14 !== void 0 && (_item$_productOrigin14 = _item$_productOrigin14.duration) !== null && _item$_productOrigin14 !== void 0 && (_item$_productOrigin14 = _item$_productOrigin14.flexible_config) !== null && _item$_productOrigin14 !== void 0 && _item$_productOrigin14.is_enable_minimum_duration) {
|
|
2209
|
+
var _item$_productOrigin15;
|
|
2210
|
+
return Math.max(max, ((_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 ? void 0 : _item$_productOrigin15.block_threshold) || 0);
|
|
2209
2211
|
}
|
|
2210
2212
|
return 0;
|
|
2211
2213
|
}, 0);
|
|
@@ -2297,8 +2299,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2297
2299
|
maxCutOffTime = undefined;
|
|
2298
2300
|
maxCutOffTimeValue = dayjs();
|
|
2299
2301
|
cartItems.forEach(function (item) {
|
|
2300
|
-
var _item$
|
|
2301
|
-
(_item$
|
|
2302
|
+
var _item$_productOrigin16, _item$_productOrigin17, _item$_productOrigin18, _item$_productOrigin19;
|
|
2303
|
+
(_item$_productOrigin16 = item._productOrigin) === null || _item$_productOrigin16 === void 0 || (_item$_productOrigin16 = _item$_productOrigin16.product_resource) === null || _item$_productOrigin16 === void 0 || (_item$_productOrigin16 = _item$_productOrigin16.resources) === null || _item$_productOrigin16 === void 0 || _item$_productOrigin16.forEach(function (n) {
|
|
2302
2304
|
// TODO: 少了个 status 的判断
|
|
2303
2305
|
if (n.code === resources_code) {
|
|
2304
2306
|
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
@@ -2311,10 +2313,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2311
2313
|
if (item.resource_id && !resourceIds.includes(item.resource_id)) {
|
|
2312
2314
|
resourceIds.push(item.resource_id);
|
|
2313
2315
|
}
|
|
2314
|
-
resourcesTypeId = item === null || item === void 0 || (_item$
|
|
2316
|
+
resourcesTypeId = item === null || item === void 0 || (_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 = _item$_productOrigin17.find(function (n) {
|
|
2315
2317
|
return n.code === resources_code;
|
|
2316
|
-
})) === null || _item$
|
|
2317
|
-
if ((_item$
|
|
2318
|
+
})) === null || _item$_productOrigin17 === void 0 ? void 0 : _item$_productOrigin17.id;
|
|
2319
|
+
if ((_item$_productOrigin18 = item._productOrigin) !== null && _item$_productOrigin18 !== void 0 && _item$_productOrigin18.cut_off_time && ((_item$_productOrigin19 = item._productOrigin) === null || _item$_productOrigin19 === void 0 ? void 0 : _item$_productOrigin19.cut_off_time.type) === 'advance') {
|
|
2318
2320
|
var currentCutOffTime = dayjs().add(item._productOrigin.cut_off_time.unit, item._productOrigin.cut_off_time.unit_type);
|
|
2319
2321
|
if (currentCutOffTime.isAfter(maxCutOffTimeValue, 'minute')) {
|
|
2320
2322
|
maxCutOffTimeValue = currentCutOffTime;
|
|
@@ -2337,13 +2339,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2337
2339
|
cartItems.forEach(function (item) {
|
|
2338
2340
|
// 单个预约累加账号 多个预约取最大值
|
|
2339
2341
|
if (isSingleResource) {
|
|
2340
|
-
var _item$
|
|
2341
|
-
accountDuration += ((_item$
|
|
2342
|
+
var _item$_productOrigin20;
|
|
2343
|
+
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;
|
|
2342
2344
|
} else {
|
|
2343
|
-
var _item$
|
|
2344
|
-
if (accountDuration < (((_item$
|
|
2345
|
-
var _item$
|
|
2346
|
-
accountDuration = ((_item$
|
|
2345
|
+
var _item$_productOrigin21;
|
|
2346
|
+
if (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)) {
|
|
2347
|
+
var _item$_productOrigin22;
|
|
2348
|
+
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;
|
|
2347
2349
|
}
|
|
2348
2350
|
}
|
|
2349
2351
|
});
|
|
@@ -2369,18 +2371,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2369
2371
|
case 20:
|
|
2370
2372
|
resourcesUseableMap = {};
|
|
2371
2373
|
hasFlexibleDuration = cartItems.some(function (item) {
|
|
2372
|
-
var _item$
|
|
2373
|
-
return ((_item$
|
|
2374
|
+
var _item$_productOrigin23;
|
|
2375
|
+
return ((_item$_productOrigin23 = item._productOrigin) === null || _item$_productOrigin23 === void 0 || (_item$_productOrigin23 = _item$_productOrigin23.duration) === null || _item$_productOrigin23 === void 0 ? void 0 : _item$_productOrigin23.type) === 'flexible';
|
|
2374
2376
|
});
|
|
2375
2377
|
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 的值
|
|
2376
2378
|
maxBlockThreshold = 0;
|
|
2377
2379
|
if (hasFlexibleDuration) {
|
|
2378
2380
|
maxBlockThreshold = cartItems.reduce(function (max, item) {
|
|
2379
|
-
var _item$
|
|
2381
|
+
var _item$_productOrigin24;
|
|
2380
2382
|
// 如果开启了灵活时长商品配置,则取 block_threshold 的值
|
|
2381
|
-
if ((_item$
|
|
2382
|
-
var _item$
|
|
2383
|
-
return Math.max(max, ((_item$
|
|
2383
|
+
if ((_item$_productOrigin24 = item._productOrigin) !== null && _item$_productOrigin24 !== void 0 && (_item$_productOrigin24 = _item$_productOrigin24.duration) !== null && _item$_productOrigin24 !== void 0 && (_item$_productOrigin24 = _item$_productOrigin24.flexible_config) !== null && _item$_productOrigin24 !== void 0 && _item$_productOrigin24.is_enable_minimum_duration) {
|
|
2384
|
+
var _item$_productOrigin25;
|
|
2385
|
+
return Math.max(max, ((_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 ? void 0 : _item$_productOrigin25.block_threshold) || 0);
|
|
2384
2386
|
}
|
|
2385
2387
|
return 0;
|
|
2386
2388
|
}, 0);
|
|
@@ -2541,10 +2543,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2541
2543
|
var osWarnTips = [];
|
|
2542
2544
|
var newResources = cloneDeep(item._origin.resources);
|
|
2543
2545
|
newResources.forEach(function (resource) {
|
|
2544
|
-
var _item$
|
|
2546
|
+
var _item$_productOrigin26;
|
|
2545
2547
|
// 如果商品配置的是灵活时长,开始时间设置为提交的时间,结束时间从资源的可用最晚时间和店铺营业结束时间里取一个最早的
|
|
2546
|
-
if (((_item$
|
|
2547
|
-
var _allResources$find, _item$
|
|
2548
|
+
if (((_item$_productOrigin26 = item._productOrigin) === null || _item$_productOrigin26 === void 0 || (_item$_productOrigin26 = _item$_productOrigin26.duration) === null || _item$_productOrigin26 === void 0 ? void 0 : _item$_productOrigin26.type) === 'flexible') {
|
|
2549
|
+
var _allResources$find, _item$_productOrigin27, _item$_productOrigin28;
|
|
2548
2550
|
item.duration = {
|
|
2549
2551
|
type: 'minutes',
|
|
2550
2552
|
value: 10
|
|
@@ -2627,15 +2629,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2627
2629
|
resource.endTime = formattedEndTime.format('YYYY-MM-DD HH:mm');
|
|
2628
2630
|
// 如果是动态时长商品,并且当前选择的时间的结束时间小于了最低提示时长(warningThreshold),则追加一个提示
|
|
2629
2631
|
// 如果currentStartTime + warningThreshold 大于 currentEndTime,且 osWarnTips 没有pisell2.product.card.closing-soon.warning 这一项,则加入这一项
|
|
2630
|
-
if ((_item$
|
|
2632
|
+
if ((_item$_productOrigin27 = item._productOrigin) !== null && _item$_productOrigin27 !== void 0 && (_item$_productOrigin27 = _item$_productOrigin27.duration) !== null && _item$_productOrigin27 !== void 0 && (_item$_productOrigin27 = _item$_productOrigin27.flexible_config) !== null && _item$_productOrigin27 !== void 0 && _item$_productOrigin27.is_enable_minimum_duration && dayjs(currentStartTime).add(((_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 ? void 0 : _item$_productOrigin28.warning_threshold) || 0, 'minutes').isAfter(dayjs(formattedEndTime))) {
|
|
2631
2633
|
if (!osWarnTips.includes('pisell2.product.card.closing-soon.warning')) {
|
|
2632
2634
|
osWarnTips.push('pisell2.product.card.closing-soon.warning');
|
|
2633
2635
|
}
|
|
2634
2636
|
}
|
|
2635
2637
|
} else {
|
|
2636
|
-
var _item$
|
|
2638
|
+
var _item$_productOrigin29;
|
|
2637
2639
|
resource.startTime = currentStartTime;
|
|
2638
|
-
resource.endTime = dayjs(currentStartTime).add(((_item$
|
|
2640
|
+
resource.endTime = dayjs(currentStartTime).add(((_item$_productOrigin29 = item._productOrigin) === null || _item$_productOrigin29 === void 0 || (_item$_productOrigin29 = _item$_productOrigin29.duration) === null || _item$_productOrigin29 === void 0 ? void 0 : _item$_productOrigin29.value) || 10, 'minutes').format('YYYY-MM-DD HH:mm');
|
|
2639
2641
|
}
|
|
2640
2642
|
// delete resource.times;
|
|
2641
2643
|
});
|
|
@@ -1153,7 +1153,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
const totalCapacity = (countMap[n.id] || []).reduce(
|
|
1155
1155
|
(sum, item) => {
|
|
1156
|
-
const hasOverlap =
|
|
1156
|
+
const hasOverlap = (0, import_dayjs.default)(item.time.start_at).isBefore((0, import_dayjs.default)(timeSlots.end_at)) && (0, import_dayjs.default)(item.time.end_at).isAfter((0, import_dayjs.default)(timeSlots.start_at));
|
|
1157
1157
|
return hasOverlap ? sum + item.pax : sum;
|
|
1158
1158
|
},
|
|
1159
1159
|
0
|
|
@@ -1235,9 +1235,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
);
|
|
1237
1237
|
cartItems2.forEach((item, index) => {
|
|
1238
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j
|
|
1238
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1239
1239
|
const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
|
|
1240
|
-
|
|
1240
|
+
const hasOriginTimeSlot = Boolean(item._origin.start_time) && Boolean(item._origin.end_time) && !(timeSlots == null ? void 0 : timeSlots.start_time);
|
|
1241
|
+
if (hasOriginTimeSlot) {
|
|
1241
1242
|
recordTimeSlots = {
|
|
1242
1243
|
start_time: item._origin.start_time,
|
|
1243
1244
|
end_time: item._origin.end_time,
|
|
@@ -1249,13 +1250,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1249
1250
|
const currentResourceConfig = (_c = (_b = (_a2 = item._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b.resources) == null ? void 0 : _c.find(
|
|
1250
1251
|
(n) => n.code === resources_code
|
|
1251
1252
|
);
|
|
1252
|
-
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_d = item._productOrigin) == null ? void 0 : _d.duration) && !hasFlexibleProduct) {
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
"minutes"
|
|
1256
|
-
);
|
|
1253
|
+
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_d = item._productOrigin) == null ? void 0 : _d.duration) && !hasFlexibleProduct && !hasOriginTimeSlot) {
|
|
1254
|
+
const recordEndAt = recordTimeSlots.end_at ? (0, import_dayjs.default)(recordTimeSlots.end_at) : (0, import_dayjs.default)(`${item.start_date} ${recordTimeSlots.end_time}`);
|
|
1255
|
+
let start_at = recordEndAt;
|
|
1257
1256
|
let end_at = start_at.add(
|
|
1258
|
-
((
|
|
1257
|
+
((_f = (_e = item._productOrigin) == null ? void 0 : _e.duration) == null ? void 0 : _f.value) || 10,
|
|
1259
1258
|
"minutes"
|
|
1260
1259
|
);
|
|
1261
1260
|
recordTimeSlots = {
|
|
@@ -1309,7 +1308,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1309
1308
|
const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
1310
1309
|
let selectedResources = [];
|
|
1311
1310
|
const resources2 = (0, import_lodash_es.cloneDeep)(
|
|
1312
|
-
((
|
|
1311
|
+
((_h = (_g = item._productOrigin) == null ? void 0 : _g.product_resource) == null ? void 0 : _h.resources) || []
|
|
1313
1312
|
);
|
|
1314
1313
|
const currentResourcesRenderList = [];
|
|
1315
1314
|
resources2.forEach((n) => {
|
|
@@ -1357,11 +1356,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1357
1356
|
return recordCount >= currentCapacity;
|
|
1358
1357
|
});
|
|
1359
1358
|
});
|
|
1360
|
-
const targetRenderList = (
|
|
1359
|
+
const targetRenderList = (_i = productResources.find(
|
|
1361
1360
|
(n) => n.code === resources_code
|
|
1362
|
-
)) == null ? void 0 :
|
|
1361
|
+
)) == null ? void 0 : _i.renderList;
|
|
1363
1362
|
if (targetRenderList && targetRenderList.length > 0) {
|
|
1364
|
-
if ((
|
|
1363
|
+
if ((_j = item._origin.resources) == null ? void 0 : _j.some(
|
|
1365
1364
|
(n) => n.form_id === targetRenderList[0].form_id
|
|
1366
1365
|
)) {
|
|
1367
1366
|
return;
|