石广澎
2024-07-30 d113dc3d1e5f3b42ea414e8be538ce2442ffc899
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
43
44
45
46
<template>
    <view>
 
    </view>
</template>
 
<script>
    import {
        config
    } from 'common/config.js';
    export default {
        data() {
            return {
        opt: {},
        platform: this.$utils.getPlat()
            };
        },
        onLoad(opt) {
      this.opt = opt
        },
    onShow() {
      let redirect_uri = `${config.webURL}/pay/scanpay?cid=${this.opt.cid||''}&shopId=${this.opt.shopId||''}&activityQrcodeId=${this.opt.activityQrcodeId||''}&smoney=${this.opt.smoney||''}`
      if(uni.getStorageSync('OPENID'+this.platform)){
        window.location.href = redirect_uri
        return
      }
      redirect_uri = encodeURIComponent(redirect_uri)
      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=${this.opt.cid}`
        })
      }
    },
    }
</script>
 
<style lang="scss">
 
</style>