| // pages/unbind/unbind.js |
| Page({ |
| |
| /** |
| * 页面的初始数据 |
| */ |
| data: { |
| bankcard:'', |
| name:'', |
| status:'' |
| |
| }, |
| |
| /** |
| * 生命周期函数--监听页面加载 |
| */ |
| onLoad: function (options) { |
| var that = this; |
| wx.$doPost('/v1/cardinfor',{}, function(ok, ret) { |
| if (ok) { |
| wx.hideLoading(); |
| console.log(ret) |
| if (ret.data.code == 200) { |
| that.setData({ |
| name: ret.data.name, |
| bankcard: ret.data.cardno, |
| status:ret.data.cardstatus |
| }) |
| |
| } else { |
| wx.showModal({ |
| title: '错误', |
| content: ret.data.msg, |
| duration: 2000 |
| }) |
| } |
| } else { |
| wx.hideLoading(); |
| wx.showModal({ |
| title: '错误', |
| content: "请求失败了,请稍后再试", |
| duration: 2000 |
| }) |
| } |
| }) |
| |
| }, |
| |
| /** |
| * 生命周期函数--监听页面初次渲染完成 |
| */ |
| onReady: function () { |
| |
| }, |
| |
| unSign: function() { |
| |
| wx.showModal({ |
| title: '提示', |
| content: '确定要解除签约吗', |
| success(res) { |
| if (res.confirm) { |
| |
| wx.$doPost('/v1/unsignbxy', {}, function(ok, ret) { |
| if (ok) { |
| console.log(ret) |
| if (ret.data.code == 200) { |
| wx.setStorageSync("signed", ret.data.signed); |
| |
| wx.showModal({ |
| title: '提示', |
| content: '解约成功', |
| showCancel:false, |
| success(res) { |
| if (res.confirm) { |
| wx.navigateTo({ |
| url: '../index/index', |
| }) |
| } |
| } |
| }) |
| |
| } else { |
| wx.showModal({ |
| title: '错误', |
| content: ret.data.msg, |
| duration: 2000 |
| }) |
| |
| } |
| } else { |
| wx.showModal({ |
| title: '错误', |
| content: ret.data.msg, |
| duration: 2000 |
| }) |
| } |
| }) |
| |
| } |
| } |
| }) |
| }, |
| |
| /** |
| * 生命周期函数--监听页面显示 |
| */ |
| onShow: function () { |
| |
| }, |
| |
| /** |
| * 生命周期函数--监听页面隐藏 |
| */ |
| onHide: function () { |
| |
| }, |
| |
| /** |
| * 生命周期函数--监听页面卸载 |
| */ |
| onUnload: function () { |
| |
| }, |
| |
| /** |
| * 页面相关事件处理函数--监听用户下拉动作 |
| */ |
| onPullDownRefresh: function () { |
| |
| }, |
| |
| /** |
| * 页面上拉触底事件的处理函数 |
| */ |
| onReachBottom: function () { |
| |
| }, |
| |
| /** |
| * 用户点击右上角分享 |
| */ |
| onShareAppMessage: function () { |
| |
| } |
| }) |