ahyd_DIB/pages/commercialBI/components/guest/consumptionLevel.vue
2023-04-06 20:20:00 +08:00

170 lines
5.2 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==='男'?'https://eshangtech.com/ShopICO/ahyd-BID/commercial/man.svg':'https://eshangtech.com/ShopICO/ahyd-BID/commercial/woman.svg'"></image>
<p class="title">{{item.name}}</p>
</div>
<div class="progress">
<div class="small" :style="{background:item.name==='男'?'#CAD0DA':'#C6D3D7',width:item.small + '%'}">{{item.small<16?'':item.small + '%'}}</div>
<div class="normal" :style="{background:item.name==='男'?'#ACB9CD':'#AFC1C6',width:item.normal + '%',left:item.small+'%'}">{{item.normal<16?'':item.normal+'%'}}</div>
<div class="big" :style="{background:item.name==='男'?'#1E80FF':'#00C2FF',left:(Number(item.small)+Number(item.normal))+'%', width:item.big+'%'}">{{item.big<16?'':item.big + '%'}}</div>
</div>
<div class="imgKey">
<div style="margin: 0 auto;display: flex">
<div class="item">
<div class="icon" :style="{background:item.name==='男'?'#CAD0DA':'#C6D3D7'}"></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==='男'?'#1E80FF':'#00C2FF'}"></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('value',value)
this.genderList = value
},
immediate: true
}
},
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:0 2px 2px 0;
box-sizing: border-box;
padding-left: 4px;
}
.normal{
display: flex;
align-items: center;
height: 100%;
position: absolute;
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;
}
.small:after{
position: absolute;
content:'';
width: 2px;
height: 100%;
background: #FFFFFF;
z-index:9;
right: 0;
top: 0;
}
}
.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>