binquan.qiu | f9647a2 | 2020-05-08 15:43:24 +0800 | [diff] [blame] | 1 | // pages/unbind/unbind.js |
| 2 | Page({ |
| 3 | |
| 4 | /** |
| 5 | * 页面的初始数据 |
| 6 | */ |
| 7 | data: { |
| 8 | bankcard:'', |
| 9 | name:'', |
| 10 | status:'' |
| 11 | |
| 12 | }, |
| 13 | |
| 14 | /** |
| 15 | * 生命周期函数--监听页面加载 |
| 16 | */ |
| 17 | onLoad: function (options) { |
| 18 | var that = this; |
| 19 | wx.$doPost('/v1/cardinfor',{}, function(ok, ret) { |
| 20 | if (ok) { |
| 21 | wx.hideLoading(); |
| 22 | console.log(ret) |
| 23 | if (ret.data.code == 200) { |
| 24 | that.setData({ |
| 25 | name: ret.data.name, |
| 26 | bankcard: ret.data.cardno, |
| 27 | status:ret.data.cardstatus |
| 28 | }) |
| 29 | |
| 30 | } else { |
| 31 | wx.showModal({ |
| 32 | title: '错误', |
| 33 | content: ret.data.msg, |
| 34 | duration: 2000 |
| 35 | }) |
| 36 | } |
| 37 | } else { |
| 38 | wx.hideLoading(); |
| 39 | wx.showModal({ |
| 40 | title: '错误', |
| 41 | content: "请求失败了,请稍后再试", |
| 42 | duration: 2000 |
| 43 | }) |
| 44 | } |
| 45 | }) |
| 46 | |
| 47 | }, |
| 48 | |
| 49 | /** |
| 50 | * 生命周期函数--监听页面初次渲染完成 |
| 51 | */ |
| 52 | onReady: function () { |
| 53 | |
| 54 | }, |
| 55 | |
| 56 | unSign: function() { |
| 57 | |
| 58 | wx.showModal({ |
| 59 | title: '提示', |
| 60 | content: '确定要解除签约吗', |
| 61 | success(res) { |
| 62 | if (res.confirm) { |
| 63 | |
| 64 | wx.$doPost('/v1/unsignbxy', {}, function(ok, ret) { |
| 65 | if (ok) { |
| 66 | console.log(ret) |
| 67 | if (ret.data.code == 200) { |
| 68 | wx.setStorageSync("signed", ret.data.signed); |
| 69 | |
| 70 | wx.showModal({ |
| 71 | title: '提示', |
| 72 | content: '解约成功', |
| 73 | showCancel:false, |
| 74 | success(res) { |
| 75 | if (res.confirm) { |
| 76 | wx.navigateTo({ |
| 77 | url: '../index/index', |
| 78 | }) |
| 79 | } |
| 80 | } |
| 81 | }) |
| 82 | |
| 83 | } else { |
| 84 | wx.showModal({ |
| 85 | title: '错误', |
| 86 | content: ret.data.msg, |
| 87 | duration: 2000 |
| 88 | }) |
| 89 | |
| 90 | } |
| 91 | } else { |
| 92 | wx.showModal({ |
| 93 | title: '错误', |
| 94 | content: ret.data.msg, |
| 95 | duration: 2000 |
| 96 | }) |
| 97 | } |
| 98 | }) |
| 99 | |
| 100 | } |
| 101 | } |
| 102 | }) |
| 103 | }, |
| 104 | |
| 105 | /** |
| 106 | * 生命周期函数--监听页面显示 |
| 107 | */ |
| 108 | onShow: function () { |
| 109 | |
| 110 | }, |
| 111 | |
| 112 | /** |
| 113 | * 生命周期函数--监听页面隐藏 |
| 114 | */ |
| 115 | onHide: function () { |
| 116 | |
| 117 | }, |
| 118 | |
| 119 | /** |
| 120 | * 生命周期函数--监听页面卸载 |
| 121 | */ |
| 122 | onUnload: function () { |
| 123 | |
| 124 | }, |
| 125 | |
| 126 | /** |
| 127 | * 页面相关事件处理函数--监听用户下拉动作 |
| 128 | */ |
| 129 | onPullDownRefresh: function () { |
| 130 | |
| 131 | }, |
| 132 | |
| 133 | /** |
| 134 | * 页面上拉触底事件的处理函数 |
| 135 | */ |
| 136 | onReachBottom: function () { |
| 137 | |
| 138 | }, |
| 139 | |
| 140 | /** |
| 141 | * 用户点击右上角分享 |
| 142 | */ |
| 143 | onShareAppMessage: function () { |
| 144 | |
| 145 | } |
| 146 | }) |