@pisell/pisellos 3.0.9 → 3.0.10
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.
|
@@ -50,10 +50,11 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
50
50
|
category_ids?: number[];
|
|
51
51
|
}): Promise<any>;
|
|
52
52
|
loadAllSchedule(): Promise<void>;
|
|
53
|
-
loadScheduleAvailableDate({ startDate, endDate, custom_page_id, }: {
|
|
53
|
+
loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel }: {
|
|
54
54
|
startDate: string;
|
|
55
55
|
endDate: string;
|
|
56
56
|
custom_page_id?: number;
|
|
57
|
+
channel?: string;
|
|
57
58
|
}): Promise<ITime[]>;
|
|
58
59
|
storeProduct(productData: ProductData): Promise<void>;
|
|
59
60
|
addAccount(account: Account | IHolder, extra?: {
|
|
@@ -314,11 +314,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
314
314
|
value: function () {
|
|
315
315
|
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref3) {
|
|
316
316
|
var _res$data$date_list;
|
|
317
|
-
var startDate, endDate, custom_page_id, dates, res;
|
|
317
|
+
var startDate, endDate, custom_page_id, channel, dates, res;
|
|
318
318
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
319
319
|
while (1) switch (_context5.prev = _context5.next) {
|
|
320
320
|
case 0:
|
|
321
|
-
startDate = _ref3.startDate, endDate = _ref3.endDate, custom_page_id = _ref3.custom_page_id;
|
|
321
|
+
startDate = _ref3.startDate, endDate = _ref3.endDate, custom_page_id = _ref3.custom_page_id, channel = _ref3.channel;
|
|
322
322
|
// 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天,需要把 startDate 置为今天
|
|
323
323
|
if (dayjs(startDate).isBefore(dayjs(), 'day')) {
|
|
324
324
|
startDate = dayjs().format('YYYY-MM-DD');
|
|
@@ -337,7 +337,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
337
337
|
return this.request.get("/schedule/product/availability", {
|
|
338
338
|
start_date: startDate,
|
|
339
339
|
end_date: endDate,
|
|
340
|
-
custom_page_id: custom_page_id
|
|
340
|
+
custom_page_id: custom_page_id,
|
|
341
|
+
channel: channel
|
|
341
342
|
});
|
|
342
343
|
case 8:
|
|
343
344
|
res = _context5.sent;
|
|
@@ -350,13 +351,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
350
351
|
return _context5.abrupt("return", dates);
|
|
351
352
|
case 12:
|
|
352
353
|
res.data.date_list.forEach(function (n) {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
dates[index].status = 'available';
|
|
359
|
-
}
|
|
354
|
+
var index = dates.findIndex(function (m) {
|
|
355
|
+
return m.date === n.date;
|
|
356
|
+
});
|
|
357
|
+
if (index !== -1) {
|
|
358
|
+
dates[index].status = 'available';
|
|
360
359
|
}
|
|
361
360
|
});
|
|
362
361
|
dates = disableDatesBeforeOneDay(dates);
|
|
@@ -1195,7 +1194,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1195
1194
|
});
|
|
1196
1195
|
n.renderList = n.renderList.filter(function (m) {
|
|
1197
1196
|
var recordCount = capacityMap[m.id] || 0;
|
|
1198
|
-
var
|
|
1197
|
+
var canUseArr = m.times.map(function (item) {
|
|
1199
1198
|
var res = getIsUsableByTimeItem({
|
|
1200
1199
|
timeSlice: {
|
|
1201
1200
|
start_time: startTime.format('HH:mm'),
|
|
@@ -1213,7 +1212,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1213
1212
|
}
|
|
1214
1213
|
return res.usable;
|
|
1215
1214
|
});
|
|
1216
|
-
|
|
1215
|
+
// 在已经选定时间的情况下,只要canUseTime 里有一个 false,那就代表不可用
|
|
1216
|
+
return !canUseArr.some(function (n) {
|
|
1217
|
+
return n === false;
|
|
1218
|
+
});
|
|
1217
1219
|
});
|
|
1218
1220
|
});
|
|
1219
1221
|
} else {
|
|
@@ -1841,7 +1843,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1841
1843
|
if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[m.id]) !== false) {
|
|
1842
1844
|
resourcesUseableMap[m.id] = res.usable;
|
|
1843
1845
|
}
|
|
1844
|
-
// 如果资源可用,且是独占资源,remainingCapacity 始终为 1
|
|
1845
1846
|
if (res.usable && res.remainingCapacity >= count) {
|
|
1846
1847
|
count = res.remainingCapacity;
|
|
1847
1848
|
}
|
|
@@ -50,10 +50,11 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
50
50
|
category_ids?: number[];
|
|
51
51
|
}): Promise<any>;
|
|
52
52
|
loadAllSchedule(): Promise<void>;
|
|
53
|
-
loadScheduleAvailableDate({ startDate, endDate, custom_page_id, }: {
|
|
53
|
+
loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel }: {
|
|
54
54
|
startDate: string;
|
|
55
55
|
endDate: string;
|
|
56
56
|
custom_page_id?: number;
|
|
57
|
+
channel?: string;
|
|
57
58
|
}): Promise<ITime[]>;
|
|
58
59
|
storeProduct(productData: ProductData): Promise<void>;
|
|
59
60
|
addAccount(account: Account | IHolder, extra?: {
|
|
@@ -208,7 +208,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
208
208
|
async loadScheduleAvailableDate({
|
|
209
209
|
startDate,
|
|
210
210
|
endDate,
|
|
211
|
-
custom_page_id
|
|
211
|
+
custom_page_id,
|
|
212
|
+
channel
|
|
212
213
|
}) {
|
|
213
214
|
var _a;
|
|
214
215
|
if ((0, import_dayjs.default)(startDate).isBefore((0, import_dayjs.default)(), "day")) {
|
|
@@ -224,7 +225,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
224
225
|
{
|
|
225
226
|
start_date: startDate,
|
|
226
227
|
end_date: endDate,
|
|
227
|
-
custom_page_id
|
|
228
|
+
custom_page_id,
|
|
229
|
+
channel
|
|
228
230
|
}
|
|
229
231
|
);
|
|
230
232
|
this.store.schedule.setAvailabilityScheduleDateList(res.data.date_list);
|
|
@@ -232,11 +234,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
232
234
|
return dates;
|
|
233
235
|
}
|
|
234
236
|
res.data.date_list.forEach((n) => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
dates[index].status = "available";
|
|
239
|
-
}
|
|
237
|
+
const index = dates.findIndex((m) => m.date === n.date);
|
|
238
|
+
if (index !== -1) {
|
|
239
|
+
dates[index].status = "available";
|
|
240
240
|
}
|
|
241
241
|
});
|
|
242
242
|
dates = (0, import_utils3.disableDatesBeforeOneDay)(dates);
|
|
@@ -646,7 +646,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
646
646
|
});
|
|
647
647
|
n.renderList = n.renderList.filter((m) => {
|
|
648
648
|
const recordCount = capacityMap[m.id] || 0;
|
|
649
|
-
const
|
|
649
|
+
const canUseArr = m.times.map((item) => {
|
|
650
650
|
const res = (0, import_resources.getIsUsableByTimeItem)({
|
|
651
651
|
timeSlice: {
|
|
652
652
|
start_time: startTime.format("HH:mm"),
|
|
@@ -664,7 +664,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
664
664
|
}
|
|
665
665
|
return res.usable;
|
|
666
666
|
});
|
|
667
|
-
return
|
|
667
|
+
return !canUseArr.some((n2) => n2 === false);
|
|
668
668
|
});
|
|
669
669
|
});
|
|
670
670
|
} else {
|