Commit c08ab2a4a9d41968461ed967c17b4ce814219c45

Authored by vking
2 parents 1b5ac496 3e072ab5

Merge remote-tracking branch 'origin/master'

Showing 1 changed file with 18 additions and 3 deletions
@@ -35,6 +35,9 @@ Component({ @@ -35,6 +35,9 @@ Component({
35 methods:{ 35 methods:{
36 selecttime(e){ 36 selecttime(e){
37 const target=e.currentTarget.dataset; 37 const target=e.currentTarget.dataset;
  38 + this.setData({
  39 + time:target.time
  40 + })
38 this.triggerEvent('selecttime',{time:target.time,action:'click'}) 41 this.triggerEvent('selecttime',{time:target.time,action:'click'})
39 }, 42 },
40 //获得默认所有可订时间段 43 //获得默认所有可订时间段
@@ -70,14 +73,26 @@ Component({ @@ -70,14 +73,26 @@ Component({
70 list:[] 73 list:[]
71 }) 74 })
72 } 75 }
  76 + let time='',current=0;
73 durlist.forEach((v,i)=>{ 77 durlist.forEach((v,i)=>{
74 let thiscurrent=Math.floor(i/5); 78 let thiscurrent=Math.floor(i/5);
75 - duritem[thiscurrent].list.push(v) 79 + duritem[thiscurrent].list.push(v);
  80 + if(this.data.time==''){
  81 + time=duritem[0].list[0].showdur
  82 + }else{
  83 + if(this.data.time==v.showdur){
  84 + time=v.showdur;
  85 + current=thiscurrent;
  86 + }else{
  87 + time=duritem[0].list[0].showdur
  88 + }
  89 + }
76 }) 90 })
  91 + console.log(this.data.time);
77 this.setData({ 92 this.setData({
78 durlist:duritem, 93 durlist:duritem,
79 - time:durlist.length>0 ? duritem[0].list[0].showdur : '',  
80 - current:0 94 + time:time,
  95 + current:current
81 }) 96 })
82 this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'}) 97 this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'})
83 }, 98 },