<template>
  <div class="app-container" ref="main">
    <div ref="search">
      <el-form
        :model="queryParams"
        ref="queryForm"
        size="small"
        :inline="true"
        class="search-container"
      >
        <el-form-item prop="name">
          <el-input
            v-model="queryParams.input"
            placeholder="请输入关键字"
            clearable
          >
            <div class="search-btn" slot="append">
              <i class="el-icon-search"></i>
            </div>
          </el-input>
        </el-form-item>
      </el-form>
    </div>

    <el-table
      v-loading="loading"
      :data="tableData"
      :height="tableHeigth + 'px'"
    >
      <el-table-column
        label="序号"
        align="center"
        type="index"
        prop="id"
        width="55"
      />
      <el-table-column label="证书名称" align="center" prop="certificateId" />
      <el-table-column label="兑换人员" align="center" prop="type" />
      <el-table-column label="状态" align="center" prop="duration" />
      <el-table-column label="兑换时间" align="center" prop="time" />
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            icon="el-icon-view"
            type="text"
            @click="handleInfo(scope.row)"
            >查看</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"
    />

    <!-- 发布对话框 -->
    <el-dialog :visible.sync="open" width="900px" append-to-body>
      <div slot="title" class="dialog-title">
        <span class="title-line"></span>
        {{ title }}
      </div>
      <div class="conversionInfo">
        <div class="basicInfo">
          <div class="title">
            <img src="@/assets/images/huodong.png" alt="" />
            <span>证书详情</span>
          </div>
          <div class="info">
            <div class="lists">
              <div class="list-left">
                <div>证书名称：</div>
                <div>xxx证书</div>
              </div>
              <div class="list-right">
                <div>兑换人员：</div>
                <div>xxxx</div>
              </div>
            </div>
            <div class="lists">
              <div class="list-left">
                <div>兑换时间：</div>
                <div>xxxx</div>
              </div>
              <div class="list-left">
                <div>兑换积分：</div>
                <div>xx</div>
              </div>
            </div>
            <div class="lists">
              <div class="list-left">
                <div>证书状态：</div>
                <div>已发放</div>
              </div>
            </div>
          </div>
        </div>
        <div class="logisticsInfo">
          <div class="title">
            <img src="@/assets/images/huodong.png" alt="" />
            <span>物流信息</span>
          </div>
          <div class="info">
            <div class="lists">
              <div class="list-left">
                <div>快递公司：</div>
                <div>XXXXXXXXX</div>
              </div>
              <div class="list-right">
                <div>快递单号：</div>
                <div>XXXXXXXXXXX</div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">关 闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  getSellectall,
  postElectron,
  getInfo,
  editData,
} from "@/api/volunteer/gxhzs/hdzsff/index.js";
export default {
  data() {
    return {
      infoOpen: false,
      form: {},
      open: false,
      title: "",
      tableHeigth: 0,
      queryParams: {},
      loading: false,
      tableData: [{}],
      total: 1,
      queryParams: {
        creType: 2,
        pageNum: 1,
        pageSize: 20,
      },
    };
  },
  created() {
    // //给表格一个固定值
    this.$nextTick(() => {
      this.tableHeigth =
        this.$refs.main.offsetHeight - this.$refs.search.offsetHeight - 80;
      this.getList();
    });
  },
  methods: {
    handleInfo() {
      this.title = "查看";
      this.open = true;
    },
    cancel() {
      this.open = false;
    },
  },
};
</script>
<style lang="scss" scoped>
@import "@/assets/styles/myTable.scss";
::v-deep .conversionInfo {
  .basicInfo,
  .logisticsInfo {
    .title {
      display: flex;
      align-items: center;
      img {
        width: 14px;
        margin-right: 10px;
      }
      span {
        font-size: 16px;
        font-family: "Alibaba PuHuiTi";
        font-weight: bold;
        color: #4c4949;
      }
    }
    .info {
      margin-top: 20px;
      display: grid;
      grid-column: 1fr;
      grid-row-gap: 20px;
      .lists {
        display: flex;
        align-items: center;
        justify-content: space-between;
        .list-left,
        .list-right {
          flex: 1;
          display: flex;
          align-items: center;
          div {
            &:nth-child(1) {
              font-size: 14px;
              font-family: "Alibaba PuHuiTi";
              font-weight: 400;
              color: #4c4949;
            }
            &:nth-child(2) {
              font-size: 14px;
              font-family: "Alibaba PuHuiTi";
              font-weight: 400;
              color: #807a7a;
            }
          }
        }
      }
    }
  }
  .logisticsInfo {
    margin-top: 30px;
  }
}
</style>
