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,6 +192,29 @@ 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=>{
if(res.data.canPay == false) {
wx.showToast({
title : '支付成功',
icon : 'success',
duration: 2000
})
setTimeout(()=>{
if(this.data.isdeliver == 1) {
wx.reLaunch({
url: '/pages/order/order?orderType=rightsCoupons'
})
} else {
wx.reLaunch({
url: '/pages/order/order?orderType=rights'
})
}
},3000)
this.setData({
rightsTap: true
})
}else {
// payWayIndex为0的时候为微信支付
if(this.data.payWayIndex == 0) {
wx.$api.index.fridayPay(res.data.trade_no).then(res=>{ wx.$api.index.fridayPay(res.data.trade_no).then(res=>{
let payInfo = JSON.parse(res.data) let payInfo = JSON.parse(res.data)
wx.requestPayment({ wx.requestPayment({
@@ -218,6 +255,17 @@ Page({
} }
}) })
}) })
}
// payWayIndex为1的时候为沃钱包支付
if(this.data.payWayIndex == 1) {
const newUrl = "https://lifetest.ysd-bs.com/unicom/payment?trade_no=" + res.data.trade_no
let url= encodeURIComponent(newUrl)
wx.redirectTo({
// 跳转到webview页面
url: `/pages/webView/webView?url=${url}`
});
}
}
}) })
} }
}) })

View File

@@ -91,9 +91,20 @@
<!-- 支付方式 --> <!-- 支付方式 -->
<view class="rightsList"> <view class="rightsList">
<view class="rightsLabel">
<view class="rightsLabel-left">请选择支付方式</view>
<view class="rightsLabel-right rightsLabel-range">
<picker range="{{payWay}}" range-key="name" bindchange="payBind">
<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-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>