|
@@ -117,15 +117,25 @@
|
|
|
<el-form-item label="所在县">
|
|
|
<el-input v-model="origin.countyName"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="详细地址">
|
|
|
+ <!-- <el-form-item label="详细地址">
|
|
|
<el-input v-model="origin.detailAddress"></el-input>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
<el-form-item label="经度(°)" prop="longitude">
|
|
|
<el-input v-model="origin.longitude"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="维度(°)" prop="latitude">
|
|
|
<el-input v-model="origin.latitude"></el-input>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="详细地址" >
|
|
|
+ <el-autocomplete
|
|
|
+ v-model="origin.detailAddress"
|
|
|
+ :fetch-suggestions="mapSearch"
|
|
|
+ placeholder="请输入详细地址"
|
|
|
+ style="width: 100%"
|
|
|
+ :trigger-on-focus="false"
|
|
|
+ @select="mapSelect"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
|
<baidu-map class="map" :center="center" :zoom="zoom" @ready="handlermap"
|
|
|
:scroll-wheel-zoom="true"
|
|
@@ -284,7 +294,12 @@
|
|
|
center: {lng: 106.632713, lat: 26.653157},
|
|
|
zoom: 12,
|
|
|
mapVisible:false,
|
|
|
- clientHeight:document.documentElement.clientHeight-90 // 设置屏幕高度
|
|
|
+ clientHeight:document.documentElement.clientHeight-90, // 设置屏幕高度
|
|
|
+ mapLocation: {
|
|
|
+ address: undefined,
|
|
|
+ coordinate: undefined
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -483,6 +498,8 @@
|
|
|
handlermap ({BMap, map}) {
|
|
|
let _this = this; // 设置一个临时变量指向vue实例;
|
|
|
var geolocation = new BMap.Geolocation();
|
|
|
+ this.BMap = BMap;
|
|
|
+ this.map = map;
|
|
|
geolocation.getCurrentPosition(function(r){
|
|
|
// console.log(r);
|
|
|
_this.center = {lng: r.longitude, lat: r.latitude}; // 设置center属性值
|
|
@@ -541,6 +558,71 @@
|
|
|
mapShow(){
|
|
|
this.mapVisible = true
|
|
|
},
|
|
|
+ mapSearch(queryString, cb) {
|
|
|
+ var that = this
|
|
|
+ var myGeo = new this.BMap.Geocoder()
|
|
|
+ myGeo.getPoint(queryString, function(point) {
|
|
|
+ if (point) {
|
|
|
+ that.mapLocation.coordinate = point
|
|
|
+ that.makerCenter(point)
|
|
|
+ } else {
|
|
|
+ that.mapLocation.coordinate = null
|
|
|
+ }
|
|
|
+ }, this.locationCity)
|
|
|
+ var options = {
|
|
|
+ onSearchComplete: function(results) {
|
|
|
+ if (local.getStatus() === 0) {
|
|
|
+ // 判断状态是否正确
|
|
|
+ var s = []
|
|
|
+ for (var i = 0; i < results.getCurrentNumPois(); i++) {
|
|
|
+ var x = results.getPoi(i)
|
|
|
+ var item = { value: x.address + x.title, point: x.point }
|
|
|
+ s.push(item)
|
|
|
+ cb(s)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ cb()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var local = new this.BMap.LocalSearch(this.map, options)
|
|
|
+ local.search(queryString)
|
|
|
+ },
|
|
|
+ mapSelect(e) {
|
|
|
+ // console.log('e',e.point);
|
|
|
+ this.getMapInfo(e.point);
|
|
|
+ //转为高德坐标
|
|
|
+ let transGaode = bMapTransQQMap(e.point.lng,e.point.lat);
|
|
|
+ this.origin.longitude = transGaode.lng;
|
|
|
+ this.origin.latitude = transGaode.lat;
|
|
|
+ var { point } = e
|
|
|
+ this.mapLocation.coordinate = point
|
|
|
+ this.makerCenter(point)
|
|
|
+ },
|
|
|
+ makerCenter(point) {
|
|
|
+ if (this.map) {
|
|
|
+ this.map.clearOverlays()
|
|
|
+ this.map.addOverlay(new this.BMap.Marker(point))
|
|
|
+ this.center.lng = point.lng
|
|
|
+ this.center.lat = point.lat
|
|
|
+ this.zoom = 15
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getMapInfo(point){
|
|
|
+ //用所定位的经纬度查找所在地省市街道等信息
|
|
|
+ var point = new BMap.Point(point.lng, point.lat);
|
|
|
+ var gc = new BMap.Geocoder();
|
|
|
+ let _this = this;
|
|
|
+ gc.getLocation(point, function (rs) {
|
|
|
+ var addComp = rs.addressComponents;
|
|
|
+ // console.log('getMapInfo',rs);//地址信息
|
|
|
+ _this.origin.provinceName = rs.addressComponents.province;
|
|
|
+ _this.origin.cityName = rs.addressComponents.city;
|
|
|
+ _this.origin.countyName = rs.addressComponents.district;
|
|
|
+ _this.origin.detailAddress = rs.address;
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
handleSupplierChange(val) {
|
|
|
let supplierInfoObj = {};
|
|
|
supplierInfoObj = this.supplierOptList.find(item => {
|