GroupRanking.vue 4.36 KB
<template>
  <div class="group-wrap">
    <template v-if="tabIndex == 1">
      <template v-if="productionReportList && productionReportList.length > 0">
        <div class="group-inline flex" v-for="(i, index) in productionReportList" :key="i.id">
          <div :class="['group-type', index == 0 ? 'group-type-index' : '']">
            {{ index + 1 }}
            <template v-if="index == 0">
              <div class="sprite-icon icon-huangguan"></div>
            </template>
          </div>
          <div :class="['small-text', 'grouping-text', tabType.index == 1 ? 'rate' : '']">{{ i.merchantName }}</div>
          <div class="small-text gray">¥{{ i.newProductionValue }}</div>
          <template v-if="tabType.index == 1 && tabIndex == 0">
            <span class="ratio flex">
              <van-icon name="down" size="10px" :class="`${index == 1 ? 'up' : ''}`" />
              10%
            </span>
          </template>
        </div>
      </template>

      <template v-else>
        <Empty></Empty>
      </template>
    </template>
    <template v-else>
      <template v-if="tabType.index == 0 ? qyCustomerRatioMerchantTop&&qyCustomerRatioMerchantTop.length > 0 : qyTotalCountMerchantTop&&qyTotalCountMerchantTop.length > 0">
        <div class="group-inline flex" v-for="(c, index) in tabType.index == 0 ? qyCustomerRatioMerchantTop : qyTotalCountMerchantTop" :key="c.id">
          <div :class="['group-type', index == 0 ? 'group-type-index' : '']">
            {{ index + 1 }}
            <template v-if="index == 0">
              <div class="sprite-icon icon-huangguan"></div>
            </template>
          </div>
          <div :class="['small-text', 'grouping-text', tabType.index == 1 ? 'rate' : '']">{{ c.merchantName }}</div>
          <div class="small-text gray">{{ tabType.index == 0 ? c.qyCustomerRatio * 100 + '%' : c.newlyQyCount }}</div>
          <template v-if="tabType.index == 1">
            <span :class="['ratio', 'flex', c.newlyQyDegree <= 0 ? 'ycolor' : '']">
              <template v-if="c.newlyQyDegree != null">
                <template v-if="c.newlyQyDegree">
                  <div :class="['sprite-icon', c.newlyQyDegree > 0 ? 'icon-iconup' : 'icon-icondown']"></div>
                </template>
                {{ (c.newlyQyDegree * 100).toFixed(0) }}%
              </template>
              <template v-else>-</template>
            </span>
          </template>
        </div>
      </template>

      <template v-else>
        <Empty></Empty>
      </template>
    </template>
  </div>
</template>

<script>
import { mapState, mapGetters, mapActions } from 'vuex'
export default {
  name: 'GroupRanking',

  data() {
    return {
      data: []
    }
  },
  computed: {
    ...mapState({
      reportData: state => state.report.reportData,
      tabIndex: state => state.report.tabIndex,
      tabType: state => state.report.tabType,
      qyCustomerRatioMerchantTop: state => state.report.qyCustomerRatioMerchantTop, //企微客户占比
      productionReportList: state => state.report.productionReportList,
      qyTotalCountMerchantTop: state => state.report.qyTotalCountMerchantTop //企微客户数排行
    })
  },
  mounted() {
  
  },
  methods: {
    click(tabIndex) {
      this.tabIndex = tabIndex
      this.$emit('change', tabIndex)
    }
  }
}
</script>

<style lang='scss' scoped>
.group-wrap {
  height: auto;
  background-color: #fff;
  padding: 0 10px;

  .group-inline {
    border-bottom: 1px solid #e8e8f2;
    padding: 15px 0 19px 0;
    .group-type {
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background-color: #c9d7eb;
      font-size: 12px;
      font-weight: 500;
      color: #333333;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .group-type-index {
      background-color: #3975c6;
      color: #fff;
      position: relative;
      .icon-huangguan {
        position: absolute;
        top: -6px;
        right: -9px;
      }
    }
    .grouping-text {
      width: 196px;
      word-wrap: break-word;
      margin: 0 32px 0 8px;
      height: auto;
      color: #333333;
    }
    .rate {
      margin: 0 32px 0 8px !important;
      width: 148px !important;
    }
    .ratio {
      font-size: 12px;
      color: #3975c6;
      margin-left: 32px;
      & .up {
        transform: rotate(180deg);
      }
     
    }
     .ycolor {

        color: #df8500!important;
      }
  }
}
</style>