<script setup>
import { reactive, ref, toRefs } from "vue";
import { useRouter } from "vue-router";

const router = useRouter();

const data = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10,
  },
});
const { queryParams } = toRefs(data);
const queryRef = ref(null);
const total = ref(0);
const tableData = ref([]);

/**
 * 获取列表数据
 */
const getList = () => {};

/**
 * 查询列表数据
 */
const handleQuery = () => {
  queryParams.value.pageNum = 1;
  getList();
};

/**
 * 重置查询条件
 */
const resetQuery = () => {
  queryRef.value.resetFields();
  getList();
};

/**
 * 根据id删除
 * @param id
 */
const deleteById = (id) => {};

const goBack = (id) => {
  // 跳转到"/admin/index" query参数 id
  router.push({
    path: "/admin/index",
    query: {
      id,
    },
  });
};

/**
 * 根据id查询
 */
const getById = (id) => {};
</script>

<template>
  <div class="app-container">
    <el-row>
      <el-col :span="6">
        <el-card></el-card>
      </el-col>
      <el-col :span="12"></el-col>
    </el-row>
    <el-form ref="queryRef" :model="queryParams" inline>
      <el-form-item label="企业名称">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入企业名称"
        ></el-input>
      </el-form-item>
      <!--      日期时间段查询-->
      <el-form-item label="时间段">
        <el-date-picker
          v-model="queryParams.timeRange"
          end-placeholder="结束日期"
          range-separator="至"
          start-placeholder="开始日期"
          type="datetimerange"
          value-format="YYYY-MM-dd HH:mm:ss"
        ></el-date-picker>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="handleQuery">查询</el-button>
        <!--        重置-->
        <el-button type="danger" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <!--    element plus 表格 , 列:订单号,企业名称,所属领域,会员等级,会员金额,购买会员时间,操作-->
    <el-table size="large" :data="tableData" class="withdraw-table">
      <el-table-column label="订单号" prop="id" width="180"></el-table-column>
      <el-table-column
        label="企业名称"
        prop="name"
        width="180"
      ></el-table-column>
      <el-table-column
        label="所属领域"
        prop="field"
        width="180"
      ></el-table-column>
      <el-table-column
        label="会员等级"
        prop="level"
        width="180"
      ></el-table-column>
      <el-table-column
        label="会员金额"
        prop="amount"
        width="180"
      ></el-table-column>
      <el-table-column
        label="购买会员时间"
        prop="buyTime"
        width="180"
      ></el-table-column>
      <el-table-column label="操作" width="180">
        <template #default="{ row }">
          <el-button type="primary" @click="goBack(row.id)"
            >查看详情
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      ref="pagination"
      v-model:limit="queryParams.pageSize"
      v-model:page="queryParams.pageNum"
      :total="total"
      @pagination="getList"
    />
  </div>
</template>

<style lang="scss" scoped>
//:deep(.el-table--large) {
//font-size: 18px;
//th {
//font-size: 18px;
//}
//}
</style>
