Redirect to userPayData.wxPay

This commit is contained in:
Vion 2022-01-27 17:40:14 +08:00
parent 300788a552
commit 808807c563
3 changed files with 56 additions and 23 deletions

View File

@ -33,6 +33,22 @@ let util = {
} else { } else {
return 2; return 2;
} }
},
checkPaytypeValidated($paytype) {
if(isWx && $paytype == 1) {
//return 3;
return true;
} else if(isWx && $paytype!=1) {
return false;
}
if(!isMobile && $paytype == 1) {
//Desktop, use native pay
return true;
} else if(isMobile && $paytype == 2) {
return true;
}
return false;
} }
} }
export default util; export default util;

View File

@ -140,10 +140,12 @@
import Myheader from "~/components/header.vue"; import Myheader from "~/components/header.vue";
import MyFooter from '~/components/rc-footer.vue'; import MyFooter from '~/components/rc-footer.vue';
import tabs from "~/components/tabs.vue"; import tabs from "~/components/tabs.vue";
import { customerorders, userindent, canceldanhao,generateOrderWX } from "../../ajax/getData"; import util from "@/ajax/util";
import { customerorders, userindent, canceldanhao, repayOrde } from "../../ajax/getData";
export default { export default {
data() { data() {
return { return {
util,
crumbs:[ crumbs:[
{ {
path:'/personal/mypersonal/', path:'/personal/mypersonal/',
@ -346,28 +348,39 @@ export default {
}, },
// //
async getwei(item) { async getwei(item) {
console.log(item); let data = await this.repayOrde(item.orderNumber);
let postData = []; if(data.code==1) {
let userPayData = { let userPayData = {
userprice: item.salesAmount, userprice: item.usersalesAmount,
orderId:item.orderNumber, orderId: item.orderNumber,
userinformation:item.addressUserName + userinformation: item.addressUserName + " " + item.addressPhoneNumber,
" " + wxPay:data.msg
item.phoneNumber, };
wxPay: "weixin://wxpay/bizpayurl?pr=4RJbokxzz",
};
this.$router.push({
path: "/personal/userpay",
query: {
userData:item.orderNumber,
stype:1,
userPayData: JSON.stringify(userPayData),
},
});
},
this.$router.push({
path: "/personal/userpay",
query: {
userData: item.orderNumber,
stype: 1,
userPayData: JSON.stringify(userPayData),
},
});
} else {
this.$message({
type: "error",
message: "订单数据错误,请联系客服进行处理",
});
}
},
async repayOrde(ordernumber) {
let payType = this.util.pickPaytype();
let res = await repayOrde(ordernumber, payType);
if (res) {
return res;
}
},
usertiaozhuan(item){ usertiaozhuan(item){
this.$router.push({ this.$router.push({
path: "/myorder/usertion", path: "/myorder/usertion",

View File

@ -94,7 +94,9 @@
</div> </div>
</el-dialog> </el-dialog>
<div style="display:none"> <div style="display:none">
<form :action="this.h5PayUrl" method="post" ref="h5SubmitForm"></form> <form :action="this.h5PayUrl" method="post" ref="h5SubmitForm">
<input type="hidden" v-model="h5payRedirectUrl">
</form>
</div> </div>
</div> </div>
</template> </template>
@ -112,6 +114,7 @@ export default {
data() { data() {
return { return {
util, util,
h5payRedirectUrl:'',
activeIndex: 0, activeIndex: 0,
paymentTimer:undefined, paymentTimer:undefined,
isSucess: false, isSucess: false,
@ -176,6 +179,7 @@ export default {
goPayH5() { goPayH5() {
let isMobile = this.util.isMobile(); let isMobile = this.util.isMobile();
if(this.userPayData.wxPay && isMobile) { if(this.userPayData.wxPay && isMobile) {
//this.$refs["h5SubmitForm"].action="http://47.96.75.242:10086/royalcanin/royalcanin/redirectUrlWXH5";
this.$refs["h5SubmitForm"].action=this.userPayData.wxPay; this.$refs["h5SubmitForm"].action=this.userPayData.wxPay;
this.$refs["h5SubmitForm"].submit(); this.$refs["h5SubmitForm"].submit();
//window.location.href=this.userPayData.wxPay;; //window.location.href=this.userPayData.wxPay;;