<template>
    <div class="bandLevel">
        <div class="bandItem" v-for="(item,index) in dataList" :key="index">
            <p class="title">{{item.name}}</p>
            <div class="progress">
                <div class="big" :style="{width:item.big+'%'}">{{item.big}}</div>
                <div class="normal" :style="{width:item.normal + '%',left:item.big+'%'}">{{item.normal}}</div>
                <div class="small" :style="{width:item.small + '%',left:(Number(item.big)+Number(item.normal))+'%'}">{{item.small}}</div>
            </div>
        </div>
        <div class="key">
            <div class="box">
                <div class="keyItem">
                    <div class="icon" style="background: #1E80FF"></div>
                    <p class="type">高消费</p>
                </div>
                <div class="keyItem">
                    <div class="icon" style="background: #ACB9CD"></div>
                    <p class="type">普通消费</p>
                </div>
                <div class="keyItem">
                    <div class="icon" style="background: #CAD0DA"></div>
                    <p class="type">低消费</p>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
var uChartsInstance = {};
export default {
    name: "bandLevel",
    data() {
        return {
            dataList: []
        }
    },
    props: {
        data: {
            type: Array,
            default: () => []
        }
    },
    watch: {
        data: {
            handler(value) {
                console.log('carDatawatch', value)
                this.dataList = value
            }
        }
    },
    methods: {

    }
}
</script>

<style scoped lang="scss">
.bandLevel{
    width: 100%;
    margin-top: 12px;
    .bandItem{
        margin-bottom: 12px;
        .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;
                background: #1E80FF;
            }
            .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;
                background: #ACB9CD;
            }
            .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;
                background: #CAD0DA;
            }
        }
    }
    .key{
        display: flex;
        width: 100%;
        .box{
            display: flex;
            margin: 0 auto;
            .keyItem{
                display: flex;
                align-items: center;
                margin-right: 12px;
                .icon{
                    width: 12px;
                    height: 12px;
                    border-radius: 2px;
                    margin-right: 4px;
                }
                .type{
                    font-size: 12px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #786B6C;
                    line-height: 18px;
                }
            }
        }
    }
}
</style>