Commit 9a2f3616 by 前端

客户画像2.0

1 parent c89e93cb
<template>
<div>
<p class="line-color-title">{{title}}</p>
<div v-if="data" ref="pieChart" style="margin-top:10px;width: 100%; height:22vh;"></div>
<div v-if="data" ref="pieChart" style="margin-top:10px;width: 100%; height:25vh;"></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>
......@@ -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;
......
......@@ -19,13 +19,13 @@
<PieChart :title="'车辆类型'" :data="vehicleDistribution"/>
<BarChart :title="'甄选商品偏好(top10)'" :data="productDistribution"></BarChart>
<BarChart :title="'攻略偏好(top10)'" :data="productDistribution"></BarChart>
<BarChart :title="'权益购买偏好(top10)'" :data="productDistribution"></BarChart>
<BarChart :title="'攻略偏好(top10)'" :data="strategyDistribution"></BarChart>
<BarChart :title="'权益购买偏好(top10)'" :data="equityDistribution"></BarChart>
<LineChart :title="'浏览时段偏好'" :data="browseDistribution"/>
<PieChart :title="'客户购买转化阶段'" :data="vehicleDistribution"/>
<BarChart :title="'客户全生命周期价值(LTV)'" :data="productDistribution"
<PieChart :title="'客户购买转化阶段'" :data="transformDistribution"/>
<BarChart :title="'客户全生命周期价值(LTV)'" :data="ltvDistribution"
: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) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!