@pisell/pisellos 2.0.45 → 2.0.47
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.
|
@@ -140,7 +140,11 @@ var getDaysByRepeatWeek = function getDaysByRepeatWeek(params, isGetRange) {
|
|
|
140
140
|
for (var i = 0; i < frequency_date.length; i++) {
|
|
141
141
|
var item = frequency_date[i];
|
|
142
142
|
var _start = startTmp.day(item);
|
|
143
|
+
// 如果周结束的那一天还超过了deadline,则需要把_end置为deadline
|
|
143
144
|
var _end = _start.add(scheduleDiff, 'second');
|
|
145
|
+
if (_end.isAfter(deadline, 'day')) {
|
|
146
|
+
_end = deadline;
|
|
147
|
+
}
|
|
144
148
|
if (isGetRange) {
|
|
145
149
|
if (excludedDaysMap.has(_start.format('YYYY-MM-DD'))) {
|
|
146
150
|
startTmp = startTmp.day(1).add(frequency, 'day');
|
|
@@ -272,7 +272,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
272
272
|
value: (function () {
|
|
273
273
|
var _loadProductByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref2) {
|
|
274
274
|
var _schedule$product_ids;
|
|
275
|
-
var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, schedule, otherProductsIds, allProductIds;
|
|
275
|
+
var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, newProductIds, schedule, otherProductsIds, allProductIds;
|
|
276
276
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
277
277
|
while (1) switch (_context3.prev = _context3.next) {
|
|
278
278
|
case 0:
|
|
@@ -289,27 +289,38 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
289
289
|
week: '',
|
|
290
290
|
weekNum: 0
|
|
291
291
|
}]);
|
|
292
|
+
newProductIds = []; // const scheduleIds = scheduleList
|
|
293
|
+
// .filter((n) => n.date === date)
|
|
294
|
+
// .flatMap((n) => n.schedule_id)
|
|
295
|
+
// .filter((n) => n !== null && n !== undefined);
|
|
296
|
+
// 如果外面没传 product_ids,尝试从对应 schedule 里拿 product_ids
|
|
297
|
+
// if (!product_ids?.length) {
|
|
298
|
+
// const schedule = scheduleList.find((n) => n.date === date);
|
|
299
|
+
// if (schedule && schedule.product_ids?.length) {
|
|
300
|
+
// product_ids = schedule.product_ids;
|
|
301
|
+
// }
|
|
302
|
+
// }
|
|
292
303
|
// V2接口修改后,只能从schedule 接口里拿数据,不可以从外面拿,外面给的是装修数据
|
|
293
304
|
schedule = scheduleList.find(function (n) {
|
|
294
305
|
return n.date === date;
|
|
295
306
|
});
|
|
296
307
|
if (schedule && (_schedule$product_ids = schedule.product_ids) !== null && _schedule$product_ids !== void 0 && _schedule$product_ids.length) {
|
|
297
|
-
|
|
308
|
+
newProductIds = schedule.product_ids;
|
|
298
309
|
}
|
|
299
310
|
// 尝试去拿schedule 里的 other_product_ids 和 product_ids 拼在一起去重
|
|
300
311
|
otherProductsIds = this.store.schedule.getOtherProductsIds() || [];
|
|
301
|
-
allProductIds = [].concat(_toConsumableArray(
|
|
312
|
+
allProductIds = [].concat(_toConsumableArray(newProductIds), _toConsumableArray(otherProductsIds)).filter(function (n, index, self) {
|
|
302
313
|
return self.indexOf(n) === index;
|
|
303
314
|
});
|
|
304
|
-
_context3.next =
|
|
315
|
+
_context3.next = 10;
|
|
305
316
|
return this.loadProducts({
|
|
306
317
|
product_ids: allProductIds,
|
|
307
318
|
category_ids: category_ids,
|
|
308
319
|
schedule_date: date
|
|
309
320
|
});
|
|
310
|
-
case 9:
|
|
311
|
-
return _context3.abrupt("return", _context3.sent);
|
|
312
321
|
case 10:
|
|
322
|
+
return _context3.abrupt("return", _context3.sent);
|
|
323
|
+
case 11:
|
|
313
324
|
case "end":
|
|
314
325
|
return _context3.stop();
|
|
315
326
|
}
|
|
@@ -140,7 +140,10 @@ var getDaysByRepeatWeek = (params, isGetRange) => {
|
|
|
140
140
|
for (let i = 0; i < frequency_date.length; i++) {
|
|
141
141
|
const item = frequency_date[i];
|
|
142
142
|
const _start = startTmp.day(item);
|
|
143
|
-
|
|
143
|
+
let _end = _start.add(scheduleDiff, "second");
|
|
144
|
+
if (_end.isAfter(deadline, "day")) {
|
|
145
|
+
_end = deadline;
|
|
146
|
+
}
|
|
144
147
|
if (isGetRange) {
|
|
145
148
|
if (excludedDaysMap.has(_start.format("YYYY-MM-DD"))) {
|
|
146
149
|
startTmp = startTmp.day(1).add(frequency, "day");
|
|
@@ -217,12 +217,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
217
217
|
{ date, status: "available", week: "", weekNum: 0 },
|
|
218
218
|
{ date, status: "available", week: "", weekNum: 0 }
|
|
219
219
|
]);
|
|
220
|
+
let newProductIds = [];
|
|
220
221
|
const schedule = scheduleList.find((n) => n.date === date);
|
|
221
222
|
if (schedule && ((_a = schedule.product_ids) == null ? void 0 : _a.length)) {
|
|
222
|
-
|
|
223
|
+
newProductIds = schedule.product_ids;
|
|
223
224
|
}
|
|
224
225
|
const otherProductsIds = this.store.schedule.getOtherProductsIds() || [];
|
|
225
|
-
const allProductIds = [...
|
|
226
|
+
const allProductIds = [...newProductIds, ...otherProductsIds].filter(
|
|
226
227
|
(n, index, self) => self.indexOf(n) === index
|
|
227
228
|
);
|
|
228
229
|
return await this.loadProducts({
|