瀏覽代碼

调整支付透传

heyang 3 年之前
父節點
當前提交
13ab434c38
共有 2 個文件被更改,包括 22 次插入6 次删除
  1. 11 2
      screenAndroid/WXdraw.js
  2. 11 4
      screenIos/WXdraw.js

+ 11 - 2
screenAndroid/WXdraw.js

@@ -115,7 +115,6 @@ function doConnect() {
       return
       return
     }
     }
     if (result.type === 'payInitiateEvent') {
     if (result.type === 'payInitiateEvent') {
-      window.location.href = result.data.payUrl
       var url = window.location.href;
       var url = window.location.href;
       url = url.split('/');
       url = url.split('/');
       var baseUrl = url[0] + '//' + url[2];
       var baseUrl = url[0] + '//' + url[2];
@@ -129,7 +128,17 @@ function doConnect() {
         type: 'POST',
         type: 'POST',
         dataType: 'json',
         dataType: 'json',
         contentType: 'application/json;charset=UTF-8',
         contentType: 'application/json;charset=UTF-8',
-        success: function (res) {},
+        success: function (res) {
+          if(result.data.payType === 1) { // 微信
+            if (window.__wxjs_environment === 'miniprogram') { // 小程序
+              // copyUrl(result.data.payUrl);
+            } else {
+              window.location.href = result.data.payUrl
+            }
+          } else {
+            window.location.href = result.data.payUrl
+          }
+        },
       });
       });
       return
       return
     }
     }

+ 11 - 4
screenIos/WXdraw.js

@@ -81,9 +81,7 @@ function doConnect() {
     }
     }
   };
   };
   wsss.onmessage = function (res) {
   wsss.onmessage = function (res) {
-    console.log('res', res)
     var result = typeof res.data === 'string' ? JSON.parse(res.data) : res.data
     var result = typeof res.data === 'string' ? JSON.parse(res.data) : res.data
-    console.log('result.type', result.type)
     if (result.type === 'cutting') {
     if (result.type === 'cutting') {
       if (result.data.status === 0) {
       if (result.data.status === 0) {
         $.toast('复制成功', "text");
         $.toast('复制成功', "text");
@@ -124,7 +122,6 @@ function doConnect() {
       return
       return
     }
     }
     if (result.type === 'payInitiateEvent') {
     if (result.type === 'payInitiateEvent') {
-      window.location.href = result.data.payUrl
       var url = window.location.href;
       var url = window.location.href;
       url = url.split('/');
       url = url.split('/');
       var baseUrl = url[0] + '//' + url[2];
       var baseUrl = url[0] + '//' + url[2];
@@ -138,7 +135,17 @@ function doConnect() {
         type: 'POST',
         type: 'POST',
         dataType: 'json',
         dataType: 'json',
         contentType: 'application/json;charset=UTF-8',
         contentType: 'application/json;charset=UTF-8',
-        success: function (res) {},
+        success: function (res) {
+          if(result.data.payType === 1) { // 微信
+            if (window.__wxjs_environment === 'miniprogram') { // 小程序
+              // copyUrl(result.data.payUrl);
+            } else {
+              window.location.href = result.data.payUrl
+            }
+          } else {
+            window.location.href = result.data.payUrl
+          }
+        },
       });
       });
       return
       return
     }
     }