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 d2024888
authored
Apr 13, 2022
by
匡雅琴
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新增省市
1 parent
1e567623
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
418 additions
and
80 deletions
html/merchant/add.html
html/merchant/addSubMerchant.html
html/merchant/detail.html
html/merchant/edit.html
js/common.js
html/merchant/add.html
View file @
d202488
...
@@ -643,17 +643,19 @@
...
@@ -643,17 +643,19 @@
id
:
'startp'
,
id
:
'startp'
,
name
:
'provinceName'
,
name
:
'provinceName'
,
url
:
'/area/list'
,
url
:
'/area/list'
,
value
:
'provinceId'
,
// value: 'provinceId',
value
:
'provinceName'
,
text
:
'provinceName'
,
text
:
'provinceName'
,
param
:
{
provinceName
:
'广东'
,
cityName
:
'深圳'
},
param
:
{
provinceName
:
'广东'
,
cityName
:
'深圳'
},
select
:
function
(
data
)
{
select
:
function
(
data
)
{
const
{
value
}
=
data
const
{
value
}
=
data
if
(
value
)
{
if
(
value
)
{
var
province
=
provinceInfoList
.
find
(
item
=>
item
.
provinceId
==
value
)
// var province = provinceInfoList.find(item => item.provinceId == value)
var
province
=
provinceInfoList
.
find
(
item
=>
item
.
provinceName
==
value
)
cityInfo
=
province
.
cityInfoList
cityInfo
=
province
.
cityInfoList
console
.
log
(
province
)
merchantForm
.
provinceCode
=
province
.
provinceId
merchantForm
.
provinceCode
=
province
.
provinceId
merchantForm
.
provinceName
=
province
.
provinceName
merchantForm
.
provinceName
=
province
.
provinceName
$
(
'#addrEl'
).
val
(
''
)
}
else
{
}
else
{
cityInfo
=
[]
cityInfo
=
[]
merchantForm
.
provinceCode
=
''
merchantForm
.
provinceCode
=
''
...
@@ -665,14 +667,16 @@
...
@@ -665,14 +667,16 @@
id
:
'startc'
,
id
:
'startc'
,
name
:
'cityName'
,
name
:
'cityName'
,
url
:
'/area/list'
,
url
:
'/area/list'
,
value
:
'cityId'
,
// value: 'cityId',
value
:
'cityName'
,
text
:
'cityName'
,
text
:
'cityName'
,
data
:
cityInfo
,
data
:
cityInfo
,
link
:
'startp'
,
link
:
'startp'
,
select
:
function
(
data
)
{
select
:
function
(
data
)
{
const
{
value
}
=
data
const
{
value
}
=
data
if
(
value
)
{
if
(
value
)
{
var
city
=
cityInfo
.
find
(
item
=>
item
.
cityId
==
value
)
// var city = cityInfo.find(item => item.cityId == value)
var
city
=
cityInfo
.
find
(
item
=>
item
.
cityName
==
value
)
merchantForm
.
cityCode
=
city
.
cityId
merchantForm
.
cityCode
=
city
.
cityId
merchantForm
.
cityName
=
city
.
cityName
merchantForm
.
cityName
=
city
.
cityName
}
else
{
}
else
{
...
@@ -681,11 +685,8 @@
...
@@ -681,11 +685,8 @@
}
}
}
}
})
})
console
.
log
(
merchantForm
)
}
}
})
})
// 禁用所有input框的回车事件
// 禁用所有input框的回车事件
var
inputs
=
document
.
getElementsByTagName
(
'input'
)
var
inputs
=
document
.
getElementsByTagName
(
'input'
)
for
(
let
i
=
0
;
i
<
inputs
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
inputs
.
length
;
i
++
)
{
...
@@ -880,6 +881,12 @@
...
@@ -880,6 +881,12 @@
params
.
lng
=
merchantForm
.
lng
params
.
lng
=
merchantForm
.
lng
params
.
merchantAddress
=
merchantForm
.
merchantAddress
params
.
merchantAddress
=
merchantForm
.
merchantAddress
}
}
if
(
merchantForm
.
provinceName
)
{
params
.
provinceName
=
merchantForm
.
provinceName
params
.
provinceCode
=
merchantForm
.
provinceCode
params
.
cityName
=
merchantForm
.
cityName
params
.
cityCode
=
merchantForm
.
cityCode
}
$
.
each
(
fieldToFormNameList
,
function
(
index
,
item
)
{
$
.
each
(
fieldToFormNameList
,
function
(
index
,
item
)
{
merchantForm
[
item
]
=
formData
[
item
]
||
''
merchantForm
[
item
]
=
formData
[
item
]
||
''
params
[
item
]
=
formData
[
item
]
||
''
params
[
item
]
=
formData
[
item
]
||
''
...
@@ -942,7 +949,6 @@
...
@@ -942,7 +949,6 @@
if
(
treeObj
)
{
if
(
treeObj
)
{
let
getCheckedNodes
=
treeObj
.
getCheckedNodes
(
true
)
let
getCheckedNodes
=
treeObj
.
getCheckedNodes
(
true
)
const
getCheckedKeys
=
treeObj
.
getCheckedNodes
(
true
).
map
(
item
=>
item
.
id
)
const
getCheckedKeys
=
treeObj
.
getCheckedNodes
(
true
).
map
(
item
=>
item
.
id
)
console
.
log
(
getCheckedKeys
)
getCheckedNodes
=
getCheckedNodes
.
filter
(
item
=>
item
.
children
)
getCheckedNodes
=
getCheckedNodes
.
filter
(
item
=>
item
.
children
)
merchantForm
.
merchantBrandList
=
getCheckedNodes
.
map
(
car
=>
{
merchantForm
.
merchantBrandList
=
getCheckedNodes
.
map
(
car
=>
{
let
merchantBrandId
=
[]
let
merchantBrandId
=
[]
...
@@ -956,7 +962,6 @@
...
@@ -956,7 +962,6 @@
merchantBrandId
merchantBrandId
}
}
})
})
console
.
log
(
merchantForm
.
merchantBrandList
)
params
.
merchantBrandListJson
=
JSON
.
stringify
(
merchantForm
.
merchantBrandList
)
params
.
merchantBrandListJson
=
JSON
.
stringify
(
merchantForm
.
merchantBrandList
)
}
}
if
(
merchantForm
.
merchantFiles
.
length
)
{
if
(
merchantForm
.
merchantFiles
.
length
)
{
...
@@ -983,40 +988,39 @@
...
@@ -983,40 +988,39 @@
params
.
status
=
1
params
.
status
=
1
}
}
console
.
log
(
params
)
console
.
log
(
params
)
// request(params, function (res) {
request
(
params
,
function
(
res
)
{
// if (res.code == '0') {
if
(
res
.
code
==
'0'
)
{
// if (editLevel == 3) {
if
(
editLevel
==
3
)
{
// layer.msg('操作成功', {
layer
.
msg
(
'操作成功'
,
{
// icon: 1
icon
:
1
// })
})
// go('merchant', 'index')
go
(
'merchant'
,
'index'
)
// } else {
}
else
{
// if (!merchantId) {
if
(
!
merchantId
)
{
// merchantId = res.data
merchantId
=
res
.
data
// }
}
// merchantForm.merchantAccountLevel = parseInt(merchantForm.merchantAccountLevel)
merchantForm
.
merchantAccountLevel
=
parseInt
(
merchantForm
.
merchantAccountLevel
)
// getMerchantApi(merchantId, function (respone) {
getMerchantApi
(
merchantId
,
function
(
respone
)
{
// form.val('merchantForm', respone.data)
form
.
val
(
'merchantForm'
,
respone
.
data
)
// merchantForm = respone.data
merchantForm
=
respone
.
data
if
(
merchantForm
.
merchantAddress
)
{
// if (merchantForm.merchantAddress) {
$
(
'#addrEl'
).
text
(
merchantForm
.
merchantAddress
)
// $('#addrEl').text(merchantForm.merchantAddress)
}
// }
accountTypeVisible
=
true
// accountTypeVisible = true
var
el
=
$
(
'#accountTypeEl'
)
// var el = $('#accountTypeEl')
el
.
empty
()
// el.empty()
recoveryFile
()
// recoveryFile()
getAccountType
()
// getAccountType()
baseIsShow
(
false
)
// baseIsShow(false)
treeIsShow
(
true
)
// treeIsShow(true)
if
(
isFreshSecond
)
{
// if (isFreshSecond) {
getById
()
// getById()
isFreshSecond
=
false
// isFreshSecond = false
}
// }
})
// })
}
// }
}
// }
})
// })
return
false
return
false
})
})
...
@@ -1047,7 +1051,40 @@
...
@@ -1047,7 +1051,40 @@
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
provinceIdx
=
res
.
merchantAddress
.
indexOf
(
'省'
)
var
cityIdx
=
res
.
merchantAddress
.
indexOf
(
'市'
)
var
province
=
res
.
merchantAddress
.
slice
(
0
,
provinceIdx
)
var
city
=
res
.
merchantAddress
.
slice
(
provinceIdx
+
1
,
cityIdx
)
// 判断省市是否匹配
if
(
merchantForm
.
provinceName
)
{
if
(
merchantForm
.
provinceName
!==
province
||
merchantForm
.
cityName
!==
city
)
{
layer
.
open
({
title
:
'提示'
,
content
:
'您选择的地址错误,请重新选择'
});
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
==
merchantForm
.
provinceName
)
cityInfo
=
province
.
cityInfoList
merchantForm
.
provinceCode
=
province
.
provinceId
com
.
getSelect
({
id
:
'startc'
,
value
:
'cityName'
,
text
:
'cityName'
,
data
:
cityInfo
,
link
:
'startp'
,
isFirst
:
false
})
var
city
=
cityInfo
.
find
(
item
=>
item
.
cityName
==
merchantForm
.
cityName
)
merchantForm
.
cityCode
=
city
.
cityId
$
(
'#startc'
).
val
(
merchantForm
.
cityName
)
form
.
render
(
'select'
);
layer
.
close
(
index
)
layer
.
close
(
index
)
}
else
{
}
else
{
layer
.
msg
(
'请选择地址'
,
{
layer
.
msg
(
'请选择地址'
,
{
...
...
html/merchant/addSubMerchant.html
View file @
d202488
...
@@ -231,6 +231,16 @@
...
@@ -231,6 +231,16 @@
left
:
340px
;
left
:
340px
;
top
:
0
;
top
:
0
;
}
}
.address
{
display
:
inline-block
;
width
:
calc
(
100%
-
120px
);
}
.select-address
{
width
:
calc
(
100%
-
600px
)
!important
;
margin-left
:
20px
;
}
</style>
</style>
<title>
商户编辑
</title>
<title>
商户编辑
</title>
</head>
</head>
...
@@ -311,11 +321,25 @@
...
@@ -311,11 +321,25 @@
</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 w-70"
>
<div
class=
"layui-input-inline"
>
<div
class=
"layui-bg-white padding10 padding-l20 layui-form"
>
<div
class=
"layui-input-inline margin-l10 w-70"
>
<div
class=
"searchBtn"
>
<select
name=
"select4"
id=
"startp"
lay-search
></select>
</div>
</div>
<div
class=
"layui-input-inline w-70"
style=
"margin-left: 20px;"
>
<div
class=
"searchBtn"
>
<select
name=
"select4"
id=
"startc"
lay-search
></select>
</div>
</div>
</div>
</div>
<div
class=
"layui-input-inline select-address"
>
<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
address
"
id=
"addrEl"
placeholder=
"请选择商户地址"
/>
<!-- <div class="m-t-10" id="addrEl">请选择商户地址</div> -->
<!-- <div class="m-t-10" id="addrEl">请选择商户地址</div> -->
<button
type=
"button"
class=
"layui-btn"
data-type=
"handleSelectAddr"
>
选择地址
</button>
<button
type=
"button"
class=
"layui-btn"
data-type=
"handleSelectAddr"
style=
"margin-left: 20px"
>
选择地址
</button>
</div>
</div>
</div>
</div>
<!-- <div class="layui-form-item">
<!-- <div class="layui-form-item">
...
@@ -535,7 +559,8 @@
...
@@ -535,7 +559,8 @@
<script
src=
"/js/load.js"
></script>
<script
src=
"/js/load.js"
></script>
<script
src=
"/js/validator.js"
></script>
<script
src=
"/js/validator.js"
></script>
<script>
<script>
layui
.
use
([
'gtree'
,
'request'
,
'helper'
,
'layer'
,
'laydate'
,
'element'
,
'xmSelect'
,
'laytpl'
,
'validator'
,
'util'
],
function
()
{
layui
.
use
([
'gtree'
,
'request'
,
'helper'
,
'layer'
,
'laydate'
,
'element'
,
'xmSelect'
,
'laytpl'
,
'validator'
,
'util'
,
'common'
],
function
()
{
var
com
=
layui
.
common
var
tree
=
layui
.
gtree
var
tree
=
layui
.
gtree
var
request
=
layui
.
request
var
request
=
layui
.
request
var
form
=
layui
.
form
var
form
=
layui
.
form
...
@@ -597,7 +622,58 @@
...
@@ -597,7 +622,58 @@
busiScopeList
:
[],
busiScopeList
:
[],
accountTypeList
:
[]
accountTypeList
:
[]
}
}
var
provinceInfoList
=
[]
var
cityInfo
=
[]
// 省市区
getProvinceList
()
com
.
getSelect
({
id
:
'startp'
,
name
:
'provinceName'
,
url
:
'/area/list'
,
// value: 'provinceId',
value
:
'provinceName'
,
text
:
'provinceName'
,
param
:
{
provinceName
:
'广东'
,
cityName
:
'深圳'
},
select
:
function
(
data
)
{
const
{
value
}
=
data
if
(
value
)
{
// var province = provinceInfoList.find(item => item.provinceId == value)
var
province
=
provinceInfoList
.
find
(
item
=>
item
.
provinceName
==
value
)
cityInfo
=
province
.
cityInfoList
merchantForm
.
provinceCode
=
province
.
provinceId
merchantForm
.
provinceName
=
province
.
provinceName
$
(
'#addrEl'
).
val
(
''
)
}
else
{
cityInfo
=
[]
merchantForm
.
provinceCode
=
''
merchantForm
.
provinceName
=
''
}
merchantForm
.
cityCode
=
''
merchantForm
.
cityName
=
''
com
.
getSelect
({
id
:
'startc'
,
name
:
'cityName'
,
url
:
'/area/list'
,
// value: 'cityId',
value
:
'cityName'
,
text
:
'cityName'
,
data
:
cityInfo
,
link
:
'startp'
,
select
:
function
(
data
)
{
const
{
value
}
=
data
if
(
value
)
{
// var city = cityInfo.find(item => item.cityId == value)
var
city
=
cityInfo
.
find
(
item
=>
item
.
cityName
==
value
)
merchantForm
.
cityCode
=
city
.
cityId
merchantForm
.
cityName
=
city
.
cityName
}
else
{
merchantForm
.
cityCode
=
''
merchantForm
.
cityName
=
''
}
}
})
}
})
// 禁用所有input框的回车事件
// 禁用所有input框的回车事件
var
inputs
=
document
.
getElementsByTagName
(
'input'
)
var
inputs
=
document
.
getElementsByTagName
(
'input'
)
for
(
let
i
=
0
;
i
<
inputs
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
inputs
.
length
;
i
++
)
{
...
@@ -804,6 +880,12 @@
...
@@ -804,6 +880,12 @@
params
.
lng
=
merchantForm
.
lng
params
.
lng
=
merchantForm
.
lng
params
.
merchantAddress
=
merchantForm
.
merchantAddress
params
.
merchantAddress
=
merchantForm
.
merchantAddress
}
}
if
(
merchantForm
.
provinceName
)
{
params
.
provinceName
=
merchantForm
.
provinceName
params
.
provinceCode
=
merchantForm
.
provinceCode
params
.
cityName
=
merchantForm
.
cityName
params
.
cityCode
=
merchantForm
.
cityCode
}
$
.
each
(
fieldToFormNameList
,
function
(
index
,
item
)
{
$
.
each
(
fieldToFormNameList
,
function
(
index
,
item
)
{
merchantForm
[
item
]
=
formData
[
item
]
||
''
merchantForm
[
item
]
=
formData
[
item
]
||
''
params
[
item
]
=
formData
[
item
]
||
''
params
[
item
]
=
formData
[
item
]
||
''
...
@@ -975,7 +1057,41 @@
...
@@ -975,7 +1057,41 @@
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
provinceIdx
=
res
.
merchantAddress
.
indexOf
(
'省'
)
var
cityIdx
=
res
.
merchantAddress
.
indexOf
(
'市'
)
var
province
=
res
.
merchantAddress
.
slice
(
0
,
provinceIdx
)
var
city
=
res
.
merchantAddress
.
slice
(
provinceIdx
+
1
,
cityIdx
)
// 判断省市是否匹配
if
(
merchantForm
.
provinceName
)
{
if
(
merchantForm
.
provinceName
!==
province
||
merchantForm
.
cityName
!==
city
)
{
layer
.
open
({
title
:
'提示'
,
content
:
'您选择的地址错误,请重新选择'
});
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
==
merchantForm
.
provinceName
)
cityInfo
=
province
.
cityInfoList
merchantForm
.
provinceCode
=
province
.
provinceId
com
.
getSelect
({
id
:
'startc'
,
value
:
'cityName'
,
text
:
'cityName'
,
data
:
cityInfo
,
link
:
'startp'
,
isFirst
:
false
})
var
city
=
cityInfo
.
find
(
item
=>
item
.
cityName
==
merchantForm
.
cityName
)
merchantForm
.
cityCode
=
city
.
cityId
$
(
'#startc'
).
val
(
merchantForm
.
cityName
)
form
.
render
(
'select'
);
console
.
log
(
merchantForm
,
'-----------'
)
layer
.
close
(
index
)
layer
.
close
(
index
)
}
else
{
}
else
{
layer
.
msg
(
'请选择地址'
,
{
layer
.
msg
(
'请选择地址'
,
{
...
@@ -1515,6 +1631,20 @@
...
@@ -1515,6 +1631,20 @@
})
})
}
}
// 省市区
function
getProvinceList
()
{
var
ajax
=
layui
.
$
.
ajax
ajax
({
// url: 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/glsx-oss-account-config',
url
:
'http://oss-config.dev.glsx.com.cn/mock/617ba1df1072f92988f05a14/account/provinceList'
,
async
:
false
,
success
:
function
(
res
)
{
console
.
log
(
res
)
provinceInfoList
=
res
.
provinceInfoList
}
})
}
// 数 - start
// 数 - start
var
laytpl
=
layui
.
laytpl
var
laytpl
=
layui
.
laytpl
var
xmSelect
=
layui
.
xmSelect
var
xmSelect
=
layui
.
xmSelect
...
...
html/merchant/detail.html
View file @
d202488
...
@@ -489,6 +489,27 @@
...
@@ -489,6 +489,27 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"layui-col-md5"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
驻店电话:
</label>
<div
class=
"layui-input-block"
>
<!-- layui-form-mid -->
<div
class=
"layui-word-aux"
id=
"residentPhone"
></div>
</div>
</div>
</div>
<div
class=
"layui-col-md5"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
营业时间:
</label>
<div
class=
"layui-input-block"
>
<!-- layui-form-mid -->
<div
class=
"layui-word-aux"
id=
"businessTime"
></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -587,7 +608,8 @@
...
@@ -587,7 +608,8 @@
'merchantModelName'
,
'merchantModelName'
,
'statusName'
,
'statusName'
,
'entmicroName'
,
'entmicroName'
,
'sapCode'
'sapCode'
,
'residentPhone'
]
]
var
roleData
=
{}
var
roleData
=
{}
var
accountAuth
=
[]
var
accountAuth
=
[]
...
@@ -691,10 +713,10 @@
...
@@ -691,10 +713,10 @@
if
(
roleData
.
merchantType
==
2
)
{
if
(
roleData
.
merchantType
==
2
)
{
$
(
'#orgTxt'
).
text
(
'组织机构代码:'
)
$
(
'#orgTxt'
).
text
(
'组织机构代码:'
)
}
}
console
.
log
(
roleData
)
if
(
roleData
.
channelId
==
2
)
{
if
(
roleData
.
channelId
==
2
)
{
$
(
'#sapBox'
).
removeClass
(
'hide'
)
$
(
'#sapBox'
).
removeClass
(
'hide'
)
}
}
roleData
.
bussinessBegintime
?
$
(
'#businessTime'
).
text
(
roleData
.
bussinessBegintime
+
'-'
+
roleData
.
bussinessEndtime
)
:
$
(
'#businessTime'
).
text
(
'-'
)
// var effectiveTimeNameEl = $('#effectiveTimeName')
// var effectiveTimeNameEl = $('#effectiveTimeName')
// if (roleData.merchantAccountLevel == 4) { // 门店
// if (roleData.merchantAccountLevel == 4) { // 门店
// if (roleData.status == 1 || roleData.status == 5) {
// if (roleData.status == 1 || roleData.status == 5) {
...
...
html/merchant/edit.html
View file @
d202488
...
@@ -400,11 +400,26 @@
...
@@ -400,11 +400,26 @@
</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 w-70"
>
<div
class=
"layui-input-inline"
>
<input
style=
"color: #333333 !important"
name=
"merchantAddress"
disabled
<div
class=
"layui-bg-white padding10 padding-l20 layui-form"
>
class=
"layui-input layui-btn-disabled"
id=
"addrEl"
placeholder=
"请选择商户地址"
/>
<div
class=
"layui-input-inline margin-l10 w-70"
>
<div
class=
"searchBtn"
>
<select
name=
"select4"
id=
"startp"
lay-search
></select>
</div>
</div>
<div
class=
"layui-input-inline w-70"
style=
"margin-left: 20px;"
>
<div
class=
"searchBtn"
>
<select
name=
"select4"
id=
"startc"
lay-search
></select>
</div>
</div>
</div>
</div>
<div
class=
"layui-input-inline select-address"
>
<input
style=
"color: #333333 !important;"
name=
"merchantAddress"
disabled
class=
"layui-input layui-btn-disabled address"
id=
"addrEl"
placeholder=
"请选择商户地址"
/>
<!-- <div class="m-t-10" id="addrEl">请选择商户地址</div> -->
<!-- <div class="m-t-10" id="addrEl">请选择商户地址</div> -->
<button
type=
"button"
class=
"layui-btn"
data-type=
"handleSelectAddr"
>
选择地址
</button>
<button
type=
"button"
class=
"layui-btn"
data-type=
"handleSelectAddr"
style=
"margin-left: 20px"
>
选择地址
</button>
</div>
</div>
</div>
</div>
...
@@ -523,7 +538,8 @@
...
@@ -523,7 +538,8 @@
<script
src=
"/js/load.js"
></script>
<script
src=
"/js/load.js"
></script>
<script
src=
"/js/validator.js"
></script>
<script
src=
"/js/validator.js"
></script>
<script>
<script>
layui
.
use
([
'gtree'
,
'request'
,
'helper'
,
'layer'
,
'laydate'
,
'element'
,
'xmSelect'
,
'laytpl'
,
'validator'
,
'util'
],
function
()
{
layui
.
use
([
'gtree'
,
'request'
,
'helper'
,
'layer'
,
'laydate'
,
'element'
,
'xmSelect'
,
'laytpl'
,
'validator'
,
'util'
,
'common'
],
function
()
{
var
com
=
layui
.
common
var
tree
=
layui
.
gtree
var
tree
=
layui
.
gtree
var
request
=
layui
.
request
var
request
=
layui
.
request
var
form
=
layui
.
form
var
form
=
layui
.
form
...
@@ -593,6 +609,58 @@
...
@@ -593,6 +609,58 @@
busiScopeList
:
[],
busiScopeList
:
[],
accountTypeList
:
[]
accountTypeList
:
[]
}
}
var
provinceInfoList
=
[]
var
cityInfo
=
[]
// 省市区
getProvinceList
()
com
.
getSelect
({
id
:
'startp'
,
name
:
'provinceName'
,
url
:
'/area/list'
,
// value: 'provinceId',
value
:
'provinceName'
,
text
:
'provinceName'
,
param
:
{
provinceName
:
'广东'
,
cityName
:
'深圳'
},
select
:
function
(
data
)
{
const
{
value
}
=
data
if
(
value
)
{
// var province = provinceInfoList.find(item => item.provinceId == value)
var
province
=
provinceInfoList
.
find
(
item
=>
item
.
provinceName
==
value
)
cityInfo
=
province
.
cityInfoList
merchantForm
.
provinceCode
=
province
.
provinceId
merchantForm
.
provinceName
=
province
.
provinceName
$
(
'#addrEl'
).
val
(
''
)
}
else
{
cityInfo
=
[]
merchantForm
.
provinceCode
=
''
merchantForm
.
provinceName
=
''
}
merchantForm
.
cityCode
=
''
merchantForm
.
cityName
=
''
com
.
getSelect
({
id
:
'startc'
,
name
:
'cityName'
,
url
:
'/area/list'
,
// value: 'cityId',
value
:
'cityName'
,
text
:
'cityName'
,
data
:
cityInfo
,
link
:
'startp'
,
select
:
function
(
data
)
{
const
{
value
}
=
data
if
(
value
)
{
// var city = cityInfo.find(item => item.cityId == value)
var
city
=
cityInfo
.
find
(
item
=>
item
.
cityName
==
value
)
merchantForm
.
cityCode
=
city
.
cityId
merchantForm
.
cityName
=
city
.
cityName
}
else
{
merchantForm
.
cityCode
=
''
merchantForm
.
cityName
=
''
}
}
})
}
})
// 禁用所有input框的回车事件
// 禁用所有input框的回车事件
var
inputs
=
document
.
getElementsByTagName
(
'input'
)
var
inputs
=
document
.
getElementsByTagName
(
'input'
)
...
@@ -788,7 +856,13 @@
...
@@ -788,7 +856,13 @@
params
.
lng
=
merchantForm
.
lng
params
.
lng
=
merchantForm
.
lng
params
.
merchantAddress
=
merchantForm
.
merchantAddress
params
.
merchantAddress
=
merchantForm
.
merchantAddress
}
}
// 省市
if
(
merchantForm
.
provinceName
)
{
params
.
provinceName
=
merchantForm
.
provinceName
params
.
provinceCode
=
merchantForm
.
provinceCode
params
.
cityName
=
merchantForm
.
cityName
params
.
cityCode
=
merchantForm
.
cityCode
}
$
.
each
(
fieldToFormNameList
,
function
(
index
,
item
)
{
$
.
each
(
fieldToFormNameList
,
function
(
index
,
item
)
{
merchantForm
[
item
]
=
formData
[
item
]
||
''
merchantForm
[
item
]
=
formData
[
item
]
||
''
params
[
item
]
=
formData
[
item
]
||
''
params
[
item
]
=
formData
[
item
]
||
''
...
@@ -933,7 +1007,40 @@
...
@@ -933,7 +1007,40 @@
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
provinceIdx
=
res
.
merchantAddress
.
indexOf
(
'省'
)
var
cityIdx
=
res
.
merchantAddress
.
indexOf
(
'市'
)
var
province
=
res
.
merchantAddress
.
slice
(
0
,
provinceIdx
)
var
city
=
res
.
merchantAddress
.
slice
(
provinceIdx
+
1
,
cityIdx
)
// 判断省市是否匹配
if
(
merchantForm
.
provinceName
)
{
if
(
merchantForm
.
provinceName
!==
province
||
merchantForm
.
cityName
!==
city
)
{
layer
.
open
({
title
:
'提示'
,
content
:
'您选择的地址错误,请重新选择'
});
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
==
merchantForm
.
provinceName
)
cityInfo
=
province
.
cityInfoList
merchantForm
.
provinceCode
=
province
.
provinceId
com
.
getSelect
({
id
:
'startc'
,
value
:
'cityName'
,
text
:
'cityName'
,
data
:
cityInfo
,
link
:
'startp'
,
isFirst
:
false
})
var
city
=
cityInfo
.
find
(
item
=>
item
.
cityName
==
merchantForm
.
cityName
)
merchantForm
.
cityCode
=
city
.
cityId
$
(
'#startc'
).
val
(
merchantForm
.
cityName
)
form
.
render
(
'select'
);
layer
.
close
(
index
)
layer
.
close
(
index
)
}
else
{
}
else
{
layer
.
msg
(
'请选择地址'
,
{
layer
.
msg
(
'请选择地址'
,
{
...
@@ -1310,6 +1417,24 @@
...
@@ -1310,6 +1417,24 @@
if
(
merchantForm
.
channelId
==
2
)
{
if
(
merchantForm
.
channelId
==
2
)
{
$
(
'#sapCode'
).
removeClass
(
'hide'
)
$
(
'#sapCode'
).
removeClass
(
'hide'
)
}
}
// 省市回显
if
(
merchantForm
.
provinceName
)
{
var
province
=
provinceInfoList
.
find
(
item
=>
item
.
provinceName
==
merchantForm
.
provinceName
)
cityInfo
=
province
.
cityInfoList
merchantForm
.
provinceCode
=
province
.
provinceId
com
.
getSelect
({
id
:
'startc'
,
value
:
'cityName'
,
text
:
'cityName'
,
data
:
cityInfo
,
link
:
'startp'
,
isFirst
:
false
})
var
city
=
cityInfo
.
find
(
item
=>
item
.
cityName
==
merchantForm
.
cityName
)
merchantForm
.
cityCode
=
city
.
cityId
$
(
'#startc'
).
val
(
merchantForm
.
cityName
)
form
.
render
(
'select'
);
}
if
(
step
==
1
)
{
if
(
step
==
1
)
{
getBusiScope
()
getBusiScope
()
getCarBrandTree
()
getCarBrandTree
()
...
@@ -1525,6 +1650,20 @@
...
@@ -1525,6 +1650,20 @@
})
})
}
}
// 省市区
function
getProvinceList
()
{
var
ajax
=
layui
.
$
.
ajax
ajax
({
// url: 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/glsx-oss-account-config',
url
:
'http://oss-config.dev.glsx.com.cn/mock/617ba1df1072f92988f05a14/account/provinceList'
,
async
:
false
,
success
:
function
(
res
)
{
console
.
log
(
res
)
provinceInfoList
=
res
.
provinceInfoList
}
})
}
// 树 - start
// 树 - start
var
laytpl
=
layui
.
laytpl
var
laytpl
=
layui
.
laytpl
var
xmSelect
=
layui
.
xmSelect
var
xmSelect
=
layui
.
xmSelect
...
...
js/common.js
View file @
d202488
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*/
*/
layui
.
define
([
'form'
,
'laydate'
,
'carousel'
,
'util'
],
function
(
exports
)
{
layui
.
define
([
'form'
,
'laydate'
,
'carousel'
,
'util'
],
function
(
exports
)
{
const
{
form
,
laydate
,
carousel
,
util
,
$
,
cache
}
=
layui
;
const
{
form
,
laydate
,
carousel
,
util
,
$
,
cache
}
=
layui
exports
(
'common'
,
{
exports
(
'common'
,
{
/**
/**
* 生成下拉选
* 生成下拉选
...
@@ -34,38 +34,46 @@ layui.define(['form', 'laydate', 'carousel', 'util'], function (exports) {
...
@@ -34,38 +34,46 @@ layui.define(['form', 'laydate', 'carousel', 'util'], function (exports) {
name
:
''
,
name
:
''
,
value
:
'value'
,
value
:
'value'
,
text
:
'text'
,
text
:
'text'
,
getValue
:
function
(
v
)
{
return
v
[
this
.
value
]
},
getValue
:
function
(
v
)
{
getText
:
function
(
t
)
{
return
t
[
this
.
text
]
},
return
v
[
this
.
value
]
},
getText
:
function
(
t
)
{
return
t
[
this
.
text
]
},
param
:
null
,
param
:
null
,
initData
:
[{
cityId
:
''
,
cityName
:
'请选择'
}],
initData
:
[{
cityId
:
''
,
cityName
:
'请选择'
}],
link
:
false
,
link
:
false
,
select
:
false
,
select
:
false
,
data
:
[],
data
:
[],
isFirst
:
true
,
...
config
...
config
},
},
that
=
this
,
that
=
this
,
isArray
=
Array
.
isArray
(
f
.
id
);
isArray
=
Array
.
isArray
(
f
.
id
)
if
(
f
.
isFirst
)
{
if
(
isArray
)
{
if
(
isArray
)
{
f
.
id
.
forEach
(
id
=>
{
f
.
id
.
forEach
(
id
=>
{
$
(
"#"
+
id
).
attr
(
"lay-filter"
,
'commonSelect'
+
id
);
$
(
'#'
+
id
).
attr
(
'lay-filter'
,
'commonSelect'
+
id
)
$
(
"#"
+
id
).
attr
(
"name"
,
f
.
name
)
$
(
'#'
+
id
).
attr
(
'name'
,
f
.
name
)
})
})
}
else
{
}
else
{
$
(
"#"
+
f
.
id
).
attr
(
"lay-filter"
,
'commonSelect'
+
f
.
id
);
$
(
'#'
+
f
.
id
).
attr
(
'lay-filter'
,
'commonSelect'
+
f
.
id
)
$
(
"#"
+
f
.
id
).
attr
(
"name"
,
f
.
name
)
$
(
'#'
+
f
.
id
).
attr
(
'name'
,
f
.
name
)
}
}
}
getProvinceList
()
getProvinceList
()
//绑定选中事件
//绑定选中事件
if
(
f
.
select
)
{
if
(
f
.
select
)
{
if
(
isArray
)
{
if
(
isArray
)
{
f
.
id
.
forEach
(
id
=>
{
f
.
id
.
forEach
(
id
=>
{
form
.
on
(
'select(commonSelect'
+
id
+
')'
,
function
(
data
)
{
form
.
on
(
'select(commonSelect'
+
id
+
')'
,
function
(
data
)
{
f
.
select
(
data
);
f
.
select
(
data
)
})
})
})
})
}
else
{
}
else
{
form
.
on
(
'select(commonSelect'
+
f
.
id
+
')'
,
function
(
data
)
{
form
.
on
(
'select(commonSelect'
+
f
.
id
+
')'
,
function
(
data
)
{
f
.
select
(
data
);
f
.
select
(
data
)
})
})
}
}
}
}
...
@@ -75,24 +83,26 @@ layui.define(['form', 'laydate', 'carousel', 'util'], function (exports) {
...
@@ -75,24 +83,26 @@ layui.define(['form', 'laydate', 'carousel', 'util'], function (exports) {
f
.
data
=
that
.
provinceInfoList
f
.
data
=
that
.
provinceInfoList
}
}
console
.
log
(
f
.
data
)
console
.
log
(
f
.
data
)
let
h
=
''
;
let
h
=
''
$
.
each
(
f
.
initData
,
function
(
i
,
d
)
{
h
+=
'<option value="'
+
d
.
cityId
+
'">'
+
d
.
cityName
+
'</option>'
;
});
$
.
each
(
f
.
initData
,
function
(
i
,
d
)
{
h
+=
'<option value="'
+
d
.
cityId
+
'">'
+
d
.
cityName
+
'</option>'
})
$
.
each
(
f
.
data
,
function
(
i
,
d
)
{
$
.
each
(
f
.
data
,
function
(
i
,
d
)
{
h
+=
'<option value="'
+
f
.
getValue
(
d
)
+
'">'
+
f
.
getText
(
d
)
+
'</option>'
;
h
+=
'<option value="'
+
f
.
getValue
(
d
)
+
'">'
+
f
.
getText
(
d
)
+
'</option>'
});
})
if
(
isArray
)
{
if
(
isArray
)
{
f
.
id
.
forEach
(
d
=>
{
f
.
id
.
forEach
(
d
=>
{
let
a
=
$
(
"#"
+
d
);
let
a
=
$
(
'#'
+
d
)
a
.
empty
();
a
.
empty
()
a
.
append
(
h
);
a
.
append
(
h
)
})
})
}
else
{
}
else
{
let
a
=
$
(
"#"
+
f
.
id
);
let
a
=
$
(
'#'
+
f
.
id
)
a
.
empty
();
a
.
empty
()
a
.
append
(
h
);
a
.
append
(
h
)
}
}
form
.
render
(
'select'
);
form
.
render
(
'select'
)
return
h
;
return
h
}
}
function
getProvinceList
()
{
function
getProvinceList
()
{
var
ajax
=
layui
.
$
.
ajax
var
ajax
=
layui
.
$
.
ajax
...
@@ -106,7 +116,7 @@ layui.define(['form', 'laydate', 'carousel', 'util'], function (exports) {
...
@@ -106,7 +116,7 @@ layui.define(['form', 'laydate', 'carousel', 'util'], function (exports) {
}
}
})
})
}
}
return
getOptions
();
return
getOptions
()
}
}
})
})
})
})
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