Commit 2b33f54331efdce236a2b6648bedecb3bce6527d

Authored by liuxuqinfhp1220
1 parent 302ef50a

no message

Showing 1 changed file with 27 additions and 6 deletions
  1 +//获取当前时间
  2 +const date=new Date();
  3 +import App from '../../../utils/api';
1 Component({ 4 Component({
2 properties:{ 5 properties:{
3 - timedur:Object, 6 + seller:Object,
  7 + //时间段
4 time:{ 8 time:{
5 type:String, 9 type:String,
6 value:'' 10 value:''
  11 + },
  12 + //日期
  13 + date:{
  14 + type:String,
  15 + value:''
7 } 16 }
8 }, 17 },
9 attached(){ 18 attached(){
10 this.getdurlist(); 19 this.getdurlist();
11 }, 20 },
12 ready(){ 21 ready(){
  22 + //设置默认时间段
13 if(this.data.time==''){ 23 if(this.data.time==''){
14 this.setData({ 24 this.setData({
15 time:this.data.durlist[0].showdur 25 time:this.data.durlist[0].showdur
16 }) 26 })
17 } 27 }
  28 + //设置默认日期
  29 + if(this.data.date==''){
  30 + let currentmonth=date.getMonth()+1;
  31 + let currentdate=date.getDate();
  32 + this.setData({
  33 + date:date.getFullYear()+'-'+(currentmonth<10 ? '0'+currentmonth : currentmonth)+'-'+(currentdate<10 ? '0'+currentdate : currentdate)
  34 + })
  35 + }
18 this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'}) 36 this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'})
19 }, 37 },
20 methods:{ 38 methods:{
@@ -22,12 +40,10 @@ Component({ @@ -22,12 +40,10 @@ Component({
22 const target=e.currentTarget.dataset; 40 const target=e.currentTarget.dataset;
23 this.triggerEvent('selecttime',{time:target.time,action:'click'}) 41 this.triggerEvent('selecttime',{time:target.time,action:'click'})
24 }, 42 },
25 - //获得可订时间段 43 + //获得默认所有可订时间段
26 getdurlist(){ 44 getdurlist(){
27 - //获取当前时间  
28 - const date=new Date();  
29 let currenttimemark=date.getHours()+new Date().getMinutes()/60; 45 let currenttimemark=date.getHours()+new Date().getMinutes()/60;
30 - let timedur=this.data.timedur; 46 + let timedur=this.data.seller.daily;
31 let durlist=[]; 47 let durlist=[];
32 for(let key in timedur){ 48 for(let key in timedur){
33 let arr=timedur[key].split('-'); 49 let arr=timedur[key].split('-');
@@ -53,6 +69,11 @@ Component({ @@ -53,6 +69,11 @@ Component({
53 this.setData({ 69 this.setData({
54 durlist:durlist 70 durlist:durlist
55 }) 71 })
56 - } 72 + },
  73 + //获取具体日期时间段满房状态
  74 + getroombydate(){
  75 + //参数:date:'2019-07-24' sid:1
  76 +
  77 + },
57 } 78 }
58 }) 79 })