|
|
@@ -973,9 +973,15 @@ const loadCommentList = async () => {
|
|
|
const res: any = await commentList(params);
|
|
|
if (res.code === 200) {
|
|
|
commentListData.value = res.data.records || [];
|
|
|
- // 更新评论总数
|
|
|
+ // 更新评论总数(包括回复数)
|
|
|
if (currentDetail.value) {
|
|
|
- currentDetail.value.commentCount = res.data.total || 0;
|
|
|
+ const baseCommentCount = res.data.total || 0;
|
|
|
+ // 计算所有回复的总数
|
|
|
+ const replyCount = commentListData.value.reduce((total, comment) => {
|
|
|
+ return total + (comment.storeComment?.length || 0);
|
|
|
+ }, 0);
|
|
|
+ // 评论总数 = 评论数 + 回复数
|
|
|
+ currentDetail.value.commentCount = baseCommentCount + replyCount;
|
|
|
}
|
|
|
console.log("评论列表:", commentListData.value);
|
|
|
console.log("评论总数:", res.data.total);
|