123456789101112131415161718192021222324252627282930313233343536373839 |
- <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 = "wxd9c7c138a055ee66"; //七云公众号appID
- onMounted(() => {
- wxPay();
- });
- const wxPay = () => {
- // 处理回调接口
- const redirectUri = encodeURIComponent('http://sevencloud.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>
|