@pisell/pisellos 0.0.113 → 0.0.114
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.
|
@@ -271,7 +271,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
271
271
|
key: "loadProductByScheduleDate",
|
|
272
272
|
value: function () {
|
|
273
273
|
var _loadProductByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref2) {
|
|
274
|
-
var
|
|
274
|
+
var _product_ids;
|
|
275
|
+
var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, scheduleIds, _schedule$product_ids, schedule, otherProductsIds, allProductIds;
|
|
275
276
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
276
277
|
while (1) switch (_context3.prev = _context3.next) {
|
|
277
278
|
case 0:
|
|
@@ -294,21 +295,31 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
294
295
|
return n.schedule_id;
|
|
295
296
|
}).filter(function (n) {
|
|
296
297
|
return n !== null && n !== undefined;
|
|
297
|
-
}); //
|
|
298
|
+
}); // 如果外面没传 product_ids,尝试从对应 schedule 里拿 product_ids
|
|
299
|
+
if (!((_product_ids = product_ids) !== null && _product_ids !== void 0 && _product_ids.length)) {
|
|
300
|
+
schedule = scheduleList.find(function (n) {
|
|
301
|
+
return n.date === date;
|
|
302
|
+
});
|
|
303
|
+
if (schedule && (_schedule$product_ids = schedule.product_ids) !== null && _schedule$product_ids !== void 0 && _schedule$product_ids.length) {
|
|
304
|
+
product_ids = schedule.product_ids;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// 尝试去拿schedule 里的 other_product_ids 和 product_ids 拼在一起去重
|
|
298
309
|
otherProductsIds = this.store.schedule.getOtherProductsIds() || [];
|
|
299
310
|
allProductIds = [].concat(_toConsumableArray(product_ids), _toConsumableArray(otherProductsIds)).filter(function (n, index, self) {
|
|
300
311
|
return self.indexOf(n) === index;
|
|
301
312
|
});
|
|
302
|
-
_context3.next =
|
|
313
|
+
_context3.next = 9;
|
|
303
314
|
return this.loadProducts({
|
|
304
315
|
schedule_ids: scheduleIds,
|
|
305
316
|
product_ids: allProductIds,
|
|
306
317
|
category_ids: category_ids,
|
|
307
318
|
schedule_date: date
|
|
308
319
|
});
|
|
309
|
-
case 8:
|
|
310
|
-
return _context3.abrupt("return", _context3.sent);
|
|
311
320
|
case 9:
|
|
321
|
+
return _context3.abrupt("return", _context3.sent);
|
|
322
|
+
case 10:
|
|
312
323
|
case "end":
|
|
313
324
|
return _context3.stop();
|
|
314
325
|
}
|
|
@@ -215,12 +215,19 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
215
215
|
product_ids = [],
|
|
216
216
|
category_ids = []
|
|
217
217
|
}) {
|
|
218
|
+
var _a;
|
|
218
219
|
const scheduleList = this.store.schedule.getAvailabilityScheduleDateList();
|
|
219
220
|
this.setDateRange([
|
|
220
221
|
{ date, status: "available", week: "", weekNum: 0 },
|
|
221
222
|
{ date, status: "available", week: "", weekNum: 0 }
|
|
222
223
|
]);
|
|
223
224
|
const scheduleIds = scheduleList.filter((n) => n.date === date).flatMap((n) => n.schedule_id).filter((n) => n !== null && n !== void 0);
|
|
225
|
+
if (!(product_ids == null ? void 0 : product_ids.length)) {
|
|
226
|
+
const schedule = scheduleList.find((n) => n.date === date);
|
|
227
|
+
if (schedule && ((_a = schedule.product_ids) == null ? void 0 : _a.length)) {
|
|
228
|
+
product_ids = schedule.product_ids;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
224
231
|
const otherProductsIds = this.store.schedule.getOtherProductsIds() || [];
|
|
225
232
|
const allProductIds = [...product_ids, ...otherProductsIds].filter((n, index, self) => self.indexOf(n) === index);
|
|
226
233
|
return await this.loadProducts({
|