<template>
  <!-- 对话框(添加 / 修改) -->
  <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="80%" >
    <div class="app-container">
      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
        <el-form-item label="博主昵称" prop="nickname">
          <el-input
            v-model="queryParams.nickname"
            placeholder="请输入博主昵称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>

        <el-form-item label="平台名称" prop="platformName">
          <el-input
            v-model="queryParams.platformName"
            placeholder="请输入平台名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>

        <el-form-item label="平台昵称" prop="accountName">
          <el-input
            v-model="queryParams.accountName"
            placeholder="请输入账号昵称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>

      <el-row :gutter="10" class="mb8">
        <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
      </el-row>

      <el-table v-loading="loading" :data="cardList">
        <el-table-column label="博主昵称" align="center" prop="nickname" />
        <el-table-column label="平台名称" align="center" prop="platformName" />
        <el-table-column label="账号id" align="center" prop="accountNumber" />
        <el-table-column label="平台昵称" align="center" prop="accountName" />
        <el-table-column label="粉丝数量" align="center" prop="fansNum" />
        <el-table-column label="联系方式" align="center" prop="tel" />
        <el-table-column label="商单自报价" align="center" prop="price" />
        <el-table-column label="审核状态" align="center" prop="approvalStatus">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.dl_approval_status" :value="scope.row.approvalStatus"/>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              @click="detail(scope.row.id)"
            >查看详情</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </div>
    <BusiCardForm ref="refForm" :isDetail="true" @success="getList"/>
  </el-dialog>
</template>

<script>
import { listCard } from "@/api/member/busiCard";
import BusiCardForm from "@/views/member/busiCard/form/busiCardForm.vue"
export default {
  name: "CardCheckHis",
  dicts: ['dl_approval_status'],
  components: {
    BusiCardForm
  },
  data(){
    return{
      // 弹出层标题
      dialogTitle: "审核历史",
      // 是否显示弹出层
      dialogVisible: false,
      open:false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        nickname: null,
        platformName: null,
        accountName: null,
        approvalStatus: 10,
      },
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 通告主认证申请表格数据
      cardList: [],
    }
  },
  methods: {
    initForm(){
      this.dialogVisible = true;
      this.getList()
    },

    /** 查询通告主认证申请列表 */
    getList() {
      this.loading = true;
      this.loading = true;
      listCard(this.queryParams).then(response => {
        this.cardList = response.data.records;
        this.total = response.data.total;
        this.loading = false;
      });
    },

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },

    /** 重置按钮操作 */
    resetQuery() {
      this.startEndTime = []
      this.resetForm("queryForm");
      this.handleQuery();
    },

    /** 详情 */
    detail(id) {
      this.$refs['refForm'].initDraw(id)
    },
  }
}
</script>

<style scoped>
/deep/.el-dialog__body {
  padding: 0px 10px;
  color: #606266;
  font-size: 14px;
  word-break: break-all;
}
</style>
