|
@@ -0,0 +1,115 @@
|
|
|
+<template>
|
|
|
+ <window-size>
|
|
|
+ <van-grid direction="horizontal" :column-num="7">
|
|
|
+ <van-grid-item v-for="item in data.oneWeekText" :key="item" :text="'周' + item" />
|
|
|
+ </van-grid>
|
|
|
+ <van-grid direction="horizontal" :column-num="7">
|
|
|
+ <van-grid-item v-for="(item, index) in data.nextSevenDate" :key="index">
|
|
|
+ <van-badge :content="hasSource(index)" :color="badgeColor(index)">
|
|
|
+ <van-button
|
|
|
+ :disabled="disabledBtn(index)"
|
|
|
+ :type="getType(index)"
|
|
|
+ size="small"
|
|
|
+ round
|
|
|
+ @click="handleClickDate(index)"
|
|
|
+ >{{ item.date }}</van-button
|
|
|
+ >
|
|
|
+ </van-badge>
|
|
|
+ </van-grid-item>
|
|
|
+ </van-grid>
|
|
|
+ <div style="height: 5px"></div>
|
|
|
+ <van-tag type="primary" plain style="margin-left: 5px">{{ data.dateSelected }}</van-tag>
|
|
|
+ <div style="height: 5px"></div>
|
|
|
+ <van-empty description="暂无可预约项目" v-if="currentSources.length === 0" />
|
|
|
+ <div v-else :style="scrollStyle">
|
|
|
+ <van-cell
|
|
|
+ v-for="(item, index) in currentSources"
|
|
|
+ :key="index"
|
|
|
+ :title="item.jcxm"
|
|
|
+ :value="item.deptName"
|
|
|
+ :label="'时段:' + item.beginTime + ' - ' + item.endTime"
|
|
|
+ is-link
|
|
|
+ center
|
|
|
+ @click="routeToBookDetail(item)"
|
|
|
+ ></van-cell>
|
|
|
+ </div>
|
|
|
+ </window-size>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { onMounted, reactive, ref } from 'vue'
|
|
|
+import router from '../../../router'
|
|
|
+import { getFullScheduleOfMedicalForPlatform } from '../../../api/bookable'
|
|
|
+import { getOneWeekText, getNextSevenDate } from '../../../utils/date'
|
|
|
+import store from '../../../store'
|
|
|
+
|
|
|
+export default {
|
|
|
+ setup() {
|
|
|
+ const windowSize = store.state.windowSize
|
|
|
+ const scrollStyle = {
|
|
|
+ height: windowSize.h - 190 + 'px',
|
|
|
+ overflowY: 'auto',
|
|
|
+ }
|
|
|
+ const bookItem = store.state.currentBook
|
|
|
+ const currentSources = ref([])
|
|
|
+ const data = reactive({
|
|
|
+ currentIndex: 0,
|
|
|
+ oneWeekText: getOneWeekText(),
|
|
|
+ nextSevenDate: getNextSevenDate(),
|
|
|
+ sources: {},
|
|
|
+ statuses: [],
|
|
|
+ dateSelected: '',
|
|
|
+ })
|
|
|
+ const getType = (index) => {
|
|
|
+ return index === data.currentIndex ? 'primary' : 'default'
|
|
|
+ }
|
|
|
+ const hasSource = (index) => {
|
|
|
+ return data.statuses[index] === 1 ? '有' : '无'
|
|
|
+ }
|
|
|
+ const badgeColor = (index) => {
|
|
|
+ return data.statuses[index] === 1 ? 'green' : 'red'
|
|
|
+ }
|
|
|
+ const disabledBtn = (index) => {
|
|
|
+ return data.statuses[index] === 0
|
|
|
+ }
|
|
|
+ const handleClickDate = (index) => {
|
|
|
+ data.currentIndex = index
|
|
|
+ data.dateSelected = data.nextSevenDate[index].fullDate
|
|
|
+ currentSources.value = data.sources[data.dateSelected] || []
|
|
|
+ }
|
|
|
+
|
|
|
+ const routeToBookDetail = (item) => {
|
|
|
+ bookItem.recordDate = item.recordDate
|
|
|
+ bookItem.beginTime = item.beginTime
|
|
|
+ bookItem.endTime = item.endTime
|
|
|
+ bookItem.id = item.id
|
|
|
+ router.push({ name: 'bookExam', params: bookItem })
|
|
|
+ }
|
|
|
+
|
|
|
+ onMounted(() => {
|
|
|
+ getFullScheduleOfMedicalForPlatform(bookItem).then((res) => {
|
|
|
+ data.sources = res.sources
|
|
|
+ data.statuses = res.statuses
|
|
|
+ for (let i = 0; i < 7; i++) {
|
|
|
+ handleClickDate(i)
|
|
|
+ if (res.statuses[i] === 1) {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ return {
|
|
|
+ scrollStyle,
|
|
|
+ data,
|
|
|
+ getType,
|
|
|
+ hasSource,
|
|
|
+ badgeColor,
|
|
|
+ disabledBtn,
|
|
|
+ routeToBookDetail,
|
|
|
+ handleClickDate,
|
|
|
+ currentSources,
|
|
|
+ }
|
|
|
+ },
|
|
|
+}
|
|
|
+</script>
|