// packageD/quickPay/member_choose_bank/member_choose_bank.js let app = getApp(); Page({ /** * 页面的初始数据 */ data: { bank: [], show1: false, arr: [], amount: '', pay_sn: '', bank_name: '', code: '', order_pay_sn: '', payer_phone: '', pay_type: '', card_no: '', check_open: false, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.initData(); this.getType(); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, initData() { this.setData({ bank:[], show1:false, arr:[], amount:'', pay_sn:'', bank_name: '', code: '', order_pay_sn: '', payer_phone: '', pay_type: '', card_no:'', }); }, toPay(e) { let item = e.currentTarget.dataset.item; if (item.status == 0 && this.data.pay_type == 2) { wx.navigateTo({ url: '/packageD/quickPay/member_bind_bank/member_bind_bank?card_id=' + item.id }); } }, toAdd() { wx.navigateTo({ url: '/packageD/quickPay/member_add_bank_first/member_add_bank_first' }); }, tapUnbound (e) { let item=e.currentTarget.dataset.item; if (this.data.check_open) { this.toRemove(item); } else { wx.showModal({ title: '提示', content: '此操作将解绑该银行卡,确认执行该操作吗?', success: (result) => { if (result.confirm) { this.deleteBank(item); } } }); } }, toRemove (item) { wx.navigateTo({ url: '/packageD/quickPay/member_remove_bank/member_remove_bank?card_id=' + item.id }); }, deleteBank(item) { let that = this; let urlStr = app.getNetAddresss("plugin.converge_pay.frontend.controllers.quick-pay-bank-card.del"); app._getNetWork({ url: urlStr, data: { card_id: item.id }, showToastIn: false, success: function (resdata) { var res = resdata.data; if (res.result == 1) { wx.showToast({ icon: 'none', title: res.msg, duration: 1500, }); that.setData({ show1: false }); that.getBank(); } else { wx.showToast({ icon: 'none', title: res.msg, duration: 1500, }); } }, fail: function (res) { console.log(res.msg); } }); }, getBank() { let that = this; let urlStr = app.getNetAddresss("plugin.converge_pay.frontend.controllers.quick-pay-bank-card.index"); app._getNetWork({ url: urlStr, showToastIn: false, success: function (resdata) { var res = resdata.data; if (res.result == 1) { that.setData({ bank:res.data }); that.getMemberPhone(); } else { that.setData({ bank: res.data }); wx.showToast({ icon: 'none', title: res.msg, duration: 1500, }); } }, fail: function (res) { console.log(res.msg); } }); }, getType() { let that = this; let urlStr = app.getNetAddresss("plugin.converge_pay.frontend.controllers.quick-pay-bank-card.get-pay-type"); app._getNetWork({ url: urlStr, showToastIn: false, success: function (resdata) { var res = resdata.data; if (res.result == 1) { that.setData({ pay_type: res.data.pay_type }); that.getBank(); } else { wx.showToast({ icon: 'none', title: res.msg, duration: 1500, }); } }, fail: function (res) { console.log(res.msg); } }); }, getMemberPhone () { let urlStr = app.getNetAddresss("plugin.converge_pay.frontend.controllers.quick-pay-bank-card.get-mobile"); app._getNetWork({ url: urlStr, showToastIn: false, success: (resdata) => { var res = resdata.data; if (res.result !== 1) { app.tips(res.msg); return; } this.setData({check_open: res.data.sms_check_open}); }, fail: function (res) { console.log(res.msg); }, }); }, });