Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-custom
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 9a2f3616
authored
Dec 14, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
客户画像2.0
1 parent
c89e93cb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
39 deletions
src/views/userPortrait/components/PieChart.vue
src/views/userPortrait/components/UserStats.vue
src/views/userPortrait/index.vue
src/views/userPortrait/components/PieChart.vue
View file @
9a2f361
<
template
>
<div>
<p
class=
"line-color-title"
>
{{
title
}}
</p>
<div
v-if=
"data"
ref=
"pieChart"
style=
"margin-top:10px;width: 100%; height:2
2
vh;"
></div>
<div
v-if=
"data"
ref=
"pieChart"
style=
"margin-top:10px;width: 100%; height:2
5
vh;"
></div>
</div>
</
template
>
...
...
@@ -34,6 +34,7 @@ export default {
mounted
()
{
this
.
initChart
(
this
.
$refs
.
pieChart
);
this
.
drawChart
();
this
.
dynamicResizeChart
();
},
methods
:
{
generateRichStyles
()
{
...
...
@@ -91,6 +92,12 @@ export default {
};
</
script
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
scoped
>
/* 您可以根据需要添加自定义样式 */
@media
screen
and
(
min-resolution
:
2dppx
)
{
/* 针对高分辨率显示屏的样式调整 */
.pieChart
{
height
:
30vh
;
/* 可能需要更大的高度 */
}
}
</
style
>
src/views/userPortrait/components/UserStats.vue
View file @
9a2f361
...
...
@@ -4,10 +4,7 @@
<div
class=
"avatar male"
></div>
<span>
男
</span>
<div
class=
"progress"
>
<div
class=
"fill male"
:style=
"
{ width: malePercentage==0? 50: malePercentage+ '%','min-width':'40%',
'max-width':'50%',
'margin-left':(30
<malePercentage
&&
malePercentage
< 50
?
malePercentage:0
<malePercentage
&&
malePercentage
<30
?
malePercentage
*
2
:
malePercentage
/
4
)
+
'%'
}"
>
{{
<div
class=
"fill male"
:style=
"styleObject"
>
{{
malePercentage
||
0
}}
%
</div>
...
...
@@ -42,6 +39,28 @@ export default {
}
},
computed
:
{
styleObject
()
{
// 基本的宽度样式
let
widthStyle
=
this
.
malePercentage
===
0
?
'50%'
:
`
${
this
.
malePercentage
}
%`
;
// 计算marginLeft
let
marginLeftStyle
;
if
(
this
.
malePercentage
>
30
&&
this
.
malePercentage
<
50
)
{
marginLeftStyle
=
`
${
this
.
malePercentage
}
%`
;
}
else
if
(
this
.
malePercentage
>
0
&&
this
.
malePercentage
<
30
)
{
marginLeftStyle
=
`
${
this
.
malePercentage
*
2
}
%`
;
}
else
{
marginLeftStyle
=
`
${
this
.
malePercentage
/
4
}
%`
;
}
// 返回样式对象
return
{
width
:
widthStyle
,
'min-width'
:
'40%'
,
'max-width'
:
'50%'
,
'margin-left'
:
marginLeftStyle
,
};
},
malePercentage
()
{
let
percentage
=
(
this
.
maleCount
/
(
this
.
maleCount
+
this
.
femaleCount
))
*
100
;
...
...
src/views/userPortrait/index.vue
View file @
9a2f361
...
...
@@ -19,13 +19,13 @@
<PieChart
:title=
"'车辆类型'"
:data=
"vehicleDistribution"
/>
<BarChart
:title=
"'甄选商品偏好(top10)'"
:data=
"productDistribution"
></BarChart>
<BarChart
:title=
"'攻略偏好(top10)'"
:data=
"
product
Distribution"
></BarChart>
<BarChart
:title=
"'权益购买偏好(top10)'"
:data=
"
product
Distribution"
></BarChart>
<BarChart
:title=
"'攻略偏好(top10)'"
:data=
"
strategy
Distribution"
></BarChart>
<BarChart
:title=
"'权益购买偏好(top10)'"
:data=
"
equity
Distribution"
></BarChart>
<LineChart
:title=
"'浏览时段偏好'"
:data=
"browseDistribution"
/>
<PieChart
:title=
"'客户购买转化阶段'"
:data=
"
vehicle
Distribution"
/>
<BarChart
:title=
"'客户全生命周期价值(LTV)'"
:data=
"
product
Distribution"
<PieChart
:title=
"'客户购买转化阶段'"
:data=
"
transform
Distribution"
/>
<BarChart
:title=
"'客户全生命周期价值(LTV)'"
:data=
"
ltv
Distribution"
:colors=
"[['#6E77FF', '#A1D9FF']]"
:rotate=
"0"
></BarChart>
</div>
...
...
@@ -65,6 +65,11 @@ export default {
browseDistribution
:
null
,
productDistribution
:
null
,
strategyDistribution
:
null
,
equityDistribution
:
null
,
transformDistribution
:
null
,
ltvDistribution
:
null
,
mockAgeColors
:
[
{
offset
:
0.02
,
color
:
'#BCCAFF'
},
{
offset
:
1
,
color
:
'#9F6EFF'
}],
...
...
@@ -82,7 +87,7 @@ export default {
methods
:
{
async
getUserPortraitData
()
{
// 44209572
const
merchantId
=
44209572
const
merchantId
=
this
.
$globalState
.
session
.
merchantId
// this.$globalState.session.merchantId
await
this
.
$apis
.
userPortrait
.
getPortraitData
({
merchantId
}).
then
(
res
=>
{
for
(
const
key
in
res
)
{
...
...
@@ -90,34 +95,6 @@ export default {
this
[
key
]
=
res
[
key
]
}
}
this
.
productDistribution
=
[{
name
:
"配件用品"
,
value
:
0
},
{
name
:
"商品3"
,
value
:
0
},
{
name
:
"化妆用品"
,
value
:
1
},
{
name
:
"划船20232"
,
value
:
1
},
{
name
:
"商品1"
,
value
:
0
},
{
name
:
"休闲零食"
,
value
:
1
},
{
name
:
"划船5"
,
value
:
0
},
{
name
:
"划船"
,
value
:
1
},
{
name
:
"日常用品"
,
value
:
3
}]
})
},
findSexCount
(
sex
)
{
...
...
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