<template>
  <div class="progress">
    <div v-if="list.length">
      <div class="card_list" v-for="(item,index) in list" :key="index">
        <div class="card" @click="$linkTo(`./details?id=${item.id}`)">
          <div class="top">
            <div class="title">{{ item.riskDescription }}</div>
            <div class="time">{{ item.declareTime }}</div>
          </div>
          <div class="bottom">
            <span :style="{background: item.status == 0? '#FF883C':item.status == 1? '#1AAAFF': item.status==2? '#FF4466': '#42D784'}"></span>
            <span :class="item.status == 0? 'status0': item.status==1? 'status1': item.status==2? 'status3': 'status2'">{{ $dict.getLabel('helpDeclarationStatus',item.status) }}</span>
          </div>
        </div>
      </div>
    </div>
    <AiEmpty v-else description="暂无数据"/>
  </div>
</template>

<script>
export default {
  name: "progress",
  appName: "进度查询",
  data() {
    return {
      list: [],
      current: 1,
    }
  },
  onShow() {
    this.$dict.load('helpDeclarationStatus')
    this.getList()
  },
  methods: {
    getList() {
      this.$instance.post('/app/apphelpdeclarationinfo/listByApplet',null,{
        params: {
          current: this.current
        }
      }).then((res) => {
        if(res?.data) {
          this.list = this.current == 1? res.data.records : [...this.list,...res.data.records]
        }
      })
    },
    onReachBottom() {
      this.current ++
      this.getList()
    }
  }
}
</script>

<style lang="scss" scoped>
.progress {
  padding-top: 24px;
  .card_list {
    padding: 0 32px;
    box-sizing: border-box;
    .card {
      background: #FFFFFF;
      box-shadow: 0px 0px 8px 0px #00000005;
      border-radius: 16px;
      margin-bottom: 24px;
      .top {
        padding: 32px;
        box-sizing: border-box;
        border-bottom: 2px solid #DDDDDD;
        .title {
          color: #333333;
          font-size: 32px;
          font-weight: 600;
          overflow:hidden; 
          text-overflow:ellipsis;
          display:-webkit-box;
          -webkit-box-orient:vertical;
          -webkit-line-clamp:2;
        }
        .time {
          margin-top: 32px;
          color: #999999;
          font-size: 26px;
        }
      }
      .bottom {
        padding: 32px;
        box-sizing: border-box;
        span:first-child {
          display: inline-block;
          width: 8px;
          height: 8px;
          border-radius: 50%;
          margin-right: 8px;
          background: #FF4466;
        }
      }
      .status0 {
        color: #FF883C
      }
      .status1 {
        color: #1AAAFF
      }
      .status2 {
        color: #42D784
      }
      .status3 {
        color: #FF4466
      }
    }
  }
}
</style>