// pages/cardDetail/index.js const app = getApp(); import { customRequest } from '../../utils/request.js'; Page({ /** * 页面的初始数据 */ data: { cardSure:false, bank: {}, }, close: function () { this.setData({ cardSure: false, }) }, unbind: function() { this.setData({ cardSure: true }); }, cancelBind:function(){ var that = this; customRequest('/user/bank/deleteUserBank',{header:'headers', method: 'POST', data: {id: that.data.bank.id}}).then((res)=>{ if (res.data.status == 200) { wx.showToast({ title: '已解绑', icon: 'success', duration: 2000, success:function(res){ console.log(res); }, }) setTimeout(()=>{ wx.navigateBack({ delta: 1 }) },2000) } else if (res.data.status == 9999) { // app.dialogNotLogin(); } else { wx.showToast({ icon: "none", title: res.data.msg, duration: 3000 }); } }) // wx.request({ // url: app.globalData.ip + '/user/bank/deleteUserBank', // data: { // id: that.data.bank.id // }, // header: app.globalData.headers, // method: "POST", // success: function (res) { // console.log(res); // if (res.data.status == 200) { // wx.showToast({ // title: '已解绑', // icon: 'success', // duration: 2000, // success:function(res){ // console.log(res); // }, // }) // setTimeout(()=>{ // wx.navigateBack({ // delta: 1 // }) // },2000) // } else if (res.data.status == 9999) { // // app.dialogNotLogin(); // } else { // wx.showToast({ // icon: "none", // title: res.data.msg, // duration: 3000 // }); // } // } // }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { try { var bank = wx.getStorageSync('storageSyncBankDetail') if (bank) { this.setData({ bank: bank }); } } catch (e) { // Do something when catch error } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage1: function () { } })