Commit 2b6116b8 by 胡悦

Merge branch 'master' of 192.168.3.233:glsx-web/glsx-oss-merchant-data

2 parents a63de281 26f17404
...@@ -34,12 +34,14 @@ ...@@ -34,12 +34,14 @@
v-for="(i, index) in List" v-for="(i, index) in List"
:key="index+''" :key="index+''"
> >
<span style="line-height: 50px;">{{i.label}}: <span style="line-height: 50px;">
<span class="label-justify">{{i.label}}:</span>
<div <div
v-if="i.isMap" v-if="i.isMap"
class='amap-page-container' class='amap-page-container'
> >
<span v-show="hasLocation" class="error mapTips">{{i.value}}</span> <span :class="[hasLocation ? 'error map-txt' : 'error', isEdit ? 'mapTips-edit': 'mapTips']">{{i.value}}</span>
<gl-button v-if="isEdit && i.label == 'POI位置点'" class="mapTips-button" @click="markAddr(isMarkAddr = true)">标记位置点</gl-button>
<el-amap <el-amap
vid='amapDemo' vid='amapDemo'
:center='center' :center='center'
...@@ -58,10 +60,10 @@ ...@@ -58,10 +60,10 @@
> >
<gl-input <gl-input
v-else-if="isEdit && editOptions.includes(i.name)" v-else-if="isEdit && editOptions.includes(i.name)"
v-model="i.value" v-model="merchantInfo[i.name]"
:placeholder=i.label :placeholder="i.label"
></gl-input> ></gl-input>
<span v-else>{{i.value}}</span> <span v-else>{{merchantInfo[i.name]}}</span>
</span> </span>
</gl-col> </gl-col>
</gl-col> </gl-col>
...@@ -161,6 +163,8 @@ export default { ...@@ -161,6 +163,8 @@ export default {
activeName: 'first', activeName: 'first',
merchantInfo: {}, merchantInfo: {},
isEdit: false, isEdit: false,
tempAddr: '',
isMarkAddr: false,
editOptions: ['address', 'merchantChannelName', 'contactor', 'contactPhone', 'phone', 'email'], editOptions: ['address', 'merchantChannelName', 'contactor', 'contactPhone', 'phone', 'email'],
List: [ List: [
{ {
...@@ -215,24 +219,30 @@ export default { ...@@ -215,24 +219,30 @@ export default {
center: [113.939723, 22.525351], center: [113.939723, 22.525351],
events: { events: {
'click': (e) => { 'click': (e) => {
if (this.isMarkAddr) {
amapManager._map.remove(marker) amapManager._map.remove(marker)
marker = [] this.getAddress(e.lnglat.lng, e.lnglat.lat)
this.center = [+e.lnglat.lng, +e.lnglat.lat] // amapManager._map.remove(marker)
var geocoder = new AMap.Geocoder({ // marker = []
radius: 1000, // this.center = [+e.lnglat.lng, +e.lnglat.lat]
extensions: 'all' // var geocoder = new AMap.Geocoder({
}) // radius: 1000,
geocoder.getAddress(this.center, (status, result) => { // extensions: 'all'
if (status === 'complete' && result.info === 'OK') { // })
console.dir(result) // geocoder.getAddress(this.center, (status, result) => {
const mar = new AMap.Marker({ // if (status === 'complete' && result.info === 'OK') {
position: this.center, // console.dir(result)
title: result.regeocode.formattedAddress // const mar = new AMap.Marker({
}) // position: this.center,
marker.push(mar) // title: result.regeocode.formattedAddress
amapManager._map.add(marker) // })
// marker.push(mar)
// amapManager._map.add(marker)
// console.log(this.hasLocation)
// this.List[10].value = result.regeocode.formattedAddress
// }
// })
} }
})
} }
}, },
// 员工状态:0可用,1不可用 // 员工状态:0可用,1不可用
...@@ -363,11 +373,16 @@ export default { ...@@ -363,11 +373,16 @@ export default {
}, },
// 编辑,取消 // 编辑,取消
handleEdit(isCancel) { handleEdit(isCancel) {
this.isMarkAddr = false
// 保存 // 保存
if (!isCancel && this.isEdit) { if (!isCancel && this.isEdit) {
this.merchantInfo.lng = this.center[0]
this.merchantInfo.lat = this.center[1]
console.log('调保存接口--') console.log('调保存接口--')
console.log(this.merchantInfo)
this.isEdit = !this.isEdit this.isEdit = !this.isEdit
} else { } else {
this.getAddress(this.merchantInfo.lng, this.merchantInfo.lat)
this.isEdit = !this.isEdit this.isEdit = !this.isEdit
} }
}, },
...@@ -394,6 +409,8 @@ export default { ...@@ -394,6 +409,8 @@ export default {
params.method = bizMethods.Detail params.method = bizMethods.Detail
request.req(params).then(res => { request.req(params).then(res => {
this.merchantInfo = res this.merchantInfo = res
// this.merchantInfo.lng = '113.939723'
// this.merchantInfo.lat = '22.525351'
this.assignBasicInfo() this.assignBasicInfo()
this.IdChange[0] = 0 this.IdChange[0] = 0
this.basicLoading = false this.basicLoading = false
...@@ -407,14 +424,9 @@ export default { ...@@ -407,14 +424,9 @@ export default {
for (var i in this.List) { for (var i in this.List) {
if (this.List[i].isMap) { if (this.List[i].isMap) {
if (this.merchantInfo.lng && this.merchantInfo.lat) { if (this.merchantInfo.lng && this.merchantInfo.lat) {
this.center = [+this.merchantInfo.lng, +this.merchantInfo.lat] this.getAddress(this.merchantInfo.lng, this.merchantInfo.lat)
const o = amapManager.getMap()
const marker = new AMap.Marker({
position: this.center
})
marker.setMap(o)
} else { } else {
this.hasLocation = true this.hasLocation = false
} }
} else if (this.List[i].isImg) { } else if (this.List[i].isImg) {
this.List[i].value = this.merchantInfo.merchantPortrait this.List[i].value = this.merchantInfo.merchantPortrait
...@@ -423,6 +435,33 @@ export default { ...@@ -423,6 +435,33 @@ export default {
} }
} }
}, },
// 根据经纬度获取地址名
getAddress(lng, lat) {
marker = []
this.center = [+lng, +lat]
var geocoder = new AMap.Geocoder({
radius: 1000,
extensions: 'all'
})
geocoder.getAddress(this.center, (status, result) => {
if (status === 'complete' && result.info === 'OK') {
// console.dir(result)
const mar = new AMap.Marker({
position: this.center,
title: result.regeocode.formattedAddress
})
marker.push(mar)
amapManager._map.add(marker)
this.tempAddr = result.regeocode.formattedAddress
this.markAddr()
}
})
},
markAddr() {
this.hasLocation = true
this.List[10].value = this.tempAddr
// console.log(this.center)
},
// 员工信息 // 员工信息
getStaffInfo() { getStaffInfo() {
const params = { merchantId: this.merchantId } const params = { merchantId: this.merchantId }
...@@ -481,7 +520,21 @@ export default { ...@@ -481,7 +520,21 @@ export default {
} }
.amap-page-container .mapTips { .amap-page-container .mapTips {
position: absolute; position: absolute;
top: -28px; top: -34px;
left: 85px;
}
.amap-page-container .map-txt {
color: #000;
font-size: 14px;
}
.amap-page-container .mapTips-edit {
position: absolute;
top: -34px;
left: 205px;
}
.amap-page-container .mapTips-button {
position: absolute;
top: -46px;
left: 85px; left: 85px;
} }
.amap-demo { .amap-demo {
...@@ -511,6 +564,11 @@ export default { ...@@ -511,6 +564,11 @@ export default {
line-height: 36px; line-height: 36px;
/* padding-left: 20px */ /* padding-left: 20px */
} }
.label-justify {
display:inline-block;
width:85px;
text-align-last: justify;
}
.detail-logo { .detail-logo {
width: 40px; width: 40px;
height: 40px; height: 40px;
...@@ -520,7 +578,7 @@ export default { ...@@ -520,7 +578,7 @@ export default {
background-color: #fafafa; background-color: #fafafa;
} }
.detail .el-input { .detail .el-input {
width: 80%; width: 50%;
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!