Commit 44040ee8 authored by 潘永坪's avatar 潘永坪

反扫开发

parent da281927
......@@ -97,6 +97,7 @@
export default {
data() {
return {
enterUrl:'',//进入页面路由
merchantName: '', //商户名称
productName: '', //产品名称
orderList: '', //订单列表
......@@ -113,6 +114,7 @@
package:'',
signType:'',
paySign:'',
orderInfo:'',//支付宝订单号
background:'',//去支付的背景颜色
orderId:'',//订单Id
openid:'',//用户Id
......@@ -121,7 +123,18 @@
}
},
onLoad(option){
//#ifdef MP-WEIXIN
this.enterUrl=option.q
//#endif
//#ifdef MP-ALIPAY
this.enterUrl=uni.getStorageSync('alipayQrCode')
//#endif
if(this.enterUrl){
this.orderId=this.getUrlKey('orderId')
}else{
this.orderId=option.orderId
}
this.ifyukuaiCode=option.ifyukuaiCode
this.afterBuyUrl=option.afterBuyUrl||'/pages/my/order/orderList/orderList'
this.openid=uni.getStorageSync('openid')||''
......@@ -193,6 +206,8 @@
this.package=res.data.package
this.signType=res.data.signType
this.paySign=res.data.sign
//支付宝入参
this.orderInfo = res.data.payInfo || ''
//支付参数结束
this.pdOrderMoney = res.data.pdOrderMoney
if(this.pdOrderMoney==0&&res.data.subOrderType == -1){//0元购直接跳电子门票页面
......@@ -234,6 +249,8 @@
setTimeout(() => {
this.background='f9690e'
}, 1000)
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: 'wxpay',
timeStamp:this.timeStamp,
......@@ -253,7 +270,29 @@
})
}
})
//#endif
// #ifdef MP-ALIPAY
uni.requestPayment({
provider: 'alipay', // 服务提供商 支付宝支付: alipay 微信支付: wxpay
orderInfo: this.orderInfo, // 支付宝订单号
success: function (res) {
uni.navigateTo({
url:_this.afterBuyUrl+'?orderId='+_this.orderId+'&ifyukuaiCode='+_this.ifyukuaiCode
})
},
fail: function (err) {
uni.showToast({
title:err.errMsg,
icon:'none'
})
}
})
// #endif
},
getUrlKey(name){//---------------------------------------------------------------获取url
return(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ''])[1].replace(/\+/g, '%20') || ''
},
}
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment