select-room.js
976 Bytes
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
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,
seletroomlist:{
type:Array,
value:[]
}
},
data:{
},
attached(){
this.room=this.selectComponent('#room');
console.log('xxxxx',this.data.seller);
},
methods:{
selectroom(e){
console.log(e)
let _target=e.detail;
let seletroomlist=this.data.seletroomlist;
seletroomlist.push(_target);
this.setData({
seletroomlist:this.data.seletroomlist
})
this.triggerEvent('changeroom',{selectroom:this.data.seletroomlist})
},
cancelroom(e){
let _target=e.currentTarget.dataset;
this.data.seletroomlist.splice(_target.index,1);
this.setData({
seletroomlist:this.data.seletroomlist
})
this.room.cancelroom(_target.id);
this.triggerEvent('changeroom',{selectroom:this.data.seletroomlist});
}
}
})