<template>
    <div class="news">
        <div class="detail" v-html="info.detail"></div>
        <div class="news-btn" v-if="info.link">
            <van-button round block type="primary" @click="buy">去购买</van-button>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            info: {}
        };
    },
    mounted() {
        this.$http.get('/news/get/' + this.$route.query.id).then(res => {
            this.info = res;
        });
    },
    methods: {
        buy() {
            if (this.info.linkType === 'collections') {
                this.$router.push(`/productSearch?search=${this.info.linkContent}&source=TRANSFER`);
            }
        }
    }
};
</script>

<style lang="less" scoped>
.news {
    background-color: #181818;
    box-sizing: border-box;
    .detail {
        background-color: #181818;
        /deep/ p {
            background-color: #181818;
            margin: 0;
            img {
                display: block;
            }
        }
    }
    padding-bottom: 100px;
}

.news-btn {
    position: fixed;
    z-index: 20;
    background: #181818;
    padding: 9px 68px;
    .flex();
    left: 0;
    right: 0;
    bottom: 0;
    .bottom(9px);

    /deep/.van-button {
        &.van-button--disabled {
            background: #303133;
            color: #939599;
            opacity: 1;
        }
    }
}
</style>
