|
...
|
...
|
@@ -20,14 +20,14 @@ Component({ |
|
|
|
|
|
|
|
},
|
|
|
|
ready(){
|
|
|
|
this.getroombydate();
|
|
|
|
this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'})
|
|
|
|
|
|
|
|
},
|
|
|
|
observers: {
|
|
|
|
'date': function(date) {
|
|
|
|
this.setData({
|
|
|
|
date: date
|
|
|
|
})
|
|
|
|
'date': function(newdate) {
|
|
|
|
if(newdate!=''){
|
|
|
|
this.getroombydate();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods:{
|
|
...
|
...
|
@@ -37,7 +37,7 @@ Component({ |
|
|
|
},
|
|
|
|
//获得默认所有可订时间段
|
|
|
|
getdurlist(houseFull){
|
|
|
|
let currenttimemark=date.getHours()+new Date().getMinutes()/60;
|
|
|
|
let currenttimemark=date.getHours()+date.getMinutes()/60;
|
|
|
|
let timedur=this.data.seller.daily;
|
|
|
|
for(let key in houseFull){
|
|
|
|
if(houseFull[key]==1){
|
|
...
|
...
|
@@ -50,10 +50,22 @@ Component({ |
|
|
|
//每个时段的开始时间、结束时间
|
|
|
|
let starttime=Number(arr[0].split(':')[0]);
|
|
|
|
let endtime=Number(arr[1].split(':')[0]);
|
|
|
|
if(currenttimemark+0.5<endtime){
|
|
|
|
if(currenttimemark+0.5>starttime){
|
|
|
|
starttime=Math.round(currenttimemark)+0.5;
|
|
|
|
if(util.unixtoTime(date/1000,'YYYY-MM-DD')==this.data.date){
|
|
|
|
if(currenttimemark+0.5<endtime){
|
|
|
|
if(currenttimemark+0.5>starttime){
|
|
|
|
starttime=Math.round(currenttimemark)+0.5;
|
|
|
|
}
|
|
|
|
for(let i=starttime;i<=endtime;i+=0.5){
|
|
|
|
let obj={};
|
|
|
|
if(i%1==0){
|
|
|
|
obj.showdur=i<10 ? '0'+i+':00' : i+':00'
|
|
|
|
}else{
|
|
|
|
obj.showdur=i<10 ? '0'+Math.floor(i)+':30' : Math.floor(i)+':30'
|
|
|
|
}
|
|
|
|
durlist.push(obj)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
for(let i=starttime;i<=endtime;i+=0.5){
|
|
|
|
let obj={};
|
|
|
|
if(i%1==0){
|
|
...
|
...
|
@@ -63,13 +75,13 @@ Component({ |
|
|
|
}
|
|
|
|
durlist.push(obj)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
durlist:durlist,
|
|
|
|
time:this.data.time=='' ? durlist[0].showdur : this.data.time
|
|
|
|
time:this.data.time=='' ? (durlist.length>0 ? durlist[0].showdur : '暂无可预订时段') : this.data.time
|
|
|
|
})
|
|
|
|
this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'})
|
|
|
|
},
|
|
|
|
//获取具体日期时间段满房状态
|
|
|
|
getroombydate(){
|
...
|
...
|
|