|
|
|
@ -9,8 +9,12 @@ |
|
|
|
</view> |
|
|
|
<view class="lf-m-t-40 lf-p-l-32 lf-p-r-32"> |
|
|
|
<view class="lf-row-between lf-m-b-40"> |
|
|
|
<view class="lf-font-32 lf-color-222">地图上的门店</view> |
|
|
|
<view class="lf-font-24 lf-color-blue lf-row-center"> |
|
|
|
<view class="lf-font-32 lf-color-222">商品列表</view> |
|
|
|
<view class="lf-font-24 lf-color-blue lf-row-center" style="width: 520rpx; justify-content: flex-end;" v-if="self_latitude && self_longitude && address"> |
|
|
|
<text class="lf-iconfont lf-icon-dingwei lf-m-r-10 lf-font-22"></text> |
|
|
|
<text class="lf-line-1">{{ address }}</text> |
|
|
|
</view> |
|
|
|
<view class="lf-font-24 lf-color-blue lf-row-center" @click="getShopDistance()" v-else> |
|
|
|
<text class="lf-iconfont lf-icon-dingwei lf-m-r-10 lf-font-22"></text> |
|
|
|
我的位置 |
|
|
|
</view> |
|
|
|
@ -48,12 +52,16 @@ |
|
|
|
</view> |
|
|
|
<view class="lf-flex-column"> |
|
|
|
<view class="lf-font-28 lf-color-222 lf-line-1" style="max-width: 460rpx;">{{item.title}}</view> |
|
|
|
<view class="lf-font-24 lf-color-999 lf-flex lf-m-t-18" v-if="item.address"> |
|
|
|
<view class="lf-font-24 lf-color-999 lf-flex lf-m-t-18" > |
|
|
|
<view> |
|
|
|
<text class="lf-iconfont lf-icon-dingwei1" style="font-size: 10px!important;"></text> |
|
|
|
</view> |
|
|
|
<view class="lf-line-2 lf-m-l-10" style="max-width: 440rpx;"> |
|
|
|
{{item.address}} <text class="lf-m-l-10 lf-m-r-10">|</text> <text>{{item.distance_m | kmUnit}}</text> |
|
|
|
<block v-if="item.address"> |
|
|
|
<text>{{ item.address }}</text> |
|
|
|
<text class="lf-m-l-10 lf-m-r-10">|</text> |
|
|
|
</block> |
|
|
|
<text>{{item.distance_m | kmUnit}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -80,6 +88,11 @@ |
|
|
|
</template>ß |
|
|
|
|
|
|
|
<script> |
|
|
|
let QQMapWX = require('@/common/qqmap-wx-jssdk.min.js'); |
|
|
|
let qqmapsdk = new QQMapWX({ |
|
|
|
key: 'GB3BZ-7W2CU-LW3VH-B7ZIF-XRKSF-D3FOL' |
|
|
|
}); |
|
|
|
|
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
@ -132,12 +145,14 @@ |
|
|
|
isPage: true, |
|
|
|
pageSize: 20, |
|
|
|
sort: 0, |
|
|
|
address: '' |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
this.getCategory(); |
|
|
|
this.windowHeight = getApp().globalData.windowHeight; |
|
|
|
this.getShopDistance(); |
|
|
|
// 腾讯地图KEY: GB3BZ-7W2CU-LW3VH-B7ZIF-XRKSF-D3FOL |
|
|
|
}, |
|
|
|
filters: { |
|
|
|
kmUnit(m){ |
|
|
|
@ -168,21 +183,35 @@ |
|
|
|
//获取当前位置 计算商店距离 |
|
|
|
getShopDistance() { |
|
|
|
let that = this; |
|
|
|
wx.getLocation({ |
|
|
|
type: 'wgs84', |
|
|
|
uni.getLocation({ |
|
|
|
type: 'gcj02', |
|
|
|
isHighAccuracy: true, |
|
|
|
success (res) { |
|
|
|
that.self_latitude = res.latitude |
|
|
|
that.self_longitude = res.longitude |
|
|
|
console.log(that.self_longitude) |
|
|
|
console.log(that.self_latitude) |
|
|
|
console.log(res) |
|
|
|
that.self_latitude = res.latitude; |
|
|
|
that.self_longitude = res.longitude; |
|
|
|
that.getAddressInfo(); |
|
|
|
}, |
|
|
|
fail(err) { |
|
|
|
console.log(err) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 根据坐标获取地址信息 |
|
|
|
getAddressInfo(){ |
|
|
|
// TODO 配置合法域名 |
|
|
|
qqmapsdk.reverseGeocoder({ |
|
|
|
location: { |
|
|
|
latitude: this.self_latitude, |
|
|
|
longitude: this.self_longitude |
|
|
|
}, |
|
|
|
success: res => { |
|
|
|
this.address = res.result.address; |
|
|
|
}, |
|
|
|
fail: err => { |
|
|
|
console.log("调用失败!", err); |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
tabChangeFather(index){ |
|
|
|
this.current_father = index; |
|
|
|
this.clearTabItem() |
|
|
|
@ -276,7 +305,14 @@ |
|
|
|
let sort_type = this.tab_list[this.current].type; |
|
|
|
console.log('页数',tab_item.id) |
|
|
|
if(this.$shared.isValueType(tab_item) == 'undefined') return; |
|
|
|
this.$http(this.API.API_ADVICELIST,{lat: this.self_latitude,lng: this.self_longitude,page: tab_item.page,category_id: tab_item1.id,type: sort_type,by: this.sort}).then(res => { |
|
|
|
this.$http(this.API.API_ADVICELIST, { |
|
|
|
lat: this.self_latitude, |
|
|
|
lng: this.self_longitude, |
|
|
|
page: tab_item.page, |
|
|
|
category_id: tab_item1.id, |
|
|
|
type: sort_type, |
|
|
|
by: this.sort, |
|
|
|
}).then(res => { |
|
|
|
let isPage = res.data.next_page_url == null?false:true; |
|
|
|
tab_item.isPage = isPage; |
|
|
|
if(!isPage){ |
|
|
|
|