Commit 5cc5537beee4dd3f4d9e986b0a1a299aef8617d6

Authored by liuxuqinfhp1220
1 parent 2b33f543

时间段组件添加获取后台满房接口数据

... ... @@ -16,15 +16,9 @@ Component({
}
},
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;
... ... @@ -33,6 +27,7 @@ Component({
date:date.getFullYear()+'-'+(currentmonth<10 ? '0'+currentmonth : currentmonth)+'-'+(currentdate<10 ? '0'+currentdate : currentdate)
})
}
this.getroombydate();
this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'})
},
methods:{
... ... @@ -41,9 +36,14 @@ Component({
this.triggerEvent('selecttime',{time:target.time,action:'click'})
},
//获得默认所有可订时间段
getdurlist(){
getdurlist(houseFull){
let currenttimemark=date.getHours()+new Date().getMinutes()/60;
let timedur=this.data.seller.daily;
for(let key in houseFull){
if(houseFull[key]==1){
delete timedur[key];
}
}
let durlist=[];
for(let key in timedur){
let arr=timedur[key].split('-');
... ... @@ -67,13 +67,24 @@ Component({
}
this.setData({
durlist:durlist
durlist:durlist,
time:this.data.time=='' ? durlist[0].showdur : this.data.time
})
},
//获取具体日期时间段满房状态
getroombydate(){
//参数:date:'2019-07-24' sid:1
let parmdata={
date:this.data.date,
sid:this.data.seller.id
}
App.Customer.GetHouseFullDateTimes(parmdata).then((json)=>{
console.log(json)
if(json.ret==200){
let houseFull=JSON.parse(json.data);
this.getdurlist(houseFull);
}
})
},
}
})
\ No newline at end of file
... ...
... ... @@ -273,5 +273,8 @@ export default {
'App.Other.generate_qrcode':{
host: 'https://cli.im/mina/',
alias:'generate_qrcode'
}
},
//获取营业时间段满房接口
'App.Customer.GetHouseFullDateTimes':null
}
\ No newline at end of file
... ...