leadBasicInfo.vue 8.31 KB
<template>
  <div>
    <div class="scrm-sub-client-container">
      <div class="pageContent" :style="{ 'min-height': clientHeight + 'px' }">
        <!-- 基本信息 -->
        <div class="baseTitle">
          <p class="title">基本信息</p>
          <hr />
          <!-- 救援服务 -->
          <yl-descriptions v-if="leadType == 3" ref="ylDeacriptions" :tableModel="rescueDescriModel" :showData="leadBaseList" />
          <!-- 新车询价 -->
          <yl-descriptions v-if="leadType == 4" ref="ylDeacriptions" :tableModel="newcarDescriModel" :showData="leadBaseList" />
          <!-- 试驾预约和维保预约 -->
          <yl-descriptions v-if="leadType == 5 || leadType == 6" ref="ylDeacriptions" :tableModel="orderDescriModel" :showData="leadBaseList" />
        </div>
        <!-- 跟进记录 -->
        <div class="baseTitle">
          <p class="title">跟进记录</p>
          <hr />
          <div class="timestamp" v-if="this.leadFollowRecord.length > 0">
            <el-timeline>
              <el-timeline-item v-for="(item, index) in leadFollowRecord" :key="index" :timestamp="item.followDate" placement="top" :color="index === 0 ? '#5850FF' : ''">
                <p class="conductor">
                  处理人:
                  <span>{{ item.userName }}</span>
                </p>
                <p class="remark">{{ item.remark }}</p>
              </el-timeline-item>
            </el-timeline>
          </div>
          <div :style="{ height: clientHeight - 450 + 'px' }" class="noRecord" v-else>
            <img src="@/assets/leadManage/noRecord.png" alt="" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getBaseInfo } from '@/api/modules/leadManage'
