Overview.vue 8.72 KB
<template>
  <div class="overview flex">
    <div class="store mgr4">
      <div class="headline flex-around">
        <div :style="{ width: item.width ? item.width : 'auto' }" v-for="(item, index) in titleList" :key="index">{{ item.text }}</div>
      </div>
      <div class="content">
        <div :class="['content-item', 'flex-around', info.pd ? info.pd : '']" v-for="(info, index) in infoList" :key="index">
          <div class="content-title">{{ info.title }}</div>
          <template v-for="(data, ids) in info.dataList">
            <div v-if="ids != 3" :class="['content-number', 'num-' + ids]" :key="ids">
              {{ index == 0 ? numAddSymbol(data(smartClueData)) : index == 1 ? numAddSymbol(data(merchantData)) : numAddSymbol(data(smartData)) }}
            </div>
            <div v-else :class="['content-number', 'num-' + ids]" :key="ids">
              {{ index == 0 ? toFixNum(data(smartClueData)) : index == 1 ? toFixNum(data(merchantData)) : toFixNum(data(smartData)) }}
            </div>
          </template>
        </div>
      </div>
    </div>
    <div class="clew mgr4">
      <div class="headline text-center">产生线索/核销数</div>
      <div class="clew-content">
        <div :class="['clew-content-item', 'bg-' + clewInx]" v-for="(clew, clewInx) in clewList" :key="clewInx">
          <template v-for="(clewData, clewIds) in clew">
            <div class="clew-line-text flex-between" :key="clewIds">
              <div>{{ clewData.title }}</div>
              <div class="clew-num">
                {{ clewInx == 0 ? numAddSymbol(clewData.value(smartClueData)) : clewInx == 1 ? numAddSymbol(clewData.value(merchantData)) : numAddSymbol(clewData.value(smartData)) }}
              </div>
            </div>
          </template>
        </div>
      </div>
    </div>
    <!-- <div class="estimate">
      <div class="headline text-center">预估价值/挽回损失</div>
      <div class="estimate-content">
        <div :class="['estimate-content-item', 'bgEstimate-' + estimateInx]" v-for="(estimate, estimateInx) in estimateList" :key="estimateInx">
          <template v-for="(estimateData, estimateIds) in estimate">
            <div :class="['estimate-line-text', estimateInx == 2 ? 'flex-column retrieve' : 'text-center']" :key="estimateIds">
              <div v-if="estimateInx == 2">挽回损失</div>
              <div class="estimate-num">
                {{ estimateInx == 0 ? numAddSymbol(estimateData(smartClueData)) : estimateInx == 1 ? numAddSymbol(estimateData(merchantData)) : numAddSymbol(estimateData(smartData)) }}
              </div>
            </div>
          </template>
        </div>
      </div>
    </div> -->
  </div>
</template>

