Showing
5 changed files
with
10 additions
and
1 deletions
| @@ -22,6 +22,7 @@ App({ | @@ -22,6 +22,7 @@ App({ | ||
| 22 | system:{}, | 22 | system:{}, |
| 23 | shareTicket:"", | 23 | shareTicket:"", |
| 24 | isAdmin:false,//是否运营人员 | 24 | isAdmin:false,//是否运营人员 |
| 25 | + location:null,//人的位置信息 | ||
| 25 | onLaunch: async function (opt) { | 26 | onLaunch: async function (opt) { |
| 26 | if(wx.getLogManager){ | 27 | if(wx.getLogManager){ |
| 27 | const logger =wx.getLogManager() | 28 | const logger =wx.getLogManager() |
| @@ -101,6 +101,7 @@ Component({ | @@ -101,6 +101,7 @@ Component({ | ||
| 101 | seller.label_carr=seller.label_carr.slice(0,3) | 101 | seller.label_carr=seller.label_carr.slice(0,3) |
| 102 | } | 102 | } |
| 103 | this.setData({ | 103 | this.setData({ |
| 104 | + location:getApp().location, | ||
| 104 | se: seller, | 105 | se: seller, |
| 105 | }) | 106 | }) |
| 106 | }, | 107 | }, |
| @@ -20,7 +20,9 @@ | @@ -20,7 +20,9 @@ | ||
| 20 | </view> | 20 | </view> |
| 21 | <view class="text flex-ll"> | 21 | <view class="text flex-ll"> |
| 22 | <view class="text-item" wx:if="{{seller.room_num>0}}">{{seller.room_num}}个包间</view> | 22 | <view class="text-item" wx:if="{{seller.room_num>0}}">{{seller.room_num}}个包间</view> |
| 23 | - <view class="text-item" wx:if="{{seller.distance>=0 && seller.distance!==''}}">{{hasSuggestion?'距搜索地':'距您'}}{{util.distance(seller.distance_centre||seller.distance)}}</view> | 23 | + <block wx:if="{{hasSuggestion || location.latitude}}"> |
| 24 | + <view class="text-item" wx:if="{{seller.distance>=0 && seller.distance!==''}}">{{hasSuggestion?'距搜索地':'距您'}}{{util.distance(seller.distance_centre||seller.distance)}}</view> | ||
| 25 | + </block> | ||
| 24 | </view> | 26 | </view> |
| 25 | <view wx:if="{{hasStat}}" class="stat"> | 27 | <view wx:if="{{hasStat}}" class="stat"> |
| 26 | <stat stat="{{seller.score}}"></stat> | 28 | <stat stat="{{seller.score}}"></stat> |
| @@ -104,6 +104,7 @@ Component({ | @@ -104,6 +104,7 @@ Component({ | ||
| 104 | hasSuccess=true; | 104 | hasSuccess=true; |
| 105 | rex=res; | 105 | rex=res; |
| 106 | this.triggerEvent("pos",JSON.parse(JSON.stringify(res))); | 106 | this.triggerEvent("pos",JSON.parse(JSON.stringify(res))); |
| 107 | + getApp().location=res; | ||
| 107 | success(res) | 108 | success(res) |
| 108 | }, | 109 | }, |
| 109 | fail: (res) => { | 110 | fail: (res) => { |
| @@ -486,6 +486,10 @@ Page({ | @@ -486,6 +486,10 @@ Page({ | ||
| 486 | } | 486 | } |
| 487 | if(param.lat){ | 487 | if(param.lat){ |
| 488 | param.centre_pos=`${param.lat},${param.lng}` | 488 | param.centre_pos=`${param.lat},${param.lng}` |
| 489 | + }else{ | ||
| 490 | + let lat=(this.mapData.region.southwest.latitude+this.mapData.region.northeast.latitude)/2 | ||
| 491 | + let lng=(this.mapData.region.southwest.longitude+this.mapData.region.northeast.longitude)/2 | ||
| 492 | + param.centre_pos=`${lat},${lng}` | ||
| 489 | } | 493 | } |
| 490 | if(this.data.hasSuggestion){ | 494 | if(this.data.hasSuggestion){ |
| 491 | param.centre_pos=`${this.data.suggestion.latitude},${this.data.suggestion.longitude}` | 495 | param.centre_pos=`${this.data.suggestion.latitude},${this.data.suggestion.longitude}` |
-
Please register or login to post a comment