mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-03 02:36:39 +08:00
commit
aeec63e7a3
64
rc-busness/ajax/util.js
Normal file
64
rc-busness/ajax/util.js
Normal 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 }
|
||||||
|
*/
|
@ -4,7 +4,7 @@ export default {
|
|||||||
|
|
||||||
// Global page headers: https://go.nuxtjs.dev/config-head
|
// Global page headers: https://go.nuxtjs.dev/config-head
|
||||||
head: {
|
head: {
|
||||||
title: '皇家官方商城',
|
title: '皇家宠物食品官方商城',
|
||||||
|
|
||||||
htmlAttrs: {
|
htmlAttrs: {
|
||||||
lang: 'zh-cn',
|
lang: 'zh-cn',
|
||||||
|
@ -101,7 +101,9 @@ import Myheader from "~/components/header.vue";
|
|||||||
import tabs from "@/components/tabs.vue";
|
import tabs from "@/components/tabs.vue";
|
||||||
import vueQr from 'vue-qr'
|
import vueQr from 'vue-qr'
|
||||||
|
|
||||||
|
|
||||||
import { generateOrderAlipay, updateOrderWX, monitorOrderNotify,repayOrde } from "../../ajax/getData";
|
import { generateOrderAlipay, updateOrderWX, monitorOrderNotify,repayOrde } from "../../ajax/getData";
|
||||||
|
//import { isMobile } from "@/ajax/util";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -147,15 +149,28 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
defaultHandlePayment() {
|
defaultHandlePayment() {
|
||||||
let isMobile = this.isMobile();
|
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) {
|
if(this.userPayData.wxPay && !isMobile) {
|
||||||
|
//Desktop, use native pay
|
||||||
this.qrtext=this.userPayData.wxPay;
|
this.qrtext=this.userPayData.wxPay;
|
||||||
this.payOrderWX();
|
this.payOrderWX();
|
||||||
this.disableQrcode=false;
|
this.disableQrcode=false;
|
||||||
} else if (this.userPayData.wxPay && isMobile) {
|
} else if (this.userPayData.wxPay && isMobile) {
|
||||||
|
//Mobile, use H5 pay
|
||||||
this.disableQrcode=true;
|
this.disableQrcode=true;
|
||||||
} else if(!this.userPayData.wxPay || this.userPayData.wxPay.length<=4) {
|
} else if(!this.userPayData.wxPay || this.userPayData.wxPay.length<=4) {
|
||||||
throw new Error("订单信息错误,请删除商品后再次购买");
|
throw new Error("订单信息错误,请删除商品后再次购买");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
goPayH5() {
|
goPayH5() {
|
||||||
let isMobile = this.isMobile();
|
let isMobile = this.isMobile();
|
||||||
@ -166,6 +181,7 @@ export default {
|
|||||||
throw new Error("订单信息错误,请删除商品后再次购买");
|
throw new Error("订单信息错误,请删除商品后再次购买");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
isMobile () {
|
isMobile () {
|
||||||
var sUserAgent = navigator.userAgent.toLowerCase();
|
var sUserAgent = navigator.userAgent.toLowerCase();
|
||||||
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
|
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
|
||||||
@ -182,6 +198,11 @@ export default {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/**/
|
||||||
|
isWX(){
|
||||||
|
var ua = navigator.userAgent.toLowerCase();
|
||||||
|
return (/micromessenger/.test(ua)) ? true : false;
|
||||||
|
},
|
||||||
closeDialogSuccess() {
|
closeDialogSuccess() {
|
||||||
this.qrtext = '';
|
this.qrtext = '';
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
@ -198,12 +219,6 @@ export default {
|
|||||||
// path: "/personal/useraddress",
|
// 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) {
|
async selectGoods(item, index) {
|
||||||
this.activeIndex = index;
|
this.activeIndex = index;
|
||||||
this.paytype = item.paytype;
|
this.paytype = item.paytype;
|
||||||
|
Loading…
Reference in New Issue
Block a user