Project.vue 3.82 KB
<!--
 * @Author: 前端 qianduan01@didihu.com.cn
 * @Date: 2022-10-25 10:12:26
 * @LastEditors: huyue
 * @LastEditTime: 2023-08-22 17:18:53
 * @FilePath: \dj-data-view\src\views\saas\project.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="project-wrap flex">
    <div class="project-item flex" v-for="(item, index) in projectList" :key="index">
      <div class="project-left">
        <div :class="['project-title', { fontSmall: index == 3 }]">{{ item.name }}</div>
        <div class="project-icon"><img src="@/assets/images/arrow.png" alt="" /></div>
      </div>
      <div class="project-right flex">
        <div class="project-content-item">
          <div class="project-content-desc">展业门店数</div>
          <div class="project-content-num">{{ item.totalNum }}</div>
        </div>
        <div class="project-content-item">
          <div class="project-content-desc">当年新增</div>
          <div class="project-content-num">{{ item.incrNum }}</div>
        </div>
        <div class="project-content-item">
          <div class="project-content-desc">转化率</div>
          <div class="project-content-num">{{ toFixRatio(item.conversionrate) }}</div>
        </div>
        <div class="project-content-item">
          <div class="project-content-desc">客单价</div>
          <div class="project-content-num">{{ toFixNum(item.atv) }}</div>
        </div>
        <div class="project-content-item">
          <div class="project-content-desc">GMV</div>
          <div class="project-content-num">{{ numAddSymbol(item.outputValue) }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Project',
  data() {
    return {
      projectList: [{}, {}, {}, {}]
    }
  },
  mounted() {
    this.getBusinessType()
  },
  methods: {
    toFixRatio(val) {
      return (val * 100).toFixed(2) + '%'
    },
    toFixNum(val) {
      return this.numAddSymbol(Math.round(val))
    },
    getBusinessType() {
      this.api.operational.getBusinessType().then(res => {
        if (res.code == 0) {
          this.projectList = res.data.dataList
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.project-wrap {
  margin: 0.98vh 0.83vw 0;
  height: 11.71vh;
  flex-wrap: wrap;
  justify-content: space-between;
  .project-item {
    width: 49.6%;
    background: #071735;
    .project-left {
      width: 2.8vw;
      padding: 0px 0.4vw;
      height: 5.61vh;
      background-image: linear-gradient(270deg, #6578FF 0%, #079FF1 100%);
      text-align: center;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      .project-title {
        color: #e8e8e8;
        font-size: 10px;
        line-height: 12px;
        margin-top: 0.4vh;
        // &.fontSmall {
        //   font-size: 9px;
        // }
      }
      .project-icon {
        width: 0.83vw;
        height: 0.98vh;
        margin: 0 auto;
        margin-top: 0.24vh;
      }
    }
    .project-right {
      flex: 1;
      .project-content-item {
        &:first-child {
          width: 22%;
        }
        &:nth-child(2) {
          width: 16%;
        }
        &:nth-child(3) {
          width: 16%;
        }
        &:nth-child(4) {
          width: 17%;
        }
        &:nth-child(5) {
          width: 28%;
        }
        padding-left: 0.5vw;
        .project-content-desc {
          font-size: 9px;
          color: #dddddd;
        }
        .project-content-num {
          font-weight: 700;
          font-size: 12px;
          color: #ffffff;
        }
      }
    }
  }
}
</style>