|
...
|
...
|
@@ -26,7 +26,7 @@ Page({ |
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function (options) {
|
|
|
|
this.getPos()
|
|
|
|
this.selectComponent('#getpos').getPos();
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -109,15 +109,18 @@ Page({ |
|
|
|
keyword:''
|
|
|
|
})
|
|
|
|
}
|
|
|
|
App.Customer.KeywordTips({
|
|
|
|
let prarms={
|
|
|
|
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=>{
|
|
|
|
}
|
|
|
|
if(this.location.latitude){
|
|
|
|
prarms.location=this.location.latitude+','+this.location.longitude
|
|
|
|
}
|
|
|
|
App.Customer.KeywordTips(prarms).then(res=>{
|
|
|
|
if(this.inputVal.length<1){
|
|
|
|
return this.setData({
|
|
|
|
suggestion: []
|
|
...
|
...
|
@@ -183,42 +186,11 @@ Page({ |
|
|
|
})
|
|
|
|
},
|
|
|
|
location:'',
|
|
|
|
getPos(){
|
|
|
|
this._getPos().then(res => {
|
|
|
|
console.log('wx.getLocation.then', res);
|
|
|
|
this.location=res
|
|
|
|
this.getCity()
|
|
|
|
this.GetRecommendSellerLists()
|
|
|
|
}).catch((e) => {
|
|
|
|
console.log('wx.getLocation.catch', e);
|
|
|
|
if ('getLocation:fail auth deny' == e.errMsg || 'getLocation:fail:auth denied' == e.errMsg) {
|
|
|
|
this.selectComponent('#showModal').options({
|
|
|
|
header: '定位失败',
|
|
|
|
body: '需要地理位置授权'
|
|
|
|
}).show();
|
|
|
|
} else {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.getPos()
|
|
|
|
}, 500)
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
},
|
|
|
|
_getPos(){
|
|
|
|
return new Promise((success, fail) => {
|
|
|
|
wx.getLocation({
|
|
|
|
type: 'gcj02',
|
|
|
|
success: (res) => {
|
|
|
|
success(res)
|
|
|
|
},
|
|
|
|
fail: (res) => {
|
|
|
|
fail(res)
|
|
|
|
},
|
|
|
|
complete: (res) => {
|
|
|
|
console.log('wx.getLocation', res)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
|
|
|
onpos(e){
|
|
|
|
console.log(e);
|
|
|
|
this.location=e.detail
|
|
|
|
this.GetRecommendSellerLists()
|
|
|
|
this.getCity()
|
|
|
|
},
|
|
|
|
getCity(){
|
|
|
|
qqmapsdk.reverseGeocoder({
|
|
...
|
...
|
@@ -284,12 +256,11 @@ Page({ |
|
|
|
})
|
|
|
|
},
|
|
|
|
GetRecommendSellerLists(){
|
|
|
|
if(!this.location.latitude) return;
|
|
|
|
let param={}
|
|
|
|
if(this.location){
|
|
|
|
param={
|
|
|
|
lat:this.location.latitude,
|
|
|
|
lng:this.location.longitude
|
|
|
|
}
|
|
|
|
param={
|
|
|
|
lat:this.location.latitude,
|
|
|
|
lng:this.location.longitude
|
|
|
|
}
|
|
|
|
App.Customer.GetRecommendSellerLists(param).then(res=>{
|
|
|
|
this.setData({
|
...
|
...
|
|