MerchantsPropotion.vue 3.16 KB
<template>
  <div class="propotion-box flex">
    <div class="propotion-box-left">
      <box-title title="商城采购商品占比"></box-title>
      <RightViewContent
        v-if="shopmallData.length"
        class="content-box"
        :chart="shopmallChart"
        :listData="shopmallData"
        :legentList="shopmallLegend"
        :legendColors="shopmallChart.colors"
      ></RightViewContent>
      <div v-else class="empty">
        <Empty></Empty>
      </div>
    </div>
    <div class="propotion-box-right">
      <box-title title="自采商品占比"></box-title>
      <RightViewContent
        v-if="selfPickData.length"
        class="content-box"
        :chart="selfPickChart"
        :listData="selfPickData"
        :legentList="selfPickLegend"
        :legendColors="selfPickChart.colors"
      ></RightViewContent>
      <div v-else class="empty">
        <Empty></Empty>
      </div>
    </div>
  </div>
</template>

<script>
import RightViewContent from '../solar/RightViewContent.vue'
export default {
  name: 'MerchantsPropotion',
  components: {
    RightViewContent
  },
  props: {
    shopmallData: {
      type: Array,
      default: () => []
    },
    selfPickData: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      // 商城采购饼图结构
      shopmallChart: {
        id: 'shopmall',
        keys: ['goodsname', 'purchaseamount'],
        height: '18vh',
        colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001'],
        formatter: 'price'
      },
      shopmallLegend: [
        {
          name: 'goodsname',
          width: '15.28vw'
        },
        {
          name: 'rate',
          type: 'decimal',
          width: '3vw'
        },
        // {
        //   name: 'purchaseamount',
        //   hasIcon: '¥',
        //   type: 'number',
        //   width: '5vw'
        // },
        // {
        //   name: 'averprice',
        //   hasIcon: '均价¥',
        //   type: 'number',
        //   width: '5vw'
        // }
      ],
      // 自采饼图结构
      selfPickChart: {
        id: 'selfPick',
        keys: ['goodsname', 'purchaseamount'],
        height: '18vh',
        colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001'],
        formatter: 'price'
      },
      selfPickLegend: [
        {
          name: 'goodsname',
          width: '15.28vw'
        },
        {
          name: 'rate',
          type: 'decimal',
          width: '3vw'
        },
        // {
        //   name: 'purchaseamount',
        //   hasIcon: '¥',
        //   type: 'number',
        //   width: '5vw'
        // },
        // {
        //   name: 'averprice',
        //   hasIcon: '均价¥',
        //   type: 'number',
        //   width: '5vw'
        // }
      ]
    }
  },

  mounted() {},

  methods: {}
}
</script>

<style lang="scss" scoped>
.propotion-box {
  justify-content: space-between;
  margin-top: 1.78vh;
  &-left,
  &-right {
    width: 31.46vw;
    height: 31.56vh;
    box-shadow: inset 0 0 20px 0 #3d57ff69;
  }
  .content-box {
    padding: 3.78vh 1.78vw 4.44vh 1.78vw;
  }
  .empty {
    height: 22vh;
    display: flex;
    align-items: center;
  }
}
</style>