<template>
  <div>
    <!-- 头部导航栏 -->
    <!-- <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item>消费分期</el-breadcrumb-item>
      <el-breadcrumb-item>查询单个数据</el-breadcrumb-item>
    </el-breadcrumb> -->

    <el-card>
      <div class="filter">
        手机号：<el-input
          v-model="queryInfo.phoneNo"
          maxlength="11"
          placeholder="请输入手机号"
        ></el-input>
        <!-- 身份证号码：<el-input
          v-model="idCardNo"
          placeholder="请输入身份证号码"
        ></el-input> -->
        <el-button type="primary" @click="checkData">查询</el-button>
      </div>
      <el-table :data="dataTable" border style="width: 100%">
          <el-table-column
            prop="phoneNo"
            label="手机号"
            width="120px"
          ></el-table-column>
          <el-table-column
            prop="userId"
            label="userId"
            width="100px"
          ></el-table-column>
          <el-table-column
            prop="uuid"
            label="uuid"
            width="320px"
          ></el-table-column>
          <el-table-column
            prop="registeredFrom"
            label="注册渠道"
            width="100px"
          ></el-table-column>
          <el-table-column
            prop="nextApplyTime"
            label="过期时间"
            width="180px"
          ></el-table-column>
          <el-table-column prop="createdAt" label="创建时间" width="180px"></el-table-column>
          <el-table-column prop="status" label="状态"></el-table-column>
        </el-table>
    </el-card>
  </div>
</template>

<script>
import {queryUserData} from '@/api/checkVccData'
export default {
  data() {
    return {
      idCardNo: '',
      queryInfo: {
        namespace: window.sessionStorage.getItem('env'),
        phoneNo: ''
      },
      dataTable: []
    }
  },
  methods: {
    checkData() {
      // 手机号长度限制
      if (this.queryInfo.phoneNo === '') {
        return this.$message.error('手机号不能为空！')
      }
      if (this.queryInfo.phoneNo.length !== 11) {
        return this.$message.error('手机号长度不对！')
      }
      this.queryInfo.namespace = window.sessionStorage.getItem('env')
      queryUserData(this.queryInfo).then((resp) => {
        if (resp.data.code === 500) {
          return this.$message.error(resp.data.data)
        }
        this.dataTable.push(resp.data.data)
      })
    }
  }
}
</script>

<style lang="less" scoped>
.el-input {
    width: 200px;
    margin-right: 20px;
}
.el-table {
    margin-top: 20px;
}
</style>
