<template>
  <div class="refund-goods common">
    <div class="title">退款信息</div>
    <div
      class="spu flex-default"
      v-for="(item, index) of data.list"
      :key="`goods-item-${index}`"
    >
      <img class="thumb" :src="item.thumb" />
      <div class="info">
        <div class="name">{{ item.name }}</div>
        <div class="sku">{{item.skuProps | propFilter}}</div>
      </div>
    </div>
    <div class="info-list">
      <div class="item">
        <div class="label">退款原因</div>
        <div class="val">{{ RefundReasonTypeLabel[data.returnType] }}</div>
      </div>
      <div class="item">
        <div class="label">退款金额</div>
        <div class="val">￥{{ data.amount }}</div>
      </div>
      <!-- <div class="item">
        <div class="label">申请件数</div>
        <div class="val">1</div>
      </div> -->
      <div class="item">
        <div class="label">申请时间</div>
        <div class="val">{{ data.createTime | timeFilter }}</div>
      </div>
      <!-- <div class="item">
        <div class="label">退款编号</div>
        <div class="val">1562896325986</div>
      </div> -->
      <div class="item">
        <div class="label">补充描述</div>
        <div class="val">{{ data.returnReason }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { RefundReasonType, RefundReasonTypeLabel } from "@/enums";
export default {
  props: ["data"],
  data() {
    return {
      RefundReasonType,
      RefundReasonTypeLabel,
    };
  },
  filters: {
    propFilter(val){
      if(val && val.length != 0){
        return val.map(s => `${s.propKey}：${s.propVal}`).join("  ")
      }
      return ''
    }
  }
};
</script>

<style lang="less">
.refund-goods {
  > .title {
    font-size: 16px;
    color: #140603;
    font-weight: bold;
    line-height: 18px;
    margin-bottom: 15px;
  }
  > .spu {
    margin-bottom: 16px;
    .thumb {
      width: 100px;
      height: 100px;
      background: #d8d8d8;
      border-radius: 6px;
      margin-right: 10px;
      object-fit: cover;
    }
    .info {
      flex: 1;
      padding: 6px;
    }
    .info .name {
      color: #140603;
      font-size: 14px;
      line-height: 18px;
      margin-bottom: 9px;
    }
    .info .sku {
      font-size: 12px;
      line-height: 16px;
      color: #aeaeae;
    }
  }
  > .info-list {
    .item {
      display: flex;
      margin-bottom: 15px;
      &:last-of-type{
        margin-bottom: 0;
      }
    }
    .item .label {
      width: 75px;
      color: #aeaeae;
      font-size: 12px;
    }
    .item .val {
      flex: 1;
      color: #140603;
      font-size: 12px;
    }
  }
}
</style>


