石广澎
2024-07-11 6c2609b9f3212e4e502e1dc4d0d4f1382d8782e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<template>
    <view>
 
    </view>
</template>
 
<script>
    import {
        config
    } from 'common/config.js';
    export default {
        data() {
            return {
        platform: this.$utils.getPlat()
            };
        },
        onLoad(opt) {
      const redirect_uri = encodeURIComponent(`${config.webURL}/pay/scanpay?cid=${opt.cid}`)
      if(uni.getStorageSync('UNIONID'+this.platform)){
        window.location.href = redirect_uri
        return
      }
            uni.clearStorage()
            if (this.platform == 2) {
                window.location.href =
                    `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${config.wx_appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
            } else if (this.platform == 5) {
                window.location.href =
                    `https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=${config.ali_appid}&scope=auth_base&redirect_uri=${redirect_uri}&state=STATE`
            } else {
                uni.reLaunch({
                    url: `/pay/scanpay?cid=${opt.cid}`
                })
            }
 
        }
    }
</script>
 
<style lang="scss">
 
</style>