Commit 6ed70e3d8a468bbc8f654f31104dd8dbb874bb5d

Authored by vking
1 parent d26a2680

一键录入

... ... @@ -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({
... ...
... ... @@ -4,6 +4,7 @@
"navigationBarTitleText":"周到安排",
"usingComponents": {
"formids":"/components/formids/formids",
"getpos":"/components/userinfo/getpos",
"nav":"/components/nav/nav",
"search-item":"/components/reserve/search/item",
"sb-tr":"/components/reserve/seller-box-transverse/seller-box"
... ...
... ... @@ -33,7 +33,7 @@
<view class="empty-t2">试试搜搜别的</view>
</block>
</view>
<view class="rsl-block">
<view class="rsl-block" wx:if="{{rsl.length>0}}">
<view class="line-push">为你推荐</view>
<view class="transverse-list">
<swiper
... ... @@ -68,4 +68,5 @@
</view>
</view>
</view>
<fb></fb>
\ No newline at end of file
<fb></fb>
<getpos bindpos="onpos" id="getpos" hasAllowFail></getpos>
\ No newline at end of file
... ...