<template>
  <div class="percent-card">
    <div class="card-chart">
      <div class="card-title gray">{{ title }}</div>
      <percent-bar width="64px" height="64px" :value="percent" :color="color" />
    </div>
    <div class="card-info">
      <div class="card-value">
        <span class="value-text gray">{{ TotalText }}</span>
        <span class="white font-num">{{ TotalValue }}</span>
      </div>
      <div class="card-value">
        <span class="value-text gray">{{ ActualText }}</span>
        <span class="white font-num">{{ ActualValue }}</span>
      </div>
    </div>
  </div>
</template>

<script>
// 百分比card2
// 使用位置 驾驶舱首页 计划电量完成情况 中的百分比卡片
import PercentBar from "../../chart/bar/percent-bar-3.vue";
export default {
  components: {
    PercentBar,
  },
  props: {
    title: {
      type: String,
      default: "月计划完成率",
    },
    TotalText: {
      type: String,
      default: "实际",
    },
    TotalValue: {
      type: Number,
      default: 100,
    },
    ActualText: {
      type: String,
      default: "计划",
    },
    ActualValue: {
      type: Number,
      default: 25,
    },
    color: {
      type: String,
      default: "green",
    },
  },
  computed: {
    percent() {
      return (this.ActualValue / this.TotalValue) * 100;
    },
  },
};
</script>

<style lang="less" scoped>
.percent-card {
  display: flex;

  .card-chart {
    display: flex;
    align-items: center;
  }

  .card-title {
    text-align: center;
    width: 100%;
    font-size: 12px;
    color: #ffffff;
  }

  .card-info {
    margin: 0 0.741vh;

    .card-value {
      font-size: @fontsize-s;
      font-weight: 400;
      margin-top: 1.1111vh;

      .value-text {
        margin-right: 0.741vh;
        font-family: @font-family-num;
      }
    }

    .card-text {
      font-size: @fontsize;
    }
  }
}
</style>
