Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-shop
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 452aa6fb
authored
Aug 15, 2023
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
地图,二次确认
1 parent
a48232c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
21 deletions
src/views/customerManage/components/province-city/index.vue
src/views/customerManage/editCustomer.vue
src/views/customerManage/components/province-city/index.vue
View file @
452aa6f
...
@@ -14,13 +14,12 @@
...
@@ -14,13 +14,12 @@
</el-select>
</el-select>
</div>
</div>
</el-form-item>
</el-form-item>
<el-form-item
:label=
"detailAddressLabel"
>
<el-form-item
:label=
"detailAddressLabel"
class=
"province-textarea"
>
<el-input
size=
"small"
v-if=
"mapView"
readonly
placeholder=
"请选择详细地址"
v-model=
"provinceForm.fullAddress"
class=
"map-input"
>
<el-input
size=
"small"
type=
"textarea"
:rows=
"3"
v-if=
"mapView"
maxlength=
"50"
:readonly=
"!(provinceForm.provinceName && provinceForm.cityName)"
placeholder=
"请选择详细地址"
v-model=
"provinceForm.fullAddress"
class=
"map-input"
@
blur=
"handleInputAddr"
></el-input>
<el-button
size=
"small"
slot=
"append"
@
click=
"hanleSelectMap"
icon=
"gl-icon-location"
>
<el-button
type=
"text"
size=
"small"
@
click=
"hanleSelectMap"
icon=
"gl-icon-location"
>
<!--
<img
src=
"@/assets/map.png"
alt=
""
class=
"map-icon"
/>
-->
<!--
<img
src=
"@/assets/map.png"
alt=
""
class=
"map-icon"
/>
-->
<!--
<i
class=
"gl-icon-location"
></i>
-->
<!--
<i
class=
"gl-icon-location"
></i>
-->
</el-button>
</el-button>
</el-input>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
<GLDialog
:visible
.
sync=
"dialogMapVisible"
:mode=
"'big'"
bigTitle=
"选择地址"
>
<GLDialog
:visible
.
sync=
"dialogMapVisible"
:mode=
"'big'"
bigTitle=
"选择地址"
>
...
@@ -35,6 +34,7 @@
...
@@ -35,6 +34,7 @@
<
script
>
<
script
>
import
mapView
from
'./mapView.vue'
import
mapView
from
'./mapView.vue'
let
map
// import GLDialog from '@/packages/GLDialog/src/GLDialog'
// import GLDialog from '@/packages/GLDialog/src/GLDialog'
export
default
{
export
default
{
name
:
'GLProvince'
,
name
:
'GLProvince'
,
...
@@ -168,15 +168,13 @@ export default {
...
@@ -168,15 +168,13 @@ export default {
},
},
// 省市回显
// 省市回显
init
(
provinceData
)
{
init
(
provinceData
)
{
console
.
log
(
provinceData
,
'fdkjfkdfdkfldfkl000000000000'
)
// const { provinceName, cityName, townName, merchantAddress, longitude, latitude } = provinceData
// const { provinceName, cityName, townName, merchantAddress, longitude, latitude } = provinceData
this
.
provinceForm
.
provinceName
=
provinceData
.
provinceName
this
.
provinceForm
.
provinceName
=
provinceData
.
provinceName
this
.
provinceForm
.
cityName
=
provinceData
.
cityName
this
.
provinceForm
.
cityName
=
provinceData
.
cityName
this
.
provinceForm
.
townName
=
provinceData
.
townName
||
''
this
.
provinceForm
.
townName
=
provinceData
.
townName
||
''
this
.
provinceForm
.
fullAddress
=
provinceData
.
merchantAddress
this
.
provinceForm
.
fullAddress
=
provinceData
.
merchantAddress
||
''
this
.
provinceForm
.
lng
=
provinceData
.
longitude
this
.
provinceForm
.
lng
=
provinceData
.
longitude
this
.
provinceForm
.
lat
=
provinceData
.
latitude
this
.
provinceForm
.
lat
=
provinceData
.
latitude
console
.
log
(
this
.
provinceForm
,
'provinceForm'
)
if
(
provinceData
.
provinceName
)
{
if
(
provinceData
.
provinceName
)
{
this
.
AllData
.
map
(
item
=>
{
this
.
AllData
.
map
(
item
=>
{
if
(
item
.
name
.
indexOf
(
provinceData
.
provinceName
)
!=
-
1
)
{
if
(
item
.
name
.
indexOf
(
provinceData
.
provinceName
)
!=
-
1
)
{
...
@@ -209,6 +207,8 @@ export default {
...
@@ -209,6 +207,8 @@ export default {
this
.
provinceForm
.
fullAddress
=
''
this
.
provinceForm
.
fullAddress
=
''
this
.
provinceForm
.
cityName
=
''
this
.
provinceForm
.
cityName
=
''
this
.
provinceForm
.
townName
=
''
this
.
provinceForm
.
townName
=
''
this
.
provinceForm
.
lat
=
''
this
.
provinceForm
.
lng
=
''
if
(
val
)
{
if
(
val
)
{
this
.
cityList
=
val
.
districts
this
.
cityList
=
val
.
districts
}
else
{
}
else
{
...
@@ -222,6 +222,8 @@ export default {
...
@@ -222,6 +222,8 @@ export default {
this
.
provinceForm
.
cityName
=
val
?
val
.
name
:
''
this
.
provinceForm
.
cityName
=
val
?
val
.
name
:
''
this
.
provinceForm
.
fullAddress
=
''
this
.
provinceForm
.
fullAddress
=
''
this
.
provinceForm
.
townName
=
''
this
.
provinceForm
.
townName
=
''
this
.
provinceForm
.
lat
=
''
this
.
provinceForm
.
lng
=
''
if
(
val
)
{
if
(
val
)
{
this
.
townList
=
val
.
districts
this
.
townList
=
val
.
districts
}
else
{
}
else
{
...
@@ -234,10 +236,36 @@ export default {
...
@@ -234,10 +236,36 @@ export default {
selectTown
(
val
)
{
selectTown
(
val
)
{
this
.
provinceForm
.
townName
=
val
?
val
.
name
:
''
this
.
provinceForm
.
townName
=
val
?
val
.
name
:
''
this
.
provinceForm
.
fullAddress
=
''
this
.
provinceForm
.
fullAddress
=
''
this
.
provinceForm
.
lat
=
''
this
.
provinceForm
.
lng
=
''
// 选择区
// 选择区
this
.
$emit
(
'selectTown'
,
val
)
this
.
$emit
(
'selectTown'
,
val
)
},
},
getLoc
(
addr
)
{
let
_this
=
this
//加载地理编码插件
AMap
.
plugin
([
'AMap.Geocoder'
],
function
()
{
map
=
new
AMap
.
Geocoder
({})
// 返回地理编码结果
map
.
getLocation
(
addr
,
function
(
status
,
result
)
{
if
(
status
===
'complete'
&&
result
.
info
===
'OK'
)
{
// result中对应详细地理坐标信息
_this
.
provinceForm
.
lat
=
result
.
geocodes
[
0
].
location
.
lat
_this
.
provinceForm
.
lng
=
result
.
geocodes
[
0
].
location
.
lng
_this
.
provinceForm
.
provinceCode
=
result
.
geocodes
[
0
].
adcode
.
slice
(
0
,
2
)
+
'0000'
_this
.
provinceForm
.
cityCode
=
result
.
geocodes
[
0
].
adcode
}
})
})
},
handleInputAddr
()
{
if
(
!
this
.
provinceForm
.
lat
||
!
this
.
provinceForm
.
lng
)
{
this
.
getLoc
(
this
.
provinceForm
.
provinceName
+
this
.
provinceForm
.
cityName
+
this
.
provinceForm
.
townName
)
}
},
// 打开地图弹框
// 打开地图弹框
hanleSelectMap
()
{
hanleSelectMap
()
{
console
.
log
(
this
.
provinceForm
)
console
.
log
(
this
.
provinceForm
)
...
@@ -263,7 +291,6 @@ export default {
...
@@ -263,7 +291,6 @@ export default {
this
.
provinceForm
.
lng
=
lnglat
.
lng
this
.
provinceForm
.
lng
=
lnglat
.
lng
var
mapData
=
this
.
$refs
.
mapForm
.
geocoderAddress
var
mapData
=
this
.
$refs
.
mapForm
.
geocoderAddress
// 赋值省市区名称和code
// 赋值省市区名称和code
console
.
log
(
this
.
$refs
.
mapForm
,
'\\\\\\'
)
const
{
city
,
citycode
,
province
,
district
,
towncode
}
=
mapData
.
addressComponent
const
{
city
,
citycode
,
province
,
district
,
towncode
}
=
mapData
.
addressComponent
if
(
!
this
.
provinceForm
.
provinceName
)
{
if
(
!
this
.
provinceForm
.
provinceName
)
{
this
.
provinceForm
.
provinceName
=
province
this
.
provinceForm
.
provinceName
=
province
...
@@ -308,6 +335,7 @@ export default {
...
@@ -308,6 +335,7 @@ export default {
// 如果只展示省市
// 如果只展示省市
if
(
this
.
provinceForm
.
provinceName
&&
!
this
.
provinceForm
.
townName
)
{
if
(
this
.
provinceForm
.
provinceName
&&
!
this
.
provinceForm
.
townName
)
{
if
(
this
.
provinceForm
.
provinceName
!==
provincename
||
this
.
provinceForm
.
cityName
!==
cityname
)
{
if
(
this
.
provinceForm
.
provinceName
!==
provincename
||
this
.
provinceForm
.
cityName
!==
cityname
)
{
this
.
provinceForm
.
fullAddress
=
''
this
.
$message
.
error
(
'您选择的地址错误,请重新选择'
)
this
.
$message
.
error
(
'您选择的地址错误,请重新选择'
)
return
return
}
}
...
@@ -315,13 +343,14 @@ export default {
...
@@ -315,13 +343,14 @@ export default {
// 如果展示省市区
// 如果展示省市区
if
(
this
.
provinceForm
.
provinceName
&&
this
.
provinceForm
.
townName
)
{
if
(
this
.
provinceForm
.
provinceName
&&
this
.
provinceForm
.
townName
)
{
if
(
this
.
provinceForm
.
provinceName
!==
provincename
||
this
.
provinceForm
.
cityName
!==
cityname
||
this
.
provinceForm
.
townName
!==
town
)
{
if
(
this
.
provinceForm
.
provinceName
!==
provincename
||
this
.
provinceForm
.
cityName
!==
cityname
||
this
.
provinceForm
.
townName
!==
town
)
{
this
.
provinceForm
.
fullAddress
=
''
this
.
$message
.
error
(
'您选择的地址错误,请重新选择'
)
this
.
$message
.
error
(
'您选择的地址错误,请重新选择'
)
return
return
}
}
}
}
console
.
log
(
'????'
)
this
.
dialogMapVisible
=
false
this
.
dialogMapVisible
=
false
// this.subdistrict == 2 ? this.init(province, city) : this.init(province, city, town)
// this.subdistrict == 2 ? this.init(province, city) : this.init(province, city, town)
// console.log(this.provinceForm.lat, 'provinceForm')
// 通过地图选择省市区
// 通过地图选择省市区
this
.
$emit
(
'selectAddressByMap'
,
this
.
provinceForm
)
this
.
$emit
(
'selectAddressByMap'
,
this
.
provinceForm
)
}
}
...
@@ -340,6 +369,19 @@ export default {
...
@@ -340,6 +369,19 @@ export default {
.gl-form-page
.el-form
.province-box
.el-select
.el-input
{
.gl-form-page
.el-form
.province-box
.el-select
.el-input
{
width
:
136px
!important
;
width
:
136px
!important
;
}
}
.gl-form-page
.el-form
.province-textarea
.el-textarea
{
width
:
432px
!important
;
}
.province-textarea
{
position
:
relative
;
}
.province-textarea
.gl-icon-location
{
position
:
absolute
;
bottom
:
9px
;
right
:
80px
;
cursor
:
pointer
;
color
:
rgb
(
144
,
147
,
153
);
}
.gl-form-page
.el-form
.el-form-item
{
.gl-form-page
.el-form
.el-form-item
{
display
:
flex
;
display
:
flex
;
}
}
...
...
src/views/customerManage/editCustomer.vue
View file @
452aa6f
...
@@ -271,6 +271,8 @@ export default {
...
@@ -271,6 +271,8 @@ export default {
})
})
return
return
}
}
params
.
merchantBrandListJson
=
JSON
.
stringify
(
this
.
$common
.
utils
.
deepClone
(
this
.
editForm
.
merchantBrandList
))
delete
params
.
merchantBrandList
params
.
sceneList
=
[]
params
.
sceneList
=
[]
this
.
baseData
.
sceneList
.
forEach
(
item
=>
{
this
.
baseData
.
sceneList
.
forEach
(
item
=>
{
const
productCodeIds
=
item
.
productList
.
map
(
k
=>
k
.
productCode
)
const
productCodeIds
=
item
.
productList
.
map
(
k
=>
k
.
productCode
)
...
@@ -278,16 +280,25 @@ export default {
...
@@ -278,16 +280,25 @@ export default {
params
.
sceneList
.
push
(
item
.
sceneCode
)
params
.
sceneList
.
push
(
item
.
sceneCode
)
}
}
})
})
const
apiName
=
this
.
routeInfo
.
editType
==
'edit'
?
'updateMerchant'
:
'createMerchant'
this
.
$confirm
(
'<strong>是否确认提交?</strong> <div>提交客户开通申请,进入开店审核,审核通过后将为您自动创建客户</div> '
,
'提示'
,
{
this
.
$apis
.
customer
[
apiName
](
params
).
then
(
res
=>
{
dangerouslyUseHTMLString
:
true
,
this
.
$message
({
confirmButtonText
:
'确定'
,
message
:
res
.
code
==
'0'
?
'操作成功'
:
res
.
message
,
cancelButtonText
:
'取消'
,
type
:
res
.
code
==
'0'
?
'success'
:
'error'
type
:
'warning'
})
if
(
res
.
code
==
'0'
)
{
this
.
cancelJump
()
}
})
})
.
then
(()
=>
{
const
apiName
=
this
.
routeInfo
.
editType
==
'edit'
?
'updateMerchant'
:
'createMerchant'
this
.
$apis
.
customer
[
apiName
](
params
).
then
(
res
=>
{
this
.
$message
({
message
:
res
.
code
==
'0'
?
'操作成功'
:
res
.
message
,
type
:
res
.
code
==
'0'
?
'success'
:
'error'
})
if
(
res
.
code
==
'0'
)
{
this
.
cancelJump
()
}
})
})
.
catch
(()
=>
{
})
}
}
})
})
},
},
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment