|
|
|
<template>
|
|
|
|
<view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import {
|
|
|
|
getH5AccessToken,
|
|
|
|
getAlipayUserId
|
|
|
|
} from '../../Utils/Api.js';
|
|
|
|
let app = getApp();
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onLoad(options) {
|
|
|
|
var arr1 = window.location.href;
|
|
|
|
var arr2 = arr1.split('=');
|
|
|
|
if (app.globalData.platformType == 'WECHAT' || app.globalData.platformType == 'ALIPAY') {
|
|
|
|
if (arr2[1].length == 12) {
|
|
|
|
var arr3 = arr2[1].split('#/');
|
|
|
|
app.globalData.snNo = arr3[0];
|
|
|
|
uni.setStorage({
|
|
|
|
key: "snNumber",
|
|
|
|
data: arr3[0]
|
|
|
|
})
|
|
|
|
this.jumpWeb();
|
|
|
|
} 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.code && app.globalData.platformType == 'WECHAT') {
|
|
|
|
this.getH5AccessToken();
|
|
|
|
}
|
|
|
|
if (app.globalData.code && app.globalData.platformType == 'ALIPAY') {
|
|
|
|
this.getAlipayUserId();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
var arr1 = window.location.href;
|
|
|
|
var arr2 = arr1.split('=');
|
|
|
|
var arr3 = arr2[1].split('#/');
|
|
|
|
app.globalData.snNo = arr3[0];
|
|
|
|
uni.setStorage({
|
|
|
|
key: "snNumber",
|
|
|
|
data: arr3[0]
|
|
|
|
})
|
|
|
|
uni.reLaunch({
|
|
|
|
url: '../index/index'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
//H5 微信获取openId
|
|
|
|
getH5AccessToken() {
|
|
|
|
let params = {
|
|
|
|
code: app.globalData.code
|
|
|
|
}
|
|
|
|
getH5AccessToken(params).then(res => {
|
|
|
|
if (res.return_code == '000000' && res.return_data.openid) {
|
|
|
|
app.globalData.openId = res.return_data.openid;
|
|
|
|
uni.setStorage({
|
|
|
|
key: "openId",
|
|
|
|
data: res.return_data.openid
|
|
|
|
})
|
|
|
|
uni.reLaunch({
|
|
|
|
url: '../index/index'
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
this.jumpWeb();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
//支付宝获取openid
|
|
|
|
getAlipayUserId() {
|
|
|
|
let params = {
|
|
|
|
code: app.globalData.code
|
|
|
|
}
|
|
|
|
getAlipayUserId(params).then(res => {
|
|
|
|
if (res.return_code == '000000' && res.return_data.userId) {
|
|
|
|
app.globalData.openId = res.return_data.userId;
|
|
|
|
uni.setStorage({
|
|
|
|
key: "openId",
|
|
|
|
data: res.return_data.userId
|
|
|
|
})
|
|
|
|
uni.reLaunch({
|
|
|
|
url: '../index/index'
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
this.jumpWeb();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
//重定向方法
|
|
|
|
jumpWeb() {
|
|
|
|
if (app.globalData.platformType == 'WECHAT') {
|
|
|
|
location.href =
|
|
|
|
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https://hsg.dctpay.com/wechat_authorize/?redirect_uri=https://pay.dctpay.com/scanPay&response_type=code&scope=snsapi_base#wechat_redirect';
|
|
|
|
}
|
|
|
|
if (app.globalData.platformType == 'ALIPAY') {
|
|
|
|
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';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
</style>
|