<template>
    <div>
    </div>
</template>
  
<script>
import { onMounted } from "vue";
import { useRoute } from "vue-router";


export default {
    name: 'weChatPay',

    setup() {
        const route = useRoute();
        console.log(route.query.id);
        const id = route.query.id;
        const appId = "wxcd5b1b2636c9f611";
    
        onMounted(() => {
            wxPay();
        });


        const wxPay = () => {
            // 处理回调接口
            const redirectUri = encodeURIComponent('http://szwlh.sunzee.com.cn/PAY-SERVER/tOrder/callback');
            // const redirectUri = encodeURIComponent('http://szwltest.sunzee.com.cn/PAY-SERVER/tOrder/callback');
            const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_base&state=${id}&connect_redirect=1#wechat_redirect`;
            console.log(url)
            window.location.replace(url);
        };

        return {
            wxPay
        };
    }
};
</script>