userpay error fix

This commit is contained in:
Vion
2022-01-27 11:24:31 +08:00
parent 31fe06b2c2
commit 7912abdabc
3 changed files with 92 additions and 13 deletions

View File

@@ -101,7 +101,9 @@ import Myheader from "~/components/header.vue";
import tabs from "@/components/tabs.vue";
import vueQr from 'vue-qr'
import { generateOrderAlipay, updateOrderWX, monitorOrderNotify,repayOrde } from "../../ajax/getData";
//import { isMobile } from "@/ajax/util";
export default {
data() {
@@ -147,15 +149,28 @@ export default {
methods: {
defaultHandlePayment() {
let isMobile = this.isMobile();
if(this.userPayData.wxPay && !isMobile) {
this.qrtext=this.userPayData.wxPay;
this.payOrderWX();
let isWx = this.isWX();
if(isWx && this.userPayData.wxPay && this.userPayData.wxPay.length>4) {
//Desktop, use native pay
this.disableQrcode=false;
} else if (this.userPayData.wxPay && isMobile) {
this.disableQrcode=true;
} else if(!this.userPayData.wxPay || this.userPayData.wxPay.length<=4) {
this.qrtext=this.userPayData.wxPay;
} else if(isWx) {
throw new Error("订单信息错误,请删除商品后再次购买");
}
if(!isWx) {
if(this.userPayData.wxPay && !isMobile) {
//Desktop, use native pay
this.qrtext=this.userPayData.wxPay;
this.payOrderWX();
this.disableQrcode=false;
} else if (this.userPayData.wxPay && isMobile) {
//Mobile, use H5 pay
this.disableQrcode=true;
} else if(!this.userPayData.wxPay || this.userPayData.wxPay.length<=4) {
throw new Error("订单信息错误,请删除商品后再次购买");
}
}
},
goPayH5() {
let isMobile = this.isMobile();
@@ -166,6 +181,7 @@ export default {
throw new Error("订单信息错误,请删除商品后再次购买");
}
},
isMobile () {
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
@@ -182,6 +198,11 @@ export default {
return true;
}
},
/**/
isWX(){
var ua = navigator.userAgent.toLowerCase();
return (/micromessenger/.test(ua)) ? true : false;
},
closeDialogSuccess() {
this.qrtext = '';
this.$router.push({
@@ -198,12 +219,6 @@ export default {
// path: "/personal/useraddress",
// });
},
async selectGoods(item, index) {
this.activeIndex = index;
this.paytype = item.paytype;
if (index == 1) {
//支付宝
let res = await generateOrderAlipay(this.userPayData.orderId);
async selectGoods(item, index) {
this.activeIndex = index;
this.paytype = item.paytype;