dengrui/pagesB/allEvaluate/allEvaluate.vue

111 lines
3.0 KiB
Vue
Raw Normal View History

2021-08-26 01:49:06 +00:00
<template>
<view style="padding-bottom: 120rpx;" v-if="pageShow">
<!-- 使用标题栏 -->
<status-nav :statusBackw="true" :statusTitle="true" :title-val="'商品评价'" :tabcolor="'#ffffff'"></status-nav>
<view class="bacb padding-x20" :style="{marginTop:(statusHNH+10)+'px'}" style="background-color: #F5F5F5;">
<!-- 列表 -->
<evaluateList :eval-arr="evalArr" :isEval="true"></evaluateList>
</view>
<!-- 客服 -->
<bottomkf :detail="proDetail" @diaoq="proDetailEv" :sku_img="sku_img"></bottomkf>
</view>
</template>
<script>
import bottomkf from '@/components/bottomkf.vue';
import evaluateList from '@/components/evaluateList.vue';
export default {
components:{
bottomkf,
evaluateList
},
data() {
return {
evalArr:[],
page:1,
2021-08-29 01:35:35 +00:00
size:10,
total:'',
isZanw:true,
2021-08-26 01:49:06 +00:00
only_image:0,
proDetail:'',
sku_img:'',
statusHNH:uni.getStorageSync('statusHNH'),
2021-08-29 01:35:35 +00:00
pageShow:false,
dangId:''
2021-08-26 01:49:06 +00:00
}
},
onUnload() {
uni.removeStorageSync('plOrder')
},
onLoad(options) {
this.checkAllEvaluate(options.id)
2021-08-29 01:35:35 +00:00
this.dangId = options.id
2021-08-26 01:49:06 +00:00
this.proDetail = uni.getStorageSync('plOrder')
},
onShow() {
this.$toolAll.tools.guoq()
},
2021-08-29 01:35:35 +00:00
onReachBottom() {
if(this.total!=this.evalArr.length){
this.page++
this.checkAllEvaluate(this.dangId)//调用自主预约列表事件
} else {
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多商品列表','none',1000)
this.isZanw = false
}
},
2021-08-26 01:49:06 +00:00
methods: {
proDetailEv(){
this.sku_img = this.$http + this.proDetail.sku_list[0].main_image
},
checkAllEvaluate(id){//查看所有评论列表事件
let allEvaluateObj = {
spu_id:id,
page:this.page,
size:this.size,
only_image:this.only_image
}
this.$requst.post('product/spu/comment-list',allEvaluateObj).then(res=>{
// console.log('所有评论信息:',res);
if(res.code==0){
this.pageShow = true
2021-08-29 01:35:35 +00:00
if(this.page==1) this.evalArr = []
this.total = res.data.total
2021-08-26 01:49:06 +00:00
if(res.data.list.length!=0){
res.data.list.forEach(item=>{
let imgArr = []
item.images.forEach(itemimg=>{
let imgObj = {
src:this.$http + itemimg
}
imgArr.push(imgObj)
})
let newname = this.$toolAll.tools.hideName(item.account.nickname)//隐藏姓名中间几位
let haveH = item.account.headimgurl.slice(0,4)
if(haveH!='http') {
haveH = this.$http
} else haveH = ''
let evalObj = {
src:haveH + item.account.headimgurl,
name:newname,
xingj:item.grade,
content:item.content,
title:item.orderSku.spu_name,
time:item.created_at,
imgList:imgArr
}
this.evalArr.push(evalObj)
})
// console.log(this.evalArr);
}
}
},error=>{})
}
}
}
</script>
<style>
</style>