@pisell/pisellos 3.0.8 → 3.0.9
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.
|
@@ -1581,7 +1581,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1581
1581
|
}, {
|
|
1582
1582
|
key: "getTimeSlotByAllResources",
|
|
1583
1583
|
value: function getTimeSlotByAllResources(resources_code) {
|
|
1584
|
-
var
|
|
1584
|
+
var _dateRange,
|
|
1585
|
+
_this9 = this,
|
|
1585
1586
|
_cartItems$,
|
|
1586
1587
|
_cartItems$2;
|
|
1587
1588
|
var dateRange = this.store.date.getDateRange();
|
|
@@ -1590,8 +1591,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1590
1591
|
var cartItems = cloneDeep(this.store.cart.getItems());
|
|
1591
1592
|
// if (cartItems?.[0].start_date) return [];
|
|
1592
1593
|
var resourceIds = [];
|
|
1594
|
+
var resourcesTypeId = undefined;
|
|
1593
1595
|
cartItems.forEach(function (item) {
|
|
1594
|
-
var _item$_productOrigin9;
|
|
1596
|
+
var _item$_productOrigin9, _item$_productOrigin10;
|
|
1595
1597
|
(_item$_productOrigin9 = item._productOrigin) === null || _item$_productOrigin9 === void 0 || (_item$_productOrigin9 = _item$_productOrigin9.product_resource) === null || _item$_productOrigin9 === void 0 || (_item$_productOrigin9 = _item$_productOrigin9.resources) === null || _item$_productOrigin9 === void 0 || _item$_productOrigin9.forEach(function (n) {
|
|
1596
1598
|
if (n.code === resources_code) {
|
|
1597
1599
|
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
@@ -1603,7 +1605,19 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1603
1605
|
if (item.resource_id) {
|
|
1604
1606
|
resourceIds.push(item.resource_id);
|
|
1605
1607
|
}
|
|
1608
|
+
resourcesTypeId = item === null || item === void 0 || (_item$_productOrigin10 = item._productOrigin) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.product_resource) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.resources) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.find(function (n) {
|
|
1609
|
+
return n.code === resources_code;
|
|
1610
|
+
})) === null || _item$_productOrigin10 === void 0 ? void 0 : _item$_productOrigin10.id;
|
|
1606
1611
|
});
|
|
1612
|
+
// 保险起见,在这里如果 dateRange 里也有 resources 的话,也 push 进去
|
|
1613
|
+
if ((_dateRange = dateRange) !== null && _dateRange !== void 0 && (_dateRange = _dateRange[0]) !== null && _dateRange !== void 0 && (_dateRange = _dateRange.resource) !== null && _dateRange !== void 0 && _dateRange.length) {
|
|
1614
|
+
// resources.push(...dateRange[0].resource);
|
|
1615
|
+
dateRange[0].resource.forEach(function (n) {
|
|
1616
|
+
if (n.form_id === resourcesTypeId) {
|
|
1617
|
+
resources.push(n);
|
|
1618
|
+
}
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1607
1621
|
var resourcesMap = getResourcesMap(resources);
|
|
1608
1622
|
var duration = 0;
|
|
1609
1623
|
// duration = 不同账号的最长时间
|
|
@@ -1611,8 +1625,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1611
1625
|
var checkDuration = function checkDuration(cartItems) {
|
|
1612
1626
|
var accountDuration = 0;
|
|
1613
1627
|
cartItems.forEach(function (item) {
|
|
1614
|
-
var _item$_productOrigin$3, _item$
|
|
1615
|
-
accountDuration += (_item$_productOrigin$3 = (_item$
|
|
1628
|
+
var _item$_productOrigin$3, _item$_productOrigin11;
|
|
1629
|
+
accountDuration += (_item$_productOrigin$3 = (_item$_productOrigin11 = item._productOrigin) === null || _item$_productOrigin11 === void 0 || (_item$_productOrigin11 = _item$_productOrigin11.duration) === null || _item$_productOrigin11 === void 0 ? void 0 : _item$_productOrigin11.value) !== null && _item$_productOrigin$3 !== void 0 ? _item$_productOrigin$3 : 0;
|
|
1616
1630
|
});
|
|
1617
1631
|
if (accountDuration > duration) {
|
|
1618
1632
|
duration = accountDuration;
|
|
@@ -1681,9 +1695,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1681
1695
|
accountItems.forEach(function (item, index) {
|
|
1682
1696
|
var newResources = cloneDeep(item._origin.resources);
|
|
1683
1697
|
newResources.forEach(function (resource) {
|
|
1684
|
-
var _item$_productOrigin$4, _item$
|
|
1698
|
+
var _item$_productOrigin$4, _item$_productOrigin12, _ref11, _item$_productOrigin13;
|
|
1685
1699
|
resource.startTime = currentStartTime;
|
|
1686
|
-
resource.endTime = dayjs(currentStartTime).add((_item$_productOrigin$4 = (_item$
|
|
1700
|
+
resource.endTime = dayjs(currentStartTime).add((_item$_productOrigin$4 = (_item$_productOrigin12 = item._productOrigin) === null || _item$_productOrigin12 === void 0 || (_item$_productOrigin12 = _item$_productOrigin12.duration) === null || _item$_productOrigin12 === void 0 ? void 0 : _item$_productOrigin12.value) !== null && _item$_productOrigin$4 !== void 0 ? _item$_productOrigin$4 : 0, (_ref11 = (_item$_productOrigin13 = item._productOrigin) === null || _item$_productOrigin13 === void 0 || (_item$_productOrigin13 = _item$_productOrigin13.duration) === null || _item$_productOrigin13 === void 0 ? void 0 : _item$_productOrigin13.type) !== null && _ref11 !== void 0 ? _ref11 : 'minutes').format('YYYY-MM-DD HH:mm');
|
|
1687
1701
|
delete resource.times;
|
|
1688
1702
|
});
|
|
1689
1703
|
_this10.store.cart.updateItem({
|
|
@@ -992,13 +992,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
992
992
|
}
|
|
993
993
|
// 从购物车中获取已经分配好第一步资源的所有时间片
|
|
994
994
|
getTimeSlotByAllResources(resources_code) {
|
|
995
|
-
var _a, _b, _c, _d;
|
|
995
|
+
var _a, _b, _c, _d, _e, _f;
|
|
996
996
|
let dateRange = this.store.date.getDateRange();
|
|
997
997
|
const resources = [];
|
|
998
998
|
const cartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
999
999
|
const resourceIds = [];
|
|
1000
|
+
let resourcesTypeId = void 0;
|
|
1000
1001
|
cartItems.forEach((item) => {
|
|
1001
|
-
var _a2, _b2, _c2;
|
|
1002
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g;
|
|
1002
1003
|
(_c2 = (_b2 = (_a2 = item._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b2.resources) == null ? void 0 : _c2.forEach((n) => {
|
|
1003
1004
|
if (n.code === resources_code) {
|
|
1004
1005
|
resources.push(...n.renderList || []);
|
|
@@ -1007,7 +1008,15 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1007
1008
|
if (item.resource_id) {
|
|
1008
1009
|
resourceIds.push(item.resource_id);
|
|
1009
1010
|
}
|
|
1011
|
+
resourcesTypeId = (_g = (_f2 = (_e2 = (_d2 = item == null ? void 0 : item._productOrigin) == null ? void 0 : _d2.product_resource) == null ? void 0 : _e2.resources) == null ? void 0 : _f2.find((n) => n.code === resources_code)) == null ? void 0 : _g.id;
|
|
1010
1012
|
});
|
|
1013
|
+
if ((_b = (_a = dateRange == null ? void 0 : dateRange[0]) == null ? void 0 : _a.resource) == null ? void 0 : _b.length) {
|
|
1014
|
+
dateRange[0].resource.forEach((n) => {
|
|
1015
|
+
if (n.form_id === resourcesTypeId) {
|
|
1016
|
+
resources.push(n);
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1011
1020
|
const resourcesMap = (0, import_utils.getResourcesMap)(resources);
|
|
1012
1021
|
let duration = 0;
|
|
1013
1022
|
const accountList = this.store.accountList.getAccounts();
|
|
@@ -1029,7 +1038,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1029
1038
|
} else {
|
|
1030
1039
|
checkDuration(cartItems);
|
|
1031
1040
|
}
|
|
1032
|
-
if (!((
|
|
1041
|
+
if (!((_c = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _c.start_date) && !((_d = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _d.resource_id) || !(cartItems == null ? void 0 : cartItems[0].duration)) {
|
|
1033
1042
|
return [];
|
|
1034
1043
|
}
|
|
1035
1044
|
if ((cartItems == null ? void 0 : cartItems[0].start_date) && !dateRange) {
|
|
@@ -1041,7 +1050,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1041
1050
|
weekNum: 0
|
|
1042
1051
|
},
|
|
1043
1052
|
{
|
|
1044
|
-
date: ((
|
|
1053
|
+
date: ((_e = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _e.end_date) || ((_f = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _f.start_date) || "",
|
|
1045
1054
|
status: "available",
|
|
1046
1055
|
week: "",
|
|
1047
1056
|
weekNum: 0
|