<template>
    <div class="alert-wrapper" v-if="showAlert" @click.self=" showAlert = false ">
        <div class="alert">
            <div class="alertHearder ET6 EC10">
                关注公众号，完成预约
            </div>
            <div class="alertContent">
                <img :src="qr_code_url" alt="公众号二维码">
                <p class="ET6 EC5">长按识别二维码关注公众号</p>
            </div>
        </div>
    </div>
</template>

<script>
import EventBus from '../../libs/eventbus';

export default {
    data () {
        return {
            showAlert: false,
            qr_code_url: '', // 二维码地址
        };
    },
    created() {
        EventBus.$on('seckillAlert', (url) => {
            this.showAlert = true;
            this.qr_code_url = url;
        });
    },
};
</script>

<style scoped>
    .alert-wrapper {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        background-color: rgba(0,0,0,0.5);
        z-index: 10;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .alert {
        width: 5rem;
        height: 5rem;
        background: #fff;
        border-radius: 0.02rem;
    }
    .alertHearder {
        height: 1rem;
        text-align: center;
        background: #09bb07;
        line-height: 1rem;
    }
    .alertContent {
        text-align: center;
        margin-top: 0.4rem;
    }
    .alertContent > img {
        width: 2.5rem;
        height: 2.5rem;
    }
    .alertContent > p {
        margin-top: 0.08rem;
    }
</style>
