Commit 5cc5537beee4dd3f4d9e986b0a1a299aef8617d6

Authored by liuxuqinfhp1220
1 parent 2b33f543

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

@@ -16,15 +16,9 @@ Component({ @@ -16,15 +16,9 @@ Component({
16 } 16 }
17 }, 17 },
18 attached(){ 18 attached(){
19 - this.getdurlist(); 19 +
20 }, 20 },
21 ready(){ 21 ready(){
22 - //设置默认时间段  
23 - if(this.data.time==''){  
24 - this.setData({  
25 - time:this.data.durlist[0].showdur  
26 - })  
27 - }  
28 //设置默认日期 22 //设置默认日期
29 if(this.data.date==''){ 23 if(this.data.date==''){
30 let currentmonth=date.getMonth()+1; 24 let currentmonth=date.getMonth()+1;
@@ -33,6 +27,7 @@ Component({ @@ -33,6 +27,7 @@ Component({
33 date:date.getFullYear()+'-'+(currentmonth<10 ? '0'+currentmonth : currentmonth)+'-'+(currentdate<10 ? '0'+currentdate : currentdate) 27 date:date.getFullYear()+'-'+(currentmonth<10 ? '0'+currentmonth : currentmonth)+'-'+(currentdate<10 ? '0'+currentdate : currentdate)
34 }) 28 })
35 } 29 }
  30 + this.getroombydate();
36 this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'}) 31 this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'})
37 }, 32 },
38 methods:{ 33 methods:{
@@ -41,9 +36,14 @@ Component({ @@ -41,9 +36,14 @@ Component({
41 this.triggerEvent('selecttime',{time:target.time,action:'click'}) 36 this.triggerEvent('selecttime',{time:target.time,action:'click'})
42 }, 37 },
43 //获得默认所有可订时间段 38 //获得默认所有可订时间段
44 - getdurlist(){ 39 + getdurlist(houseFull){
45 let currenttimemark=date.getHours()+new Date().getMinutes()/60; 40 let currenttimemark=date.getHours()+new Date().getMinutes()/60;
46 let timedur=this.data.seller.daily; 41 let timedur=this.data.seller.daily;
  42 + for(let key in houseFull){
  43 + if(houseFull[key]==1){
  44 + delete timedur[key];
  45 + }
  46 + }
47 let durlist=[]; 47 let durlist=[];
48 for(let key in timedur){ 48 for(let key in timedur){
49 let arr=timedur[key].split('-'); 49 let arr=timedur[key].split('-');
@@ -67,13 +67,24 @@ Component({ @@ -67,13 +67,24 @@ Component({
67 67
68 } 68 }
69 this.setData({ 69 this.setData({
70 - durlist:durlist 70 + durlist:durlist,
  71 + time:this.data.time=='' ? durlist[0].showdur : this.data.time
71 }) 72 })
72 }, 73 },
73 //获取具体日期时间段满房状态 74 //获取具体日期时间段满房状态
74 getroombydate(){ 75 getroombydate(){
75 //参数:date:'2019-07-24' sid:1 76 //参数:date:'2019-07-24' sid:1
76 - 77 + let parmdata={
  78 + date:this.data.date,
  79 + sid:this.data.seller.id
  80 + }
  81 + App.Customer.GetHouseFullDateTimes(parmdata).then((json)=>{
  82 + console.log(json)
  83 + if(json.ret==200){
  84 + let houseFull=JSON.parse(json.data);
  85 + this.getdurlist(houseFull);
  86 + }
  87 + })
77 }, 88 },
78 } 89 }
79 }) 90 })
@@ -273,5 +273,8 @@ export default { @@ -273,5 +273,8 @@ export default {
273 'App.Other.generate_qrcode':{ 273 'App.Other.generate_qrcode':{
274 host: 'https://cli.im/mina/', 274 host: 'https://cli.im/mina/',
275 alias:'generate_qrcode' 275 alias:'generate_qrcode'
276 - } 276 + },
  277 +
  278 + //获取营业时间段满房接口
  279 + 'App.Customer.GetHouseFullDateTimes':null
277 } 280 }