Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
account
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 3ea786f2
authored
Aug 20, 2021
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
地图
1 parent
cc9b0ce0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
47 deletions
html/merchant/edit.html
html/merchant/map.html
html/merchant/edit.html
View file @
3ea786f
...
...
@@ -36,6 +36,10 @@
width
:
320px
;
}
.edit-box
.layui-form-item
.layui-input-inline.w-70
{
width
:
70%
;
}
.edit-box
.btn-no-border
{
border
:
none
;
}
...
...
@@ -166,9 +170,10 @@
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
商户地址:
</label>
<div
class=
"layui-input-inline"
>
<input
style=
"color: #333333 !important;"
name=
"merchantAddress"
disabled
class=
"layui-input layui-btn-disabled"
id=
"addrEl"
placeholder=
"请选择商户地址"
>
<div
class=
"layui-input-inline w-70"
>
<!-- <input style="color: #333333 !important;" name="merchantAddress" disabled
class="layui-input layui-btn-disabled" id="addrEl" placeholder="请选择商户地址"> -->
<div
class=
"m-t-10"
id=
"addrEl"
>
请选择商户地址
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
...
...
@@ -289,7 +294,7 @@
<div
id=
"subMerchantEl"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
上级商户:
</label>
<div
class=
"layui-input-inline"
>
<div
class=
"layui-input-inline
w-70
"
>
<!-- <input class="layui-input layui-btn-disabled" name="parentName" placeholder="请输入上级商户" disabled> -->
<div
class=
"m-t-10"
id=
"parentName"
></div>
</div>
...
...
@@ -326,7 +331,7 @@
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
账户类型:
</label>
<div
class=
"layui-input-inline"
id=
"accountTypeEl"
>
<div
class=
"layui-input-inline
w-70
"
id=
"accountTypeEl"
>
</div>
</div>
<div
class=
"layui-form-item"
style=
"text-align: center;"
>
...
...
@@ -662,30 +667,22 @@
area
:
[
'900px'
,
'600px'
],
btn
:
[
'确定'
,
'取消'
],
content
:
'map.html'
,
success
:
function
(
layero
,
index
)
{
//向layer页面传值,传值主要代码
// var body = layer.getChildFrame('body', index)
// console.log(body)
//得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
// var iframeWin = window[layero.find('iframe')[0]['name']]
// console.log(iframeWin)
//将弹窗页面中属性名id="merchantAddress"的标签赋值
// body.find("[id='merchantAddress']").val('fhdskfls')
},
yes
:
function
(
index
,
layero
)
{
// console.log(window["layui-layer-iframe" + index])
// var res = window["layui-layer-iframe" + index].callbackdata()
// console.log(res)
var
body
=
layer
.
getChildFrame
(
'body'
,
index
)
body
.
find
(
'#mapBtn'
).
click
()
var
res
=
helper
.
store
.
get
(
'merchantMapObj'
)
// console.log(res)
merchantForm
.
lat
=
res
.
lat
merchantForm
.
lng
=
res
.
lng
merchantForm
.
merchantAddress
=
res
.
merchantAddress
setInput
(
'#addrEl'
,
merchantForm
.
merchantAddress
)
layer
.
close
(
index
)
if
(
res
.
lat
&&
res
.
merchantAddress
)
{
merchantForm
.
lat
=
res
.
lat
merchantForm
.
lng
=
res
.
lng
merchantForm
.
merchantAddress
=
res
.
merchantAddress
$
(
'#addrEl'
).
text
(
merchantForm
.
merchantAddress
)
layer
.
close
(
index
)
}
else
{
layer
.
msg
(
'请选择地址'
,
{
icon
:
5
})
}
},
end
:
function
()
{
helper
.
store
.
remove
(
'merchantMapObj'
)
...
...
@@ -949,6 +946,9 @@
getMerchantApi
(
merchantId
,
function
(
res
)
{
form
.
val
(
'merchantForm'
,
res
.
data
)
merchantForm
=
res
.
data
if
(
merchantForm
.
merchantAddress
)
{
$
(
'#addrEl'
).
text
(
merchantForm
.
merchantAddress
)
}
if
(
merchantForm
.
status
!=
1
)
{
$
(
'#draft'
).
remove
()
}
...
...
html/merchant/map.html
View file @
3ea786f
...
...
@@ -60,9 +60,9 @@
<form
class=
"layui-form"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-input-inline"
style=
"width: calc(100% - 58px); margin: 0;"
>
<input
name=
"searchAddr"
class=
"layui-input"
placeholder=
"请输入地点名称"
>
<input
id=
"addrEl"
name=
"searchAddr"
class=
"layui-input"
placeholder=
"请输入地点名称"
>
</div>
<button
type=
"button"
class=
"layui-btn"
lay-submit
lay-filter=
"searchFilte
r"
>
<button
type=
"button"
class=
"layui-btn"
data-type=
"handleSearchAdd
r"
>
<i
class=
"layui-icon layui-icon-search"
></i>
</button>
</div>
...
...
@@ -75,15 +75,17 @@
<div
class=
"layui-form-item"
>
<input
name=
"merchantAddress"
id=
"merchantAddress"
class=
"layui-input"
placeholder=
"请输入详细地址,如道路、门牌号等"
>
</div>
<div
class=
"layui-form-item"
>
<button
id=
"mapBtn"
style=
"display: none;"
lay-submit
lay-filter=
"confirmFilter"
></button>
</div>
</form>
</div>
<button
id=
"mapBtn"
style=
"display: none;"
></button>
</main>
</div>
<script
src=
"https://www.layuicdn.com/layui/layui.js"
></script>
<script
src=
"/js/load.js"
></script>
<script
type=
"text/javascript"
src=
"https://webapi.amap.com/maps?v=1.4.15&key=44cc16e43ad7ed3358df507bd0618181&plugin=AMap.Geocoder&plugin=AMap.PlaceSearch"
>
src=
"https://webapi.amap.com/maps?v=1.4.15&key=44cc16e43ad7ed3358df507bd0618181&plugin=AMap.Geocoder&plugin=AMap.PlaceSearch
&plugin=AMap.Geolocation
"
>
</script>
<script>
layui
.
use
([
'helper'
],
function
()
{
...
...
@@ -102,27 +104,29 @@
init
()
form
.
on
(
'submit(searchFilter)'
,
function
(
data
)
{
// console.log(data)
getLocation
(
data
.
field
.
searchAddr
)
return
false
})
var
btnHandle
=
{
handleSearchAddr
:
function
()
{
var
addr
=
$
(
'#addrEl'
).
val
()
getLocation
(
addr
)
return
false
}
}
$
(
'#mapBtn'
).
on
(
'click'
,
function
()
{
helper
.
store
.
set
(
'merchantMapObj'
,
mapData
)
$
(
'.layui-btn'
).
on
(
'click'
,
function
()
{
var
type
=
$
(
this
).
data
(
'type'
)
if
(
btnHandle
[
type
])
{
btnHandle
[
type
]()
}
})
// var marker = new AMap.Marker({
// position: __pos,
// // 设置是否可以拖拽
// draggable: true,
// cursor: "move" // 设置拖拽效果
// })
// var marker = new AMap.Marker({
// position: [116.39, 39.9] //位置
// })
// map.add(marker) //添加到地图
form
.
on
(
'submit(confirmFilter)'
,
function
(
data
)
{
if
(
mapData
.
lat
&&
data
.
field
.
merchantAddress
)
{
mapData
.
merchantAddress
=
data
.
field
.
merchantAddress
helper
.
store
.
set
(
'merchantMapObj'
,
mapData
)
}
return
false
})
map
.
on
(
'click'
,
setLocation
)
function
init
()
{
...
...
@@ -131,6 +135,17 @@
if
(
mapData
.
lat
&&
mapData
.
lng
)
{
__pos
=
[
mapData
.
lng
,
mapData
.
lat
]
modelVal
(
'merchantAddress'
,
mapData
.
merchantAddress
)
}
else
{
var
geolocation
=
new
AMap
.
Geolocation
({})
geolocation
.
getCurrentPosition
()
AMap
.
event
.
addListener
(
geolocation
,
'complete'
,
(
e
)
=>
{
// console.log(e) // 定位成功之后做的事
__pos
=
[
e
.
position
.
lng
,
e
.
position
.
lat
]
mapData
.
lat
=
e
.
position
.
lat
mapData
.
lng
=
e
.
position
.
lng
mapData
.
merchantAddress
=
e
.
formattedAddress
modelVal
(
'merchantAddress'
,
mapData
.
merchantAddress
)
})
}
marker
=
new
AMap
.
Marker
({
...
...
@@ -207,7 +222,7 @@
placeSearch
.
search
(
keywords
,
function
(
status
,
result
)
{
console
.
log
(
result
)
//
console.log(result)
// 搜索成功时,result即是对应的匹配数据
if
(
result
&&
...
...
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