test

var rushtime = $("#rushTime").attr("value");//活动状态 var longtime = $("#longTime").attr("value");//当前活动状态下的活动时长 var rushdiscount = $("#rushDiscount").attr("value");//折扣 var begintoend = $("#beginToEnd").attr("value");//活动从开始到结束的全部持续时间 var countprice = $("#countprice").attr("value");//价格 if(rushtime == 1 || rushtime == 2){ //活动未开始,活动进行中 countDown(longtime,rushtime,begintoend); }else if(rushtime == 3){ //活动已结束 $("#qianggou").show().html("活动已结束"); }else{ //没有活动 $("#qianggou").hide(); } function countDown(longtime,rushtime,begintoend){ var time = longtime; time = parseInt(time / 1000); var day = Math.floor(time / (60*60*24)); time -= day * (60*60*24); var hour = Math.floor(time /(60*60)); time -= hour * (60*60); var minute = Math.floor(time / 60); var second = time - (minute * 60); if(day<10){ if(day<0 && rushtime == 1){ // 切换到正在抢购 rushtime = 2; window.setTimeout(function(){countDown(begintoend,rushtime,begintoend);},1000); }else if(day<0){ $("#qianggou").show().html("活动已结束"); $(".preprice1").html("").hide(); return; }else{ day="0"+day; } } if(hour<10){ hour="0"+hour; } if(minute<10){ minute="0"+minute; } if(second<10){ second="0"+second; } if(rushtime == 2){ $(".preprice1 i").html((countprice*rushdiscount).toFixed(2)); $(".preprice1").show(); } if(rushtime == 1 && day==0&&hour==0&&minute==0&&second==1){ $("#qianggou").show().html("距离抢购还有   "+day+"天"+hour+"时"+minute+"分"+second+"秒"); rushtime = 2; window.setTimeout(function(){countDown(begintoend,rushtime,begintoend);},1000); }else if(rushtime == 1){ $("#qianggou").show().html("距离抢购还有   "+day+"天"+hour+"时"+minute+"分"+second+"秒"); longtime = longtime-1000; window.setTimeout(function(){countDown(longtime,rushtime,begintoend);},1000); }else if(day==0&&hour==0&&minute==0&&second==0){ $("#qianggou").show().html("活动已结束"); $(".preprice1").html("").hide(); return; }else{ $("#qianggou").show().html("限时抢购剩余   "+day+"天"+hour+"时"+minute+"分"+second+"秒"); longtime = longtime-1000; window.setTimeout(function(){countDown(longtime,rushtime,begintoend);},1000); } }

Free & Fast Delivery          All Products' Discount          30-Day Money-Back Guarantee          12-month Warranty          Bulk Sale          Lifetime Customer Support

Search our site

Shopping Cart

Your cart is currently empty.

}