<template>
  <div class="refund-state common">
    <div :class="statusTxt ? ['tip'] : ['tip', 'tip-single']">
      <div class="title">{{ statusTitle }}</div>
      <div class="text">{{ statusTxt }}</div>
    </div>
    <template v-if="isReviewSuccess">
      <div class="line" />
      <div class="addr">
        <div class="title flex-default">
          <span class="name">收货人：{{ data.name }}</span>
          <span class="phone">{{ data.phone }}</span>
        </div>
        <div class="content">
          {{ data.addr }}
          <font
            class="copy"
            @click="handleCopy(`${data.name}  ${data.phone}  ${data.addr}`)"
          >
            复制
          </font>
        </div>
      </div>
    </template>
  </div>
</template>

<script>
import { DeliveryRefundStatus } from "@/enums";
export default {
  props: ["data", "status"],
  data() {
    return {
      statusTxtMap: {
        [DeliveryRefundStatus.APPLY]: {
          title: "您的服务单已申请成功，请等待后台审核。",
        },
        [DeliveryRefundStatus.REVIEW_SUCCESS]: {
          title: "商家已同意退货申请，请尽快退货。",
          txt: "未与商家协商一致，请勿使用到付或平邮，以免商家拒签货物",
        },
        [DeliveryRefundStatus.EXPRESS]: {
          title: "已寄回商品，等待商家收货。",
          txt: "如果商家收到货并验货无误，将退款给您",
        },
        [DeliveryRefundStatus.SHOP_REFUND]: { title: "退款中。" },
        [DeliveryRefundStatus.SUCCESS]: { title: "服务已完成，感谢您的支持。" },
        [DeliveryRefundStatus.REVIEW_FAIL]: { title: "商家已驳回退货申请。" },
        [DeliveryRefundStatus.CANCEL]: { title: "您已撤销退款。" },
      },
    };
  },
  computed: {
    statusTitle() {
      return this.statusTxtMap[this.status].title;
    },
    statusTxt() {
      return this.statusTxtMap[this.status].txt;
    },
    isReviewSuccess() {
      return this.status == DeliveryRefundStatus.REVIEW_SUCCESS;
    },
    isFail() {
      return this.status == DeliveryRefundStatus.REVIEW_FAIL;
    },
  },
};
</script>

<style lang="less">
.refund-state {
  margin-top: -16px;
  > .tip {
    .title {
      color: #010101;
      font-size: 14px;
      line-height: 16px;
      margin-bottom: 5px;
      font-weight: bold;
    }
    .text {
      font-size: 12px;
      line-height: 14px;
      color: #aeaeae;
    }
  }
  > .tip-single {
    padding: 13px 0;
  }
  > .line {
    margin: 15px 0;
    height: 1px;
    box-shadow: 0px 1px 0px 0px rgba(241, 241, 241, 1);
  }
  > .addr {
    .title {
      align-items: center;
      margin-bottom: 6px;
    }
    .title .name {
      font-weight: bold;
      color: #010101;
      margin-right: 7px;
    }
    .title .phone {
      color: #aeaeae;
      font-size: 12px;
    }
    .content {
      color: #666666;
      font-size: 12px;
      line-height: 16px;
    }
    .content .copy {
      color: #007aff;
      margin-left: 6px;
    }
  }
}
</style>


