<template>
<div class="app-container calendar-list-container">
  <!-- 筛选条件 -->
  <div class="filter-container">
    <!-- 筛选条件 -->
    <div class="filter-container">
      <el-date-picker class="filter-item"
          v-model="params.date" style="display: inline-flex;width:230px" 
          type="daterange" 
          placeholder="请选择订单日期范围"
          start-placeholder="开始日期"
          end-placeholder="结束日期">
        </el-date-picker>
      <el-select v-model="params.payType" style="width: 120px" class="filter-item" clearable placeholder="支付类型">
        <el-option v-for="item in options.statu"
          :key="item.value"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>
      <el-input @keyup.enter.native="handleSearch" style="width: 138px;" class="filter-item" clearable placeholder="用户手机号" v-model="params.search_eq_mobile"></el-input>
      <!-- <el-input @keyup.enter.native="handleSearch" style="width: 200px;" class="filter-item" clearable placeholder="订单号" v-model="params.orderSn"></el-input> -->
      <el-input @keyup.enter.native="handleSearch" style="width: 170px;" class="filter-item" placeholder="昵称" v-model="params.search_like_nickname"></el-input>

      <el-button class="filter-item" type="primary" v-waves icon="search" @click="handleSearch">搜索</el-button>
      <!-- <el-button class="filter-item pull-right" type="success" icon="edit" @click="handleCreate">添加</el-button> -->
    </div>
    <!-- <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="全部" name="1">
      </el-tab-pane>
      <el-tab-pane label="已取消" name="2"></el-tab-pane>
      <el-tab-pane label="未支付" name="3"></el-tab-pane>
      <el-tab-pane label="已支付" name="4"></el-tab-pane>
    </el-tabs> -->
  </div>

  <!-- 列表数据 -->
  <Pagination uri="/member/enter/veneu/logs" :request-params="params" ref="pagination">
      <el-table-column align="center" label="用户人脸">
        <template scope="scope">
          <img :src="scope.row.faceUrl" style="width:100px;height:auto">
        </template>
      </el-table-column>

      <!-- 用户ID -->
      <el-table-column align="center" label="用户昵称">
        <template scope="scope">
          <span>{{scope.row.nickname}}</span>
        </template>
      </el-table-column>
      
      <!-- 手机号 -->
      <el-table-column align="center" label="手机号">
        <template scope="scope">
          <span>{{scope.row.mobile}}</span>
        </template>
      </el-table-column>

      <!-- 场馆ID -->
      <el-table-column align="center" label="类型">
        <template scope="scope">
          <span v-text="getType(scope.row.type)"></span>
        </template>
      </el-table-column>

      <!-- 入场支付订单 -->
      <!-- <el-table-column align="center" label="订单">
        <template scope="scope">
          <span>{{scope.row.orderSn}}</span>
        </template>
      </el-table-column> -->

      <!-- 入场支付方式 -->
      <!-- <el-table-column align="center" label="支付方式">
        <template scope="scope">
          <span v-if="scope.row.payType === 1">余额支付</span>
          <span v-if="scope.row.payType === 2">会员卡</span>
        </template>
      </el-table-column> -->

      <!-- 价格 -->
      <!-- <el-table-column align="center" label="价格">
        <template scope="scope">
          <span>{{scope.row.price}}</span>
        </template>
      </el-table-column> -->

      <!-- 进场时间 -->
      <el-table-column align="center" label="进场时间">
        <template scope="scope">
          <span>{{scope.row.createdTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
        </template>
      </el-table-column>

    <el-table-column label="操作" align="center" width="150">
      <template scope="scope">
        <el-button size="small" type="text" @click="handleEdit(scope.row.id)">查看</el-button>
      </template>
    </el-table-column>
  </Pagination>
</div>
</template>

<script>
import { remove } from '@/api//member/enter/veneu/log'
import waves from '@/directive/waves.js'// 水波纹指令
import Pagination from '@/components/Pagination'
import moment from 'moment'

export default {
  name: 'memberEnterVeneuLog_list',
  components: { Pagination },
  directives: {
    waves
  },
  data() {
    return {
      activeName: '1',
      params: {
        search_eq_mobile: '',
        orderSn: '',
        starTime: '',
        endTime: '',
        search_like_nickname: '',
        payType: undefined
      },
      options: {
        statu: [
          {
            value: 1,
            label: '余额支付'
          },
          {
            value: 2,
            label: '会员卡'
          }
        ]
      }
    }
  },
  created() {
  },
  methods: {
    /**
     * 搜索篮球进场订单
     */
    handleSearch() {
      if (this.params.date != null) {
        this.params.endTime = moment(this.params.date[1]).format('YYYY-M-D HH:mm:ss')
        this.params.starTime = moment(this.params.date[0]).format('YYYY-M-D HH:mm:ss')
      } else {
        this.params.starTime = ''
        this.params.endTime = ''
      }
      this.$refs.pagination.handleSearch()
    },
    getType(type) {
      if (type === 0) {
        return '入场'
      } else if (type === 1) {
        return '出场'
      }
    },

    /**
     * 编辑篮球进场订单
     */
    handleEdit(id) {
      this.$router.push({ path: '/member/enter/veneu/log/edit', query: { id: id }})
    },

    /**
     * 创建篮球进场订单
     */
    handleCreate() {
      this.$router.push({ path: '/member/enter/veneu/log/edit' })
    },

    /**
     * 删除篮球进场订单
     */
    handleDelete(row) {
      this.$confirm('确认删除该篮球进场订单？').then(_ => {
        remove(row.id).then(response => {
          this.$refs.pagination.removeItem(row)
        })
      }).catch(_ => {})
    }
  }
}
</script>

