Browse Source

发现好产品页面解析地址

master
邓平艺 4 years ago
parent
commit
c95e11f76d
  1. 3
      common/qqmap-wx-jssdk.min.js
  2. 5
      package.json
  3. 2
      pages.json
  4. 60
      pages/shopmap/index.vue

3
common/qqmap-wx-jssdk.min.js
File diff suppressed because it is too large
View File

5
package.json

@ -0,0 +1,5 @@
{
"dependencies": {
"tki-qrcode": "^0.1.6"
}
}

2
pages.json

@ -29,7 +29,7 @@
{ {
"path": "pages/shopmap/index", "path": "pages/shopmap/index",
"style": { "style": {
"navigationBarTitleText": "多门店"
"navigationBarTitleText": "发现好产品"
} }
}, },
{ {

60
pages/shopmap/index.vue

@ -9,8 +9,12 @@
</view> </view>
<view class="lf-m-t-40 lf-p-l-32 lf-p-r-32"> <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-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> <text class="lf-iconfont lf-icon-dingwei lf-m-r-10 lf-font-22"></text>
我的位置 我的位置
</view> </view>
@ -48,12 +52,16 @@
</view> </view>
<view class="lf-flex-column"> <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-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> <view>
<text class="lf-iconfont lf-icon-dingwei1" style="font-size: 10px!important;"></text> <text class="lf-iconfont lf-icon-dingwei1" style="font-size: 10px!important;"></text>
</view> </view>
<view class="lf-line-2 lf-m-l-10" style="max-width: 440rpx;"> <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> </view>
</view> </view>
@ -80,6 +88,11 @@
</template>ß </template>ß
<script> <script>
let QQMapWX = require('@/common/qqmap-wx-jssdk.min.js');
let qqmapsdk = new QQMapWX({
key: 'GB3BZ-7W2CU-LW3VH-B7ZIF-XRKSF-D3FOL'
});
export default { export default {
data() { data() {
return { return {
@ -132,12 +145,14 @@
isPage: true, isPage: true,
pageSize: 20, pageSize: 20,
sort: 0, sort: 0,
address: ''
} }
}, },
onLoad() { onLoad() {
this.getCategory(); this.getCategory();
this.windowHeight = getApp().globalData.windowHeight; this.windowHeight = getApp().globalData.windowHeight;
this.getShopDistance(); this.getShopDistance();
// KEY GB3BZ-7W2CU-LW3VH-B7ZIF-XRKSF-D3FOL
}, },
filters: { filters: {
kmUnit(m){ kmUnit(m){
@ -168,21 +183,35 @@
// //
getShopDistance() { getShopDistance() {
let that = this; let that = this;
wx.getLocation({
type: 'wgs84',
uni.getLocation({
type: 'gcj02',
isHighAccuracy: true, isHighAccuracy: true,
success (res) { 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) { fail(err) {
console.log(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){ tabChangeFather(index){
this.current_father = index; this.current_father = index;
this.clearTabItem() this.clearTabItem()
@ -276,7 +305,14 @@
let sort_type = this.tab_list[this.current].type; let sort_type = this.tab_list[this.current].type;
console.log('页数',tab_item.id) console.log('页数',tab_item.id)
if(this.$shared.isValueType(tab_item) == 'undefined') return; 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; let isPage = res.data.next_page_url == null?false:true;
tab_item.isPage = isPage; tab_item.isPage = isPage;
if(!isPage){ if(!isPage){

Loading…
Cancel
Save