<template>
  <div class="app-container">
    <div style="margin-left: 35%;font-size: 25px;margin-bottom: 30px;font-weight: bold;color: red">输入对应的条件 进行查询</div>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="98px">
      <el-form-item label="车牌号" prop="carnum">
        <el-input
          v-model="queryParams.carnum"
          placeholder="请输入客户名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="名称" prop="bren">
        <el-input
          v-model="queryParams.bren"
          placeholder="请输入客户名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="手机号" prop="brphone">
        <el-input
          v-model="queryParams.brphone"
          placeholder="请输入手机号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="委托人名称" prop="wtr">
        <el-input
          v-model="queryParams.wtr"
          placeholder="请输入委托人名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="委托人手机号" prop="wtrphone">
        <el-input
          v-model="queryParams.wtrphone"
          placeholder="请输入委托人手机号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <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-form-item>
    </el-form>
    <el-table v-loading="loading" :data="customerInfoList" @selection-change="handleSelectionChange">

      <el-table-column label="客户名称" align="center" prop="bren" />
      <el-table-column label="客户手机号" align="center" prop="brphone" />
      <el-table-column label="委托人名称"  align="center" prop="wtr" />
      <el-table-column label="委托人手机号" align="center" prop="wtrphone"/>
      <el-table-column label="车牌号" align="center" prop="carnum"/>
      <el-table-column label="委托日期" align="center" prop="year">
        <template slot-scope="scope">
          {{scope.row.year+'-'+scope.row.month+'-'+scope.row.day}}
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>
<script>
import { partnerGetWtList} from "./api/customer";

export default {
  name: "CustomerInfo",
  dicts: ['sys_user_sex','jcz_role'],
  data() {
    return {
      tou:false,
      // 遮罩层
      loading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 客户信息表格数据
      customerInfoList: [],
      // userCarList:[],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        customerName: null,
        customerPhone: null,
        carNum:null,
      },
      // 表单参数
      form: {
      },
    };
  },
  created() {
  },
  methods: {
    /** 查询客户信息列表 */
    getList() {

      if (!this.queryParams.bren&&!this.queryParams.brphone&&!this.queryParams.wtr&&!this.queryParams.wtrphone){
        this.$message.warning("请输入查询条件")
        return
      }
      this.loading = true;
      partnerGetWtList(this.queryParams).then(response => {
        this.customerInfoList = response.rows;
        // this.userCarList = response.rows.userCarList
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
  }
};
</script>
