withdrawals.js
2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
var a = getApp(), n = a.request, e = require("../../../utils/common.js");
Page({
data: {
url: a.globalData.setting.url,
userMoney: 0,
capacheUrl: ""
},
onLoad: function(a) {
this.setData({
userMoney: a.money
}), this.getCapache();
},
submitWithdrawals: function(a) {
var e = a.detail.value;
if (!0 === this.checkFormData(e)) {
var t = this;
n.post("/api/user/withdrawals", {
data: {
account_bank: e.account_bank,
account_name: e.account_name,
bank_name: e.bank_name,
money: e.money,
verify_code: e.verify_code,
paypwd: e.paypwd
},
success: function() {
wx.showToast({
title: "已提交申请",
mask: !0,
complete: function() {
setTimeout(function() {
wx.navigateBack();
}, 1e3);
}
});
},
failStatus: function() {
t.getCapache();
}
});
}
},
checkFormData: function(n) {
console.log(n);
var e = parseFloat(n.money);
return isNaN(e) ? a.showWarning("请填写合法的提现金额") : e < .01 ? a.showWarning("请填写大于等于1分的提现金额") : e > this.data.userMoney ? a.showWarning("可提现最大金额是 " + this.data.userMoney + " 元") : n.bank_name.length < 2 ? a.showWarning("请填写正确的银行名称") : isNaN(parseInt(n.account_bank)) || "" == n.account_bank ? a.showWarning("请填写正确的收款账号") : "" == n.account_name ? a.showWarning("请填写正确的开户号") : "" == n.paypwd.length ? a.showWarning("支付密码不能为空") : "" != n.verify_code || a.showWarning("请先输入验证码");
},
getCapache: function() {
this.setData({
capacheUrl: e.getCapache()
});
}
});