diff --git a/pages_order/mine/wallet.vue b/pages_order/mine/wallet.vue
index 0e8357a..f7088a1 100644
--- a/pages_order/mine/wallet.vue
+++ b/pages_order/mine/wallet.vue
@@ -9,10 +9,12 @@
总余额(元)
{{ walletData.balance.toFixed(2) }}
-
+
去充值
+ >
-
+
+
资产明细
>
@@ -22,23 +24,25 @@
- 我要提现
+ {{ isRecharge ? '我要充值' : '我要提现' }}
¥
-
+
-
+
-
+
提现说明
@@ -50,8 +54,8 @@
-
@@ -69,33 +73,29 @@ export default {
return {
walletData: null,
withdrawAmount: '',
+ rechargeAmount: '',
realName: '',
amountError: '',
- nameError: ''
- }
- },
- computed: {
- isFormValid() {
- return this.withdrawAmount && this.realName && !this.amountError && !this.nameError
+ nameError: '',
+ isFormValid: true,
+ isRecharge: false
}
},
+
onLoad() {
this.walletData = walletData
},
methods: {
// 导航到充值页面
navigateToRecharge() {
- uni.showToast({
- title: '充值功能暂未开放',
- icon: 'none'
- })
+ this.isRecharge = true
},
// 导航到资产明细页面
navigateToDetail() {
uni.showToast({
title: '资产明细功能暂未开放',
- icon: 'none'
+ icon: 'error'
})
},
@@ -144,13 +144,19 @@ export default {
// 提交提现申请
submitWithdraw() {
+ if (this.isRecharge) {
+ return this.recharge()
+ }
+
// 再次验证表单
if (!this.validateAmount() || !this.validateName()) {
+ console.log(2);
// 显示具体错误
if (this.amountError) {
+ console.log(3);
uni.showToast({
title: this.amountError,
- icon: 'none'
+ icon: 'error'
})
return
}
@@ -158,7 +164,7 @@ export default {
if (this.nameError) {
uni.showToast({
title: this.nameError,
- icon: 'none'
+ icon: 'error'
})
return
}
@@ -166,6 +172,11 @@ export default {
return
}
+ // 如果在isFormVaild为false的情况下进入函数 则为多次点击 直接返回
+ if (this.isFormValid) {
+ this.isFormValid = false
+ }else return
+
// 显示提交中状态
uni.showLoading({
title: '提交中...'
@@ -185,7 +196,40 @@ export default {
// 模拟余额变更
this.walletData.balance -= parseFloat(this.withdrawAmount)
+ this.isFormValid = true
}, 1500)
+ },
+
+ recharge() {
+ uni.showModal({
+ title: '确认充值',
+ content: '充值金额为' + this.rechargeAmount + '元',
+ confirmColor: '#019245',
+ success: (res) => {
+ // 这里编写函数逻辑
+ if (res.confirm) {
+ uni.showLoading({
+ title: '充值中...'
+ })
+ // 执行重置逻辑
+
+ // 模拟重置时间
+ setTimeout(() => {
+ uni.hideLoading()
+ uni.showToast({
+ title: '充值成功',
+ icon: 'success'
+ })
+ // 重置表单
+ this.rechargeAmount = ''
+ this.isRecharge = false
+ }, 1500)
+ }
+ },
+ fail: (err) => {
+ console.log(err);
+ }
+ })
}
}
}
@@ -245,12 +289,12 @@ export default {
justify-content: center;
font-size: 24rpx;
font-weight: normal;
+ gap: 4rpx;
// line-height: 1;
padding: 0 20rpx;
}
.detail-btn {
- // border: 1px solid rgba(255, 255, 255, 0.6);
.arrow {
margin-left: 10rpx;
@@ -275,7 +319,7 @@ export default {
align-items: center;
padding: 24rpx 20rpx;
margin-bottom: 20rpx;
- // background-color: red;
+ background-color: #e7e7e7;
border-radius: 20rpx;
.currency-symbol {
color: #FF0000;