< 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
times . date = this . RegistrationTimeList [ this . selectDay ] . date
times . key = this . selectDay
this . $emit ( 'confirmSubmitEvent' , times )
}
}
} ;
< / script >
< style lang = "scss" scoped >
. book - com {
width : 100 % ;
height : auto ;
overflow : hidden ;
. date - wraper {
width : 714 rpx ;
margin : 24 rpx auto 0 ;
height : 218 rpx ;
background : # FFFFFF ;
box - shadow : 0 rpx 2 rpx 24 rpx 0 rpx rgba ( 0 , 0 , 0 , 0.03 ) ;
overflow - x : auto ;
display : flex ;
box - sizing : border - box ;
padding : 40 rpx 24 rpx ;
. date {
width : 120 rpx ;
flex - shrink : 0 ;
margin - right : 18 rpx ;
. top {
width : 106 rpx ;
height : 98 rpx ;
padding - top : 8 rpx ! important ;
box - sizing : border - box ;
view {
color : # 333333 ;
font - size : 28 rpx ;
line - height : 36 rpx ;
height : 36 rpx ;
text - align : center ;
}
view : last - of - type {
margin - top : 10 rpx ;
}
}
. bot {
height : 32 rpx ;
font - size : 24 rpx ;
color : # 999999 ;
line - height : 32 rpx ;
margin - top : 14 rpx ;
text - align : center ;
& . active {
color : # 50 C382 ;
}
}
& . active {
. top {
background : # 39 D067 ;
border - radius : 8 rpx ;
view {
color : white ! important ;
}
}
}
}
}
. datelist {
width : 714 rpx ;
margin : 20 rpx auto 0 ;
height : auto ;
background : # F8F8F8 ;
border - radius : 8 rpx ;
box - sizing : border - box ;
overflow : hidden ;
. title {
height : 50 rpx ;
font - size : 32 rpx ;
color : # 000000 ;
line - height : 50 rpx ;
letter - spacing : 2 rpx ;
padding - top : 24 rpx ;
margin - bottom : 24 rpx ;
background : # FFFFFF ;
}
. item {
min - height : 318 rpx ;
padding : 0 24 rpx 0 rpx 24 rpx ;
box - shadow : 0 rpx 24 rpx 24 rpx 0 rpx rgba ( 0 , 0 , 0 , 0.03 ) ;
background : # FFFFFF ;
position : relative ;
margin - bottom : 20 rpx ;
& . itemallempty {
background : # FFFFFF ! important ;
}
& . itemempty {
height : 420 rpx ! important ;
padding - bottom : 0 rpx ! important ;
}
. empty {
position : absolute ;
top : 0 ;
left : 147 rpx ;
width : 420 rpx ;
height : 420 rpx ;
img {
width : 420 rpx ;
height : 420 rpx ;
display : block ;
height : 420 rpx ;
margin : 0 auto ;
}
. info {
width : 100 % ;
position : absolute ;
z - index : 2 ;
bottom : 42 rpx ;
text - align : center ;
height : 40 rpx ;
font - size : 28 rpx ;
color : # AEB0B8 ;
line - height : 40 rpx ;
}
}
. inner - wrapper {
width : 100 % ;
display : flex ;
flex - wrap : wrap ;
justify - content : space - between ;
. son {
display : flex ;
align - items : center ;
justify - content : center ;
width : 320 rpx ;
height : 86 rpx ;
background : # F8FFF7 ;
border - radius : 8 rpx ;
border : 2 rpx solid # 39 D067 ;
margin - bottom : 20 rpx ;
color : # 50 C382 ;
font - size : 30 rpx ;
& . disable {
background : # F1F1F1 ;
border : 2 rpx solid # CACACA ;
color : # 999999 ;
}
}
}
}
img {
width : 420 rpx ;
height : 420 rpx ;
display : block ;
height : 420 rpx ;
margin : 0 auto ;
}
. info2 {
position : absolute ;
bottom : 50 rpx ;
width : 100 % ;
view {
width : 100 % ;
text - align : center ;
}
view : first - of - type {
font - size : 28 rpx ;
height : 40 rpx ;
width : 100 % ;
color : # AEB0B8 ;
line - height : 40 rpx ;
}
view : last - of - type {
height : 33 rpx ;
font - size : 24 rpx ;
color : # BEC1CA ;
line - height : 33 rpx ;
margin - top : 14 rpx ;
}
}
. empty - all {
height : 454 rpx ;
padding - bottom : 20 rpx ;
background : # FFFFFF ;
position : relative ;
}
}
}
< / style >