binquan.qiu | 7f2665f | 2020-03-27 17:19:57 +0800 | [diff] [blame] | 1 | // pages/cardlost/cardlost.js |
| 2 | Page({ |
| 3 | |
| 4 | /** |
| 5 | * 页面的初始数据 |
| 6 | */ |
| 7 | data: { |
| 8 | pwd: '' |
| 9 | }, |
| 10 | |
| 11 | setPwd: function(e) { |
| 12 | this.setData({ |
| 13 | pwd: e.detail.value |
| 14 | }) |
| 15 | }, |
| 16 | |
| 17 | /** |
| 18 | * 生命周期函数--监听页面加载 |
| 19 | */ |
| 20 | onLoad: function(options) { |
| 21 | |
| 22 | }, |
| 23 | |
| 24 | /** |
| 25 | * 生命周期函数--监听页面初次渲染完成 |
| 26 | */ |
| 27 | onReady: function() { |
| 28 | |
| 29 | }, |
| 30 | |
| 31 | /** |
| 32 | * 生命周期函数--监听页面显示 |
| 33 | */ |
| 34 | onShow: function() { |
| 35 | |
| 36 | }, |
| 37 | |
| 38 | |
| 39 | /** |
| 40 | * 生命周期函数--监听页面隐藏 |
| 41 | */ |
| 42 | onHide: function() { |
| 43 | |
| 44 | }, |
| 45 | |
| 46 | /** |
| 47 | * 生命周期函数--监听页面卸载 |
| 48 | */ |
| 49 | onUnload: function() { |
| 50 | |
| 51 | }, |
| 52 | |
| 53 | /** |
| 54 | * 页面相关事件处理函数--监听用户下拉动作 |
| 55 | */ |
| 56 | onPullDownRefresh: function() { |
| 57 | |
| 58 | }, |
| 59 | |
| 60 | /** |
| 61 | * 页面上拉触底事件的处理函数 |
| 62 | */ |
| 63 | onReachBottom: function() { |
| 64 | |
| 65 | }, |
| 66 | |
| 67 | /** |
| 68 | * 用户点击右上角分享 |
| 69 | */ |
| 70 | onShareAppMessage: function() { |
| 71 | |
| 72 | }, |
| 73 | doNext: function() { |
| 74 | var pwd = this.data.pwd; |
| 75 | if (wx.$isEmpty(pwd)) { |
| 76 | return; |
| 77 | } |
| 78 | wx.showModal({ |
| 79 | title: '提示', |
| 80 | content: '确定要挂失吗', |
| 81 | success(res) { |
| 82 | if (res.confirm) { |
| 83 | var param = { |
| 84 | "paypwd": pwd |
| 85 | } |
| 86 | wx.$doPost('/v1/cardlost', param, function(ok, ret) { |
| 87 | if (ok) { |
| 88 | // wx.hideLoading(); |
| 89 | console.log(ret) |
| 90 | if (ret.data.status == 200) { |
| 91 | wx.showModal({ |
| 92 | title: '提示', |
| 93 | content: '注销成功', |
| 94 | showCancel:false, |
| 95 | success(res) { |
| 96 | if (res.confirm) { |
| 97 | wx.navigateTo({ |
| 98 | url: '../index/index', |
| 99 | }) |
| 100 | } |
| 101 | } |
| 102 | }) |
| 103 | |
| 104 | } else { |
| 105 | wx.showModal({ |
| 106 | title: '错误', |
| 107 | content: ret.data.message, |
| 108 | duration: 2000 |
| 109 | }) |
| 110 | |
| 111 | } |
| 112 | } else { |
| 113 | wx.showModal({ |
| 114 | title: '错误', |
| 115 | content: ret.data.msg, |
| 116 | duration: 2000 |
| 117 | }) |
| 118 | |
| 119 | } |
| 120 | }) |
| 121 | |
| 122 | } |
| 123 | } |
| 124 | }) |
| 125 | |
| 126 | } |
| 127 | }) |