| | |
| | | // payList.value[index1].checked = true |
| | | // payMethod.value = payList.value[index1].value |
| | | // } |
| | | const e = ref('123125') |
| | | async function submit(){ |
| | | let money = '' |
| | | if(disabled.value){ |
| | |
| | | money = Number(otherMoney.value) |
| | | } |
| | | await wxPayApi({businessType:1,tradeAmount:money}).then((res) =>{ |
| | | console.log('reswxpay',res) |
| | | |
| | | e.value = res |
| | | if(res.code == 200){ |
| | | //调用微信官方支付接口弹出付款界面,输入密码扣款 |
| | | wx.requestPayment({ |
| | | //预支付订单信息 |
| | |
| | | success (res) { |
| | | if (res.errMsg == "requestPayment:ok"){ |
| | | console.log('支付成功', res) |
| | | uni.showToast({ |
| | | title: '支付成功', |
| | | duration: 2000, |
| | | }); |
| | | uni.navigateBack() |
| | | }else{ |
| | | console.log('支付失败') |
| | | uni.showToast({ |
| | | title: '支付失败', |
| | | duration: 2000, |
| | | icon:'none' |
| | | }); |
| | | } |
| | | |
| | | }, |
| | | fail (res) { |
| | | console.log('支付失败', res) |
| | | uni.showToast({ |
| | | title: '微信支付失败', |
| | | duration: 2000, |
| | | icon:'none' |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | |
| | | } |
| | | </script> |
| | | <template> |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <text>{{e}}</text> |
| | | <view class="submit-btn" @click="submit()">立即充值</view> |
| | | </view> |
| | | </view> |