menu.js
1.65 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import App from '../../utils/api';
import util from '../../utils/util'
Component({
data:{
menuhidden:true,
url:'pages/reserve/index_new',
},
attached: function() {
this.setStatus();
this.getuser();
this.getautomenu();
this.getorder();
},
methods:{
getuser(){
App.User.GetBalance().then(res=>{
this.setData({
user:res.data
})
})
},
getorder(){
App.Reserve.GetReserveIsConsume().then((json)=>{
if(json.ret==200){
console.log('787878',json.data)
this.setData({
haveorder:json.data.is_customer==1 || json.data.is_manager==1
})
}
})
},
getautomenu(){
App.Foodset.GetUserFoodOrders({
status:2,//tabType,
openid: getApp().openid,
offset:1,
limit:1,
size:1,
}).then(res=>{
console.log(res)
if(res.data.length>0){
this.setData({
shownotice:true
})
}
})
},
showmenu(){
this.setData({
menuhidden:false
})
},
hidemenu(){
this.setData({
menuhidden:true
})
},
topage(e){
let url=e.currentTarget.dataset.path;
wx.navigateTo({
url:url
})
},
topagerelunch(e){
let url=e.currentTarget.dataset.path;
wx.reLaunch({
url:url
})
},
tosearch(e){
let url=e.currentTarget.dataset.path;
wx.navigateTo({
url:url
})
},
gotoList(e){
getApp().meListType=e.currentTarget.dataset.type;
wx.redirectTo({
url:'/pages/me/list?type='+e.currentTarget.dataset.type
})
},
setStatus(){
let pages = getCurrentPages();
let p = pages[pages.length - 1];
console.log('custom-tab-bar.setStatus',p.route)
this.setData({
url:p.route,
})
},
}
})