clientGroupDetail.vue 10.7 KB
<template>
  <div class="scrm-sub-client-container">
    <div class="header">
      <div class="vehicleGroupName">
        <span>{{ groupName }}</span>
      </div>
      <button class="backBtn" @click="goBack">返回客户群管理</button>
    </div>
    <div class="content">
      <div class="leftWrap">
        <div class="avator">
          <img src="@/assets/clientDetail/defaultAvator.png" alt="" />
        </div>
        <p>
          <span>群主</span>
          <span class="ellipsis-1">{{ leftPanelList.groupHostName }}</span>
        </p>
        <p>
          <span>群主手机</span>
          <span class="ellipsis-1">{{ leftPanelList.groupHostPhone }}</span>
        </p>
        <p>
          <span>群主邮箱</span>
          <span class="ellipsis-1" :title="leftPanelList.groupHostEmail">{{ leftPanelList.groupHostEmail }}</span>
        </p>
        <p>
          <span>群主部门</span>
          <span class="ellipsis-1">{{ leftPanelList.groupHostDepart }}</span>
        </p>
        <p>
          <span>群管理员</span>
          <span class="ellipsis-1">{{ leftPanelList.groupAdmin }}</span>
        </p>
        <p>
          <span>创建时间</span>
          <span class="ellipsis-1" :title="leftPanelList.createDate">{{ leftPanelList.createDate }}</span>
        </p>
      </div>
      <div class="rightWrap">
        <p>
          <span>客户列表</span>
          <span>{{ clientTableDataNum || 0 }}个</span>
        </p>
        <search-form class="searchTop border-shadow" :formModel="searchForm" :formList="clientGroupFormList" @setTableHeightEvent="setTableHeightEvent">
          <span class="inline-b" slot="form-slot">
            <!-- :size="btn_size" -->
            <el-button plain @click="resetTable">重置</el-button>
            <el-button type="primary" @click="searchTable">查询</el-button>
          </span>
        </search-form>
        <!-- <basic-table ref="clientMassTable" :tableParams="tableParams" :getListApi="getListApi" :searchForm="searchForm" :hasNum="true">
          <span slot="table-button" slot-scope="scope">
            <el-button v-for="(j, idx) in tableParams.tableOption.btnList" :key="idx" :type="j.type || 'text'" :size="btn_size" @click="btnClick(j.pType, scope.scope)">{{ j.name }}</el-button>
          </span>
        </basic-table> -->
        <GLTable ref="clientGroupDetail" @setTableFinishFun="setTableFinishFun" :tableId="$route.query.id" :hasNum="true" :pageConf="pageConf" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn" :searchForm="searchForm" :tableParams="tableParams" :headerStyle="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }" :noDataImg="url">
          <span slot="customerName" slot-scope="scope">
            <span>{{ scope.scope.customerName }}</span>
            <span class="pure-blue-text">{{ scope.scope.type == 1 ? '@微信' : scope.scope.type == 2 ? '@企微' : '' }}</span>
          </span>
          <span slot="customerSex" slot-scope="scope">
            <span>{{ scope.scope.customerSex == 0 ? '未知' : scope.scope.customerSex == 1 ? '男' : '女' }}</span>
          </span>
          <span slot="joinScene" slot-scope="scope">
            <span>{{ scope.scope.joinScene == 1 ? '直接邀请入群' : scope.scope.joinScene == 2 ? '通过邀请链接入群' : scope.scope.joinScene == 3 ? '通过扫描群二维码入群' : '' }}</span>
          </span>
          <template slot="auth-button" slot-scope="scope" :data="scope.scope">
            <span @click="goDetail(scope.scope.id)" class="blue-text">详情</span>
          </template>
        </GLTable>
      </div>
    </div>
  </div>
</template>

