You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

281 lines
6.7 KiB

<template>
<view class="book-com">
<view class="date-wraper">
<view :class="'date'+((selectDay==key)?' active':'')" v-for="(item,key) in RegistrationTimeList" @click="chooseDay(key, item)">
<view class="top">
<view>{{item.date.substring(8,10)}}</view>
<view class="PfScMedium">{{item.weekday}}</view>
</view>
<view :class="'bot'+((item.type!=1 && item.type!=5)?' active':'')+(key==0?' PfScMedium':'')">
{{item.type_text}}
</view>
</view>
</view>
<view class="datelist">
<view :class="'item'+(timeList.am.length<=0?' itemempty':' ')" v-if="bookTimeList">
<view class="title PfScMedium">上午预约</view>
<view class="inner-wrapper" v-if="timeList.am.length>0">
<view v-for="(item,key) in timeList.am" :class="'son PfScMedium'+(item.bed_count<=0?' disable':'')" @click="confirmSubmit(item)" :hover-class="item.bed_count>0?'hover2':''">
{{item.start}}-{{item.end}}
<text v-if="visitorList.length > item.bed_count || item.bed_count<=0">({{item.bed_count>0?item.bed_count:'满'}})</text>
</view>
</view>
<view class="empty" v-else>
<img :src="cssUrl+'empty.png'" alt="">
<view class="info">当前时间段不可预约</view>
</view>
</view>
<view :class="'item'+(timeList.pm.length<=0?' itemempty':' ')" v-if="bookTimeList">
<view class="title PfScMedium">下午预约</view>
<view class="inner-wrapper" v-if="timeList.pm.length>0">
<view :class="'son PfScMedium'+(item.bed_count<=0?' disable':'')" @click="confirmSubmit(item)" :hover-class="item.bed_count>0?'hover2':''" v-for="(item,key) in timeList.pm">
{{item.start}}-{{item.end}}
<text v-if="visitorList.length > item.bed_count || item.bed_count<=0">({{item.bed_count?item.bed_count:'满'}})</text>
</view>
</view>
<view class="empty" v-else>
<img :src="cssUrl+'empty.png'" alt="">
<view class="info">当前时间段不可预约</view>
</view>
</view>
<view class="empty-all" v-else>
<img :src="cssUrl+'empty.png'" alt="">
<view class="info2">
<view class="PfScMedium">{{timeList.type_text}}</view>
<view>请选择其他可预约日期</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: "bookBox",
props: {
RegistrationTimeList:{
type:Array,
default:()=>[]
},
visitorList:{
type:Array,
default:()=>[]
},
},
data() {
return {
cssUrl:this.cssUrl,
bookTimeList:false,
timeList:true,
disable:true,
selectDay:-1
}
},
methods: {
dataInit(firstRegistrationTime) {
this.selectDay = 0
this.bookTimeList = firstRegistrationTime
this.bookTimeList = false
if(firstRegistrationTime.am.length > 0 || firstRegistrationTime.pm.length > 0) this.bookTimeList = true
this.timeList = firstRegistrationTime
},
chooseDay(day, book){
this.selectDay = day
this.bookTimeList = false
if(book.am.length > 0 || book.pm.length > 0) this.bookTimeList = true
this.timeList = book
},
confirmSubmit(times){
if(times.bed_count <= 0) return
this.$emit('confirmSubmitEvent', times)
}
}
};
</script>
<style lang="scss" scoped>
.book-com{
width: 100%;
height: auto;
overflow: hidden;
.date-wraper{
width: 714rpx;
margin: 24rpx auto 0;
height: 218rpx;
background: #FFFFFF;
box-shadow: 0rpx 2rpx 24rpx 0rpx rgba(0,0,0,0.03);
overflow-x: auto;
display: flex;
box-sizing: border-box;
padding: 40rpx 24rpx;
.date{
width: 120rpx;
flex-shrink: 0;
margin-right: 18rpx;
.top{
width: 106rpx;
height: 98rpx;
padding-top: 8rpx !important;
box-sizing: border-box;
view{
color: #333333;
font-size: 28rpx;
line-height: 36rpx;
height: 36rpx;
text-align: center;
}
view:last-of-type{
margin-top: 10rpx;
}
}
.bot{
height: 32rpx;
font-size: 24rpx;
color: #999999;
line-height: 32rpx;
margin-top: 14rpx;
text-align: center;
&.active{
color: #50C382;
}
}
&.active{
.top{
background: #39D067;
border-radius: 8rpx;
view{
color: white !important;
}
}
}
}
}
.datelist{
width: 714rpx;
margin: 20rpx auto 0;
height: auto;
background: #F8F8F8;
border-radius: 8rpx;
box-sizing: border-box;
overflow: hidden;
.title{
height: 50rpx;
font-size: 32rpx;
color: #000000;
line-height: 50rpx;
letter-spacing: 2rpx;
padding-top: 24rpx;
margin-bottom: 24rpx;
background: #FFFFFF;
}
.item{
min-height: 318rpx;
padding: 0 24rpx 0rpx 24rpx;
box-shadow: 0rpx 24rpx 24rpx 0rpx rgba(0,0,0,0.03);
background: #FFFFFF;
position: relative;
margin-bottom: 20rpx;
&.itemallempty{
background: #FFFFFF !important;
}
&.itemempty{
height: 420rpx !important;
padding-bottom: 0rpx !important;
}
.empty{
position: absolute;
top: 0;
left: 147rpx;
width: 420rpx;
height: 420rpx;
img{
width: 420rpx;
height: 420rpx;
display: block;
height: 420rpx;
margin: 0 auto;
}
.info{
width: 100%;
position: absolute;
z-index: 2;
bottom: 42rpx;
text-align: center;
height: 40rpx;
font-size: 28rpx;
color: #AEB0B8;
line-height: 40rpx;
}
}
.inner-wrapper{
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.son{
display: flex;
align-items: center;
justify-content: center;
width: 320rpx;
height: 86rpx;
background: #F8FFF7;
border-radius: 8rpx;
border: 2rpx solid #39D067;
margin-bottom: 20rpx;
color: #50C382;
font-size: 30rpx;
&.disable{
background: #F1F1F1;
border: 2rpx solid #CACACA;
color: #999999;
}
}
}
}
img{
width: 420rpx;
height: 420rpx;
display: block;
height: 420rpx;
margin: 0 auto;
}
.info2{
position: absolute;
bottom: 50rpx;
width: 100%;
view{
width: 100%;
text-align: center;
}
view:first-of-type{
font-size: 28rpx;
height: 40rpx;
width: 100%;
color: #AEB0B8;
line-height: 40rpx;
}
view:last-of-type{
height: 33rpx;
font-size: 24rpx;
color: #BEC1CA;
line-height: 33rpx;
margin-top: 14rpx;
}
}
.empty-all{
height: 454rpx;
padding-bottom: 20rpx;
background: #FFFFFF;
position: relative;
}
}
}
</style>