Browse Source

地图

master
石可 4 years ago
parent
commit
0c4481b604
  1. 2
      components/lf-nav/lf-nav.vue
  2. 2
      pages/search/search.vue
  3. 73
      pages/shopmap/index.vue

2
components/lf-nav/lf-nav.vue

@ -10,7 +10,7 @@
<block v-else>
<view class="head-nav" :style="{'top': headHeight - 40 + 'px'}" v-if="showIcon">
<view class="lf-row-between" @click="goMap()">
<text class="lf-iconfont lf-icon-dizhi font-40size lf-color-white lf-m-r-10"></text>
<text class="lf-iconfont lf-icon-ditu font-40size lf-color-white lf-m-r-10"></text>
<view class="lf-font-28 lf-color-white">地图</view>
</view>
</view>

2
pages/search/search.vue

@ -95,6 +95,8 @@
uni.navigateTo({
url: '/pages/search/searchList?start_place=' + this.start_place+'&target_place='+this.target_place
})
this.start_place = '';
this.target_place = '';
},
tabChange(index){
this.current = index;

73
pages/shopmap/index.vue

@ -42,23 +42,23 @@
</view>
</view> -->
<view class="lf-row-between lf-m-t-40">
<view class="lf-row-between">
<view class="lf-row-between" @click="$url('/pages/goodsDetail/index?goods_id='+item.id);">
<view class="lf-m-r-20">
<image style="width: 46rpx;height: 46rpx;" :src="item.picture" mode="aspectFill"></image>
<image style="width: 90rpx;height: 90rpx;border-radius: 10rpx;" :src="item.picture" mode="aspectFill"></image>
</view>
<view class="lf-flex-column">
<view class="lf-font-28 lf-color-222 lf-line-1" style="max-width: 510rpx;">{{item.title}}</view>
<view class="lf-font-24 lf-color-999 lf-flex lf-m-t-18">
<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>
<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: 480rpx;">
瑞希开发
<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>
</view>
</view>
</view>
</view>
<view>
<view @click="openMap(item.address,item.latitude,item.logitude)">
<text class="lf-iconfont lf-icon-daohang"></text>
</view>
</view>
@ -86,17 +86,7 @@
tab_list_father: [],
current_father: 0,
windowHeight: 0,
markers_list: [
{
id: 0,
name: '时尚',
address: '杭州市',
latitude: 30.353351,
longitude: 120.231010,
width: 50,
height: 50
}
],
markers_list: [],
self_latitude: '',
self_longitude: '',
//
@ -149,7 +139,32 @@
this.windowHeight = getApp().globalData.windowHeight;
this.getShopDistance();
},
filters: {
kmUnit(m){
var v;
if(typeof m === 'number' && !isNaN(m)){
if (m >= 1000) {
v = (m / 1000).toFixed(2) + 'km'
} else {
v = m + 'm'
}
}else{
v = '0m'
}
return v;
}
},
methods: {
//
openMap(address, lat, lng) {
// let { address, lat, lng } = this.goods_detail?.store || {};
uni.openLocation({
longitude: Number(lng),
latitude: Number(lat),
scale: 20,
name: address
});
},
//
getShopDistance() {
let that = this;
@ -206,10 +221,7 @@
list.push(item)
}
})
console.log(list)
this.tab_list_father = list;
console.log(this.tab_list_father)
this.getActivityList()
}).catch(err => {
@ -259,11 +271,12 @@
}
},
getActivityList(){
let tab_item = this.tab_list_father[this.current_father];
let tab_item1 = this.tab_list_father[this.current_father];
let tab_item = this.tab_list[this.current];
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,{page: tab_item.page,category_id: tab_item.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){
@ -278,6 +291,20 @@
}else{
tab_item.list.push(...res.data.data);
}
let res_list = res.data.data || [];
let markers_self = res_list.map(item => {
return {
id: item.id,
name: item.title,
address: item.address,
latitude: item.latitude,
longitude: item.logitude,
width: 30,
height: 30
}
});
this.markers_list = markers_self
}).catch(err => {
})

Loading…
Cancel
Save