123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <template>
- <view class="main">
- <view class="leftcontainer">
- <scroll-view scroll-y="true" style="height: 700rpx;">
- <view :class="leftindex==index?'leftstyle leftstyle_active':'leftstyle'" v-for="(item,index) in date[0]"
- @click="selectdate(item,index)" :key="index">
- <view class="">
- {{formatdate(item.week)}}
- </view>
- <view class="">
- {{item.date}}
- </view>
- </view>
- </scroll-view>
- </view>
- <view class="rightcontainer">
- <scroll-view scroll-y="true" style="height: 700rpx;">
- <u-grid :col="3">
- <u-grid-item v-for="(itm,idx) in rightday" @click="selectday(itm)" :key="idx">
- <view class="text-sm">
- {{itm.intro}}
- </view>
- <view class="margin-top-sm">{{itm.start_time_period}} - {{itm.end_time_period}}</view>
- <view v-if="itm.can_appoint==1||type==3||type==5"
- :class="itm.can_appoint_num==0?'margin-top-sm text-gray text-sm':'margin-top-sm text-blue text-sm'">
- 可预约号源:{{itm.can_appoint_num}}
- </view>
- <view v-else class="margin-top-sm text-gray text-sm">
- 暂不可预约
- </view>
- </u-grid-item>
- </u-grid>
- </scroll-view>
- </view>
- </view>
- </template>
- <script>
- export default {
- props: {
- date: {
- type: Array,
- },
- type: {
- type: String
- }
- },
- mounted() {},
- data() {
- return {
- leftindex: 0,
- rightday: [],
- year: ""
- }
- },
- methods: {
- formatdate(week) {
- switch (week) {
- case 1:
- return "周一"
- break;
- case 2:
- return "周二"
- break;
- case 3:
- return "周三"
- break;
- case 4:
- return "周四"
- break;
- case 5:
- return "周五"
- break;
- case 6:
- return "周六"
- break;
- case 7:
- return "周日"
- break;
- default:
- break;
- }
- },
- selectdate(item, index) {
- console.log(this.date)
- this.leftindex = index
- this.year = item.date
- this.date[1].forEach(data => {
- data.forEach(itm => {
- if (itm.schedule_id == item.id) {
- this.rightday = data
- }
- })
- })
- },
- selectday(itm) {
- console.log(itm)
- let arr = itm.year + " " + itm.end_time_period;
- arr = arr.split(/[- :]/)
- let nndate = new Date(arr[0], arr[1] - 1, arr[2], arr[3], arr[4]);
- nndate = Date.parse(nndate)
- let currentTime = Date.parse(new Date())
- if (nndate < currentTime) {
- uni.showToast({
- title: "不可预约已过时间",
- icon: "none"
- })
- return false
- }
- if (itm.can_appoint_num == 0) {
- uni.showToast({
- title: "已无号源可预约",
- icon: "none"
- })
- return false
- }
- if (itm.can_appoint == 0) {
- uni.showToast({
- title: "暂不可预约",
- icon: "none"
- })
- return false
- }
- if (this.year != "") {
- itm.year = this.year
- }
- this.$emit('callbacktime', itm)
- }
- }
- };
- </script>
- <style scoped>
- .main {
- display: flex;
- /* margin-left: 15rpx;
- margin-right: 15rpx; */
- }
- .leftcontainer {
- border-right: 1rpx solid #efefef;
- width: 25%;
- }
- .rightcontainer {
- width: 75%;
- }
- .leftstyle {
- width: 100%;
- height: 80rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 30rpx;
- color: #0B73B9;
- flex-direction: column;
- }
- .leftstyle_active {
- color: #fff;
- background-color: #0B73B9;
- }
- </style>
|