@pisell/pisellos 3.0.14 → 3.0.15
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.
|
@@ -1196,7 +1196,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1196
1196
|
capacity: formatCapacity
|
|
1197
1197
|
});
|
|
1198
1198
|
var productResources = getResourcesByProduct(resourcesMap, ((_cartItem$_productOri2 = cartItem._productOrigin) === null || _cartItem$_productOri2 === void 0 || (_cartItem$_productOri2 = _cartItem$_productOri2.product_resource) === null || _cartItem$_productOri2 === void 0 ? void 0 : _cartItem$_productOri2.resources) || [], selectedResources, currentCapacity);
|
|
1199
|
-
debugger;
|
|
1200
1199
|
// 如果购物车里已经有了时间片,则需要按照时间片过滤
|
|
1201
1200
|
if (cartItem._origin.start_time) {
|
|
1202
1201
|
var startTime = dayjs("".concat(cartItem._origin.start_date, " ").concat(cartItem._origin.start_time));
|
|
@@ -1253,10 +1252,19 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1253
1252
|
} else {
|
|
1254
1253
|
productResources.forEach(function (item) {
|
|
1255
1254
|
// 如果资源的 capacity 已经小于了当前需要的 capacity ,则需要把资源给过滤掉
|
|
1255
|
+
// 同时,在这一步尝试去拉一下时间片,基于商品的时长,看每个资源是否还有空余时间能对这个商品做服务,如果没有则过滤
|
|
1256
1256
|
item.renderList = item.renderList.filter(function (n) {
|
|
1257
|
+
var _cartItem$_productOri3;
|
|
1257
1258
|
var recordCount = n.capacity || 0;
|
|
1258
1259
|
if (n.onlyComputed) return false;
|
|
1259
|
-
|
|
1260
|
+
// 查一下这个资源基于商品的可用时间片
|
|
1261
|
+
var timeSlots = getTimeSlicesByResource({
|
|
1262
|
+
resource: n,
|
|
1263
|
+
duration: ((_cartItem$_productOri3 = cartItem._productOrigin) === null || _cartItem$_productOri3 === void 0 || (_cartItem$_productOri3 = _cartItem$_productOri3.duration) === null || _cartItem$_productOri3 === void 0 ? void 0 : _cartItem$_productOri3.value) || 0,
|
|
1264
|
+
split: 10,
|
|
1265
|
+
currentDate: dateRange[0].date
|
|
1266
|
+
});
|
|
1267
|
+
return recordCount >= currentCapacity && timeSlots.length > 0;
|
|
1260
1268
|
});
|
|
1261
1269
|
});
|
|
1262
1270
|
}
|
|
@@ -1352,7 +1360,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1352
1360
|
}, {
|
|
1353
1361
|
key: "autoSelectAccountResources",
|
|
1354
1362
|
value: function autoSelectAccountResources(_ref8) {
|
|
1355
|
-
var _cartItem$
|
|
1363
|
+
var _cartItem$_productOri4, _allProductResources$;
|
|
1356
1364
|
var cartItem = _ref8.cartItem,
|
|
1357
1365
|
holder_id = _ref8.holder_id,
|
|
1358
1366
|
resources_code = _ref8.resources_code,
|
|
@@ -1401,7 +1409,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1401
1409
|
var resourcesMap = getResourcesMap(cloneDeep(AllResources));
|
|
1402
1410
|
var allCartItems = cloneDeep(this.store.cart.getItems());
|
|
1403
1411
|
var selectedResources = getOthersSelectedResources(allCartItems, holder_id, resourcesMap);
|
|
1404
|
-
var allProductResources = getResourcesByProduct(resourcesMap, ((_cartItem$
|
|
1412
|
+
var allProductResources = getResourcesByProduct(resourcesMap, ((_cartItem$_productOri4 = cartItem._productOrigin) === null || _cartItem$_productOri4 === void 0 || (_cartItem$_productOri4 = _cartItem$_productOri4.product_resource) === null || _cartItem$_productOri4 === void 0 ? void 0 : _cartItem$_productOri4.resources) || [], selectedResources, 1);
|
|
1405
1413
|
var resources = ((_allProductResources$ = allProductResources.find(function (n) {
|
|
1406
1414
|
return n.code === resources_code;
|
|
1407
1415
|
})) === null || _allProductResources$ === void 0 ? void 0 : _allProductResources$.renderList) || [];
|
|
@@ -1607,8 +1615,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1607
1615
|
if ((_n$renderList = n.renderList) !== null && _n$renderList !== void 0 && _n$renderList.length) {
|
|
1608
1616
|
// 过滤掉 capacity 小于 currentCapacity 的资源
|
|
1609
1617
|
n.renderList = n.renderList.filter(function (m) {
|
|
1618
|
+
var _item$duration;
|
|
1610
1619
|
var recordCount = m.capacity || 0;
|
|
1611
|
-
|
|
1620
|
+
var timeSlots = getTimeSlicesByResource({
|
|
1621
|
+
resource: m,
|
|
1622
|
+
duration: (item === null || item === void 0 || (_item$duration = item.duration) === null || _item$duration === void 0 ? void 0 : _item$duration.value) || 0,
|
|
1623
|
+
split: 10,
|
|
1624
|
+
currentDate: dateRange[0].date
|
|
1625
|
+
});
|
|
1626
|
+
return recordCount >= currentCapacity && timeSlots.length > 0;
|
|
1612
1627
|
});
|
|
1613
1628
|
currentResourcesRenderList.push.apply(currentResourcesRenderList, _toConsumableArray(n.renderList || []));
|
|
1614
1629
|
}
|
|
@@ -1917,9 +1932,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1917
1932
|
if (!aIsCombined && bIsCombined) return -1;
|
|
1918
1933
|
return 0;
|
|
1919
1934
|
});
|
|
1920
|
-
|
|
1935
|
+
|
|
1921
1936
|
// 计算每个日程切片下日程可用的资源的容量总和
|
|
1922
1937
|
var formatScheduleTimeSlots = scheduleTimeSlots.map(function (item) {
|
|
1938
|
+
// 用来计算资源的可使用情况,针对单个schedule 时间片
|
|
1939
|
+
var resourcesUseableMap = {};
|
|
1923
1940
|
var count = 0;
|
|
1924
1941
|
// 遍历所有资源
|
|
1925
1942
|
allProductResources === null || allProductResources === void 0 || allProductResources.forEach(function (m) {
|
|
@@ -1962,7 +1979,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1962
1979
|
// 在已经选定时间的情况下,只要canUseTime如果有一个 false 那就不可用
|
|
1963
1980
|
if (!currentResourcesTimeSlotCanUsedArr.some(function (n) {
|
|
1964
1981
|
return n === false;
|
|
1965
|
-
})) {
|
|
1982
|
+
}) && currentResourcesCount >= count) {
|
|
1966
1983
|
count = currentResourcesCount;
|
|
1967
1984
|
}
|
|
1968
1985
|
});
|
|
@@ -638,7 +638,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
638
638
|
selectedResources,
|
|
639
639
|
currentCapacity
|
|
640
640
|
);
|
|
641
|
-
debugger;
|
|
642
641
|
if (cartItem._origin.start_time) {
|
|
643
642
|
const startTime = (0, import_dayjs.default)(
|
|
644
643
|
`${cartItem._origin.start_date} ${cartItem._origin.start_time}`
|
|
@@ -692,10 +691,17 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
692
691
|
} else {
|
|
693
692
|
productResources.forEach((item) => {
|
|
694
693
|
item.renderList = item.renderList.filter((n) => {
|
|
694
|
+
var _a2, _b2;
|
|
695
695
|
const recordCount = n.capacity || 0;
|
|
696
696
|
if (n.onlyComputed)
|
|
697
697
|
return false;
|
|
698
|
-
|
|
698
|
+
const timeSlots = (0, import_resources.getTimeSlicesByResource)({
|
|
699
|
+
resource: n,
|
|
700
|
+
duration: ((_b2 = (_a2 = cartItem._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) || 0,
|
|
701
|
+
split: 10,
|
|
702
|
+
currentDate: dateRange[0].date
|
|
703
|
+
});
|
|
704
|
+
return recordCount >= currentCapacity && timeSlots.length > 0;
|
|
699
705
|
});
|
|
700
706
|
});
|
|
701
707
|
}
|
|
@@ -994,8 +1000,15 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
994
1000
|
var _a3;
|
|
995
1001
|
if ((_a3 = n.renderList) == null ? void 0 : _a3.length) {
|
|
996
1002
|
n.renderList = n.renderList.filter((m) => {
|
|
1003
|
+
var _a4;
|
|
997
1004
|
const recordCount = m.capacity || 0;
|
|
998
|
-
|
|
1005
|
+
const timeSlots2 = (0, import_resources.getTimeSlicesByResource)({
|
|
1006
|
+
resource: m,
|
|
1007
|
+
duration: ((_a4 = item == null ? void 0 : item.duration) == null ? void 0 : _a4.value) || 0,
|
|
1008
|
+
split: 10,
|
|
1009
|
+
currentDate: dateRange[0].date
|
|
1010
|
+
});
|
|
1011
|
+
return recordCount >= currentCapacity && timeSlots2.length > 0;
|
|
999
1012
|
});
|
|
1000
1013
|
currentResourcesRenderList.push(...n.renderList || []);
|
|
1001
1014
|
}
|
|
@@ -1273,8 +1286,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1273
1286
|
return -1;
|
|
1274
1287
|
return 0;
|
|
1275
1288
|
});
|
|
1276
|
-
const resourcesUseableMap = {};
|
|
1277
1289
|
const formatScheduleTimeSlots = scheduleTimeSlots.map((item) => {
|
|
1290
|
+
const resourcesUseableMap = {};
|
|
1278
1291
|
let count = 0;
|
|
1279
1292
|
allProductResources == null ? void 0 : allProductResources.forEach((m) => {
|
|
1280
1293
|
let currentResourcesCount = 0;
|
|
@@ -1307,7 +1320,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1307
1320
|
}
|
|
1308
1321
|
currentResourcesTimeSlotCanUsedArr.push(res.usable);
|
|
1309
1322
|
});
|
|
1310
|
-
if (!currentResourcesTimeSlotCanUsedArr.some((n) => n === false)) {
|
|
1323
|
+
if (!currentResourcesTimeSlotCanUsedArr.some((n) => n === false) && currentResourcesCount >= count) {
|
|
1311
1324
|
count = currentResourcesCount;
|
|
1312
1325
|
}
|
|
1313
1326
|
});
|