Evaluate = function(limit = 0, limits = []) { var _this = this; _this.listCount = 0; _this.page = 1; _this.limits = limits; _this.limit = limit == false ? 10 : limit; }; Evaluate.prototype.getList = function(d) { var _this = d._this; var page = _this.page; var limit = _this.limit; var search_type = d.search_type; var search_text = d.search_text == null ? {} : d.search_text; var explain_type = d.explain_type; var start_time = d.start_time; var end_time = d.end_time; var goods_id = d.goods_id; var is_audit = d.is_audit; $.ajax({ url: ns.url("shop/goods/evaluate"), async: false, data: { "page": page, "page_size": limit, "search_type": search_type, "search_text": search_text, "explain_type": explain_type, "start_time": start_time, "end_time": end_time, "goods_id" : goods_id, "is_audit" : is_audit, }, type: "POST", dataType: "JSON", success: function (res) { _this.listCount = res.data.count; $(".evaluate-table").find("tbody").empty(); var d = res.data.list; if (d.length == 0) { var html = '无数据'; $(".evaluate-table").find("tbody").append(html); } for (var i in d) { var img_one = d[i].sku_image.split(",")[0]; var html = ''; var isFirstExplain = Boolean(d[i].explain_first) ? 1 : 0;//是否第一次评价 html += ''; html += '' + '
' + '' + '' + '
' + ''; html += '' + '
' + '
' + // '' + '' + '
' + '
' + '

' + d[i].sku_name + '

' + '

¥' + d[i].sku_price + '

' + '
' + '
' + ''; html += '' + '
' + '

' + d[i].member_name + '

' + '
' + ''; html += '' + '
'; if (d[i].explain_type == 1) { html += `

好评

`; } else if (d[i].explain_type == 2) { html += `

中评

`; } else { html += `

差评

`; } '
' + ''; if(d[i].again_images.length > 0 && d[i].images.length == false){ html += ''; html += '
'+ '

' + d[i].content + '

'+ '
'; }else{ html += ''; html += '
'+ '

' + d[i].content + '

'+ '
'; } if (d[i].images) { html += '
'; var images = d[i].images.split(","); for (var j=0; j'; html += ''; html += '
'; } html += ''; } if (d[i].explain_first) { html += '
'+ '商家回复:'+ '

' + d[i].explain_first + '

' + '
'; } if (d[i].again_content) { html += '
'; html += '
' + '追评:' + '

' + d[i].again_content + '

' + '
'; if (d[i].again_images) { html += '
'; var again_images = d[i].again_images.split(","); for (var k=0; k'; html += ''; html += '
'; } html += ''; } } if (d[i].again_explain) { html += '
'+ '[商家回复]'+ '

' + d[i].again_explain + '

' + '
'; } html += ''; if(d[i].again_time != 0){ if(d[i].again_images.length > 0 ){ html += '' + '
' + '

' + ns.time_to_date(d[i].create_time) + '

' + '
' + '
' + '

' + ns.time_to_date(d[i].again_time) + '

' + '' + ''; }else{ html += '' + '
' + '

' + ns.time_to_date(d[i].create_time) + '

' + '
' + '
' + '
' + '

' + ns.time_to_date(d[i].again_time) + '

' + '
' + ''; } }else{ html += '' + '
' + '

' + ns.time_to_date(d[i].create_time) + '

' + '
' + ''; } var audit = "已审核"; var audit_action = ''; if(d[i].is_audit == 0){ audit = "未审核"; audit_action = '审核通过'; audit_action += '审核拒绝'; audit_action += '删除评论'; }else if(d[i].is_audit == 1){ audit = "审核通过"; audit_action += '删除评论'; }else if(d[i].is_audit == 2){ audit = "审核拒绝"; audit_action += '删除评论'; } var again_audit = "未追评"; if (d[i].again_time){ if(d[i].again_is_audit == 0){ again_audit = "未审核"; if (d[i].is_audit != 0 && d[i].again_is_audit == 0){ audit_action = '通过追评'; audit_action += '拒绝追评'; } }else if(d[i].again_is_audit == 1){ again_audit = "审核通过"; }else if(d[i].again_is_audit == 2){ again_audit = "审核拒绝"; } } html += '' + audit + ''; html += '
'; html += audit_action; if(d[i].is_audit == 1) { if ((d[i].content != "" && d[i].explain_first == "")) { html += '回复'; } else if ((d[i].again_content != "" && d[i].again_explain == "" && d[i].again_is_audit == 1)) { html += '追评回复'; } if ((d[i].content != "" && d[i].explain_first != "")) { html += '删除回复'; } if ((d[i].again_content != "" && d[i].again_explain != "")) { html += '删除追评回复'; } } html += '
'; html += ''; $(".evaluate-table").find("tbody").append(html); layui.use(['form', 'layer'],function(){ var form = layui.form, layer = layui.layer; form.render(); layer.photos({ photos: '.title-pic', anim: 5 }); }); } } }); }; Evaluate.prototype.pageInit = function (d) { var _this = d._this; layui.use('laypage', function () { var laypage = layui.laypage; laypage.render({ elem: 'laypage', count: _this.listCount, limit: _this.limit, limits: _this.limits, prev: '', next: '', layout: ['count','limit','prev', 'page', 'next'], // curr: location.hash.replace('#!page=', ''), //获取起始页 // hash: 'page', jump: function (obj, first) { _this.limit = obj.limit; if (!first) { _this.page = obj.curr; _this.getList({ _this: _this, "search_type": d.search_type, "search_text": d.search_text, "explain_type": d.explain_type, "start_time": d.start_time, "end_time": d.end_time, "goods_id" : d.goods_id, "is_audit" : d.is_audit }); } } }); }); };