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 8c4dc39c
authored
May 06, 2022
by
前端
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'v2.1.0' into 'develop'
V2.1.0 See merge request
!19
2 parents
ee798305
aa5dbd95
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
951 additions
and
54 deletions
html/merchant/add.html
html/merchant/addSubMerchant.html
html/merchant/detail.html
html/merchant/edit.html
html/merchant/map.html
html/role/add.html
html/role/index.html
js/common.js
js/validator.js
html/merchant/add.html
View file @
8c4dc39
...
@@ -219,6 +219,21 @@
...
@@ -219,6 +219,21 @@
left
:
340px
;
left
:
340px
;
top
:
0
;
top
:
0
;
}
}
.w-70
{
width
:
150px
!important
;
}
.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>
...
@@ -321,9 +336,24 @@
...
@@ -321,9 +336,24 @@
</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
id=
"addMap"
></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
type=
"button"
class=
"layui-btn"
data-type=
"handleSelectAddr"
style=
"margin-left: 20px"
>
选择地址
</button>
style=
"margin-left: 20px"
>
选择地址
</button>
...
@@ -348,7 +378,7 @@
...
@@ -348,7 +378,7 @@
<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"
>
<input
class=
"layui-input"
name=
"residentPhone"
maxlength=
"1
1
"
placeholder=
"请输入驻店电话"
<input
class=
"layui-input"
name=
"residentPhone"
maxlength=
"1
3
"
placeholder=
"请输入驻店电话"
lay-verify=
"residentPhone"
/>
lay-verify=
"residentPhone"
/>
</div>
</div>
</div>
</div>
...
@@ -546,9 +576,12 @@
...
@@ -546,9 +576,12 @@
</div>
</div>
<script
src=
"https://img02.glsx.com.cn/layui/layui.js"
></script>
<script
src=
"https://img02.glsx.com.cn/layui/layui.js"
></script>
<script
src=
"/js/load.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&plugin=AMap.Geolocation"
>
</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
...
@@ -605,6 +638,58 @@
...
@@ -605,6 +638,58 @@
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
++
)
{
...
@@ -712,7 +797,7 @@
...
@@ -712,7 +797,7 @@
},
},
residentPhone
:
function
(
value
)
{
residentPhone
:
function
(
value
)
{
if
(
value
&&
!
validator
.
checkPhoneNumber
(
value
))
{
if
(
value
&&
!
validator
.
checkPhoneNumber
Two
(
value
))
{
return
'请填入正确的驻店电话'
return
'请填入正确的驻店电话'
}
}
},
},
...
@@ -777,7 +862,7 @@
...
@@ -777,7 +862,7 @@
'merchantLoginPassword'
,
'merchantLoginPassword'
,
'merchantAccountLevel'
,
'merchantAccountLevel'
,
'effectiveTime'
,
'effectiveTime'
,
'merchantModel'
,
'merchantModel'
]
]
if
(
formData
.
isloginName
==
'on'
)
{
if
(
formData
.
isloginName
==
'on'
)
{
params
.
isloginName
=
1
params
.
isloginName
=
1
...
@@ -799,6 +884,12 @@
...
@@ -799,6 +884,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
]
||
''
...
@@ -861,8 +952,7 @@
...
@@ -861,8 +952,7 @@
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
=
[]
car
.
children
.
forEach
(
item
=>
{
car
.
children
.
forEach
(
item
=>
{
...
@@ -875,7 +965,6 @@
...
@@ -875,7 +965,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
)
{
...
@@ -917,7 +1006,6 @@
...
@@ -917,7 +1006,6 @@
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
)
}
}
...
@@ -966,7 +1054,61 @@
...
@@ -966,7 +1054,61 @@
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
provincecode
=
res
.
geocoderAddress
.
adcode
var
provinceIdx
=
fullAddress
.
province
var
cityIdx
=
fullAddress
.
city
?
fullAddress
.
city
:
fullAddress
.
district
const
municipalities
=
[
'北京市'
,
'天津市'
,
'上海市'
,
'重庆市'
]
var
municipality
=
municipalities
.
find
(
item
=>
item
==
provinceIdx
)
if
(
municipality
)
{
cityIdx
=
cityIdx
.
slice
(
0
,
2
)
+
'城区'
console
.
log
(
cityIdx
);
if
(
municipality
===
'重庆市'
)
{
provincecode
=
provincecode
.
slice
(
0
,
4
)
provincecode
==
5001
?
(
cityIdx
=
cityIdx
.
slice
(
0
,
2
)
+
'城区'
)
:
(
cityIdx
=
cityIdx
.
slice
(
0
,
2
)
+
'郊县'
)
}
}
// 判断省市是否匹配
if
(
merchantForm
.
provinceName
)
{
if
(
merchantForm
.
provinceName
!==
provinceIdx
||
merchantForm
.
cityName
!==
cityIdx
)
{
layer
.
open
({
title
:
'提示'
,
content
:
'您选择的地址错误,请重新选择'
});
return
}
}
$
(
'#addrEl'
).
val
(
merchantForm
.
merchantAddress
)
$
(
'#addrEl'
).
val
(
merchantForm
.
merchantAddress
)
var
province
=
provinceInfoList
.
find
(
item
=>
item
.
name
==
provinceIdx
)
$
(
'#startp'
).
val
(
province
.
name
)
cityInfo
=
province
.
districtList
merchantForm
.
provinceName
=
province
.
name
merchantForm
.
provinceCode
=
province
.
adcode
com
.
getSelect
({
id
:
'startc'
,
value
:
'name'
,
text
:
'name'
,
data
:
cityInfo
,
link
:
'startp'
,
// isFirst: false,
select
:
function
(
data
)
{
const
{
value
}
=
data
if
(
value
)
{
console
.
log
(
cityInfo
);
merchantForm
.
cityName
=
value
var
cityChange
=
cityInfo
.
find
(
item
=>
item
.
name
==
value
)
merchantForm
.
cityCode
=
cityChange
.
adcode
$
(
'#addrEl'
).
val
(
''
)
}
}
})
var
city
=
cityInfo
.
find
(
item
=>
item
.
name
==
cityIdx
)
console
.
log
(
city
);
merchantForm
.
cityCode
=
city
.
adcode
merchantForm
.
cityName
=
city
.
name
$
(
'#startc'
).
val
(
merchantForm
.
cityName
)
form
.
render
(
'select'
);
layer
.
close
(
index
)
layer
.
close
(
index
)
}
else
{
}
else
{
layer
.
msg
(
'请选择地址'
,
{
layer
.
msg
(
'请选择地址'
,
{
...
@@ -1018,14 +1160,14 @@
...
@@ -1018,14 +1160,14 @@
var
checkAll
=
false
var
checkAll
=
false
var
checkCarBrand
=
$
(
'#checkCarBrand'
)
var
checkCarBrand
=
$
(
'#checkCarBrand'
)
// 主营品牌全选
// 主营品牌全选
checkCarBrand
.
on
(
'click'
,
function
()
{
checkCarBrand
.
on
(
'click'
,
function
()
{
checkAll
=
!
checkAll
checkAll
=
!
checkAll
treeObj
.
checkAllNodes
(
checkAll
)
treeObj
.
checkAllNodes
(
checkAll
)
if
(
checkAll
)
{
if
(
checkAll
)
{
checkCarBrand
.
html
(
'全不选'
)
checkCarBrand
.
html
(
'全不选'
)
}
else
{
}
else
{
checkCarBrand
.
html
(
'全选'
)
checkCarBrand
.
html
(
'全选'
)
}
}
})
})
$
(
'.layui-btn'
).
on
(
'click'
,
function
()
{
$
(
'.layui-btn'
).
on
(
'click'
,
function
()
{
...
@@ -1323,7 +1465,7 @@
...
@@ -1323,7 +1465,7 @@
var
checkedList
=
[]
var
checkedList
=
[]
if
(
editLevel
==
3
&&
merchantForm
.
merchantBrandMain
)
{
if
(
editLevel
==
3
&&
merchantForm
.
merchantBrandMain
)
{
// checkedList = merchantForm.merchantBrandMain.split(',')
// checkedList = merchantForm.merchantBrandMain.split(',')
checkedList
=
merchantForm
.
merchantBrandMain
.
replaceAll
(
';'
,
','
).
split
(
','
)
checkedList
=
merchantForm
.
merchantBrandMain
.
replaceAll
(
';'
,
','
).
split
(
','
)
$
.
each
(
checkedList
,
function
(
index
,
item
)
{
$
.
each
(
checkedList
,
function
(
index
,
item
)
{
checkedList
[
index
]
=
parseInt
(
item
)
checkedList
[
index
]
=
parseInt
(
item
)
})
})
...
@@ -1504,6 +1646,82 @@
...
@@ -1504,6 +1646,82 @@
})
})
}
}
// 省市区
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
// }
// })
var
map
=
new
AMap
.
Map
(
'district'
,
{
resizeEnable
:
true
})
AMap
.
plugin
([
'AMap.DistrictSearch'
],
()
=>
{
var
opts
=
{
subdistrict
:
2
,
//返回下一级行政区
level
:
'city'
,
//查询的范围
showbiz
:
true
//查询行政级别为 市
}
var
districtSearch
=
new
AMap
.
DistrictSearch
(
opts
)
districtSearch
.
search
(
'中国'
,
(
status
,
result
)
=>
{
provinceInfoList
=
result
.
districtList
[
0
].
districtList
com
.
getSelect
({
id
:
'startp'
,
name
:
'provinceName'
,
url
:
'/area/list'
,
// value: 'provinceId',
data
:
provinceInfoList
,
value
:
'name'
,
text
:
'name'
,
param
:
{},
select
:
function
(
data
)
{
const
{
value
}
=
data
if
(
value
)
{
// var province = provinceInfoList.find(item => item.provinceId == value)
var
province
=
provinceInfoList
.
find
(
item
=>
item
.
name
==
value
)
cityInfo
=
province
.
districtList
merchantForm
.
provinceCode
=
province
.
adcode
merchantForm
.
provinceName
=
province
.
name
$
(
'#addrEl'
).
val
(
''
)
}
else
{
cityInfo
=
[]
merchantForm
.
provinceCode
=
''
merchantForm
.
provinceName
=
''
}
merchantForm
.
cityCode
=
''
merchantForm
.
cityName
=
''
com
.
getSelect
({
id
:
'startc'
,
name
:
'cityName'
,
url
:
'/area/list'
,
value
:
'name'
,
text
:
'name'
,
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
.
name
==
value
)
merchantForm
.
cityCode
=
city
.
adcode
merchantForm
.
cityName
=
city
.
name
}
else
{
merchantForm
.
cityCode
=
''
merchantForm
.
cityName
=
''
}
}
})
}
})
})
})
}
// 数 - start
// 数 - start
var
check_arr
=
[]
var
check_arr
=
[]
var
requestList
=
[]
var
requestList
=
[]
...
...
html/merchant/addSubMerchant.html
View file @
8c4dc39
...
@@ -231,6 +231,20 @@
...
@@ -231,6 +231,20 @@
left
:
340px
;
left
:
340px
;
top
:
0
;
top
:
0
;
}
}
.w-70
{
width
:
150px
!important
;
}
.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 +325,26 @@
...
@@ -311,11 +325,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"
>
<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
id=
"addMap"
></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">
...
@@ -337,7 +366,7 @@
...
@@ -337,7 +366,7 @@
<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"
>
<input
class=
"layui-input"
name=
"residentPhone"
maxlength=
"1
1
"
placeholder=
"请输入驻店电话"
<input
class=
"layui-input"
name=
"residentPhone"
maxlength=
"1
3
"
placeholder=
"请输入驻店电话"
lay-verify=
"residentPhone"
/>
lay-verify=
"residentPhone"
/>
</div>
</div>
</div>
</div>
...
@@ -533,9 +562,12 @@
...
@@ -533,9 +562,12 @@
</div>
</div>
<script
src=
"https://img02.glsx.com.cn/layui/layui.js"
></script>
<script
src=
"https://img02.glsx.com.cn/layui/layui.js"
></script>
<script
src=
"/js/load.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&plugin=AMap.Geolocation"
>
</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 +629,58 @@
...
@@ -597,7 +629,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
++
)
{
...
@@ -711,7 +794,7 @@
...
@@ -711,7 +794,7 @@
}
}
},
},
residentPhone
:
function
(
value
)
{
residentPhone
:
function
(
value
)
{
if
(
value
&&
!
validator
.
checkPhoneNumber
(
value
))
{
if
(
value
&&
!
validator
.
checkPhoneNumber
Two
(
value
))
{
return
'请填入正确的驻店电话'
return
'请填入正确的驻店电话'
}
}
},
},
...
@@ -804,6 +887,12 @@
...
@@ -804,6 +887,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 +1064,59 @@
...
@@ -975,7 +1064,59 @@
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
provincecode
=
res
.
geocoderAddress
.
adcode
var
provinceIdx
=
fullAddress
.
province
var
cityIdx
=
fullAddress
.
city
?
fullAddress
.
city
:
fullAddress
.
district
const
municipalities
=
[
'北京市'
,
'天津市'
,
'上海市'
,
'重庆市'
]
var
municipality
=
municipalities
.
find
(
item
=>
item
==
provinceIdx
)
if
(
municipality
)
{
cityIdx
=
cityIdx
.
slice
(
0
,
2
)
+
'城区'
console
.
log
(
cityIdx
);
if
(
municipality
===
'重庆市'
)
{
provincecode
=
provincecode
.
slice
(
0
,
4
)
provincecode
==
5001
?
(
cityIdx
=
cityIdx
.
slice
(
0
,
2
)
+
'城区'
)
:
(
cityIdx
=
cityIdx
.
slice
(
0
,
2
)
+
'郊县'
)
}
}
// 判断省市是否匹配
if
(
merchantForm
.
provinceName
)
{
if
(
merchantForm
.
provinceName
!==
provinceIdx
||
merchantForm
.
cityName
!==
cityIdx
)
{
layer
.
open
({
title
:
'提示'
,
content
:
'您选择的地址错误,请重新选择'
});
return
}
}
$
(
'#addrEl'
).
val
(
merchantForm
.
merchantAddress
)
$
(
'#addrEl'
).
val
(
merchantForm
.
merchantAddress
)
var
province
=
provinceInfoList
.
find
(
item
=>
item
.
name
==
provinceIdx
)
$
(
'#startp'
).
val
(
province
.
name
)
cityInfo
=
province
.
districtList
merchantForm
.
provinceName
=
province
.
name
merchantForm
.
provinceCode
=
province
.
adcode
com
.
getSelect
({
id
:
'startc'
,
value
:
'name'
,
text
:
'name'
,
data
:
cityInfo
,
link
:
'startp'
,
// isFirst: false,
select
:
function
(
data
)
{
const
{
value
}
=
data
if
(
value
)
{
merchantForm
.
cityName
=
value
var
cityChange
=
cityInfo
.
find
(
item
=>
item
.
cityName
==
value
)
merchantForm
.
cityCode
=
cityChange
.
adcode
$
(
'#addrEl'
).
val
(
''
)
}
}
})
var
city
=
cityInfo
.
find
(
item
=>
item
.
name
==
cityIdx
)
merchantForm
.
cityCode
=
city
.
adcode
merchantForm
.
cityName
=
city
.
name
$
(
'#startc'
).
val
(
merchantForm
.
cityName
)
form
.
render
(
'select'
);
layer
.
close
(
index
)
layer
.
close
(
index
)
}
else
{
}
else
{
layer
.
msg
(
'请选择地址'
,
{
layer
.
msg
(
'请选择地址'
,
{
...
@@ -1515,6 +1656,82 @@
...
@@ -1515,6 +1656,82 @@
})
})
}
}
// 省市区
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
// }
// })
var
map
=
new
AMap
.
Map
(
'district'
,
{
resizeEnable
:
true
})
AMap
.
plugin
([
'AMap.DistrictSearch'
],
()
=>
{
var
opts
=
{
subdistrict
:
2
,
//返回下一级行政区
level
:
'city'
,
//查询的范围
showbiz
:
true
//查询行政级别为 市
}
var
districtSearch
=
new
AMap
.
DistrictSearch
(
opts
)
districtSearch
.
search
(
'中国'
,
(
status
,
result
)
=>
{
provinceInfoList
=
result
.
districtList
[
0
].
districtList
com
.
getSelect
({
id
:
'startp'
,
name
:
'provinceName'
,
url
:
'/area/list'
,
// value: 'provinceId',
data
:
provinceInfoList
,
value
:
'name'
,
text
:
'name'
,
param
:
{},
select
:
function
(
data
)
{
const
{
value
}
=
data
if
(
value
)
{
// var province = provinceInfoList.find(item => item.provinceId == value)
var
province
=
provinceInfoList
.
find
(
item
=>
item
.
name
==
value
)
cityInfo
=
province
.
districtList
merchantForm
.
provinceCode
=
province
.
adcode
merchantForm
.
provinceName
=
province
.
name
$
(
'#addrEl'
).
val
(
''
)
}
else
{
cityInfo
=
[]
merchantForm
.
provinceCode
=
''
merchantForm
.
provinceName
=
''
}
merchantForm
.
cityCode
=
''
merchantForm
.
cityName
=
''
com
.
getSelect
({
id
:
'startc'
,
name
:
'cityName'
,
url
:
'/area/list'
,
value
:
'name'
,
text
:
'name'
,
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
.
name
==
value
)
merchantForm
.
cityCode
=
city
.
adcode
merchantForm
.
cityName
=
city
.
name
}
else
{
merchantForm
.
cityCode
=
''
merchantForm
.
cityName
=
''
}
}
})
}
})
})
})
}
// 数 - start
// 数 - start
var
laytpl
=
layui
.
laytpl
var
laytpl
=
layui
.
laytpl
var
xmSelect
=
layui
.
xmSelect
var
xmSelect
=
layui
.
xmSelect
...
...
html/merchant/detail.html
View file @
8c4dc39
...
@@ -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 @
8c4dc39
...
@@ -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>
...
@@ -320,7 +334,7 @@
...
@@ -320,7 +334,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
w-70
"
id=
"accountTypeEl"
></div>
<div
class=
"layui-input-inline
"
style=
"width: calc(100% - 200px)
"
id=
"accountTypeEl"
></div>
</div>
</div>
</div>
</div>
<div
class=
"edit-box clearfix"
>
<div
class=
"edit-box clearfix"
>
...
@@ -400,11 +414,27 @@
...
@@ -400,11 +414,27 @@
</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
id=
"addMap"
></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>
...
@@ -420,7 +450,7 @@
...
@@ -420,7 +450,7 @@
<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"
>
<input
class=
"layui-input"
name=
"residentPhone"
maxlength=
"1
1
"
placeholder=
"请输入驻店电话"
<input
class=
"layui-input"
name=
"residentPhone"
maxlength=
"1
3
"
placeholder=
"请输入驻店电话"
lay-verify=
"residentPhone"
/>
lay-verify=
"residentPhone"
/>
</div>
</div>
</div>
</div>
...
@@ -464,7 +494,8 @@
...
@@ -464,7 +494,8 @@
<label
class=
"layui-form-label"
>
主营品牌:
</label>
<label
class=
"layui-form-label"
>
主营品牌:
</label>
<div
class=
"layui-input-inline"
style=
"position: relative;"
>
<div
class=
"layui-input-inline"
style=
"position: relative;"
>
<input
class=
"layui-input"
placeholder=
"车型品牌"
id=
"brand"
/>
<input
class=
"layui-input"
placeholder=
"车型品牌"
id=
"brand"
/>
<button
id=
"checkCarBrand"
type=
"button"
class=
"layui-btn btn-no-border check-carbrand"
>
全选
</button>
<button
id=
"checkCarBrand"
type=
"button"
class=
"layui-btn btn-no-border check-carbrand"
>
全选
</button>
<div
id=
"carBrandTree"
class=
"hide"
style=
"height: 200px; overflow-y: scroll"
></div>
<div
id=
"carBrandTree"
class=
"hide"
style=
"height: 200px; overflow-y: scroll"
></div>
<div
id=
"noCarbrand"
class=
"no-car hide"
>
暂无数据
</div>
<div
id=
"noCarbrand"
class=
"no-car hide"
>
暂无数据
</div>
</div>
</div>
...
@@ -521,9 +552,13 @@
...
@@ -521,9 +552,13 @@
</div>
</div>
<script
src=
"https://img02.glsx.com.cn/layui/layui.js"
></script>
<script
src=
"https://img02.glsx.com.cn/layui/layui.js"
></script>
<script
src=
"/js/load.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&plugin=AMap.Geolocation"
>
</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 +628,56 @@
...
@@ -593,6 +628,56 @@
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.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.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'
)
...
@@ -709,7 +794,7 @@
...
@@ -709,7 +794,7 @@
}
}
},
},
residentPhone
:
function
(
value
)
{
residentPhone
:
function
(
value
)
{
if
(
value
&&
!
validator
.
checkPhoneNumber
(
value
))
{
if
(
value
&&
!
validator
.
checkPhoneNumber
Two
(
value
))
{
return
'请填入正确的驻店电话'
return
'请填入正确的驻店电话'
}
}
},
},
...
@@ -734,6 +819,7 @@
...
@@ -734,6 +819,7 @@
focusElem
.
css
(
verifyType
==
'radio'
?
{
color
:
''
}
:
{
'border-color'
:
''
})
focusElem
.
css
(
verifyType
==
'radio'
?
{
color
:
''
}
:
{
'border-color'
:
''
})
})
})
.
focus
()
.
focus
()
console
.
log
(
222
);
return
'必填项不能为空'
return
'必填项不能为空'
}
}
}
}
...
@@ -788,7 +874,13 @@
...
@@ -788,7 +874,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
]
||
''
...
@@ -853,7 +945,7 @@
...
@@ -853,7 +945,7 @@
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
)
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
=
[]
car
.
children
.
forEach
(
item
=>
{
car
.
children
.
forEach
(
item
=>
{
...
@@ -933,7 +1025,60 @@
...
@@ -933,7 +1025,60 @@
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
provincecode
=
res
.
geocoderAddress
.
adcode
var
provinceIdx
=
fullAddress
.
province
var
cityIdx
=
fullAddress
.
city
?
fullAddress
.
city
:
fullAddress
.
district
const
municipalities
=
[
'北京市'
,
'天津市'
,
'上海市'
,
'重庆市'
]
var
municipality
=
municipalities
.
find
(
item
=>
item
==
provinceIdx
)
if
(
municipality
)
{
cityIdx
=
cityIdx
.
slice
(
0
,
2
)
+
'城区'
console
.
log
(
cityIdx
);
if
(
municipality
===
'重庆市'
)
{
provincecode
=
provincecode
.
slice
(
0
,
4
)
provincecode
==
5001
?
(
cityIdx
=
cityIdx
.
slice
(
0
,
2
)
+
'城区'
)
:
(
cityIdx
=
cityIdx
.
slice
(
0
,
2
)
+
'郊县'
)
}
}
// 判断省市是否匹配
if
(
merchantForm
.
provinceName
)
{
if
(
merchantForm
.
provinceName
!==
provinceIdx
||
merchantForm
.
cityName
!==
cityIdx
)
{
layer
.
open
({
title
:
'提示'
,
content
:
'您选择的地址错误,请重新选择'
});
return
}
}
$
(
'#addrEl'
).
val
(
merchantForm
.
merchantAddress
)
$
(
'#addrEl'
).
val
(
merchantForm
.
merchantAddress
)
console
.
log
(
provinceInfoList
);
var
province
=
provinceInfoList
.
find
(
item
=>
item
.
name
.
indexOf
(
provinceIdx
)
!=
-
1
)
$
(
'#startp'
).
val
(
province
.
name
)
cityInfo
=
province
.
districtList
merchantForm
.
provinceName
=
province
.
name
merchantForm
.
provinceCode
=
province
.
adcode
com
.
getSelect
({
id
:
'startc'
,
value
:
'name'
,
text
:
'name'
,
data
:
cityInfo
,
link
:
'startp'
,
// isFirst: false,
select
:
function
(
data
)
{
const
{
value
}
=
data
if
(
value
)
{
merchantForm
.
cityName
=
value
var
cityChange
=
cityInfo
.
find
(
item
=>
item
.
name
==
value
)
merchantForm
.
cityCode
=
cityChange
.
adcode
$
(
'#addrEl'
).
val
(
''
)
}
}
})
var
city
=
cityInfo
.
find
(
item
=>
item
.
name
==
cityIdx
)
merchantForm
.
cityCode
=
city
.
adcode
merchantForm
.
cityName
=
city
.
name
$
(
'#startc'
).
val
(
city
.
name
)
form
.
render
(
'select'
);
layer
.
close
(
index
)
layer
.
close
(
index
)
}
else
{
}
else
{
layer
.
msg
(
'请选择地址'
,
{
layer
.
msg
(
'请选择地址'
,
{
...
@@ -986,14 +1131,14 @@
...
@@ -986,14 +1131,14 @@
var
checkAll
=
false
var
checkAll
=
false
var
checkCarBrand
=
$
(
'#checkCarBrand'
)
var
checkCarBrand
=
$
(
'#checkCarBrand'
)
// 主营品牌全选
// 主营品牌全选
checkCarBrand
.
on
(
'click'
,
function
()
{
checkCarBrand
.
on
(
'click'
,
function
()
{
checkAll
=
!
checkAll
checkAll
=
!
checkAll
treeObj
.
checkAllNodes
(
checkAll
)
treeObj
.
checkAllNodes
(
checkAll
)
if
(
checkAll
)
{
if
(
checkAll
)
{
checkCarBrand
.
html
(
'全不选'
)
checkCarBrand
.
html
(
'全不选'
)
}
else
{
}
else
{
checkCarBrand
.
html
(
'全选'
)
checkCarBrand
.
html
(
'全选'
)
}
}
})
})
// tab 点击事件
// tab 点击事件
...
@@ -1310,6 +1455,36 @@
...
@@ -1310,6 +1455,36 @@
if
(
merchantForm
.
channelId
==
2
)
{
if
(
merchantForm
.
channelId
==
2
)
{
$
(
'#sapCode'
).
removeClass
(
'hide'
)
$
(
'#sapCode'
).
removeClass
(
'hide'
)
}
}
// 省市回显
if
(
merchantForm
.
provinceName
)
{
var
province
=
provinceInfoList
.
find
(
item
=>
item
.
name
.
indexOf
(
merchantForm
.
provinceName
)
!=
-
1
)
merchantForm
.
provinceName
=
province
.
name
cityInfo
=
province
.
districtList
// merchantForm.provinceCode = province.provinceId
$
(
'#startp'
).
val
(
province
.
name
)
com
.
getSelect
({
id
:
'startc'
,
value
:
'name'
,
text
:
'name'
,
data
:
cityInfo
,
link
:
'startp'
,
// isFirst: false,
select
:
function
(
data
)
{
const
{
value
}
=
data
if
(
value
)
{
merchantForm
.
cityName
=
value
var
cityChange
=
cityInfo
.
find
(
item
=>
item
.
name
==
value
)
merchantForm
.
cityCode
=
cityChange
.
adcode
$
(
'#addrEl'
).
val
(
''
)
}
}
})
var
city
=
cityInfo
.
find
(
item
=>
item
.
name
.
indexOf
(
merchantForm
.
cityName
)
!=
-
1
)
merchantForm
.
cityName
=
city
.
name
// merchantForm.cityCode = city.cityId
$
(
'#startc'
).
val
(
city
.
name
)
form
.
render
(
'select'
);
}
if
(
step
==
1
)
{
if
(
step
==
1
)
{
getBusiScope
()
getBusiScope
()
getCarBrandTree
()
getCarBrandTree
()
...
@@ -1336,7 +1511,7 @@
...
@@ -1336,7 +1511,7 @@
var
checkedList
=
[]
var
checkedList
=
[]
if
(
editLevel
==
3
&&
merchantForm
.
merchantBrandMain
)
{
if
(
editLevel
==
3
&&
merchantForm
.
merchantBrandMain
)
{
// checkedList = merchantForm.merchantBrandMain.split(',')
// checkedList = merchantForm.merchantBrandMain.split(',')
checkedList
=
merchantForm
.
merchantBrandMain
.
replaceAll
(
';'
,
','
).
split
(
','
)
checkedList
=
merchantForm
.
merchantBrandMain
.
replaceAll
(
';'
,
','
).
split
(
','
)
$
.
each
(
checkedList
,
function
(
index
,
item
)
{
$
.
each
(
checkedList
,
function
(
index
,
item
)
{
checkedList
[
index
]
=
parseInt
(
item
)
checkedList
[
index
]
=
parseInt
(
item
)
})
})
...
@@ -1525,6 +1700,82 @@
...
@@ -1525,6 +1700,82 @@
})
})
}
}
// 省市区
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
// }
// })
var
map
=
new
AMap
.
Map
(
'district'
,
{
resizeEnable
:
true
})
AMap
.
plugin
([
'AMap.DistrictSearch'
],
()
=>
{
var
opts
=
{
subdistrict
:
2
,
//返回下一级行政区
level
:
'city'
,
//查询的范围
showbiz
:
true
//查询行政级别为 市
}
var
districtSearch
=
new
AMap
.
DistrictSearch
(
opts
)
districtSearch
.
search
(
'中国'
,
(
status
,
result
)
=>
{
provinceInfoList
=
result
.
districtList
[
0
].
districtList
com
.
getSelect
({
id
:
'startp'
,
name
:
'provinceName'
,
url
:
'/area/list'
,
// value: 'provinceId',
data
:
provinceInfoList
,
value
:
'name'
,
text
:
'name'
,
param
:
{},
select
:
function
(
data
)
{
const
{
value
}
=
data
if
(
value
)
{
// var province = provinceInfoList.find(item => item.provinceId == value)
var
province
=
provinceInfoList
.
find
(
item
=>
item
.
name
==
value
)
cityInfo
=
province
.
districtList
merchantForm
.
provinceCode
=
province
.
adcode
merchantForm
.
provinceName
=
province
.
name
$
(
'#addrEl'
).
val
(
''
)
}
else
{
cityInfo
=
[]
merchantForm
.
provinceCode
=
''
merchantForm
.
provinceName
=
''
}
merchantForm
.
cityCode
=
''
merchantForm
.
cityName
=
''
com
.
getSelect
({
id
:
'startc'
,
name
:
'cityName'
,
url
:
'/area/list'
,
value
:
'name'
,
text
:
'name'
,
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
.
name
==
value
)
merchantForm
.
cityCode
=
city
.
adcode
merchantForm
.
cityName
=
city
.
name
}
else
{
merchantForm
.
cityCode
=
''
merchantForm
.
cityName
=
''
}
}
})
}
})
})
})
}
// 树 - start
// 树 - start
var
laytpl
=
layui
.
laytpl
var
laytpl
=
layui
.
laytpl
var
xmSelect
=
layui
.
xmSelect
var
xmSelect
=
layui
.
xmSelect
...
...
html/merchant/map.html
View file @
8c4dc39
...
@@ -86,7 +86,7 @@
...
@@ -86,7 +86,7 @@
<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&plugin=AMap.Geolocation"
>
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
()
{
var
form
=
layui
.
form
var
form
=
layui
.
form
...
@@ -126,7 +126,7 @@
...
@@ -126,7 +126,7 @@
}
}
return
false
return
false
})
})
map
.
on
(
'click'
,
setLocation
)
map
.
on
(
'click'
,
setLocation
)
function
init
()
{
function
init
()
{
...
@@ -232,7 +232,7 @@
...
@@ -232,7 +232,7 @@
)
{
)
{
pois
=
result
.
poiList
.
pois
pois
=
result
.
poiList
.
pois
// var flag = false
// var flag = false
}
else
{}
}
else
{
}
appendList
()
appendList
()
setFitView
()
setFitView
()
}
}
...
@@ -259,6 +259,11 @@
...
@@ -259,6 +259,11 @@
mapData
.
merchantAddress
=
result
.
regeocode
.
formattedAddress
mapData
.
merchantAddress
=
result
.
regeocode
.
formattedAddress
modelVal
(
'merchantAddress'
,
mapData
.
merchantAddress
)
modelVal
(
'merchantAddress'
,
mapData
.
merchantAddress
)
placeSearch
(
mapData
.
merchantAddress
)
placeSearch
(
mapData
.
merchantAddress
)
geocoder
.
getLocation
(
mapData
.
merchantAddress
,
(
status
,
result
)
=>
{
if
(
status
===
'complete'
&&
result
.
info
===
'OK'
)
{
mapData
.
geocoderAddress
=
result
.
geocodes
[
0
]
}
})
}
}
})
})
}
}
...
...
html/role/add.html
View file @
8c4dc39
...
@@ -238,6 +238,10 @@
...
@@ -238,6 +238,10 @@
on
:
function
(
data
)
{
on
:
function
(
data
)
{
merchantId
=
data
.
change
[
0
].
id
merchantId
=
data
.
change
[
0
].
id
findMenuFunTreeByMerId
(
merchantId
)
findMenuFunTreeByMerId
(
merchantId
)
for
(
var
key
in
treeData
)
{
active
.
tabDelete
(
'roleAuth'
,
key
)
treeData
=
{}
}
}
}
})
})
if
(
roleid
)
{
if
(
roleid
)
{
...
...
html/role/index.html
View file @
8c4dc39
...
@@ -28,6 +28,17 @@
...
@@ -28,6 +28,17 @@
.show
{
.show
{
display
:
inline-block
;
display
:
inline-block
;
}
}
.role-tips
{
display
:
inline-flex
;
align-items
:
center
;
}
.role-tips
i
{
margin-left
:
4px
;
font-size
:
16px
;
color
:
#5850FF
;
}
</style>
</style>
<body>
<body>
...
@@ -108,7 +119,7 @@
...
@@ -108,7 +119,7 @@
var
cols
=
[
var
cols
=
[
//表头
//表头
{
field
:
''
,
title
:
'序号'
,
type
:
'numbers'
,
width
:
60
},
{
field
:
''
,
title
:
'序号'
,
type
:
'numbers'
,
width
:
60
},
{
field
:
'roleName'
,
title
:
'角色名称'
,
align
:
'center'
},
{
field
:
'roleName'
,
title
:
'角色名称'
,
align
:
'center'
,
templet
:
'#roleTpl'
},
{
field
:
'roleCode'
,
title
:
'角色号'
,
align
:
'center'
},
{
field
:
'roleCode'
,
title
:
'角色号'
,
align
:
'center'
},
{
field
:
'merchantName'
,
title
:
'所属商户名'
,
align
:
'center'
},
{
field
:
'merchantName'
,
title
:
'所属商户名'
,
align
:
'center'
},
{
field
:
'statusName'
,
title
:
'状态'
,
align
:
'center'
,
width
:
100
},
{
field
:
'statusName'
,
title
:
'状态'
,
align
:
'center'
,
width
:
100
},
...
@@ -117,7 +128,7 @@
...
@@ -117,7 +128,7 @@
]
]
var
colums
=
[
var
colums
=
[
{
field
:
''
,
title
:
'序号'
,
type
:
'numbers'
,
width
:
60
},
{
field
:
''
,
title
:
'序号'
,
type
:
'numbers'
,
width
:
60
},
{
field
:
'roleName'
,
title
:
'角色名称'
,
align
:
'center'
},
{
field
:
'roleName'
,
title
:
'角色名称'
,
align
:
'center'
,
templet
:
'#roleTpl'
},
{
field
:
'roleCode'
,
title
:
'角色号'
,
align
:
'center'
},
{
field
:
'roleCode'
,
title
:
'角色号'
,
align
:
'center'
},
{
field
:
'statusName'
,
title
:
'状态'
,
align
:
'center'
},
{
field
:
'statusName'
,
title
:
'状态'
,
align
:
'center'
},
{
field
:
'createdTime'
,
title
:
'创建时间'
,
align
:
'center'
},
{
field
:
'createdTime'
,
title
:
'创建时间'
,
align
:
'center'
},
...
@@ -129,7 +140,37 @@
...
@@ -129,7 +140,37 @@
elem
:
'#roleTable'
,
elem
:
'#roleTable'
,
skin
:
'nob'
,
skin
:
'nob'
,
height
:
'full-300'
,
height
:
'full-300'
,
cols
:
accountInfo
&&
accountInfo
.
merchantAccountLevel
==
4
?
[
colums
]
:
[
cols
]
cols
:
accountInfo
&&
accountInfo
.
merchantAccountLevel
==
4
?
[
colums
]
:
[
cols
],
done
:
function
(
res
,
curr
,
count
)
{
$
(
'#roleDj'
).
hover
(
function
(
e
)
{
layer
.
tips
(
'<span style="color:#333333;font-size: 14px;font-weight: 400;">此角色拥有嘀加智享车生活和精品升级的管理员权限。</span>'
,
this
,
{
tips
:
[
4
,
'#fff'
],
time
:
0
,
}
)
},
function
()
{
// 鼠标移出
layer
.
closeAll
()
})
$
(
'#roleGl'
).
hover
(
function
(
e
)
{
layer
.
tips
(
'<span style="color:#333333;font-size: 14px;font-weight: 400;">此角色拥有账户中心所有产品的管理员权限。</span>'
,
this
,
{
tips
:
[
4
,
'#fff'
],
time
:
0
,
}
)
},
function
()
{
// 鼠标移出
layer
.
closeAll
()
})
}
})
})
...
@@ -259,15 +300,28 @@
...
@@ -259,15 +300,28 @@
getTabelList
(
roleTable
)
getTabelList
(
roleTable
)
return
false
return
false
})
})
})
})
</script>
</script>
<script
type=
"text/html"
id=
"roleBar"
>
<script
type=
"text/html"
id=
"roleBar"
>
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"detail"
>
查看
<
/a
>
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"detail"
>
查看
<
/a
>
{{
#
if
(
!
d
.
defalutRole
){
}}
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"edit"
>
修改
<
/a
>
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"edit"
>
修改
<
/a
>
{{
#
if
(
d
.
delFlag
==
1
){
}}
{{
#
}
}}
{{
#
if
(
!
d
.
defalutRole
&&
d
.
delFlag
==
1
){
}}
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"del"
>
删除
<
/a
>
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"del"
>
删除
<
/a
>
{{
#
}
}}
{{
#
}
}}
</script>
</script>
<script
type=
"text/html"
id=
"roleTpl"
>
<
span
class
=
"role-tips"
>
{{
d
.
roleName
}}
{{
#
if
(
d
.
roleName
==
'D+智享管理员'
)
{
}}
<
i
class
=
"layui-icon layui-icon-about"
id
=
"roleDj"
><
/i
>
{{
#
}
}}
{{
#
if
(
d
.
roleName
==
'广联总管理员'
)
{
}}
<
i
class
=
"layui-icon layui-icon-about"
id
=
"roleGl"
><
/i
>
{{
#
}
}}
<
/span>
</script>
</body>
</body>
</html>
</html>
\ No newline at end of file
\ No newline at end of file
js/common.js
0 → 100644
View file @
8c4dc39
/*
* @Description: 省市组件
* @Author: huyue
* @Date: 2022-04-08 17:00:25
* @LastEditors: huyue
* @LastEditTime: 2022-04-11 17:01:39
*/
layui
.
define
([
'form'
,
'laydate'
,
'carousel'
,
'util'
],
function
(
exports
)
{
const
{
form
,
laydate
,
carousel
,
util
,
$
,
cache
}
=
layui
exports
(
'common'
,
{
/**
* 生成下拉选
* @param config:参数
* id:dom的id
* string:单个dom
* Array:多个dom
* url:获取地址
* value:<option>的value名
* text:<option>text
* getValue:自定义传输值
* getText:自定义显示文本
* param:url请求的额外参数
* initData:默认option
* link:需要联动的下拉选的dom id
* select:选中事件
* @return <option/>文本
*/
getSelect
(
config
)
{
let
f
=
{
id
:
undefined
,
url
:
undefined
,
name
:
''
,
value
:
'value'
,
text
:
'text'
,
getValue
:
function
(
v
)
{
return
v
[
this
.
value
]
},
getText
:
function
(
t
)
{
return
t
[
this
.
text
]
},
param
:
null
,
initData
:
[{
adcode
:
''
,
name
:
'请选择'
}],
link
:
false
,
select
:
false
,
data
:
[],
isFirst
:
true
,
...
config
},
that
=
this
,
isArray
=
Array
.
isArray
(
f
.
id
)
if
(
f
.
isFirst
)
{
if
(
isArray
)
{
f
.
id
.
forEach
(
id
=>
{
$
(
'#'
+
id
).
attr
(
'lay-filter'
,
'commonSelect'
+
id
)
$
(
'#'
+
id
).
attr
(
'name'
,
f
.
name
)
})
}
else
{
$
(
'#'
+
f
.
id
).
attr
(
'lay-filter'
,
'commonSelect'
+
f
.
id
)
$
(
'#'
+
f
.
id
).
attr
(
'name'
,
f
.
name
)
}
}
// getProvinceList()
//绑定选中事件
if
(
f
.
select
)
{
if
(
isArray
)
{
f
.
id
.
forEach
(
id
=>
{
form
.
on
(
'select(commonSelect'
+
id
+
')'
,
function
(
data
)
{
f
.
select
(
data
)
})
})
}
else
{
form
.
on
(
'select(commonSelect'
+
f
.
id
+
')'
,
function
(
data
)
{
f
.
select
(
data
)
})
}
}
//生成option
function
getOptions
()
{
// if (!f.link) {
// f.data = that.provinceInfoList
// }
let
h
=
''
$
.
each
(
f
.
initData
,
function
(
i
,
d
)
{
h
+=
'<option value="'
+
d
.
adcode
+
'">'
+
d
.
name
+
'</option>'
})
$
.
each
(
f
.
data
,
function
(
i
,
d
)
{
h
+=
'<option value="'
+
f
.
getValue
(
d
)
+
'">'
+
f
.
getText
(
d
)
+
'</option>'
})
if
(
isArray
)
{
f
.
id
.
forEach
(
d
=>
{
let
a
=
$
(
'#'
+
d
)
a
.
empty
()
a
.
append
(
h
)
})
}
else
{
let
a
=
$
(
'#'
+
f
.
id
)
a
.
empty
()
a
.
append
(
h
)
}
form
.
render
(
'select'
)
return
h
}
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
)
{
that
.
provinceInfoList
=
res
.
provinceInfoList
}
})
}
return
getOptions
()
}
})
})
js/validator.js
View file @
8c4dc39
...
@@ -3,6 +3,9 @@ layui.define(['store'], function (exports) {
...
@@ -3,6 +3,9 @@ layui.define(['store'], function (exports) {
/* 手机号码格式校验正则 */
/* 手机号码格式校验正则 */
PHONEREG
:
/^
(
13
[
0-9
]
|15
[
0-9
]
|16
[
0-9
]
|17
[
0-9
]
|18
[
0-9
]
|19
[
0-9
]
|14
[
0-9
])[
0-9
]{8}
$/
,
PHONEREG
:
/^
(
13
[
0-9
]
|15
[
0-9
]
|16
[
0-9
]
|17
[
0-9
]
|18
[
0-9
]
|19
[
0-9
]
|14
[
0-9
])[
0-9
]{8}
$/
,
/* 手机号码或固话格式校验正则 */
PHONETWO
:
/^
((
0
\d{2,3}
-
\d{7,8})
|
(
1
[
34578
]\d{9}))
$/
,
/* 同时包含字母和数字 */
/* 同时包含字母和数字 */
ISNUMANDLETTERS
:
/^
[
a-zA-Z0-9
]
+$/
,
ISNUMANDLETTERS
:
/^
[
a-zA-Z0-9
]
+$/
,
...
@@ -39,6 +42,10 @@ layui.define(['store'], function (exports) {
...
@@ -39,6 +42,10 @@ layui.define(['store'], function (exports) {
checkPhoneNumber
:
function
(
str
)
{
checkPhoneNumber
:
function
(
str
)
{
return
validator
.
PHONEREG
.
test
(
str
)
return
validator
.
PHONEREG
.
test
(
str
)
},
},
// 驻店电话校验规则
checkPhoneNumberTwo
:
function
(
str
)
{
return
validator
.
PHONETWO
.
test
(
str
)
},
// 判断是否含有数字或字母
// 判断是否含有数字或字母
checkNumOrLetters
:
function
(
str
)
{
checkNumOrLetters
:
function
(
str
)
{
...
@@ -88,7 +95,7 @@ layui.define(['store'], function (exports) {
...
@@ -88,7 +95,7 @@ layui.define(['store'], function (exports) {
var
pass
=
true
var
pass
=
true
// 身份证位数为15或18位
// 身份证位数为15或18位
// if (![15, 18].includes(code.length)) {
// if (![15, 18].includes(code.length)) {
if
(
!
(
(
code
.
length
==
15
)
||
(
code
.
length
==
18
)
))
{
if
(
!
(
code
.
length
==
15
||
code
.
length
==
18
))
{
pass
=
false
pass
=
false
}
else
if
(
!
code
||
(
code
.
length
===
18
&&
!
/^
\d{6}(
18|19|20
)\d{2}(
0
[
1-9
]
|1
[
012
])(
0
[
1-9
]
|
[
12
]\d
|3
[
01
])\d{3}(\d
|X
)
$/i
.
test
(
code
)))
{
}
else
if
(
!
code
||
(
code
.
length
===
18
&&
!
/^
\d{6}(
18|19|20
)\d{2}(
0
[
1-9
]
|1
[
012
])(
0
[
1-9
]
|
[
12
]\d
|3
[
01
])\d{3}(\d
|X
)
$/i
.
test
(
code
)))
{
// tip = '身份证号格式错误'
// tip = '身份证号格式错误'
...
@@ -132,4 +139,4 @@ layui.define(['store'], function (exports) {
...
@@ -132,4 +139,4 @@ layui.define(['store'], function (exports) {
}
}
}
}
exports
(
'validator'
,
validator
)
exports
(
'validator'
,
validator
)
})
\ No newline at end of file
\ No newline at end of file
})
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