|
|
|
@ -1,8 +1,8 @@ |
|
|
|
|
<template> |
|
|
|
|
<view class="map-container"> |
|
|
|
|
<!-- #ifdef H5 --> |
|
|
|
|
<map style="width: 100%; height: 10vh;" :style="{height:mapheight}" :latitude="latitude" :longitude="longitude" |
|
|
|
|
:markers="marker" :scale="scale" @markertap="markertap" @callouttap='callouttap'> |
|
|
|
|
<map id="myMap" style="width: 100%; height: 10vh;" :style="{height:mapheight}" :latitude="latitude" |
|
|
|
|
:longitude="longitude" :markers="marker" :scale="scale" @markertap="markertap" @callouttap='callouttap'> |
|
|
|
|
<cover-view class="cover-view-loca" :style='{bottom:coverbottom}' @click="onControltap"> |
|
|
|
|
<cover-image class="cover-image" src="../../../static/img/dispos.png"></cover-image> |
|
|
|
|
</cover-view> |
|
|
|
@ -107,8 +107,8 @@ |
|
|
|
|
<!-- #endif --> |
|
|
|
|
|
|
|
|
|
<!-- #ifdef MP --> |
|
|
|
|
<map style="width: 100%; height: 10vh;" :style="{height:mapheight}" :latitude="latitude" :longitude="longitude" |
|
|
|
|
:markers="marker" :scale="scale" @markertap="markertap" @callouttap='callouttap'> |
|
|
|
|
<map id="myMap" style="width: 100%; height: 10vh;" :style="{height:mapheight}" :latitude="latitude" |
|
|
|
|
:longitude="longitude" :markers="marker" :scale="scale" @markertap="markertap" @callouttap='callouttap'> |
|
|
|
|
<cover-view class="cover-view-loca" :style='{bottom:coverbottom}' @click="onControltap"> |
|
|
|
|
<cover-image class="cover-image" src="../../../static/img/dispos.png"></cover-image> |
|
|
|
|
</cover-view> |
|
|
|
@ -123,10 +123,10 @@ |
|
|
|
|
<view class="width100 mart15 backcorfff cover-viewchage alijus fotct" style="border-radius: 22px;"> |
|
|
|
|
<!-- :class="[selectFirst == 1? 'onchange' : '']" --> |
|
|
|
|
<view class="font14 width30w fotct onchange text1" @click="changeChilerType()">{{selectFirstName}} |
|
|
|
|
<image mode="widthFix" class="margle" style="width: 8px;" :src="imagewxUrl+imgadres2"></image> |
|
|
|
|
<image mode="aspectFit" class="margle" style="width: 8px;height:8px;" :src="imagewxUrl+imgadres2"></image> |
|
|
|
|
</view> |
|
|
|
|
<view class="font14 width30w onchange" @click="changeChilerdistance()">{{distanceName}} |
|
|
|
|
<image mode="widthFix" class="margle" style="width: 8px;" :src="imagewxUrl+imgadres2"></image> |
|
|
|
|
<image mode="aspectFit" class="margle" style="width: 8px;height:8px;" :src="imagewxUrl+imgadres2"></image> |
|
|
|
|
</view> |
|
|
|
|
<view class="font14 width30w"> |
|
|
|
|
<!-- 全部 |
|
|
|
@ -222,13 +222,14 @@ |
|
|
|
|
return { |
|
|
|
|
latitude: '', //纬度 |
|
|
|
|
longitude: '', //经度 |
|
|
|
|
mapContext: null, |
|
|
|
|
scale: 13, //缩放级别 |
|
|
|
|
bottomData: false, |
|
|
|
|
imagewxUrl: app.globalData.imageWxImg, |
|
|
|
|
imgadres2: 'xiala.png', |
|
|
|
|
imgadres3: 'noorder.png', |
|
|
|
|
imgadres4: 'dh.png', |
|
|
|
|
marker: '', //商户 |
|
|
|
|
marker: [], //商户 |
|
|
|
|
typeid: 99999999, //选择分类 |
|
|
|
|
isSelected: 1, //是否选择下拉 |
|
|
|
|
selectFirst: '99999999', //筛选是否有值 |
|
|
|
@ -282,11 +283,17 @@ |
|
|
|
|
typeplat: 1 //手机类型 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onLoad() {}, |
|
|
|
|
onLoad() { |
|
|
|
|
this.onControltap(); |
|
|
|
|
}, |
|
|
|
|
onReady() { |
|
|
|
|
this.mapContext = uni.createMapContext('myMap'); |
|
|
|
|
console.log(this.mapContext) |
|
|
|
|
}, |
|
|
|
|
onShow() { |
|
|
|
|
// this.latitude = app.globalData.latitude; |
|
|
|
|
// this.longitude = app.globalData.longitude; |
|
|
|
|
this.onControltap(); |
|
|
|
|
/* this.onControltap(); */ |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
mapheight() { |
|
|
|
@ -338,9 +345,9 @@ |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
//查询商户 |
|
|
|
|
getMapStore() { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '加载中...' |
|
|
|
|
getMapStore() { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '加载中...' |
|
|
|
|
}) |
|
|
|
|
let childId = ''; |
|
|
|
|
if (this.selectFirst == 99999999) { |
|
|
|
@ -356,13 +363,27 @@ |
|
|
|
|
longitude: this.longitude, |
|
|
|
|
latitude: this.latitude |
|
|
|
|
} |
|
|
|
|
getMapStore(datas).then(res => { |
|
|
|
|
getMapStore(datas).then(res => { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
this.marker = res.return_data |
|
|
|
|
this.marker = res.return_data; |
|
|
|
|
// console.log(this.marker,"marker") |
|
|
|
|
} else { |
|
|
|
|
this.marker = []; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.marker.push({ |
|
|
|
|
id: 0, |
|
|
|
|
latitude: this.latitude, |
|
|
|
|
longitude: this.longitude, |
|
|
|
|
iconPath: '/static/img/location.png', |
|
|
|
|
rotate: 1, |
|
|
|
|
alpha: 1, |
|
|
|
|
width: 40, |
|
|
|
|
height: 40 |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
//选择二级分类数据 |
|
|
|
@ -379,27 +400,26 @@ |
|
|
|
|
this.selectChilerdistance = 2; |
|
|
|
|
this.getMapStore(); |
|
|
|
|
}, |
|
|
|
|
//地图点击事件 |
|
|
|
|
//地图点击事件,点击标记点时触发 |
|
|
|
|
markertap(e) { |
|
|
|
|
// #ifdef H5 |
|
|
|
|
// console.log(e,"点击标记点时触发"); |
|
|
|
|
let markerId = e.detail.markerId; |
|
|
|
|
if(markerId == 0) return; /* 点击当前自己定位的标记点*/ |
|
|
|
|
for (var i = 0; i < this.marker.length; i++) { |
|
|
|
|
if (markerId == this.marker[i].id) { |
|
|
|
|
this.seeloaction(this.marker[i]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// #endif |
|
|
|
|
}, |
|
|
|
|
//地图点击事件 |
|
|
|
|
//地图点击事件,点击标记点对应的气泡时触发, |
|
|
|
|
callouttap(e) { |
|
|
|
|
// #ifdef MP |
|
|
|
|
let markerId = e.markerId; |
|
|
|
|
// console.log(e, "点击标记点对应的气泡") |
|
|
|
|
let markerId = e.detail.markerId; |
|
|
|
|
for (var i = 0; i < this.marker.length; i++) { |
|
|
|
|
if (markerId == this.marker[i].id) { |
|
|
|
|
this.seeloaction(this.marker[i]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// #endif |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
postionIng() { |
|
|
|
@ -523,6 +543,18 @@ |
|
|
|
|
// console.log(res, '获取当前位置') |
|
|
|
|
this.longitude = res.longitude; |
|
|
|
|
this.latitude = res.latitude; |
|
|
|
|
|
|
|
|
|
if(this.mapContext){ |
|
|
|
|
this.mapContext.moveToLocation({ |
|
|
|
|
latitude: this.latitude, |
|
|
|
|
longitude: this.longitude, |
|
|
|
|
success(res){ |
|
|
|
|
// console.log(res,"成功") |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log(this.longitude, this.latitude, "this.longitude,this.latitude") |
|
|
|
|
this.getIndustry(); |
|
|
|
|
}, |
|
|
|
|
fail() { |
|
|
|
@ -550,15 +582,15 @@ |
|
|
|
|
"ext2": null, |
|
|
|
|
"status": 1, |
|
|
|
|
"ext1": "642" |
|
|
|
|
}]; |
|
|
|
|
this.selectFirst = '99999999'; |
|
|
|
|
}]; |
|
|
|
|
this.selectFirst = '99999999'; |
|
|
|
|
this.selectFirstName = '全部'; |
|
|
|
|
}else{ |
|
|
|
|
this.goodsSendotClassList = item.childIndustry; |
|
|
|
|
this.selectFirst = item.childIndustry[0].id; |
|
|
|
|
this.selectFirstName = item.childIndustry[0].name; |
|
|
|
|
} else { |
|
|
|
|
this.goodsSendotClassList = item.childIndustry; |
|
|
|
|
this.selectFirst = item.childIndustry[0].id; |
|
|
|
|
this.selectFirstName = item.childIndustry[0].name; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getMapStore(); |
|
|
|
|
}, |
|
|
|
|
//子菜单显示 |
|
|
|
@ -585,18 +617,26 @@ |
|
|
|
|
this.isSelected = item; |
|
|
|
|
}, |
|
|
|
|
seeloaction(item) { |
|
|
|
|
// #ifdef H5 |
|
|
|
|
console.log(item,"item"); |
|
|
|
|
uni.openLocation({ |
|
|
|
|
latitude: parseFloat(item.latitude), //目的地的定位 |
|
|
|
|
longitude: parseFloat(item.longitude), //目的地的定位 |
|
|
|
|
name: item.callout.content, |
|
|
|
|
address: item.callout.address |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
window.location.href = |
|
|
|
|
`http://apis.map.qq.com/uri/v1/marker?marker=coord:(${item.latitude},${item.longitude})&addr:${item.address}`; |
|
|
|
|
// #endif |
|
|
|
|
// #ifdef MP |
|
|
|
|
uni.openLocation({ |
|
|
|
|
latitude: Number(item.latitude), //目的地的定位 |
|
|
|
|
longitude: Number(item.longitude), //目的地的定位 |
|
|
|
|
name: item.store_name, |
|
|
|
|
address: item.address |
|
|
|
|
}) |
|
|
|
|
// #endif |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|