|
|
|
@ -1,25 +1,35 @@ |
|
|
|
|
<template> |
|
|
|
|
<view> |
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import { |
|
|
|
|
import { |
|
|
|
|
getH5AccessToken, |
|
|
|
|
getAlipayUserId |
|
|
|
|
getAlipayUserId, |
|
|
|
|
getUnionUserId |
|
|
|
|
} from '../../Utils/Api.js'; |
|
|
|
|
let app = getApp(); |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
|
|
|
|
|
appUpIdentifier: '' |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onLoad(options) { |
|
|
|
|
//银联 |
|
|
|
|
if (app.globalData.platformType == 'UQRCODEPAY') { |
|
|
|
|
var useragent = navigator.userAgent; |
|
|
|
|
var agentname = useragent.split('UnionPay/'); |
|
|
|
|
var agentno = agentname[1]; |
|
|
|
|
var agentnoname = agentno.split(')'); |
|
|
|
|
var lastangetname = agentnoname[0]; |
|
|
|
|
this.appUpIdentifier = 'UnionPay/' + lastangetname; |
|
|
|
|
} |
|
|
|
|
var arr1 = window.location.href; |
|
|
|
|
var arr2 = arr1.split('='); |
|
|
|
|
if (app.globalData.platformType == 'WECHAT' || app.globalData.platformType == 'ALIPAY') { |
|
|
|
|
if (app.globalData.platformType == 'WECHAT' || app.globalData.platformType == 'ALIPAY' || app.globalData |
|
|
|
|
.platformType == 'UQRCODEPAY') { |
|
|
|
|
if (arr2[1].length == 12) { |
|
|
|
|
var arr3 = arr2[1].split('#/'); |
|
|
|
|
app.globalData.snNo = arr3[0]; |
|
|
|
@ -31,14 +41,25 @@ |
|
|
|
|
} else { |
|
|
|
|
let that = this; |
|
|
|
|
var arr4; |
|
|
|
|
arr4 = arr2[2].split('&'); |
|
|
|
|
app.globalData.code = arr4[0]; |
|
|
|
|
uni.getStorage({ |
|
|
|
|
key: 'snNumber', |
|
|
|
|
success(e) { |
|
|
|
|
app.globalData.snNo = e.data; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
if (app.globalData.platformType == 'UQRCODEPAY') { |
|
|
|
|
arr4 = arr2[1].split('&'); |
|
|
|
|
app.globalData.code = arr4[0]; |
|
|
|
|
uni.getStorage({ |
|
|
|
|
key: 'snNumber', |
|
|
|
|
success(e) { |
|
|
|
|
app.globalData.snNo = e.data; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
arr4 = arr2[2].split('&'); |
|
|
|
|
app.globalData.code = arr4[0]; |
|
|
|
|
uni.getStorage({ |
|
|
|
|
key: 'snNumber', |
|
|
|
|
success(e) { |
|
|
|
|
app.globalData.snNo = e.data; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (app.globalData.code && app.globalData.platformType == 'WECHAT') { |
|
|
|
@ -47,6 +68,9 @@ |
|
|
|
|
if (app.globalData.code && app.globalData.platformType == 'ALIPAY') { |
|
|
|
|
this.getAlipayUserId(); |
|
|
|
|
} |
|
|
|
|
if (app.globalData.code && app.globalData.platformType == 'UQRCODEPAY') { |
|
|
|
|
this.getUnionUserId(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
var arr1 = window.location.href; |
|
|
|
|
var arr2 = arr1.split('='); |
|
|
|
@ -60,9 +84,10 @@ |
|
|
|
|
url: '../index/index' |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
//H5 微信获取openId |
|
|
|
|
getH5AccessToken() { |
|
|
|
|
let params = { |
|
|
|
@ -103,6 +128,28 @@ |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//云闪付获取openid |
|
|
|
|
getUnionUserId() { |
|
|
|
|
let params = { |
|
|
|
|
"serialNumber": app.globalData.snNo, |
|
|
|
|
"userAuthCode": app.globalData.code, |
|
|
|
|
"appUpIdentifier": this.appUpIdentifier |
|
|
|
|
} |
|
|
|
|
getUnionUserId(params).then(res => { |
|
|
|
|
if (res.return_code == '000000' && res.return_data.respData.userId) { |
|
|
|
|
app.globalData.openId = res.return_data.respData.userId; |
|
|
|
|
uni.setStorage({ |
|
|
|
|
key: "openId", |
|
|
|
|
data: res.return_data.respData.userId |
|
|
|
|
}) |
|
|
|
|
uni.reLaunch({ |
|
|
|
|
url: '../index/index' |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
this.jumpWeb(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//重定向方法 |
|
|
|
|
jumpWeb() { |
|
|
|
|
if (app.globalData.platformType == 'WECHAT') { |
|
|
|
@ -113,6 +160,10 @@ |
|
|
|
|
location.href = |
|
|
|
|
'https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=2021003176605875&scope=auth_base&redirect_uri=https://pay.dctpay.com/redirect?redirect_uri=https%3A%2F%2Fpay.dctpay.com%2FscanPay%3Fsn%3D1000017476'; |
|
|
|
|
} |
|
|
|
|
if (app.globalData.platformType == 'UQRCODEPAY') { |
|
|
|
|
location.href = |
|
|
|
|
'https://qr.95516.com/qrcGtwWeb-web/api/userAuth?version=1.0.0&redirectUrl=https://pay.dctpay.com/scanPay'; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|