猎豆优选官网

template.js 3.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. function template_home (data) {
  2. //每日推荐
  3. var html = '';
  4. // console.log(data)
  5. data.forEach(function (item, index) {
  6. var id=item.goods_id;
  7. var is_coupon=item.is_coupon;
  8. var coupon_price=item.coupon_price;
  9. var price=item.price;
  10. var discount_price=item.discount_price;
  11. var commission_rate=item.commission_rate;
  12. var quan = '';
  13. if(item.is_coupon){
  14. quan = "<div class=commodity_quan><span>券</span><span>" + item.coupon_price + "元</span></div>"
  15. }
  16. html += "<li><a href='../details/index.html?goods_id="+id+"&is_coupon="+is_coupon+"&coupon_price="+coupon_price+"&price="+price+"&discount_price="+discount_price+"&commission_rate="+commission_rate+"' target='_blank' class='lp_li_a'><img src=" + item.img + " /><div class=commodity><div class=commodity_name>" + item.title + "</div><div class=commodity_introduce>" + quan + "<div class=commodity_number>付款人数:<span>" + item.volume + "</span></div></div><div class=commodity_price><div><span class=nowPrice>¥" + item.discount_price + "</span><span class=oldPrice>¥" + item.price + "</span></div><div>立即抢购</div></div></div></a></li>";
  17. })
  18. return html;
  19. }
  20. function flash_time (data) {
  21. //限时抢购
  22. var html = '';
  23. data.forEach(function (item, index) {
  24. var id=item.goods_id;
  25. var is_coupon=item.is_coupon;
  26. var coupon_price=item.coupon_price;
  27. var price=item.price;
  28. var discount_price=item.discount_price;
  29. var commission_rate=item.commission_rate;
  30. var quan = '';
  31. var ratio = item.sale_num/item.total_num*100;
  32. if(item.coupon_id){
  33. quan = "<div class=commodity_quan><span>券</span><span>" + item.coupon_price + "元</span></div>"
  34. }
  35. html += "<li><a href='../details/index.html?goods_id="+id+"&is_coupon="+is_coupon+"&coupon_price="+coupon_price+"&price="+price+"&discount_price="+discount_price+"&commission_rate="+commission_rate+"' target='_blank' class='lp_li_a'><img src=" + item.img + " /><div class=commodity><div class=commodity_name>" + item.title + "</div><div class=commodity_introduce>" + quan + "<div class=commodity_number>付款人数:<span>" + item.sale_num + "</span></div></div><div class=commodity_price><div><span class=nowPrice>¥" + item.discount_price + "</span><span class=oldPrice>¥" + item.price + "</span></div><div>立即抢购</div></div><div class=commodity_jdt><div class=progress><div class=progress_value style=width:" + ratio + "%></div><span>剩余" + Number(item.total_num-item.sale_num) + "件</span></div></div></div></a></li>"
  36. })
  37. return html;
  38. }
  39. function flash_time_noStart (data) {
  40. //限时抢购
  41. var html = '';
  42. data.forEach(function (item, index) {
  43. var id=item.goods_id;
  44. var is_coupon=item.is_coupon;
  45. var coupon_price=item.coupon_price;
  46. var price=item.price;
  47. var discount_price=item.discount_price;
  48. var commission_rate=item.commission_rate;
  49. var quan = '';
  50. var ratio = item.sale_num/item.total_num*100;
  51. if(item.coupon_id){
  52. quan = "<div class=commodity_quan><span>券</span><span>" + item.coupon_price + "元</span></div>"
  53. }
  54. html += "<li><a href='javascript:void(0)' class='lp_li_a'><img src=" + item.img + " /><div class=commodity><div class=commodity_name>" + item.title + "</div><div class=commodity_introduce>" + quan + "<div class=commodity_number>付款人数:<span>" + item.sale_num + "</span></div></div><div class=commodity_price><div><span class=nowPrice>¥" + item.discount_price + "</span><span class=oldPrice>¥" + item.price + "</span></div><div style=background:#ccc>立即抢购</div></div><div class=commodity_jdt><div class=progress><div class=progress_value style=width:" + ratio + "%></div><span>剩余" + Number(item.total_num-item.sale_num) + "件</span></div></div></div></a></li>"
  55. })
  56. return html;
  57. }