!function(e){e(document).ready(function(){var a=!0,t=e("#obtainphone"),o=(e("#noThing"),e("#code")),c=null;if(clearInterval(c),e.cookie("captcha")){clearInterval(c);var n=e.cookie("captcha"),r=e("#obtaincode");r.val(n+"秒后重新获取").attr("disabled",!0),c=setInterval(function(){n--,n>0?(r.val(n+"秒").attr("disabled",!0).css({background:"#ccc"}),e.cookie("captcha",n,{path:"/",expires:1/86400*n})):(clearInterval(c),r.val("获取验证码").removeClass("disabled").removeAttr("disabled style").css({background:"#00beaf"}))},1e3)}e("#obtaincode").click(function(a){clearInterval(c),a.preventDefault();{var o=e(this),n=60,r=(e("#code").val(),e("#obtainphone").val()),l=new Date;Date.parse(l)}if(""==t.val())alert("请输入手机号"),t.focus();else{if(!t.val().match(/(^1[3|5|7|8|4][0-9]{9}$)/))return alert("手机号码格式不正确"),t.val("").focus(),!1;c=setInterval(function(){n--,n>0?(o.attr("disabled",!0).val(n+"秒"),e.cookie("captcha",n,{path:"/",expires:1/86400*n}),e("#obtaincode").css("background","#ccc")):(clearInterval(c),o.val("获取验证码").removeAttr("disabled"),e("#obtaincode").css("background","#00beaf"))},1e3),e.ajax({url:"http://api.feedback.ayibang.com/v1/feedback/verifyCode",dataType:"json",async:!0,data:{phone:r},type:"get",success:function(){},error:function(){}})}});var l=e("#submitBtn");l.on("click",function(){l.prop("disabled",!1);var r=e("#obtaincode"),i=e("#opinion").val(),s=e("#obtainphone").val(),d=e("#code").val();if(""==i)alert("意见不能为空"),t.focus();else if(""==s)alert("手机号不能为空");else{if(!t.val().match(/(^1[3|5|7|8|4][0-9]{9}$)/))return alert("手机号码格式不正确"),t.val("").focus(),!1;if(""==o.val())return alert("请输入验证码"),o.val("").focus(),!1;if(!o.val().match(/(^\d{4}$)/))return alert("验证码格式不正确"),o.val("").focus(),!1;if(l.prop("disabled",!0),!a)return;a=!1,e.ajax({url:"http://api.feedback.ayibang.com/v1/feedback/authAndCreate",dataType:"json",async:!0,data:{phone:s,content:i,code:d,channels:5},type:"post",success:function(){a=!0,alert("客服小妹已经收到您的意见反馈，会在第一时间给您解决哦~"),e(".feedback").hide(),e("#opinion").val(""),e("#obtainphone").val(""),e("#code").val("");var t=new Date;e.cookie("captcha",n,{path:"/",expires:new Date(t-864e5)}),document.cookie="",clearInterval(c),r.val("获取验证码").removeClass("disabled").removeAttr("disabled style").css({background:"#00beaf"}),l.prop("disabled",!1)},error:function(t){a=!0;var o=JSON.parse(t.responseText).error.message;alert(o),e("#code").val(""),e("#submitBtn").prop("disabled",!1)}})}}),e(".closebtn3").click(function(){var a=new Date;e.cookie("captcha",0,{path:"/",expires:new Date(a-864e5)}),document.cookie="",clearInterval(c),e("#obtaincode").val("获取验证码").removeClass("disabled").removeAttr("disabled style").css({background:"#00beaf"}),e("#obtainphone").val(""),e("#opinion").val(""),l.prop("disabled",!1),e(".feedback").hide()})})}(window.jQuery||window.Zepto,window);