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

反扫开发

parent da281927
...@@ -97,6 +97,7 @@ ...@@ -97,6 +97,7 @@
export default { export default {
data() { data() {
return { return {
enterUrl:'',//进入页面路由
merchantName: '', //商户名称 merchantName: '', //商户名称
productName: '', //产品名称 productName: '', //产品名称
orderList: '', //订单列表 orderList: '', //订单列表
...@@ -113,6 +114,7 @@ ...@@ -113,6 +114,7 @@
package:'', package:'',
signType:'', signType:'',
paySign:'', paySign:'',
orderInfo:'',//支付宝订单号
background:'',//去支付的背景颜色 background:'',//去支付的背景颜色
orderId:'',//订单Id orderId:'',//订单Id
openid:'',//用户Id openid:'',//用户Id
...@@ -121,7 +123,18 @@ ...@@ -121,7 +123,18 @@
} }
}, },
onLoad(option){ onLoad(option){
this.orderId=option.orderId //#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.ifyukuaiCode=option.ifyukuaiCode
this.afterBuyUrl=option.afterBuyUrl||'/pages/my/order/orderList/orderList' this.afterBuyUrl=option.afterBuyUrl||'/pages/my/order/orderList/orderList'
this.openid=uni.getStorageSync('openid')||'' this.openid=uni.getStorageSync('openid')||''
...@@ -193,6 +206,8 @@ ...@@ -193,6 +206,8 @@
this.package=res.data.package this.package=res.data.package
this.signType=res.data.signType this.signType=res.data.signType
this.paySign=res.data.sign this.paySign=res.data.sign
//支付宝入参
this.orderInfo = res.data.payInfo || ''
//支付参数结束 //支付参数结束
this.pdOrderMoney = res.data.pdOrderMoney this.pdOrderMoney = res.data.pdOrderMoney
if(this.pdOrderMoney==0&&res.data.subOrderType == -1){//0元购直接跳电子门票页面 if(this.pdOrderMoney==0&&res.data.subOrderType == -1){//0元购直接跳电子门票页面
...@@ -234,6 +249,8 @@ ...@@ -234,6 +249,8 @@
setTimeout(() => { setTimeout(() => {
this.background='f9690e' this.background='f9690e'
}, 1000) }, 1000)
// #ifdef MP-WEIXIN
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', provider: 'wxpay',
timeStamp:this.timeStamp, timeStamp:this.timeStamp,
...@@ -253,13 +270,35 @@ ...@@ -253,13 +270,35 @@
}) })
} }
}) })
} //#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> </script>
<style> <style>
.bigBox{height: 100%;background: #fafafc;} .bigBox{height: 100%;background: #fafafc;}
.middle{padding: 30rpx 24rpx 0 24rpx;} .middle{padding: 30rpx 24rpx 0 24rpx;}
.main{padding: 10rpx 24rpx 20rpx 24rpx;background: #FFFFFF;border-radius: 20rpx;box-shadow: 0 0 15rpx #e6e6e8;} .main{padding: 10rpx 24rpx 20rpx 24rpx;background: #FFFFFF;border-radius: 20rpx;box-shadow: 0 0 15rpx #e6e6e8;}
.product{border-bottom: 1px solid #e5e5e5;padding: 25rpx 0;} .product{border-bottom: 1px solid #e5e5e5;padding: 25rpx 0;}
......
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