282 lines
9.5 KiB
Vue
282 lines
9.5 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" v-if="Number(item.small)!==0" :style="{background:item.name==='男性'?'#CAD0DA':'#C6D3D7',width:item.small + '%'}" @click="handleShow(item,index,0)">{{item.small<16?'':item.small + '%'}}
|
|
<div class="text" v-if="item.showList[0]">
|
|
<div class="icon" :style="{background:item.name==='男性'?'#CAD0DA':'#C6D3D7'}"></div>
|
|
<text style="margin-right: 4px">低消费</text>
|
|
<text>{{item.small}}%</text>
|
|
</div>
|
|
</div>
|
|
<div class="normal" v-if="Number(item.normal)!==0" :style="{background:item.name==='男性'?'#ACB9CD':'#AFC1C6',width:item.normal + '%',left:item.small+'%'}" @click="handleShow(item,index,1)">{{item.normal<16?'':item.normal+'%'}}
|
|
<div class="text" v-if="item.showList[1]">
|
|
<div class="icon" :style="{background:item.name==='男性'?'#ACB9CD':'#AFC1C6'}"></div>
|
|
<text style="margin-right: 4px">普通消费</text>
|
|
<text>{{item.normal}}%</text>
|
|
</div>
|
|
</div>
|
|
<div class="big" v-if="Number(item.big)!==0" :style="{background:item.name==='男性'?'#1E80FF':'#00C2FF',left:(Number(item.small)+Number(item.normal))+'%', width:item.big+'%'}" @click="handleShow(item,index,2)">{{item.big<16?'':item.big + '%'}}
|
|
<div class="text" v-if="item.showList[2]">
|
|
<div class="icon" :style="{background:item.name==='男性'?'#1E80FF':'#00C2FF'}"></div>
|
|
<text style="margin-right: 4px">高消费</text>
|
|
<text>{{item.big}}%</text>
|
|
</div>
|
|
</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:[],//数据
|
|
list:[{name:'man',list:[false,false,false]},{name:'woman',list:[false,false,false]}],
|
|
}
|
|
},
|
|
props: {
|
|
data: {
|
|
type: Array,
|
|
default: () => []
|
|
}
|
|
},
|
|
watch: {
|
|
data: {
|
|
handler(value) {
|
|
this.genderList = value
|
|
this.genderList.forEach(item=>{
|
|
item.showList = [false,false,false]
|
|
})
|
|
},
|
|
immediate: true
|
|
}
|
|
},
|
|
methods: {
|
|
handleShow(item,index,number){
|
|
if (index === 0){
|
|
//男
|
|
let list = []
|
|
this.genderList[0].showList.forEach(()=>{
|
|
list.push(false)
|
|
})
|
|
this.genderList[0].showList = list
|
|
this.genderList[0].showList[number] = true
|
|
}else if(index === 1){
|
|
//女
|
|
let list = []
|
|
this.genderList[1].showList.forEach(()=>{
|
|
list.push(false)
|
|
})
|
|
this.genderList[1].showList = list
|
|
this.genderList[1].showList[number] = true
|
|
}
|
|
this.$forceUpdate()
|
|
}
|
|
}
|
|
}
|
|
</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;
|
|
.text{
|
|
position: absolute;
|
|
padding: 0 5px;
|
|
z-index: 9;
|
|
left: 50px;top: -25px;
|
|
background: rgba(0,0,0,0.6);
|
|
color:#fff;
|
|
border-radius: 2px;
|
|
display: flex;
|
|
align-items: center;
|
|
.icon{
|
|
width: 10px;
|
|
height: 10px;
|
|
background: #1E80FF;
|
|
margin-right: 4px;
|
|
}
|
|
}
|
|
.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;
|
|
.text{
|
|
width: 120px;
|
|
height: 26px;
|
|
position: absolute;
|
|
z-index: 9;
|
|
left: 0;top: 0;
|
|
transform: translateX(-100%);
|
|
background: rgba(0,0,0,0.6);
|
|
color:#fff;
|
|
border-radius: 2px;
|
|
display: flex;
|
|
align-items: center;
|
|
.icon{
|
|
width: 10px;
|
|
height: 10px;
|
|
margin-right: 4px;
|
|
}
|
|
}
|
|
}
|
|
.normal{
|
|
display: flex;
|
|
align-items: center;
|
|
height: 100%;
|
|
position: absolute;
|
|
box-sizing: border-box;
|
|
padding-left: 4px;
|
|
.text{
|
|
width: 130px;
|
|
height: 26px;
|
|
position: absolute;
|
|
z-index: 9;
|
|
left: 0;top: 0;
|
|
transform: translateX(-100%);
|
|
background: rgba(0,0,0,0.6);
|
|
color:#fff;
|
|
border-radius: 2px;
|
|
display: flex;
|
|
align-items: center;
|
|
.icon{
|
|
width: 10px;
|
|
height: 10px;
|
|
background: #1E80FF;
|
|
margin-right: 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;
|
|
.text{
|
|
position: absolute;
|
|
width: 130px;
|
|
height: 26px;
|
|
z-index: 9;
|
|
left: 50px;top: -25px;
|
|
background: rgba(0,0,0,0.6);
|
|
color:#fff;
|
|
border-radius: 2px;
|
|
display: flex;
|
|
align-items: center;
|
|
.icon{
|
|
width: 10px;
|
|
height: 10px;
|
|
background: #1E80FF;
|
|
margin-right: 4px;
|
|
}
|
|
}
|
|
}
|
|
.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>
|