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()