price-title.vue 2.55 KB
<template>
    <div class="price-title">
        <i v-if="entity.sales_price > 0"
        :class="{price: true, highlight: entity.market_price > entity.sales_price}">
            {{entity.format_sales_price !== '0' ? entity.format_sales_price : entity.format_market_price}}
        </i>
        <i class="price" v-if="entity.market_price > entity.sales_price"
        :class="{'line-through': entity.sales_price > 0}">{{entity.format_market_price}}</i>
        <p class="product-name">{{entity.product_name}}</p>

        <ul class="vip-level" v-if="entity.vipPrice">
            <li class="icons-item" v-for="(vip, index) in entity.vipPrice" :key="index">
                <span :class="`vip-img vip-${vip.level}`"></span>
                <span :class="`vip-price ${vip.currentVip}`">{{vip.price}}</span>
            </li>
        </ul>
    </div>
</template>

<script>
export default {
    name: 'PriceTitle',
    props: {
        entity: {
            type: Object,
            return() {
                return {};
            }
        }
    }
};
</script>

<style lang="scss">
.price-title {
    text-align: left;
    padding-top: 35px;
    padding-bottom: 30px;

    .price {
        color: #b0b0b0;
        font-size: 32px;
        font-style: normal;
        line-height: 1;
        font-family: "BrownStd-Regular";

        &.line-through {
            margin-left: 8px;
            font-size: 22px;
            text-decoration: line-through;
        }

        &.highlight {
                line-height: 1;
                color: #b0021b;
        }
    }

    .product-name {
        margin-top: 15px;
        color: #000;
        font-size: 24px;
        line-height: 1.2;
    }

    .vip-level {
        min-height: 2.2rem;
        background-color: #fff;
        display: flex;
        justify-content: space-between;

        .icons-item {
            margin: 0;
            height: 90px;
            font-size: 22px;
            line-height: 95px;

            span {
                display: inline-block;
                padding-left: 8px;
                vertical-align: middle;
            }

            .active {
                color: #000;
            }
        }

        .vip-img {
            width: 90px;
            height: 33px;
        }

        .vip-3 {
            background: resolve("me/vip-3.png");
        }

        .vip-2 {
            background: resolve("me/vip-2.png");
        }

        .vip-1 {
            background: resolve("me/vip-1.png");
        }

        .vip-3,
        .vip-2,
        .vip-1 {
            background-size: 100%;
        }
    }
}
</style>