Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
gh
/
data-view
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 e441c520
authored
Jun 29, 2022
by
王志慧
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit-wzh
1 parent
72476d0b
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
106 additions
and
61 deletions
src/api/modules/sales.js
src/components/PieChart.vue
src/components/RanKing.vue
src/mixins/clientMixin.js
src/mixins/salesMixin.js
src/views/afterSales/file.vue
src/views/customer/age.vue
src/views/customer/buyCar.vue
src/views/customer/sex.vue
src/views/salesData/customerCategory.vue
src/views/salesData/enterCategory.vue
src/views/salesData/infoFrom.vue
src/api/modules/sales.js
View file @
e441c52
...
@@ -33,11 +33,15 @@ const storeTotal = params => {
...
@@ -33,11 +33,15 @@ const storeTotal = params => {
const
storeSaleTrans
=
params
=>
{
const
storeSaleTrans
=
params
=>
{
return
request
.
get
(
'merchant/saleTrans'
,
params
)
return
request
.
get
(
'merchant/saleTrans'
,
params
)
}
}
// 获取门店销售相关信息
const
getMerchantSales
=
params
=>
{
return
request
.
get
(
'merchant/sale'
,
params
)
}
export
default
{
export
default
{
getSales
,
getSales
,
saleTotal
,
saleTotal
,
saleTrans
,
saleTrans
,
storeTotal
,
storeTotal
,
storeSaleTrans
storeSaleTrans
,
getMerchantSales
}
}
src/components/PieChart.vue
View file @
e441c52
...
@@ -56,10 +56,14 @@ export default {
...
@@ -56,10 +56,14 @@ export default {
watch
:
{
watch
:
{
list
:
{
list
:
{
handler
(
newVal
)
{
handler
(
newVal
)
{
if
(
newVal
.
length
>
0
)
{
this
.
initData
()
this
.
initData
()
this
.
$nextTick
(()
=>
{
this
.
draw
()
this
.
draw
()
})
}
},
},
immediate
:
fals
e
immediate
:
tru
e
}
}
},
},
...
@@ -71,19 +75,22 @@ export default {
...
@@ -71,19 +75,22 @@ export default {
methods
:
{
methods
:
{
//初始化数据
//初始化数据
initData
()
{
initData
()
{
let
{
list
,
viewData
,
keys
}
=
this
let
{
list
,
keys
}
=
this
this
.
viewData
=
[]
list
.
forEach
(
item
=>
{
list
.
forEach
(
item
=>
{
viewData
.
push
({
this
.
viewData
.
push
({
name
:
item
[
keys
[
0
]],
name
:
item
[
keys
[
0
]],
value
:
item
[
keys
[
1
]]
value
:
item
[
keys
[
1
]]
})
})
})
})
},
},
draw
()
{
draw
()
{
if
(
this
.
mTime
)
clearInterval
(
this
.
mTime
)
this
.
echartsPie
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
))
this
.
echartsPie
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
))
window
.
addEventListener
(
'resize'
,
()
=>
{
window
.
addEventListener
(
'resize'
,
()
=>
{
this
.
echartsPie
.
resize
()
this
.
echartsPie
.
resize
()
})
})
// 指定图表的配置项和数据
// 指定图表的配置项和数据
this
.
option
=
{
this
.
option
=
{
// tooltip: {
// tooltip: {
...
@@ -91,29 +98,6 @@ export default {
...
@@ -91,29 +98,6 @@ export default {
// },
// },
color
:
this
.
colors
,
color
:
this
.
colors
,
title
:
{
text
:
this
.
text
,
// 副标题
subtext
:
this
.
subtext
,
// 主副标题间距
itemGap
:
5
,
x
:
'center'
,
y
:
'center'
,
top
:
'50'
,
// 主标题样式
textStyle
:
{
fontSize
:
'12'
,
color
:
'#ffffff'
,
textAlign
:
'center'
,
fontWeight
:
500
},
// 副标题样式
subtextStyle
:
{
fontSize
:
'10'
,
fontWeight
:
'400'
,
color
:
'#606266'
}
},
series
:
[
series
:
[
{
{
name
:
'客户年龄分布'
,
name
:
'客户年龄分布'
,
...
@@ -139,16 +123,16 @@ export default {
...
@@ -139,16 +123,16 @@ export default {
labelLine
:
{
labelLine
:
{
show
:
false
show
:
false
},
},
animationType
:
'scale'
,
animationEasing
:
'elasticOut'
,
animationDurationUpdate
:
3000
,
animationTypeUpdate
:
'transition'
,
animation
:
true
,
data
:
this
.
viewData
data
:
this
.
viewData
}
}
]
]
}
}
this
.
echartsPie
.
clear
()
this
.
mainValue
=
0
this
.
numDesc
=
''
this
.
setAnamiteText
()
this
.
echartsPie
.
setOption
(
this
.
option
)
this
.
echartsPie
.
setOption
(
this
.
option
)
this
.
mTime
=
setInterval
(
this
.
pieActive
,
3000
)
this
.
mTime
=
setInterval
(
this
.
pieActive
,
3000
)
// 鼠标划出
// 鼠标划出
this
.
echartsPie
.
on
(
'mouseout'
,
()
=>
{
this
.
echartsPie
.
on
(
'mouseout'
,
()
=>
{
...
@@ -161,7 +145,6 @@ export default {
...
@@ -161,7 +145,6 @@ export default {
this
.
setAnamiteText
()
this
.
setAnamiteText
()
// 停止定时器,清除之前的高亮
// 停止定时器,清除之前的高亮
clearInterval
(
this
.
mTime
)
clearInterval
(
this
.
mTime
)
console
.
log
(
'mouseover'
)
this
.
currentIndex
=
data
.
dataIndex
this
.
currentIndex
=
data
.
dataIndex
this
.
highlightPie
()
this
.
highlightPie
()
this
.
emitEvent
(
data
.
data
)
this
.
emitEvent
(
data
.
data
)
...
@@ -212,7 +195,7 @@ export default {
...
@@ -212,7 +195,7 @@ export default {
.pie-box
{
.pie-box
{
background
:
#262525
;
background
:
#262525
;
position
:
relative
;
position
:
relative
;
flex
:
1
;
flex
:
1
;
.center-content
{
.center-content
{
position
:
absolute
;
position
:
absolute
;
top
:
50%
;
top
:
50%
;
...
...
src/components/RanKing.vue
View file @
e441c52
...
@@ -46,8 +46,7 @@ export default {
...
@@ -46,8 +46,7 @@ export default {
font-size
:
10px
;
font-size
:
10px
;
color
:
#eb6001
;
color
:
#eb6001
;
font-weight
:
400
;
font-weight
:
400
;
text-align
:
center
;
padding
:
0.4vh
0
0.4vh
20%
;
padding
:
0.4vh
0
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
}
}
.ranking
{
.ranking
{
...
@@ -61,10 +60,9 @@ export default {
...
@@ -61,10 +60,9 @@ export default {
.brand-num
{
.brand-num
{
color
:
#606266
;
color
:
#606266
;
margin-right
:
0.6vw
;
margin-right
:
0.6vw
;
max-width
:
20px
;
}
}
.marquee
{
.marquee
{
width
:
calc
(
100%
-
1.5vw
)
;
width
:
80%
;
height
:
1.9vh
;
height
:
1.9vh
;
}
}
}
}
...
...
src/mixins/clientMixin.js
View file @
e441c52
// import{changeMixin} from "./changeMixin"
import
{
changeMixin
}
from
'./index'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
now
:
new
Date
().
format
(
'yyyy-MM-dd'
),
clientData
:
[],
clientData
:
[],
brandList
:
[],
brandList
:
[],
distributionRank
:
''
distributionRank
:
''
,
isBrand
:
false
,
brandName
:
''
}
}
},
},
//
mixins: [changeMixin],
mixins
:
[
changeMixin
],
created
()
{
created
()
{
this
.
getClientData
()
this
.
getClientData
()
},
},
methods
:
{
methods
:
{
getClientData
()
{
getClientData
()
{
let
clientApi
=
this
.
isBrand
?
'overalldistribution'
:
'merchantOveralldistribution'
const
params
=
{
const
params
=
{
req
:
{
req
:
{
corporateGroupName
:
'集团1'
,
corporateGroupName
:
'集团1'
,
queryItem
:
this
.
type
,
queryItem
:
this
.
type
,
// queryTime:
this.now
,
// queryTime:
this.getCurrentDate
,
queryTime
:
'2022-06-23'
,
queryTime
:
'2022-06-23'
,
queryType
:
0
queryType
:
this
.
watchReportParams
.
reportType
}
}
}
}
this
.
api
.
customer
.
overalldistribution
(
params
).
then
(
res
=>
{
if
(
this
.
isBrand
)
params
.
req
.
brandName
=
this
.
brandName
this
.
api
.
customer
[
clientApi
](
params
).
then
(
res
=>
{
if
(
res
.
data
.
dataList
.
length
>
0
)
{
let
distribution
=
JSON
.
parse
(
res
.
data
.
dataList
[
0
].
distribution
)
let
distribution
=
JSON
.
parse
(
res
.
data
.
dataList
[
0
].
distribution
)
const
keys
=
Object
.
keys
(
distribution
)
const
keys
=
Object
.
keys
(
distribution
)
keys
.
forEach
((
item
,
index
)
=>
{
keys
.
forEach
((
item
,
index
)
=>
{
...
@@ -33,10 +37,19 @@ export default {
...
@@ -33,10 +37,19 @@ export default {
})
})
})
})
this
.
distributionRank
=
JSON
.
parse
(
res
.
data
.
dataList
[
0
].
distributionRank
)
this
.
distributionRank
=
JSON
.
parse
(
res
.
data
.
dataList
[
0
].
distributionRank
)
}
else
{
this
.
clientData
=
[]
}
})
})
},
},
init
(
newVal
){
init
(
newVal
)
{
// console.log(newVal,1111111111111111111111111)
console
.
log
(
newVal
,
99999999999999999
)
this
.
isBrand
=
false
if
(
newVal
.
brand
)
{
this
.
isBrand
=
true
this
.
brandName
=
newVal
.
brand
.
name
}
this
.
getClientData
()
}
}
}
}
}
}
src/mixins/salesMixin.js
View file @
e441c52
import
{
changeMixin
}
from
'./index'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
now
:
new
Date
().
format
(
'yyyy-MM-dd'
),
salesData
:
[],
salesData
:
[],
brandList
:
[],
brandList
:
[],
typeRanking
:
''
typeRanking
:
''
,
isBrand
:
false
,
brandName
:
''
}
}
},
},
mixins
:
[
changeMixin
],
created
()
{
created
()
{
this
.
getSalesData
()
this
.
getSalesData
()
},
},
methods
:
{
methods
:
{
getSalesData
()
{
getSalesData
()
{
let
salesApi
=
this
.
isBrand
?
'getSales'
:
'getMerchantSales'
const
params
=
{
const
params
=
{
req
:
{
req
:
{
corporateGroupName
:
'集团1'
,
corporateGroupName
:
'集团1'
,
queryItem
:
this
.
type
,
queryItem
:
this
.
type
,
// queryTime:
this.now
,
// queryTime:
this.getCurrentDate
,
queryTime
:
'2022-06-23'
,
queryTime
:
'2022-06-23'
,
queryType
:
0
queryType
:
this
.
watchReportParams
.
reportType
}
}
}
}
this
.
api
.
sales
.
getSales
(
params
).
then
(
res
=>
{
if
(
this
.
isBrand
)
params
.
req
.
brandName
=
this
.
brandName
this
.
api
.
sales
[
salesApi
](
params
).
then
(
res
=>
{
if
(
res
.
data
.
dataList
.
length
>
0
)
{
let
typeNum
=
JSON
.
parse
(
res
.
data
.
dataList
[
0
].
typeNum
)
let
typeNum
=
JSON
.
parse
(
res
.
data
.
dataList
[
0
].
typeNum
)
Object
.
keys
(
typeNum
).
forEach
((
item
,
index
)
=>
{
Object
.
keys
(
typeNum
).
forEach
((
item
,
index
)
=>
{
this
.
salesData
.
push
({
this
.
salesData
.
push
({
...
@@ -31,7 +37,18 @@ export default {
...
@@ -31,7 +37,18 @@ export default {
})
})
this
.
typeRanking
=
JSON
.
parse
(
res
.
data
.
dataList
[
0
].
typeRanking
)
this
.
typeRanking
=
JSON
.
parse
(
res
.
data
.
dataList
[
0
].
typeRanking
)
}
else
{
this
.
salesData
=
[]
}
})
})
},
init
(
newVal
)
{
this
.
isBrand
=
false
if
(
newVal
.
brand
)
{
this
.
isBrand
=
true
this
.
brandName
=
newVal
.
brand
.
name
}
this
.
getSalesData
()
}
}
}
}
}
}
src/views/afterSales/file.vue
View file @
e441c52
...
@@ -51,7 +51,7 @@ export default {
...
@@ -51,7 +51,7 @@ export default {
this
.
dealList
(
data
.
dataList
)
this
.
dealList
(
data
.
dataList
)
break
break
default
:
default
:
alert
(
message
)
//
alert(message)
}
}
})
})
},
},
...
...
src/views/customer/age.vue
View file @
e441c52
...
@@ -12,8 +12,13 @@
...
@@ -12,8 +12,13 @@
<span>
客户年龄分布
</span>
<span>
客户年龄分布
</span>
</div>
</div>
<div
class=
"container flex"
>
<div
class=
"container flex"
>
<template
v-if=
"clientData.length > 0"
>
<pie-chart
:id=
"chart.id"
:list=
"clientData"
@
pieAction=
"pieAction"
></pie-chart>
<pie-chart
:id=
"chart.id"
:list=
"clientData"
@
pieAction=
"pieAction"
></pie-chart>
<ran-king
:list=
"brandList"
></ran-king>
<ran-king
:list=
"brandList"
></ran-king>
</
template
>
<div
class=
"empty"
style=
"height:12.7vh"
v-else
>
<img
src=
"../../assets/images/empty.png"
alt=
""
/>
</div>
</div>
</div>
</div>
</div>
</template>
</template>
...
@@ -25,16 +30,16 @@ export default {
...
@@ -25,16 +30,16 @@ export default {
mixins
:
[
clientMixin
],
mixins
:
[
clientMixin
],
data
()
{
data
()
{
return
{
return
{
type
:
'age'
,
type
:
'age'
,
chart
:
{
chart
:
{
id
:
'age-pie'
id
:
'age-pie'
}
}
}
}
},
},
methods
:
{
methods
:
{
pieAction
(
data
){
pieAction
(
data
)
{
this
.
brandList
=
Object
.
keys
(
this
.
distributionRank
[
data
.
name
])
this
.
brandList
=
Object
.
keys
(
this
.
distributionRank
[
data
.
name
])
}
,
}
}
}
}
}
</
script
>
</
script
>
src/views/customer/buyCar.vue
View file @
e441c52
...
@@ -12,8 +12,13 @@
...
@@ -12,8 +12,13 @@
<span>
客户购车年限
</span>
<span>
客户购车年限
</span>
</div>
</div>
<div
class=
"container flex"
>
<div
class=
"container flex"
>
<template
v-if=
"clientData.length > 0"
>
<pie-chart
:id=
"chart.id"
:list=
"clientData"
@
pieAction=
"pieAction"
></pie-chart>
<pie-chart
:id=
"chart.id"
:list=
"clientData"
@
pieAction=
"pieAction"
></pie-chart>
<ran-king
:list=
"brandList"
></ran-king>
<ran-king
:list=
"brandList"
></ran-king>
</
template
>
<div
class=
"empty"
style=
"height:12.7vh"
v-else
>
<img
src=
"../../assets/images/empty.png"
alt=
""
/>
</div>
</div>
</div>
</div>
</div>
</template>
</template>
...
...
src/views/customer/sex.vue
View file @
e441c52
...
@@ -12,8 +12,13 @@
...
@@ -12,8 +12,13 @@
<span>
客户性别
</span>
<span>
客户性别
</span>
</div>
</div>
<div
class=
"container flex"
>
<div
class=
"container flex"
>
<template
v-if=
"clientData.length > 0"
>
<pie-chart
:id=
"chart.id"
:list=
"clientData"
@
pieAction=
"pieAction"
></pie-chart>
<pie-chart
:id=
"chart.id"
:list=
"clientData"
@
pieAction=
"pieAction"
></pie-chart>
<ran-king
:list=
"brandList"
></ran-king>
<ran-king
:list=
"brandList"
></ran-king>
</
template
>
<div
class=
"empty"
style=
"height:12.7vh"
v-else
>
<img
src=
"../../assets/images/empty.png"
alt=
""
/>
</div>
</div>
</div>
</div>
</div>
</template>
</template>
...
...
src/views/salesData/customerCategory.vue
View file @
e441c52
...
@@ -12,8 +12,13 @@
...
@@ -12,8 +12,13 @@
<span>
客户级别
</span>
<span>
客户级别
</span>
</div>
</div>
<div
class=
"flex container"
>
<div
class=
"flex container"
>
<template
v-if=
"salesData.length > 0"
>
<pie-chart
:id=
"chart.id"
:list=
"salesData"
@
pieAction=
"pieAction"
></pie-chart>
<pie-chart
:id=
"chart.id"
:list=
"salesData"
@
pieAction=
"pieAction"
></pie-chart>
<ran-king
:list=
"brandList"
></ran-king>
<ran-king
:list=
"brandList"
></ran-king>
</
template
>
<div
class=
"empty"
style=
"height:12.7vh"
v-else
>
<img
src=
"../../assets/images/empty.png"
alt=
""
/>
</div>
</div>
</div>
</div>
</div>
</template>
</template>
...
...
src/views/salesData/enterCategory.vue
View file @
e441c52
...
@@ -11,9 +11,14 @@
...
@@ -11,9 +11,14 @@
<span
class=
"icon"
></span>
<span
class=
"icon"
></span>
<span>
进店类型
</span>
<span>
进店类型
</span>
</div>
</div>
<div
class=
"container flex"
>
<div
class=
"flex container"
>
<template
v-if=
"salesData.length > 0"
>
<pie-chart
:id=
"chart.id"
:list=
"salesData"
@
pieAction=
"pieAction"
></pie-chart>
<pie-chart
:id=
"chart.id"
:list=
"salesData"
@
pieAction=
"pieAction"
></pie-chart>
<ran-king
:list=
"brandList"
></ran-king>
<ran-king
:list=
"brandList"
></ran-king>
</
template
>
<div
class=
"empty"
style=
"height:12.7vh"
v-else
>
<img
src=
"../../assets/images/empty.png"
alt=
""
/>
</div>
</div>
</div>
</div>
</div>
</template>
</template>
...
...
src/views/salesData/infoFrom.vue
View file @
e441c52
...
@@ -11,9 +11,14 @@
...
@@ -11,9 +11,14 @@
<span
class=
"icon"
></span>
<span
class=
"icon"
></span>
<span>
信息来源
</span>
<span>
信息来源
</span>
</div>
</div>
<div
class=
"container flex"
>
<div
class=
"flex container"
>
<template
v-if=
"salesData.length > 0"
>
<pie-chart
:id=
"chart.id"
:list=
"salesData"
@
pieAction=
"pieAction"
></pie-chart>
<pie-chart
:id=
"chart.id"
:list=
"salesData"
@
pieAction=
"pieAction"
></pie-chart>
<ran-king
:list=
"brandList"
></ran-king>
<ran-king
:list=
"brandList"
></ran-king>
</
template
>
<div
class=
"empty"
style=
"height: 12.7vh"
v-else
>
<img
src=
"../../assets/images/empty.png"
alt=
""
/>
</div>
</div>
</div>
</div>
</div>
</template>
</template>
...
...
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