You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

68 lines
1.6 KiB

const app = getApp();
Page({
data: {
time_type:0,
upperbound:null,
lowerbound:null,
userInfo: {},
hasUserInfo: false,
detailedmenu:null,
loading:true
},
onLoad:function(options){
var time_type
this.setData({
upperbound:Number(options.upperbound),
lowerbound:Number(options.lowerbound),
})
if (this.data.upperbound == 30){
time_type = 0
}
if (this.data.upperbound == 60){
time_type = 1
}
if (this.data.upperbound == 9999){
time_type = 2
}
this.setData({
time_type:time_type,
})
},
get_menu(){
var that = this
wx.cloud.callContainer({
"config": {
"env": "prod-2g058voqbea31ecb"
},
"path": "menu/menus/",
"header": {
"X-WX-SERVICE": "django-5198",
'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
},
"method": "GET",
data:{upper_bound:that.data.upperbound,lower_bound:that.data.lowerbound},
success(res){
let arr = app.parse_json(res)
that.setData({
detailedmenu:arr,
loading:false
})
}
})
},
onShow(){
this.get_menu()
},
onTapMenu(e){
var item = JSON.stringify(e.currentTarget.dataset.product)
wx.navigateTo({
url: '../menu/menu?item='+item
})
},
back(){
wx.navigateBack({
delta: 0,
})
},
})