!120 2022-1-27 Leung

Merge pull request !120 from Admin/sit-Leung
This commit is contained in:
Admin 2022-01-27 03:25:24 +00:00 committed by Gitee
commit aeec63e7a3
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 92 additions and 13 deletions

64
rc-busness/ajax/util.js Normal file
View File

@ -0,0 +1,64 @@
/*
export const isMobile = () => {
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid = sUserAgent.match(/android/i) == "android";
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
return false;
} else {
return true;
}
}
*/
export default {
isMobile :false
}
/*
export default {
isMobile(){
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid = sUserAgent.match(/android/i) == "android";
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
return false;
} else {
return true;
}
}
}
*/
/*
function isMobile() {
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid = sUserAgent.match(/android/i) == "android";
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
return false;
} else {
return true;
}
}
export { isMobile }
*/

View File

@ -4,7 +4,7 @@ export default {
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: '皇家官方商城',
title: '皇家宠物食品官方商城',
htmlAttrs: {
lang: 'zh-cn',

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();
let isWx = this.isWX();
if(isWx && this.userPayData.wxPay && this.userPayData.wxPay.length>4) {
//Desktop, use native pay
this.disableQrcode=false;
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;