| // pages/cardlost/cardlost.js |
| Page({ |
| |
| /** |
| * 页面的初始数据 |
| */ |
| data: { |
| pwd: '' |
| }, |
| |
| setPwd: function(e) { |
| this.setData({ |
| pwd: e.detail.value |
| }) |
| }, |
| |
| /** |
| * 生命周期函数--监听页面加载 |
| */ |
| onLoad: function(options) { |
| |
| }, |
| |
| /** |
| * 生命周期函数--监听页面初次渲染完成 |
| */ |
| onReady: function() { |
| |
| }, |
| |
| /** |
| * 生命周期函数--监听页面显示 |
| */ |
| onShow: function() { |
| |
| }, |
| |
| |
| /** |
| * 生命周期函数--监听页面隐藏 |
| */ |
| onHide: function() { |
| |
| }, |
| |
| /** |
| * 生命周期函数--监听页面卸载 |
| */ |
| onUnload: function() { |
| |
| }, |
| |
| /** |
| * 页面相关事件处理函数--监听用户下拉动作 |
| */ |
| onPullDownRefresh: function() { |
| |
| }, |
| |
| /** |
| * 页面上拉触底事件的处理函数 |
| */ |
| onReachBottom: function() { |
| |
| }, |
| |
| /** |
| * 用户点击右上角分享 |
| */ |
| onShareAppMessage: function() { |
| |
| }, |
| doNext: function() { |
| var pwd = this.data.pwd; |
| if (wx.$isEmpty(pwd)) { |
| return; |
| } |
| wx.showModal({ |
| title: '提示', |
| content: '确定要挂失吗', |
| success(res) { |
| if (res.confirm) { |
| var param = { |
| "paypwd": pwd |
| } |
| wx.$doPost('/v1/cardlost', param, function(ok, ret) { |
| if (ok) { |
| // wx.hideLoading(); |
| console.log(ret) |
| if (ret.data.status == 200) { |
| wx.showModal({ |
| title: '提示', |
| content: '注销成功', |
| showCancel:false, |
| success(res) { |
| if (res.confirm) { |
| wx.navigateTo({ |
| url: '../index/index', |
| }) |
| } |
| } |
| }) |
| |
| } else { |
| wx.showModal({ |
| title: '错误', |
| content: ret.data.message, |
| duration: 2000 |
| }) |
| |
| } |
| } else { |
| wx.showModal({ |
| title: '错误', |
| content: ret.data.msg, |
| duration: 2000 |
| }) |
| |
| } |
| }) |
| |
| } |
| } |
| }) |
| |
| } |
| }) |