[添加转账,提现等新功能]
This commit is contained in:
63
pages/withdrawal_form/withdrawal_form.js
Normal file
63
pages/withdrawal_form/withdrawal_form.js
Normal file
@@ -0,0 +1,63 @@
|
||||
// pages/withdrawal_form/withdrawal_form.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
balance : '', //余额
|
||||
tax : '', //手续费
|
||||
disabled: false //按钮状态
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad (options) {
|
||||
// 获取提现前置账户信息
|
||||
this.withdrawsInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 提现前置账户信息
|
||||
*/
|
||||
withdrawsInfo() {
|
||||
wx.$api.user.withdraws().then(res=>{
|
||||
this.setData({
|
||||
balance: res.data.balance,
|
||||
tax : res.data.tax
|
||||
})
|
||||
|
||||
}).catch(err=>{})
|
||||
},
|
||||
|
||||
/**
|
||||
* 提现表单填写
|
||||
*/
|
||||
formSubmit(e) {
|
||||
let newAmount = e.detail.value.amount
|
||||
if(newAmount > 1) {
|
||||
wx.$api.user.withdrawsForm(newAmount, "mini").then(res=>{
|
||||
this.setData({
|
||||
disabled: true
|
||||
})
|
||||
|
||||
wx.showToast({
|
||||
title: '提现申请提交成功',
|
||||
})
|
||||
|
||||
setTimeout(()=>{
|
||||
wx.redirectTo({
|
||||
url: '/pages/withdrawal_record/withdrawal_record'
|
||||
})
|
||||
},2000)
|
||||
|
||||
}).catch(err=>{})
|
||||
}else {
|
||||
wx.showToast({
|
||||
title: '金额不得低于2元',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user