<script>
var endtime = "{$vo.order_endtime}";
// 倒计时
function CountDown(){
var end = new Date(endtime);
var now = new Date();
var t = end.getTime() - now.getTime();
// 订单超时
if(end < now ){
document.getElementById('endtime').innerHTML = '剩余时间0';
return false;
}
var d=Math.floor(t/1000/60/60/24);
var h=Math.floor(t/1000/60/60%24);
var m=Math.floor(t/1000/60%60);
var s=Math.floor(t/1000%60);
// 格式化
var str_d = '';
var str_h = '';
var str_m = '';
var str_s = s+'秒';
if(d>0){
str_d = d+'天';
}
if(h>0){
str_h = h+'小时';
}
if(m>0){
str_m = m+'分钟';
}
// 已经超时
if(d<0){
var st = '已超时';
}else{
var str = str_d+str_h+str_m+str_s;
}
document.getElementById('endtime').innerHTML = str;
}
//CountDown();
setInterval(CountDown,1000);
</script>