@pisell/pisellos 1.0.95 → 1.0.96
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.
|
@@ -457,10 +457,24 @@ export var filterDiscountListByBookingTime = function filterDiscountListByBookin
|
|
|
457
457
|
return discountList;
|
|
458
458
|
}
|
|
459
459
|
return discountList.filter(function (discount) {
|
|
460
|
-
var _discount$metadata2
|
|
461
|
-
if (
|
|
460
|
+
var _discount$metadata2;
|
|
461
|
+
if ((discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.validity_type) === "custom_schedule_validity") {
|
|
462
|
+
var _discount$custom_sche;
|
|
463
|
+
return getDateIsInSchedule(bookingTime, ((_discount$custom_sche = discount.custom_schedule_snapshot) === null || _discount$custom_sche === void 0 ? void 0 : _discount$custom_sche.data) || []);
|
|
464
|
+
}
|
|
465
|
+
try {
|
|
466
|
+
var isHasStart = !!discount.start_date && !!discount.start_time;
|
|
467
|
+
var startDate = dayjs("".concat(discount.start_date, " ").concat(discount.start_time));
|
|
468
|
+
var bookingTimeDayjs = dayjs(bookingTime);
|
|
469
|
+
|
|
470
|
+
// 判断预约时间是否在开始时间之后
|
|
471
|
+
var isAfterStart = isHasStart ? bookingTimeDayjs.isSameOrAfter(startDate) : true;
|
|
472
|
+
|
|
473
|
+
// 判断预约时间是否在过期时间之前(expire_time 为空时为长期有效)
|
|
474
|
+
var isBeforeExpire = discount.expire_time ? bookingTimeDayjs.isSameOrBefore(dayjs(discount.expire_time)) : true;
|
|
475
|
+
return isAfterStart && isBeforeExpire;
|
|
476
|
+
} catch (error) {
|
|
462
477
|
return true;
|
|
463
478
|
}
|
|
464
|
-
return getDateIsInSchedule(bookingTime, ((_discount$custom_sche = discount.custom_schedule_snapshot) === null || _discount$custom_sche === void 0 ? void 0 : _discount$custom_sche.data) || []);
|
|
465
479
|
});
|
|
466
480
|
};
|
|
@@ -122,12 +122,6 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
122
122
|
throw error;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
/**
|
|
126
|
-
* 初始化外设扫码结果监听
|
|
127
|
-
*/
|
|
128
|
-
initPeripheralsListener() {
|
|
129
|
-
this.scan.initPeripheralsListener();
|
|
130
|
-
}
|
|
131
125
|
/**
|
|
132
126
|
* 获取商品列表(不加载到模块中)
|
|
133
127
|
* @returns 商品列表
|
|
@@ -294,11 +294,20 @@ var filterDiscountListByBookingTime = (discountList, bookingTime) => {
|
|
|
294
294
|
return discountList;
|
|
295
295
|
}
|
|
296
296
|
return discountList.filter((discount) => {
|
|
297
|
-
var _a, _b
|
|
298
|
-
if (
|
|
297
|
+
var _a, _b;
|
|
298
|
+
if (((_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a.validity_type) === "custom_schedule_validity") {
|
|
299
|
+
return getDateIsInSchedule(bookingTime, ((_b = discount.custom_schedule_snapshot) == null ? void 0 : _b.data) || []);
|
|
300
|
+
}
|
|
301
|
+
try {
|
|
302
|
+
const isHasStart = !!discount.start_date && !!discount.start_time;
|
|
303
|
+
const startDate = (0, import_dayjs.default)(`${discount.start_date} ${discount.start_time}`);
|
|
304
|
+
const bookingTimeDayjs = (0, import_dayjs.default)(bookingTime);
|
|
305
|
+
const isAfterStart = isHasStart ? bookingTimeDayjs.isSameOrAfter(startDate) : true;
|
|
306
|
+
const isBeforeExpire = discount.expire_time ? bookingTimeDayjs.isSameOrBefore((0, import_dayjs.default)(discount.expire_time)) : true;
|
|
307
|
+
return isAfterStart && isBeforeExpire;
|
|
308
|
+
} catch (error) {
|
|
299
309
|
return true;
|
|
300
310
|
}
|
|
301
|
-
return getDateIsInSchedule(bookingTime, ((_c = discount.custom_schedule_snapshot) == null ? void 0 : _c.data) || []);
|
|
302
311
|
});
|
|
303
312
|
};
|
|
304
313
|
// Annotate the CommonJS export names for ESM import in node:
|