<!-- 接待人员详情页 -->
<template>
  <div class="app-container">
    <el-form  ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="68px" label-position="top">
      <el-form-item label="时间" prop="type">
        <el-radio-group v-model="queryParams.type">
          <el-radio label="1">今日接待</el-radio>
          <el-radio label="2">本月接待</el-radio>
        </el-radio-group>      
      </el-form-item>
      <el-form-item label="到场状态" prop="arrivalStatusList">
        <el-checkbox-group v-model="queryParams.arrivalStatusList">
            <el-checkbox :label="1">未到场</el-checkbox>
            <el-checkbox :label="2">到场未成交</el-checkbox>
            <el-checkbox :label="3">到场已成交</el-checkbox>
        </el-checkbox-group>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
        <el-button type="primary" icon="el-icon-back" size="mini" @click="back">返回</el-button>

      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="coachList">
      <el-table-column type="index" width="50" align="center" />
      <el-table-column label="学员姓名" align="center" prop="name" />
      <el-table-column label="联系方式" align="center" prop="phone" />
      <el-table-column label="到场状态" align="center" prop="arrivalStatus" >
        <template scope="scope">
          <el-tag v-if="scope.row.arrivalStatus == 1">未到场</el-tag>
          <el-tag v-if="scope.row.arrivalStatus == 2">到场未成交</el-tag>
          <el-tag v-if="scope.row.arrivalStatus == 3">到场已成交</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark" />
    </el-table>
  </div>
</template>

<script>
import { getCountDetail} from '@/api/zs/feedbackDetail';
export default {
  data() {
    return {
      // 遮罩层
      loading: false,
     
      // 总条数
      total: 0,
      // 教练表格数据
      coachList: [],
      // 查询参数
      queryParams: {
        type: null, // 1本日统计 2本月统计
        coachId: null,
        arrivalStatusList: undefined
      }
    };
  },
  created() {
    this.queryParams.type = this.$route.query.type;
    this.queryParams.coachId = this.$route.query.coachId
    if(this.queryParams.arrivalStatusList == undefined){
      this.queryParams.arrivalStatusList = [1,2]
    }
    this.getList()
  },
  methods: {
    /** 查询教练列表 */
    getList() {
      this.loading = true;
      getCountDetail(this.queryParams).then(resp=> {
        if(resp.code == 200 && resp.data){
          this.coachList = resp.data
          this.loading = false
        }
      })
    },
    back(){
      window.history.back()
    }
  }
};
</script>
