<template>
  <view v-if="orderStatus == 11" class="prepayArea" :class="{ listPage: listPage }">
    <span
      v-if="
        !!orderData &&
          orderData.giftCardReturnInfo &&
          orderData.giftCardReturnInfo.giftCardReturnAmt
      "
      class="giftCardReturnInfo"
    >
      <span class="content">返{{ orderData.giftCardReturnInfo.giftCardReturnAmt }}元礼品卡</span>
    </span>
    <button class="prepayBtn" @click.stop="clickBtn">
      付款
    </button>
  </view>
</template>
<script>
export default {
  props: {
    orderStatus: {
      type: [Number, String],
      default: ''
    },
    orderData: {
      type: Object,
      default() {
        return {};
      }
    },
    listPage: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    clickBtn() {
      this.$emit('clickBtn');
    }
  }
};
</script>
<style lang="less" scoped>
// 因待付款增加返礼品卡标识，无法使用cherry-ui button组件进行二次开发
.prepayArea {
  display: inline-block;
  position: relative;
  margin-left: @padding-unit;
  &.listPage {
    margin-top: @padding-sm;
  }
  .prepayBtn {
    display: block;
    position: relative;
    color: @red;
    border: 1px solid @red;
    background: @white;
    width: 86px;
    border-radius: 999px;
    height: 30px;
    z-index: 2;
    font-size: 14px;
  }
  .giftCardReturnInfo {
    max-width: 86px;
    position: absolute;
    right: 0.5px;
    top: -11px;
    display: inline-block;
    // padding: 0 @padding-unit;
    height: 25px;
    background-image: linear-gradient(270deg, #ff5d00 50%, #fff 91%);
    color: @white;
    font-size: 8px;
    // box-sizing: border-box;
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
    border-bottom-left-radius: 7px;
    border-bottom-right-radius: 0;
    display: flex;
    align-items: flex-start;
    .content {
      max-width: 86px;
      position: relative;
      padding: 0 @padding-unit + 2 0 @padding-unit;
      display: inline-block;
      box-sizing: border-box;
      background-image: linear-gradient(270deg, #ff5d00 10%, #ff1900 91%);
      border-top-left-radius: 7px;
      border-top-right-radius: 7px;
      border-bottom-left-radius: 7px;
      border-bottom-right-radius: 0;
      z-index: 3;
      height: 16px;
      line-height: 17px;
      text-align: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }
}
</style>
