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 @@
...
@@ -36,6 +36,10 @@
width
:
320px
;
width
:
320px
;
}
}
.edit-box
.layui-form-item
.layui-input-inline.w-70
{
width
:
70%
;
}
.edit-box
.btn-no-border
{
.edit-box
.btn-no-border
{
border
:
none
;
border
:
none
;
}
}
...
@@ -166,9 +170,10 @@
...
@@ -166,9 +170,10 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
商户地址:
</label>
<label
class=
"layui-form-label"
>
商户地址:
</label>
<div
class=
"layui-input-inline"
>
<div
class=
"layui-input-inline w-70"
>
<input
style=
"color: #333333 !important;"
name=
"merchantAddress"
disabled
<!-- <input style="color: #333333 !important;" name="merchantAddress" disabled
class=
"layui-input layui-btn-disabled"
id=
"addrEl"
placeholder=
"请选择商户地址"
>
class="layui-input layui-btn-disabled" id="addrEl" placeholder="请选择商户地址"> -->
<div
class=
"m-t-10"
id=
"addrEl"
>
请选择商户地址
</div>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
...
@@ -289,7 +294,7 @@
...
@@ -289,7 +294,7 @@
<div
id=
"subMerchantEl"
>
<div
id=
"subMerchantEl"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
上级商户:
</label>
<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> -->
<!-- <input class="layui-input layui-btn-disabled" name="parentName" placeholder="请输入上级商户" disabled> -->
<div
class=
"m-t-10"
id=
"parentName"
></div>
<div
class=
"m-t-10"
id=
"parentName"
></div>
</div>
</div>
...
@@ -326,7 +331,7 @@
...
@@ -326,7 +331,7 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
账户类型:
</label>
<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>
</div>
<div
class=
"layui-form-item"
style=
"text-align: center;"
>
<div
class=
"layui-form-item"
style=
"text-align: center;"
>
...
@@ -662,30 +667,22 @@
...
@@ -662,30 +667,22 @@
area
:
[
'900px'
,
'600px'
],
area
:
[
'900px'
,
'600px'
],
btn
:
[
'确定'
,
'取消'
],
btn
:
[
'确定'
,
'取消'
],
content
:
'map.html'
,
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
)
{
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
)
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)
// console.log(res)
merchantForm
.
lat
=
res
.
lat
if
(
res
.
lat
&&
res
.
merchantAddress
)
{
merchantForm
.
lng
=
res
.
lng
merchantForm
.
lat
=
res
.
lat
merchantForm
.
merchantAddress
=
res
.
merchantAddress
merchantForm
.
lng
=
res
.
lng
setInput
(
'#addrEl'
,
merchantForm
.
merchantAddress
)
merchantForm
.
merchantAddress
=
res
.
merchantAddress
layer
.
close
(
index
)
$
(
'#addrEl'
).
text
(
merchantForm
.
merchantAddress
)
layer
.
close
(
index
)
}
else
{
layer
.
msg
(
'请选择地址'
,
{
icon
:
5
})
}
},
},
end
:
function
()
{
end
:
function
()
{
helper
.
store
.
remove
(
'merchantMapObj'
)
helper
.
store
.
remove
(
'merchantMapObj'
)
...
@@ -949,6 +946,9 @@
...
@@ -949,6 +946,9 @@
getMerchantApi
(
merchantId
,
function
(
res
)
{
getMerchantApi
(
merchantId
,
function
(
res
)
{
form
.
val
(
'merchantForm'
,
res
.
data
)
form
.
val
(
'merchantForm'
,
res
.
data
)
merchantForm
=
res
.
data
merchantForm
=
res
.
data
if
(
merchantForm
.
merchantAddress
)
{
$
(
'#addrEl'
).
text
(
merchantForm
.
merchantAddress
)
}
if
(
merchantForm
.
status
!=
1
)
{
if
(
merchantForm
.
status
!=
1
)
{
$
(
'#draft'
).
remove
()
$
(
'#draft'
).
remove
()
}
}
...
...
html/merchant/map.html
View file @
3ea786f
...
@@ -60,9 +60,9 @@
...
@@ -60,9 +60,9 @@
<form
class=
"layui-form"
>
<form
class=
"layui-form"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-input-inline"
style=
"width: calc(100% - 58px); margin: 0;"
>
<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>
</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>
<i
class=
"layui-icon layui-icon-search"
></i>
</button>
</button>
</div>
</div>
...
@@ -75,15 +75,17 @@
...
@@ -75,15 +75,17 @@
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<input
name=
"merchantAddress"
id=
"merchantAddress"
class=
"layui-input"
placeholder=
"请输入详细地址,如道路、门牌号等"
>
<input
name=
"merchantAddress"
id=
"merchantAddress"
class=
"layui-input"
placeholder=
"请输入详细地址,如道路、门牌号等"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<button
id=
"mapBtn"
style=
"display: none;"
lay-submit
lay-filter=
"confirmFilter"
></button>
</div>
</form>
</form>
</div>
</div>
<button
id=
"mapBtn"
style=
"display: none;"
></button>
</main>
</main>
</div>
</div>
<script
src=
"https://www.layuicdn.com/layui/layui.js"
></script>
<script
src=
"https://www.layuicdn.com/layui/layui.js"
></script>
<script
src=
"/js/load.js"
></script>
<script
src=
"/js/load.js"
></script>
<script
type=
"text/javascript"
<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>
<script>
<script>
layui
.
use
([
'helper'
],
function
()
{
layui
.
use
([
'helper'
],
function
()
{
...
@@ -102,27 +104,29 @@
...
@@ -102,27 +104,29 @@
init
()
init
()
form
.
on
(
'submit(searchFilter)'
,
function
(
data
)
{
var
btnHandle
=
{
// console.log(data)
handleSearchAddr
:
function
()
{
getLocation
(
data
.
field
.
searchAddr
)
var
addr
=
$
(
'#addrEl'
).
val
()
return
false
getLocation
(
addr
)
})
return
false
}
}
$
(
'#mapBtn'
).
on
(
'click'
,
function
()
{
$
(
'.layui-btn'
).
on
(
'click'
,
function
()
{
helper
.
store
.
set
(
'merchantMapObj'
,
mapData
)
var
type
=
$
(
this
).
data
(
'type'
)
if
(
btnHandle
[
type
])
{
btnHandle
[
type
]()
}
})
})
// var marker = new AMap.Marker({
form
.
on
(
'submit(confirmFilter)'
,
function
(
data
)
{
// position: __pos,
if
(
mapData
.
lat
&&
data
.
field
.
merchantAddress
)
{
// // 设置是否可以拖拽
mapData
.
merchantAddress
=
data
.
field
.
merchantAddress
// draggable: true,
helper
.
store
.
set
(
'merchantMapObj'
,
mapData
)
// cursor: "move" // 设置拖拽效果
}
// })
return
false
})
// var marker = new AMap.Marker({
// position: [116.39, 39.9] //位置
// })
// map.add(marker) //添加到地图
map
.
on
(
'click'
,
setLocation
)
map
.
on
(
'click'
,
setLocation
)
function
init
()
{
function
init
()
{
...
@@ -131,6 +135,17 @@
...
@@ -131,6 +135,17 @@
if
(
mapData
.
lat
&&
mapData
.
lng
)
{
if
(
mapData
.
lat
&&
mapData
.
lng
)
{
__pos
=
[
mapData
.
lng
,
mapData
.
lat
]
__pos
=
[
mapData
.
lng
,
mapData
.
lat
]
modelVal
(
'merchantAddress'
,
mapData
.
merchantAddress
)
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
({
marker
=
new
AMap
.
Marker
({
...
@@ -207,7 +222,7 @@
...
@@ -207,7 +222,7 @@
placeSearch
.
search
(
placeSearch
.
search
(
keywords
,
keywords
,
function
(
status
,
result
)
{
function
(
status
,
result
)
{
console
.
log
(
result
)
//
console.log(result)
// 搜索成功时,result即是对应的匹配数据
// 搜索成功时,result即是对应的匹配数据
if
(
if
(
result
&&
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