You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/public/assets/pages-comment-index.fe9898f...

2 lines
3.8 KiB

11 months ago
import{_ as e}from"./u-tabs.f280784d.js";import{p as a,q as s,o as t,c as o,w as l,n as r,i as n,a as i,b as c,d as m,F as u,x as d,r as p,f as g,t as f,e as h,k as _,g as T}from"./index-ae8bbb19.js";import{r as b}from"./uni-app.es.ee1d5b08.js";import{l as y,t as v,_ as I}from"./comment.92b0fbb1.js";import{M as k,_ as x}from"./mescroll-mixins.7cda1bf3.js";import{A as w}from"./index.0c0be40a.js";import{_ as C}from"./_plugin-vue_export-helper.1b428a4d.js";import"./u-icon.b463ad8a.js";const j=[{name:"全部",scoreType:-1},{name:"好评",scoreType:10},{name:"中评",scoreType:20},{name:"差评",scoreType:30}];const S=C({components:{AvatarImage:w},mixins:[k],data:()=>({goodsId:null,curTab:0,list:a(),total:{all:0,negative:0,praise:0,review:0},rates:{10:5,20:3,30:1},tabs:j,upOption:{auto:!0,page:{size:15},noMoreSize:4,empty:{tip:"亲,暂无相关商品评价"}}}),onLoad(e){this.goodsId=e.goodsId,this.getTotal()},methods:{upCallback(e){const a=this;a.getCommentList(e.num).then((e=>{const s=e.data.length,t=e.data.total;a.mescroll.endBySize(s,t)})).catch((()=>a.mescroll.endErr()))},getCommentList(e=1){const a=this;return new Promise(((t,o)=>{y(a.goodsId,{scoreType:a.getScoreType(),page:e},{load:!1}).then((o=>{const l=o.data.list;a.list.data=s(l,a.list,e),t(l)}))}))},getScoreType(){return this.tabs[this.curTab].scoreType},getTotal(){const e=this;v(e.goodsId).then((a=>{const s=a.data.total;e.getTabs(s)}))},getTabs(e){const a=this.tabs;a[0].name=`全部(${e.all})`,a[1].name=`好评(${e.praise})`,a[2].name=`中评(${e.review})`,a[3].name=`差评(${e.negative})`},onChangeTab(e){this.curTab=e,this.onRefreshList()},onRefreshList(){this.list=a(),setTimeout((()=>{this.mescroll.resetUpScroll()}),120)},onPreviewImages(e,a){const s=this.list.data[e].images.map((e=>e.image_url));uni.previewImage({current:s[a],urls:s})}}},[["render",function(a,s,y,v,k,w){const C=b(d("u-tabs"),e),j=p("avatar-image"),S=n,L=_,$=b(d("u-rate"),I),z=T,P=b(d("mescroll-body"),x);return t(),o(S,{class:"container",style:r(a.appThemeStyle)},{default:l((()=>[i(P,{ref:"mescrollRef",sticky:!0,onInit:a.mescrollInit,down:{use:!1},up:k.upOption,onUp:w.upCallback},{default:l((()=>[i(C,{list:k.tabs,"is-scroll":!1,current:k.curTab,"active-color":a.appTheme.mainBg,duration:.2,onChange:w.onChangeTab},null,8,["list","current","active-color","duration","onChange"]),i(S,{class:"comment-list"},{default:l((()=>[(t(!0),c(u,null,m(k.list.data,((e,a)=>(t(),o(S,{class:"comment-item",key:a},{default:l((()=>[i(S,{class:"item-head"},{default:l((()=>[i(S,{class:"user-info"},{default:l((()=>[i(S,{class:"user-avatar"},{default:l((()=>[i(j,{url:e.user.avatar_url,width:50},null,8,["url"])])),_:2},1024),i(L,{class:"user-name f-26"},{default:l((()=>[g(f(e.user.nick_name),1)])),_:2},1024)])),_:2},1024),i($,{"active-color":"#f4a213",current:k.rates[e.score],disabled:!0},null,8,["current"]),i(S,{class:"flex-box f-22 col-9 t-r"},{default:l((()=>[g(f(e.create_time),1)])),_:2},1024)])),_:2},1024),i(S,{class:"item-content m-top20"},{default:l((()=>[i(L,{class:"f-26"},{default:l((()=>[g(f(e.content),1)])),_:2},1024)])),_:2},1024),e.images.length?(t(),o(S,{key:0,class:"images-list clearfix"},{default:l((()=>[(t(!0),c(u,null,m(e.images,((e,s)=>(t(),o(S,{class:"image-preview",key:s},{default:l((()=>[i(z,{class:"image",mode:"aspectFill",src:e.image_url,onClick:e=>w.onPreviewImages(a,s)},null,8,["src","onClick"])])),_:2},1024)))),128))])),_:2},1024)):h("",!0),i(S,{class:"goods-props clearfix"},{default:l((()=>[(t(!0),c(u,null,m(e.orderGoods.goods_props,((e,a)=>(t(),o(S,{class:"goods-props-item",key:a},{default:l((()=>[i(L,{class:"group-name"},{default:l((()=>[g(f(e.group.name)+": ",1)])),_:2},1024),i(L,null,{default:l((()=>[g(f(e.value.name)+";",1)])),_:2},1024)])),_:2},1024)))),128))])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1},8,["onInit","up","onUp"])])),_:1},8,["style"])}],["__scopeId","data-v-cf04de30"]]);export{S as default};