2020-08-13 08:12:57 +00:00
|
|
|
<template>
|
2021-06-11 09:41:16 +00:00
|
|
|
<view style="height: 100%;">
|
2020-08-13 08:12:57 +00:00
|
|
|
<view class='evaluate-list'>
|
|
|
|
<view class='generalComment acea-row row-between-wrapper'>
|
|
|
|
<view class='acea-row row-middle font-color'>
|
|
|
|
<view class='evaluate'>评分</view>
|
2021-06-11 09:41:16 +00:00
|
|
|
<view class='start'
|
|
|
|
:class="'star'+ (replyData.sumCount===0?'3':Math.round(replyData.replyStar/replyData.sumCount))">
|
|
|
|
</view>
|
2020-08-13 08:12:57 +00:00
|
|
|
</view>
|
|
|
|
<view><text class='font-color'>{{(replyData.replyChance)*100}}%</text>好评率</view>
|
|
|
|
</view>
|
|
|
|
<view class='nav acea-row row-middle'>
|
2021-06-11 09:41:16 +00:00
|
|
|
<view class='item' :class='type==0 ? "bg-color":""' @click='changeType(0)'>全部({{replyData.sumCount}})
|
|
|
|
</view>
|
|
|
|
<view class='item' :class='type==1 ? "bg-color":""' @click='changeType(1)'>好评({{replyData.goodCount}})
|
|
|
|
</view>
|
|
|
|
<view class='item' :class='type==2 ? "bg-color":""' @click='changeType(2)'>中评({{replyData.inCount}})
|
|
|
|
</view>
|
|
|
|
<view class='item' :class='type==3 ? "bg-color":""' @click='changeType(3)'>差评({{replyData.poorCount}})
|
|
|
|
</view>
|
2020-08-13 08:12:57 +00:00
|
|
|
</view>
|
|
|
|
<userEvaluation :reply="reply"></userEvaluation>
|
2021-06-11 09:41:16 +00:00
|
|
|
</view>
|
|
|
|
<view class='loadingicon acea-row row-center-wrapper'>
|
|
|
|
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
|
2020-08-13 08:12:57 +00:00
|
|
|
</view>
|
|
|
|
<view class='noCommodity' v-if="!replyData.sumCount && page > 1">
|
|
|
|
<view class='pictrue'>
|
2020-12-23 07:56:45 +00:00
|
|
|
<image src='../static/noEvaluate.png'></image>
|
2020-08-13 08:12:57 +00:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import {
|
|
|
|
getReplyList,
|
|
|
|
getReplyConfig
|
|
|
|
} from '@/api/store.js';
|
|
|
|
import userEvaluation from '@/components/userEvaluation';
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
userEvaluation
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
replyData: {},
|
|
|
|
product_id: 0,
|
|
|
|
reply: [],
|
|
|
|
type: 0,
|
|
|
|
loading: false,
|
|
|
|
loadend: false,
|
|
|
|
loadTitle: '加载更多',
|
|
|
|
page: 1,
|
|
|
|
limit: 20
|
|
|
|
};
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function(options) {
|
|
|
|
let that = this;
|
2020-11-05 08:21:06 +00:00
|
|
|
if (!options.productId) return that.$util.Tips({
|
2020-08-13 08:12:57 +00:00
|
|
|
title: '缺少参数'
|
|
|
|
}, {
|
|
|
|
tab: 3,
|
|
|
|
url: 1
|
|
|
|
});
|
2020-11-05 08:21:06 +00:00
|
|
|
that.productId = options.productId;
|
2020-08-13 08:12:57 +00:00
|
|
|
},
|
|
|
|
onShow: function() {
|
|
|
|
this.getProductReplyCount();
|
|
|
|
this.getProductReplyList();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
/**
|
|
|
|
* 获取评论统计数据
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
getProductReplyCount: function() {
|
|
|
|
let that = this;
|
2020-11-05 08:21:06 +00:00
|
|
|
getReplyConfig(that.productId).then(res => {
|
2021-06-11 09:41:16 +00:00
|
|
|
that.$set(that, 'replyData', res.data);
|
2020-08-13 08:12:57 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 分页获取评论
|
|
|
|
*/
|
|
|
|
getProductReplyList: function() {
|
|
|
|
let that = this;
|
|
|
|
if (that.loadend) return;
|
|
|
|
if (that.loading) return;
|
|
|
|
that.loading = true;
|
|
|
|
that.loadTitle = '';
|
2020-11-05 08:21:06 +00:00
|
|
|
getReplyList(that.productId, {
|
2020-08-13 08:12:57 +00:00
|
|
|
page: that.page,
|
|
|
|
limit: that.limit,
|
|
|
|
type: that.type,
|
|
|
|
}).then(res => {
|
|
|
|
let list = res.data.list,
|
|
|
|
loadend = list.length < that.limit;
|
|
|
|
that.reply = that.$util.SplitArray(list, that.reply);
|
2021-06-11 09:41:16 +00:00
|
|
|
that.$set(that, 'reply', that.reply);
|
2020-08-13 08:12:57 +00:00
|
|
|
that.loading = false;
|
|
|
|
that.loadend = loadend;
|
2021-06-11 09:41:16 +00:00
|
|
|
if (that.reply.length) {
|
2021-03-19 10:26:43 +00:00
|
|
|
that.loadTitle = loadend ? "😕人家是有底线的~~" : "加载更多";
|
|
|
|
}
|
2020-08-13 08:12:57 +00:00
|
|
|
that.page = that.page + 1;
|
|
|
|
}).catch(err => {
|
|
|
|
that.loading = false,
|
2021-06-11 09:41:16 +00:00
|
|
|
that.loadTitle = '加载更多'
|
2020-08-13 08:12:57 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
/*
|
|
|
|
* 点击事件切换
|
|
|
|
* */
|
|
|
|
changeType: function(e) {
|
|
|
|
let type = parseInt(e);
|
|
|
|
if (type == this.type) return;
|
|
|
|
this.type = type;
|
|
|
|
this.page = 1;
|
|
|
|
this.loadend = false;
|
2021-06-11 09:41:16 +00:00
|
|
|
this.$set(this, 'reply', []);
|
2020-08-13 08:12:57 +00:00
|
|
|
this.getProductReplyList();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom: function() {
|
|
|
|
this.getProductReplyList();
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2021-06-11 09:41:16 +00:00
|
|
|
page {
|
|
|
|
background-color: #fff;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
.evaluate-list{
|
|
|
|
padding: 30rpx 0 0 0;
|
|
|
|
background-color: #fff;
|
|
|
|
}
|
|
|
|
.evaluate-list .generalComment {
|
|
|
|
padding: 0 30rpx;
|
|
|
|
margin-top: 1rpx;
|
|
|
|
background-color: #fff;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #808080;
|
|
|
|
}
|
|
|
|
|
|
|
|
.evaluate-list .generalComment .evaluate {
|
|
|
|
margin-right: 7rpx;
|
|
|
|
color: #333333;
|
|
|
|
font-size: 28rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.evaluate-list .nav {
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #282828;
|
|
|
|
padding: 30rpx;
|
|
|
|
background-color: #fff;
|
|
|
|
border-bottom: 1rpx solid #f5f5f5;
|
|
|
|
}
|
|
|
|
|
|
|
|
.evaluate-list .nav .item {
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #282828;
|
|
|
|
border-radius: 27rpx;
|
|
|
|
height: 54rpx;
|
|
|
|
padding: 0 20rpx;
|
|
|
|
background-color: #f4f4f4;
|
|
|
|
line-height: 54rpx;
|
|
|
|
margin-right: 17rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.evaluate-list .nav .item.bg-color {
|
|
|
|
color: #fff;
|
|
|
|
}
|
2020-08-13 08:12:57 +00:00
|
|
|
</style>
|