// list 是ajax请求过来的数据
// obj是你选择的对象(我这里是选择的ul 让数据在ul 里面 展示)
var loadCouponUI = function(list, obj) {
var html = '';
$.each(list.list, function(k, info){
html += '<li>\
<div class="coutop">\
<a href="'+info.url+'"><img class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="'+info.cover+'" width="230px" height="200px" alt=""></a>\
<h4><a href="'+info.coupon_info.url+'">['+info.coupon_info.name+'] </a><a href="'+info.url+'">'+info.title+'</a></h4>\
<p>有效期至 <em>'+info.end_time+'</em></p>\
</div>\
<div class="coubottom clearfix">\
<p class="num left">\
<span class="surplus-num">剩余<em>'+info.last_total+'</em>份</span>\
<span class="totle-num">共<em>'+info.total+'</em>份</span>\
</p>';
if (info.coupon_status == 1) {
html += '<a href="javascript:void(0);" class="btn btn-danger right">立即领取</a>';
} else if (info.coupon_status == 2) {
htim += '<a href="javascript:void(0);" class="btn btn-primary right">已领完</a>';
} else if (info.coupon_status == 4) {
html += '<a href="javascript:void(0);" class="btn btn-info right">已领取</a>';
}
html += '</div>\
</li>';
})
obj.append(html);
}
共同学习,写下你的评论
评论加载中...
作者其他优质文章