<template>
  <el-form ref="searchForm" :model="searchForm" inline label-width="80px">
    <el-row>
      <el-form-item label="审核状态：" label-width="90px">
        <DMRadio v-model="searchForm.checkState" :list="auditStatusOptions" all-text="全部" />
      </el-form-item>
    </el-row>
    <el-row>
      <el-form-item label="是否全款：" label-width="90px">
        <DMRadio v-model="searchForm.state" :list="stateOptions" all-text="全部" />
      </el-form-item>
    </el-row>
    <el-row>
      <el-form-item label="回款状态：" label-width="90px">
        <DMRadio v-model="searchForm.moneyState" :list="moneyStateOptions" label="dictLabel" name="dictCode" all-text="全部" />
      </el-form-item>
    </el-row>
    <el-form-item label="快速查询">
      <el-input v-model="searchForm.name" placeholder="姓名/联系方式" clearable @keyup.enter.native="handleQuery" />
    </el-form-item>
    <el-form-item label="成交时间">
      <el-date-picker v-model="searchForm.dealDate" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
    </el-form-item>
    <el-form-item label="驾校">
      <el-select v-model="searchForm.signSchool" placeholder="请选择" clearable>
        <el-option v-for="dict in schoolOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
      </el-select>
    </el-form-item>
    <el-form-item label="跟进人员">
      <el-select v-model="searchForm.followUser2" placeholder="请选择" clearable>
        <el-option v-for="dict in userOptions" :key="dict.id" :label="dict.name" :value="dict.id" />
      </el-select>
    </el-form-item>
    <el-form-item label-width="0">
      <el-button type="primary" icon="el-icon-search" @click="$emit('search')">搜索</el-button>
      <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import DMRadio from '@/components/DMRadio';
export default {
  components: {
    DMRadio
  },
  data() {
    return {
      searchForm: {
        checkState: undefined,
        state: undefined,
        moneyState: undefined,
        name: undefined,
        dealDate: [],
        signSchool: undefined,
        followUser2: undefined
      },
      auditStatusOptions: [
        { label: '待审核', value: 1 },
        { label: '已审核', value: 2 },
        { label: '驳回', value: 3 }
      ],
      stateOptions: [
        { label: '全款', value: true },
        { label: '非全款', value: false }
      ],
      moneyStateOptions: [],
      schoolOptions: [],
      userOptions: []
    };
  },
  created() {
    this.getDicts('dm_money_state').then((response) => {
      this.moneyStateOptions = response.data;
    });
  },
  methods: {
    resetQuery() {
      this.searchForm = {
        checkState: undefined,
        state: undefined,
        moneyState: undefined,
        name: undefined,
        dealDate: [],
        signSchool: undefined,
        followUser2: undefined
      };
    },
    getEmployee() {
      // getEmployee({ coach: false }).then((resp) => {
      //   if (resp.code == 200) {
      //     this.userOptions = resp.data
      //   }
      // })
    },
    getSchools() {
      // getSchools().then((resp) => {
      //   this.schoolOptions = resp.data
      // })
    }
  }
};
</script>

<style lang="scss" scoped>
</style>
