hookehuyr

feat(预约页面): 添加无限预约状态下的提示文本显示

在无限预约状态下显示自定义提示文本,当没有设置提示时显示默认文本
<!--
* @Date: 2024-01-15 13:35:51
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-02-05 16:57:15
* @FilePath: /xysBooking/src/views/booking.vue
* @LastEditTime: 2026-01-22 10:56:01
* @FilePath: /git/xysBooking/src/views/booking.vue
* @Description: 预约页面
-->
<template>
......@@ -67,7 +67,7 @@
<div class="text">选择参访时间段</div>
</div>
<div style="padding: 1.5rem 0.75rem; color: #A67939; text-align: center;">
暂未开启预约
{{ infinity_tips_text }}
</div>
</div>
</div>
......@@ -142,13 +142,16 @@ onMounted(async () => {
* @return {object} {text: 日期, date: 日期, reserve_full: 是否可约 1=可约,0=约满,-1=无需预约 overdue=过期日期 }
*/
const findDatesInfo = (date) => {
if (!date) return { text: '', date: '', reserve_full: '', tips: '', lunar_date: {} };
const result = dates_list.value.find((item) => item.month_date === date);
const currentDate = new Date(date);
const lunarDate = calendar.solar2lunar(dayjs(date).format('YYYY-MM-DD'));
const d = dayjs(date);
const lunarDate = calendar.solar2lunar(d.year(), d.month() + 1, d.date());
return {
text: currentDate.getDate().toString().padStart(2, '0'),
date: result?.month_date,
reserve_full: result?.reserve_full,
tips: result?.tips || '',
lunar_date: lunarDate
};
};
......@@ -212,6 +215,16 @@ const checked_day_reserve_full = ref(null);
const checked_time = ref(-1);
const timePeriod = ref([]); // 当前时间段信息
const infinity_tips_text = computed(() => {
if (!checked_day.value || checked_day_reserve_full.value !== ReserveStatus.INFINITY) return '';
const info = findDatesInfo(checked_day.value);
if (dayjs(checked_day.value).isAfter(dayjs(), 'day')) {
const tips = (info.tips || '').trim();
if (tips) return tips;
}
return '暂未开启预约';
});
const chooseTime = (item, index) => { // 选择时间段回调
if (item.rest_qty || item.rest_qty === QtyStatus.INFINITY) { // 余量等于-1为不限制数量
checked_time.value = index;
......