【秒杀商品详情】

1. 接入评价
pull/1/MERGE
YunaiV 2023-06-11 22:18:47 +08:00
parent 80c5617d52
commit 02aa4756fd
2 changed files with 39 additions and 26 deletions

View File

@ -8,8 +8,9 @@ export function getCommentStatistics(spuId) {
} }
// 获得最近的 n 条商品评价 // 获得最近的 n 条商品评价
export function getCommentList(spuId) { export function getCommentList(spuId, count) {
return request.get('app-api/product/comment/list', { return request.get('app-api/product/comment/list', {
spuId spuId,
count
}); });
} }

View File

@ -53,16 +53,17 @@
</view> </view>
<view class='iconfont icon-jiantou'></view> <view class='iconfont icon-jiantou'></view>
</view> </view>
<!-- 评论 TODO --> <!-- 评论 -->
<view class='userEvaluation' id="past1"> <view class='userEvaluation' id="past1">
<view class='title acea-row row-between-wrapper' :style="replyCount==0?'border-bottom-left-radius:14rpx;border-bottom-right-radius:14rpx;':''"> <view class='title acea-row row-between-wrapper'
<view>用户评价({{replyCount}})</view> :style="replyCount ===0?'border-bottom-left-radius:14rpx;border-bottom-right-radius:14rpx;':''">
<view>用户评价({{ replyCount }})</view>
<navigator class='praise' hover-class='none' :url="'/pages/users/goods_comment_list/index?productId='+ storeInfo.productId"> <navigator class='praise' hover-class='none' :url="'/pages/users/goods_comment_list/index?productId='+ storeInfo.productId">
<text class='font-color'>{{replyChance}}%</text>好评率 <text class='font-color'>{{ replyChance }}%</text>好评率
<text class='iconfont icon-jiantou'></text> <text class='iconfont icon-jiantou'></text>
</navigator> </navigator>
</view> </view>
<userEvaluation :reply="reply"></userEvaluation> <userEvaluation :reply="reply" />
</view> </view>
</view> </view>
</view> </view>
@ -216,6 +217,8 @@
import { silenceBindingSpread } from "@/utils"; import { silenceBindingSpread } from "@/utils";
import { spread } from "@/api/user"; import { spread } from "@/api/user";
import * as ProductSpuApi from '@/api/product/spu.js'; 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 SeckillActivityApi from '@/api/promotion/seckill.js';
import * as Util from '@/utils/util.js'; import * as Util from '@/utils/util.js';
import * as ProductUtil from '@/utils/product.js'; import * as ProductUtil from '@/utils/product.js';
@ -655,31 +658,40 @@
+ '&seckillActivityId=' + this.id + '&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 // TODO
kefuClick(){
location.href = this.chatUrl;
},
closePosters:function(){ closePosters:function(){
this.posters = false; 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() { returns: function() {
uni.navigateBack() uni.navigateBack()