Commit 2b33f54331efdce236a2b6648bedecb3bce6527d

Authored by liuxuqinfhp1220
1 parent 302ef50a

no message

Showing 1 changed file with 27 additions and 6 deletions
//获取当前时间
const date=new Date();
import App from '../../../utils/api';
Component({
properties:{
timedur:Object,
seller:Object,
//时间段
time:{
type:String,
value:''
},
//日期
date:{
type:String,
value:''
}
},
attached(){
this.getdurlist();
},
ready(){
//设置默认时间段
if(this.data.time==''){
this.setData({
time:this.data.durlist[0].showdur
})
}
//设置默认日期
if(this.data.date==''){
let currentmonth=date.getMonth()+1;
let currentdate=date.getDate();
this.setData({
date:date.getFullYear()+'-'+(currentmonth<10 ? '0'+currentmonth : currentmonth)+'-'+(currentdate<10 ? '0'+currentdate : currentdate)
})
}
this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'})
},
methods:{
... ... @@ -22,12 +40,10 @@ Component({
const target=e.currentTarget.dataset;
this.triggerEvent('selecttime',{time:target.time,action:'click'})
},
//获得可订时间段
//获得默认所有可订时间段
getdurlist(){
//获取当前时间
const date=new Date();
let currenttimemark=date.getHours()+new Date().getMinutes()/60;
let timedur=this.data.timedur;
let timedur=this.data.seller.daily;
let durlist=[];
for(let key in timedur){
let arr=timedur[key].split('-');
... ... @@ -53,6 +69,11 @@ Component({
this.setData({
durlist:durlist
})
}
},
//获取具体日期时间段满房状态
getroombydate(){
//参数:date:'2019-07-24' sid:1
},
}
})
\ No newline at end of file
... ...