<template>
  <div class="txtSize">
    <div class="title">
      <span style="margin-bottom:20px;">竞价情况</span>
      <!-- <span style="width"></span> -->
      <div style="display: flex">
        <span style="width: 100px">
          <el-select v-model="region" size="mini">
            <el-option label="不限部门" value="1"></el-option>
            <el-option label="网络部" value="2"></el-option>
          </el-select>
        </span>
        <span style="width: 60px">
          <el-select v-model="region1" size="mini">
            <el-option label="日" value="1"></el-option>
            <el-option label="月" value="2"></el-option>
            <el-option label="年" value="3"></el-option>
          </el-select>
        </span>
        <span style="width: 140px">

          <el-date-picker
            style="width:100%"
            size="mini"
            :clearable="false"
            v-model="region2"
            :type="region1 == 1 ? 'date' : region1 == 2 ? 'month' : 'year'"
            placeholder="选择日期">
          </el-date-picker>
        </span>
      </div>
    </div>

    <!-- <div id="bottomCenter" style="width: auto; height: 300px"></div> -->

    <!-- <div id="bottomCenterCon" style="width: auto; height: 300px; top:-80px"></div> -->
    <!-- <bottomCenterCon></bottomCenterCon> -->

    <Echart
      :options="options"
      id="bottomCenter"
      height="300px"
      width="100%"
    ></Echart>
  
    <Echart
      :options="optionsPie"
      id="bottomCenterCon"
      height="300px"
      width="100%"
    ></Echart>
  </div>
</template>

<script>
import Echart from "@/common/echart";


export default {
  components: {
    Echart,
  },
  props: {
    cdata: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      region: "1",
      region1: "1",
      region2: "1",
      options: {
        // title: {
        //   text: "Funnel",
        // },
        tooltip: {
          trigger: "item",
          formatter: "{b} : {c}",
        },
        legend: {
          data: ["竞价单数", "已反馈单数", "生成订单"],
        },
        series: [
          {
            name: "Funnel",
            type: "funnel",
            left: "10%",
            top: 60,
            bottom: 60,
            width: "80%",
            min: 0,
            max: 100,
            minSize: "30%",
            maxSize: "100%",
            sort: "descending",
            gap: 2,
            label: {
              show: true,
              position: "inside",
              formatter:((params)=>{
                //返回值对大数额做处理
               return `${params.data.name} : ${this.$options.filters['getNum_noPrice'](params.data.value) }`
              })
            },
            labelLine: {
              length: 10,
              lineStyle: {
                width: 1,
                type: "solid",
              },
            },
            itemStyle: {
              borderColor: "#fff",
              borderWidth: 1,
            },
            // emphasis: {
            //   label: {
            //     fontSize: 20,
            //   },
            // },
            data: [
              { value: 456760, name: "生成订单" },
              { value: 8880, name: "已反馈单数" },
              { value: 100, name: "竞价单数" },
            ],
          },
        ],
      },


      optionsPie: {
  tooltip: {
    trigger: 'item'
  },
  legend: {
    // top: '50%',
    bottom: '1%'
  },
   title: {
          text: `空反：\n总单数\n${1111}`,
          fontWeight:"normal",
          fontSize:14,
          lineHeight: 26,
          left:'40%',
          top:"40%",
        },
  series: [
    {
      name: '空反',
      type: 'pie',
      radius: ['40%', '70%'],
      avoidLabelOverlap: false,
      label: {
        show: true,
        position: 'inner',
        formatter:((params)=>{
                //返回值对大数额做处理
               return `${this.$options.filters['getNum_noPrice'](params.data.value) }`
              })
      },
   
      labelLine: {
        show: false
      },
      data: [
        { value: 1048, name: '进行中' },
        { value: 735, name: '已结束' },
      ]
    }
  ]
}
    };
  },
  mounted() {
    // this.cinit();
  },
  methods: {
    cinit() {
      this.$echarts
        .init(document.getElementById("bottomCenter"))
        .setOption(this.options);

    
        this.$echarts
        .init(document.getElementById("bottomCenterCon"))
        .setOption(this.optionsPie);
    },
  },
};
</script>

<style lang="scss" scoped>
.txtSize {
  // font-size: 0px;
  position: relative;
  top: -270px;
}
.title {
  font-size: 18px;
  margin: 20px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}
#bottomCenterCon{
  position: relative;
  top:0px;
}
</style>