'); var payModalEl = document.getElementById('modal_box'); var modal_box = new bootstrap.Modal(payModalEl, {keyboard: false}); modal_box.show(); var PayTime = null; PayTime = setInterval(function(){ $.getJSON(apiurl+'/pay?method=scancheck&data_key=bXtNfS86YmmTLIJVhadkaQ%3D%3D&otn='+r.out_trade_no,function(r){ if(r.errcode==0){ modal_box.hide(); layer.open({content:r.errmsg,style: 'border:none;background-color:green;color:#fff;',skin: 'msg',time: 3}); clearInterval(PayTime); setTimeout(function(){location.reload();},2000); } }); },2000); payModalEl.addEventListener('hidden.bs.modal', function (event) { clearInterval(PayTime); }); }else{ layer.open({content:r.errmsg,style: 'border:none;background-color:#333;color:#fff;',skin: 'msg',time: 3}); } }); } $('#site_datetime').change(function(){ var data_key=encodeURIComponent(''),pay_times=parseInt($(this).children('option:selected').val()),site_id=$('#site_id').val(); pay_for(data_key,site_id,pay_times); }); $('.home_link').on('click', function () { $('#site_datetime option[value=\'3\']').prop("selected",true); var website_id=0,data_id = $(this).attr('data-id'),data_link=$(this).attr('data-link'),siteid=$('#domain_siteid').val().trim(),siteurl=$('#domain_siteurl').val().trim(),paymethod=0,data_key=encodeURIComponent(''); if(data_key==''){ alert('Data Key!'); return false; } if(parseInt(data_id)>0&&data_link!=''){ paymethod=1; $('#site_id').val(data_id); $('#site_link').val(data_link); website_id=data_id; }else{ if(parseInt(siteid)>0&&siteurl!=''){ paymethod=3; $('#site_id').val(siteid); $('#site_link').val(siteurl); website_id=siteid; }else{ if(siteurl!=''){ paymethod=2; $('#site_link').val(siteurl); }else{ alert('Error Method!'); return false; } } } if(parseInt(website_id)==0&&paymethod!=2){ alert('Error Website!'); return false; } if(isMobile()){ $.getJSON(apiurl+'/pay?method=data&data_key='+data_key+'&data_id='+website_id,function(r){ if(r.errcode==0){ location.href=apiurl+'/pay?method=alipay&data='+r.data; }else{ layer.open({content:r.errmsg,style: 'border:none;background-color:#333;color:#fff;',skin: 'msg',time: 3}); } }); }else{ if(paymethod==2){ $.getJSON(apiurl+'/api/links?data_key='+data_key+'&link='+encodeURIComponent(siteurl),function(r){ if(r.errcode==0){ $('#site_id').val(r.id); pay_for(data_key,r.id,3) }else{ layer.open({content:r.errmsg,style: 'border:none;background-color:#333;color:#fff;',skin: 'msg',time: 3}); return false; } }); }else{ pay_for(data_key,website_id,3) } } }); })(jQuery);