@pisell/pisellos 2.0.28 → 2.0.30
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.
|
@@ -143,7 +143,7 @@ var getDaysByRepeatWeek = function getDaysByRepeatWeek(params, isGetRange) {
|
|
|
143
143
|
var _end = _start.add(scheduleDiff, 'second');
|
|
144
144
|
if (isGetRange) {
|
|
145
145
|
if (excludedDaysMap.has(_start.format('YYYY-MM-DD'))) {
|
|
146
|
-
startTmp = startTmp.day(1).add(frequency, '
|
|
146
|
+
startTmp = startTmp.day(1).add(frequency, 'day');
|
|
147
147
|
continue;
|
|
148
148
|
}
|
|
149
149
|
var arr = getDataRange({
|
|
@@ -1266,7 +1266,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1266
1266
|
var _item$_origin$resourc;
|
|
1267
1267
|
var resources = (_item$_origin$resourc = item._origin.resources) === null || _item$_origin$resourc === void 0 ? void 0 : _item$_origin$resourc.filter(function (m) {
|
|
1268
1268
|
// 检查当前资源是否与目标资源的任何资源匹配
|
|
1269
|
-
|
|
1269
|
+
// 目标资源,应该只取跟当前 m.form_id 相同的资源
|
|
1270
|
+
var sameFormIdResources = targetCartItem._origin.resources.filter(function (n) {
|
|
1271
|
+
return n.form_id === m.form_id;
|
|
1272
|
+
});
|
|
1273
|
+
if (!(sameFormIdResources !== null && sameFormIdResources !== void 0 && sameFormIdResources.length)) {
|
|
1274
|
+
return true;
|
|
1275
|
+
}
|
|
1276
|
+
return !sameFormIdResources.some(function (targetRes) {
|
|
1270
1277
|
// 如果新更新进来的资源不是单个预约,其实就不需要检测了资源重叠了,但是需要检测资源 capacity 是否足够
|
|
1271
1278
|
if (targetRes.resourceType !== 'single') {
|
|
1272
1279
|
var _item$_productOrigin2;
|
|
@@ -1280,10 +1287,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1280
1287
|
var originResource = allOriginResources.find(function (n) {
|
|
1281
1288
|
return n.id === targetRes.id;
|
|
1282
1289
|
});
|
|
1283
|
-
if (currentResourcesCapacityMap[
|
|
1290
|
+
if (currentResourcesCapacityMap[m.id] + _currentCapacity > (originResource === null || originResource === void 0 ? void 0 : originResource.capacity)) {
|
|
1284
1291
|
return true;
|
|
1285
1292
|
}
|
|
1286
|
-
currentResourcesCapacityMap[
|
|
1293
|
+
currentResourcesCapacityMap[m.id] += _currentCapacity;
|
|
1287
1294
|
return false;
|
|
1288
1295
|
}
|
|
1289
1296
|
if (item.holder_id !== (targetCartItem === null || targetCartItem === void 0 ? void 0 : targetCartItem.holder_id)) {
|
|
@@ -2431,7 +2438,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2431
2438
|
if (currentResourcesCount >= count) {
|
|
2432
2439
|
count = currentResourcesCount;
|
|
2433
2440
|
}
|
|
2434
|
-
|
|
2441
|
+
if (!m.onlyComputed) {
|
|
2442
|
+
bookingLeft += 1;
|
|
2443
|
+
}
|
|
2435
2444
|
}
|
|
2436
2445
|
});
|
|
2437
2446
|
var startDayJs = dayjs(item.start);
|
|
@@ -2858,7 +2867,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2858
2867
|
openResources = ((_tempProducts = tempProducts) === null || _tempProducts === void 0 || (_tempProducts = _tempProducts.product_resource) === null || _tempProducts === void 0 || (_tempProducts = _tempProducts.resources) === null || _tempProducts === void 0 ? void 0 : _tempProducts.filter(function (m) {
|
|
2859
2868
|
return m.status === 1;
|
|
2860
2869
|
})) || []; // res.data 返回的一定是启用商品的资源列表,不需要再过滤了
|
|
2861
|
-
allProductResources = sortCombinedResources(res.data);
|
|
2870
|
+
allProductResources = sortCombinedResources(res.data); // allProductResources 需要根据商品里的资源的单个预约多个预约补充resourceType
|
|
2871
|
+
allProductResources.forEach(function (m) {
|
|
2872
|
+
var _tempProducts2;
|
|
2873
|
+
var resource = (_tempProducts2 = tempProducts) === null || _tempProducts2 === void 0 || (_tempProducts2 = _tempProducts2.product_resource) === null || _tempProducts2 === void 0 || (_tempProducts2 = _tempProducts2.resources) === null || _tempProducts2 === void 0 ? void 0 : _tempProducts2.find(function (n) {
|
|
2874
|
+
return n.id === m.form_id;
|
|
2875
|
+
});
|
|
2876
|
+
if (resource) {
|
|
2877
|
+
m.resourceType = resource.type;
|
|
2878
|
+
}
|
|
2879
|
+
});
|
|
2862
2880
|
targetSchedules = this.store.schedule.getScheduleListByIds(tempProducts['schedule.ids']);
|
|
2863
2881
|
_loop3 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop3() {
|
|
2864
2882
|
var currentDateStr, status, _checkSessionProductL, latestStartDate, earliestEndDate, scheduleByDate, minTimeMaxTime, scheduleTimeSlots, timesSlotCanUse;
|
|
@@ -2915,7 +2933,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2915
2933
|
return;
|
|
2916
2934
|
}
|
|
2917
2935
|
var targetCanUseTimes = mTimes.some(function (childTiem) {
|
|
2918
|
-
var
|
|
2936
|
+
var _tempProducts3;
|
|
2919
2937
|
// 挨个去匹配某个工作时间段结合当前日程时间,资源能不能用,有多少容量能用
|
|
2920
2938
|
var res = getIsUsableByTimeItem({
|
|
2921
2939
|
timeSlice: {
|
|
@@ -2928,7 +2946,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2928
2946
|
resource: m,
|
|
2929
2947
|
currentCount: 1,
|
|
2930
2948
|
resourcesUseableMap: resourcesUseableMap,
|
|
2931
|
-
cut_off_time: (
|
|
2949
|
+
cut_off_time: (_tempProducts3 = tempProducts) === null || _tempProducts3 === void 0 ? void 0 : _tempProducts3.cut_off_time
|
|
2932
2950
|
});
|
|
2933
2951
|
if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[m.id]) !== false && res.reason !== 'capacityOnly') {
|
|
2934
2952
|
resourcesUseableMap[m.id] = res.usable;
|
|
@@ -2967,22 +2985,22 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2967
2985
|
}
|
|
2968
2986
|
}, _loop3);
|
|
2969
2987
|
});
|
|
2970
|
-
case
|
|
2988
|
+
case 23:
|
|
2971
2989
|
if (!(dayjs(currentDate).isBefore(dayjs(endDate), 'day') || dayjs(currentDate).isSame(dayjs(endDate), 'day'))) {
|
|
2972
|
-
_context32.next =
|
|
2990
|
+
_context32.next = 29;
|
|
2973
2991
|
break;
|
|
2974
2992
|
}
|
|
2975
|
-
return _context32.delegateYield(_loop3(), "t0",
|
|
2976
|
-
case
|
|
2993
|
+
return _context32.delegateYield(_loop3(), "t0", 25);
|
|
2994
|
+
case 25:
|
|
2977
2995
|
if (!_context32.t0) {
|
|
2978
|
-
_context32.next =
|
|
2996
|
+
_context32.next = 27;
|
|
2979
2997
|
break;
|
|
2980
2998
|
}
|
|
2981
|
-
return _context32.abrupt("break",
|
|
2982
|
-
case
|
|
2983
|
-
_context32.next =
|
|
2999
|
+
return _context32.abrupt("break", 29);
|
|
3000
|
+
case 27:
|
|
3001
|
+
_context32.next = 23;
|
|
2984
3002
|
break;
|
|
2985
|
-
case
|
|
3003
|
+
case 29:
|
|
2986
3004
|
// 最终把资源数据也加到日期内
|
|
2987
3005
|
dates = handleAvailableDateByResource(res.data, dates);
|
|
2988
3006
|
this.store.date.setDateList(dates);
|
|
@@ -2998,7 +3016,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2998
3016
|
dateList: dates,
|
|
2999
3017
|
firstAvailableDate: firstAvailableDate
|
|
3000
3018
|
});
|
|
3001
|
-
case
|
|
3019
|
+
case 33:
|
|
3002
3020
|
case "end":
|
|
3003
3021
|
return _context32.stop();
|
|
3004
3022
|
}
|
|
@@ -143,7 +143,7 @@ var getDaysByRepeatWeek = (params, isGetRange) => {
|
|
|
143
143
|
const _end = _start.add(scheduleDiff, "second");
|
|
144
144
|
if (isGetRange) {
|
|
145
145
|
if (excludedDaysMap.has(_start.format("YYYY-MM-DD"))) {
|
|
146
|
-
startTmp = startTmp.day(1).add(frequency, "
|
|
146
|
+
startTmp = startTmp.day(1).add(frequency, "day");
|
|
147
147
|
continue;
|
|
148
148
|
}
|
|
149
149
|
const arr = getDataRange({
|
|
@@ -643,7 +643,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
643
643
|
var _a2;
|
|
644
644
|
if (item._id !== targetCartItem._id) {
|
|
645
645
|
const resources = (_a2 = item._origin.resources) == null ? void 0 : _a2.filter((m) => {
|
|
646
|
-
|
|
646
|
+
const sameFormIdResources = targetCartItem._origin.resources.filter((n) => n.form_id === m.form_id);
|
|
647
|
+
if (!(sameFormIdResources == null ? void 0 : sameFormIdResources.length)) {
|
|
648
|
+
return true;
|
|
649
|
+
}
|
|
650
|
+
return !sameFormIdResources.some((targetRes) => {
|
|
647
651
|
var _a3, _b, _c;
|
|
648
652
|
if (targetRes.resourceType !== "single") {
|
|
649
653
|
const formatCapacity = (0, import_resources.formatDefaultCapacitys)({
|
|
@@ -656,10 +660,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
656
660
|
const originResource = allOriginResources.find(
|
|
657
661
|
(n) => n.id === targetRes.id
|
|
658
662
|
);
|
|
659
|
-
if (currentResourcesCapacityMap[
|
|
663
|
+
if (currentResourcesCapacityMap[m.id] + currentCapacity > (originResource == null ? void 0 : originResource.capacity)) {
|
|
660
664
|
return true;
|
|
661
665
|
}
|
|
662
|
-
currentResourcesCapacityMap[
|
|
666
|
+
currentResourcesCapacityMap[m.id] += currentCapacity;
|
|
663
667
|
return false;
|
|
664
668
|
}
|
|
665
669
|
if (item.holder_id !== (targetCartItem == null ? void 0 : targetCartItem.holder_id)) {
|
|
@@ -1701,7 +1705,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1701
1705
|
if (currentResourcesCount >= count) {
|
|
1702
1706
|
count = currentResourcesCount;
|
|
1703
1707
|
}
|
|
1704
|
-
|
|
1708
|
+
if (!m.onlyComputed) {
|
|
1709
|
+
bookingLeft += 1;
|
|
1710
|
+
}
|
|
1705
1711
|
}
|
|
1706
1712
|
});
|
|
1707
1713
|
const startDayJs = (0, import_dayjs.default)(item.start);
|
|
@@ -2017,6 +2023,15 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2017
2023
|
(m) => m.status === 1
|
|
2018
2024
|
)) || [];
|
|
2019
2025
|
const allProductResources = (0, import_resources.sortCombinedResources)(res.data);
|
|
2026
|
+
allProductResources.forEach((m) => {
|
|
2027
|
+
var _a2, _b2;
|
|
2028
|
+
const resource = (_b2 = (_a2 = tempProducts == null ? void 0 : tempProducts.product_resource) == null ? void 0 : _a2.resources) == null ? void 0 : _b2.find(
|
|
2029
|
+
(n) => n.id === m.form_id
|
|
2030
|
+
);
|
|
2031
|
+
if (resource) {
|
|
2032
|
+
m.resourceType = resource.type;
|
|
2033
|
+
}
|
|
2034
|
+
});
|
|
2020
2035
|
const targetSchedules = this.store.schedule.getScheduleListByIds(
|
|
2021
2036
|
tempProducts["schedule.ids"]
|
|
2022
2037
|
);
|