<script>
import { getTableDetail, getDetailTableList } from '@/api/modules/clientGroupManage'
import url from '@/assets/clientDataOverview/nodata.png'
export default {
  name: 'clientGroupDetail',
  data() {
    return {
      groupName: this.$route.query.groupName,
      url: url,
      leftPanelList: {},
      searchForm: {},
      clientGroupFormList: [
        {
          type: 'daterange',
          prop: 'daterange',
          label: '入群时间',
          pickerOptions: {
            disabledDate(time) {
              return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
            }
          }
        },
        {
          type: 'select',
          prop: 'customerSex',
          label: '性别',
          placeholder: '请选择性别',
          options: [
            {
              label: '全部',
              value: null
            },
            {
              label: '男',
              value: 1
            },
            {
              label: '女',
              value: 2
            },
            {
              label: '未知',
              value: 0
            }
          ]
        },
        {
          type: 'input',
          inputType: 'text',
          prop: 'groupNickName',
          label: '本群昵称',
          placeholder: '请输入本群昵称'
        },
        {
          type: 'input',
          inputType: 'text',
          prop: 'customerName',
          label: '客户名称',
          placeholder: '请输入客户名称'
        }
      ],
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
      tableParams: {
        // btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'data',
        tableColumns: [
          {
            label: '本群昵称',
            prop: 'groupNickName'
          },
          {
            label: '客户名称',
            prop: 'customerName',
            addHtml: 'customerName'
          },
          {
            label: '手机号码',
            prop: 'customerPhone'
          },
          {
            label: '性别',
            prop: 'customerSex',
            addHtml: 'customerSex'
          },
          {
            label: '入群方式',
            prop: 'joinScene',
            addHtml: 'joinScene'
          },
          {
            label: '入群时间',
            prop: 'joinTime'
          }
        ],
        tableOption: {
          width: 80,
          btnList: [
            {
              name: '详情',
              pType: 'detail'
            }
          ]
        }
      },
      getListApi: getDetailTableList,
      clientTableDataNum: 0
    }
  },
  created() {
    this.getTableDetail()
  },
  mounted() {
    this.$nextTick(() => {
      this.$refs.clientGroupDetail.setTableHeightFun()
    })
  },
  methods: {
    async getTableDetail(id = this.$route.query.id) {
      const res = await getTableDetail({ id: id })
      console.log('获取客户群数据', res)
      if (!res) {
        return false
      }
      this.leftPanelList = res
    },
    beforeSearchFn() {
      return new Promise((resolve, reject) => {
        console.log(this.searchForm)
        if (this.searchForm.daterange) {
          this.searchForm.beginTime = this.searchForm.daterange[0]
          this.searchForm.endTime = this.searchForm.daterange[1]
          delete this.searchForm.daterange
        } else {
          if (this.searchForm.beginTime) delete this.searchForm.beginTime && delete this.searchForm.endTime
        }
        resolve()
      })
    },
    setTableHeightEvent() {
      this.$refs.clientGroupManage.setTableHeightFun()
    },
    setTableFinishFun(content) {
      this.clientTableDataNum = content.length
    },
    goBack() {
      this.$router.push({ path: '/clientGroupManage/index' })
    },
    //搜索表格
    searchTable() {
      this.$refs.clientGroupDetail.refreshTable()
    },
    //重置表格
    resetTable() {
      this.searchForm = {}
      this.$refs.clientGroupDetail.refreshTable()
    },
    goDetail(id) {
      this.$router.push({
        path: '/clientManage/clientDetail',
        query: {
          id: id
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.scrm-sub-client-container {
  @import '@/styles/variables.scss';
  @import '@/styles/resetelement.scss';
  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
    background: #ffffff;
    box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
    .vehicleGroupName {
      margin-left: 26px;
      height: 20px;
      font-size: 20px;
      font-weight: 500;
      color: #333333;
      line-height: 20px;
      letter-spacing: 1px;
    }
    .backBtn {
      margin-right: 20px;
      height: 32px;
      background: $btnBlue;
      color: #fff;
      border-radius: 4px;
      padding: 0 20px;
      border: none;
      &:hover {
        background-color: $lightBtnBlue;
      }
    }
  }
  .content {
    display: flex;
    width: 100%;
    margin-top: 20px;
    .leftWrap {
      width: 240px;
      // height: 877px;
      min-height: 270px; //calc(100vh - 92px);
      background-color: #fff;
      box-sizing: border-box;
      .avator {
        margin: 0 auto;
        margin-top: 40px;
        width: 60px;
        height: 60px;
        text-align: center;
        line-height: 60px;
        img {
          border-radius: 50%;
          width: 100%;
          height: 100%;
        }
      }
      p {
        padding-left: 20px;
        position: relative;
        margin-top: 20px;
        span:first-child {
          display: inline-block;
          height: 20px;
          font-size: 14px;
          font-weight: 500;
          color: #333333;
          line-height: 20px;
        }
        span:nth-child(2) {
          position: absolute;
          left: 100px;
          display: inline-block;
          height: 20px;
          font-size: 14px;
          font-weight: 400;
          color: #666666;
          line-height: 20px;
          max-width: 131px;
        }
      }
    }
    .rightWrap {
      margin-left: 20px;
      width: calc(100% - 260px);
      box-sizing: border-box;
      background-color: #fff;
      padding: 20px;
      > p {
        height: 20px;
        line-height: 20px;
        margin-bottom: 10px;
        span {
          vertical-align: middle;
        }
        span:first-child {
          font-size: 18px;
          font-weight: 400;
          color: #333333;
        }
        span:nth-child(2) {
          margin-left: 6px;
          font-size: 14px;
          font-weight: 400;
          color: $btnBlue;
          height: 20px;
          line-height: 20px;
        }
      }
      .el-button + .el-button {
        margin-left: 20px;
      }
      // .el-button {
      //   font-size: 14px;
      //   font-weight: 400;
      //   padding: 9px 21px;
      //   background: $btnBlue;
      //   border-radius: 4px;
      //   border: none;
      // }
      // .el-button:first-child {
      //   background: #ffffff;
      //   border-radius: 4px;
      //   border: 1px solid #999999;
      //   font-weight: 400;
      //   color: #666666;
      // }
      .glsx-table {
        margin-top: 20px;
      }
    }
  }
}
</style>