@pisell/pisellos 0.0.54 → 0.0.55
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.
|
@@ -132,7 +132,7 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
132
132
|
case 5:
|
|
133
133
|
// 1.生成当前月份的所有日期,默认都是可用的
|
|
134
134
|
dates = generateMonthDates(start_date, end_date, type); // 如果没有资源或者结束日期在今天之前,则所有日期均不可用
|
|
135
|
-
if (!(!(resource_ids !== null && resource_ids !== void 0 && resource_ids.length) || dayjs(end_date).isBefore(dayjs()))) {
|
|
135
|
+
if (!(!(resource_ids !== null && resource_ids !== void 0 && resource_ids.length) || dayjs(end_date).isBefore(dayjs().startOf('day')))) {
|
|
136
136
|
_context3.next = 8;
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
@@ -145,8 +145,6 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
145
145
|
end_date: end_date,
|
|
146
146
|
resource_ids: resource_ids,
|
|
147
147
|
front_end_cache_id: this.cacheId
|
|
148
|
-
}, {
|
|
149
|
-
useCache: true
|
|
150
148
|
});
|
|
151
149
|
case 11:
|
|
152
150
|
res = _context3.sent;
|
|
@@ -244,6 +244,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
244
244
|
status: 'available',
|
|
245
245
|
week: '',
|
|
246
246
|
weekNum: 0
|
|
247
|
+
}, {
|
|
248
|
+
date: date,
|
|
249
|
+
status: 'available',
|
|
250
|
+
week: '',
|
|
251
|
+
weekNum: 0
|
|
247
252
|
}]);
|
|
248
253
|
scheduleIds = scheduleList.filter(function (n) {
|
|
249
254
|
return n.date === date;
|
|
@@ -656,22 +661,19 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
656
661
|
_schedule: this.store.currentProduct.getOtherParams()['schedule']
|
|
657
662
|
})];
|
|
658
663
|
}
|
|
659
|
-
|
|
660
|
-
return this.getDateRange();
|
|
661
|
-
case 8:
|
|
662
|
-
dateRange = _context13.sent;
|
|
664
|
+
dateRange = this.store.date.getDateRange();
|
|
663
665
|
tempStartDate = startDate || (dateRange === null || dateRange === void 0 ? void 0 : dateRange[0].date);
|
|
664
|
-
tempEndDate = endDate || (dateRange === null || dateRange === void 0 ? void 0 : dateRange[
|
|
666
|
+
tempEndDate = endDate || (dateRange === null || dateRange === void 0 ? void 0 : dateRange[1].date);
|
|
665
667
|
if (tempProducts.length) {
|
|
666
|
-
_context13.next =
|
|
668
|
+
_context13.next = 11;
|
|
667
669
|
break;
|
|
668
670
|
}
|
|
669
671
|
return _context13.abrupt("return", []);
|
|
670
|
-
case
|
|
672
|
+
case 11:
|
|
671
673
|
// 在这里需要把能收集到的数据都收集上来,拼装好给 date 模块去查询
|
|
672
674
|
_ref5 = getAvailableProductResources(tempProducts) || {}, resourceIds = _ref5.resourceIds, rules = _ref5.rules, resourcesMap = _ref5.resourcesMap;
|
|
673
675
|
this.otherParams.currentResourcesMap = resourcesMap;
|
|
674
|
-
_context13.next =
|
|
676
|
+
_context13.next = 15;
|
|
675
677
|
return this.store.date.getResourceDates({
|
|
676
678
|
url: params.url,
|
|
677
679
|
query: {
|
|
@@ -682,10 +684,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
682
684
|
rules: rules,
|
|
683
685
|
type: type
|
|
684
686
|
});
|
|
685
|
-
case
|
|
687
|
+
case 15:
|
|
686
688
|
res = _context13.sent;
|
|
687
689
|
return _context13.abrupt("return", res);
|
|
688
|
-
case
|
|
690
|
+
case 17:
|
|
689
691
|
case "end":
|
|
690
692
|
return _context13.stop();
|
|
691
693
|
}
|
|
@@ -1547,7 +1549,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1547
1549
|
// 取出购物车中所有一已选择的第一步资源
|
|
1548
1550
|
var resources = [];
|
|
1549
1551
|
var cartItems = this.store.cart.getItems();
|
|
1550
|
-
if (cartItems
|
|
1552
|
+
// if (cartItems?.[0].start_date) return [];
|
|
1551
1553
|
var resourceIds = [];
|
|
1552
1554
|
cartItems.forEach(function (item) {
|
|
1553
1555
|
var _item$_productOrigin8;
|
|
@@ -1566,9 +1568,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1566
1568
|
var resourcesMap = getResourcesMap(resources);
|
|
1567
1569
|
var duration = 0;
|
|
1568
1570
|
// duration = 不同账号的最长时间
|
|
1569
|
-
this.store.accountList.getAccounts()
|
|
1571
|
+
var accountList = this.store.accountList.getAccounts();
|
|
1572
|
+
var checkDuration = function checkDuration(cartItems) {
|
|
1570
1573
|
var accountDuration = 0;
|
|
1571
|
-
var cartItems = _this8.store.cart.getCartByAccount(account.getId());
|
|
1572
1574
|
cartItems.forEach(function (item) {
|
|
1573
1575
|
var _item$_productOrigin$3, _item$_productOrigin9;
|
|
1574
1576
|
accountDuration += (_item$_productOrigin$3 = (_item$_productOrigin9 = item._productOrigin) === null || _item$_productOrigin9 === void 0 || (_item$_productOrigin9 = _item$_productOrigin9.duration) === null || _item$_productOrigin9 === void 0 ? void 0 : _item$_productOrigin9.value) !== null && _item$_productOrigin$3 !== void 0 ? _item$_productOrigin$3 : 0;
|
|
@@ -1576,6 +1578,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1576
1578
|
if (accountDuration > duration) {
|
|
1577
1579
|
duration = accountDuration;
|
|
1578
1580
|
}
|
|
1581
|
+
};
|
|
1582
|
+
if (cartItems !== null && cartItems !== void 0 && cartItems[0].holder_id) {
|
|
1583
|
+
accountList.forEach(function (account) {
|
|
1584
|
+
var cartItems = _this8.store.cart.getCartByAccount(account.getId());
|
|
1585
|
+
checkDuration(cartItems);
|
|
1586
|
+
});
|
|
1587
|
+
} else {
|
|
1588
|
+
checkDuration(cartItems);
|
|
1589
|
+
}
|
|
1590
|
+
this.store.accountList.getAccounts().forEach(function (account) {
|
|
1591
|
+
var cartItems = _this8.store.cart.getCartByAccount(account.getId());
|
|
1579
1592
|
});
|
|
1580
1593
|
var timeSlots = getTimeSlicesByResources({
|
|
1581
1594
|
resourceIds: resourceIds,
|
|
@@ -1700,6 +1713,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1700
1713
|
var date = _ref13.date,
|
|
1701
1714
|
scheduleIds = _ref13.scheduleIds,
|
|
1702
1715
|
resources = _ref13.resources;
|
|
1716
|
+
debugger;
|
|
1703
1717
|
var targetProduct = this.store.currentProduct;
|
|
1704
1718
|
var targetProductData = targetProduct === null || targetProduct === void 0 ? void 0 : targetProduct.getData();
|
|
1705
1719
|
var targetSchedules = [];
|
|
@@ -1776,6 +1790,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1776
1790
|
var productData = _objectSpread(_objectSpread({}, origin), {}, {
|
|
1777
1791
|
product_variant_id: product_variant_id
|
|
1778
1792
|
});
|
|
1793
|
+
if (!account) {
|
|
1794
|
+
var activeAccount = this.getActiveAccount();
|
|
1795
|
+
if (activeAccount) {
|
|
1796
|
+
account = activeAccount;
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1779
1799
|
this.store.cart.addItem({
|
|
1780
1800
|
product: productData,
|
|
1781
1801
|
date: date,
|
|
@@ -85,7 +85,7 @@ var DateModule = class extends import_BaseModule.BaseModule {
|
|
|
85
85
|
return [];
|
|
86
86
|
}
|
|
87
87
|
let dates = (0, import_utils.generateMonthDates)(start_date, end_date, type);
|
|
88
|
-
if (!(resource_ids == null ? void 0 : resource_ids.length) || (0, import_dayjs.default)(end_date).isBefore((0, import_dayjs.default)())) {
|
|
88
|
+
if (!(resource_ids == null ? void 0 : resource_ids.length) || (0, import_dayjs.default)(end_date).isBefore((0, import_dayjs.default)().startOf("day"))) {
|
|
89
89
|
return (0, import_utils.disableAllDates)(dates);
|
|
90
90
|
}
|
|
91
91
|
try {
|
|
@@ -96,8 +96,7 @@ var DateModule = class extends import_BaseModule.BaseModule {
|
|
|
96
96
|
end_date,
|
|
97
97
|
resource_ids,
|
|
98
98
|
front_end_cache_id: this.cacheId
|
|
99
|
-
}
|
|
100
|
-
{ useCache: true }
|
|
99
|
+
}
|
|
101
100
|
);
|
|
102
101
|
if (!((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.length)) {
|
|
103
102
|
return (0, import_utils.disableAllDates)(dates);
|
|
@@ -184,7 +184,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
184
184
|
product_ids
|
|
185
185
|
}) {
|
|
186
186
|
const scheduleList = this.store.schedule.getAvailabilityScheduleDateList();
|
|
187
|
-
this.setDateRange([{ date, status: "available", week: "", weekNum: 0 }]);
|
|
187
|
+
this.setDateRange([{ date, status: "available", week: "", weekNum: 0 }, { date, status: "available", week: "", weekNum: 0 }]);
|
|
188
188
|
const scheduleIds = scheduleList.filter((n) => n.date === date).flatMap((n) => n.schedule_id);
|
|
189
189
|
return await this.loadProducts({ schedule_ids: scheduleIds, product_ids });
|
|
190
190
|
}
|
|
@@ -345,9 +345,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
345
345
|
}
|
|
346
346
|
];
|
|
347
347
|
}
|
|
348
|
-
|
|
348
|
+
let dateRange = this.store.date.getDateRange();
|
|
349
349
|
const tempStartDate = startDate || (dateRange == null ? void 0 : dateRange[0].date);
|
|
350
|
-
const tempEndDate = endDate || (dateRange == null ? void 0 : dateRange[
|
|
350
|
+
const tempEndDate = endDate || (dateRange == null ? void 0 : dateRange[1].date);
|
|
351
351
|
if (!tempProducts.length) {
|
|
352
352
|
return [];
|
|
353
353
|
}
|
|
@@ -944,8 +944,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
944
944
|
const dateRange = this.store.date.getDateRange();
|
|
945
945
|
const resources = [];
|
|
946
946
|
const cartItems = this.store.cart.getItems();
|
|
947
|
-
if (cartItems == null ? void 0 : cartItems[0].start_date)
|
|
948
|
-
return [];
|
|
949
947
|
const resourceIds = [];
|
|
950
948
|
cartItems.forEach((item) => {
|
|
951
949
|
var _a, _b, _c;
|
|
@@ -960,9 +958,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
960
958
|
});
|
|
961
959
|
const resourcesMap = (0, import_utils.getResourcesMap)(resources);
|
|
962
960
|
let duration = 0;
|
|
963
|
-
this.store.accountList.getAccounts()
|
|
961
|
+
const accountList = this.store.accountList.getAccounts();
|
|
962
|
+
const checkDuration = (cartItems2) => {
|
|
964
963
|
let accountDuration = 0;
|
|
965
|
-
const cartItems2 = this.store.cart.getCartByAccount(account.getId());
|
|
966
964
|
cartItems2.forEach((item) => {
|
|
967
965
|
var _a, _b;
|
|
968
966
|
accountDuration += ((_b = (_a = item._productOrigin) == null ? void 0 : _a.duration) == null ? void 0 : _b.value) ?? 0;
|
|
@@ -970,6 +968,17 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
970
968
|
if (accountDuration > duration) {
|
|
971
969
|
duration = accountDuration;
|
|
972
970
|
}
|
|
971
|
+
};
|
|
972
|
+
if (cartItems == null ? void 0 : cartItems[0].holder_id) {
|
|
973
|
+
accountList.forEach((account) => {
|
|
974
|
+
const cartItems2 = this.store.cart.getCartByAccount(account.getId());
|
|
975
|
+
checkDuration(cartItems2);
|
|
976
|
+
});
|
|
977
|
+
} else {
|
|
978
|
+
checkDuration(cartItems);
|
|
979
|
+
}
|
|
980
|
+
this.store.accountList.getAccounts().forEach((account) => {
|
|
981
|
+
const cartItems2 = this.store.cart.getCartByAccount(account.getId());
|
|
973
982
|
});
|
|
974
983
|
const timeSlots = (0, import_resources.getTimeSlicesByResources)({
|
|
975
984
|
resourceIds,
|
|
@@ -1061,6 +1070,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1061
1070
|
resources
|
|
1062
1071
|
}) {
|
|
1063
1072
|
var _a, _b, _c;
|
|
1073
|
+
debugger;
|
|
1064
1074
|
const targetProduct = this.store.currentProduct;
|
|
1065
1075
|
const targetProductData = targetProduct == null ? void 0 : targetProduct.getData();
|
|
1066
1076
|
let targetSchedules = [];
|
|
@@ -1133,6 +1143,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1133
1143
|
}) {
|
|
1134
1144
|
const { bundle, options, origin, product_variant_id } = product || {};
|
|
1135
1145
|
const productData = { ...origin, product_variant_id };
|
|
1146
|
+
if (!account) {
|
|
1147
|
+
const activeAccount = this.getActiveAccount();
|
|
1148
|
+
if (activeAccount) {
|
|
1149
|
+
account = activeAccount;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1136
1152
|
this.store.cart.addItem({
|
|
1137
1153
|
product: productData,
|
|
1138
1154
|
date,
|