<template>
  <ai-detail>
    <template slot="title">
      <ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
      </ai-title>
    </template>
    <template slot="content">
      <ai-card title="基本信息">
        <template #content>
          <ai-wrapper>
            <ai-info-item label="姓名" :value="info.name"></ai-info-item>
            <ai-info-item label="联系方式" :value="info.phone"></ai-info-item>
            <ai-info-item label="风险类型" :value="dict.getLabel('fpRiskType', info.riskType)"></ai-info-item>
            <ai-info-item label="身份证号" :value="info.idNumber"></ai-info-item>
            <ai-info-item label="所在地区" :value="info.areaName"></ai-info-item>
            <ai-info-item label="联系地址" isLine :value="info.address"></ai-info-item>
            <ai-info-item label="备注说明" isLine :value="info.remarks"></ai-info-item>
          </ai-wrapper>
        </template>
      </ai-card>
    </template>
  </ai-detail>
</template>

<script>
  export default {
    name: 'Detail',

    props: {
      instance: Function,
      dict: Object,
      params: Object
    },

    data () {
      return {
        info: {},
        id: ''
      }
    },

    created () {
      if (this.params && this.params.id) {
        this.id = this.params.id
        this.getInfo(this.params.id)
      }
    },

    methods: {
      getInfo (id) {
        this.instance.post(`/app/apppreventionreturntopovertyriskperson/queryDetailById?id=${id}`).then(res => {
          if (res.code === 0) {
            this.info = res.data
          }
        })
      },

      cancel (isRefresh) {
        this.$emit('change', {
          type: 'List',
          isRefresh: !!isRefresh
        })
      }
    }
  }
</script>

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