支付修改

This commit is contained in:
魏啾
2024-05-30 15:12:31 +08:00
parent 6402da83aa
commit 1efdcca59c
3 changed files with 58 additions and 40 deletions

View File

@@ -172,7 +172,7 @@
以优惠¥{{emitorderfoodform.couponsPrice}}
</view>
</view>
<view class="fixedview_tow" @tap="$u.debounce(showpopupclick, 500)">
<view class="fixedview_tow" @tap="$u.debounce(showpopupclickdd, 500)">
立即付款
</view>
</view>
@@ -257,11 +257,6 @@
this.radiovalue1 = n
uni.cache.set('radiovalue1', n)
},
// fangdouevent() {
// this.$u.debounce(() => {
// this.showpopupclick()
// }, 1000)
// },
async getcoupon() {
let res = await this.api.userCoupon({
"orderNum": this.listinfo.amount,
@@ -297,7 +292,10 @@
console.log(msg, 'createOrder执行')
this.listinfoid = msg.data.id //下单需要的id
this.orderInfo = msg.data
this.showpopupclickdd()
if (this.radiovalue1 == 1) {
this.showpopupclickdds() //微信支付
}
}
},
handlemessage() {
@@ -354,35 +352,40 @@
},
// 去充值
goRecharge() {
console.log(this.amountVIP.shopId, '调试11111')
uni.pro.navigateTo('/pages/member/index', {
shopId: this.amountVIP.shopId
})
},
showpopupclickdd(i) {
showpopupclickdd() {
console.log(this.radiovalue1, 'radiovalue1的值')
if (this.radiovalue1 == 1) {
this.showpopupclickdds()
this.showpopupclick() //生成订单
} else {
// 判断是否有绑定支付密码
// 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码
let isVip = uni.cache.get('userInfo').isPwd
if (isVip == 0) {
if (uni.cache.get('userInfo').isPwd == 0) {
uni.pro.navigateTo('/pages/user/repairpassword', {
shopId_id: uni.cache.get('shopUser')
})
} else {
this.ispws = true
this.$nextTick(() => {
this.$refs.payPwd.onPayUp();
})
if(this.amountVIP.amount > this.listinfo.amount){
this.ispws = true
this.showpopupclick() //生成订单
this.$nextTick(() => {
this.$refs.payPwd.onPayUp();
})
}else{
uni.showToast({
title: "余额不足"
})
}
}
}
},
// 微信支付
async showpopupclickdds() {
let res = await this.api.payorderPay({
orderId: this.listinfoid
}) //判断是否支付成功
@@ -408,13 +411,17 @@
uni.cache.set('shopUser', '') //删除shopUser
this.paymodfiyOrderInfo()
setTimeout(res => {
// uni.redirectTo({
// url: '/pages/order/successful?orderId=' + this
// .listinfoid + '&orderInfo=' + JSON.stringify(
// this.orderInfo) + '&radiovalue1=' + this
// .radiovalue1
// });
uni.redirectTo({
url: '/pages/order/successful?orderId=' + this
.listinfoid + '&orderInfo=' + JSON.stringify(
this.orderInfo) + '&radiovalue1=' + this
.radiovalue1
url: '/pages/order/order_detail?orderId=' + this
.listinfoid
});
}, 1000)
}, 500)
// uni.redirectTo({
// url: "/pages/mall/order/ordersuccess?id=" + datareslane.data
// .order_id,
@@ -425,10 +432,18 @@
icon: 'none',
title: '支付失败'
})
// uni.hideLoading()
// uni.redirectTo({
// url: '/pages/order/order_detail?orderId=' + this.listinfoid
// });
setTimeout(res => {
// uni.redirectTo({
// url: '/pages/order/successful?orderId=' + this
// .listinfoid + '&orderInfo=' + JSON.stringify(
// this.orderInfo) + '&radiovalue1=' + this
// .radiovalue1
// });
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + this
.listinfoid
});
}, 500)
},
complete: (data) => {
console.log(data, '成功与否')
@@ -451,13 +466,17 @@
title: '支付成功',
success: () => {
setTimeout(res => {
// uni.redirectTo({
// url: '/pages/order/successful?orderId=' + this
// .listinfoid + '&orderInfo=' + JSON.stringify(
// this.orderInfo) + '&radiovalue1=' + this
// .radiovalue1
// });
uni.redirectTo({
url: '/pages/order/successful?orderId=' + this
.listinfoid + '&orderInfo=' + JSON.stringify(
this.orderInfo) + '&radiovalue1=' + this
.radiovalue1
url: '/pages/order/order_detail?orderId=' + this
.listinfoid
});
}, 1000)
}, 500)
}