var id=mobile.getUrlVars("id"); mui.init(); mui.previewImage(); /** *初始化、添加监听 */ mui.ready(function(){ getComment(); }); //查询订单 function getComment(){ mobile.ajaxPost(base+"/userOrderComment/getList",{merchantId:id},function(json){ if(json.data&&json.data.length>0){ $("#item1").append() var html1=[]; var html2=[]; var i = 0; $("#segmentedControls .mui-control-item").eq(0).html("全部("+json.data.length+")"); $.each(json.data,function(id,item){ if(!item.nickname){ item.nickname="匿名用户"; } if(!item.headimgurl){ item.headimgurl=base+"static/mobile/image/avatar.png"; } html1.push('
  • '); html1.push('
    '); html1.push(''); html1.push('
    '+item.nickname+'
    '); html1.push('

    '+item.comment_content+'

    '); html1.push('

    '+item.create_time+'

    '); if(item.comment_pic1){ html1.push(''); } if(item.comment_pic2){ html1.push(''); } if(item.comment_pic3){ html1.push(''); } html1.push('
    '); html1.push('
  • '); if(item.comment_pic1){ i++; html2.push('
  • '); html2.push('
    '); html2.push(''); html2.push('
    '+item.nickname+'
    '); html2.push('

    '+item.comment_content+'

    '); html2.push('

    '+item.create_time+'

    '); if(item.comment_pic1){ html2.push(''); } if(item.comment_pic2){ html2.push(''); } if(item.comment_pic3){ html2.push(''); } html2.push('
    '); html2.push('
  • '); } }); $("#segmentedControls .mui-control-item").eq(1).html("有图("+i+")"); $("#item1 ul").html(html1.join("")); $("#item2 ul").html(html2.join("")); }else{ mobile.tip("#item1","暂无评价","",""); mobile.tip("#item2","暂无评价","",""); } }); }