|
1
|
Component({
|
1
|
Component({
|
|
2
|
properties:{
|
2
|
properties:{
|
|
3
|
- timedur:Object
|
3
|
+ timedur:Object,
|
|
|
|
4
|
+ time:{
|
|
|
|
5
|
+ type:String,
|
|
|
|
6
|
+ value:''
|
|
|
|
7
|
+ }
|
|
4
|
},
|
8
|
},
|
|
5
|
attached(){
|
9
|
attached(){
|
|
6
|
this.getdurlist();
|
10
|
this.getdurlist();
|
|
7
|
},
|
11
|
},
|
|
8
|
ready(){
|
12
|
ready(){
|
|
9
|
-
|
13
|
+ if(this.data.time==''){
|
|
|
|
14
|
+ this.setData({
|
|
|
|
15
|
+ time:this.data.durlist[0].showdur
|
|
|
|
16
|
+ })
|
|
|
|
17
|
+ }
|
|
|
|
18
|
+ this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'})
|
|
10
|
},
|
19
|
},
|
|
11
|
methods:{
|
20
|
methods:{
|
|
12
|
selecttime(e){
|
21
|
selecttime(e){
|
|
13
|
const target=e.currentTarget.dataset;
|
22
|
const target=e.currentTarget.dataset;
|
|
14
|
-
|
23
|
+ this.triggerEvent('selecttime',{time:target.time,action:'click'})
|
|
15
|
},
|
24
|
},
|
|
16
|
//获得可订时间段
|
25
|
//获得可订时间段
|
|
17
|
getdurlist(){
|
26
|
getdurlist(){
|
|
@@ -30,9 +39,7 @@ Component({ |
|
@@ -30,9 +39,7 @@ Component({ |
|
30
|
starttime=Math.round(currenttimemark)
|
39
|
starttime=Math.round(currenttimemark)
|
|
31
|
}
|
40
|
}
|
|
32
|
for(let i=starttime;i<=endtime;i+=0.5){
|
41
|
for(let i=starttime;i<=endtime;i+=0.5){
|
|
33
|
- let obj={
|
|
|
|
34
|
- timemark:i
|
|
|
|
35
|
- }
|
42
|
+ let obj={};
|
|
36
|
if(i%1==0){
|
43
|
if(i%1==0){
|
|
37
|
obj.showdur=i<10 ? '0'+i+':00' : i+':00'
|
44
|
obj.showdur=i<10 ? '0'+i+':00' : i+':00'
|
|
38
|
}else{
|
45
|
}else{
|