<script>
export default {
  name: 'Oversize',
  data() {
    return {
      merchantData: '', // 门店会员的权益
      smartData: '', // 智慧车管线索订阅
      smartClueData: '', // 智慧门店线索订阅
      titleList: [
        { text: '订阅门店', width: '5.78vw' },
        { text: '线索订阅门店数(累计)', width: '5.82vw' },
        { text: '线索订阅门店数(当年新增)', width: '6.82vw' },
        { text: '活跃使用门店', width: '4.95vw' },
        { text: '留存率', width: '3.29vw' }
      ],
      infoList: [
        {
          title: '智慧门店线索订阅',
          pd: 'pd26',
          width: '2.78vw',
          dataList: [obj => obj.totalnum, obj => obj.activenum, obj => obj.increnum, obj => obj.retention]
        },
        {
          title: '门店会员的权益',
          width: '2.78vw',
          dataList: [obj => obj.totalnum, obj => obj.activenum, obj => obj.increnum, obj => obj.retention]
        },
        {
          title: '智慧车管线索订阅',
          width: '2.78vw',
          dataList: [obj => obj.totalnum, obj => obj.activenum, obj => obj.increnum, obj => obj.retention]
        }
      ],
      clewList: [
        [
          { title: '到店线索', value: obj => obj.arrival },
          { title: '送修线索', value: obj => obj.repair },
          { title: '续保线索', value: obj => obj.insurance }
        ],
        [
          // { title: '自店权益', value: obj => obj.ownshopequity },
          { title: '数字权益', value: obj => obj.digitalequity }
        ],
        [
          { title: '高危点', value: obj => obj.highcriticalpoint },
          { title: '高危报警', value: obj => obj.highriskalarm }
        ]
      ],
      estimateList: [[obj => obj.totalnum, obj => obj.increnum, obj => obj.activenum], [obj => obj.totalnum], [obj => obj.totalnum]]
    }
  },
  created() {
    this.getMerchantData()
    this.getSmartData()
    this.getSmartClueData()
  },
  methods: {
    toFixNum(val) {
      if (!val) {
        return '0.0%'
      }
      return (val * 100).toFixed(1) + '%'
    },
    getMerchantData() {
      this.api.operational.getMerchantMemberEquity().then(res => {
        if (res.code == 0) {
          this.merchantData = res.data.dataList[0]
        }
      })
    },
    getSmartData() {
      this.api.operational.getSmartCarManageClueSubscription().then(res => {
        if (res.code == 0) {
          this.smartData = res.data.dataList[0]
        }
      })
    },
    getSmartClueData() {
      this.api.operational.getSmartMerchantClueSubscription().then(res => {
        if (res.code == 0) {
          this.smartClueData = res.data.dataList[0]
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.overview {
  // box-sizing: border-box;
  padding: 2.22vh 0.83vw;
  .store {
    width: 30.28vw;
    height: 29.27vh;
  }
  .clew {
    width: 11.11vw;
    height: 29.27vh;
  }
  .estimate {
    width: 7.64vw;
    height: 29.27vh;
  }
  .headline {
    height: 5.01vh;
    background: #092a46;
    font-weight: 600;
    font-size: 12px;
    color: #e8e8e8;
    padding-left: 20px;
  }
  .content {
    width: 100%;
    height: 23.66vh;
    &-item {
      padding: 1.59vh 0;
      height: 4.88vh;
      background: rgba(11, 44, 142, 0.28);
      margin-bottom: 0.49vh;
      justify-content: space-around;
      box-sizing: border-box;
      &:last-child {
        height: 6.34vh;
        margin-bottom: 0;
      }
      &:nth-child(2) {
        background-color: rgba(11, 101, 142, 0.28);
      }
    }
    &-title {
      width: 4.98vw;
      font-weight: 400;
      font-size: 12px;
      color: #fff;
      padding-left: 20px;
      // white-space: pre-wrap;
    }
    &-number {
      font-weight: 700;
      font-size: 12px;
      color: #ffffff;
      padding-left: 20px;
    }
    .num-0 {
      width: 6.95vw;
    }
    .num-1 {
      width: 4.95vw;
    }
    .num-2 {
      width: 4.29vw;
    }
    .num-3 {
      width: 3.29vw;
    }
    .pd26 {
      height: 8.21vh;
      padding: 3.17vh 0;
    }
  }
  .mgr4 {
    margin-right: 0.28vw;
  }
  .clew-content {
    width: 100%;
    &-item {
      margin-bottom: 0.49vh;
      background: rgba(11, 44, 142, 0.28);
      .clew-line-text {
        padding: 0.85vh 2.56vw 0.73vh 2.56vw;
        font-weight: 400;
        font-size: 12px;
        color: #fff;
        border-bottom: 1px solid #0e2949;
        box-sizing: border-box;
        height: 2.72vh;
        .clew-num {
          font-weight: 700;
          font-size: 12px;
          color: #ffffff;
        }
        &:last-child {
          border: none !important;
        }
      }
    }
    .bg-1 {
      background: rgba(11, 101, 142, 0.28);
      .clew-line-text {
        border-bottom: 1px solid #0a2d26;
        height: 4.88vh;
      }
      // .clew-num {
      //   color: #FF0000;
      // }
    }
    .bg-2 {
      background: rgba(11, 44, 142, 0.28);
      .clew-line-text {
        // border-bottom: 1px solid #390b4b;
        height: 3.17vh;
      }
    }
  }
  .estimate-content {
    width: 100%;
    &-item {
      margin-bottom: 0.49vh;
      background: #0b0e31;
      .estimate-line-text {
        font-weight: 400;
        border-bottom: 1px solid #171f60;
        box-sizing: border-box;
        height: 3.333vh;
        .estimate-num {
          font-weight: 700;
          font-size: 12px;
          color: #ffffff;
        }
        &:last-child {
          border: none !important;
        }
      }
    }
    .bgEstimate-1 {
      .estimate-line-text {
        height: 6.83vh;
        border: none;
      }
    }
    .bgEstimate-2 {
      .estimate-line-text {
        height: 6.83vh;
        border: none;
      }
    }
    .retrieve {
      font-size: 12px;
      color: #ff3540;
      .estimate-num {
        color: #ff3540 !important;
        margin-top: 0.37vh;
      }
    }
  }
}
</style>