<template>
    <div class="app-container" >
      <el-form size="small" :inline="true" label-width="68px" @submit.native.prevent>
        <el-row :gutter="20">
            <el-form-item label="手机号">
                <el-input v-model="queryParams.phone" placeholder="请输入" clearable  @keyup.enter.native="handleQuery" />
            </el-form-item>
        </el-row>
        <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-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
  
        </el-form-item>
      </el-form>
  
      <el-table v-loading="loading" :data="tableList"  >
        <el-table-column type="index" width="55" align="center" />
        <el-table-column label="手机号" align="center" prop="phone" min-width="140" />
        <el-table-column label="会员名" align="center" prop="memberName" min-width="140"/>
        <el-table-column label="车型" align="center" prop="carName" min-width="100" />
        <el-table-column label="科目" align="center" prop="subjects" min-width="100"/>
        <el-table-column label="开始时间" align="center" prop="startDate" min-width="100"/>
        <el-table-column label="结束时间" align="center" prop="endDate" min-width="100"/>

        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <!-- <el-button size="mini" type="text" icon="el-icon-download" @click="handleEdit(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" /> -->
      <VipForm v-if="dialogVisible" ref="dialogForm" :dialog-visible="dialogVisible" @update="getList" />
  
    </div>
  </template>
  
  <script>
  import { getUserMemberList } from '@/api/vip';
  import VipForm from './components/VipForm.vue'
  
  export default {
    name: 'Vip',
    components:{
        VipForm
    },
    data() {
      return {
        // 遮罩层
        loading: false,
        // 总条数
        total: 0,
        tableList: [],
        // 查询参数
        queryParams: {
            phone: undefined
        },
        dialogVisible: false,
        dialogAddVisible: false
      };
    },
    created() {
      this.getList();
    },
    methods: {
      /** 查询文件列表 */
      getList() {
        this.loading = true;
        getUserMemberList(this.queryParams).then(response => {
          this.tableList = response.data;
          // this.total = response.total;
          this.loading = false;
        });
      },
  
      /** 搜索按钮操作 */
      handleQuery() {
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.queryParams.question = '';
        this.handleQuery();
      },

      handleAdd(item) {
        this.dialogVisible = true;
        this.$nextTick(() => {
          this.$refs.dialogForm.init(item);
        });
      }
    }
  };
  </script>
  