<template>
  <div class="detail" v-if="pageShow">
    <div class="info">
      <div class="info-top">
        <div class="left">
          <image src="/static/images/avatar.png"/>
          <h2>{{ info.name || info.phone }}</h2>
        </div>
        <div class="right">
          <image src="/static/images/phone.png"/>
          <p>拨打电话</p>
        </div>
      </div>
      <div class="info-item__wrapper">
        <div class="info-item">
          <label>风险类型：</label>
          <span>大额医疗支出</span>
        </div>
        <div class="info-item">
          <label>联系电话：</label>
          <span>13782909781</span>
        </div>
        <div class="info-item">
          <label>所在地址：</label>
          <span>{{ info.addressArea }} {{ info.address }}</span>
        </div>
        <div class="info-item">
          <label>情况描述：</label>
          <span>全身大面积烧伤，预计手术费30万元</span>
        </div>
      </div>
    </div>
    <div class="result" v-if="false">
      <div class="result-top">
        <h2>处理结果</h2>
        <span>已解除风险</span>
      </div>
      <div class="info-item__wrapper">
        <div class="info-item">
          <label>受理人：</label>
          <span>张三</span>
        </div>
        <div class="info-item">
          <label>处理时间：</label>
          <span>2021-10-10 10:10:10</span>
        </div>
        <div class="info-item">
          <label>联系方式：</label>
          <span>17964042574</span>
        </div>
        <div class="info-item">
          <label>处理结果：</label>
          <span>经现场了解，该人员家庭有多出房产，无返贫风险倾向。</span>
        </div>
        <div class="info-item">
          <label>图片：</label>
          <div class="imgs">
            <image v-for="(item, index) in 6" :key="index" src="/static/images/avatar.png"/>
          </div>
        </div>
      </div>
    </div>
    <div class="footer">
      <span>纳入监测对象</span>
      <span @click="linkTo">解除预警</span>
    </div>
  </div>
</template>

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

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

  onLoad(query) {
    uni.showLoading()
    this.id = query.id

    this.getInfo(query.id)
  },

  methods: {
    linkTo() {
      uni.navigateTo({
        url: './povertyMonitorForm'
      })
    },

    getInfo(id) {
      this.$http.post(`/app/apppreventionreturntopoverty/queryDetailById?id=${id}`).then(res => {
        if (res.code === 0) {
          this.info = res.data

          this.pageShow = true
        }

        uni.hideLoading()
      })
    }
  }
}
</script>

<style lang="scss">
.detail {
  padding-bottom: 122px;

  * {
    box-sizing: border-box;
  }

  .footer {
    display: flex;
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 1;
    width: 100%;
    height: 112px;

    span {
      flex: 1;
      height: 112px;
      line-height: 112px;
      text-align: center;
      color: #FF4466;
      font-size: 32px;
      background: #fff;

      &:last-child {
        color: #fff;
        background: #3192F4;
      }
    }
  }

  .info {
    background: #fff;

    .info-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 136px;
      padding: 0 32px;
      background: #FFFFFF;
      border-bottom: 1px solid #D8DDE6;

      .left {
        display: flex;
        align-items: center;

        image {
          width: 80px;
          height: 80px;
          margin-right: 16px;
        }

        h2 {
          color: #333333;
          font-size: 36px;
          font-weight: 600;
        }
      }

      .right {
        text-align: center;

        image {
          width: 64px;
          height: 64px;
        }

        p {
          color: #3D94FB;
          font-size: 24px;
        }
      }
    }
  }

  .result {
    margin-top: 20px;
    background: #fff;

    .result-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 96px;
      padding: 0 32px;
      border-bottom: 1px solid #DDDDDD;

      h2 {
        font-size: 32px;
        color: #333;
        font-weight: 600;
      }

      span {
        color: #2EA222;
        font-size: 30px;
      }
    }
  }

  .info-item__wrapper {
    padding: 32px;

    .info-item {
      display: flex;
      margin-bottom: 12px;

      label {
        flex-shrink: 0;
        width: 150px;
        line-height: 1.3;
        text-align: right;
        color: #999999;
        font-size: 30px;
      }

      span {
        flex: 1;
        line-height: 1.3;
        text-align: justify;
        color: #343D65;
      }

      .imgs {
        flex: 1;

        image {
          width: 160px;
          height: 160px;
          margin-right: 16px;
          margin-bottom: 16px;
          border-radius: 4px;
        }
      }
    }
  }
}
</style>
