From d113dc3d1e5f3b42ea414e8be538ce2442ffc899 Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期二, 30 七月 2024 17:43:05 +0800
Subject: [PATCH] feat(支付): 支持C扫B动态码支付
---
pay/login.vue | 36 ++++++++++++++++++++----------------
1 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/pay/login.vue b/pay/login.vue
index 9204bd8..1789eb0 100644
--- a/pay/login.vue
+++ b/pay/login.vue
@@ -11,29 +11,33 @@
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||''}&activityQrcodeId=${this.opt.activityQrcodeId||''}&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>
--
Gitblit v1.9.1