|
...
|
...
|
@@ -22,6 +22,7 @@ Page({ |
|
|
|
hasDisabled:true,
|
|
|
|
hasSuggestion:false,
|
|
|
|
placeholder:'您好,几位,什么时候',
|
|
|
|
search_placeholder:"搜索餐厅/位置,快速订包间",
|
|
|
|
hasLoading:true,
|
|
|
|
},
|
|
|
|
|
|
...
|
...
|
@@ -69,6 +70,7 @@ Page({ |
|
|
|
})
|
|
|
|
}catch(e){}
|
|
|
|
setTimeout(()=>{this.getList()},300)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -82,7 +84,15 @@ Page({ |
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow: function () {
|
|
|
|
|
|
|
|
PubSub.on(
|
|
|
|
'searchParamList',
|
|
|
|
data=>{
|
|
|
|
console.log('searchParamList.msg',data)
|
|
|
|
if(data.fun=='setSuggestion'){
|
|
|
|
this.setSuggestion(data.suggestion);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -96,7 +106,7 @@ Page({ |
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload: function () {
|
|
|
|
|
|
|
|
PubSub.off('searchParamList')
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -117,6 +127,9 @@ Page({ |
|
|
|
let mapParam=this.options
|
|
|
|
this.offset=1 //page
|
|
|
|
this.size=20 //page size
|
|
|
|
this.setData({
|
|
|
|
keyword:mapParam.keyword||'',
|
|
|
|
})
|
|
|
|
if(mapParam.keyword){
|
|
|
|
this.param={
|
|
|
|
lat_extend:mapParam.lat,
|
|
...
|
...
|
@@ -134,9 +147,18 @@ Page({ |
|
|
|
}
|
|
|
|
}else{
|
|
|
|
//计算视窗中心
|
|
|
|
let map=JSON.parse(mapParam.map);
|
|
|
|
let lat=map.northeast.latitude-(map.northeast.latitude-map.southwest.latitude)/2;
|
|
|
|
let lng=map.northeast.longitude-(map.northeast.longitude-map.southwest.longitude)/2;
|
|
|
|
let lat,lng
|
|
|
|
if(this.suggestion){
|
|
|
|
lat=this.suggestion.latitude
|
|
|
|
lng=this.suggestion.longitude
|
|
|
|
this.setData({
|
|
|
|
keyword:this.suggestion.title,
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
let map=JSON.parse(mapParam.map);
|
|
|
|
lat=map.northeast.latitude-(map.northeast.latitude-map.southwest.latitude)/2;
|
|
|
|
lng=map.northeast.longitude-(map.northeast.longitude-map.southwest.longitude)/2;
|
|
|
|
}
|
|
|
|
this.param={
|
|
|
|
lat:lat,
|
|
|
|
lng:lng,
|
|
...
|
...
|
@@ -146,8 +168,12 @@ Page({ |
|
|
|
size:this.size,
|
|
|
|
distance:50,
|
|
|
|
};
|
|
|
|
if(mapParam.centre_pos){
|
|
|
|
this.param.centre_pos=mapParam.centre_pos
|
|
|
|
if(this.suggestion){
|
|
|
|
this.param.centre_pos=`${lat},${lng}`
|
|
|
|
}else{
|
|
|
|
if(mapParam.centre_pos){
|
|
|
|
this.param.centre_pos=mapParam.centre_pos
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -350,4 +376,25 @@ Page({ |
|
|
|
this.selectComponent('#as').show(e.detail.seller);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
gotoSearch(e){
|
|
|
|
let pages = getCurrentPages();
|
|
|
|
if(pages.length>1){
|
|
|
|
let p = pages[pages.length - 2];
|
|
|
|
if(p.route=='pages/reserve/search'){
|
|
|
|
return wx.navigateBack();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wx.navigateTo({
|
|
|
|
url:'/pages/reserve/search',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
suggestion:null,
|
|
|
|
setSuggestion(suggestion){
|
|
|
|
this.suggestion=suggestion
|
|
|
|
this.setData({
|
|
|
|
suggestion:suggestion,
|
|
|
|
hasSuggestion:true,
|
|
|
|
})
|
|
|
|
this.getList()
|
|
|
|
},
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|