提交 ffbff697 authored 作者: 王鹏飞's avatar 王鹏飞

支付修改

上级 e1fa7a9b
...@@ -51,22 +51,45 @@ export default { ...@@ -51,22 +51,45 @@ export default {
// 微信支付 // 微信支付
wxPay() { wxPay() {
const options = this.order.options const options = this.order.options
wx.chooseWXPay({ WeixinJSBridge.invoke(
timestamp: options.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符 'getBrandWCPayRequest',
nonceStr: options.nonceStr, // 支付签名随机串,不长于 32 位 {
package: `prepay_id=${this.order.prepay_id}`, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*) appId: options.appId, //公众号名称,由商户传入
signType: options.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5' timestamp: options.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
paySign: options.paySign, // 支付签名 nonceStr: options.nonceStr, // 支付签名随机串,不长于 32 位
success: res => { package: `prepay_id=${this.order.prepay_id}`, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
this.$toast('支付成功') signType: options.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
// 支付成功后的回调函数 paySign: options.paySign // 支付签名
this.$emit('success', res)
}, },
fail: error => { function (res) {
this.$toast('支付失败') if (res.err_msg == 'get_brand_wcpay_request:ok') {
this.$emti('fail', error) // 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
this.$toast('支付成功')
// 支付成功后的回调函数
this.$emit('success', res)
} else {
this.$toast('支付失败')
this.$emti('fail', error)
}
} }
}) )
// wx.chooseWXPay({
// timestamp: options.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
// nonceStr: options.nonceStr, // 支付签名随机串,不长于 32 位
// package: `prepay_id=${this.order.prepay_id}`, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
// signType: options.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
// paySign: options.paySign, // 支付签名
// success: res => {
// this.$toast('支付成功')
// // 支付成功后的回调函数
// this.$emit('success', res)
// },
// fail: error => {
// this.$toast('支付失败')
// this.$emti('fail', error)
// }
// })
}, },
pay() { pay() {
this.getOpenId() this.getOpenId()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论