@pisell/pisellos 3.0.84 → 3.0.85
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.
|
@@ -134,7 +134,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
134
134
|
if (productList.every(function (item) {
|
|
135
135
|
var _product$discount_lis;
|
|
136
136
|
var product = _this2.hooks.getProduct(item);
|
|
137
|
-
return product.booking_id && (((_product$discount_lis = product.discount_list) === null || _product$discount_lis === void 0 ? void 0 : _product$discount_lis.length) ||
|
|
137
|
+
return product.booking_id && (((_product$discount_lis = product.discount_list) === null || _product$discount_lis === void 0 ? void 0 : _product$discount_lis.length) || product.total == 0);
|
|
138
138
|
})) {
|
|
139
139
|
return {
|
|
140
140
|
isAvailable: false,
|
|
@@ -1779,7 +1779,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1779
1779
|
}
|
|
1780
1780
|
// 计算在时间片内有交集的预约容量总和
|
|
1781
1781
|
var totalCapacity = (countMap[n.id] || []).reduce(function (sum, item) {
|
|
1782
|
-
var hasOverlap =
|
|
1782
|
+
var hasOverlap = dayjs(item.time.start_at).isBefore(dayjs(timeSlots.end_at)) && dayjs(item.time.end_at).isAfter(dayjs(timeSlots.start_at));
|
|
1783
1783
|
return hasOverlap ? sum + item.pax : sum;
|
|
1784
1784
|
}, 0);
|
|
1785
1785
|
|
|
@@ -1886,8 +1886,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1886
1886
|
cartItems.forEach(function (item, index) {
|
|
1887
1887
|
var _getCapacityInfoByCar6 = getCapacityInfoByCartItem(item),
|
|
1888
1888
|
currentCapacity = _getCapacityInfoByCar6.currentCapacity;
|
|
1889
|
+
var hasOriginTimeSlot = Boolean(item._origin.start_time) && Boolean(item._origin.end_time) && !(timeSlots !== null && timeSlots !== void 0 && timeSlots.start_time);
|
|
1889
1890
|
// 如果商品已经有时间数据了,意味着是通过先选日期再选商品流程进来的,相当于时间切片已经选中了
|
|
1890
|
-
if (
|
|
1891
|
+
if (hasOriginTimeSlot) {
|
|
1891
1892
|
recordTimeSlots = {
|
|
1892
1893
|
start_time: item._origin.start_time,
|
|
1893
1894
|
end_time: item._origin.end_time,
|
|
@@ -1903,10 +1904,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1903
1904
|
return n.code === resources_code;
|
|
1904
1905
|
});
|
|
1905
1906
|
// 只有 duration 类商品且不含有灵活时间的商品需要这个操作
|
|
1906
|
-
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) {
|
|
1907
|
-
var _item$_productOrigin4
|
|
1908
|
-
var
|
|
1909
|
-
var
|
|
1907
|
+
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) {
|
|
1908
|
+
var _item$_productOrigin4;
|
|
1909
|
+
var recordEndAt = recordTimeSlots.end_at ? dayjs(recordTimeSlots.end_at) : dayjs("".concat(item.start_date, " ").concat(recordTimeSlots.end_time));
|
|
1910
|
+
var start_at = recordEndAt;
|
|
1911
|
+
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');
|
|
1910
1912
|
recordTimeSlots = {
|
|
1911
1913
|
start_time: start_at.format('HH:mm'),
|
|
1912
1914
|
end_time: end_at.format('HH:mm'),
|
|
@@ -1950,13 +1952,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1950
1952
|
errorList.push(item._id);
|
|
1951
1953
|
}
|
|
1952
1954
|
} else {
|
|
1953
|
-
var _item$
|
|
1955
|
+
var _item$_productOrigin5, _productResources$fin;
|
|
1954
1956
|
// 这里必须每次循环重新读,避免前一次循环操作了购物车,导致数据变更
|
|
1955
1957
|
// 能进到这种逻辑,说明是 duration 类商品或者灵活时长商品,且是第一种资源,还没有确定时间
|
|
1956
1958
|
var allCartItems = cloneDeep(_this11.store.cart.getItems());
|
|
1957
1959
|
// 如果没有传递 timeSlots,代表是第一种资源,则直接拿商品的 duration,到资源列表里找一个公共可用的
|
|
1958
1960
|
var selectedResources = [];
|
|
1959
|
-
var _resources = cloneDeep(((_item$
|
|
1961
|
+
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) || []);
|
|
1960
1962
|
var currentResourcesRenderList = [];
|
|
1961
1963
|
_resources.forEach(function (n) {
|
|
1962
1964
|
var _n$renderList;
|
|
@@ -2072,8 +2074,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2072
2074
|
var maxCutOffTime = undefined;
|
|
2073
2075
|
var maxCutOffTimeValue = dayjs();
|
|
2074
2076
|
cartItems.forEach(function (item) {
|
|
2075
|
-
var _item$
|
|
2076
|
-
(_item$
|
|
2077
|
+
var _item$_productOrigin6, _item$_productOrigin7, _item$_productOrigin8, _item$_productOrigin9;
|
|
2078
|
+
(_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) {
|
|
2077
2079
|
// TODO: 少了个 status 的判断
|
|
2078
2080
|
if (n.code === resources_code) {
|
|
2079
2081
|
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
@@ -2086,10 +2088,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2086
2088
|
if (item.resource_id && !resourceIds.includes(item.resource_id)) {
|
|
2087
2089
|
resourceIds.push(item.resource_id);
|
|
2088
2090
|
}
|
|
2089
|
-
resourcesTypeId = item === null || item === void 0 || (_item$
|
|
2091
|
+
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) {
|
|
2090
2092
|
return n.code === resources_code;
|
|
2091
|
-
})) === null || _item$
|
|
2092
|
-
if ((_item$
|
|
2093
|
+
})) === null || _item$_productOrigin7 === void 0 ? void 0 : _item$_productOrigin7.id;
|
|
2094
|
+
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') {
|
|
2093
2095
|
var currentCutOffTime = dayjs().add(item._productOrigin.cut_off_time.unit, item._productOrigin.cut_off_time.unit_type);
|
|
2094
2096
|
if (currentCutOffTime.isAfter(maxCutOffTimeValue, 'minute')) {
|
|
2095
2097
|
maxCutOffTimeValue = currentCutOffTime;
|
|
@@ -2139,13 +2141,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2139
2141
|
cartItems.forEach(function (item) {
|
|
2140
2142
|
// 单个预约累加账号 多个预约取最大值
|
|
2141
2143
|
if (isSingleResource) {
|
|
2142
|
-
var _item$
|
|
2143
|
-
accountDuration += ((_item$
|
|
2144
|
+
var _item$_productOrigin10;
|
|
2145
|
+
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;
|
|
2144
2146
|
} else {
|
|
2145
|
-
var _item$
|
|
2146
|
-
if (accountDuration < (((_item$
|
|
2147
|
-
var _item$
|
|
2148
|
-
accountDuration = ((_item$
|
|
2147
|
+
var _item$_productOrigin11;
|
|
2148
|
+
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)) {
|
|
2149
|
+
var _item$_productOrigin12;
|
|
2150
|
+
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;
|
|
2149
2151
|
}
|
|
2150
2152
|
}
|
|
2151
2153
|
});
|
|
@@ -2182,8 +2184,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2182
2184
|
}
|
|
2183
2185
|
var resourcesUseableMap = {};
|
|
2184
2186
|
var hasFlexibleDuration = cartItems.some(function (item) {
|
|
2185
|
-
var _item$
|
|
2186
|
-
return ((_item$
|
|
2187
|
+
var _item$_productOrigin13;
|
|
2188
|
+
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';
|
|
2187
2189
|
});
|
|
2188
2190
|
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;
|
|
2189
2191
|
|
|
@@ -2191,11 +2193,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2191
2193
|
var maxBlockThreshold = 0;
|
|
2192
2194
|
if (hasFlexibleDuration) {
|
|
2193
2195
|
maxBlockThreshold = cartItems.reduce(function (max, item) {
|
|
2194
|
-
var _item$
|
|
2196
|
+
var _item$_productOrigin14;
|
|
2195
2197
|
// 如果开启了灵活时长商品配置,则取 block_threshold 的值
|
|
2196
|
-
if ((_item$
|
|
2197
|
-
var _item$
|
|
2198
|
-
return Math.max(max, ((_item$
|
|
2198
|
+
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) {
|
|
2199
|
+
var _item$_productOrigin15;
|
|
2200
|
+
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);
|
|
2199
2201
|
}
|
|
2200
2202
|
return 0;
|
|
2201
2203
|
}, 0);
|
|
@@ -2287,8 +2289,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2287
2289
|
maxCutOffTime = undefined;
|
|
2288
2290
|
maxCutOffTimeValue = dayjs();
|
|
2289
2291
|
cartItems.forEach(function (item) {
|
|
2290
|
-
var _item$
|
|
2291
|
-
(_item$
|
|
2292
|
+
var _item$_productOrigin16, _item$_productOrigin17, _item$_productOrigin18, _item$_productOrigin19;
|
|
2293
|
+
(_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) {
|
|
2292
2294
|
// TODO: 少了个 status 的判断
|
|
2293
2295
|
if (n.code === resources_code) {
|
|
2294
2296
|
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
@@ -2301,10 +2303,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2301
2303
|
if (item.resource_id && !resourceIds.includes(item.resource_id)) {
|
|
2302
2304
|
resourceIds.push(item.resource_id);
|
|
2303
2305
|
}
|
|
2304
|
-
resourcesTypeId = item === null || item === void 0 || (_item$
|
|
2306
|
+
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) {
|
|
2305
2307
|
return n.code === resources_code;
|
|
2306
|
-
})) === null || _item$
|
|
2307
|
-
if ((_item$
|
|
2308
|
+
})) === null || _item$_productOrigin17 === void 0 ? void 0 : _item$_productOrigin17.id;
|
|
2309
|
+
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') {
|
|
2308
2310
|
var currentCutOffTime = dayjs().add(item._productOrigin.cut_off_time.unit, item._productOrigin.cut_off_time.unit_type);
|
|
2309
2311
|
if (currentCutOffTime.isAfter(maxCutOffTimeValue, 'minute')) {
|
|
2310
2312
|
maxCutOffTimeValue = currentCutOffTime;
|
|
@@ -2327,13 +2329,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2327
2329
|
cartItems.forEach(function (item) {
|
|
2328
2330
|
// 单个预约累加账号 多个预约取最大值
|
|
2329
2331
|
if (isSingleResource) {
|
|
2330
|
-
var _item$
|
|
2331
|
-
accountDuration += ((_item$
|
|
2332
|
+
var _item$_productOrigin20;
|
|
2333
|
+
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;
|
|
2332
2334
|
} else {
|
|
2333
|
-
var _item$
|
|
2334
|
-
if (accountDuration < (((_item$
|
|
2335
|
-
var _item$
|
|
2336
|
-
accountDuration = ((_item$
|
|
2335
|
+
var _item$_productOrigin21;
|
|
2336
|
+
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)) {
|
|
2337
|
+
var _item$_productOrigin22;
|
|
2338
|
+
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;
|
|
2337
2339
|
}
|
|
2338
2340
|
}
|
|
2339
2341
|
});
|
|
@@ -2359,18 +2361,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2359
2361
|
case 20:
|
|
2360
2362
|
resourcesUseableMap = {};
|
|
2361
2363
|
hasFlexibleDuration = cartItems.some(function (item) {
|
|
2362
|
-
var _item$
|
|
2363
|
-
return ((_item$
|
|
2364
|
+
var _item$_productOrigin23;
|
|
2365
|
+
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';
|
|
2364
2366
|
});
|
|
2365
2367
|
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 的值
|
|
2366
2368
|
maxBlockThreshold = 0;
|
|
2367
2369
|
if (hasFlexibleDuration) {
|
|
2368
2370
|
maxBlockThreshold = cartItems.reduce(function (max, item) {
|
|
2369
|
-
var _item$
|
|
2371
|
+
var _item$_productOrigin24;
|
|
2370
2372
|
// 如果开启了灵活时长商品配置,则取 block_threshold 的值
|
|
2371
|
-
if ((_item$
|
|
2372
|
-
var _item$
|
|
2373
|
-
return Math.max(max, ((_item$
|
|
2373
|
+
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) {
|
|
2374
|
+
var _item$_productOrigin25;
|
|
2375
|
+
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);
|
|
2374
2376
|
}
|
|
2375
2377
|
return 0;
|
|
2376
2378
|
}, 0);
|
|
@@ -2531,10 +2533,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2531
2533
|
var osWarnTips = [];
|
|
2532
2534
|
var newResources = cloneDeep(item._origin.resources);
|
|
2533
2535
|
newResources.forEach(function (resource) {
|
|
2534
|
-
var _item$
|
|
2536
|
+
var _item$_productOrigin26;
|
|
2535
2537
|
// 如果商品配置的是灵活时长,开始时间设置为提交的时间,结束时间从资源的可用最晚时间和店铺营业结束时间里取一个最早的
|
|
2536
|
-
if (((_item$
|
|
2537
|
-
var _allResources$find, _item$
|
|
2538
|
+
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') {
|
|
2539
|
+
var _allResources$find, _item$_productOrigin27, _item$_productOrigin28;
|
|
2538
2540
|
item.duration = {
|
|
2539
2541
|
type: 'minutes',
|
|
2540
2542
|
value: 10
|
|
@@ -2617,15 +2619,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2617
2619
|
resource.endTime = formattedEndTime.format('YYYY-MM-DD HH:mm');
|
|
2618
2620
|
// 如果是动态时长商品,并且当前选择的时间的结束时间小于了最低提示时长(warningThreshold),则追加一个提示
|
|
2619
2621
|
// 如果currentStartTime + warningThreshold 大于 currentEndTime,且 osWarnTips 没有pisell2.product.card.closing-soon.warning 这一项,则加入这一项
|
|
2620
|
-
if ((_item$
|
|
2622
|
+
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))) {
|
|
2621
2623
|
if (!osWarnTips.includes('pisell2.product.card.closing-soon.warning')) {
|
|
2622
2624
|
osWarnTips.push('pisell2.product.card.closing-soon.warning');
|
|
2623
2625
|
}
|
|
2624
2626
|
}
|
|
2625
2627
|
} else {
|
|
2626
|
-
var _item$
|
|
2628
|
+
var _item$_productOrigin29;
|
|
2627
2629
|
resource.startTime = currentStartTime;
|
|
2628
|
-
resource.endTime = dayjs(currentStartTime).add(((_item$
|
|
2630
|
+
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');
|
|
2629
2631
|
}
|
|
2630
2632
|
// delete resource.times;
|
|
2631
2633
|
});
|
|
@@ -89,7 +89,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
89
89
|
if (productList.every((item) => {
|
|
90
90
|
var _a;
|
|
91
91
|
const product = this.hooks.getProduct(item);
|
|
92
|
-
return product.booking_id && (((_a = product.discount_list) == null ? void 0 : _a.length) ||
|
|
92
|
+
return product.booking_id && (((_a = product.discount_list) == null ? void 0 : _a.length) || product.total == 0);
|
|
93
93
|
})) {
|
|
94
94
|
return {
|
|
95
95
|
isAvailable: false,
|
|
@@ -1152,7 +1152,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
const totalCapacity = (countMap[n.id] || []).reduce(
|
|
1154
1154
|
(sum, item) => {
|
|
1155
|
-
const hasOverlap =
|
|
1155
|
+
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));
|
|
1156
1156
|
return hasOverlap ? sum + item.pax : sum;
|
|
1157
1157
|
},
|
|
1158
1158
|
0
|
|
@@ -1234,9 +1234,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1234
1234
|
}
|
|
1235
1235
|
);
|
|
1236
1236
|
cartItems2.forEach((item, index) => {
|
|
1237
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j
|
|
1237
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1238
1238
|
const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
|
|
1239
|
-
|
|
1239
|
+
const hasOriginTimeSlot = Boolean(item._origin.start_time) && Boolean(item._origin.end_time) && !(timeSlots == null ? void 0 : timeSlots.start_time);
|
|
1240
|
+
if (hasOriginTimeSlot) {
|
|
1240
1241
|
recordTimeSlots = {
|
|
1241
1242
|
start_time: item._origin.start_time,
|
|
1242
1243
|
end_time: item._origin.end_time,
|
|
@@ -1248,13 +1249,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1248
1249
|
const currentResourceConfig = (_c = (_b = (_a2 = item._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b.resources) == null ? void 0 : _c.find(
|
|
1249
1250
|
(n) => n.code === resources_code
|
|
1250
1251
|
);
|
|
1251
|
-
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_d = item._productOrigin) == null ? void 0 : _d.duration) && !hasFlexibleProduct) {
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
"minutes"
|
|
1255
|
-
);
|
|
1252
|
+
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_d = item._productOrigin) == null ? void 0 : _d.duration) && !hasFlexibleProduct && !hasOriginTimeSlot) {
|
|
1253
|
+
const recordEndAt = recordTimeSlots.end_at ? (0, import_dayjs.default)(recordTimeSlots.end_at) : (0, import_dayjs.default)(`${item.start_date} ${recordTimeSlots.end_time}`);
|
|
1254
|
+
let start_at = recordEndAt;
|
|
1256
1255
|
let end_at = start_at.add(
|
|
1257
|
-
((
|
|
1256
|
+
((_f = (_e = item._productOrigin) == null ? void 0 : _e.duration) == null ? void 0 : _f.value) || 10,
|
|
1258
1257
|
"minutes"
|
|
1259
1258
|
);
|
|
1260
1259
|
recordTimeSlots = {
|
|
@@ -1308,7 +1307,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1308
1307
|
const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
1309
1308
|
let selectedResources = [];
|
|
1310
1309
|
const resources2 = (0, import_lodash_es.cloneDeep)(
|
|
1311
|
-
((
|
|
1310
|
+
((_h = (_g = item._productOrigin) == null ? void 0 : _g.product_resource) == null ? void 0 : _h.resources) || []
|
|
1312
1311
|
);
|
|
1313
1312
|
const currentResourcesRenderList = [];
|
|
1314
1313
|
resources2.forEach((n) => {
|
|
@@ -1356,11 +1355,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1356
1355
|
return recordCount >= currentCapacity;
|
|
1357
1356
|
});
|
|
1358
1357
|
});
|
|
1359
|
-
const targetRenderList = (
|
|
1358
|
+
const targetRenderList = (_i = productResources.find(
|
|
1360
1359
|
(n) => n.code === resources_code
|
|
1361
|
-
)) == null ? void 0 :
|
|
1360
|
+
)) == null ? void 0 : _i.renderList;
|
|
1362
1361
|
if (targetRenderList && targetRenderList.length > 0) {
|
|
1363
|
-
if ((
|
|
1362
|
+
if ((_j = item._origin.resources) == null ? void 0 : _j.some(
|
|
1364
1363
|
(n) => n.form_id === targetRenderList[0].form_id
|
|
1365
1364
|
)) {
|
|
1366
1365
|
return;
|