clientGroupDetailold.vue 12.5 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
<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>
          <el-tooltip class="item" :content="leftPanelList.groupHostEmail" placement="top">
            <span class="ellipsis-1">{{ leftPanelList.groupHostEmail }}</span>
          </el-tooltip>
        </p>
        <!-- <p>
          <span>群主部门</span>
          <span class="ellipsis-1">{{ leftPanelList.groupHostDepart }}</span>
        </p> -->
        <p>
          <span>群管理员</span>
          <el-tooltip class="item" :content="leftPanelList.groupAdmin" placement="top">
            <span class="ellipsis-1">{{ leftPanelList.groupAdmin }}</span>
          </el-tooltip>
        </p>
        <p>
          <span>创建时间</span>
          <el-tooltip class="item" :content="leftPanelList.createDate" placement="top">
            <span class="ellipsis-1">{{ leftPanelList.createDate }}</span>
          </el-tooltip>
        </p>
      </div>
      <div class="rightWrap">
        <p>
          <span>全部客户</span>
          <span>{{ clientTableDataNum || 0 }}个</span>
        </p>
        <search-form class="searchTop border-shadow" :isNeedThreeBtns="false" :showDefaultTime="false" :formModel="searchForm" :formList="clientGroupFormList" @setTableHeightEvent="setTableHeightEvent">
          <span class="inline-b" slot="form-slot">
            <el-button type="primary">导出</el-button>
            <el-button plain @click="resetTable">重置</el-button>
            <el-button type="primary" @click="searchTable">查询</el-button>
          </span>
        </search-form>
        <!-- :tableId="$route.query.id" 去掉,表格组件也应该去掉 -->
        <GLTable ref="clientGroupDetail" @setTableFinishFun="setTableFinishFun" :hasNum="true" :pageConf="pageConf" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn" :searchForm="searchFormTable" :tableParams="tableParams" :headerStyle="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }" :noDataImg="url">
          <span slot="customerName" class="flex-center" slot-scope="scope">
            <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>
          <span slot="customerSex" slot-scope="scope">
            <span>{{ scope.scope.customerSex == 2 ? '女' : 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>
        <GLDialog mode="small" :visible.sync="dialogVisible">
          <div class="content-body">
            <p>该客户暂无员工跟进,无法查看该客户详情,</p>
            <p class="bottomText">赶紧去加好友吧!</p>
          </div>
          <span slot="footer" class="dialog-footer">
            <el-button type="primary" size="small" @click="dialogVisible = false">我知道了</el-button>
          </span>
        </GLDialog>
      </div>
    </div>
  </div>
</template>

<script>
import { getTableDetail, getDetailTableList, getClientTableDetail } from '@/api/modules/clientGroupManage'
import url from '@/assets/clientDataOverview/nodata.png'
export default {
  name: 'clientGroupDetail',
  data() {
    return {
      dialogVisible: false,
      groupName: this.$route.query.groupName,
      url: url,
      leftPanelList: {},
      searchForm: {},
      searchFormTable: {},
      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',
            minWidth: 100
          },
          {
            label: '手机号码',
            prop: 'customerPhone'
          },
          {
            label: '性别',
            prop: 'customerSex',
            addHtml: 'customerSex'
          },
          {
            label: '入群方式',
            prop: 'joinScene',
            addHtml: 'joinScene'
          },
          {
            label: '邀请人',
            prop: 'invitorName'
          },
          {
            label: '入群时间',
            prop: 'joinTime',
            width: 120
          }
        ],
        tableOption: {
          width: 80,
          btnList: [
            {
              name: '详情',
              pType: 'detail'
            }
          ]
        }
      },
      getListApi: getDetailTableList,
      clientTableDataNum: 0,
      flushTime: false
    }
  },
  created() {
    this.getTableDetail()
    this.searchForm = {
      id: this.$route.query.id
    }
  },
  mounted() {
    // this.$nextTick(() => {
    //   this.searchTable()
    // })
  },
  // watch: {
  //   'searchForm.daterange':{
  //     deep: true,
  //     // immediate:true,
  //     handler(val) {
  //       
  //       if(val){
  //           
  //         this.searchTable()
  //       }
  //     }
  //   }
  // },

  methods: {
    async getTableDetail(id = this.$route.query.id) {
      const res = await getTableDetail({ id: id })
      
      if (!res) {
        return false
      }
      this.leftPanelList = res
    },
    beforeSearchFn() {
      return new Promise((resolve, reject) => {
        this.searchFormTable = JSON.parse(JSON.stringify(this.searchForm))
        //  
        //  
        //  
        if (this.searchFormTable.daterange) {
          this.searchFormTable.beginTime = this.searchForm.daterange[0]
          this.searchFormTable.endTime = this.searchForm.daterange[1]
          delete this.searchFormTable.daterange
        } else {
          if (this.searchFormTable.beginTime) delete this.searchFormTable.beginTime && delete this.searchFormTable.endTime
        }
        resolve()
      })
    },
    setTableHeightEvent() {
      this.$refs.clientGroupDetail.setTableHeightFun()
    },
    setTableFinishFun(content) {
      //content是第一页的数据
      
      this.clientTableDataNum = this.$refs.clientGroupDetail.total
      //接收到的数据为空
      // if (!this.$refs.clientGroupDetail.data.length) {
      //   this.$refs.clientGroupDetail.setTableHeightFun()
      // }
      this.$refs.clientGroupDetail.data.length ? (this.$refs.clientGroupDetail.tableHeightValues = '') : this.$refs.clientGroupDetail.setTableHeightFun()
    },
    goBack() {
      this.$router.push({ path: '/clientGroupManage/index' })
    },
    //搜索表格
    searchTable() {
      this.$refs.clientGroupDetail.refreshTable()
    },
    //重置表格
    resetTable() {
      this.searchForm = { id: this.$route.query.id }
      this.$refs.clientGroupDetail.refreshTable()
    },
    handleClose() {
      this.dialogVisible = !this.dialogVisible
    },
    handleConfirm() {
      this.handleClose()
    },
    goDetail(id) {
      //  接口通过了跳转
      getClientTableDetail({ oneId: id }).then(res => {
        if (res.code == '0') {
          if (!res.data) {
            this.dialogVisible = true
            return false
          }
          this.$router.push({
            path: '/clientManage/clientDetail',
            query: {
              id: id
            }
          })
        } else {
          this.$message({
            type: 'error',
            message: res.message
          })
        }
      })
    }
  }
}
</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: 600;
      color: #333333;
      line-height: 20px;
      letter-spacing: 1px;
    }
    .backBtn {
      margin-right: 20px;
      height: 32px;
      font-size: 14px;
      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: 600;
          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;
      }
      .glsx-table {
        margin-top: 20px;
      }
    }
  }

  .container-body {
    font-size: 18px;
    text-align: center;
    font-weight: 400;
    color: #333333;
    .bottomText {
      margin-top: 10px;
    }
  }
}
</style>