<template>
    <div class="header" :style="{backgroundImage: 'url('+ bgUrl +')'}">
        <div class="headerTop" :style="{height:(menu.bottom + 6) + 'px',background:topBg}">
            <div class="box" :style="{top:(menu.bottom - (menu.height / 2)) + 'px'}">
                <div class="icon" @click="handleBack">
                    <image class="img" src="/static/images/commercial/navigation-left.svg"></image>
                </div>
                <text class="title">{{title}}</text>
                <div class="seize"></div>
            </div>
        </div>
        <div class="serviceArea" :style="{top : (menu.bottom + 14) + 'px'}">
            <picker class="picker"  @change="bindPickerChange" :value="serviceIndex" :range="serviceArray">
                <div class="selectService">
                    <image class="img" src="/static/images/commercial/fixed.svg"></image>
                    <view class="select">
                        <view class="content">
                            <view class="uni-input">{{serviceArray[serviceIndex]}}</view>
                            <text class="area">{{area}}</text>
                            <image class="rightArrow" src="/static/images/commercial/rightArrow.svg"></image>
                        </view>
                    </view>
                </div>
            </picker>
            <div class="label">
                <div :class="index===0?'labelItem labelItem0':index===1?'labelItem labelItem1':index===2?'labelItem labelItem2':index===3?'labelItem labelItem3':
                index===4?'labelItem labelItem4':index===5?'labelItem labelItem5':''" v-for="(item,index) in labelList" :key="index"
                :style="{background: 'linear-gradient('+bgColor+')'}"
                >{{ item }}</div>
            </div>
        </div>
        <div class="analyse">
            <text class="title">分析</text>
            <text class="content">新桥服务区入区车辆主要来自杭州市, 入车车辆主要是普通车型(30-60万)</text>
        </div>
    </div>
</template>

<script>

export default {
    name: "headerTop",
    props:{
      menu:{
          type: Object,
          default: ()=>{}
      },
      bgUrl:{
          type:String,
          default: ""
      },
      bgColor:{
          type:String,
          default: ""
      },
      title:{
          type:String,
          default: ""
      },
      labelList:{
          type:Array,
          default:()=>[]
      },
      topBg:{
          type:String,
          default: ""
      }
    },
    data() {
        return {

        }
    },
    onLoad(){

    },
    methods:{
        bindPickerChange(){

        },
        //返回上一级
        handleBack(){
            uni.navigateBack({
                delta: 1
            })
        }
    }
}
</script>

<style scoped lang="scss">
.header{
  width: 100%;
  height: calc(1.056 * 100vw);
  box-sizing: border-box;
  position: relative;
  padding: 0 16px;
  background-repeat: no-repeat;
  background-size: cover;
  .headerTop{
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    z-index:99999;
    .box{
      padding: 0 16px;
      position: absolute;
      box-sizing: border-box;
      width: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      transform: translateY(-50%);
      .icon{
        width: 24px;
        height: 24px;
        .img{
          width: 100%;
          height: 100%;
        }
      }
      .title{
        font-size: 36rpx;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 600;
        color: #1C2130;
        line-height: 56rpx;
      }
      .seize{
        width: 24px;
        height: 24px;
      }
    }
  }
  .serviceArea{
    width: calc(100% - 32px);
    position: absolute;
    box-sizing: border-box;
    .picker{
        .selectService{
            display: flex;
            align-items: center;
            display: flex;
            .img{
                  width: 40px;
                  height: 40px;
                  z-index: 2;
              }
            .select{
                  width: 174px;
                  height: 32px;
                  background: #F8F8FA;
                  border-radius: 0 16px 16px 0;
                  transform: translateX(-20px);
                  box-sizing: border-box;
                  padding-left: 25px;
                  display: flex;
                  align-items: center;
                  position: relative;
                  .content{
                      display: flex;
                      align-items: center;
                      .uni-input{
                          padding: 0;
                          background: transparent;
                          font-size: 14px;
                          font-family: PingFangSC-Semibold, PingFang SC;
                          font-weight: 600;
                          color: #160002;
                          height: 40px;
                          line-height: 40px;
                      }
                      .area{
                          font-size: 14px;
                          font-family: PingFangSC-Regular, PingFang SC;
                          font-weight: 400;
                          color: #786B6C;
                          line-height: 40px;
                          margin-left: 4px;
                      }
                      .rightArrow{
                          width: 24px;
                          height: 12px;
                          position: absolute;
                          right: 11px;
                      }
                  }

              }
        }
    }
    .label{
        width: calc(60% + 20px);
        height: 127px;
        position: relative;
        margin-top: 44px;
        .labelItem{
            position: absolute;
            font-size: 16px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #FFFFFF;
            line-height: 22px;
            border-radius: 4px 4px 0 4px;
            padding: 4px 12px;
        }
        .labelItem0{
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            z-index:9;
        }
        .labelItem1{
            top: 30%;
            left: 5%;
            z-index:8;
            opacity: 0.8;
        }
        .labelItem2{
            right: 0;
            top: 30%;
            opacity: 0.7;
        }
        .labelItem3{
            top: 10%;
            left: 50%;
            transform: translateX(-50%);
            opacity: 0.6;
        }
        .labelItem4{
            bottom: 20%;
            left: 10%;
            opacity: 0.5;
        }
        .labelItem5{
            bottom: 20%;
            right: 20%;
            opacity: 0.4;
        }
    }
  }
  .analyse{
        position: absolute;
        bottom: 16px;
        width: calc(100vw - 32px);
        height: 48px;
        box-sizing: border-box;
        padding: 6px 12px;
        background: #fff;
        border-radius: 4px;
        display: flex;
        .title{
            width: 28px;
            height: 18px;
            font-size: 12px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #160002;
            line-height: 18px;
            padding: 0 4px;
            text-align: center;
            border-radius: 4px;
            background:rgba(6, 93, 255, 0.1);
        }
        .content{
            width: calc(100% - 46px);
            padding-left: 6px;
            font-size: 12px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #786B6C;
            line-height: 18px;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            overflow: hidden;
            -webkit-line-clamp: 2;
        }
    }

}
</style>