group.vue 11.1 KB
<template>
  <div class="scrm-sub-client-container">
    <div class="head-container">
      <template v-if="crowdType == ''">
        <div class="head-container-title color-3 font-20">{{ $Constants.DESCRIBEDATA[id - 1].name }}</div>
        <div class="head-container-content color-6 font-14">{{ $Constants.DESCRIBEDATA[id - 1].info }}</div>
      </template>
      <template v-else>
        <div class="head-container-title color-3 font-20">{{ crowdForm.crowdName }}</div>
        <div class="head-container-content color-6 font-14">{{ crowdForm.crowdDesc }}</div>
      </template>
      <!-- <div class="reminder font-14 color-3">企业标签 | 自动更新</div> -->
      <div class="back color-58 font-14" @click="goBack">返回人群管理</div>
    </div>
    <div class="main-container">
      <GLCombiForm ref="formSearch" :formObj="tableSearchForm" :formData="tagsPartFormList" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
      <div class="main-container-head flex-between">
        <div class="main-container-head-title color-3 font-20">
          全部客户
          <span class="main-container-head-number font-14">{{ totalCount }}个</span>
        </div>
        <el-button size="small" @click="handleExport" class="export">导出</el-button>
      </div>
      <GLTable ref="groupRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :noDataImg="url" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
        <span slot="customerName" slot-scope="scope" style="display: flex; align-items: center">
          <el-tooltip effect="dark" :content="scope.scope.customerName" placement="top">
            <span class="ellipsis-1" style="display: inline-block; max-width: 70px; text-align: left">{{ scope.scope.customerName }}</span>
          </el-tooltip>
        </span>
        <!-- 企微名称 -->
        <div slot="nickNameList" slot-scope="scope" class="expandImg">
          <div v-for="(list, idx) in scope.scope.nickNameList" :key="idx">
            <div v-if="idx == 0">
              <span>{{ list.nickName }}</span>
              <span class="smallFontSize" :class="[list.type == 1 ? 'pure-green-text' : '', list.type == 2 ? 'pure-yello-text' : '']">@{{ list.corpName }}</span>
            </div>
            <span v-if="idx == 1">
              <el-popover placement="right-start" trigger="hover" content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
                <div style="padding-bottom: 3px !important" v-for="(i, index) in scope.scope.nickNameList" :key="index">
                  <span>{{ i.nickName }}</span>
                  <span style="height: 20px; font-size: 12px; letter-spacing: 0; line-height: 20px; font-weight: 400; margin-left: 2px" :class="[i.type == 1 ? 'pure-green-text' : '', i.type == 2 ? 'pure-yello-text' : '']">@{{ i.corpName }}</span>
                </div>
                <img class="imgEll" src="@/assets/tagsManage/ellipsis.png" alt="" slot="reference" />
              </el-popover>
            </span>
          </div>
        </div>
        <div class="table-btns" slot="optionBtns" slot-scope="scope">
          <el-button type="text" @click="goDetail(scope.scope)" class="blue-text">详情</el-button>
        </div>
      </GLTable>
    </div>
  </div>
</template>

