temp payment method integration

This commit is contained in:
Vion
2022-01-26 19:39:20 +08:00
parent 0e87e84f9e
commit f058f0a1e0
9 changed files with 273 additions and 211 deletions

View File

@@ -608,6 +608,9 @@ ul li ol li em strong i {
background: #fff;
width: 100%;
padding: 10px;
div:first-child {
text-align: left;;
}
}
}
}

View File

@@ -588,7 +588,8 @@ export default {
// // },
// // },
// ];
let res = await generateOrderWX(postData);
let isMobile = this.isMobile();
let res = await generateOrderWX(postData,isMobile);
if (res.success) {
let userPayData = {
orderId: res.data.orderNumber,
@@ -599,7 +600,7 @@ export default {
postData[0].orderAddress.addressPhoneNumber,
// wxPay: "weixin://wxpay/bizpayurl?pr=4RJbokxzz",
// wxPay: "weixin://wxpay/bizpayurl?pr=4RJbokxzz",
wxPay: res.msg,
wxPay: (res.msg?res.msg:''),
};
this.$router.push({
path: "/personal/userpay",
@@ -617,6 +618,22 @@ export default {
async canceldanhao(orderNumber) {
let data = await userin(orderNumber);
},
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;
}
}
},
mounted() {
this.goldmedal = JSON.parse(this.$route.query.list);

View File

@@ -396,16 +396,18 @@ export default {
userpay(item, index) {
if (item.status == 0) {
this.canceldanhao(item.orderNumber);
setTimeout(() => {
this.indet(this.userdata);
this.useralllist=[];
this.alllist=[];
this.allmessage=[];
this.obligation=[];
this.receiving=[];
this.pending=[];
}, 500);
if(confirm('确认取消该订单嘛?')){
this.canceldanhao(item.orderNumber);
setTimeout(() => {
this.indet(this.userdata);
this.useralllist=[];
this.alllist=[];
this.allmessage=[];
this.obligation=[];
this.receiving=[];
this.pending=[];
}, 500);
}
} else if(item.status == 1) { //确认收货
}

View File

@@ -42,16 +42,25 @@
:key="index"
@click="selectGoods(item, index)"
:class="activeIndex == index ? 'active' : ''"
v-if="(!disableAlipay || (disableAlipay && item.type!='alipay'))"
>
<img :src="item.payimage" alt="" />
<span>{{ item.paytype }}支付</span>
<div style="display:flex;">
<img :src="item.payimage" alt="" />
<span>{{ item.paytype }}支付</span>
</div>
</li>
</ul>
</div>
</div>
<div class="paycord">
<div class="qrcode"><vue-qr :text="qrtext" :size="260"></vue-qr></div>
<div class="payconfirm rc-padding-y--md" v-if="disableQrcode">
<span class="ts-standard-btn ts-standard-btn--two center" @click="goPayH5">
确认支付
</span>
</div>
<div class="paycord" v-if="!disableQrcode">
<div class="qrcode"><vue-qr :text="qrtext" :size="260"></vue-qr></div>
<span>{{ paytype }}扫一扫立即支付</span>
</div>
@@ -90,49 +99,84 @@ import tabs from "@/components/tabs.vue";
import vueQr from 'vue-qr'
import { generateOrderAlipay, updateOrderWX, monitorOrderNotify,repayOrde } from "../../ajax/getData";
export default {
data() {
return {
activeIndex: 0,
paymentTimer:undefined,
isSucess: false,
dialogSuccess: true,
dialogSuccess: false,
paytype: "微信",
userpaystype: [
{
paytype: "微信",
payimage: require("../../assets/pay/wx.png"),
type:'wechat'
},
/*
{
paytype: "支付宝",
payimage: require("../../assets/pay/zfb.png"),
type:'alipay'
},
*/
],
dialogFail: false,
userPayData: {},
qrtext:'',
userData:'',
disableAlipay:true,
disableQrcode:false,
};
},
computed: {},
computed: {
},
created(){
},
mounted() {
let stype=this.$route.query.stype;
console.log(stype)
if(stype==1){
this.userData = this.$route.query.userData;
this.repayOrde(this.userData);
this.userPayData = JSON.parse(this.$route.query.userPayData);
console.log(this.userPayData);
}else{
this.userPayData = JSON.parse(this.$route.query.userPayData);
console.log(this.userPayData);
}
this.qrtext=this.userPayData.wxPay
this.payOrderWX();
this.userPayData = JSON.parse(this.$route.query.userPayData);
this.defaultHandlePayment();
},
methods: {
defaultHandlePayment() {
let isMobile = this.isMobile();
if(this.userPayData.wxPay && !isMobile) {
this.qrtext=this.userPayData.wxPay;
this.payOrderWX();
this.disableQrcode=false;
} else if (this.userPayData.wxPay && isMobile) {
this.disableQrcode=true;
} else if(!this.userPayData.wxPay || this.userPayData.wxPay.length<=4) {
throw new Error("订单信息错误,请删除商品后再次购买");
}
},
goPayH5() {
let isMobile = this.isMobile();
if(this.userPayData.wxPay && isMobile) {
window.location.href=this.userPayData.wxPay;
this.disableQrcode=true;
} else {
throw new Error("订单信息错误,请删除商品后再次购买");
}
},
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;
}
},
closeDialogSuccess() {
this.qrtext = '';
this.$router.push({
@@ -149,27 +193,20 @@ export default {
// path: "/personal/useraddress",
// });
},
async repayOrde(ordernumber) {
let res = await repayOrde(ordernumber);
console.log(ordernumber);
if (res) {
console.log(res)
this.qrtext=res.msg
console.log(this.qrtext);
}
},
async selectGoods(item, index) {
this.activeIndex = index;
this.paytype = item.paytype;
if (index == 1) {
//支付宝
let res = await generateOrderAlipay(this.userPayData.orderId);
this.qrtext = '';
if (res.success) {
this.qrtext=res.data
this.qrtext=res.data;
}
}
} else {
this.userPayData = JSON.parse(this.$route.query.userPayData);
this.qrtext=this.userPayData.wxPay
}
},
//支付监听
@@ -181,13 +218,13 @@ export default {
} else if (res.fail) {
this.dialogFail = true;
}else{
} else {
let _self = this;
this.paymentTimer = setTimeout(function(){
_self.payOrderWX()
},5000);
}
},
}
},
components: {
Myheader,
@@ -297,6 +334,13 @@ export default {
}
}
@media screen and (max-width: 768px) {
.payconfirm{
position:fixed;
bottom:0;
left:0;
width:100%;
}
.ph_hidden {
display: none;
}
@@ -320,7 +364,7 @@ export default {
justify-content: left;
&.active {
border: none;
border-bottom: 1px solid #d7d7d7;
border-bottom: 4px solid #e2001a;
}
}
}