msb_prod
ch 3 years ago
parent ae78d0efbe
commit 73ae3fbc51

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-07-08 11:46:30
* @LastEditors: ch
* @LastEditTime: 2022-07-12 11:09:38
* @LastEditTime: 2022-07-12 15:03:22
* @Description: file content
*/
@ -17,7 +17,7 @@ import '@/common/utils/uniUtilsIndex'
const ua = navigator ? navigator.userAgent.toLowerCase() : '';
if (ua.includes('micromessenger')) {
const openId = localStorage.getItem('payOpenId');
const openId = uni.getStorage({ key: 'payOpenId' });;
if (!openId) {
let query = FormatSearchJson(window.location.search);
// 通过订单No获取APPID
@ -31,7 +31,7 @@ if (ua.includes('micromessenger')) {
if (error) {
return false;
}
localStorage.setItem('payOpenId', result.openId);
uni.setStorage({ key: 'payOpenId', data: result.openId });
})
} else {
ApiGetAuthUrl({

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-07-08 11:46:30
* @LastEditors: ch
* @LastEditTime: 2022-07-12 14:53:15
* @LastEditTime: 2022-07-12 15:07:16
* @Description: file content
-->
<template>
@ -36,7 +36,7 @@ const ENV = process.env;
payType : 'wxpay',
orderInfo : {},
payOrderNo : this.$route.query.payOrderNo,
openId : localStorage.getItem('payOpenId'),
openId : null,
}
},
computed:{
@ -73,6 +73,7 @@ const ENV = process.env;
},
pay(){
this.openId = uni.getStorage({key:'payOpenId'});
if(this.payType === 'wxpay'){
if(this.openId && WeixinJSBridge){
this.wxJsapiPay()
@ -129,16 +130,22 @@ const ENV = process.env;
}
},
async getPayData(payCode){
const {error, result} = await ApiPostH5Pay({
let par = {
payOrderNo : this.orderInfo.payOrderNo,
payCode,
channelUser : payCode === 'WX_JSAPI' ? this.openId : null,
appCode : this.orderInfo.prepayAliApp.prepayAppCode
});
payCode
}
if(['WX_JSAPI','WX_H5'].includes(payCode)){
par.appCode = this.orderInfo.prepayWxApp.prepayAppCode
}else{
par.appCode = this.orderInfo.prepayAliApp.prepayAppCode
}
if(payCode === 'WX_JSAPI'){
par.channelUser = this.openId
}
const {error, result} = await ApiPostH5Pay(par);
if(error){
uni._$toast(error.message);
}
return {error, result};
}
}

Loading…
Cancel
Save