Commit 3f8827fa authored by Mac's avatar Mac

评论提交

parent 2a77da42
<template> <template>
<view class="comment-list" v-if="commentCount && commentCount.length > 0"> <view class="comment-list" >
<u-tabs <u-tabs
name="name" name="name"
:list="commentCount" :list="list"
:is-scroll="false" :is-scroll="false"
:active-color="mc" :active-color="mc"
:current="current" :current="current"
...@@ -21,7 +21,16 @@ ...@@ -21,7 +21,16 @@
<view class="u-box"> <view class="u-box">
<view class="user"> <view class="user">
<u-avatar :src="x.UserPhotoPath" :size="50"></u-avatar> <u-avatar :src="x.UserPhotoPath" :size="50"></u-avatar>
<text style="margin-left: 10px;">{{ x.UserName }}</text> <text style="margin:0 10px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;max-width: 130px;">{{ x.UserName }}</text>
<u-rate
:current="x.CommentScore"
active-color="#FA3534"
inactive-color="#b2b2b2"
active-icon="star"
inactive-icon="star-o"
size="20"
:disabled="true"
></u-rate>
</view> </view>
<view class="timer">{{ x.CreateDate }}</view> <view class="timer">{{ x.CreateDate }}</view>
</view> </view>
...@@ -85,6 +94,7 @@ export default { ...@@ -85,6 +94,7 @@ export default {
pageTitle: "全部评论", pageTitle: "全部评论",
status: "loadmore", status: "loadmore",
isover: false, isover: false,
list:[],
loadText: { loadText: {
loadmore: "轻轻上拉,加载更多", loadmore: "轻轻上拉,加载更多",
loading: "努力加载中", loading: "努力加载中",
...@@ -102,8 +112,9 @@ export default { ...@@ -102,8 +112,9 @@ export default {
uni.showNavigationBarLoading(); uni.showNavigationBarLoading();
this.id = option.id || 46942; this.id = option.id || 46942;
this.mc = this.$uiConfig.mainColor; this.mc = this.$uiConfig.mainColor;
this.init();
this.initPage(); this.initPage();
this.getCommentStatistics()
}, },
methods: { methods: {
previewImage(i,images) { previewImage(i,images) {
...@@ -142,6 +153,27 @@ export default { ...@@ -142,6 +153,27 @@ export default {
title: this.pageTitle, title: this.pageTitle,
}); });
}, },
getCommentStatistics(){
this.request2(
{
url: "/api/AppletOrder/GetAppletGoodsCommentStatistics",
data: {
GoodsId:this.id
},
},
(res) => {
let data = res.data.List
data.forEach(x=>{
x.name = x.Name+'(' + x.Count + ')'
})
data.unshift({name:'全部',Id:0})
this.list = data
this.msg.CommentGrade = data[0].Id
this.init();
}
);
},
init() { init() {
this.isover = false; this.isover = false;
this.loading = true; this.loading = true;
...@@ -199,6 +231,8 @@ export default { ...@@ -199,6 +231,8 @@ export default {
}, },
tabsChange(index) { tabsChange(index) {
this.current = index; this.current = index;
this.msg.pageIndex = 1;
this.msg.CommentGrade = this.list[index].Id
this.init() this.init()
this.page=1 this.page=1
}, },
...@@ -247,7 +281,10 @@ export default { ...@@ -247,7 +281,10 @@ export default {
.comment-list .comment-details .comment .content .u-box { .comment-list .comment-details .comment .content .u-box {
display: flex; display: flex;
margin-bottom: 10px; margin-bottom: 10px;
flex-direction: row;
justify-content: space-between;
align-items: center; align-items: center;
} }
.comment-list .comment-details .comment .content .u-box .user { .comment-list .comment-details .comment .content .u-box .user {
flex: 1; flex: 1;
......
...@@ -7,12 +7,13 @@ ...@@ -7,12 +7,13 @@
<view class="good-info">{{goodsName}}</view> <view class="good-info">{{goodsName}}</view>
<view class="op-box"> <view class="op-box">
<u-rate <u-rate
:current="msg.CommentGrade" :current="msg.CommentScore"
active-color="#FA3534" active-color="#FA3534"
inactive-color="#b2b2b2" inactive-color="#b2b2b2"
active-icon="star" active-icon="star"
inactive-icon="star-o" inactive-icon="star-o"
size="40" size="40"
@change='change'
></u-rate> ></u-rate>
</view> </view>
</view> </view>
...@@ -67,11 +68,12 @@ export default { ...@@ -67,11 +68,12 @@ export default {
mc: "", mc: "",
secondary: "", secondary: "",
msg: { msg: {
CommentGrade: 5, CommentGrade: 0,
GoodsId: 0, GoodsId: 0,
Content: "", Content: "",
OrderDetailId: 0, OrderDetailId: 0,
CommentImgList: [], CommentImgList: [],
CommentScore:5
}, },
submitStatus: false, submitStatus: false,
goodsName: "", goodsName: "",
...@@ -102,9 +104,12 @@ export default { ...@@ -102,9 +104,12 @@ export default {
let r = JSON.parse(data); let r = JSON.parse(data);
this.msg.CommentImgList.push(r.data); this.msg.CommentImgList.push(r.data);
}, },
change(val){
this.msg.CommentScore = val
},
submitForm() { submitForm() {
this.submitStatus = true; this.submitStatus = true;
if (this.msg.CommentGrade > 0) { if (this.msg.CommentScore > 0) {
this.request2( this.request2(
{ {
url: "/api/AppletOrder/SetGoodsCommentInfo", url: "/api/AppletOrder/SetGoodsCommentInfo",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment