ahyd_DIB/pages/commercialBI/components/guest/consumptionLevel.vue
2023-03-31 18:54:54 +08:00

167 lines
5.1 KiB
Vue

<template>
<div class="consumptionLevel">
<div class="gender" v-for="(item,index) in genderList" :key="index">
<div class="top">
<image class="icon" :src="item.name==='男'?'/static/images/commercial/man.svg':'/static/images/commercial/woman.svg'"></image>
<p class="title">{{item.name}}</p>
</div>
<div class="progress">
<div class="big" :style="{background:item.name==='男'?'#1E80FF':'#00C2FF', width:item.big+'%'}">{{item.big}}</div>
<div class="normal" :style="{background:item.name==='男'?'#ACB9CD':'#AFC1C6',width:item.normal + '%',left:item.big+'%'}">{{item.normal}}</div>
<div class="small" :style="{background:item.name==='男'?'#CAD0DA':'#C6D3D7',left:(Number(item.big)+Number(item.normal))+'%',width:item.small + '%'}">{{item.small}}</div>
</div>
<div class="imgKey">
<div style="margin: 0 auto;display: flex">
<div class="item">
<div class="icon" :style="{background:item.name==='男'?'#1E80FF':'#00C2FF'}"></div>
<p class="consume">高消费</p>
</div>
<div class="item">
<div class="icon" :style="{background:item.name==='男'?'#ACB9CD':'#AFC1C6'}"></div>
<p class="consume">普通消费</p>
</div>
<div class="item">
<div class="icon" :style="{background:item.name==='男'?'#CAD0DA':'#C6D3D7'}"></div>
<p class="consume">低消费</p>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "consumptionLevel",
data() {
return {
genderList:[]//数据
}
},
props: {
data: {
type: Array,
default: () => []
}
},
watch: {
data: {
handler(value) {
console.log('carDatawatch', value)
this.genderList = value
}
}
},
methods: {
}
}
</script>
<style scoped lang="scss">
.consumptionLevel{
width: 100%;
margin-top: 12px;
.gender{
width: 100%;
margin-bottom: 12px;
.top{
display: flex;
align-items: center;
.icon{
width: 16px;
height: 16px;
margin-right: 4px;
}
.title{
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #160002;
line-height: 20px;
}
}
.progress{
width: 100%;
height: 20px;
margin-top: 6px;
position: relative;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
.big{
display: flex;
align-items: center;
height: 100%;
position: absolute;
top: 0;
left: 0;
border-radius: 2px 0 0 2px;
box-sizing: border-box;
padding-left: 4px;
}
.big:after{
position: absolute;
content:'';
width: 2px;
height: 100%;
background: #FFFFFF;
z-index:9;
right: 0;
top: 0;
}
.normal{
display: flex;
align-items: center;
height: 100%;
position: absolute;
border-radius: 2px 0 0 2px;
box-sizing: border-box;
padding-left: 4px;
}
.normal:after{
position: absolute;
content:'';
width: 2px;
height: 100%;
background: #FFFFFF;
z-index:9;
right: 0;
top: 0;
}
.small{
display: flex;
align-items: center;
height: 100%;
position: absolute;
box-sizing: border-box;
padding-left: 4px;
border-radius: 2px 0 0 2px;
}
}
.imgKey{
display: flex;
margin-top: 8px;
.item{
display: flex;
align-items: center;
margin-right: 12px;
.icon{
width: 12px;
height: 12px;
border-radius: 2px;
margin-right: 4px;
}
.consume{
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #786B6C;
line-height: 18px;
}
}
}
}
}
</style>