Showing
1 changed file
with
18 additions
and
18 deletions
| @@ -55,26 +55,12 @@ Component({ | @@ -55,26 +55,12 @@ Component({ | ||
| 55 | if(currenttimemark+0.5>starttime){ | 55 | if(currenttimemark+0.5>starttime){ |
| 56 | starttime=Math.round(currenttimemark)+0.5; | 56 | starttime=Math.round(currenttimemark)+0.5; |
| 57 | } | 57 | } |
| 58 | - for(let i=starttime;i<=endtime;i+=0.5){ | ||
| 59 | - let obj={}; | ||
| 60 | - if(i%1==0){ | ||
| 61 | - obj.showdur=i<10 ? '0'+i+':00' : i+':00' | ||
| 62 | - }else{ | ||
| 63 | - obj.showdur=i<10 ? '0'+Math.floor(i)+':30' : Math.floor(i)+':30' | ||
| 64 | - } | ||
| 65 | - durlist.push(obj) | ||
| 66 | - } | 58 | + let thisdurlist=this.getsinglelist(starttime,endtime) |
| 59 | + durlist=durlist.concat(thisdurlist) | ||
| 67 | } | 60 | } |
| 68 | }else{ | 61 | }else{ |
| 69 | - for(let i=starttime;i<=endtime;i+=0.5){ | ||
| 70 | - let obj={}; | ||
| 71 | - if(i%1==0){ | ||
| 72 | - obj.showdur=i<10 ? '0'+i+':00' : i+':00' | ||
| 73 | - }else{ | ||
| 74 | - obj.showdur=i<10 ? '0'+Math.floor(i)+':30' : Math.floor(i)+':30' | ||
| 75 | - } | ||
| 76 | - durlist.push(obj) | ||
| 77 | - } | 62 | + let thisdurlist=this.getsinglelist(starttime,endtime); |
| 63 | + durlist=durlist.concat(thisdurlist) | ||
| 78 | } | 64 | } |
| 79 | } | 65 | } |
| 80 | this.setData({ | 66 | this.setData({ |
| @@ -83,6 +69,20 @@ Component({ | @@ -83,6 +69,20 @@ Component({ | ||
| 83 | }) | 69 | }) |
| 84 | this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'}) | 70 | this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'}) |
| 85 | }, | 71 | }, |
| 72 | + //获取每个时段的时间列表 | ||
| 73 | + getsinglelist(starttime,endtime){ | ||
| 74 | + let singledurlist=[]; | ||
| 75 | + for(let i=starttime;i<=endtime;i+=0.5){ | ||
| 76 | + let obj={}; | ||
| 77 | + if(i%1==0){ | ||
| 78 | + obj.showdur=i<10 ? '0'+i+':00' : i+':00' | ||
| 79 | + }else{ | ||
| 80 | + obj.showdur=i<10 ? '0'+Math.floor(i)+':30' : Math.floor(i)+':30' | ||
| 81 | + } | ||
| 82 | + singledurlist.push(obj) | ||
| 83 | + } | ||
| 84 | + return singledurlist; | ||
| 85 | + }, | ||
| 86 | //获取具体日期时间段满房状态 | 86 | //获取具体日期时间段满房状态 |
| 87 | getroombydate(){ | 87 | getroombydate(){ |
| 88 | //参数:date:'2019-07-24' sid:1 | 88 | //参数:date:'2019-07-24' sid:1 |
-
Please register or login to post a comment