7 changed files with 219 additions and 103 deletions
@ -0,0 +1,16 @@ |
|||||
|
import request from '@/utils/request' |
||||
|
|
||||
|
|
||||
|
export function vxPay(totalPrice,goodsName,openId,orderNumber) { |
||||
|
const data = { |
||||
|
totalPrice, |
||||
|
goodsName, |
||||
|
openId, |
||||
|
orderNumber |
||||
|
} |
||||
|
return request({ |
||||
|
url: '/app/vxPay/vxv3pay', |
||||
|
method: 'post', |
||||
|
data:data |
||||
|
}) |
||||
|
} |
||||
@ -1,75 +1,39 @@ |
|||||
|
<!-- 微信公众号的登录回调页 --> |
||||
<template> |
<template> |
||||
<view class="content"> |
<!-- 空登陆页 --> |
||||
<image class="logo" src="@/static/logo.png"></image> |
<view /> |
||||
<view class="text-area"> |
|
||||
<text class="title">Hello RuoYi-Vue</text> |
|
||||
</view> |
|
||||
<view class="text-area"> |
|
||||
<up-text type="primary" text="uview-plus"></up-text> |
|
||||
</view> |
|
||||
<view class="charts-box"> |
|
||||
<qiun-data-charts type="column" :chartData="chartData" /> |
|
||||
</view> |
|
||||
</view> |
|
||||
</template> |
</template> |
||||
|
|
||||
<script setup> |
<script setup> |
||||
import { ref, onMounted } from 'vue'; |
import { onLoad } from '@dcloudio/uni-app'; |
||||
|
import { getUserInfo} from '@/api/card' |
||||
const chartData = ref({}); |
|
||||
|
onLoad(async (options) => { |
||||
onMounted(() => { getServerData() }); |
// #ifdef H5 |
||||
|
// 将 search 参数赋值到 options 中,方便下面解析 |
||||
function getServerData() { |
new URLSearchParams(location.search).forEach((value, key) => { |
||||
// 模拟从服务器获取数据时的延时 |
options[key] = value; |
||||
setTimeout(() => { |
}); |
||||
let res = { |
const event = options.event; |
||||
categories: ['2016', '2017', '2018', '2019', '2020', '2021'], |
const code = options.code; |
||||
series: [ |
const state = options.state; |
||||
{ |
if (code) { |
||||
name: '目标值', |
getUserInfo(code).then(res => { |
||||
data: [35, 36, 31, 33, 13, 34], |
console.log(res,9) |
||||
}, |
uni.setStorageSync('openid', res.data.openid); |
||||
{ |
}) |
||||
name: '完成量', |
|
||||
data: [18, 27, 21, 24, 6, 28], |
|
||||
}, |
|
||||
], |
|
||||
}; |
|
||||
chartData.value = JSON.parse(JSON.stringify(res)); |
|
||||
}, 500); |
|
||||
} |
|
||||
</script> |
|
||||
|
|
||||
<style scoped> |
|
||||
.content { |
|
||||
display: flex; |
|
||||
flex-direction: column; |
|
||||
align-items: center; |
|
||||
justify-content: center; |
|
||||
} |
|
||||
|
|
||||
.logo { |
|
||||
height: 200rpx; |
|
||||
width: 200rpx; |
|
||||
margin-top: 200rpx; |
|
||||
margin-left: auto; |
|
||||
margin-right: auto; |
|
||||
margin-bottom: 50rpx; |
|
||||
} |
|
||||
|
|
||||
.text-area { |
|
||||
display: flex; |
|
||||
justify-content: center; |
|
||||
} |
} |
||||
|
|
||||
.title { |
// // 检测 H5 登录回调 |
||||
font-size: 36rpx; |
// let returnUrl = uni.getStorageSync('returnUrl'); |
||||
color: #8f8f94; |
// if (returnUrl) { |
||||
} |
// uni.removeStorage({key:'returnUrl'}); |
||||
|
// location.replace(returnUrl); |
||||
.charts-box { |
// } else { |
||||
width: 100%; |
// uni.switchTab({ |
||||
height: 300px; |
// url: '/', |
||||
} |
// }); |
||||
</style> |
// } |
||||
|
// #endif |
||||
|
}); |
||||
|
</script> |
||||
|
|||||
@ -0,0 +1,30 @@ |
|||||
|
let pay; |
||||
|
export default pay=(data,back,error)=> { |
||||
|
//获取后台传入的数据
|
||||
|
let appId = data.appId; |
||||
|
let timestamp = data.timestamp; |
||||
|
let nonceStr = data.nonce_str; |
||||
|
let paySign = data.sign; |
||||
|
let signType = data.signType; |
||||
|
let prepay_id = data.prepay_id; |
||||
|
// console.log("开始进行微信支付!")
|
||||
|
|
||||
|
WeixinJSBridge.invoke( |
||||
|
'getBrandWCPayRequest', { |
||||
|
"appId":appId, //公众号名称,由商户传入
|
||||
|
"timeStamp":timestamp, //时间戳,自1970年以来的秒数
|
||||
|
"nonceStr":nonceStr, //随机串
|
||||
|
"package":prepay_id, |
||||
|
"signType":signType, //微信签名方式:
|
||||
|
"paySign":paySign //微信签名
|
||||
|
}, |
||||
|
function(res){ |
||||
|
if(res.err_msg == "get_brand_wcpay_request:ok" ){ |
||||
|
// 使用以上方式判断前端返回,微信团队郑重提示:
|
||||
|
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
|
||||
|
back(); |
||||
|
}else{ |
||||
|
error(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
Loading…
Reference in new issue