From 39873a9e3c13e947d06c3aceb2b656b404afb6b3 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 28 Jun 2023 00:25:26 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=95=86=E5=93=81=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E3=80=91=201.=20=E5=8A=9F=E8=83=BD=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/product/comment.js | 7 ++ .../goods_combination_details/index.vue | 9 +- .../activity/goods_seckill_details/index.vue | 9 +- pages/goods_details/index.vue | 5 +- pages/users/goods_comment_list/index.vue | 108 +++++++++--------- 5 files changed, 71 insertions(+), 67 deletions(-) diff --git a/api/product/comment.js b/api/product/comment.js index afb0bbac..70d23a1f 100644 --- a/api/product/comment.js +++ b/api/product/comment.js @@ -18,3 +18,10 @@ export function getCommentList(spuId, count) { noAuth: true // TODO 芋艿:后续要做调整 }); } + +// 获得商品评价分页 +export function getCommentPage(data) { + return request.get('app-api/product/comment/page', data, { + noAuth: true // TODO 芋艿:后续要做调整 + }); +} diff --git a/pages/activity/goods_combination_details/index.vue b/pages/activity/goods_combination_details/index.vue index 9fb51fc9..372e0b1d 100644 --- a/pages/activity/goods_combination_details/index.vue +++ b/pages/activity/goods_combination_details/index.vue @@ -700,7 +700,7 @@ * 获得商品评价列表 */ getProductReplyList: function() { - ProductCommentApi.getCommentList(this.id, 3).then(res => { + ProductCommentApi.getCommentList(this.activity.spuId, 3).then(res => { this.reply = res.data; }) }, @@ -708,9 +708,10 @@ * 获得商品评价统计 */ getProductReplyCount: function() { - ProductCommentApi.getCommentStatistics(this.id).then(res => { - this.$set(this, 'replyChance', res.data.goodPercent); - this.$set(this, 'replyCount', res.data.allCount); + ProductCommentApi.getCommentStatistics(this.activity.spuId).then(res => { + const count = res.data.goodCount + res.data.mediocreCount + res.data.negativeCount; + this.$set(this, 'replyChance', 100.0 * res.data.goodCount / count); + this.$set(this, 'replyCount', count); }); }, diff --git a/pages/activity/goods_seckill_details/index.vue b/pages/activity/goods_seckill_details/index.vue index 049b60be..4da226df 100644 --- a/pages/activity/goods_seckill_details/index.vue +++ b/pages/activity/goods_seckill_details/index.vue @@ -630,7 +630,7 @@ * 获得商品评价列表 */ getProductReplyList: function() { - ProductCommentApi.getCommentList(this.id, 3).then(res => { + ProductCommentApi.getCommentList(this.activity.spuId, 3).then(res => { this.reply = res.data; }) }, @@ -638,9 +638,10 @@ * 获得商品评价统计 */ getProductReplyCount: function() { - ProductCommentApi.getCommentStatistics(this.id).then(res => { - this.$set(this, 'replyChance', res.data.goodPercent); - this.$set(this, 'replyCount', res.data.allCount); + ProductCommentApi.getCommentStatistics(this.activity.spuId).then(res => { + const count = res.data.goodCount + res.data.mediocreCount + res.data.negativeCount; + this.$set(this, 'replyChance', 100.0 * res.data.goodCount / count); + this.$set(this, 'replyCount', count); }); }, diff --git a/pages/goods_details/index.vue b/pages/goods_details/index.vue index d9a34a26..9050fcea 100644 --- a/pages/goods_details/index.vue +++ b/pages/goods_details/index.vue @@ -779,8 +779,9 @@ */ getProductReplyCount: function() { ProductCommentApi.getCommentStatistics(this.id).then(res => { - this.$set(this, 'replyChance', res.data.goodPercent); - this.$set(this, 'replyCount', res.data.allCount); + const count = res.data.goodCount + res.data.mediocreCount + res.data.negativeCount; + this.$set(this, 'replyChance', 100.0 * res.data.goodCount / count); + this.$set(this, 'replyCount', count); }); }, diff --git a/pages/users/goods_comment_list/index.vue b/pages/users/goods_comment_list/index.vue index d2c27620..d538ab52 100644 --- a/pages/users/goods_comment_list/index.vue +++ b/pages/users/goods_comment_list/index.vue @@ -4,50 +4,44 @@ 评分 - - + - {{(replyData.replyChance)*100}}%好评率 + {{ 100.0 * replyData.goodCount / replyData.count }}%好评率 - 全部({{replyData.sumCount}}) + 全部({{replyData.count}}) - 好评({{replyData.goodCount}}) + 好评({{replyData.goodCount}}) - 中评({{replyData.inCount}}) + 中评({{replyData.mediocreCount}}) - 差评({{replyData.poorCount}}) + 差评({{replyData.negativeCount}}) - {{loadTitle}} + {{loadTitle}} - + - + - -