This commit is contained in:
zhangjing
2021-06-07 09:48:24 +08:00
parent cf31e7c5d7
commit b420399fd8
5 changed files with 106 additions and 47 deletions

View File

@@ -95,13 +95,13 @@
</view> </view>
<radio class="radio" value="1" checked></radio> <radio class="radio" value="1" checked></radio>
</view> </view>
<!-- <view class="payContList-label"> <view class="payContList-label">
<view class="payContList-label-name"> <view class="payContList-label-name">
<image class="payContList-label-img" src="/static/img/wqb.jpg"></image> <image class="payContList-label-img" src="/static/img/wqb.jpg"></image>
沃钱包支付 沃钱包支付
</view> </view>
<radio class="radio" value="2"></radio> <radio class="radio" value="2"></radio>
</view> --> </view>
</radio-group> </radio-group>
<button class="payWayBtn" bindtap="orderPay">确认</button> <button class="payWayBtn" bindtap="orderPay">确认</button>
</view> </view>

View File

@@ -32,8 +32,8 @@ Page({
disabled : false, disabled : false,
payWayIndex : 0, payWayIndex : 0,
payWay :[ payWay :[
{value: 0, name: "微信支付"} {value: 0, name: "微信支付"},
// {value: 1, name: "沃钱包支付"} {value: 1, name: "沃钱包支付"}
] ]
}, },
@@ -353,7 +353,7 @@ Page({
if(this.data.payWayIndex == 1) { if(this.data.payWayIndex == 1) {
const newUrl = "https://lifetest.ysd-bs.com/unicom/payment?trade_no=" + res.data.trade_no const newUrl = "https://lifetest.ysd-bs.com/unicom/payment?trade_no=" + res.data.trade_no
let url= encodeURIComponent(newUrl) let url= encodeURIComponent(newUrl)
wx.navigateTo({ wx.redirectTo({
// 跳转到webview页面 // 跳转到webview页面
url: `/pages/webView/webView?url=${url}` url: `/pages/webView/webView?url=${url}`
}); });

View File

@@ -143,10 +143,10 @@
<image class="rightsLabel-row" src="/static/icon/rightsArrow.png"></image> <image class="rightsLabel-row" src="/static/icon/rightsArrow.png"></image>
</view> </view>
</view> </view>
<!-- <view class="rightsLabel-pay"> <view class="rightsLabel-pay">
<view class="rightsLabel-left">支付方式</view> <view class="rightsLabel-left">支付方式</view>
<view class="rightsLabel-right">微信支付</view> <view class="rightsLabel-right">{{payWay[payWayIndex].name}}</view>
</view> --> </view>
</view> </view>
<!-- 自提商家 --> <!-- 自提商家 -->

View File

@@ -18,6 +18,11 @@ Page({
remark : '', //使用须知 remark : '', //使用须知
platformCp : [], //选择提交数组 platformCp : [], //选择提交数组
platIndex : 0, //选择提交方式下标 platIndex : 0, //选择提交方式下标
payWayIndex : 0, //选择支付方式下标
payWay :[
{value: 0, name: "微信支付"},
{value: 1, name: "沃钱包支付"}
]
}, },
@@ -169,6 +174,15 @@ Page({
}) })
}, },
/**
* 支付选择
*/
payBind(e) {
this.setData({
payWayIndex: e.detail.value
})
},
/** /**
* 支付提交 * 支付提交
*/ */
@@ -178,46 +192,80 @@ Page({
is_deliver = this.data.isdeliver is_deliver = this.data.isdeliver
wx.$api.index.fridayInfo(welfareId, address_id, is_deliver).then(res=>{ wx.$api.index.fridayInfo(welfareId, address_id, is_deliver).then(res=>{
wx.$api.index.fridayPay(res.data.trade_no).then(res=>{ if(res.data.canPay == false) {
let payInfo = JSON.parse(res.data) wx.showToast({
wx.requestPayment({ title : '支付成功',
timeStamp: payInfo.timeStamp, icon : 'success',
nonceStr : payInfo.nonceStr, duration: 2000
package : payInfo.package, })
paySign : payInfo.paySign, setTimeout(()=>{
signType : payInfo.signType, if(this.data.isdeliver == 1) {
success : res=>{ wx.reLaunch({
if(res.errMsg == "requestPayment:ok"){ url: '/pages/order/order?orderType=rightsCoupons'
wx.showToast({ })
title: '支付成功', } else {
icon : 'success' wx.reLaunch({
}) url: '/pages/order/order?orderType=rights'
setTimeout(()=>{ })
}
},3000)
this.setData({
rightsTap: true
})
}else {
// payWayIndex为0的时候为微信支付
if(this.data.payWayIndex == 0) {
wx.$api.index.fridayPay(res.data.trade_no).then(res=>{
let payInfo = JSON.parse(res.data)
wx.requestPayment({
timeStamp: payInfo.timeStamp,
nonceStr : payInfo.nonceStr,
package : payInfo.package,
paySign : payInfo.paySign,
signType : payInfo.signType,
success : res=>{
if(res.errMsg == "requestPayment:ok"){
wx.showToast({
title: '支付成功',
icon : 'success'
})
setTimeout(()=>{
if(this.data.isdeliver == 1) {
wx.reLaunch({
url: '/pages/order/order?orderType=welfareGoods'
})
} else {
wx.reLaunch({
url: '/pages/order/order?orderType=welfare'
})
}
},3000)
}
},
fail : res=>{
if(this.data.isdeliver == 1) { if(this.data.isdeliver == 1) {
wx.reLaunch({ wx.reLaunch({
url: '/pages/order/order?orderType=welfareGoods' url: '/pages/order/order?orderType=welfareGoods&stateType=unpay'
}) })
} else { } else {
wx.reLaunch({ wx.reLaunch({
url: '/pages/order/order?orderType=welfare' url: '/pages/order/order?orderType=welfare&stateType=unpay'
}) })
} }
},3000) }
} })
}, })
fail : res=>{ }
if(this.data.isdeliver == 1) { // payWayIndex为1的时候为沃钱包支付
wx.reLaunch({ if(this.data.payWayIndex == 1) {
url: '/pages/order/order?orderType=welfareGoods&stateType=unpay' const newUrl = "https://lifetest.ysd-bs.com/unicom/payment?trade_no=" + res.data.trade_no
}) let url= encodeURIComponent(newUrl)
} else { wx.redirectTo({
wx.reLaunch({ // 跳转到webview页面
url: '/pages/order/order?orderType=welfare&stateType=unpay' url: `/pages/webView/webView?url=${url}`
}) });
} }
} }
})
})
}) })
} }
}) })

View File

@@ -90,12 +90,23 @@
</view> </view>
<!-- 支付方式 --> <!-- 支付方式 -->
<view class="rightsList"> <view class="rightsList">
<view class="rightsLabel-pay"> <view class="rightsLabel">
<view class="rightsLabel-left">支付方式</view> <view class="rightsLabel-left">请选择支付方式</view>
<view class="rightsLabel-right">微信支付</view> <view class="rightsLabel-right rightsLabel-range">
</view> <picker range="{{payWay}}" range-key="name" bindchange="payBind">
</view> <view class="tabs-text">
{{payWay[payWayIndex].name}}
</view>
</picker>
<image class="rightsLabel-row" src="/static/icon/rightsArrow.png"></image>
</view>
</view>
<view class="rightsLabel-pay">
<view class="rightsLabel-left">支付方式</view>
<view class="rightsLabel-right">{{payWay[payWayIndex].name}}</view>
</view>
</view>
<!-- 购买须知 --> <!-- 购买须知 -->
<view class="notice"> <view class="notice">