diff --git a/src/views/ebiz/sale/PayMent.vue b/src/views/ebiz/sale/PayMent.vue index 324658613..61a3912d5 100644 --- a/src/views/ebiz/sale/PayMent.vue +++ b/src/views/ebiz/sale/PayMent.vue @@ -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 Loading from '@/components/ebiz/Loading' import config from '@/config' +import { wxShare } from '@/api/ebiz/common/common.js' export default { data() { let isWeixin = this.$utils.device().isWeixin //判断环境 @@ -202,6 +203,25 @@ export default { } }, 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){ const res = await payFlag({ orderNo: orderNo }) console.dir(res)