<template>
  <div class="neighborDetail">
    <div class="type">
      <span>审核状态</span>
      <span :style="{color: data.status==0? '#FF883C': data.status==1? '#42D784': '#FF4466'}">
        {{ $dict.getLabel('partyFourLinkageStatus',data.status) }}
      </span>
    </div>
    <div class="user-info">
      <div class="item">
        <span>事件日期</span>
        <span>{{ data.linksageDate }}</span>
      </div>
      <div class="item">
        <span>四邻对象</span>
        <span>{{ data.residentName }}</span>
      </div>
      <div class="description">
        <div>事件描述</div>
        <div>
          {{ data.description }}
        </div>
      </div>
    </div>
    <div class="btn">
      <div class="delBtn" @click="delBtn">删除联动记录</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'neighborDetail',
  data() {
    return {
      id: '',
      data: {}
    }
  },
  onLoad(o) {
    this.$dict.load('partyFourLinkageStatus')
    this.id = o.id
    this.getDetail()
  },
  methods: {
    getDetail() {
      this.$instance.post('/app/apppartyfourlinkage/queryDetailById',null,{
        params: {
          id: this.id,
        }
      }).then(res => {
        if(res.code == 0) {
          this.data = res.data
        }
      })
    },
    delBtn() {
      this.$dialog.confirm({content: '确定要删除该记录吗？'}).then(()=>{
        this.$instance.post(`/app/apppartyfourlinkage/delete?ids=${this.id}`).then(res => {
          if(res.code == 0) {
            this.$u.toast('删除成功')
            setTimeout(() => {
              uni.navigateBack()
            },600)
          }
        })
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.neighborDetail {
  .type {
    display: flex;
    justify-content: space-between;
    box-sizing: border-box;
    padding: 32px 32px;
    background: #FFF;
    span:first-child {
      color: #999999;
    }
  }
  .user-info {
    margin-top: 24px;
    padding: 0 32px;
    box-sizing: border-box;
    background: #FFF;
    .item {
      display: flex;
      justify-content: space-between;
      padding: 32px 0;
      border-bottom: 1px solid #DDDDDD;
      span:first-child {
        color: #999999;
      }
    }
    .description {
      padding: 32px 0;
      div:first-child {
        margin-bottom: 20px;
        color: #999999;
      }
    }
  }
  .btn {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    padding: 16px 32px;
    box-sizing: border-box;
    background: #F3F6F9;
    .delBtn {
      height: 88px;
      line-height: 88px;
      text-align: center;
      color: #FF4466;
      border: 1px solid #FF4466;
      border-radius: 16px;
    }
  }
}
</style>