var sms_time = 60; var skipsms; function buylink(ob){ var buylink = jQuery(ob).data('link'); //qrcode.makeCode(buylink); jQuery("#qrcode").html(''); jQuery('#myModal2').modal('show'); } function sending_sms(){ sms_time--; if(sms_time == 0){ jQuery('.smscode_unactive').attr("data-active",1); jQuery('.smscode_unactive').html('获取'); jQuery('.smscode_unactive').removeClass("smscode_unactive"); clearInterval(skipsms); sms_time = 60; return false; } jQuery('#skip_time').html(sms_time); } function get_smscode(ob){ if(sms_time != 60){ alert('验证码已发送!'); return false; } var data_active = jQuery(ob).attr("data-active"); if(data_active == 1){ var id = jQuery(ob).attr("data-id"); var phone = jQuery("#"+id).val(); if(phone == '' || !checkPhone(phone)){ alert('请填写正确的手机号码!'); return false; }else{ jQuery(ob).attr("data-active",0); jQuery(ob).addClass("smscode_unactive"); jQuery(ob).html('已发送60'); skipsms = setInterval(sending_sms,1000); jQuery.post(ajaxurl,{mobile:phone,action:'massActivity',user_action:'get_smscode'},function(data){ if(data.status==1){ } if(data.status==0){ alert('发送失败,请重新获取!'); jQuery(ob).attr("data-active",1); jQuery(ob).removeClass("smscode_unactive"); jQuery(ob).html('获取'); clearInterval(skipsms); sms_time = 60; } }); } } } function writeObj(obj){ var description = ""; for(var i in obj){ var property=obj[i]; description+=i+" = "+property+"\n"; } alert(description); } function init_owl(ob,id,loop,lg,md,xs,dots){ ob.owlCarousel({ animateOut: 'fadeOut', loop:loop, margin:0, autoplay:true, nav:false, dots:dots, responsive:{ 0:{ items:xs }, 600:{ items:md }, 1000:{ items:lg } } }); jQuery(".owl-"+id+" .next").click(function(){ ob.trigger('next.owl.carousel'); }); jQuery(".owl-"+id+" .prev").click(function(){ ob.trigger('prev.owl.carousel'); }); } function checkPhone(phone) { var res = !!phone.match(/^[1][3,4,5,7,8][0-9]{9}$/); return res; } function ajax_post_form(form_id){ var error = 0; var frominput = jQuery(form_id+' input[required="required"]'); frominput.each(function(){ var fromvalue = jQuery(this).val(); if( fromvalue.length == 0){ jQuery(this).focus(); alert('该内容不能为空!'); error = 1; return false; }else{ var type = jQuery(this).attr("data-type"); if(type == "mobile"){ var ret = checkPhone(fromvalue); if(!ret){ alert('请填写有效的手机号码!'); error = 1; return false; } } } }); if(error == 1){ return false; } noty({text: '正在提交...',type:'warning',layout:'center',modal: true, dismissQueue: true, timeout: false,closeWith:''}); var newCustomerForm = jQuery(form_id).serialize(); jQuery.ajax({ type: 'POST', url: ajaxurl, data: newCustomerForm, dataType: 'json', success: function(data){ if(data.status == 1){ if(data.redirect){ noty({text: data.output,type:'error',layout:'center',theme:'relax', progressBar: true,timeout:2000,callback:{ onClose : function() { window.location.href = data.redirect; }, }, }); }else{ jQuery(form_id)[0].reset() noty({text: '提交成功',type:'success',layout:'center'}); } }else{ noty({text:data.output,type:'error',layout:'center'}); } jQuery.noty.closeAll(); }, error: function(xhr,type){ noty({text: '提交失败,请稍后再试!',type:'error',layout:'center'}); jQuery.noty.closeAll(); } }); return false; } function ajax_yundan_form(form_id){ var error = 0; var frominput = jQuery(form_id+' .zhkuang[required="required"]'); frominput.each(function(){ var fromvalue = jQuery(this).val(); if( fromvalue.length == 0){ jQuery(this).focus(); alert('该内容不能为空!'); error = 1; }else{ var type = jQuery(this).attr("data-type"); if(type == "mobile"){ var ret = checkPhone(fromvalue); if(!ret){ alert('请填写有效的手机号码!'); error = 1; } } } }); var range = parseInt($(form_id+' input[name="range"]').val()); var dtitle = '运单'; if(range == 1){ dtitle = '转单'; } if(error == 1){ return false; } noty({text: '正在查询...',type:'warning',layout:'center',modal: true, dismissQueue: true, timeout: false,closeWith:''}); var newCustomerForm = jQuery(form_id).serialize(); var action = jQuery(form_id).attr('action'); jQuery.ajax({ type: 'POST', url: action, data: newCustomerForm, dataType: 'json', success: function(data){ if(data.result){ if(data.result.traces){ var traces = data.result.traces; var html = ''; for(i in traces){ if(traces[i].details){ var row = traces[i].details; html += '

'+dtitle+'号:'+traces[i].billcode+'

'; if(traces[i].mainNo){ html += '

立邦单号:'+traces[i].mainNo+'

'; } for(i in row){ html += '
'+row[i].acceptTime+'
'+row[i].acceptAddress+'
'; } html += '
'; } } jQuery("#yundanjieguo").html(html); jQuery('#yundanModal').modal('show') ; }else{ noty({text: '暂无运单记录',type:'success',layout:'center'}); } }else{ noty({text: '暂无运单记录',type:'success',layout:'center'}); } jQuery.noty.closeAll(); }, error: function(xhr,type){ noty({text: '提交失败,请稍后再试!',type:'error',layout:'center'}); jQuery.noty.closeAll(); } }); return false; } function ajax_contact_form(){ var error = 0; var frominput = jQuery('input[required="required"]'); frominput.each(function(){ var fromvalue = jQuery(this).val(); if( fromvalue.length == 0){ jQuery(this).focus(); alert('该内容不能为空!'); error = 1; } }); if(error == 1){ return false; } noty({text: '正在发送邮件...',type:'warning',layout:'center',modal: true, dismissQueue: true, timeout: false,closeWith:''}); var newCustomerForm = jQuery("#ajax-contact-form").serialize(); jQuery.ajax({ type: 'POST', url: ajaxurl, data: newCustomerForm, dataType: 'json', success: function(data){ if(data.status == 1){ noty({text: '发送成功',type:'success',layout:'center'}); }else{ noty({text: '发送失败,请稍后再试!',type:'error',layout:'center'}); } jQuery.noty.closeAll(); }, error: function(xhr,type){ noty({text: '提交失败,请稍后再试!',type:'error',layout:'center'}); jQuery.noty.closeAll(); } }); return false; } function change_city(c,id){ var city = jQuery(c).val(); jQuery('#'+id).val(city); } (function($){ $.fn.textScroll = function(options){ var defaults = {time: 3000,num: 1} var o = $.extend( defaults,options); var _con = $(this).find("ul").eq(0); var _conH = _con.height(); var _conChildH = _con.children().eq(0).height(); var _temp = _conChildH; var _time = defaults.time; _con.clone().insertAfter(_con); var num = defaults.num; var timeID = setInterval(up,_time); this.hover(function(){clearInterval(timeID)},function(){timeID = setInterval(up,_time);}); function up(){ _con.animate({marginTop: '-'+_conChildH}); num += 1; if(_conH == _conChildH){ _con.animate({marginTop: '-'+_conChildH},"normal",over); } else { _conChildH += _temp; } } function over(){ _con.attr("style",'margin-top:0'); _conChildH = _temp; num = 1; } } })(jQuery); var reserList_show = 0; var reserList1_show = 0; jQuery(document).ready(function() { //jQuery.scrollUp({scrollName:"scrollUp",topDistance:"300",topSpeed:300,animation:"fade",animationInSpeed:200,animationOutSpeed:200,scrollText:'',activeOverlay:!1}); jQuery("#filter").on('click','a',function(){ var obj = jQuery(this); var title = obj.attr("data-title"); var term_id = obj.attr("data-id"); jQuery("#btn-filter").html(title+''); jQuery("#btn-filter").addClass('selected'); jQuery("#inputcat").val(term_id); }); });