Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-discover
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 740d0e37
authored
Jul 07, 2023
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
车系弹窗修改
1 parent
f9e8801b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
12 deletions
src/views/store/components/selectCarDialog.vue
src/views/store/components/selectCarDialog.vue
View file @
740d0e3
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
@
onCancel=
"handleClose"
>
@
onCancel=
"handleClose"
>
<div
class=
"car-container"
>
<div
class=
"car-container"
>
<div
class=
"wrap"
>
<div
class=
"wrap"
>
<div
class=
"item flex-center
"
v-for=
"item in carSeriesData"
:key=
"item.id"
@
click=
"selectBrand(item)"
>
<div
:class=
"['item', 'flex-center',
{'curItem' : curBrandId==item.id}]
" v-for="item in carSeriesData" :key="item.id" @click="selectBrand(item)">
<span>
{{
item
.
name
}}
</span>
<span>
{{
item
.
name
}}
</span>
<i
class=
"el-icon-arrow-right"
></i>
<i
class=
"el-icon-arrow-right"
></i>
</div>
</div>
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
<div
class=
"wrap"
>
<div
class=
"wrap"
>
<div
class=
"item son-brand-wrap"
v-for=
"(item, index) in sonBrandList"
:key=
"item.id"
>
<div
class=
"item son-brand-wrap"
v-for=
"(item, index) in sonBrandList"
:key=
"item.id"
>
<el-checkbox
:indeterminate=
"isIndeterminate(item)"
:value=
"isChecked(item.id, 'son')"
@
change=
"selectSonBrand($event, item, index)"
></el-checkbox>
<el-checkbox
:indeterminate=
"isIndeterminate(item)"
:value=
"isChecked(item.id, 'son')"
@
change=
"selectSonBrand($event, item, index)"
></el-checkbox>
<span
class=
"son-brand-label
"
@
click=
"showCarSeries(item)"
>
<span
:class=
"['son-brand-label',
{'curItem' : curSonBrandId==item.id}]
" @click="showCarSeries(item)">
{{
item
.
name
}}{{
isIndeterminate
(
item
)
}}
{{
item
.
name
}}{{
isIndeterminate
(
item
)
}}
<i
class=
"el-icon-arrow-right"
></i>
<i
class=
"el-icon-arrow-right"
></i>
</span>
</span>
...
@@ -40,10 +40,11 @@
...
@@ -40,10 +40,11 @@
carSeriesData
:
[],
carSeriesData
:
[],
sonBrandList
:
[],
sonBrandList
:
[],
carSeriesList
:
[],
carSeriesList
:
[],
curSonBrandId
:
''
,
selectdData
:
[],
selectdData
:
[],
checkedList
:
[],
checkedList
:
[],
checked
:
true
,
curBrandId
:
''
,
curSonBrandId
:
''
,
firstClick
:
false
}
}
},
},
computed
:{
computed
:{
...
@@ -73,6 +74,7 @@
...
@@ -73,6 +74,7 @@
const
_notExistItem
=
item
?.
childs
?.
find
(
row
=>
this
.
selectdData
.
includes
(
row
.
id
))
const
_notExistItem
=
item
?.
childs
?.
find
(
row
=>
this
.
selectdData
.
includes
(
row
.
id
))
return
!!
_existItem
&&
!!
_notExistItem
return
!!
_existItem
&&
!!
_notExistItem
},
},
// 获取数据源
getCarSeriesData
()
{
getCarSeriesData
()
{
this
.
$apis
.
case
.
getCarSeriesApi
({
needCarSeries
:
true
}).
then
(
res
=>
{
this
.
$apis
.
case
.
getCarSeriesApi
({
needCarSeries
:
true
}).
then
(
res
=>
{
console
.
log
(
res
)
console
.
log
(
res
)
...
@@ -81,38 +83,58 @@
...
@@ -81,38 +83,58 @@
}
}
})
})
},
},
// 切换品牌
selectBrand
(
item
)
{
selectBrand
(
item
)
{
if
(
this
.
curBrandId
==
item
.
id
)
return
;
this
.
curBrandId
=
item
.
id
this
.
sonBrandList
=
item
?.
childs
||
[]
this
.
sonBrandList
=
item
?.
childs
||
[]
console
.
log
(
item
,
this
.
sonBrandList
)
this
.
curSonBrandId
=
''
this
.
carSeriesList
=
[]
},
},
// 选中子品牌
selectSonBrand
(
e
,
item
,
index
){
selectSonBrand
(
e
,
item
,
index
){
console
.
log
(
e
,
item
,
index
)
const
{
id
}
=
item
const
{
id
}
=
item
const
_targetIdx
=
this
.
checkedList
.
findIndex
(
ele
=>
ele
==
id
)
const
_targetIdx
=
this
.
checkedList
.
findIndex
(
ele
=>
ele
==
id
)
if
(
_targetIdx
>-
1
){
if
(
_targetIdx
>-
1
){
this
.
checkedList
.
splice
(
_targetIdx
,
1
)
this
.
checkedList
.
splice
(
_targetIdx
,
1
)
item
.
childs
.
forEach
(
row
=>
{
const
spliceIdx
=
this
.
selectdData
.
findIndex
(
ele
=>
ele
==
row
.
id
)
this
.
selectdData
.
splice
(
spliceIdx
,
1
)
})
}
else
{
}
else
{
this
.
checkedList
.
push
(
id
)
this
.
checkedList
.
push
(
id
)
let
ids
=
item
.
childs
.
map
(
item
=>
item
.
id
)
this
.
selectdData
=
[...
new
Set
([...
this
.
selectdData
,
...
ids
])]
}
}
console
.
log
(
this
.
checkedList
)
},
},
// 选中车系
selectCarSeries
(){
selectCarSeries
(){
if
(
!
this
.
firstClick
){
this
.
selectdData
=
[]
this
.
firstClick
=
true
}
const
unChecked
=
this
.
carSeriesList
.
find
(
item
=>
!
this
.
selectdData
.
includes
(
item
.
id
))
const
unChecked
=
this
.
carSeriesList
.
find
(
item
=>
!
this
.
selectdData
.
includes
(
item
.
id
))
const
checked
=
this
.
carSeriesList
.
find
(
item
=>
this
.
selectdData
.
includes
(
item
.
id
))
const
checked
=
this
.
carSeriesList
.
find
(
item
=>
this
.
selectdData
.
includes
(
item
.
id
))
if
(
!
unChecked
)
{
const
_targetIdx
=
this
.
checkedList
.
findIndex
(
ele
=>
ele
==
this
.
curSonBrandId
)
if
(
!
unChecked
&&
_targetIdx
==-
1
)
{
this
.
checkedList
.
push
(
this
.
curSonBrandId
)
this
.
checkedList
.
push
(
this
.
curSonBrandId
)
}
}
if
(
!
checked
){
if
(
!
checked
&&
_targetIdx
>-
1
){
const
_targetIdx
=
this
.
checkedList
.
findIndex
(
ele
=>
ele
==
this
.
curSonBrandId
)
this
.
checkedList
.
splice
(
_targetIdx
,
1
)
this
.
checkedList
.
splice
(
_targetIdx
,
1
)
}
}
},
},
// 切换子品牌
showCarSeries
(
item
){
showCarSeries
(
item
){
if
(
!
this
.
firstClick
){
this
.
selectdData
=
[]
this
.
firstClick
=
true
}
if
(
this
.
curSonBrandId
==
item
.
id
)
return
;
this
.
curSonBrandId
=
item
.
id
this
.
curSonBrandId
=
item
.
id
this
.
carSeriesList
=
item
?.
childs
this
.
carSeriesList
=
item
?.
childs
},
},
handleConfirm
(){
handleConfirm
(){
console
.
log
(
this
.
selectdData
,
155
)
console
.
log
(
this
.
checkedList
,
155
)
}
}
}
}
}
}
...
@@ -123,6 +145,9 @@
...
@@ -123,6 +145,9 @@
border
:
1px
solid
#E8E8EA
;
border
:
1px
solid
#E8E8EA
;
height
:
476px
;
height
:
476px
;
display
:
flex
;
display
:
flex
;
.el-checkbox{
display
:
block
;
}
.wrap
{
.wrap
{
flex
:
1
;
flex
:
1
;
border-left
:
1px
solid
#E8E8EA
;
border-left
:
1px
solid
#E8E8EA
;
...
@@ -150,7 +175,6 @@
...
@@ -150,7 +175,6 @@
align-items
:
center
;
align-items
:
center
;
.son-brand-label{
.son-brand-label{
margin-left
:
4px
;
margin-left
:
4px
;
line-height
:
29px
;
flex
:
1
;
flex
:
1
;
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
...
@@ -170,6 +194,9 @@
...
@@ -170,6 +194,9 @@
//
}
//
}
//
}
//
}
}
}
.curItem
{
color
:
#5850FF
!important
;
}
}
}
</
style
>
</
style
>
\ 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