<template>
  <el-dialog :visible.sync="visible" :title="$t('look')" :close-on-click-modal="false" :close-on-press-escape="false">
    <el-form :model="dataForm" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '120px' : '120px'">
          <el-form-item label="用户昵称 :" prop="nickname">
          {{dataForm.nickname}}
      </el-form-item>
          <el-form-item label="真实姓名 :" prop="realName">
          {{dataForm.realName}}
      </el-form-item>
          <el-form-item label="性别 :" prop="sex">
             {{formatSex(dataForm.sex)}}
      </el-form-item>
          <el-form-item label="年龄 :" prop="age">
              {{dataForm.age}}
      </el-form-item>
          <el-form-item label="联系电话 :" prop="mobile">
              {{dataForm.mobile}}
      </el-form-item>
          <el-form-item label="身份证号 :" prop="identityNo">
              {{dataForm.identityNo}}
      </el-form-item>
          <el-form-item label="当前状态 :" prop="status">
              {{formatState(dataForm.status)}}
<!--          <el-input v-model="dataForm.status" placeholder="当前状态（0-报名，1-审核通过，2-打卡，3-取消报名，4-审核不通过）"></el-input>-->
      </el-form-item>
          <el-form-item label="原因 :" prop="failureReason">
              {{dataForm.failureReason}}
      </el-form-item>
          <el-form-item label="审核时间 :" prop="auditTime">
              {{dataForm.auditTime}}
      </el-form-item>
          <el-form-item label="报名时间 :" prop="signupTime">
              {{dataForm.signupTime}}
      </el-form-item>
      </el-form>
    <template slot="footer">
      <el-button @click="visible = false">返回</el-button>
    </template>
  </el-dialog>
</template>

<script>
import debounce from 'lodash/debounce'
export default {
  data () {
    return {
      visible: false,
      dataForm: {
        id: '',
        actId: '',
        userId: '',
        nickname: '',
        faceImg: '',
        partyFlag: '',
        realName: '',
        sex: '',
        age: '',
        mobile: '',
        identityNo: '',
        status: '',
        failureReason: '',
        auditTime: '',
        signupTime: ''

      }
    }
  },
  computed: {
  },
  methods: {
    init () {
      this.visible = true
      this.$nextTick(() => {
        this.$refs['dataForm'].resetFields()
        if (this.dataForm.id) {
          this.getInfo()
        }
      })
    },
    // 获取信息
    getInfo () {
      this.$http.get(`/heart/actuserrelation/${this.dataForm.id}`).then(({ data: res }) => {
        if (res.code !== 0) {
          return this.$message.error(res.msg)
        }
        this.dataForm = {
          ...this.dataForm,
          ...res.data
        }
      }).catch(() => {})
    },
      formatState: function (status) {
          let state = status
          if (state === '0') {
              return '报名'
          } else if (state === '1') {
              return '审核通过'
          } else if (state === '2') {
              return '打卡'
          } else if (state === '3') {
              return '取消报名'
          } else if (state === '4') {
              return '审核不通过'
          } else if (state === '5') {
              return '确认加积分'
          } else if (state === '6') {
              return '拒绝加积分'
          }
      },
      formatSex: function (sex) {
          let state = sex
          if (state === '0') {
              return '女'
          } else if (state === '1') {
              return '男'
          }
      }
  }
}
</script>
