mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-11 02:46:45 +08:00
添加获取微信授权的code相关代码逻辑
This commit is contained in:
@@ -98,6 +98,7 @@ import { Cell, CellGroup, RadioGroup, Radio, Dialog } from 'vant'
|
|||||||
import { acceptInsurance, getBankCardSignState,payFlag, underWrite, getOrderDetail,signConfirm} from '@/api/ebiz/sale/sale'
|
import { acceptInsurance, getBankCardSignState,payFlag, underWrite, getOrderDetail,signConfirm} from '@/api/ebiz/sale/sale'
|
||||||
import Loading from '@/components/ebiz/Loading'
|
import Loading from '@/components/ebiz/Loading'
|
||||||
import config from '@/config'
|
import config from '@/config'
|
||||||
|
import { wxShare } from '@/api/ebiz/common/common.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
let isWeixin = this.$utils.device().isWeixin //判断环境
|
let isWeixin = this.$utils.device().isWeixin //判断环境
|
||||||
@@ -202,6 +203,25 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getOpenid(){
|
||||||
|
wxShare({ url: location.href }).then(response => {
|
||||||
|
if (response.result == '0') {
|
||||||
|
let orderNo = this.$route.query.orderNo
|
||||||
|
let code = this.getUrlParam('code')
|
||||||
|
if(!code){
|
||||||
|
window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + response.content.appid + '&redirect_uri=' + encodeURIComponent(location.href + '?orderNo=' + orderNo) + '&response_type=code&scope=snsapi_base&state=1#wechat_redirect'
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取地址上的参数
|
||||||
|
getUrlParam(name) {
|
||||||
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
||||||
|
var r = window.location.search.substr(1).match(reg);
|
||||||
|
if (r != null) return unescape(r[2]); return null;
|
||||||
|
},
|
||||||
async payMentWx(orderNo){
|
async payMentWx(orderNo){
|
||||||
const res = await payFlag({ orderNo: orderNo })
|
const res = await payFlag({ orderNo: orderNo })
|
||||||
console.dir(res)
|
console.dir(res)
|
||||||
|
|||||||
Reference in New Issue
Block a user