<template>
    <div class="pay-success-container">
        <div class="hint-1">
            <i class="iconfont theme-customize-font icon-icon_success"></i>
            <span class="c2">购买成功</span>
        </div>
        <div class="hint-2 t2 c3">为了及时接收拼团信息，请先关注服务号</div>
        <div class="code-wrapper">
            <div class="name" v-text="store_name"></div>
            <div class="code-frame">
                <span class="frame frame-top-left"></span>
                <span class="frame frame-top-right"></span>
                <span class="frame frame-bottom-left"></span>
                <span class="frame frame-bottom-right"></span>
                <img :src="store_code" />
            </div>
            <div class="hint-3 t2 c2">长按二维码，识别并关注</div>
        </div>

        <div @click="closeToRefresh" class="checkDetail theme-customize-bg theme-customize-font-black">
            查看拼团详情
        </div>

        <div @click="closeToRefresh" class="close-container">
            <div class="close"></div>
        </div>
    </div>
</template>

<script>
import jsTools from '@xiaoe/js-tools'
export default {
    data() {
        return {
            store_code: '',
            store_name: '',
        }
    },
    created() {
        this.attentionInfo()
    },
    methods: {
        closeToRefresh: function() {
            let params = window.localStorage.getItem('team_buy_task_id')
            location.href = location.pathname + '?task_id=' + params
        },
        attentionInfo: function() {
            let that = this
            jsTools.request({ url: 'get_service_info', params: {} }).then(data => {
                if (data.code === 0) {
                    that.store_code = data.data.qr_url
                    that.store_name = data.data.wx_app_name
                }
            })
        },
    },
}
</script>

<style scoped>
.checkDetail {
    width: 6.7rem;
    height: 0.9rem;
    color: #fff;
    font-size: 0.32rem;
    text-align: center;
    background-color: #09bb07;
    line-height: 0.88rem;
    border-radius: 0.45rem;
    box-sizing: border-box;
    margin: 0.6rem auto;
}

.close:before {
    content: ' ';
    width: 100%;
    position: absolute;
    top: 50%;
    left: 0;
    border-top: 2px solid #dee1de;
    transform: translateY(-50%) rotate(45deg);
}
.close:after {
    content: ' ';
    width: 100%;
    position: absolute;
    top: 50%;
    left: 0;
    border-top: 2px solid #dee1de;
    transform: translateY(-50%) rotate(-45deg);
}
.close {
    width: 0.43rem;
    height: 0.43rem;
    position: relative;
}
.close-container {
    padding: 0.24rem;
    position: absolute;
    top: 0;
    right: 0;
}
.hint-3 {
    margin-top: 0.46rem;
    text-align: center;
}
.name {
    padding-top: 0.76rem;
    font-size: 0.36rem;
    text-align: center;
    color: #fdab46;
}
.frame-bottom-right {
    position: absolute;
    bottom: 0;
    right: 0;
    border-bottom: 1px solid #dadada;
    border-right: 1px solid #dadada;
    transform-origin: bottom right;
}
.frame-bottom-left {
    position: absolute;
    bottom: 0;
    left: 0;
    border-bottom: 1px solid #dadada;
    border-left: 1px solid #dadada;
    transform-origin: bottom left;
}
.frame-top-right {
    position: absolute;
    top: 0;
    right: 0;
    border-top: 1px solid #dadada;
    border-right: 1px solid #dadada;
    transform-origin: top right;
}
.frame-top-left {
    position: absolute;
    top: 0;
    left: 0;
    border-top: 1px solid #dadada;
    border-left: 1px solid #dadada;
    transform-origin: top left;
}
.frame {
    width: 1.2rem;
    height: 1.2rem;
    transform: scale(0.5);
}
.code-frame > img {
    width: 3.2rem;
    height: 3.2rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.code-frame {
    width: 3.48rem;
    height: 3.48rem;
    margin: 0.3rem auto;
    position: relative;
}
.code-wrapper {
    width: 6.6rem;
    height: 6.6rem;
    margin: 0.44rem auto 0;
    background-color: #fff;
    border-radius: 0.08rem;
    box-shadow: 0 2px 14px 0 rgba(218, 218, 218, 0.5);
}
.hint-2:after {
    content: ' ';
    border-top: 1px solid #c0c0c0;
    width: 0.75rem;
    position: absolute;
    top: 50%;
    right: 0.52rem;
    transform: translateY(-50%);
}
.hint-2:before {
    content: ' ';
    border-top: 1px solid #c0c0c0;
    width: 0.75rem;
    position: absolute;
    top: 50%;
    left: 0.52rem;
    transform: translateY(-50%);
}
.hint-2 {
    height: 0.4rem;
    margin-top: 0.8rem;
    line-height: 0.4rem;
    text-align: center;
    position: relative;
}
.hint-1 > img {
    width: 0.58rem;
    height: 0.58rem;
    margin-right: 0.3rem;
    vertical-align: top;
}
.hint-1 > span {
    font-size: 0.42rem;
}
.hint-1 {
    height: 0.6rem;
    margin-top: 0.8rem;
    line-height: 0.6rem;
    text-align: center;
    font-size: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}
.hint-1 .iconfont {
    font-size: 0.58rem;
    margin-right: 0.3rem;
}
.pay-success-container {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background-color: #eff4f1;
    z-index: 999999900;
    overflow-y: scroll;
}
</style>
