Authored by 王水玲

秒杀模版修改

@@ -709,6 +709,19 @@ function formatTime(time) { @@ -709,6 +709,19 @@ function formatTime(time) {
709 } 709 }
710 710
711 function setSeckillProductData(curProdcutList, products) { 711 function setSeckillProductData(curProdcutList, products) {
  712 + let num = curProdcutList.data('num');
  713 + let $curOutProductList = curProdcutList.parents('.seckill').find('.out-product-list');
  714 +
  715 + if (products && products.length > num) {
  716 + products = products.slice(0, num);
  717 + }
  718 +
  719 + if (products.length <= 3) {
  720 + $curOutProductList.addClass('less-than-3');
  721 + } else {
  722 + $curOutProductList.removeClass('less-than-3');
  723 + }
  724 +
712 curProdcutList.html(seckillProductTpl({ 725 curProdcutList.html(seckillProductTpl({
713 isApp: yoho.isApp, 726 isApp: yoho.isApp,
714 list: products, 727 list: products,
@@ -722,20 +735,6 @@ function setSeckillProductData(curProdcutList, products) { @@ -722,20 +735,6 @@ function setSeckillProductData(curProdcutList, products) {
722 } 735 }
723 736
724 function viewSeckillProduct(products, dom) { 737 function viewSeckillProduct(products, dom) {
725 - let $productList = $('.seckill .product-list');  
726 - let num = $productList.data('num');  
727 - let $curOutProductList = dom ? dom.parents('.seckill').find('.out-product-list') : $('.out-product-list');  
728 -  
729 - if (products && products.length > num) {  
730 - products = products.slice(0, num);  
731 - }  
732 -  
733 - if (products.length <= 3) {  
734 - $curOutProductList.addClass('less-than-3');  
735 - } else {  
736 - $curOutProductList.removeClass('less-than-3');  
737 - }  
738 -  
739 if (dom) { 738 if (dom) {
740 setSeckillProductData(dom.parents('.seckill').find('.product-list'), products); 739 setSeckillProductData(dom.parents('.seckill').find('.product-list'), products);
741 } else { 740 } else {