| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | opt: {}, |
| | | platform: this.$utils.getPlat() |
| | | }; |
| | | }, |
| | | onLoad(opt) { |
| | | const redirect_uri = encodeURIComponent(`${config.webURL}/pay/scanpay?cid=${opt.cid}`) |
| | | if(uni.getStorageSync('UNIONID'+this.platform)){ |
| | | this.opt = opt |
| | | }, |
| | | onShow() { |
| | | let redirect_uri = `${config.webURL}/pay/scanpay?cid=${this.opt.cid||''}&shopId=${this.opt.shopId||''}&smoney=${this.opt.smoney||''}` |
| | | if(uni.getStorageSync('OPENID'+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}` |
| | | }) |
| | | } |
| | | |
| | | } |
| | | 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> |
| | | |