<template>
  <div class="complaint-item" @click="toDetail">
    <div class="item-top flex-default">
      <div class="code"> 投诉单号：{{ itemData.complaintId }} </div>
      <div :class="itemData.complaintStatus == 1 ? ['active', 'status'] : ['status']">
        {{ itemData.complaintStatus === 1 ? "待处理" : "已完成" }}
      </div>
    </div>
    <div class="item-content">
      <div class="desc">
        {{ itemData.description }}
      </div>
      <div class="imglist">
        <image
          :src="item"
          :key="index"
          v-for="(item, index) in itemData.attachments"
        />
      </div>
    </div>
    <div class="item-result flex-default" v-show="itemData.complaintStatus != 1">
      处理结果：{{ itemData.result || "--" }}
    </div>
    <div class="item-footer flex-default">
      <div class="code"> 关联单号：{{ itemData.orderId }} </div>
      <div class="time">
        {{ itemData.createTime | timeFilter }}
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ["itemData"],
  data() {
    return {};
  },
  methods: {
    toDetail() {
      let params = { id: this.itemData.id };
      this.$router.push({ name: "complaint-detail", params });
    },
  },
};
</script>
<style lang="less">
.complaint-item {
  background-color: #ffffff;
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 16px;
  .item-top {
    justify-content: space-between;
    .code {
      font-size: 13px;
      color: #140603;
      line-height: 14px;
    }
    .status {
      color: #FA9F37;
      font-weight: bold;
      font-size: 13px;
      line-height: 12px;
    }
    .active {
      color: #2C66F5;
    }
  }
  .item-content {
    margin-top: 30px;
    .desc {
      font-size: 15px;
      color: #140603;
      line-height: 17px;
    }
    .imglist {
      margin-top: 8px;
      overflow: hidden;
      img {
        width: 58px;
        height: 58px;
        border-radius: 3px;
        float: left;
        background-color: #eaeaea;
        margin: 0 12px 12px 0;
        &:nth-child(5n) {
          margin-right: 0;
        }
      }
    }
  }
  .item-result {
    background-color: #fbfafa;
    border-radius: 8px;
    min-height: 36px;
    margin: 1px 0 22px 0;
    padding: 10px 15px;
    font-size: 13px;
    color: #140603;
    font-weight: bold;
    line-height: 18px;
    flex-wrap: wrap;
    align-items: center;
  }
  .item-footer {
    color: #999999;
    justify-content: space-between;
    margin-top: 10px;
    .code,
    .time {
      font-size: 12px;
      line-height: 14px;
    }
  }
  .flex-default {
    .code {
      width: 60%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
}
</style>
