|
...
|
...
|
@@ -42,6 +42,13 @@ 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位"}
|
|
|
|
|
|
|
|
lat=39.65157&lng=118.15044&keyword=1&multiIndex=0&city={"code":"130200","pid":"130000","name":"唐山市","status":"1","last_date":"1598949575"}&hows={"params":{"pnum":{"index":5,"val":6,"type":"pnum"},"date":{"index":1,"val":1607399207,"type":"date"},"dur":{"index":2,"val":3,"type":"dur"}},"paramObj":{"when_date":"2020-12-08","several":6,"daily":3},"paramStr":"12月08日(明天) 晚餐 6位"}&filter={"consumeStr":"¥101-220","min":"101","max":"220","active":"101,220"}
|
|
|
|
|
|
|
|
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,11 +58,28 @@ 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,
|
|
|
|
})
|
|
|
|
this.filterGroupData.average=this.filterParams.active
|
|
|
|
}
|
|
|
|
if(options.city){
|
|
|
|
this.city=JSON.parse(options.city)
|
|
|
|
}
|
|
|
|
this.findSellerData=null
|
|
|
|
if(options.hows){
|
|
|
|
this.findSellerData=JSON.parse(options.hows)
|
|
|
|
let paramStr=this.findSellerData.paramStr.split(" ");
|
|
|
|
this.setData({
|
|
|
|
findSellerData:this.findSellerData,
|
|
|
|
headerHows:[
|
|
|
|
paramStr[0].substr(0,6),
|
|
|
|
paramStr[1]+' '+paramStr[2],
|
|
|
|
],
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
this.options=options;
|
|
|
|
if(options.hasSuggestion){
|
|
...
|
...
|
@@ -67,9 +91,14 @@ Page({ |
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
hasSuggestion:true,
|
|
|
|
suggestion:this.suggestion
|
|
|
|
suggestion:this.suggestion,
|
|
|
|
keyword:this.options.keyword,
|
|
|
|
})
|
|
|
|
delete this.options.keyword
|
|
|
|
}else if(this.options.keyword){
|
|
|
|
this.setData({
|
|
|
|
keyword:options.keyword,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
let tags=[
|
|
|
|
{id:1,name:'环境好'},
|
|
...
|
...
|
@@ -102,7 +131,7 @@ Page({ |
|
|
|
}
|
|
|
|
})
|
|
|
|
}catch(e){}
|
|
|
|
setTimeout(()=>{this.getList()},300)
|
|
|
|
//setTimeout(()=>{this.getList()},300)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
...
|
...
|
@@ -127,6 +156,14 @@ Page({ |
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
if(wx.getMenuButtonBoundingClientRect){
|
|
|
|
let rect=wx.getMenuButtonBoundingClientRect()
|
|
|
|
console.log(rect,getApp().system)
|
|
|
|
this.setData({
|
|
|
|
right:getApp().system.windowWidth - rect.right + rect.width + 10,
|
|
|
|
top:rect.top+(rect.height/2-20),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -182,69 +219,30 @@ 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.findSellerData.paramObj,
|
|
|
|
}
|
|
|
|
console.log('this.location',this.location)
|
|
|
|
if(this.suggestion){
|
|
|
|
this.param.lat_extend=this.suggestion.latitude
|
|
|
|
this.param.lng_extend=this.suggestion.longitude
|
|
|
|
}else 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;
|
|
|
|
this.hasFilterData=true
|
|
|
|
}
|
|
|
|
console.log('this.filterGroupData',this.filterGroupData)
|
|
|
|
if (this.filterGroupData.cuisine) {
|
|
|
|
this.param.cuisine = this.filterGroupData.cuisine;
|
|
|
|
this.hasFilterData=true
|
|
...
|
...
|
@@ -254,7 +252,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,
|
|
...
|
...
|
@@ -265,9 +263,11 @@ Page({ |
|
|
|
})
|
|
|
|
this.hasGetSellerEnd=true
|
|
|
|
this.triggerEvent('event',{type:'getListEnd',total:res.data.length})
|
|
|
|
/*
|
|
|
|
if(res.data.length==0 && this.offset==1 && this.location){
|
|
|
|
this.onpos({detail:this.location})
|
|
|
|
this.GetRecommendSellerList()
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
...
|
...
|
@@ -283,7 +283,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)),
|
|
...
|
...
|
@@ -372,10 +372,15 @@ Page({ |
|
|
|
this.selectComponent('#search-how').show();
|
|
|
|
},
|
|
|
|
howEvent(e){
|
|
|
|
this.eventChannel.emit('findSellerData',e.detail)
|
|
|
|
//this.eventChannel.emit('findSellerData',e.detail)
|
|
|
|
this.findSellerData=e.detail
|
|
|
|
let paramStr=this.findSellerData.paramStr.split(" ");
|
|
|
|
this.setData({
|
|
|
|
findSellerData:e.detail
|
|
|
|
findSellerData:e.detail,
|
|
|
|
headerHows:[
|
|
|
|
paramStr[0].substr(0,6),
|
|
|
|
paramStr[1]+' '+paramStr[2],
|
|
|
|
],
|
|
|
|
})
|
|
|
|
setTimeout(()=>{this.getList();},0)
|
|
|
|
this.selectComponent('#search-how').hide();
|
|
...
|
...
|
@@ -384,11 +389,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()
|
|
|
|
// }
|
|
...
|
...
|
@@ -450,19 +451,12 @@ Page({ |
|
|
|
this.getList()
|
|
|
|
},
|
|
|
|
moveToLocation(){
|
|
|
|
if(!this.location || !this.location.latitude || !this.location.longitude){
|
|
|
|
this.selectComponent('#getpos').getPos(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
delete this.options.keyword
|
|
|
|
this.suggestion=null
|
|
|
|
this.hasCleanSuggestion=true
|
|
|
|
this.setData({
|
|
|
|
suggestion:null,
|
|
|
|
hasSuggestion:false,
|
|
|
|
keyword:'',
|
|
|
|
})
|
|
|
|
//PubSub.emit('searchParam', {fun:'moveToLocation'})
|
|
|
|
setTimeout(()=>{this.getList()},0)
|
|
|
|
this.selectComponent('#getpos').getPos();
|
|
|
|
},
|
|
|
|
filterShow(){
|
|
|
|
this.selectComponent('#filter').show(this.filterParams);
|
|
...
|
...
|
@@ -513,4 +507,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.findSellerData),
|
|
|
|
},'/pages/reserve/searchKeyword')
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|