<!--导游预约信息-->
<template>
  <div class="app-container">
    <el-form ref="queryForm" :inline="true" :model="queryParams" label-width="68px" size="small">
      <el-form-item label="名称" prop="name">
        <el-input v-model="queryParams.name"/>
      </el-form-item>
      <el-form-item>
        <el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table v-loading="loading" :data="tableData">
      <el-table-column label="序号" type="index"/>
      <el-table-column label="导游姓名" prop="tourGuideName"/>
      <el-table-column label="开始时间" prop="startTime"/>
      <el-table-column label="结束时间" prop="endTime"/>
      <el-table-column label="联系电话" prop="phone"/>
    </el-table>
    <pagination
      v-show="total>0"
      :limit.sync="queryParams.pageSize"
      :page.sync="queryParams.pageNum"
      :total="total"
      @pagination="getList"/>
  </div>
</template>

<script>
import {appointmentPage} from '@/api/liandao/tourGuide.js'

export default {
  name: "TourGuideAppointment",
  created() {
    this.getList();
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: '',
      },
      //表格数据
      tableData: [],
      // 总数
      total: 0,
    }
  },
  methods: {
    /** 查询数据列表 */
    getList() {
      this.loading = true;
      appointmentPage(this.queryParams).then(resp => {
          if (resp.code == 200) {
            this.tableData = resp.rows;
            this.total = resp.total;
            this.loading = false;
          }
        }
      );
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
  }
}
</script>
