room.js
1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import App from '../../../utils/api';
import util from '../../../utils/util';
Component({
properties:{
seller:Object,
date:{
type:String,
value:util.unixtoTime(new Date()/1000,'YYYY-MM-DD')
},
section:String,
seletroom:{
type:Array,
value:[]
}
},
data:{
roomlist:[
{
id:1,
name:'6人间',
mostpnum:8,
lastmoney:3000,
isfull:0,
selectnum:0,
},
{
id:2,
name:'8人间',
mostpnum:8,
lastmoney:3000,
isfull:1,
selectnum:0,
},
{
id:3,
name:'10人间',
mostpnum:8,
lastmoney:3000,
isfull:0,
selectnum:0,
},
{
id:4,
name:'16人间',
mostpnum:8,
lastmoney:3000,
isfull:0,
selectnum:0,
}
]
},
methods:{
getroomtype(){
},
selectroom(e){
let _target=e.currentTarget.dataset;
console.log(typeof _target.selectnum)
let setkey='roomlist['+_target.index+'].selectnum';
this.setData({
[setkey]:_target.selectnum+1
})
this.triggerEvent('selectroom',this.data.roomlist[_target.index])
},
cancelroom(id){
let roomlist=this.data.roomlist;
roomlist.forEach((v,i)=>{
if(v.id==id){
let setkey='roomlist['+i+'].selectnum';
this.setData({
[setkey]:v.selectnum-1,
})
}
})
},
}
})