|
@@ -119,6 +119,18 @@ $(function () {
|
|
|
if(data&&data.error.length){
|
|
|
msg(data.error[0].message)
|
|
|
};
|
|
|
+ if(data.data.totalCommentCount>0){
|
|
|
+ let good = (((data.data.positiveCommentCount)/(data.data.totalCommentCount))*100).toFixed(1),
|
|
|
+ middle = (((data.data.ordinaryCommentCount)/(data.data.totalCommentCount))*100).toFixed(1),
|
|
|
+ bad = (100-good-middle).toFixed(1);
|
|
|
+ $('.commentDetails').html(`
|
|
|
+ 评价 :<span>好评(${good+'%'})</span><span>中评(${middle+'%'})</span><span>差评(${bad+'%'})</span>
|
|
|
+ `)
|
|
|
+ }else{
|
|
|
+ $('.commentDetails').html(`
|
|
|
+ 评价 :<span>好评(100%)</span><span>中评(0%)</span><span>差评(0%)</span>
|
|
|
+ `)
|
|
|
+ }
|
|
|
if (data.data && data.data.comments.list.length) {
|
|
|
let nub = data.data.comments.list.length;
|
|
|
for (let i = 0; i < nub; i++) {
|
|
@@ -146,14 +158,7 @@ $(function () {
|
|
|
</div>
|
|
|
</li>`);
|
|
|
};
|
|
|
- if(data.data.totalCommentCount>0){
|
|
|
- let good = (((data.data.positiveCommentCount)/(data.data.totalCommentCount))*100).toFixed(1),
|
|
|
- middle = (((data.data.ordinaryCommentCount)/(data.data.totalCommentCount))*100).toFixed(1),
|
|
|
- bad = (100-good-middle).toFixed(1);
|
|
|
- $('.commentDetails').html(`
|
|
|
- 评价 :<span>好评(${good+'%'})</span><span>中评(${middle+'%'})</span><span>差评(${bad+'%'})</span>
|
|
|
- `)
|
|
|
- }
|
|
|
+
|
|
|
};
|
|
|
|
|
|
$('.numberBars').html(data.data.totalCommentCount>10?'10+':data.data.totalCommentCount)
|
|
@@ -262,7 +267,8 @@ $(function () {
|
|
|
data:{
|
|
|
commodityId:ids,
|
|
|
content:textVal,
|
|
|
- star:starNum,
|
|
|
+ star:starNum,
|
|
|
+ commodityType:0
|
|
|
}
|
|
|
}).done(function(data){
|
|
|
if(data&&data.error.length){
|