diff --git a/api/model/my.js b/api/model/my.js index 84db737..5940068 100644 --- a/api/model/my.js +++ b/api/model/my.js @@ -100,7 +100,14 @@ const api = { limit: 500 }, - + // 钱包 - 提现 + cashout: { + url: '/teambuy/amount/cashout', + method: 'POST', + limit: 500 + }, + + } export default api \ No newline at end of file diff --git a/pages_order/mine/wallet.vue b/pages_order/mine/wallet.vue index 0ff6241..f9aecac 100644 --- a/pages_order/mine/wallet.vue +++ b/pages_order/mine/wallet.vue @@ -113,7 +113,7 @@ export default { return false } - if (amount > this.walletData.balance) { + if (amount > this.userInfo.balance) { this.amountError = '提现金额不能大于余额' return false } @@ -181,22 +181,24 @@ export default { title: '提交中...' }) - // 模拟提交过程 - // setTimeout(() => { - // uni.hideLoading() - // uni.showToast({ - // title: '提现申请已提交', - // icon: 'success' - // }) - - // // 模拟余额变更 - // this.walletData.balance -= parseFloat(this.withdrawAmount) - // // 清空表单 - // this.withdrawAmount = '' - // this.realName = '' - - // this.isFormValid = true - // }, 1500) + // 提现 + this.$api('cashout', { transferAmount: this.withdrawAmount, userName: this.realName }, res => { + uni.hideLoading() + if (res.code === 200) { + uni.showToast({ + title: '提现成功', + icon: 'success' + }) + this.$store.commit('getUserInfo') + this.withdrawAmount = '' + this.realName = '' + }else { + uni.showToast({ + title: res.message, + icon: 'error' + }) + } + }) }, recharge() { @@ -228,15 +230,6 @@ export default { }) } }) - - // 模拟重置时间 - // setTimeout(() => { - // // 模拟余额变更 - // this.walletData.balance += parseFloat(this.rechargeAmount) - // // 重置表单 - // this.rechargeAmount = '' - // this.isRecharge = false - // }, 1500) } }, fail: (err) => {