dialog-confirm-info.vue 2.37 KB
<template>
  <div class="confirm-info-wrapper">
    <div class="confrim-info" v-if="confirmDescList.length > 0">
      <span v-for="(info, i) in confirmDescList" :key="i">{{ info }}</span>
    </div>
    <div v-if="info.showPrice" class="price-info">
      <p class="price-item">
        <span>{{ info.orderPriceDesc }}</span>
        <span>{{ info.orderPrice }}</span>
      </p>
      <p class="price-item">
        <span>{{ info.penaltyDesc }}&nbsp;&nbsp;({{ info.penaltyRate }})</span>
        <span class="penalty">{{ info.penaltyAmount }}</span>
      </p>
      <p class="price-item">
        <span>{{ info.refundDesc }}</span>
        <span>{{ info.refundAmount }}</span>
      </p>
    </div>
    <div v-if="isPlatformFee" class="price-info">
      <p class="price-item">
        <span>{{ info.orderPriceDesc }}</span>
        <span>{{ info.orderPrice }}</span>
      </p>
      <p class="price-item">
        <span>{{ info.penaltyDesc }}&nbsp;&nbsp;({{ info.penaltyRate }})</span>
        <span>{{ info.penaltyAmount }}</span>
      </p>
      <p class="price-item">
        <span>{{ info.refundDesc }}</span>
        <span>{{ info.refundAmount }}</span>
      </p>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    info: {
      type: Object,
      default: function() {
        return {};
      }
    },
    isPlatformFee: {
      type: Boolean,
      default: false
    },
    platformFeeInfo: {
      type: Object,
      default: function() {
        return {};
      }
    }
  },
  computed: {
    confirmDescList() {
      const { confirmDesc = "" } = this.info;
      if (confirmDesc.includes("#*")) {
        const regexp = /#\*(.*?)\*#/;
        return confirmDesc.split(regexp);
      } else {
        return confirmDesc ? [confirmDesc] : [];
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.confirm-info-wrapper {
  display: flex;
  padding: 0 40px;
  color: #000;

  .confrim-info {
    font-size: 28px;
    text-align: center;
    flex: 1;

    span {
      color: #d0021b;
    }

    & > :first-child,
    & > :last-child {
      color: #000;
      padding-left: 10px;
    }

    // p {
    //   display: inline-block;
    //   text-align: left;
    //   max-width: 100%;
    // }
  }

  .price-info {
    flex: 1;

    .price-item {
      display: flex;
      justify-content: space-between;

      .penalty {
        color: #d0021b;
      }
    }
  }
}
</style>