{if $product['name'] != ''}
{eval
$_img_exps = explode('|', $product['img']);
$image = $_img_exps[0];
$imageurl = $this->Config['site_url'].IMAGE_PATH.'product/'.$image;
$producturl = $this->Config['site_url'].'/?view='.$product['id'];
$saves = $product['price']-$product['nowprice'];
}
var tuan_data = {
'name': '{$product['name']}',
'price': '¥{$product['price']}',
'nowprice': '¥{$product['nowprice']}',
'discount': '{$product['agio']}折',
'saves': '¥{$saves}',
'buyers': {$product['num']},
'total': {$sellcount['total']},
'sell': {$sellcount['sell']},
'remain': {$sellcount['remain']}
};
var tuan_product_url = '{$producturl}';
var tuan_product_image = '{$imageurl}';
var tuan_time_life = {$product['time']};
{else}
var tuan_data = {
'name': '暂无团购',
'price': '¥0',
'nowprice': '¥0',
'discount': '0折',
'saves': '¥0',
'buyers': 0,
'total': 0,
'sell': 0,
'remain': 0
};
var tuan_product_url = '/';
var tuan_product_image = '';
var tuan_time_life = 0;
{/if}
var hour;
var minute;
var second;
var msecond=9;
var str;
function tuan_showtime()
{
if (tuan_time_life<0) return;
var fillM = '';
var fillS = '';
hour = Math.floor(tuan_time_life/3600);
iless = tuan_time_life%3600;
minute = Math.floor(iless/60);
if (minute<10) fillM = '0';
second = iless%60;
if (second<10) fillS = '0';
if (msecond>0)
{
msecond --;
}
else
{
msecond = 9;
tuan_time_life --;
}
if(tuan_time_life<=0)
{
$('#tuan_time_life').html('团购结束');
return;
}
str = '';
if(hour!=0) str+=''+hour+'小时';
if(minute!=0 || hour!=0) str+=''+fillM+''+minute+'分';
str+=''+fillS+''+second+'.'+msecond+'秒';
$('#tuan_time_life').html(str);
}
$(document).ready(function()
{
tuan_showtime();
setInterval(tuan_showtime,100);
// data
for (key in tuan_data)
{
try{$('#tuan_'+key).html(tuan_data[key]);}catch(e){}
}
$('.tuan_product_url').attr('href', tuan_product_url);
$('#tuan_product_image').attr('src', tuan_product_image);
});