【修复】修复商品详情内评价数量显示错误的问题。

This commit is contained in:
jianweie code
2023-08-04 21:14:56 +08:00
parent ef6e5a9057
commit ea000229d9
4 changed files with 12 additions and 4 deletions

View File

@@ -122,7 +122,7 @@
<view class="coreshop-margin-top-10 coreshop-bg-white coreshop-padding-left-10 coreshop-padding-right-10 coreshop-padding-bottom-10" v-if="goodsComments.length"> <view class="coreshop-margin-top-10 coreshop-bg-white coreshop-padding-left-10 coreshop-padding-right-10 coreshop-padding-bottom-10" v-if="goodsComments.length">
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-padding-top-10 coreshop-flex-direction-row"> <view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-padding-top-10 coreshop-flex-direction-row">
<view class="coreshop-basis-2"> <view class="coreshop-basis-2">
<text class="coreshop-text-black coreshop-font-md">评价{{goodsComments.length}}</text> <text class="coreshop-text-black coreshop-font-md">评价{{commentsCount}}</text>
</view> </view>
<view class="coreshop-basis-7"></view> <view class="coreshop-basis-7"></view>
<view class="coreshop-basis-1"> <view class="coreshop-basis-1">
@@ -404,6 +404,7 @@
product: {}, // 规格详情 product: {}, // 规格详情
goodsParams: [], // 商品参数信息 goodsParams: [], // 商品参数信息
goodsComments: [], // 商品评论信息 goodsComments: [], // 商品评论信息
commentsCount: 0, // 商品评论信息
shopRecommendData: [], // 本店推荐数据 shopRecommendData: [], // 本店推荐数据
type: 2, type: 2,
cartType: this.$globalConstVars.paymentType.group, cartType: this.$globalConstVars.paymentType.group,
@@ -711,6 +712,7 @@
this.$u.api.goodsComment(data).then(res => { this.$u.api.goodsComment(data).then(res => {
if (res.status == true) { if (res.status == true) {
let _list = res.data.list; let _list = res.data.list;
this.commentsCount = res.data.commentsCount;
// 如果评论没有图片 在这块作处理否则控制台报错 // 如果评论没有图片 在这块作处理否则控制台报错
_list.forEach(item => { _list.forEach(item => {
if (!item.hasOwnProperty('images')) { if (!item.hasOwnProperty('images')) {

View File

@@ -204,7 +204,7 @@
<view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-padding-8 coreshop-border-radius-9 coreshop-bg-white"> <view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-padding-8 coreshop-border-radius-9 coreshop-bg-white">
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row"> <view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row">
<view class="coreshop-basis-3"> <view class="coreshop-basis-3">
<text class="coreshop-text-black coreshop-font-weight-bold coreshop-font-15">评价{{goodsComments.length}}</text> <text class="coreshop-text-black coreshop-font-weight-bold coreshop-font-15">评价{{commentsCount}}</text>
</view> </view>
<view class="coreshop-basis-3"></view> <view class="coreshop-basis-3"></view>
<view class="coreshop-basis-4"> <view class="coreshop-basis-4">
@@ -537,6 +537,7 @@
shopRecommendData: [], // 本店推荐数据 shopRecommendData: [], // 本店推荐数据
goodsParams: [], // 商品参数信息 goodsParams: [], // 商品参数信息
goodsComments: [], // 商品评论信息 goodsComments: [], // 商品评论信息
commentsCount: 0, // 商品评论信息
pinTuanType: 2, // 1单独购买 2拼团 pinTuanType: 2, // 1单独购买 2拼团
type: 2, type: 2,
cartType: this.$globalConstVars.paymentType.pinTuan, cartType: this.$globalConstVars.paymentType.pinTuan,
@@ -929,6 +930,7 @@
this.$u.api.goodsComment(data).then(res => { this.$u.api.goodsComment(data).then(res => {
if (res.status == true) { if (res.status == true) {
let _list = res.data.list; let _list = res.data.list;
this.commentsCount = res.data.commentsCount;
// 如果评论没有图片 在这块作处理否则控制台报错 // 如果评论没有图片 在这块作处理否则控制台报错
_list.forEach(item => { _list.forEach(item => {
if (!item.hasOwnProperty('images')) { if (!item.hasOwnProperty('images')) {

View File

@@ -122,7 +122,7 @@
<view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-padding-8 coreshop-border-radius-9 coreshop-bg-white"> <view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-padding-8 coreshop-border-radius-9 coreshop-bg-white">
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row"> <view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row">
<view class="coreshop-basis-3"> <view class="coreshop-basis-3">
<text class="coreshop-text-black coreshop-font-weight-bold coreshop-font-15">评价{{goodsComments.length}}</text> <text class="coreshop-text-black coreshop-font-weight-bold coreshop-font-15">评价{{commentsCount}}</text>
</view> </view>
<view class="coreshop-basis-3"></view> <view class="coreshop-basis-3"></view>
<view class="coreshop-basis-4"> <view class="coreshop-basis-4">
@@ -408,6 +408,7 @@
product: {}, // 规格详情 product: {}, // 规格详情
goodsParams: [], // 商品参数信息 goodsParams: [], // 商品参数信息
goodsComments: [], // 商品评论信息 goodsComments: [], // 商品评论信息
commentsCount: 0, // 商品评论信息
shopRecommendData: [], // 本店推荐数据 shopRecommendData: [], // 本店推荐数据
type: 2, type: 2,
cartType: this.$globalConstVars.paymentType.seckill, cartType: this.$globalConstVars.paymentType.seckill,
@@ -716,6 +717,7 @@
this.$u.api.goodsComment(data).then(res => { this.$u.api.goodsComment(data).then(res => {
if (res.status == true) { if (res.status == true) {
let _list = res.data.list; let _list = res.data.list;
this.commentsCount = res.data.commentsCount;
// 如果评论没有图片 在这块作处理否则控制台报错 // 如果评论没有图片 在这块作处理否则控制台报错
_list.forEach(item => { _list.forEach(item => {
if (!item.hasOwnProperty('images')) { if (!item.hasOwnProperty('images')) {

View File

@@ -181,7 +181,7 @@
<view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-padding-8 coreshop-border-radius-9 coreshop-bg-white"> <view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-padding-8 coreshop-border-radius-9 coreshop-bg-white">
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row"> <view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row">
<view class="coreshop-basis-3"> <view class="coreshop-basis-3">
<text class="coreshop-text-black coreshop-font-weight-bold coreshop-font-15">评价{{goodsComments.length}}</text> <text class="coreshop-text-black coreshop-font-weight-bold coreshop-font-15">评价{{commentsCount}}</text>
</view> </view>
<view class="coreshop-basis-3"></view> <view class="coreshop-basis-3"></view>
<view class="coreshop-basis-4"> <view class="coreshop-basis-4">
@@ -477,6 +477,7 @@
shopRecommendData: [], // 本店推荐数据 shopRecommendData: [], // 本店推荐数据
goodsParams: [], // 商品参数信息 goodsParams: [], // 商品参数信息
goodsComments: [], // 商品评论信息 goodsComments: [], // 商品评论信息
commentsCount: 0, // 商品评论信息
type: 2, // 1加入购物车 2购买 type: 2, // 1加入购物车 2购买
cartType: this.$globalConstVars.paymentType.common, cartType: this.$globalConstVars.paymentType.common,
isfav: false, // 商品是否收藏 isfav: false, // 商品是否收藏
@@ -909,6 +910,7 @@
this.$u.api.goodsComment(data).then(res => { this.$u.api.goodsComment(data).then(res => {
if (res.status == true) { if (res.status == true) {
let _list = res.data.list; let _list = res.data.list;
this.commentsCount = res.data.commentsCount;
// 如果评论没有图片 在这块作处理否则控制台报错 // 如果评论没有图片 在这块作处理否则控制台报错
_list.forEach(item => { _list.forEach(item => {
if (!item.hasOwnProperty('images')) { if (!item.hasOwnProperty('images')) {