<template>
  <div class="client-details">
    <el-drawer
      :visible.sync="drawer"
      size="40%"
      custom-class="client-drawer"
      :with-header="false"
      @closed="cancel">
      <tables
        :indexFixed="true"
        :tableLoading="tableLoading"
        :tableData="tableData"
        :forData="forData"
        :tableDataTotal="tableDataTotal"
        :queryParams="queryParams"
        @handle-current-change="handleCurrentChange"
        style="margin: 12px;"
      >
        <template slot="companyName" slot-scope="scope">
          <router-link :to="scope.row.uipId?`/enterprise/${encodeStr(scope.row.companyId)}`:`/company/${encodeStr(scope.row.companyId)}`" tag="a" class="a-link" v-if="scope.row.companyId&&scope.row.companyName" v-html="scope.row.companyName"></router-link>
          <div v-else v-html="scope.row.companyName || '--'"></div>
        </template>
      </tables>
    </el-drawer>
  </div>
</template>

<script>
  import mixin from '../../party-a/mixins/mixin'
  import {memberCertificateList} from '@/api/detail/groupAccount/groupAccount'

export default {
  props: [
    'data',
    'title'
  ],
  components: { },
  mixins: [mixin],
  data() {
    return {
      drawer: false,
      queryParams: {
        id: this.data.id,
        pageNum: 1,
        pageSize: 10
      },
      formData: [
        { type: 3, fieldName: 'keys', value: '', placeholder: '输入项目/工程名称查询', options: []},
      ],
      forData: [
        {label: '拥有该资质成员', prop: 'companyName', slot: true},
        {label: '成员共有资质（个）', prop: 'certificateCount'},
      ],
      //列表
      tableLoading:false,
      tableData:[],
      tableDataTotal:0,
      amountTotal: 0
    }
  },
  created() {
    this.drawer = true
    this.handleQuery()
  },
  methods: {
    async handleQuery(params) {
      this.tableLoading = true
      let param = params?params:this.queryParams
      let res = await memberCertificateList(param)
      this.tableLoading = false
      if(res.code==200){
        this.tableData = res.rows
      }
      this.tableDataTotal = res.total
      // this.amountTotal = res.totalAmount
    },
    handlePic(url, isPic){
      isPic ? url = 'https://imgs.jiansheku.com/'+url : ''
      if(url){
        window.open(url, "_blank")
      }
    },
    linkTo(scope){
      this.drawer = false
      this.$router.push(`/biddetail/${scope.row.id}`)
    },
    cancel() {
      this.$emit('cancel')
    }
  }
}
</script>

<style lang="scss" scoped>
  .client-details {
    ::v-deep .client-drawer{
      background: #FFFFFF;
    }
    .tip-img{
      width: 14px;
      height: 14px;
      margin-right: 4px;
      cursor: pointer;
    }
  }
</style>
