resultList.vue 5.38 KB
<template>
  <div class="marketing">
    <div class="container">
      <div class="sop-title">SOP名称:{{ list.sopName }}</div>
      <div class="funnel-box">
        <div class="funnel-bg">
          <img class="funnel-img" src="@/assets/sop/funel.png"/>

        </div>
        <div class="funnel-content">
          <div class="left">
            <div v-for="(item,index) in numList" :key="index">
              {{ item.title }}
              <span class="left-num">{{ list[item.num] || 0 }}</span>
            </div>
          </div>
          <div class="right">
            <div class="sort-box" v-for="(item,index) in sortList" :key="index">
              <div class="sort-title">{{ item.title }}</div>
              <div class="sort">{{ rates[item.sort] ? rates[item.sort] : 0 }}%</div>
            </div>
          </div>
        </div>
      </div>
      <div class="text-box">
        <div class="box-left">
          <p>营销客户:当前sop已营销的客户,即全部营销事件的营销客户汇总</p>
          <p>触达客户:当前sop已营销且已触达的客户,即全部营销事件的触达客户汇总</p>
          <p>潜在客户:在营销客户中,客户意向标签为“潜在客户”的客户汇总</p>
          <p> 下单客户:在营销客户中,客户意向标签为“下单客户”的客户汇总,即客户产生业务订单</p>
        </div>
        <div class="box-line"></div>
        <div class="box-right">
          <p>触达率:(触达客户数量/营销客户数量)*100%</p>
          <p>转化率:(潜在客户数量/触达客户数量)*100%</p>
          <p>成单率:(下单客户数量/潜在客户数量)*100%</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {

  name: "resultList",
  props: {
    sopId: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      numList: [
        {title: '营销客户', num: 'marketingCustomerCount'},
        {title: '触达客户', num: 'reachCustomerCount'},
        {title: '潜在客户', num: 'potentialCustomerCount'},
        {title: '成单客户', num: 'dealCustomerCount'}
      ],
      sortList: [
        {title: '触达率', sort: 'reachRate'},
        {title: '转化率', sort: 'percentConversion'},
        {title: '成单率', sort: 'turnoverRatio'}
      ],
      list: null,
      rates: {
        reachRate: '',
        percentConversion: '',
        turnoverRatio: ''
      }
    }
  },
  async mounted() {
    await this.getResult()
    this.handleRates()
  },

  methods: {
    async getResult() {
      await this.$apis.sop.getEffectAnalysisApi({sopId: this.sopId}).then(res => {
            this.list = res
          }
      )
    },

    handleRates() {
      const {marketingCustomerCount, reachCustomerCount, potentialCustomerCount, dealCustomerCount} = this.list
      this.rates.reachRate = !marketingCustomerCount ? '-' : parseFloat(((reachCustomerCount / marketingCustomerCount) * 100).toFixed(2))
      this.rates.percentConversion
          = !reachCustomerCount ? '-' : parseFloat(((potentialCustomerCount / reachCustomerCount) * 100).toFixed(2))
      this.rates.turnoverRatio = !potentialCustomerCount ? '-' : parseFloat(((dealCustomerCount / potentialCustomerCount) * 100).toFixed(2))
    }
  }
}
</script>

<style lang="scss" scoped>
.sop-title {
  display: flex;
  justify-content: center;
  font-weight: 600;
  font-size: 20px;
  color: #1B233D;
  line-height: 48px;
}

.funnel-box {
  padding: 40px 0;
  position: relative;

  .funnel-bg {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translate(-50%);
    width: 406px;
    height: 288px;

    .funnel-img {
      width: 406px;
      height: 288px;
    }
  }

  .funnel-content {
    display: flex;
    justify-content: center;
    height: 248px;
    width: 100%;
    padding-top: 40px;
    //left: 50%;
    //transform: translate(-50%);
    .left,
    .right {
      display: flex;
    }

    .left {
      //flex: 0 0 900px;
      flex-flow: column;
      justify-content: space-around;
      align-items: flex-end;
      // align-items: center;
      z-index: 1;
      font-size: 14px;
      color: #2D2D33;
      box-sizing: border-box;
      padding-right: 20px;
      margin-left: 200px;

      div {
        display: flex;
        align-items: center;
        margin-right: 28px;

        .left-num {
          font-size: 20px;
          font-weight: 500;
          margin-left: 4px;
        }
      }
    }

    .right {
      //flex: 1;
      //flex-flow: column;
      //align-items: flex-start;
      //margin-left: 130px;
      color: #4466F0;
      //padding-top: 20px;
      font-size: 14px;
      display: inline;
      margin-left: 125px;
      //position: relative;
      .sort-box {
        margin: 38px 0;

        .sort-title {
          margin-left: 12px;
        }
      }

      .sort-box:nth-last-child(2) {
        margin-left: -40px;
      }

      .sort-box:last-child {
        //position: absolute;
        margin-left: -90px;
        //top: 50%;
      }

      .sort {
        font-size: 20px;
        font-weight: bold;
        margin-top: 6px;
      }
    }
  }
}

.text-box {
  background: #E2E1FF;
  display: flex;
  font-size: 14px;
  color: #0E0B4F;
  padding: 20px 40px;
  line-height: 25px;
  margin: 0 50px;
  //justify-content: space-between;
  .box-line {
    width: 2px;
    height: 100px;
    background: #0e0b4f52;
    margin: 0 60px;
  }
}
</style>