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