performanceStatus.vue 2.68 KB
<!-- 业绩状况 -->
<template>
  <div class="performance-status">
    <div class="header">业绩状况(延保)</div>
    <div class="tabs">
      <div
        :class="{
          'tabs-item': true,
          'tabs-item-active': index === activeIndex
        }"
        v-for="(item, index) in timeData"
        :key="index"
        @click="handleClick(index)"
      >
        {{ item.text }}
      </div>
    </div>
    <div class="content">
      <!-- 产值 -->
      <div class="content-item">
        <div class="title">个人产值(元)</div>
        <echart-bar
          class="echart"
          id="production"
          :xData="xData"
          :yData="yData"
        ></echart-bar>
      </div>
      <div class="content-item">
        <div class="title">转化率(%)</div>
        <echart-line
          class="echart"
          id="production"
          :xData="xData"
          :yData="yData"
        ></echart-line>
      </div>
      <div class="content-item">
        <div class="title">客单价(元)</div>
        <echart-bar
          class="echart"
          id="production"
          :xData="xData"
          :yData="yData"
        ></echart-bar>
      </div>
    </div>
  </div>
</template>
<script>
import EchartLine from "./echartLine"
import EchartBar from "./echartBar"
export default {
  components: {
    EchartLine,
    EchartBar
  },

  name: "performanceStatus",
  data() {
    return {
      xData: ["2021-01-01", "2021-01-02", "2021-01-03", "2021-01-04"],
      yData: [15600, 24897, 24897, 18350],
      activeIndex: 0,
      timeData: [
        {
          text: "近4周",
          value: 1
        },
        {
          text: "近4月",
          value: 2
        }
      ]
    }
  },
  methods: {
    handleClick(index) {
      this.activeIndex = index
    }
  }
}
</script>
<style scoped lang="scss">
.performance-status {
  .header {
    color: #111111;
    font-size: 16px;
    font-weight: 500;
    padding: 14px 20px;
    border-bottom: 1px solid #e5e5e5;
  }
  .tabs {
    margin: 12px 0 16px 20px;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 2px;
    .tabs-item {
      padding: 6px 20px;
      cursor: pointer;
      font-size: 12px;
      font-weight: 400;
      color: #1d1d1d;
      border: 1px solid #dbdbdb;
    }
    .tabs-item-active {
      color: #ffffff;
      background: #2a58ad;
    }
  }
  .content {
    margin: 20px;
    display: flex;
    height: 238px;
    width: 100%;
    .content-item {
      flex: 1;
      .echart {
        width: 100%;
        height: 100%;;
      }
      .title {
        color: #333333;
        font-size: 14px;
        font-weight: 400;
        margin-bottom: 12px;
      }
    }
  }
}
</style>