// pages/member/rankingListSecond/rankingListSecond.js var app = getApp(); Page({ /** * 页面的初始数据 */ data: { language: '', usable: 0.0, sure_usable: "", radio: "1", Withdrawaltext: '提现', isclick:true, balance_withdraw_status:'0', withdraw_status:0, isConfirmBtn: false,//是否显示提现按钮 final_proportion_rate:0, point:"积分" }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { this.usable = 0.0; this.sure_usable = ""; // this.toi = this.fun.getKeyByI(); //获取数据 this.getStoreInfo(); this.customizeIncome(); try { var yz_basic_info = wx.getStorageSync('yz_basic_info'); if(yz_basic_info){ this.setData({point:yz_basic_info.point}) } } catch (error) { } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() { let language = wx.getStorageSync('langIndex'); this.setData({ 'language': language.en}); }, /** * 生命周期函数--监听页面显示 */ onShow: function() { this.data.isclick = true; }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { }, /** * 用户点击右上角分享 */ onShareAppMessage: function() { }, getStoreInfo() { let that = this; let urlStr = app.getNetAddresss("plugin.love.Frontend.Modules.Love.Controllers.withdraw.page"); app._getNetWork({ url: urlStr, success: (res) => { let resData = res.data; if (resData.result === 1) { that.setData({ Data: resData.data, withdraw_status :resData.data.withdraw_status, integralShow: resData.data.integral_withdraw_status, balance_withdraw_status:resData.data.balance_withdraw_status, coin: Number(that.data.sure_usable) * Number(resData.data.withdraw_integral_scale) * Number(resData.data .integral_withdraw_proportion / 100), final_proportion_rate:resData.data.final_proportion_rate }); if(resData.data.balance_withdraw_status==1){ console.log("执行3"); this.setData({ radio:"3" }); } if(resData.data.integral_withdraw_status==1){ console.log("执行2"); this.setData({ radio:"2" }); } if(resData.data.withdraw_status==1){ this.setData({ radio:"1" }); } this.isShowConfirmBtn(); } else { wx.showToast({ title: resData.msg, icon: "none" }); } }, fail: function(res) { console.log(res); } }); }, isShowConfirmBtn() { if (this.data.withdraw_status || this.data.integralShow || this.data.balance_withdraw_status == "1" || this.data.Data.we_chat_withdraw_status == "1") { this.setData({ isConfirmBtn: true }) } }, confirm() { if(!this.data.isclick){ wx.showToast({ title: '请勿重复点击', icon: 'none' }); return; } this.data.isclick = false; if (this.data.sure_usable == undefined || this.data.sure_usable <= 0) { wx.showToast({ title: `${this.data.Withdrawaltext}数值不可低于0`, icon: "none" }); this.data.isclick = true; return; } let urlStr = app.getNetAddresss("plugin.love.Frontend.Modules.Love.Controllers.withdraw.index"); urlStr += "&change_value=" + this.data.sure_usable; urlStr += "&withdraw_type=" + this.data.radio; app._getNetWork({ url: urlStr, success: (res) => { console.log(res, '数据'); if (res.data.result === 1 && res.data.data.withdraw_type == "1") { // 跳转到提现页面 wx.navigateTo({ url: '/packageA/member/withdrawal/withdrawal' }); } else if(res.data.result === 1 && res.data.data.withdraw_type == "4"){ setTimeout(()=>{ console.log("执行"); wx.navigateBack(); },1000); wx.showToast({ title: res.data.msg, icon: "none" }); }else { this.data.isclick = true; wx.showToast({ title: res.data.msg, icon: "none" }); } }, fail: function(res) { console.log(res); } }); }, // 输入框改变的时候触发 onChange(val) { this.setData({ sure_usable: val.detail }); }, //自定义提现收入语言 customizeIncome() { try { var value = wx.getStorageSync('mailLanguage'); if (value) { let mailLanguage = JSON.parse(value); // Do something with return value this.setData({ Withdrawaltext: mailLanguage.income.name_of_withdrawal }); wx.setNavigationBarTitle({ title: mailLanguage.income.name_of_withdrawal ? mailLanguage.income.name_of_withdrawal : '提现' }); } } catch (e) { // Do something when catch error } }, onChangeRadio(val) { console.log(val); this.setData({ radio:val.detail, discount_method: val.detail }); }, });