From 02aa4756fdf700c3e3ed87ec5c3abe78d8b8f58f Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 11 Jun 2023 22:18:47 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=A7=92=E6=9D=80=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E3=80=91=201.=20=E6=8E=A5=E5=85=A5=E8=AF=84?= =?UTF-8?q?=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/product/comment.js | 5 +- .../activity/goods_seckill_details/index.vue | 60 +++++++++++-------- 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/api/product/comment.js b/api/product/comment.js index ce88089f..f7851f2d 100644 --- a/api/product/comment.js +++ b/api/product/comment.js @@ -8,8 +8,9 @@ export function getCommentStatistics(spuId) { } // 获得最近的 n 条商品评价 -export function getCommentList(spuId) { +export function getCommentList(spuId, count) { return request.get('app-api/product/comment/list', { - spuId + spuId, + count }); } diff --git a/pages/activity/goods_seckill_details/index.vue b/pages/activity/goods_seckill_details/index.vue index adca77da..d333c2fa 100644 --- a/pages/activity/goods_seckill_details/index.vue +++ b/pages/activity/goods_seckill_details/index.vue @@ -53,16 +53,17 @@ - + - - 用户评价({{replyCount}}) + + 用户评价({{ replyCount }}) - {{replyChance}}%好评率 + {{ replyChance }}%好评率 - + @@ -216,6 +217,8 @@ import { silenceBindingSpread } from "@/utils"; import { spread } from "@/api/user"; import * as ProductSpuApi from '@/api/product/spu.js'; + import * as ProductFavoriteApi from '@/api/product/favorite.js'; + import * as ProductCommentApi from '@/api/product/comment.js'; import * as SeckillActivityApi from '@/api/promotion/seckill.js'; import * as Util from '@/utils/util.js'; import * as ProductUtil from '@/utils/product.js'; @@ -655,31 +658,40 @@ + '&seckillActivityId=' + this.id }); }, + /** + * 跳转到客服 + */ + kefuClick(){ + location.href = this.chatUrl; + }, + + // ========== 评价相关的方法 ========== + /** + * 获得商品评价列表 + */ + getProductReplyList: function() { + ProductCommentApi.getCommentList(this.id, 3).then(res => { + this.reply = res.data; + }) + }, + /** + * 获得商品评价统计 + */ + getProductReplyCount: function() { + ProductCommentApi.getCommentStatistics(this.id).then(res => { + this.$set(this, 'replyChance', res.data.goodPercent); + this.$set(this, 'replyCount', res.data.allCount); + }); + }, // TODO 芋艿:暂未整理 - kefuClick(){ - location.href = this.chatUrl; - }, + closePosters:function(){ this.posters = false; }, - getProductReplyList: function() { - getReplyList(this.storeInfo.productId, { - page: 1, - limit: 3, - type: 0, - }).then(res => { - this.reply = res.data.list; - }) - }, - getProductReplyCount: function() { - let that = this; - getReplyConfig(that.storeInfo.productId).then(res => { - that.$set(that, 'replyChance', res.data.replyChance * 100); - that.$set(that, 'replyCount', res.data.sumCount); - }); - }, + + // 后退 returns: function() { uni.navigateBack()