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 += '