Showing
2 changed files
with
22 additions
and
2 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-01-15 13:35:51 | 2 | * @Date: 2024-01-15 13:35:51 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-17 18:07:39 | 4 | + * @LastEditTime: 2024-01-18 09:53:50 |
| 5 | * @FilePath: /xysBooking/src/views/booking.vue | 5 | * @FilePath: /xysBooking/src/views/booking.vue |
| 6 | * @Description: 预约页面 | 6 | * @Description: 预约页面 |
| 7 | * @Version: 1.0.0 | 7 | * @Version: 1.0.0 |
| ... | @@ -88,11 +88,13 @@ import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@ | ... | @@ -88,11 +88,13 @@ import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@ |
| 88 | //import { } from '@/utils/generateModules.js' | 88 | //import { } from '@/utils/generateModules.js' |
| 89 | //import { } from '@/utils/generateIcons.js' | 89 | //import { } from '@/utils/generateIcons.js' |
| 90 | //import { } from '@/composables' | 90 | //import { } from '@/composables' |
| 91 | +import dayjs from 'dayjs'; | ||
| 91 | import { useGo } from '@/hooks/useGo' | 92 | import { useGo } from '@/hooks/useGo' |
| 92 | import icon_select1 from '@/assets/images/单选01@2x.png' | 93 | import icon_select1 from '@/assets/images/单选01@2x.png' |
| 93 | import icon_select2 from '@/assets/images/单选02@2x.png' | 94 | import icon_select2 from '@/assets/images/单选02@2x.png' |
| 94 | import { canReserveDateListAPI, canReserveTimeListAPI } from '@/api/index' | 95 | import { canReserveDateListAPI, canReserveTimeListAPI } from '@/api/index' |
| 95 | 96 | ||
| 97 | + | ||
| 96 | const $route = useRoute(); | 98 | const $route = useRoute(); |
| 97 | const $router = useRouter(); | 99 | const $router = useRouter(); |
| 98 | useTitle($route.meta.title); | 100 | useTitle($route.meta.title); |
| ... | @@ -107,7 +109,14 @@ onMounted(async () => { | ... | @@ -107,7 +109,14 @@ onMounted(async () => { |
| 107 | const { code, data } = await canReserveDateListAPI({ month: `${raw_date.getFullYear()}-${raw_date.getMonth() + 1}` }); | 109 | const { code, data } = await canReserveDateListAPI({ month: `${raw_date.getFullYear()}-${raw_date.getMonth() + 1}` }); |
| 108 | if (code) { | 110 | if (code) { |
| 109 | // 日期列表 | 111 | // 日期列表 |
| 112 | + const current = dayjs().format('YYYY-MM-DD'); // 当日 | ||
| 110 | dates_list.value = data; | 113 | dates_list.value = data; |
| 114 | + // 今日之前都不可约 | ||
| 115 | + dates_list.value.forEach((date) => { | ||
| 116 | + if (dayjs(date.month_date).isBefore(dayjs()) && date.month_date !== current) { | ||
| 117 | + date.reserve_full = 1; | ||
| 118 | + } | ||
| 119 | + }); | ||
| 111 | dates.value = dates_list.value.map(item => item.month_date); | 120 | dates.value = dates_list.value.map(item => item.month_date); |
| 112 | } | 121 | } |
| 113 | }) | 122 | }) |
| ... | @@ -209,8 +218,15 @@ const onConfirm = async ({ selectedValues, selectedOptions }) => { // 选择日æ | ... | @@ -209,8 +218,15 @@ const onConfirm = async ({ selectedValues, selectedOptions }) => { // 选择日æ |
| 209 | // 选择日期后,查询月份信息 | 218 | // 选择日期后,查询月份信息 |
| 210 | const { code, data } = await canReserveDateListAPI({ month: `${selectedValues[0]}-${selectedValues[1]}` }); | 219 | const { code, data } = await canReserveDateListAPI({ month: `${selectedValues[0]}-${selectedValues[1]}` }); |
| 211 | if (code) { | 220 | if (code) { |
| 221 | + const current = dayjs().format('YYYY-MM-DD'); // 当日 | ||
| 212 | // 日期列表 | 222 | // 日期列表 |
| 213 | dates_list.value = data; | 223 | dates_list.value = data; |
| 224 | + // 今日之前都不可约 | ||
| 225 | + dates_list.value.forEach((date) => { | ||
| 226 | + if (dayjs(date.month_date).isBefore(dayjs()) && date.month_date !== current) { | ||
| 227 | + date.reserve_full = 1; | ||
| 228 | + } | ||
| 229 | + }); | ||
| 214 | dates.value = dates_list.value.map(item => item.month_date); | 230 | dates.value = dates_list.value.map(item => item.month_date); |
| 215 | } | 231 | } |
| 216 | } | 232 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2023-06-21 10:23:09 | 2 | * @Date: 2023-06-21 10:23:09 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-16 18:04:39 | 4 | + * @LastEditTime: 2024-01-17 18:35:33 |
| 5 | * @FilePath: /xysBooking/src/views/index.vue | 5 | * @FilePath: /xysBooking/src/views/index.vue |
| 6 | * @Description: 预约页首页 | 6 | * @Description: 预约页首页 |
| 7 | --> | 7 | --> |
| ... | @@ -60,6 +60,7 @@ import icon_2 from '@/assets/images/预约记录@2x.png' | ... | @@ -60,6 +60,7 @@ import icon_2 from '@/assets/images/预约记录@2x.png' |
| 60 | import icon_3 from '@/assets/images/首页02@2x.png' | 60 | import icon_3 from '@/assets/images/首页02@2x.png' |
| 61 | import icon_4 from '@/assets/images/二维码icon.png' | 61 | import icon_4 from '@/assets/images/二维码icon.png' |
| 62 | import icon_5 from '@/assets/images/我的01@2x.png' | 62 | import icon_5 from '@/assets/images/我的01@2x.png' |
| 63 | +import { canReserveDateListAPI } from '@/api/index' | ||
| 63 | const $route = useRoute(); | 64 | const $route = useRoute(); |
| 64 | const $router = useRouter(); | 65 | const $router = useRouter(); |
| 65 | useTitle($route.meta.title); | 66 | useTitle($route.meta.title); |
| ... | @@ -80,6 +81,9 @@ const toMy = () => { // 跳转到我的 | ... | @@ -80,6 +81,9 @@ const toMy = () => { // 跳转到我的 |
| 80 | } | 81 | } |
| 81 | 82 | ||
| 82 | onMounted(async () => { | 83 | onMounted(async () => { |
| 84 | + // TODO: 获取接口模拟授权,在首页的时候重定向 | ||
| 85 | + const raw_date = new Date(); | ||
| 86 | + const { code, data } = await canReserveDateListAPI({ month: `${raw_date.getFullYear()}-${raw_date.getMonth() + 1}` }); | ||
| 83 | }); | 87 | }); |
| 84 | 88 | ||
| 85 | </script> | 89 | </script> | ... | ... |
-
Please register or login to post a comment