Commit 8c96661c6211fb6cddfb11232270b2f9d212bd3c

Authored by liuxuqinfhp1220
1 parent dc49086e

no message

@@ -83,7 +83,8 @@ Component({ @@ -83,7 +83,8 @@ Component({
83 }) 83 })
84 let obj={ 84 let obj={
85 id:_target.id, 85 id:_target.id,
86 - name:this.data.roomlist[_target.index].name 86 + name:this.data.roomlist[_target.index].name,
  87 + action:'confirm'
87 } 88 }
88 this.triggerEvent('selectroom',obj) 89 this.triggerEvent('selectroom',obj)
89 }else{ 90 }else{
@@ -129,7 +130,17 @@ Component({ @@ -129,7 +130,17 @@ Component({
129 seletroomlist.forEach((v,i)=>{ 130 seletroomlist.forEach((v,i)=>{
130 roomlist.forEach((r,n)=>{ 131 roomlist.forEach((r,n)=>{
131 if(v.id==r.id){ 132 if(v.id==r.id){
132 - r.selectnum+=1; 133 + if(r.isFull || r.isorderFull){
  134 + this.cancelroom(r.id);
  135 + let obj={
  136 + id:r.id,
  137 + name:r.name,
  138 + action:'cancel'
  139 + }
  140 + this.triggerEvent('selectroom',obj)
  141 + }else{
  142 + r.selectnum+=1;
  143 + }
133 } 144 }
134 }) 145 })
135 }) 146 })
@@ -24,7 +24,15 @@ Component({ @@ -24,7 +24,15 @@ Component({
24 console.log(e) 24 console.log(e)
25 let _target=e.detail; 25 let _target=e.detail;
26 let seletroomlist=this.data.seletroomlist; 26 let seletroomlist=this.data.seletroomlist;
27 - seletroomlist.push(_target); 27 + if(e.detail.action=='cancel'){
  28 + seletroomlist.forEach((v,i)=>{
  29 + if(v.id==_target.id){
  30 + seletroomlist.splice(i,1)
  31 + }
  32 + })
  33 + }else{
  34 + seletroomlist.push(_target);
  35 + }
28 this.setData({ 36 this.setData({
29 seletroomlist:this.data.seletroomlist 37 seletroomlist:this.data.seletroomlist
30 }) 38 })
@@ -38,6 +46,7 @@ Component({ @@ -38,6 +46,7 @@ Component({
38 }) 46 })
39 this.room.cancelroom(_target.id); 47 this.room.cancelroom(_target.id);
40 this.triggerEvent('changeroom',{selectroom:this.data.seletroomlist}); 48 this.triggerEvent('changeroom',{selectroom:this.data.seletroomlist});
41 - } 49 + },
  50 +
42 } 51 }
43 }) 52 })