Commit 84e3c03d by 胡悦

Merge branch 'huy_dev_v2.1.0' of http://192.168.3.233:8090/h5/account into huy_dev_v2.1.0

2 parents 9843d0e8 4ab9b8f4
...@@ -1047,17 +1047,21 @@ ...@@ -1047,17 +1047,21 @@
var body = layer.getChildFrame('body', index) var body = layer.getChildFrame('body', index)
body.find('#mapBtn').click() body.find('#mapBtn').click()
var res = helper.store.get('merchantMapObj') var res = helper.store.get('merchantMapObj')
console.log(res.geocoderAddress, '======')
if (res.lat && res.merchantAddress) { if (res.lat && res.merchantAddress) {
merchantForm.lat = res.lat merchantForm.lat = res.lat
merchantForm.lng = res.lng merchantForm.lng = res.lng
merchantForm.merchantAddress = res.merchantAddress merchantForm.merchantAddress = res.merchantAddress
// 截取省市 var fullAddress = res.geocoderAddress.addressComponent
var provinceIdx = res.merchantAddress.indexOf('省') // 获取省市
var cityIdx = res.merchantAddress.indexOf('市') var provinceIdx = fullAddress.province
var province = res.merchantAddress.slice(0, provinceIdx) var cityIdx = fullAddress.city
var city = res.merchantAddress.slice(provinceIdx + 1, cityIdx) var province = provinceIdx.slice(0, 2)
var city = cityIdx.slice(0, 2)
// 判断省市是否匹配 // 判断省市是否匹配
if (merchantForm.provinceName) { if (merchantForm.provinceName) {
merchantForm.provinceName = merchantForm.provinceName.slice(0, 2)
merchantForm.cityName = merchantForm.cityName.slice(0, 2)
if (merchantForm.provinceName !== province || merchantForm.cityName !== city) { if (merchantForm.provinceName !== province || merchantForm.cityName !== city) {
layer.open({ layer.open({
title: '提示', title: '提示',
...@@ -1066,12 +1070,11 @@ ...@@ -1066,12 +1070,11 @@
return return
} }
} }
merchantForm.provinceName = province
merchantForm.cityName = city
$('#addrEl').val(merchantForm.merchantAddress) $('#addrEl').val(merchantForm.merchantAddress)
$('#startp').val(merchantForm.provinceName) var province = provinceInfoList.find(item => item.provinceName.indexOf(province) != -1)
var province = provinceInfoList.find(item => item.provinceName == merchantForm.provinceName) $('#startp').val(province.provinceName)
cityInfo = province.cityInfoList cityInfo = province.cityInfoList
merchantForm.provinceName = province.provinceName
merchantForm.provinceCode = province.provinceId merchantForm.provinceCode = province.provinceId
com.getSelect({ com.getSelect({
id: 'startc', id: 'startc',
...@@ -1081,8 +1084,9 @@ ...@@ -1081,8 +1084,9 @@
link: 'startp', link: 'startp',
isFirst: false isFirst: false
}) })
var city = cityInfo.find(item => item.cityName == merchantForm.cityName) var city = cityInfo.find(item => item.cityName.indexOf(city) != -1)
merchantForm.cityCode = city.cityId merchantForm.cityCode = city.cityId
merchantForm.cityName = city.cityName
$('#startc').val(merchantForm.cityName) $('#startc').val(merchantForm.cityName)
form.render('select'); form.render('select');
layer.close(index) layer.close(index)
......
...@@ -232,6 +232,10 @@ ...@@ -232,6 +232,10 @@
top: 0; top: 0;
} }
.w-70 {
width: 150px !important;
}
.address { .address {
display: inline-block; display: inline-block;
width: calc(100% - 120px); width: calc(100% - 120px);
...@@ -1057,13 +1061,16 @@ ...@@ -1057,13 +1061,16 @@
merchantForm.lat = res.lat merchantForm.lat = res.lat
merchantForm.lng = res.lng merchantForm.lng = res.lng
merchantForm.merchantAddress = res.merchantAddress merchantForm.merchantAddress = res.merchantAddress
// 截取省市 var fullAddress = res.geocoderAddress.addressComponent
var provinceIdx = res.merchantAddress.indexOf('省') // 获取省市
var cityIdx = res.merchantAddress.indexOf('市') var provinceIdx = fullAddress.province
var province = res.merchantAddress.slice(0, provinceIdx) var cityIdx = fullAddress.city
var city = res.merchantAddress.slice(provinceIdx + 1, cityIdx) var province = provinceIdx.slice(0, 2)
var city = cityIdx.slice(0, 2)
// 判断省市是否匹配 // 判断省市是否匹配
if (merchantForm.provinceName) { if (merchantForm.provinceName) {
merchantForm.provinceName = merchantForm.provinceName.slice(0, 2)
merchantForm.cityName = merchantForm.cityName.slice(0, 2)
if (merchantForm.provinceName !== province || merchantForm.cityName !== city) { if (merchantForm.provinceName !== province || merchantForm.cityName !== city) {
layer.open({ layer.open({
title: '提示', title: '提示',
...@@ -1072,12 +1079,11 @@ ...@@ -1072,12 +1079,11 @@
return return
} }
} }
merchantForm.provinceName = province
merchantForm.cityName = city
$('#addrEl').val(merchantForm.merchantAddress) $('#addrEl').val(merchantForm.merchantAddress)
$('#startp').val(merchantForm.provinceName) var province = provinceInfoList.find(item => item.provinceName.indexOf(province) != -1)
var province = provinceInfoList.find(item => item.provinceName == merchantForm.provinceName) $('#startp').val(province.provinceName)
cityInfo = province.cityInfoList cityInfo = province.cityInfoList
merchantForm.provinceName = province.provinceName
merchantForm.provinceCode = province.provinceId merchantForm.provinceCode = province.provinceId
com.getSelect({ com.getSelect({
id: 'startc', id: 'startc',
...@@ -1087,11 +1093,11 @@ ...@@ -1087,11 +1093,11 @@
link: 'startp', link: 'startp',
isFirst: false isFirst: false
}) })
var city = cityInfo.find(item => item.cityName == merchantForm.cityName) var city = cityInfo.find(item => item.cityName.indexOf(city) != -1)
merchantForm.cityCode = city.cityId merchantForm.cityCode = city.cityId
$('#startc').val(merchantForm.cityName) $('#startc').val(city.cityName)
merchantForm.cityName = city.cityName
form.render('select'); form.render('select');
console.log(merchantForm, '-----------')
layer.close(index) layer.close(index)
} else { } else {
layer.msg('请选择地址', { layer.msg('请选择地址', {
......
...@@ -223,6 +223,20 @@ ...@@ -223,6 +223,20 @@
left: 340px; left: 340px;
top: 0; top: 0;
} }
.address {
display: inline-block;
width: calc(100% - 120px);
}
.w-70 {
width: 150px !important;
}
.select-address {
width: calc(100% - 600px) !important;
margin-left: 20px;
}
</style> </style>
<title>商户编辑</title> <title>商户编辑</title>
</head> </head>
...@@ -802,6 +816,7 @@ ...@@ -802,6 +816,7 @@
focusElem.css(verifyType == 'radio' ? { color: '' } : { 'border-color': '' }) focusElem.css(verifyType == 'radio' ? { color: '' } : { 'border-color': '' })
}) })
.focus() .focus()
console.log(222);
return '必填项不能为空' return '必填项不能为空'
} }
} }
...@@ -1007,13 +1022,16 @@ ...@@ -1007,13 +1022,16 @@
merchantForm.lat = res.lat merchantForm.lat = res.lat
merchantForm.lng = res.lng merchantForm.lng = res.lng
merchantForm.merchantAddress = res.merchantAddress merchantForm.merchantAddress = res.merchantAddress
// 截取省市 var fullAddress = res.geocoderAddress.addressComponent
var provinceIdx = res.merchantAddress.indexOf('省') // 获取省市
var cityIdx = res.merchantAddress.indexOf('市') var provinceIdx = fullAddress.province
var province = res.merchantAddress.slice(0, provinceIdx) var cityIdx = fullAddress.city
var city = res.merchantAddress.slice(provinceIdx + 1, cityIdx) var province = provinceIdx.slice(0, 2)
var city = cityIdx.slice(0, 2)
// 判断省市是否匹配 // 判断省市是否匹配
if (merchantForm.provinceName) { if (merchantForm.provinceName) {
merchantForm.provinceName = merchantForm.provinceName.slice(0, 2)
merchantForm.cityName = merchantForm.cityName.slice(0, 2)
if (merchantForm.provinceName !== province || merchantForm.cityName !== city) { if (merchantForm.provinceName !== province || merchantForm.cityName !== city) {
layer.open({ layer.open({
title: '提示', title: '提示',
...@@ -1022,12 +1040,11 @@ ...@@ -1022,12 +1040,11 @@
return return
} }
} }
merchantForm.provinceName = province
merchantForm.cityName = city
$('#addrEl').val(merchantForm.merchantAddress) $('#addrEl').val(merchantForm.merchantAddress)
$('#startp').val(merchantForm.provinceName) var province = provinceInfoList.find(item => item.provinceName.indexOf(province) != -1)
var province = provinceInfoList.find(item => item.provinceName == merchantForm.provinceName) $('#startp').val(province.provinceName)
cityInfo = province.cityInfoList cityInfo = province.cityInfoList
merchantForm.provinceName = province.provinceName
merchantForm.provinceCode = province.provinceId merchantForm.provinceCode = province.provinceId
com.getSelect({ com.getSelect({
id: 'startc', id: 'startc',
...@@ -1037,9 +1054,10 @@ ...@@ -1037,9 +1054,10 @@
link: 'startp', link: 'startp',
isFirst: false isFirst: false
}) })
var city = cityInfo.find(item => item.cityName == merchantForm.cityName) var city = cityInfo.find(item => item.cityName.indexOf(city) != -1)
merchantForm.cityCode = city.cityId merchantForm.cityCode = city.cityId
$('#startc').val(merchantForm.cityName) merchantForm.cityName = city.cityName
$('#startc').val(city.cityName)
form.render('select'); form.render('select');
layer.close(index) layer.close(index)
} else { } else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!