Business.vue 3.31 KB
<!--
 * @Author: 前端 qianduan01@didihu.com.cn
 * @Date: 2022-10-25 10:12:26
 * @LastEditors: huyue
 * @LastEditTime: 2023-08-28 10:37:35
 * @FilePath: \dj-data-view\src\views\saas\business.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="business-wrap flex">
    <div class="business-data">
      <!-- <business-view :businessNum="businessNum"></business-view> -->
      <StatisticsBox class="business-box" :list="list.slice(0,3)"></StatisticsBox>
      <StatisticsBox class="business-box second-box" :list="list.slice(3,5)"></StatisticsBox>
    </div>
    <div class="business-category">
      <Category :categoryData="categoryData"></Category>
    </div>
  </div>
</template>

<script>
import Category from './Category'
export default {
  components: {
    Category
  },
  name: 'Business',
  data() {
    return {
      categoryData: [],
      list: [
        {
          name: '累计展业门店数',
          valueName: 'totalNum',
          value: 0
        },
        {
          name: '当年新增门店数',
          valueName: 'increnum',
          value: 0
        },
        {
          name: '客单价',
          valueName: 'atv',
          value: 0
        },
        {
          name: '当月产值',
          valueName: 'outputValuethismonth',
          value: 0
        },
        {
          name: '当年产值',
          valueName: 'outputValuethisyear',
          value: 0
        }
      ]
    }
  },
  created() {
    this.getSaasValueaddedTransformationOverview()
  },
  methods: {
    toFixNum(val) {
      return (val * 100).toFixed(2) + '%'
    },
    getSaasValueaddedTransformationOverview() {
      this.api.operational.getSaasValueaddedTransformationOverview().then(res => {
        if (res.code === '0') {
          const _data = res.data.dataList[0]
          this.list.forEach(item => {
            item.value = _data[item.valueName]
          })
          this.categoryData = [
            {
              name: '精品类',
              value: _data.equity
            },
            {
              name: '权益类',
              value: _data.membrane
            },
            {
              name: '续保类',
              value: _data.electronics
            }
          ]
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.business-wrap {
  height: 14.15vh;
  margin: 0.98vh 0.83vw;
  // margin-bottom: 0.98vh;
  // margin-top: 0.98vh;
  justify-content: space-between;
  .business-data {
    margin-right: 4px;
    // margin-top: 0.98vh;
    width: 38.06vw;
    height: 100%;
    /deep/{
      .business-box.statistics {
        height: 6.83vh;
        box-sizing: border-box;
        .statistics-item {
          margin-right: 0.28vw;
          .statistics-top {
            .statistics-name {
              margin-bottom: 0;
              font-size: 12px;
            }
            .statistics-price-number {
              font-size: 24px;
            }
          }
        }
      }
    }
    .second-box {
      margin-top: 0.29vh;
    }
  }
  .business-category {
    width: 13.89vw;
    height: 100%;
  }
}
</style>