<template>
  <div class="padding-20">
    <div class="search-box">
      <el-form ref="form"
               :inline="true"
               :model="searchForm"
               clearable
               label-width="100px"
               class="mt-10">
        <el-form-item label="座位名称:">
          <el-input v-model="searchForm.department_name" placeholder="请输入座位名称" clearable></el-input>
        </el-form-item>
        <el-form-item class="ml-10">
          <el-button icon="el-icon-search" type="primary" @click="searchSubmit">查询</el-button>
        </el-form-item>
        <el-form-item class="ml-10">
          <el-button icon="el-icon-plus" type="primary" @click="add">添加艺人</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-table :data="tableData"
              stripe
              v-loading="tableLoading"
              fit
              class="marginT-10 order-table"
              border
              :max-height="vheight">
      <el-table-column label="ID" prop="id"></el-table-column>
      <el-table-column label="头像" prop="bar_name">
        <template slot-scope="scope">
          <el-image style="width: 100px; height: 100px"
                    :src="scope.row.user_head_url"
                    :preview-src-list="[scope.row.user_head_url]">
          </el-image>
        </template>
      </el-table-column>
      <el-table-column label="昵称" prop="user_name"></el-table-column>
      <el-table-column label="手机号" prop="user_phone"></el-table-column>
      <el-table-column label="生日" prop="user_birthday"></el-table-column>
      <el-table-column label="性别" prop="user_sex"></el-table-column>
      <el-table-column label="注册时间" prop="created_at"></el-table-column>
      <!--todo 创建时间-->
      <el-table-column label="创建时间"></el-table-column>
      <!--todo 状态-->
      <el-table-column label="状态"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button type="text"
                     @click="edit(scope.row)">编辑
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      class="marginT-20"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :hide-on-single-page="true"
      :current-page="page"
      :page-size="page_size"
      :page-sizes="[10, 20, 100, 200, 300, 400]"
      background
      layout="total, sizes, prev, pager, next, jumper"
      :total="totalCount"/>
    <detail v-if="detailsDialog.show"
            v-model="detailsDialog.show"
            :exData="detailsDialog.exData"
            @success="init"></detail>
  </div>
</template>

<script>
import page from '@/mixin/page'
import detail from './details'
import axios from 'axios'

export default {
  mixins: [page],
  components: {
    detail,
  },
  data () {
    return {
      detailsDialog: {
        show: false,
        exData: {}
      },
      time: [],
      searchForm: {
        user_type: '0' // 用户类型(0用户1艺人2吧台3老板)
      },
      tableData: [],
      tableUrl: '/v1/user/member/List'
    }
  },
  methods: {
    add () {
      this.detailsDialog.exData = {}
      this.detailsDialog.show = true
    },
    edit (row) {
      this.detailsDialog.exData = row
      this.detailsDialog.show = true
    }
  },
  mounted () {
    this.init()
  },
}
</script>

<style lang="scss" scoped>
.el-dropdown {
  margin: 0 10px;

  .el-dropdown-link {
    cursor: pointer;
    color: #409EFF;
  }
}
</style>
