设置页弹窗支付问题处理

This commit is contained in:
lanzhihui 2024-09-30 09:39:24 +08:00
parent 98d8c1f67b
commit 4fa0955255

View File

@ -179,60 +179,53 @@ import https from '../mixins/https'
},
conversion(item) {
let that = this,
url = `${service.host}/user/recharge/v2`
url = `${service.host}/rank/buy`
that.modalName = ''
that.$showLoading('支付中...')
let data = {
sub_rank_id: that.payId,
chat_user_id: that.chat_user_id
pay_type: 'cash'
// chat_user_id: that.chat_user_id
}
that.$post({url: url, data}, {
success: ({code, data}) => {
that.trade_no = data.trade_no
if (data.wx_pay.length == 0) {
that.$post({url: `${service.orderpay}/${that.trade_no}/v2`}).then(({code, data}) => {
that.$post({url: url, data}).then(({code, data}) => {
that.trade_no = data.order.trade_no
if (data.length == 0) {
that.$post({url: `${service.host}/order/${that.trade_no}/callback`}).then(({code, data}) => {
// that.getUserData()
that.$emit('toUpdateCut')
that.$Toast_success('支付成功')
})
})
} else {
let wxconfig = data.wx_pay.config
let wxconfig = data.config
if (wxconfig.payment_debug) {
return that.$post({url: `${service.orderpay}/${that.trade_no}/v2`}).then(({code, data}) => {
return that.$post({url: `${service.host}/order/${that.trade_no}/callback`}).then(({code, data}) => {
// that.getUserData()
that.$emit('toUpdateCut')
that.$Toast_success('支付成功')
})
})
}
wx.requestPayment({
timeStamp: wxconfig.timestamp, // 支付签名时间戳注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
timeStamp: wxconfig.timeStamp, // 支付签名时间戳注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
nonceStr: wxconfig.nonceStr, // 支付签名随机串,不长于 32 位
package: wxconfig.package, // 统一支付接口返回的prepay_id参数值提交格式如prepay_id=***
signType: wxconfig.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
paySign: wxconfig.paySign, // 支付签名
success: function (res) {
that.$post({url: `${service.orderpay}/${that.trade_no}/v2`}).then(({code, data}) => {
that.$post({url: `${service.host}/order/${that.trade_no}/callback`}).then(({code, data}) => {
// that.getUserData()
that.$emit('toUpdateCut')
that.$Toast_success('支付成功')
})
})
},
fail: function (res) {
console.log(res, '===')
wx.showToast({
title: '已取消支付',
icon: 'none',
duration: 2000
})
}
})
}
},
fail: ({code, data}) => {
},
complete: () => {
setTimeout(() => {
wx.hideLoading()
}, 1200)
})
}
})
},