var user_id = localStorage.getItem('user_id'); //console.log(user_id) var howMoney = document.getElementsByClassName('.howMoney'); var yue = ''; $().ready(function(){ info() ; }) function info() { $.ajax({ type: "POST", url: "/api/v2/yys/alipayUserInfo", data:{ user_id:user_id }, success:function(res){ if(res.errno == "0" && res.rst){ var data = res.rst.data,usernameHtml = "",phoneHtml = '',moneyHtml = '' console.log(data) usernameHtml += data.real_name; phoneHtml += data.alipay_account; moneyHtml += data.JintieActual; yue=data.JintieActual; $('#username').append(usernameHtml) $('#phone').append(phoneHtml) $('#money').append(moneyHtml) } // $('.howMoney').bind('input propertychange', function() { // var in_money = $(this).val(); // console.log(in_money); // if(in_money > data.JintieActual){ // showMsg('提现金额超限') // } // }); //用户名隐藏 var username = $('#username').text(); var musername = " "; if(username.length == 2){ musername = username.substr(0, 1) + '*'; }else if(username.length == 3){ musername = username.substr(0, 1) + '**'; }else if(username.length == 4){ musername = username.substr(0, 2) + '**'; }else if(username.length > 4){ musername = username.substr(0, 2) + '*...'; } $('#username').text(musername); // //手机号隐藏 // var phone = $('#phone').text(); // var mphone = phone.substr(0, 3) + '****' + phone.substr(7); // $('#phone').text(mphone); // //全部提现 var money = $('#money').text(); $("#all_put").click(function(){ $('.howMoney').val(money) }) // //申请提现 // $("#tixian").click(function(){ // alert("提现") // }) } }) }; //超出提现金额提示 $('.howMoney').bind('input propertychange', function() { var in_money = $(this).val(); console.log(in_money > yue) if(in_money > yue){ showMsg('提现金额超限') $("#tixian").attr("disabled", true); } }); // tip提示,3s后消失 function showMsg(msg) { var msgBox = $('.alert-info'); msgBox.children('p').text(msg); msgBox.show(); setTimeout(function() { msgBox.hide(); }, 3000); } function tixian(){ console.log(user_id) console.log($('.howMoney').val()) $.ajax({ type: "POST", url: "/api/v2/yys/alipayGetMoney", data:{ user_id:user_id, money:$('.howMoney').val() }, success:function(res){ console.log(res) if(res.errno == "0" && res.rst){ if(res.rst.flag == 1){ showMsg(res.rst.msg) $('.howMoney').val('') } }else if(res.errno == "1001" && res.rst){ if(res.rst.flag == 0){ showMsg(res.rst.msg) $('.howMoney').val('') } } } }) }