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 => {
const
storeSaleTrans
=
params
=>
{
return
request
.
get
(
'merchant/saleTrans'
,
params
)
}
// 获取门店销售相关信息
const
getMerchantSales
=
params
=>
{
return
request
.
get
(
'merchant/sale'
,
params
)
}
export
default
{
getSales
,
saleTotal
,
saleTrans
,
storeTotal
,
storeSaleTrans
storeSaleTrans
,
getMerchantSales
}
src/components/PieChart.vue
View file @
e441c52
...
...
@@ -56,10 +56,14 @@ export default {
watch
:
{
list
:
{
handler
(
newVal
)
{
if
(
newVal
.
length
>
0
)
{
this
.
initData
()
this
.
$nextTick
(()
=>
{
this
.
draw
()
})
}
},
immediate
:
fals
e
immediate
:
tru
e
}
},
...
...
@@ -71,19 +75,22 @@ export default {
methods
:
{
//初始化数据
initData
()
{
let
{
list
,
viewData
,
keys
}
=
this
let
{
list
,
keys
}
=
this
this
.
viewData
=
[]
list
.
forEach
(
item
=>
{
viewData
.
push
({
this
.
viewData
.
push
({
name
:
item
[
keys
[
0
]],
value
:
item
[
keys
[
1
]]
})
})
},
draw
()
{
if
(
this
.
mTime
)
clearInterval
(
this
.
mTime
)
this
.
echartsPie
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
))
window
.
addEventListener
(
'resize'
,
()
=>
{
this
.
echartsPie
.
resize
()
})
// 指定图表的配置项和数据
this
.
option
=
{
// tooltip: {
...
...
@@ -91,29 +98,6 @@ export default {
// },
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
:
[
{
name
:
'客户年龄分布'
,
...
...
@@ -139,16 +123,16 @@ export default {
labelLine
:
{
show
:
false
},
animationType
:
'scale'
,
animationEasing
:
'elasticOut'
,
animationDurationUpdate
:
3000
,
animationTypeUpdate
:
'transition'
,
animation
:
true
,
data
:
this
.
viewData
}
]
}
this
.
echartsPie
.
clear
()
this
.
mainValue
=
0
this
.
numDesc
=
''
this
.
setAnamiteText
()
this
.
echartsPie
.
setOption
(
this
.
option
)
this
.
mTime
=
setInterval
(
this
.
pieActive
,
3000
)
// 鼠标划出
this
.
echartsPie
.
on
(
'mouseout'
,
()
=>
{
...
...
@@ -161,7 +145,6 @@ export default {
this
.
setAnamiteText
()
// 停止定时器,清除之前的高亮
clearInterval
(
this
.
mTime
)
console
.
log
(
'mouseover'
)
this
.
currentIndex
=
data
.
dataIndex
this
.
highlightPie
()
this
.
emitEvent
(
data
.
data
)
...
...
@@ -212,7 +195,7 @@ export default {
.pie-box
{
background
:
#262525
;
position
:
relative
;
flex
:
1
;
flex
:
1
;
.center-content
{
position
:
absolute
;
top
:
50%
;
...
...
src/components/RanKing.vue
View file @
e441c52
...
...
@@ -46,8 +46,7 @@ export default {
font-size
:
10px
;
color
:
#eb6001
;
font-weight
:
400
;
text-align
:
center
;
padding
:
0.4vh
0
;
padding
:
0.4vh
0
0.4vh
20%
;
box-sizing
:
border-box
;
}
.ranking
{
...
...
@@ -61,10 +60,9 @@ export default {
.brand-num
{
color
:
#606266
;
margin-right
:
0.6vw
;
max-width
:
20px
;
}
.marquee
{
width
:
calc
(
100%
-
1.5vw
)
;
width
:
80%
;
height
:
1.9vh
;
}
}
...
...
src/mixins/clientMixin.js
View file @
e441c52
// import{changeMixin} from "./changeMixin"
import
{
changeMixin
}
from
'./index'
export
default
{
data
()
{
return
{
now
:
new
Date
().
format
(
'yyyy-MM-dd'
),
clientData
:
[],
brandList
:
[],
distributionRank
:
''
distributionRank
:
''
,
isBrand
:
false
,
brandName
:
''
}
},
//
mixins: [changeMixin],
mixins
:
[
changeMixin
],
created
()
{
this
.
getClientData
()
},
methods
:
{
getClientData
()
{
let
clientApi
=
this
.
isBrand
?
'overalldistribution'
:
'merchantOveralldistribution'
const
params
=
{
req
:
{
corporateGroupName
:
'集团1'
,
queryItem
:
this
.
type
,
// queryTime:
this.now
,
// queryTime:
this.getCurrentDate
,
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
)
const
keys
=
Object
.
keys
(
distribution
)
keys
.
forEach
((
item
,
index
)
=>
{
...
...
@@ -33,10 +37,19 @@ export default {
})
})
this
.
distributionRank
=
JSON
.
parse
(
res
.
data
.
dataList
[
0
].
distributionRank
)
}
else
{
this
.
clientData
=
[]
}
})
},
init
(
newVal
){
// console.log(newVal,1111111111111111111111111)
init
(
newVal
)
{
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
{
data
()
{
return
{
now
:
new
Date
().
format
(
'yyyy-MM-dd'
),
salesData
:
[],
brandList
:
[],
typeRanking
:
''
typeRanking
:
''
,
isBrand
:
false
,
brandName
:
''
}
},
mixins
:
[
changeMixin
],
created
()
{
this
.
getSalesData
()
},
methods
:
{
getSalesData
()
{
let
salesApi
=
this
.
isBrand
?
'getSales'
:
'getMerchantSales'
const
params
=
{
req
:
{
corporateGroupName
:
'集团1'
,
queryItem
:
this
.
type
,
// queryTime:
this.now
,
// queryTime:
this.getCurrentDate
,
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
)
Object
.
keys
(
typeNum
).
forEach
((
item
,
index
)
=>
{
this
.
salesData
.
push
({
...
...
@@ -31,7 +37,18 @@ export default {
})
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 {
this
.
dealList
(
data
.
dataList
)
break
default
:
alert
(
message
)
//
alert(message)
}
})
},
...
...
src/views/customer/age.vue
View file @
e441c52
...
...
@@ -12,8 +12,13 @@
<span>
客户年龄分布
</span>
</div>
<div
class=
"container flex"
>
<template
v-if=
"clientData.length > 0"
>
<pie-chart
:id=
"chart.id"
:list=
"clientData"
@
pieAction=
"pieAction"
></pie-chart>
<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>
</template>
...
...
@@ -25,16 +30,16 @@ export default {
mixins
:
[
clientMixin
],
data
()
{
return
{
type
:
'age'
,
type
:
'age'
,
chart
:
{
id
:
'age-pie'
}
}
},
methods
:
{
pieAction
(
data
){
this
.
brandList
=
Object
.
keys
(
this
.
distributionRank
[
data
.
name
])
}
,
methods
:
{
pieAction
(
data
)
{
this
.
brandList
=
Object
.
keys
(
this
.
distributionRank
[
data
.
name
])
}
}
}
</
script
>
src/views/customer/buyCar.vue
View file @
e441c52
...
...
@@ -12,8 +12,13 @@
<span>
客户购车年限
</span>
</div>
<div
class=
"container flex"
>
<template
v-if=
"clientData.length > 0"
>
<pie-chart
:id=
"chart.id"
:list=
"clientData"
@
pieAction=
"pieAction"
></pie-chart>
<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>
</template>
...
...
src/views/customer/sex.vue
View file @
e441c52
...
...
@@ -12,8 +12,13 @@
<span>
客户性别
</span>
</div>
<div
class=
"container flex"
>
<template
v-if=
"clientData.length > 0"
>
<pie-chart
:id=
"chart.id"
:list=
"clientData"
@
pieAction=
"pieAction"
></pie-chart>
<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>
</template>
...
...
src/views/salesData/customerCategory.vue
View file @
e441c52
...
...
@@ -12,8 +12,13 @@
<span>
客户级别
</span>
</div>
<div
class=
"flex container"
>
<template
v-if=
"salesData.length > 0"
>
<pie-chart
:id=
"chart.id"
:list=
"salesData"
@
pieAction=
"pieAction"
></pie-chart>
<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>
</template>
...
...
src/views/salesData/enterCategory.vue
View file @
e441c52
...
...
@@ -11,9 +11,14 @@
<span
class=
"icon"
></span>
<span>
进店类型
</span>
</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>
<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>
</template>
...
...
src/views/salesData/infoFrom.vue
View file @
e441c52
...
...
@@ -11,9 +11,14 @@
<span
class=
"icon"
></span>
<span>
信息来源
</span>
</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>
<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>
</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