Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
glsx-oss-merchant-data
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 8c85ffe9
authored
Mar 26, 2019
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
省市区组件-完善
1 parent
2369808e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
25 deletions
src/views/customer/businessList/AddDialog.vue
src/views/customer/businessList/SearchDialog.vue
src/views/customer/businessList/index.vue
src/views/customer/components/src/cityArea.vue
src/views/customer/businessList/AddDialog.vue
View file @
8c85ffe
...
@@ -24,6 +24,15 @@
...
@@ -24,6 +24,15 @@
<span
v-show=
"errorBags.has('name')"
class=
"error"
>
{{
errorBags
.
first
(
'name'
)
}}
</span>
<span
v-show=
"errorBags.has('name')"
class=
"error"
>
{{
errorBags
.
first
(
'name'
)
}}
</span>
</gl-form-item>
</gl-form-item>
<gl-form-item
label=
"商户地址:"
>
<gl-form-item
label=
"商户地址:"
>
<city-area
ref=
"c"
:showCity=
"showCity"
:validateCity=
"validateCity"
:eventBus=
"eventBus"
@
cityArea=
"getCityArea"
>
</city-area>
</gl-form-item>
<gl-form-item
label=
""
>
<gl-input
<gl-input
v-model=
"merchantForm.address"
v-model=
"merchantForm.address"
placeholder=
"请输入详细地址"
placeholder=
"请输入详细地址"
...
@@ -76,6 +85,8 @@
...
@@ -76,6 +85,8 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
Vue
from
'vue'
import
{
CityArea
}
from
'../components'
const
isPhone
=
{
const
isPhone
=
{
validate
:
(
value
,
args
)
=>
{
validate
:
(
value
,
args
)
=>
{
return
value
.
length
===
11
&&
/^1
[
345789
]\d{9}
$/
.
test
(
value
)
return
value
.
length
===
11
&&
/^1
[
345789
]\d{9}
$/
.
test
(
value
)
...
@@ -86,6 +97,11 @@ export default {
...
@@ -86,6 +97,11 @@ export default {
data
()
{
data
()
{
return
{
return
{
title
:
'新增商户'
,
title
:
'新增商户'
,
// 省市区组件-配置
eventBus
:
null
,
showCity
:
[
1
,
1
,
1
],
validateCity
:
[
1
,
1
,
1
],
areaInfo
:
{},
// phoneFixed: 11,
// phoneFixed: 11,
rules
:
{
rules
:
{
merchantName
:
[{
required
:
true
}],
merchantName
:
[{
required
:
true
}],
...
@@ -107,24 +123,42 @@ export default {
...
@@ -107,24 +123,42 @@ export default {
},
},
merchantForm
:
Object
merchantForm
:
Object
},
},
components
:
{
CityArea
},
watch
:
{
watch
:
{
isVisible
()
{
isVisible
(
val
)
{
if
(
!
val
)
{
this
.
$validator
.
errors
.
clear
()
this
.
$validator
.
errors
.
clear
()
this
.
areaInfo
=
{}
}
}
}
},
},
mounted
()
{
mounted
()
{
this
.
$validator
.
extend
(
'is_phone'
,
isPhone
)
this
.
$validator
.
extend
(
'is_phone'
,
isPhone
)
this
.
eventBus
=
new
Vue
()
},
},
methods
:
{
methods
:
{
handleClose
()
{
handleClose
()
{
this
.
eventBus
.
$emit
(
'reset'
)
this
.
$emit
(
'hideDialog'
)
this
.
$emit
(
'hideDialog'
)
},
},
handleComfrim
()
{
handleComfrim
()
{
this
.
$validator
.
validateAll
().
then
((
result
)
=>
{
Promise
.
all
([
if
(
result
)
{
this
.
$refs
[
'c'
].
$validator
.
validateAll
(),
this
.
$emit
(
'comfirmDialog'
)
this
.
$validator
.
validateAll
()
]).
then
((
result
)
=>
{
if
(
result
[
0
]
&&
result
[
1
])
{
this
.
$emit
(
'comfirmDialog'
,
this
.
areaInfo
)
this
.
eventBus
.
$emit
(
'reset'
)
}
}
})
})
},
getCityArea
(
params
)
{
console
.
log
(
params
)
this
.
areaInfo
.
provinceId
=
params
[
0
]
this
.
areaInfo
.
cityId
=
params
[
1
]
this
.
areaInfo
.
areaId
=
params
[
2
]
}
}
}
}
}
}
...
...
src/views/customer/businessList/SearchDialog.vue
View file @
8c85ffe
...
@@ -29,7 +29,12 @@
...
@@ -29,7 +29,12 @@
</gl-col>
</gl-col>
<gl-col
:span=
"12"
>
<gl-col
:span=
"12"
>
<gl-form-item
label=
"地区:"
>
<gl-form-item
label=
"地区:"
>
<gl-col
:span=
"11"
>
<city-area
:showCity=
"showCity"
:eventBus=
"eventBus"
@
cityArea=
"getCityArea"
></city-area>
<!--
<gl-col
:span=
"11"
>
<gl-select
<gl-select
v-model=
"merchantSearch.provinceId"
v-model=
"merchantSearch.provinceId"
placeholder=
"省"
placeholder=
"省"
...
@@ -45,7 +50,7 @@
...
@@ -45,7 +50,7 @@
placeholder=
"市"
placeholder=
"市"
>
>
</gl-select>
</gl-select>
</gl-col>
</gl-col>
-->
</gl-form-item>
</gl-form-item>
</gl-col>
</gl-col>
<gl-col
:span=
"12"
>
<gl-col
:span=
"12"
>
...
@@ -116,11 +121,15 @@
...
@@ -116,11 +121,15 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
Vue
from
'vue'
import
{
CityArea
}
from
'../components'
export
default
{
export
default
{
name
:
'SearchDialog'
,
name
:
'SearchDialog'
,
data
()
{
data
()
{
return
{
return
{
title
:
'高级搜索'
title
:
'高级搜索'
,
eventBus
:
null
,
showCity
:
[
1
,
1
]
}
}
},
},
props
:
{
props
:
{
...
@@ -135,15 +144,28 @@ export default {
...
@@ -135,15 +144,28 @@ export default {
merchantSearch
:
Object
,
merchantSearch
:
Object
,
statusItems
:
Object
statusItems
:
Object
},
},
components
:
{
CityArea
},
mounted
()
{
this
.
eventBus
=
new
Vue
()
},
methods
:
{
methods
:
{
handleClose
()
{
handleClose
()
{
this
.
eventBus
.
$emit
(
'reset'
)
this
.
$emit
(
'hideDialog'
,
true
)
this
.
$emit
(
'hideDialog'
,
true
)
},
},
handleComfrim
()
{
handleComfrim
()
{
this
.
eventBus
.
$emit
(
'reset'
)
this
.
$emit
(
'comfirmDialog'
)
this
.
$emit
(
'comfirmDialog'
)
},
},
hideDialog
()
{
hideDialog
()
{
this
.
eventBus
.
$emit
(
'reset'
)
this
.
$emit
(
'hideDialog'
)
this
.
$emit
(
'hideDialog'
)
},
getCityArea
(
params
)
{
this
.
merchantSearch
.
provinceId
=
params
[
0
]
this
.
merchantSearch
.
cityId
=
params
[
1
]
}
}
}
}
}
}
...
...
src/views/customer/businessList/index.vue
View file @
8c85ffe
...
@@ -16,11 +16,11 @@
...
@@ -16,11 +16,11 @@
background
background
@
size-change=
"handleSizeChange"
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
@
current-change=
"handleCurrentChange"
:current-page
.
sync=
"
currentPage
"
:current-page
.
sync=
"
pageCount
"
:page-sizes=
"[10, 20, 30, 40]"
:page-sizes=
"[10, 20, 30, 40]"
:page-size=
"pageSize"
:page-size=
"pageSize"
layout=
"sizes, total, ->, prev, pager, next, jumper"
layout=
"sizes, total, ->, prev, pager, next, jumper"
:total=
"total"
:total=
"total
Count
"
>
>
</gl-pagination>
</gl-pagination>
</div>
</div>
...
@@ -58,6 +58,12 @@ export default {
...
@@ -58,6 +58,12 @@ export default {
addVisible
:
false
,
addVisible
:
false
,
merchantForm
:
{
merchantForm
:
{
merchantName
:
''
,
merchantName
:
''
,
provinceId
:
''
,
provinceName
:
''
,
cityId
:
''
,
cityName
:
''
,
areaId
:
''
,
areaName
:
''
,
address
:
''
,
address
:
''
,
merchantChannel
:
''
,
merchantChannel
:
''
,
contactor
:
''
,
contactor
:
''
,
...
@@ -81,8 +87,8 @@ export default {
...
@@ -81,8 +87,8 @@ export default {
1
:
'已停用'
1
:
'已停用'
},
},
// 分页所需参数-start
// 分页所需参数-start
total
:
10
,
total
Count
:
10
,
currentPage
:
1
,
pageCount
:
1
,
pageSize
:
10
,
pageSize
:
10
,
// 分页所需参数-end
// 分页所需参数-end
ListTableData
:
{
ListTableData
:
{
...
@@ -143,7 +149,7 @@ export default {
...
@@ -143,7 +149,7 @@ export default {
getParams
()
{
getParams
()
{
const
params
=
this
.
$deep_clone
(
this
.
merchantSearch
)
const
params
=
this
.
$deep_clone
(
this
.
merchantSearch
)
params
.
pageSize
=
this
.
pageSize
params
.
pageSize
=
this
.
pageSize
params
.
currentPage
=
this
.
currentPage
params
.
pageCount
=
this
.
pageCount
return
params
return
params
},
},
// 接口请求-start
// 接口请求-start
...
@@ -152,7 +158,7 @@ export default {
...
@@ -152,7 +158,7 @@ export default {
params
.
methods
=
bizMethods
.
Search
params
.
methods
=
bizMethods
.
Search
request
.
req
(
params
).
then
(
res
=>
{
request
.
req
(
params
).
then
(
res
=>
{
this
.
ListTableData
.
data
=
res
.
merchants
this
.
ListTableData
.
data
=
res
.
merchants
this
.
total
=
res
.
pagination
.
totalCount
this
.
total
Count
=
res
.
pagination
.
totalCount
this
.
reset
(
this
.
merchantSearch
)
this
.
reset
(
this
.
merchantSearch
)
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
err
)
console
.
log
(
err
)
...
@@ -160,14 +166,16 @@ export default {
...
@@ -160,14 +166,16 @@ export default {
this
.
reset
(
this
.
merchantSearch
)
this
.
reset
(
this
.
merchantSearch
)
})
})
},
},
saveMerchant
()
{
saveMerchant
(
areaInfo
)
{
request
.
req
(
this
.
merchantForm
).
then
(
res
=>
{
this
.
merchantForm
=
Object
.
assign
(
this
.
merchantForm
,
areaInfo
)
const
params
=
this
.
merchantForm
params
.
methods
=
bizMethods
.
Create
request
.
req
(
params
).
then
(
res
=>
{
notice
.
okTips
()
notice
.
okTips
()
this
.
reset
(
this
.
merchantForm
)
this
.
reset
(
this
.
merchantForm
)
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
err
)
console
.
log
(
err
)
notice
.
errorTips
()
notice
.
errorTips
()
this
.
reset
(
this
.
merchantForm
)
})
})
},
},
// 接口请求-end
// 接口请求-end
...
@@ -176,7 +184,7 @@ export default {
...
@@ -176,7 +184,7 @@ export default {
this
.
getList
()
this
.
getList
()
},
},
handleCurrentChange
(
val
)
{
handleCurrentChange
(
val
)
{
this
.
currentPage
=
val
this
.
pageCount
=
val
this
.
getList
()
this
.
getList
()
},
},
reset
(
params
)
{
reset
(
params
)
{
...
@@ -207,9 +215,9 @@ export default {
...
@@ -207,9 +215,9 @@ export default {
this
.
handleAdd
()
this
.
handleAdd
()
this
.
reset
(
this
.
merchantForm
)
this
.
reset
(
this
.
merchantForm
)
},
},
handleAddComfirm
()
{
handleAddComfirm
(
areaInfo
)
{
this
.
handleAdd
()
this
.
handleAdd
()
this
.
saveMerchant
()
this
.
saveMerchant
(
areaInfo
)
}
}
}
}
}
}
...
...
src/views/customer/components/src/cityArea.vue
View file @
8c85ffe
...
@@ -101,9 +101,6 @@ export default {
...
@@ -101,9 +101,6 @@ export default {
city
(
val
)
{
city
(
val
)
{
!
val
?
this
.
areaList
=
[]
:
false
!
val
?
this
.
areaList
=
[]
:
false
}
}
// eventBus(val) {
// console.log(val)
// },
// eventBus: {
// eventBus: {
// handler(__eventBus) {
// handler(__eventBus) {
// if (__eventBus) {
// if (__eventBus) {
...
@@ -118,9 +115,7 @@ export default {
...
@@ -118,9 +115,7 @@ export default {
mounted
()
{
mounted
()
{
// console.log(this.showCity)
// console.log(this.showCity)
this
.
eventBus
.
$on
(
'reset'
,
()
=>
{
this
.
eventBus
.
$on
(
'reset'
,
()
=>
{
this
.
province
=
''
this
.
resetAll
()
this
.
city
=
''
this
.
area
=
''
})
})
// 初始化
// 初始化
this
.
$request
({
url
:
'http://192.168.3.171:7300/mock/5be17454f31545347559d499/config/area_config'
}).
then
(
data
=>
{
this
.
$request
({
url
:
'http://192.168.3.171:7300/mock/5be17454f31545347559d499/config/area_config'
}).
then
(
data
=>
{
...
@@ -133,6 +128,16 @@ export default {
...
@@ -133,6 +128,16 @@ export default {
})
})
},
},
methods
:
{
methods
:
{
resetAll
()
{
this
.
province
=
''
this
.
city
=
''
this
.
area
=
''
this
.
mutIndex
=
[]
clearTimeout
(
timer
)
const
timer
=
setTimeout
(()
=>
{
this
.
$validator
.
errors
.
clear
()
},
400
)
},
// 选择省
// 选择省
selectProvince
(
val
)
{
selectProvince
(
val
)
{
this
.
mutArray
=
[
val
,
null
,
null
]
this
.
mutArray
=
[
val
,
null
,
null
]
...
@@ -155,13 +160,16 @@ export default {
...
@@ -155,13 +160,16 @@ export default {
this
.
mutArray
[
1
]
=
val
this
.
mutArray
[
1
]
=
val
this
.
mutArray
[
2
]
=
null
this
.
mutArray
[
2
]
=
null
const
i
=
this
.
mutIndex
[
0
]
const
i
=
this
.
mutIndex
[
0
]
if
(
this
.
AllData
[
i
])
{
this
.
AllData
[
i
].
cityInfoList
.
forEach
((
element
,
index
)
=>
{
this
.
AllData
[
i
].
cityInfoList
.
forEach
((
element
,
index
)
=>
{
if
(
element
.
cityId
===
val
)
{
if
(
element
.
cityId
===
val
)
{
this
.
mutIndex
[
1
]
=
index
this
.
mutIndex
[
1
]
=
index
}
}
})
})
}
val
?
this
.
getArea
(
this
.
mutIndex
[
0
],
this
.
mutIndex
[
1
])
:
false
val
?
this
.
getArea
(
this
.
mutIndex
[
0
],
this
.
mutIndex
[
1
])
:
false
this
.
area
=
''
this
.
area
=
''
this
.
mutIndex
[
2
]
=
''
val
?
this
.
$emit
(
'cityArea'
,
this
.
mutArray
)
:
false
val
?
this
.
$emit
(
'cityArea'
,
this
.
mutArray
)
:
false
},
},
// 选择区
// 选择区
...
@@ -172,20 +180,24 @@ export default {
...
@@ -172,20 +180,24 @@ export default {
// 获取市
// 获取市
getCity
(
index
)
{
getCity
(
index
)
{
const
arr
=
[]
const
arr
=
[]
if
(
this
.
AllData
[
index
])
{
this
.
AllData
[
index
].
cityInfoList
.
forEach
(
element
=>
{
this
.
AllData
[
index
].
cityInfoList
.
forEach
(
element
=>
{
arr
.
push
({
cityId
:
element
.
cityId
,
cityName
:
element
.
cityName
})
arr
.
push
({
cityId
:
element
.
cityId
,
cityName
:
element
.
cityName
})
})
})
this
.
cityList
=
arr
this
.
cityList
=
arr
}
},
},
// 获取区
// 获取区
getArea
(
i
,
j
)
{
getArea
(
i
,
j
)
{
const
arr
=
[]
const
arr
=
[]
if
(
this
.
AllData
[
i
])
{
this
.
AllData
[
i
].
cityInfoList
[
j
].
areaInfoList
.
forEach
(
element
=>
{
this
.
AllData
[
i
].
cityInfoList
[
j
].
areaInfoList
.
forEach
(
element
=>
{
arr
.
push
({
areaId
:
element
.
areaId
,
areaName
:
element
.
areaName
})
arr
.
push
({
areaId
:
element
.
areaId
,
areaName
:
element
.
areaName
})
})
})
this
.
areaList
=
arr
this
.
areaList
=
arr
}
}
}
}
}
}
}
</
script
>
</
script
>
<
style
>
<
style
>
...
...
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