From 7e081cadeda2d7b5d3cc3f6055b4ee2799d19c00 Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期四, 08 八月 2024 15:11:54 +0800
Subject: [PATCH] feat(支付): 云闪付

---
 pay/login.vue              |    8 ++++++--
 common/http.interceptor.js |    8 ++++----
 pay/scanpay.vue            |   11 +++++++----
 common/api/index.js        |    2 +-
 4 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/common/api/index.js b/common/api/index.js
index 35cafd9..8f73bc6 100644
--- a/common/api/index.js
+++ b/common/api/index.js
@@ -27,7 +27,7 @@
 		path = '/payfour-merchant/v1/web/h5PayAli/getUserIdByCode'
 	}
 	if (params.platform == 15) { //浜戦棯浠樻巿鏉�
-		path = '/service-merchant/v1/web/h5PayUnionPay/getUserIdByCode'
+		path = '/payfour-merchant/v1/web/h5PayUnionPay/getUserIdByCode'
 	}
 	return http.get(URL + path,
 		params, config = {})
diff --git a/common/http.interceptor.js b/common/http.interceptor.js
index 9bef48b..364454d 100644
--- a/common/http.interceptor.js
+++ b/common/http.interceptor.js
@@ -33,8 +33,8 @@
         }
         const plat = getPlat()
         if (plat == 2) { //寰俊
-            const OPENID = uni.getStorageSync('OPENID' + plat) || null
-            const UNIONID = uni.getStorageSync('UNIONID' + plat) || null
+            const OPENID = uni.getStorageSync('OPENID') || null
+            const UNIONID = uni.getStorageSync('UNIONID') || null
             if (OPENID) {
                 x.header['Openid'] = OPENID;
             }
@@ -43,13 +43,13 @@
             }
         }
         if (plat == 5) { //鏀粯瀹�
-            const ALIUSERID = uni.getStorageSync('ALIUSERID' + plat) || null
+            const ALIUSERID = uni.getStorageSync('ALIUSERID') || null
             if (ALIUSERID) {
                 x.header['Aliuserid'] = ALIUSERID;
             }
         }
         if (plat == 15) { //浜戦棯浠�
-            const UNIONPAYID = uni.getStorageSync('UNIONPAYID ' + plat) || null
+            const UNIONPAYID = uni.getStorageSync('UNIONPAYID') || null
             if (UNIONPAYID) {
                 x.header['Unionpayid '] = UNIONPAYID;
             }
diff --git a/pay/login.vue b/pay/login.vue
index 5c6fee4..0b2d5a5 100644
--- a/pay/login.vue
+++ b/pay/login.vue
@@ -20,11 +20,15 @@
 		},
     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(this.platform==2&&uni.getStorageSync('OPENID'+this.platform)){
+      if(this.platform==2&&uni.getStorageSync('OPENID')){
         window.location.href = redirect_uri
         return
       }
-      if(this.platform==5&&uni.getStorageSync('ALIUSERID'+this.platform)){
+      if(this.platform==5&&uni.getStorageSync('ALIUSERID')){
+        window.location.href = redirect_uri
+        return
+      }
+      if(this.platform==15&&uni.getStorageSync('UNIONPAYID')){
         window.location.href = redirect_uri
         return
       }
diff --git a/pay/scanpay.vue b/pay/scanpay.vue
index 84d955b..a910cda 100644
--- a/pay/scanpay.vue
+++ b/pay/scanpay.vue
@@ -208,7 +208,7 @@
     uni.setStorageSync('SHOPID', opt.shopId)
     uni.setStorageSync('SMONEY', opt.smoney)
     uni.setStorageSync('AQCI', opt.activityQrcodeId)
-    this.UNIONID = uni.getStorageSync('UNIONID' + this.payWay) || null
+    this.UNIONID = uni.getStorageSync('UNIONID') || null
     this.isNew = uni.getStorageSync('IS_NEW')
     if (opt.smoney) {
       this.smoney = opt.smoney
@@ -288,13 +288,16 @@
     getToken(res) {
       this.token = res.token
       if (res.openid) {
-        uni.setStorageSync('OPENID' + this.payWay, res.openid)
+        uni.setStorageSync('OPENID', res.openid)
       }
       if (res.unionid) {
-        uni.setStorageSync('UNIONID' + this.payWay, res.unionid)
+        uni.setStorageSync('UNIONID', res.unionid)
       }
       if (res.aLiUserId) {
-        uni.setStorageSync('ALIUSERID' + this.payWay, res.aLiUserId)
+        uni.setStorageSync('ALIUSERID', res.aLiUserId)
+      }
+      if (res.cloudPayUserId) {
+        uni.setStorageSync('UNIONPAYID', res.cloudPayUserId)
       }
       this.UNIONID = res.unionid
       uni.setStorageSync(ACCESSTOKEN, res.token)

--
Gitblit v1.9.1