|
...
|
...
|
@@ -42,6 +42,11 @@ Page({ |
|
|
|
* &keyword=
|
|
|
|
* &filterParams={"consumeStr":"¥200-300","min":"200","max":"300","active":"200,300"}
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
hasSuggestion=1&keyword=橡树湾&lat=39.662877&lng=118.130962¢re_pos=39.662877,118.130962&multiIndex=0&filter={"consumeStr":"¥200-300","min":"200","max":"300","active":"200,300"}&city={"code":"610100","pid":"610000","name":"西安市","status":"1","last_date":"1598949575"}&hows={"params":{"pnum":{"index":3,"val":4,"type":"pnum"},"date":{"index":0,"val":1606983211,"type":"date"},"dur":{"index":2,"val":3,"type":"dur"}},"paramObj":{"when_date":"2020-12-03","several":4,"daily":3},"paramStr":"12月03日(今天) 晚餐 4位"}
|
|
|
|
|
|
|
|
city={"code":"130200","pid":"130000","name":"唐山市","status":"1","last_date":"1598949575"}&hows={"params":{"pnum":{"index":3,"val":4,"type":"pnum"},"date":{"index":0,"val":1606984766,"type":"date"},"dur":{"index":2,"val":3,"type":"dur"}},"paramObj":{"when_date":"2020-12-03","several":4,"daily":3},"paramStr":"12月03日(今天) 晚餐 4位"}
|
|
|
|
*/
|
|
|
|
wx.getSystemInfo({
|
|
|
|
success:res=>{
|
|
|
|
console.log('wx.getSystemInfo',res)
|
|
...
|
...
|
@@ -51,12 +56,25 @@ Page({ |
|
|
|
},
|
|
|
|
})
|
|
|
|
this.filterParams=null
|
|
|
|
if(options.filterParams){
|
|
|
|
this.filterParams=JSON.parse(options.filterParams)
|
|
|
|
if(options.filter){
|
|
|
|
this.filterParams=JSON.parse(options.filter)
|
|
|
|
this.setData({
|
|
|
|
filterParams:this.filterParams,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if(options.city){
|
|
|
|
this.city=JSON.parse(options.city)
|
|
|
|
}
|
|
|
|
if(options.hows){
|
|
|
|
this.hows=JSON.parse(options.hows)
|
|
|
|
let paramStr=this.hows.paramStr.split(" ");
|
|
|
|
this.setData({
|
|
|
|
headerHows:[
|
|
|
|
paramStr[0].substr(0,6),
|
|
|
|
paramStr[1]+' '+paramStr[2],
|
|
|
|
],
|
|
|
|
})
|
|
|
|
}
|
|
|
|
this.options=options;
|
|
|
|
if(options.hasSuggestion){
|
|
|
|
let pos=options.centre_pos.split(',')
|
|
...
|
...
|
@@ -102,7 +120,7 @@ Page({ |
|
|
|
}
|
|
|
|
})
|
|
|
|
}catch(e){}
|
|
|
|
setTimeout(()=>{this.getList()},300)
|
|
|
|
//setTimeout(()=>{this.getList()},300)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
...
|
...
|
@@ -127,6 +145,13 @@ Page({ |
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
if(wx.getMenuButtonBoundingClientRect){
|
|
|
|
let rect=wx.getMenuButtonBoundingClientRect()
|
|
|
|
console.log(rect,getApp().system)
|
|
|
|
this.setData({
|
|
|
|
right:getApp().system.windowWidth - rect.right + rect.width + 10,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -182,64 +207,21 @@ Page({ |
|
|
|
this.setData({
|
|
|
|
hasLoading:true,
|
|
|
|
})
|
|
|
|
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,
|
|
|
|
lng_extend:mapParam.lng,
|
|
|
|
keyword:mapParam.keyword.trim(),
|
|
|
|
offset:this.offset,
|
|
|
|
size:this.size,
|
|
|
|
distance:500000,
|
|
|
|
};
|
|
|
|
if(mapParam.lat){
|
|
|
|
this.param.centre_pos=`${mapParam.lat},${mapParam.lng}`
|
|
|
|
}
|
|
|
|
if(mapParam.isopen_md){
|
|
|
|
this.param.isopen_md=1
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
//计算视窗中心
|
|
|
|
let lat,lng
|
|
|
|
if(this.suggestion){
|
|
|
|
lat=this.suggestion.latitude
|
|
|
|
lng=this.suggestion.longitude
|
|
|
|
this.setData({
|
|
|
|
keyword:this.suggestion.title,
|
|
|
|
})
|
|
|
|
}else if(this.hasCleanSuggestion){//清理地标使用人的位置
|
|
|
|
lat=this.location.latitude
|
|
|
|
lng=this.location.longitude
|
|
|
|
}
|
|
|
|
if(!lat || !lng){//不完整时,使用地图中心点
|
|
|
|
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,
|
|
|
|
lat_extend:mapParam.lat,
|
|
|
|
lng_extend:mapParam.lng,
|
|
|
|
offset:this.offset,
|
|
|
|
size:this.size,
|
|
|
|
distance:50,
|
|
|
|
};
|
|
|
|
if(this.suggestion || this.hasCleanSuggestion){
|
|
|
|
this.param.centre_pos=`${lat},${lng}`
|
|
|
|
}else{
|
|
|
|
if(mapParam.centre_pos){
|
|
|
|
this.param.centre_pos=mapParam.centre_pos
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.param={
|
|
|
|
offset:this.offset,
|
|
|
|
size:this.size,
|
|
|
|
code:this.city.code,
|
|
|
|
pid:this.city.pid,
|
|
|
|
keyword:this.options.keyword||'',
|
|
|
|
...this.hows.paramObj,
|
|
|
|
}
|
|
|
|
console.log('this.location',this.location)
|
|
|
|
if(this.location){
|
|
|
|
this.param.lat_extend=this.location.latitude
|
|
|
|
this.param.lng_extend=this.location.longitude
|
|
|
|
}
|
|
|
|
|
|
|
|
this.hasFilterData=false
|
|
|
|
if(this.filterGroupData.tags){
|
|
|
|
this.param.tags = this.filterGroupData.tags;
|
|
...
|
...
|
@@ -254,7 +236,7 @@ Page({ |
|
|
|
this.hasFilterData=true
|
|
|
|
}
|
|
|
|
|
|
|
|
App.Customer.SellerLists(this.param).then(res=>{
|
|
|
|
App.Customer.GetSellerListByFoods(this.param).then(res=>{
|
|
|
|
this.setData({
|
|
|
|
rsl:[],
|
|
|
|
hasMore:res.data.length==this.size,
|
|
...
|
...
|
@@ -283,7 +265,7 @@ Page({ |
|
|
|
getListMore(){
|
|
|
|
this.param.offset+=1;
|
|
|
|
let sellers=this.data.sellers;
|
|
|
|
App.Customer.SellerLists(this.param).then(res=>{
|
|
|
|
App.Customer.GetSellerListByFoods(this.param).then(res=>{
|
|
|
|
this.setData({
|
|
|
|
hasMore:res.data.length==this.size,
|
|
|
|
sellers:sellers.concat(this.sellerFormat(res.data)),
|
|
...
|
...
|
@@ -384,11 +366,7 @@ Page({ |
|
|
|
onpos(e){
|
|
|
|
console.log('onpos',this.hasGetSellerEnd,e);
|
|
|
|
this.location=e.detail
|
|
|
|
if(!this.hasGetSellerEnd){
|
|
|
|
return setTimeout(()=>{
|
|
|
|
this.onpos(e)
|
|
|
|
},500)
|
|
|
|
}
|
|
|
|
this.getList()
|
|
|
|
// if(this.data.sellers.length<1){
|
|
|
|
// this.GetRecommendSellerList()
|
|
|
|
// }
|
|
...
|
...
|
@@ -513,4 +491,20 @@ Page({ |
|
|
|
this.selectComponent('#as').show(e.detail.seller);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
searchKeyword(){
|
|
|
|
let pages = getCurrentPages();
|
|
|
|
if(pages.length>=2){
|
|
|
|
let p = pages[pages.length - 2];
|
|
|
|
if(p.route=='pages/reserve/searchKeyword') {
|
|
|
|
return wx.navigateBack();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wx.navigateTo({
|
|
|
|
url:util.http_build_query({
|
|
|
|
filter:this.filterParams?JSON.stringify(this.filterParams):null,
|
|
|
|
city:JSON.stringify(this.city),
|
|
|
|
hows:JSON.stringify(this.hows),
|
|
|
|
},'/pages/reserve/searchKeyword')
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|