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}} - + - + - -