This commit is contained in:
13405411873 2024-09-27 23:14:09 +08:00
parent d60c3c9b70
commit 5a2e35198b
2 changed files with 49 additions and 13 deletions

View File

@ -189,6 +189,35 @@ export default {
console.log(res); console.log(res);
// TODO // TODO
this.orderInfo = res.data this.orderInfo = res.data
this.goPay(this.orderInfo)
})
},
async goPay(data) {
let that = this
await request({
url: '/userClient/pay/toPay',
method: 'get',
params: {orderId: data.id}
}).then((ress) => {
wx.requestPayment({
timeStamp: ress.data.timeStamp, // 19701100:00:00
nonceStr: ress.data.nonceStr, // 32
package: ress.data.package, // prepay_id prepay_id=*
signType: ress.data.signType, // MD5RSA
paySign: ress.data.paySign, //
success: function (res) {
console.log('成功',res);
if( res.errMsg = 'requestPayment:ok'){
uni.showToast({
title:'支付成功'
})
this.getUserInfos()
}
// res.errMsg = 'requestPayment:ok'
},
})
}) })
}, },
/** /**

View File

@ -37,7 +37,7 @@
<text>{{ formatTimestamp(item.createTime) }}</text> <text>{{ formatTimestamp(item.createTime) }}</text>
</view> </view>
<view class="line3"> <view class="line3">
<!-- <view v-if="item.orderStatus == '0'" @click="goPay(item)" class="showOrder">支付</view> --> <view v-if="item.orderStatus == '0'" @click="goPay(item)" class="showOrder">支付</view>
<view v-if="item.goodsType == '2'" @click="gotoDetail(item)" class="showOrder">查看订单</view> <view v-if="item.goodsType == '2'" @click="gotoDetail(item)" class="showOrder">查看订单</view>
<view @click="gotoEvaluate(item)" class="evaluate" v-if="item.goodsType == '2' && item.orderStatus === '1' && !item.commentDesc">评价订单</view> <view @click="gotoEvaluate(item)" class="evaluate" v-if="item.goodsType == '2' && item.orderStatus === '1' && !item.commentDesc">评价订单</view>
</view> </view>
@ -179,19 +179,26 @@ export default {
url: '/userClient/pay/toPay', url: '/userClient/pay/toPay',
method: 'get', method: 'get',
params: {orderId: data.id} params: {orderId: data.id}
}).then((res) => { }).then((ress) => {
wx.requestPayment({
timeStamp: ress.data.timeStamp, // 19701100:00:00
nonceStr: ress.data.nonceStr, // 32
package: ress.data.package, // prepay_id prepay_id=*
signType: ress.data.signType, // MD5RSA
paySign: ress.data.paySign, //
success: function (res) {
console.log('成功',res);
if( res.errMsg = 'requestPayment:ok'){
uni.showToast({
title:'支付成功'
})
this.getList()
}
// res.errMsg = 'requestPayment:ok'
},
this.$refs.popup.open()
setTimeout(() => {
drawQrcode({
width: 200,
height: 200,
canvasId: 'myQrcode',
text: res.data.code_url
}) })
that.convertToImage()
}, 60)
}) })
}, },