1.对接惠支付 云闪付支付

huipay-h5
杨杰 1 year ago
parent 8bc34356a2
commit 2481e22a17
  1. 16
      App.vue
  2. 27
      Utils/Api.js
  3. 83
      pages/welcome/welcome.vue

@ -15,15 +15,15 @@
snNo: '', // sn snNo: '', // sn
platformType: '', // platformType: '', //
// //
url: 'https://hsg.dctpay.com/user', // url: 'https://hsg.dctpay.com/user',
graurl: 'https://pay.dctpay.com/crest', // graurl: 'https://pay.dctpay.com/crest',
imgUrl: 'https://pay.dctpay.com/filesystem/', // imgUrl: 'https://pay.dctpay.com/filesystem/',
imageWxImg: 'https://hsgcs.dctpay.com/filesystem/wxApplets/',
//
// url: 'https://hsgcs.dctpay.com/user',
// graurl:'https://gratia-pay.dctpay.com/crest',
// imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
// imageWxImg: 'https://hsgcs.dctpay.com/filesystem/wxApplets/', // imageWxImg: 'https://hsgcs.dctpay.com/filesystem/wxApplets/',
//
url: 'https://hsgcs.dctpay.com/user',
graurl:'https://gratia-pay.dctpay.com/crest',
imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
imageWxImg: 'https://hsgcs.dctpay.com/filesystem/wxApplets/',
}, },
onLaunch: function() { onLaunch: function() {

@ -11,8 +11,8 @@ export const getQrCodeDetail = params => {
//银行卡识别 //银行卡识别
export const recognizeBankCard = params => { export const recognizeBankCard = params => {
return POST('GET', `${grabase}/ocr/recognizeBankCard`, params).then(res => res.data); return POST('GET', `${grabase}/ocr/recognizeBankCard`, params).then(res => res.data);
} }
//创建 JSAPI 订单 //创建 JSAPI 订单
export const createJSAPIOrder = params => { export const createJSAPIOrder = params => {
return POST('POST', `${grabase}/tradeOrder/createJSAPIOrder`, params).then(res => res.data); return POST('POST', `${grabase}/tradeOrder/createJSAPIOrder`, params).then(res => res.data);
@ -20,22 +20,22 @@ export const createJSAPIOrder = params => {
// 支付 JSAPI 订单 // 支付 JSAPI 订单
export const jsapiPay = params => { export const jsapiPay = params => {
return POST('POST', `${grabase}/pay/jsapiPay`, params).then(res => res.data); return POST('POST', `${grabase}/pay/jsapiPay`, params).then(res => res.data);
} }
//计算价格 //计算价格
export const calculation = params => { export const calculation = params => {
return POST('GET', `${grabase}/tradeOrder/calculation`, params).then(res => res.data); return POST('GET', `${grabase}/tradeOrder/calculation`, params).then(res => res.data);
} }
//H5 code 转化openid //H5 code 转化openid
export const getH5AccessToken = params => { export const getH5AccessToken = params => {
return POST('GET', `${base}/wechat/getH5AccessToken`, params).then(res => res.data); return POST('GET', `${base}/wechat/getH5AccessToken`, params).then(res => res.data);
} }
//支付宝获取openid //支付宝获取openid
export const getAlipayUserId = params => { export const getAlipayUserId = params => {
return POST('GET', `${grabase}/login/getAlipayUserId`, params).then(res => res.data); return POST('GET', `${grabase}/login/getAlipayUserId`, params).then(res => res.data);
} }
//获取登录验证码 //获取登录验证码
export const getLoginSMSCode = params => { export const getLoginSMSCode = params => {
@ -62,4 +62,9 @@ export const getUserDetail = params => {
//查询优惠券 //查询优惠券
export const queryUserDiscountList = params => { export const queryUserDiscountList = params => {
return POST('GET', `${base}/discount/queryUserDiscountList`, params).then(res => res.data); return POST('GET', `${base}/discount/queryUserDiscountList`, params).then(res => res.data);
} }
// 获取拉卡拉银联用户id
export const getLkLUnionUserId = params => {
return POST('POST', `${grabase}/tradeOrder/getLkLUnionUserId`, params).then(res => res.data);
}

@ -1,25 +1,35 @@
<template> <template>
<view> <view>
</view> </view>
</template> </template>
<script> <script>
import { import {
getH5AccessToken, getH5AccessToken,
getAlipayUserId getAlipayUserId,
getLkLUnionUserId
} from '../../Utils/Api.js'; } from '../../Utils/Api.js';
let app = getApp(); let app = getApp();
export default { export default {
data() { data() {
return { return {
appUpIdentifier: ''
} }
}, },
onLoad(options) { 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 arr1 = window.location.href;
var arr2 = arr1.split('='); 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) { if (arr2[1].length == 12) {
var arr3 = arr2[1].split('#/'); var arr3 = arr2[1].split('#/');
app.globalData.snNo = arr3[0]; app.globalData.snNo = arr3[0];
@ -31,14 +41,25 @@
} else { } else {
let that = this; let that = this;
var arr4; var arr4;
arr4 = arr2[2].split('&'); if (app.globalData.platformType == 'UQRCODEPAY') {
app.globalData.code = arr4[0]; arr4 = arr2[1].split('&');
uni.getStorage({ app.globalData.code = arr4[0];
key: 'snNumber', uni.getStorage({
success(e) { key: 'snNumber',
app.globalData.snNo = e.data; 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') { if (app.globalData.code && app.globalData.platformType == 'WECHAT') {
@ -47,6 +68,9 @@
if (app.globalData.code && app.globalData.platformType == 'ALIPAY') { if (app.globalData.code && app.globalData.platformType == 'ALIPAY') {
this.getAlipayUserId(); this.getAlipayUserId();
} }
if (app.globalData.code && app.globalData.platformType == 'UQRCODEPAY') {
this.getLkLUnionUserId();
}
} else { } else {
var arr1 = window.location.href; var arr1 = window.location.href;
var arr2 = arr1.split('='); var arr2 = arr1.split('=');
@ -60,9 +84,10 @@
url: '../index/index' url: '../index/index'
}) })
} }
}, },
methods: { methods: {
//H5 openId //H5 openId
getH5AccessToken() { getH5AccessToken() {
let params = { let params = {
@ -103,15 +128,41 @@
} }
}); });
}, },
//openid
getLkLUnionUserId() {
let params = {
"serialNumber": app.globalData.snNo,
"userAuthCode": app.globalData.code,
"appUpIdentifier": this.appUpIdentifier
}
getLkLUnionUserId(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() { jumpWeb() {
if (app.globalData.platformType == 'WECHAT') { if (app.globalData.platformType == 'WECHAT') {
location.href = 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'; 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https://hsg.dctpay.com/wechat_authorize/?redirect_uri=https://gratia-pay.dctpay.com/scanPay&response_type=code&scope=snsapi_base#wechat_redirect';
} }
if (app.globalData.platformType == 'ALIPAY') { if (app.globalData.platformType == 'ALIPAY') {
location.href = 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'; '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%2Fgratia-pay.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://pgratia-pay.dctpay.com';
} }
}, },
} }

Loading…
Cancel
Save