|
...
|
...
|
@@ -122,40 +122,33 @@ Page({ |
|
|
|
suggestion: []
|
|
|
|
})
|
|
|
|
}
|
|
|
|
qqmapsdk.getSuggestion({
|
|
|
|
//获取输入框值并设置keyword参数
|
|
|
|
keyword: e.detail.value, //用户输入的关键词,可设置固定值,如keyword:'KFC'
|
|
|
|
region:this.location.city||'', //设置城市名,限制关键词所示的地域范围,非必填参数
|
|
|
|
//region_fix:1,//锁定在本市
|
|
|
|
//filter:'category<>美食',
|
|
|
|
success: function (res) {//搜索成功后的回调
|
|
|
|
console.log(res);
|
|
|
|
var sug = [];
|
|
|
|
for (var i = 0; i < res.data.length; i++) {
|
|
|
|
sug.push({ // 获取返回结果,放到sug数组中
|
|
|
|
title: res.data[i].title,
|
|
|
|
id: res.data[i].id,
|
|
|
|
addr: res.data[i].address,
|
|
|
|
city: res.data[i].city,
|
|
|
|
district: res.data[i].district,
|
|
|
|
latitude: res.data[i].location.lat,
|
|
|
|
longitude: res.data[i].location.lng
|
|
|
|
});
|
|
|
|
}
|
|
|
|
_this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
|
|
|
|
suggestion: sug
|
|
|
|
});
|
|
|
|
},
|
|
|
|
fail: function (error) {
|
|
|
|
_this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
|
|
|
|
suggestion: []
|
|
|
|
App.Customer.KeywordTips({
|
|
|
|
keyword:this.inputVal,
|
|
|
|
region:this.location.city||'',
|
|
|
|
region_fix:0,
|
|
|
|
location:this.location.latitude+','+this.location.longitude,
|
|
|
|
page_size:20,
|
|
|
|
page_index:1,
|
|
|
|
key:map_key,
|
|
|
|
}).then(res=>{
|
|
|
|
res.data=res.data.data
|
|
|
|
var sug = [];
|
|
|
|
for (var i = 0; i < res.data.length; i++) {
|
|
|
|
sug.push({ // 获取返回结果,放到sug数组中
|
|
|
|
title: res.data[i].title,
|
|
|
|
id: res.data[i].id,
|
|
|
|
addr: res.data[i].address,
|
|
|
|
city: res.data[i].city,
|
|
|
|
district: res.data[i].district,
|
|
|
|
latitude: res.data[i].location.lat,
|
|
|
|
longitude: res.data[i].location.lng,
|
|
|
|
type:res.data[i].type,
|
|
|
|
});
|
|
|
|
console.error(error);
|
|
|
|
},
|
|
|
|
complete: function (res) {
|
|
|
|
console.log('getsuggest',res);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
|
|
|
|
suggestion: sug
|
|
|
|
});
|
|
|
|
})
|
|
|
|
},
|
|
|
|
nearby_search: function () {
|
|
|
|
App.Customer.SearchMap({
|
|
...
|
...
|
@@ -167,7 +160,6 @@ Page({ |
|
|
|
orderby:'_distance',
|
|
|
|
key:map_key,
|
|
|
|
}).then(res=>{
|
|
|
|
console.log('App.Customer.SearchMap',res)
|
|
|
|
res.data=res.data.data
|
|
|
|
var mks = []
|
|
|
|
for (var i = 0; i < res.data.length; i++) {
|
|
...
|
...
|
@@ -192,7 +184,7 @@ Page({ |
|
|
|
this._getPos().then(res => {
|
|
|
|
console.log('wx.getLocation.then', res);
|
|
|
|
this.location=res
|
|
|
|
//this.getCity()
|
|
|
|
this.getCity()
|
|
|
|
}).catch((e) => {
|
|
|
|
console.log('wx.getLocation.catch', e);
|
|
|
|
if ('getLocation:fail auth deny' == e.errMsg || 'getLocation:fail:auth denied' == e.errMsg) {
|
...
|
...
|
|