<script>
import { getCustomerList, getcrowdManageList, customerClusterListExport } from '@/api/modules/clientDataOverview'
import { getStaffList } from '@/api/modules/clientManage'
import url from '@/assets/empty.png'
export default {
  name: 'group',
  data() {
    return {
      getListApi: this.$route.params.crowdType ? getcrowdManageList : getCustomerList,
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
      tableSearchForm: {
        customerPhone: '',
        nickName: '',
        customerName: '',
        followStaff: '',
        audi: '',
        carNumber: '',
        isJoin: ''
      },
      tagsPartFormList: [
        {
          type: 'select',
          name: 'followStaff',
          optionId: 'value',
          optionLabel: 'label',
          optionList: [],
          label: '跟进员工'
        },
        {
          type: 'input',
          name: 'customerPhone',
          label: '联系电话'
        },
        {
          type: 'input',
          name: 'nickName',
          label: '企微名称'
        },
        {
          type: 'input',
          name: 'customerName',
          label: '客户名称'
        },
        {
          type: 'select',
          name: 'isJoin',
          label: '是否加企微',
          optionId: 'value',
          optionLabel: 'label',
          placeholder: '请选择',
          optionList: [
            {
              value: '',
              label: '全部'
            },
            {
              value: '1',
              label: '是'
            },
            {
              value: '0',
              label: '否'
            }
          ]
        }
      ],
      crowdForm: {},
      id: this.$route.params.id ? this.$route.params.id : '',
      crowdType: this.$route.params.crowdType ? this.$route.params.crowdType : '',
      totalCount: '',
      tableParams: {
        listName: 'data',
        tableOption: false,
        tableColumns: [
          {
            label: '客户名称',
            prop: 'customerName',
            addHtml: 'customerName',
            minWidth: 150
          },
          {
            label: '企微名称',
            prop: 'nickNameList',
            addHtml: 'nickNameList',
            minWidth: 220
          },
          {
            label: '联系电话',
            prop: 'customerPhone',
            minWidth: 130
          },
          {
            label: '车牌号',
            prop: 'carNumber',
            minWidth: 120
          },
          {
            label: '车架号',
            prop: 'carVin',
            minWidth: 140,
            line: 1
          },
          {
            label: '车系',
            prop: 'audi',
            minWidth: 170
          },
          {
            label: '跟进员工',
            prop: 'followStaff',
            // addHtml: 'followStaff',
            minWidth: 170
          },
          {
            label: '是否加企微', //1. 加入,0.未加入
            prop: 'isJoinName',
            width: 130
          },
          {
            label: '购车时间',
            prop: 'buyDate',
            width: 130
          },
          {
            label: '添加时间',
            prop: 'addTime',
            width: 130
          },
          {
            label: '操作',
            prop: 'optionBtns',
            width: '62px',
            addHtml: 'optionBtns',
            fixed: 'right'
          }
        ]
      },

      url: url
    }
  },
  created() {
    let { id } = this
    this.init(id)
    // 针对广汇替换字段
    console.log(location.host)
    if (this.id == 1 && location.host == 'scrm.cgacar.com') {
      this.tableParams.tableColumns.splice(
        3,
        3,
        {
          type: 'input',
          name: '',
          label: '线索时间'
        },
        {
          type: 'input',
          name: '',
          label: '意向车型'
        },
        {
          type: 'input',
          name: '',
          label: '线索来源'
        }
      )
    }
  },
  mounted() {
    this.getStaffList()
  },
  methods: {
    //获取跟进员工
    getStaffList() {
      getStaffList({}).then(res => {
        if (res.length == 0) {
          return ''
        }
        const id = this.tagsPartFormList.findIndex(item => {
          return item.name == 'followStaff'
        })
        const staff = res.map(item => {
          return {
            label: item.staffName,
            value: item.staffName
          }
        })
        staff.unshift({ label: '全部', value: '' })

        this.$nextTick(() => {
          this.tagsPartFormList[id].optionList = staff
        })
        console.log(this.tagsPartFormList[id])
      })
    },
    handleSearch() {
      this.$refs.groupRef.refreshTable()
    },
    handleReset() {
      this.tableSearchForm = {
        crowdId: this.id
      }
      this.$refs.groupRef.refreshTable()
    },
    init(id) {
      this.tableSearchForm = {
        crowdId: id
      }
      // 通过人群Id查询人群详情
      if (this.crowdType) {
        this.getCrowdDetails()
      }
      // this.getTotalCount()
    },
    goDetail(scope) {
      this.$router.push('/clientManage/clientDetail?id=' + scope.oneId)
    },
    getCrowdDetails() {
      let params = {
        'req.crowdId': this.id
      }
      this.$apis.crowdManage.getCrowdDetails(params).then(res => {
        if (res.code == 0) {
          this.crowdForm.crowdName = res.data.crowdName
          this.crowdForm.crowdDesc = res.data.crowdDesc
        }
      })
    },
    //导出
    handleExport() {
      var params = {
        crowdId: this.id,
        pageSize: 10,
        pageNum: 1
      }
      if (this.crowdType) params.customCrowd = true
      customerClusterListExport(params).then(res => {
        this.$Utils.exportFn(res)
      })
    },
    setTableFinishFun() {
      this.totalCount = this.$refs.groupRef.total
      this.$refs.groupRef.data.length ? (this.$refs.groupRef.tableHeightValues = '') : this.$refs.groupRef.setTableHeightFun()
    },
    goBack() {
       this.$router.push('/clientDataOverview/index')
    }
  }
}
</script>

<style lang="scss" scoped>
@import '@/styles/variables.scss';
.expandImg {
  display: flex;
  .smallFontSize {
    margin-left: 2px;
    height: 20px;
    font-size: 12px;
    letter-spacing: 0;
    line-height: 20px;
    font-weight: 400;
  }
  .imgEll {
    margin-left: 6.5px;
    cursor: pointer;
    // margin-bottom:3px;
  }
}
.pure-green-text {
  color: #61cc43;
}
.pure-yello-text {
  color: #fb8f28;
}
.scrm-sub-client-container {
  .head-container {
    position: relative;
    margin-bottom: 10px;
    width: 100%;
    height: 112px;
    background: #ffffff;
    box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
    padding: 20px;
    box-sizing: border-box;
    &-title {
      font-weight: 500;
      line-height: 20px;
      letter-spacing: 1px;
      margin-bottom: 10px;
      width: calc(100% - 156px);
    }
    &-content {
      font-weight: 400;
      line-height: 20px;
      width: calc(100% - 156px);
    }
    .back {
      font-weight: 400;
      line-height: 22px;
      padding: 5px 16px;
      border-radius: 4px;
      border: 1px solid $btnBlue;
      position: absolute;
      right: 20px;
      top: 20px;
      color: $btnBlue;
      cursor: pointer;
    }
  }
  .main-container {
    width: 100%;
    height: 100%;
    background: #ffffff;
    box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
    padding: 20px;
    box-sizing: border-box;
    .main-container-head {
      margin-bottom: 20px;
      &-title {
        font-weight: 500;
        line-height: 20px;
        letter-spacing: 1px;
      }
      &-number {
        color: $btnBlue;
        margin-left: 6px;
        font-weight: 400;
        line-height: 20px;
      }
      .export {
        color: #5850ff;
        border: 1px solid #5850ff;
      }
    }
  }
  .pure-blue-text {
    color: #61cc43;
  }
  .pure-yello-text {
    color: #fb8f28;
  }
}
</style>