Commit 23886fc0 authored by liwei's avatar liwei

修改了充值

parent 62106c9a
......@@ -96,61 +96,68 @@ export default {
payGoldCoins(params).then(res => {
if (res.data.code === 200) {
const orderId = res.data.data.businessId
// 支付
const payquery = {
orderId: orderId,
type:'1',
activityId: 0
if (res.data.data.price > 0){
// 支付
const payquery = {
orderId: orderId,
type:'1',
activityId: 0
}
pay(payquery).then(res => {
console.log("支付参数", res)
console.log("测试支付", res.data.errMsg)
if (res.data.errMsg === 'OK') {
if (!res.data.data.nonceStr) {
uni.showToast({
title: '下单失败,请稍后重试',
icon: 'none'
})
} else {
// 调取微信支付窗口
uni.requestPayment({
provider: "wxpay",
appId: res.data.appid, // 微信小程序appid
timeStamp: res.data.timeStamp, // 时间戳
nonceStr: res.data.nonceStr, // 随机字符串
package: res.data.package,
signType: "MD5", // 签名算法
paySign: res.data.paySign, // 签名
success(res) {
uni.showToast({
title: '支付成功',
icon: 'success'
})
this.show = false
uni.navigateTo({
url:'/my/myorder/index'
})
},
fail(e) {
console.log("支付失败", e)
uni.showToast({
title: '支付已取消',
icon: 'none'
})
const orderStatus = {
orderId: orderId,
activityId: activityId
}
}
});
}
} else {
uni.showToast({
title: '下单失败',
icon: 'none'
})
}
})
} else {
uni.showToast({
title: '充值成功!',
icon: 'success'
})
}
// pay(payquery).then(res => {
// console.log("支付参数", res)
// console.log("测试支付", res.data.errMsg)
// if (res.data.errMsg === 'OK') {
// if (!res.data.data.nonceStr) {
// uni.showToast({
// title: '下单失败,请稍后重试',
// icon: 'none'
// })
// } else {
// // 调取微信支付窗口
// uni.requestPayment({
// provider: "wxpay",
// appId: res.data.appid, // 微信小程序appid
// timeStamp: res.data.timeStamp, // 时间戳
// nonceStr: res.data.nonceStr, // 随机字符串
// package: res.data.package,
// signType: "MD5", // 签名算法
// paySign: res.data.paySign, // 签名
// success(res) {
// uni.showToast({
// title: '支付成功',
// icon: 'success'
// })
// this.show = false
// uni.navigateTo({
// url:'/my/myorder/index'
// })
// },
// fail(e) {
// console.log("支付失败", e)
// uni.showToast({
// title: '支付已取消',
// icon: 'none'
// })
// const orderStatus = {
// orderId: orderId,
// activityId: activityId
// }
// }
// });
// }
// } else {
// uni.showToast({
// title: '下单失败',
// icon: 'none'
// })
// }
// })
} else if(res.data.code !== 200){
uni.showToast({
title: res.data.message,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment