// packageD/quickPay/member_bind_bank/member_bind_bank.js let app = getApp(); Page({ /** * 页面的初始数据 */ data: { codetext: "获取短信验证码", imgcode: "", payer_phone: "", card_id: "", start1: false, status: '' }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.getInfo(); this.setData({ card_id: options.card_id, order_pay_id: options.order_pay_id, }); if(options.status) { this.setData({ status: options.status, }); } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () {}, /** * 生命周期函数--监听页面显示 */ onShow: function () { // this.card_id = this.$route.params.card_id; }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () {}, /** * 生命周期函数--监听页面卸载 */ onUnload: function () {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () {}, /** * 用户点击右上角分享 */ onShareAppMessage: function () {}, numInp(e) { let val = e.detail.value; this.setData({ sms_code: val, }); }, sendCode(e) { if (this.data.start1) { return false; } let time = 60; let that = this; that.setData({ start1: true, codetext: "(" + time + ")秒后重新获取", }); let set = setInterval(function () { that.setData({ codetext: "(" + --time + ")秒后重新获取", }); }, 1000); setTimeout(function () { that.setData({ codetext: "获取短信验证码", start1: false, }); clearInterval(set); }, 60000); that.verificationCode(set); }, // 获取验证码 verificationCode(set) { let urlStr = app.getNetAddresss( "plugin.converge_pay.frontend.controllers.quick-pay-bank-card.bind-card" ); //发送获取验证码的请求//旧的请求:member.register.sendCodeV2 app._getNetWork({ url: urlStr, data: { card_id: this.data.card_id, }, success: function (resdata) { var res = resdata.data; if (res.result == 1) { wx.showToast({ icon: "none", title: "已发送", duration: 1500, }); } else { wx.showToast({ icon: "none", title: res.msg, duration: 1500, }); } }, fail: function (res) { console.log(res); }, }); }, confirm() { let that = this; let urlStr = app.getNetAddresss( "plugin.converge_pay.frontend.controllers.quick-pay-bank-card.confirm-bind-card" ); app._getNetWork({ url: urlStr, data: { card_id: this.data.card_id, sms_code: this.data.sms_code, }, showToastIn: false, success: function (resdata) { var res = resdata.data; if (res.result == 1) { wx.showToast({ icon: "none", title: res.msg, duration: 1500, }); wx.navigateTo({ url: "/packageD/quickPay/choose_bank/choose_bank?order_pay_id=" + that.data.order_pay_id+ '&status='+that.data.status, }); } else { wx.showToast({ icon: "none", title: res.msg, duration: 1500, }); } }, fail: function (res) { console.log(res.msg); }, }); }, getInfo() { let that = this; let urlStr = app.getNetAddresss( "plugin.converge_pay.frontend.controllers.quick-pay-bank-card.get-payer-info" ); app._getNetWork({ url: urlStr, showToastIn: false, success: function (resdata) { var res = resdata.data; if (res.result == 1) { that.setData({ payer_phone: res.data.payer_phone, }); } else { wx.showToast({ icon: "none", title: res.msg, duration: 1500, }); } }, fail: function (res) { console.log(res.msg); }, }); }, });