b_desk.js
2.27 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 util from '../../utils/util';
import comm from '../../utils/bookCommon';
import App from '../../utils/api';
const {regeneratorRuntime} = global
Page({
data:{
menu_active_id:''
},
checked_tids:[],
onLoad:function(opt){
console.log('onLoad',opt)
util.setBarTitle('选择桌位');
var radio=750/util.getsystem().windowWidth;
var contentHeight=util.getsystem().windowHeight-Math.ceil(350/radio);
if(opt.tid==0){
delete opt.tid
}
if(opt.checked_tids){
this.checked_tids=opt.checked_tids.split(',')
util.cache('tableid',this.checked_tids)
}
this.setData({
sellerid:util.cache('sellerid'),
opt:opt,
hasCheckedTable:this.checked_tids.length>0
})
this.getdesklist();
},
onShow:function(){
this.setData({
height:getApp().system.windowHeight-55
})
},
changedesk:function(e){
let tableid=util.cache('tableid');
this.checked_tids= tableid && tableid.length>0?tableid:[];
this.setData({
hasCheckedTable:this.checked_tids.length>0
})
},
back:function(){
this.setData({
buttonClick:true
})
//wx.removeStorage({key:'tableid'})
wx.navigateBack();
},
getdesklist:function(){
var formdata=this.data.opt;
formdata.sid=this.data.sellerid;
var that=this;
App.Reserve.GetTableList(formdata).then(function (json) {
if(json.ret==200){
console.log('this.checked_tids',that.checked_tids);
if(json.data.length>0){
json.data.forEach(function(v,i){
v.list.forEach(function(r,n){
r.isselect=false
if(that.checked_tids._indexOf(r.id)>-1){
r.isselect=true;
}
})
})
}
that.setData({
desklist:json.data,
menu_active_id:json.data[0].name
})
}
})
},
switchMenu(e){
this.setData({
menu_active_id:util.attr(e,'id')
})
},
})