| // pages/bindcheck/bindcheck.js |
| Page({ |
| |
| /** |
| * 页面的初始数据 |
| */ |
| data: { |
| phone: '', |
| code: '', |
| sendTime: '获取验证码', |
| sendColor: 'rgb(124, 255, 112)', |
| snsMsgWait: 30, |
| smsFlag: true, |
| privacyCheck:'' |
| }, |
| |
| /** |
| * 生命周期函数--监听页面加载 |
| */ |
| onLoad: function(options) { |
| wx.setNavigationBarTitle({ |
| title: '获取验证码', |
| }) |
| |
| var phone = wx.getStorageSync('phoneX'); |
| if (!wx.$isEmpty(phone)) { |
| this.setData({ |
| phone: phone |
| }) |
| } else { |
| phone = wx.getStorageSync('phone'); |
| this.setData({ |
| phone: phone |
| }) |
| } |
| }, |
| |
| |
| /** |
| * 生命周期函数--监听页面初次渲染完成 |
| */ |
| onReady: function() { |
| |
| }, |
| |
| /** |
| * 生命周期函数--监听页面显示 |
| */ |
| onShow: function() { |
| |
| }, |
| |
| /** |
| * 生命周期函数--监听页面隐藏 |
| */ |
| onHide: function() { |
| |
| }, |
| |
| /** |
| * 生命周期函数--监听页面卸载 |
| */ |
| onUnload: function() { |
| |
| }, |
| |
| /** |
| * 页面相关事件处理函数--监听用户下拉动作 |
| */ |
| onPullDownRefresh: function() { |
| |
| }, |
| |
| /** |
| * 页面上拉触底事件的处理函数 |
| */ |
| onReachBottom: function() { |
| |
| }, |
| setCode:function(e){ |
| this.setData({ |
| code: e.detail.value |
| }) |
| }, |
| |
| /** |
| * 用户点击右上角分享 |
| */ |
| onShareAppMessage: function() { |
| |
| }, |
| checkboxChange:function(e){ |
| console.log(e.detail.value); |
| this.setData({ |
| privacyCheck: e.detail.value |
| }) |
| }, |
| showXy:function(){ |
| wx.navigateTo({ |
| url: '../signxy/signxy', |
| }) |
| }, |
| doNext: function () { |
| var code = this.data.code; |
| if (wx.$isEmpty(code)) { |
| return; |
| } |
| |
| var agree =this.data.privacyCheck; |
| if (wx.$isEmpty(agree)) { |
| wx.showModal({ |
| title: '提示', |
| content: '请同意民卡免密代扣签约协议', |
| }) |
| return; |
| } |
| var personid = wx.getStorageSync("personid"); |
| var param={ |
| "agree":code |
| } |
| wx.$doPost('/v1/signbxy',param, function (ok, ret) { |
| if (ok) { |
| if (ret.data.code == 200) { |
| wx.setStorageSync("userid", personid); |
| wx.setStorageSync("signed", ret.data.signed); |
| wx.navigateTo({ |
| url: '../index/index', |
| }) |
| } else { |
| wx.showModal({ |
| title: '错误', |
| content: ret.data.message, |
| duration: 2000 |
| }) |
| |
| } |
| } else { |
| wx.showModal({ |
| title: '错误', |
| content: ret.data.message, |
| duration: 2000 |
| }) |
| |
| } |
| }) |
| }, |
| getCode: function() { |
| if (false == this.data.smsFlag) { |
| return; |
| } |
| |
| wx.$doCountdown(this); |
| |
| // var name = wx.getStorageSync("name"); |
| // var cardno = wx.getStorageSync("cardno"); |
| // var idtype = wx.getStorageSync("idtype"); |
| // var idno = wx.getStorageSync("idno"); |
| |
| var param = { |
| // "cardno": cardno, |
| // "idtype": idtype, |
| // "name": name, |
| // "idno": idno |
| } |
| wx.$doPost('/v1/bindcardcode', param, function(ok, ret) { |
| console.log(ret.data); |
| if (ok) { |
| if (ret.data.code == 200) {} else { |
| wx.showModal({ |
| title: '错误', |
| content: ret.data.msg, |
| |
| duration: 2000 |
| }) |
| } |
| } else { |
| wx.showModal({ |
| title: '错误', |
| content: "请求失败了" + ret.data.status + ",请稍后再试", |
| duration: 2000 |
| }) |
| } |
| }) |
| } |
| }) |