<template>
  <div class="app-container">
    <div v-if="showSurrender">
      <el-radio-group v-model="examine" size="">
        <el-radio-button label="全部"></el-radio-button>
        <el-radio-button label="待审核"></el-radio-button>
        <el-radio-button label="审核驳回"></el-radio-button>
        <el-radio-button label="审核通过"></el-radio-button>
        <el-radio-button label="已退押金"></el-radio-button>
      </el-radio-group>
      <br /><br />
      <!-- 筛选条件 -->
      <div>
        <el-form
          ref="searchForm"
          :model="searchForm"
          label-width="160px"
          size="small"
          label-position="left"
        >
          <el-row :gutter="20">
            <el-col :xs="24" :sm="12" :lg="6">
              <el-form-item label="工程登录(信息)编号" prop="">
                <el-input placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="6">
              <el-form-item label="经销商编码" prop="">
                <el-input placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="6">
              <el-form-item label="经销商名称" prop="">
                <el-input placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="6">
              <el-form-item label="工程名称" prop="">
                <el-input placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="6">
              <el-form-item label="发货申请日期" prop="">
                <el-date-picker
                  class="dateStyle"
                  type="date"
                  placeholder="选择日期"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="6">
              <el-form-item label="产品名称" prop="">
                <el-input placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="6">
              <el-form-item label="规格型号" prop="">
                <el-input placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>

            <el-col :xs="24" :sm="24" :lg="6">
              <el-form-item label="" class="fr">
                <el-button size="small">清空</el-button>
                <el-button size="small" type="primary">搜索</el-button>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <!-- 按钮 -->
      <div class="btn-group clearfix">
        <div class="fr">
          <el-button type="primary" size="small">导出</el-button>
        </div>
      </div>
      <!-- 列表 -->
      <div class="mymain-container">
        <div class="table">
          <el-table
            v-loading="listLoading"
            :data="dataList"
            element-loading-text="Loading"
            border
            fit
            highlight-current-row
            stripe
          >
            <el-table-column
              align="center"
              label="工程登录编码"
              prop="refEnginRecordNo"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="center"
              label="工程名称"
              prop="refProjectName"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="center"
              label="经销商编码"
              prop="customerId"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="center"
              label="经销商名称"
              prop="customerName"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="center"
              label="押金金额"
              prop="depositAmount"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="center"
              label="状态"
              prop=""
              min-width="160"
              show-overflow-tooltip
            >
              <template v-slot="{ row }">
                <el-tag v-show="row.examineStatus == 'SAVE'">保存</el-tag>
                <el-tag v-show="row.examineStatus == 'WAIT'">保存</el-tag>
                <el-tag v-show="row.examineStatus == 'OK'">保存</el-tag>
                <el-tag v-show="row.examineStatus == 'FAIL'">保存</el-tag>
              </template>
            </el-table-column>
            <el-table-column
              align="center"
              label="操作"
              min-width="160"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <el-button
                  type="text"
                  class="textColor"
                  @click="examineFn(scope.row.depositManageId)"
                  >审批</el-button
                >

                <el-button type="text" class="textColor">详情</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <!-- 分页 -->
        <div class="fr">
          <el-pagination
            :current-page="currentPage"
            :page-sizes="[10, 20, 30, 50]"
            :page-size="10"
            layout="total, sizes, prev, pager, next, jumper"
            :total="listTotal"
          >
          </el-pagination>
        </div>
      </div>
    </div>
    <RefundListDetail :detailId="detailId" v-else />
  </div>
</template>

<script>
import { getDepositManageList } from "@/api/engin_deposit/refund_list";
import RefundListDetail from "./components/refund_list-detail.vue";
export default {
  components: {
    RefundListDetail,
  },
  data() {
    return {
      currentPage: 1, // 当前页码
      pageSize: 10, // 每页数量
      listTotal: 0, // 列表总数
      dataList: [], // 列表数据
      searchForm: {}, //搜索表单
      listLoading: false, // 列表加载loading
      examine: "全部",
      showSurrender: true,
      detailId: "",
    };
  },
  created() {
    this.getDataList({
      pageSize: this.pageSize,
      pageNum: this.currentPage,
      confirmName: "",
      createName: "",
      customerKeyword: "",
      endDeliverTime: "",
      enginOrderNo: "",
      enginOrderType: "",
      examineStatus: "",
      refEnginRecordNo: "",
      refProjectName: "",
      refUseUnit: "",
      startDeliverTime: "",
    });
  },
  methods: {
    async getDataList(data) {
      const res = await getDepositManageList(data);
      this.dataList = res.data.records;
      this.listTotal = res.data.total;
    },
    examineFn(id) {
      this.detailId = id;
      this.showSurrender = false;
    },
  },
};
</script>

<style lang="scss" scoped>
.dateStyle {
  width: 100%;
}
</style>
