var api = require('../../../config/api.js'); var check = require('../../../utils/check.js'); var app = getApp(); Page({ data: { amt: '0.00', mobile: '', code: '' }, onLoad: function(options) { // 页面初始化 options为页面跳转所带来的参数 let userInfo = wx.getStorageSync('userInfo'); this.setData({ amt: options.remainAmount, mobile:userInfo.phone }); // 页面渲染完成 }, onReady: function() { }, onShow: function() { // 页面显示 }, onHide: function() { // 页面隐藏 }, onUnload: function() { // 页面关闭 }, sendCode: function() { let that = this; if (this.data.mobile.length == 0) { wx.showModal({ title: '错误信息', content: '手机号不能为空', showCancel: false }); return false; } if (!check.isValidPhone(this.data.mobile)) { wx.showModal({ title: '错误信息', content: '手机号输入不正确', showCancel: false }); return false; } wx.request({ url: api.AuthRegisterCaptcha, data: { mobile: that.data.mobile }, method: 'POST', header: { 'content-type': 'application/json' }, success: function(res) { if (res.data.errno == 0) { wx.showModal({ title: '发送成功', content: '验证码已发送', showCancel: false }); } else { wx.showModal({ title: '错误信息', content: res.data.errmsg, showCancel: false }); } } }); }, goWithdrawal: function() { var that = this; if (this.data.mobile.length == 0 || this.data.code.length == 0) { wx.showModal({ title: '错误信息', content: '手机号和验证码不能为空', showCancel: false }); return false; } if (!check.isValidPhone(this.data.mobile)) { wx.showModal({ title: '错误信息', content: '手机号输入不正确', showCancel: false }); return false; } //调用后台申请提现接口 }, bindMobileInput: function(e) { this.setData({ mobile: e.detail.value }); }, bindCodeInput: function(e) { this.setData({ code: e.detail.value }); }, clearInput: function(e) { switch (e.currentTarget.id) { case 'clear-code': this.setData({ code: '' }); break; } } })