import ylDescriptions from '@/components/ylDescriptions'
export default {
  name: 'leadBasicInfo',
  components: { ylDescriptions },
  data() {
    return {
      followRecord: [],
      clientHeight: '',
      leadId: '', //线索id
      leadType: '', //线索类型
      leadBaseList: {}, //线索详情基本信息
      leadFollowRecord: [], //线索详情跟进记录
      copySameDescri: [],
      theSameDescri: [
        {
          colList: [
            { thColspan: 1, tdColspan: 2, label: '客户名称', name: 'name' },
            { thColspan: 1, tdColspan: 2, label: '客户手机号', name: 'phone' }
          ]
        },
        {
          colList: [
            { thColspan: 1, tdColspan: 2, label: '单号', name: 'orderNo' },
            { thColspan: 1, tdColspan: 2, label: '线索类型', name: 'type' }
          ]
        },
        {
          colList: [
            { thColspan: 1, tdColspan: 2, label: '线索状态', name: 'status', color: '#5850FF' },
            { thColspan: 1, tdColspan: 2, label: '创建时间', name: 'createdDate' }
          ]
        },
        {
          colList: [{ thColspan: 1, tdColspan: 5, label: '跟进时长', name: 'followTime' }]
        }
      ],
      // 救援服务
      rescueDescri: [
        {
          colList: [{ thColspan: 1, tdColspan: 5, label: '救援内容', name: 'rescueType' }]
        },
        {
          colList: [{ thColspan: 1, tdColspan: 5, label: '救援地点', name: 'rescueAddress' }]
        },
        {
          colList: [{ thColspan: 1, tdColspan: 5, label: '门店', name: 'merchantName' }]
        }
      ],
      // 新车询价
      newcarDescri: [
        {
          colList: [{ thColspan: 1, tdColspan: 5, label: '车型', name: 'vehicleShapeName' }]
        },
        {
          colList: [{ thColspan: 1, tdColspan: 5, label: '询价描述', name: 'comment' }]
        },
        {
          colList: [{ thColspan: 1, tdColspan: 5, label: '门店', name: 'merchantName' }]
        }
      ],
      // 维保预约
      orderDescri: [
        {
          colList: [{ thColspan: 1, tdColspan: 5, label: '试驾车辆', name: 'carName' }]
        },
        {
          colList: [{ thColspan: 1, tdColspan: 5, label: '门店', name: 'merchantName' }]
        }
      ]
    }
  },
  created() {
    this.leadId = this.$route.params.id ? this.$route.params.id : ''
    this.leadType = this.$route.params.type ? this.$route.params.type : ''
    this.getBaseDetail()
    this.addCol()
  },
  mounted() {
    this.clientHeight = document.documentElement.clientHeight - 140
  },
  computed: {
    // 救援服务
    rescueDescriModel() {
      return this.theSameDescri.concat(this.rescueDescri)
    },
    // 新车询价
    newcarDescriModel() {
      return this.theSameDescri.concat(this.newcarDescri)
    },
    // 维保预约
    orderDescriModel() {
      return this.copySameDescri.concat(this.orderDescri)
    }
  },
  methods: {
    addCol() {
      let addcolList = {
        colList: [
          { thColspan: 1, tdColspan: 2, label: '预约时间', name: 'appointDate' },
          { thColspan: 1, tdColspan: 2, label: '到店时间', name: 'appointTime' }
        ]
      }
      this.copySameDescri = JSON.parse(JSON.stringify(this.theSameDescri))
      this.copySameDescri.splice(3, 0, addcolList)
    },
    getBaseDetail() {
      let params = { id: this.leadId }
      getBaseInfo(params).then(res => {
        let dataObj = res
        // 转换线索类型
        if (dataObj['type']) {
          switch (dataObj['type']) {
            case '3':
              dataObj['type'] = '救援服务'
              break
            case '4':
              dataObj['type'] = '新车询价'
              break
            case '5':
              dataObj['type'] = '试驾预约'
              break
            case '6':
              dataObj['type'] = '维保预约'
          }
        }
        // 转换线索状态
        if (dataObj['status']) {
          switch (dataObj['status']) {
            case '0':
              dataObj['status'] = '待跟进'
              break
            case '1':
              dataObj['status'] = '跟进中'
              break
            case '2':
              dataObj['status'] = '已完成'
          }
        }
        // 转换救援内容
        if (dataObj['rescueType']) {
          switch (dataObj['rescueType']) {
            case '0':
              dataObj['rescueType'] = '紧急脱困'
              break
            case '1':
              dataObj['rescueType'] = '拖车'
              break
            case '2':
              dataObj['rescueType'] = '换胎'
              break
            case '3':
              dataObj['rescueType'] = '送油'
              break
            case '4':
              dataObj['rescueType'] = '搭电'
              break
            case '5':
              dataObj['rescueType'] = '事故救援'
          }
        }
        this.leadBaseList = dataObj
        this.leadFollowRecord = res.followList
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.scrm-sub-client-container {
  .pageContent {
    // padding: 6px 0px 30px;
    
    // min-width: 1300px;
    background-color: #fff;
    .leadAllocation {
      width: 700px;
      display: flex;
      justify-content: space-between;
    }
    .baseTitle {
      .title {
        padding: 15px 30px 0px 20px;
        font-size: 16px;
        color: #333333;
        font-weight: 600;
      }
      .timestamp {
        margin: 25px 20px 30px 44px;
        /deep/ .el-timeline-item__timestamp.is-top {
          margin-bottom: 3px !important;
        }
        /deep/ .el-timeline-item__timestamp {
          color: #1d2129;
          font-size: 14px;
        }
        /deep/ .el-timeline-item {
          padding-bottom: 30px;
        }
        /deep/ .el-timeline-item__tail {
          left: 4px;
          top: 15px;
          height: 87%;
        }
        /deep/ .el-timeline-item__node {
          background-color: #999999;
        }
        /deep/ .el-timeline-item__node--normal {
          left: 1px;
          width: 8px;
          height: 8px;
          top: 3px;
        }
        /deep/ .el-timeline-item__content {
          p {
            padding: 4px 0;
          }
          .conductor {
            font-size: 14px;
            > span {
              padding-left: 4px;
            }
          }
          .remark {
            font-size: 13px;
            color: #999999;
            line-height: 18px;
          }
        }
      }
      .noRecord {
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden; //img如果超出这个div会隐藏超出部分
      }
    }
  }
}
</style>