Blame view

ceres-uniapp-master/pages_category_page1/goodsModule/userEvaluate.vue 13.6 KB
3f535f30   杨鑫   '初始'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  <template>
  	<view class="container">
      <!-- 骨架屏 -->
      <Skeleton
          el-color="#f1f3f4"
          bg-color="#fff"
          :loading="loading"
          :animation="true"
      ></Skeleton>
      <global-loading />
      <view class="u-skeleton">
        <!-- 我的评论 -->
        <view class="evaluateTitle-box flex-row-plus flex-sp-around u-skeleton-fillet">
          <view class="allEvaluate"
                :class="{'evaluateTitle-on' : evaluateTitleFlag == 1}"
                @click="evaluateTitleClick(1)"
          >全部评价({{ myCommentList.total || 0}})</view>
          <view class="centerLine">|</view>
          <view
              :class="{'evaluateTitle-on' : evaluateTitleFlag == 2}"
              @click="evaluateTitleClick(2)"
          >有图({{ myCommentList.imageTotal || 0}})</view>
        </view>
        <view v-if="evaluateTitleFlag == 1" class="mar-top-20">
          <template>
            <view
                class="evaluate-contentbox u-skeleton-fillet"
                v-for="(item, index) in commentVOList"
                :key="index"
                @click="commentDetails(index)"
            >
              <view class="evaluate-content flex-items flex-row flex-sp-between ">
                <view class="flex-items">
3a1f257b   杨鑫   最新
34
                  <image class="user-headSmallImg u-skeleton-circle" v-if="item.headImage" :src="$baseURL+item.headImage"></image>
726bc80b   杨鑫   最新
35
                  <image class="user-headSmallImg u-skeleton-circle" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/images/storeLogo.png" v-else></image>
3f535f30   杨鑫   '初始'
36
37
38
39
40
41
42
43
                  <view class="skuValue u-skeleton-fillet">
                    <label class="fs28" v-if="item.name">{{item.name}}</label>
                    <label class="fs28" v-else>匿名</label>
                    <view class="fs22 font-color-999 mar-top-10">
                      {{item.value}}
                    </view>
                  </view>
                </view>
0e38abb3   杨鑫   '最新'
44
                <!-- <view class="addCommentsBut" v-if="item.addComment == ''" @click.stop="addCommentsClick(index,item)">追加评价</view> -->
3f535f30   杨鑫   '初始'
45
46
47
48
              </view>
              <view class="fs26 pad-topbot-20 u-skeleton-fillet" style="margin-top: 10rpx">{{item.comment}}</view>
              <view class="evaluateImg-box" v-if="item.image">
                <view v-for="(cItem, index) in commentImgData(item.image)" :key="index">
855bef33   杨鑫   '最新版本'
49
                  <image class="evaluate-Img" :src="$baseURL+cItem"></image>
3f535f30   杨鑫   '初始'
50
51
                </view>
              </view>
0e38abb3   杨鑫   '最新'
52
              <!-- <view class="addComments-box flex-column-plus" v-if="item.addComment">
3f535f30   杨鑫   '初始'
53
54
55
56
                <label class="font-color-C5AA7B mar-top-30">用户追评</label>
                <label class="mar-top-20">{{item.addComment}}</label>
                <view class="evaluateImg-box mar-top-20" v-if="item.addImage">
                  <view v-for="(dItem, index) in commentImgData(item.addImage)" :key="index">
855bef33   杨鑫   '最新版本'
57
                    <image class="evaluate-Img" :src="$baseURL+dItem"></image>
3f535f30   杨鑫   '初始'
58
59
                  </view>
                </view>
0e38abb3   杨鑫   '最新'
60
61
              </view> -->
              <!-- <view class="goodsDes-box u-skeleton-fillet flex-column-plus mar-top-30">
3f535f30   杨鑫   '初始'
62
                <view class="flex-row-plus" @click.stop="goGoodsDetails(item.shopId,item.productId,item.skuId)">
0e7a57c2   杨鑫   '最新'
63
                  <image class="goodsDes-img default-img" :src="$baseURL+item.productImage"></image>
3f535f30   杨鑫   '初始'
64
65
66
67
68
69
70
                  <view class="goodsDesText-box">
                    <label class="fs26 goodsDes-text">{{item.productName}}</label>
                    <view class="mar-top-70">
                      <label>¥ {{item.productPrice}}</label>
                    </view>
                  </view>
                </view>
0e38abb3   杨鑫   '最新'
71
72
              </view> -->
              <!-- <view class="flex-items flex-row mar-top-30 flex-sp-between">
3f535f30   杨鑫   '初始'
73
74
                <view class="font-color-999 fs22">{{item.createTime}}</view>
                <view class="praise-box flex-items flex-row">
726bc80b   杨鑫   最新
75
                  <image class="praise-icon" @click.stop="zanTap(index,item.commentId,0)" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/images/praiseActiveIcon.png"
3f535f30   杨鑫   '初始'
76
                         v-if="item.ifLike"></image>
726bc80b   杨鑫   最新
77
                  <image class="praise-icon" @click.stop="zanTap(index,item.commentId,1)" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/images/addPraiseIcon.png"
3f535f30   杨鑫   '初始'
78
79
80
                         v-else></image>
                  <label class="mar-left-10">{{item.likes}}</label>
                </view>
0e38abb3   杨鑫   '最新'
81
              </view> -->
3f535f30   杨鑫   '初始'
82
83
84
            </view>
          </template>
          <view v-if="evaluateEmpty" class="emptyOrder-box flex-items-plus flex-column">
726bc80b   杨鑫   最新
85
            <image class="emptyOrder-img" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/img//bgnull.png"></image>
3f535f30   杨鑫   '初始'
86
87
88
89
90
91
92
93
94
95
96
97
            <label class="font-color-999 fs26 mar-top-30">你还没有评论哦~</label>
          </view>
        </view>
        <view v-if="evaluateTitleFlag == 2" class="mar-top-20">
          <template>
            <view
                class="evaluate-contentbox"
                v-for="(item, index) in commentVOList"
                :key="index"
            >
              <view class="evaluate-content flex-column" @click="commentDetails(index)" >
                <view class="flex-items">
3a1f257b   杨鑫   最新
98
                  <image class="user-headSmallImg" v-if="item.headImage" :src="$baseURL+item.headImage"></image>
726bc80b   杨鑫   最新
99
                  <image class="user-headSmallImg" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/images/storeLogo.png" v-else></image>
3f535f30   杨鑫   '初始'
100
101
102
103
104
105
106
107
108
                  <label class="fs28 mar-left-20" v-if="item.name">{{item.name}}</label>
                  <label class="fs28 mar-left-20" v-else>匿名</label>
                </view>
                <view class="fs22 font-color-999 mar-top-10">
                  {{item.value}}
                </view>
                <view class="fs26 pad-topbot-20">{{item.comment}}</view>
                <view class="evaluateImg-box" v-if="item.image">
                  <view v-for="(cItem, index) in commentImgData(item.image)" :key="index">
855bef33   杨鑫   '最新版本'
109
                    <image class="evaluate-Img" :src="$baseURL+cItem"></image>
3f535f30   杨鑫   '初始'
110
111
                  </view>
                </view>
0e38abb3   杨鑫   '最新'
112
                <!-- <view class="addComments-box flex-column-plus" v-if="item.addComment">
3f535f30   杨鑫   '初始'
113
114
115
116
                  <label class="font-color-C5AA7B mar-top-30">用户追评</label>
                  <label class="mar-top-20">{{item.addComment}}</label>
                  <view class="evaluateImg-box mar-top-20" v-if="item.addImage">
                    <view v-for="(dItem, index) in commentImgData(item.addImage)" :key="index">
855bef33   杨鑫   '最新版本'
117
                      <image class="evaluate-Img" :src="$baseURL+dItem"></image>
3f535f30   杨鑫   '初始'
118
119
                    </view>
                  </view>
0e38abb3   杨鑫   '最新'
120
                </view> -->
3f535f30   杨鑫   '初始'
121
122
123
124
  
                <view class="flex-items flex-row mar-top-30 flex-sp-between">
                  <view class="font-color-999 fs22">{{item.createTime}}</view>
                  <view class="praise-box flex-items flex-row">
726bc80b   杨鑫   最新
125
                    <image class="praise-icon" @click.stop="zanTap(index,item.commentId,0)" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/images/praiseActiveIcon.png"
3f535f30   杨鑫   '初始'
126
                           v-if="item.ifLike"></image>
726bc80b   杨鑫   最新
127
                    <image class="praise-icon" @click.stop="zanTap(index,item.commentId,1)" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/images/praiseIcon.png"
3f535f30   杨鑫   '初始'
128
129
130
131
132
133
134
135
                           v-else></image>
                    <label class="mar-left-10">{{item.likes}}</label>
                  </view>
                </view>
              </view>
            </view>
          </template>
          <view v-if="evaluateEmpty" class="emptyOrder-box flex-items-plus flex-column">
726bc80b   杨鑫   最新
136
            <image class="emptyOrder-img" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/img//bgnull.png"></image>
3f535f30   杨鑫   '初始'
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
            <label class="font-color-999 fs26 mar-top-30">你还没有评论哦~</label>
          </view>
        </view>
      </view>
  	</view>
  </template>
  
  <script>
    import Skeleton from "../../components/Skeleton";
    const NET = require('../../utils/request')
  	const API = require('../../config/api')
  	export default {
      components: {Skeleton},
      data() {
  			return {
          loading:true,
  				evaluateTitleFlag: 1,
  				myCommentList: [],
  				commentVOList: [],
  				state:"",
  				page:1,//当前页
  				pageSize:20,//每页记录数
  				loadingType:0,
  				topLeft: 0,
          evaluateEmpty: false
  			}
  		},
  		onShow(){
  			this.commentVOList = [{
          isLoading:true,
          name:'',
          comment:''
        },{
          isLoading:true,
          name:'',
          comment:''
        },{
          isLoading:true,
          name:'',
          comment:''
        },{
          isLoading:true,
          name:'',
          comment:''
        },{
          isLoading:true,
          name:'',
          comment:''
        }]
3f535f30   杨鑫   '初始'
186
187
  			this.getMyCommentList()
  		},
726bc80b   杨鑫   最新
188
189
  		onLoad() {
  			// this.getMyCommentList()
25e99daf   杨鑫   '最新'
190
  		},
3f535f30   杨鑫   '初始'
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
  		onReachBottom(){
  			if(this.loadingType == 1){
  				uni.stopPullDownRefresh()
  			}else{
  				this.page = this.page+1
  				this.getMyCommentList()
  			}
  		},
  		onBackPress(e) {
  			if (e.from === 'navigateBack') {
  				return false;
  			}
  			this.back();
  			return true;
  		},
  		methods: {
  			goGoodsDetails(shopId,productId,skuId){
  				uni.navigateTo({
  					url:'goodsDetails?shopId='+shopId+'&productId='+productId+'&skuId='+skuId
  				})
  			},
  			back(){
  				uni.switchTab({
  					url:'../../pages/tabbar/user/index'
  				});
  			},
  			commentImgData(imgData) {
726bc80b   杨鑫   最新
218
  				// console.log('现在图片',imgData)
3f535f30   杨鑫   '初始'
219
220
  				let imgDataResult = []
  				imgDataResult = imgData.split(",");
726bc80b   杨鑫   最新
221
222
223
224
225
226
227
228
  				
  				   for (let i = imgDataResult.length - 1; i >= 0; i--) {
  				        const item = imgDataResult[i];
  				        if (item === '' || item === null || item === undefined) {
  				            imgDataResult.splice(i, 1);
  				            break; // 只删除最后一个空数据,找到后跳出循环
  				        }
  				    }
3f535f30   杨鑫   '初始'
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
  				return imgDataResult
  			},
  			evaluateTitleClick(type) {
          this.evaluateEmpty = false
  				if(type == 1){
  					this.state = ''
  				}else{
  					this.state = "1"
  				}
  				this.page = 1
  				this.commentVOList = []
  				this.evaluateTitleFlag = type
  				this.getMyCommentList()
  			},
  			//我的评价列表
  			getMyCommentList() {
          this.$showLoading()
          this.loading = true
  		console.log(this.state)
  				NET.request(API.MyCommentList, {
  					page: this.page,
  					pageSize: this.pageSize,
  					state: this.state
  				}, 'GET').then(res => {
                   uni.hideLoading()
  					if(res.data.page.list.length == 0){
  						this.loadingType = 1
  						this.page = this.page
  					}
  					this.myCommentList = res.data
  					this.commentVOList = this.commentVOList.concat(res.data.page.list)
60d9bf40   杨鑫   '1'
260
  					
726bc80b   杨鑫   最新
261
  					
3f535f30   杨鑫   '初始'
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
            this.commentVOList = this.commentVOList.filter(item=>!item.isLoading)
            if (this.commentVOList.length === 0) {
              this.evaluateEmpty = true
            }
  				}).catch(res => {
            uni.hideLoading()
            uni.showToast({
              title: res.data.message,
              duration: 2000,
              icon: 'none'
            });
  				}).finally(()=>{
            this.loading = false
            this.$hideLoading()
          })
  			},
  			//点赞
  			zanTap(index, likeId, actionType) {
          this.$showLoading()
  				NET.request(API.LikeOrUnLikeComment, {
  					commentId: likeId,
  					ifLike: actionType
  				}, 'POST').then(res => {
  					this.commentVOList[index].ifLike = !this.commentVOList[index].ifLike
  					this.commentVOList[index].likes = this.commentVOList[index].ifLike ? this.commentVOList[index].likes + 1 : this.commentVOList[index].likes - 1
  					// this.commentVOList = []
  					// this.page = 1
  					// this.getMyCommentList()
  				}).catch(res => {
            this.$hideLoading()
  					// uni.hideLoading()
  				})
  			},
  			commentDetails(id) {
  				uni.setStorageSync('commentVOList', this.commentVOList[id]);
  				uni.navigateTo({
  					url: 'evaluateDetails'
  				})
  			},
  			//追加评论
5d752fd3   杨鑫   '最新'
302
303
  			addCommentsClick(id,item) {
  				
3f535f30   杨鑫   '初始'
304
  				uni.setStorageSync('addCommentVOList', this.commentVOList[id]);
5d752fd3   杨鑫   '最新'
305
  				
3f535f30   杨鑫   '初始'
306
  				uni.navigateTo({
5d752fd3   杨鑫   '最新'
307
  					url: `addEvaluate?type=2&detail${JSON.stringify(item)}`
3f535f30   杨鑫   '初始'
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
  				})
  			}
  		}
  	}
  </script>
  
  <style lang="scss" scoped>
  page {
  	background-color: #FFFFFF;
  }
  
  .container {
  	.emptyOrder-box {
  		margin-top: 70upx;
  
  		.emptyOrder-img {
  			margin-top: 45%;
  			width: 113upx;
  			height: 98upx;
  		}
  	}
  
  	.evaluateTitle-box {
  		color: #CCCCCC;
  		margin-top: 26upx;
      border-bottom: 2rpx solid #F3F4F5;
  		.evaluateTitle-on {
  			padding-bottom: 20upx;
  			border-bottom: 4upx solid #C5AA7B;
        color: #333333;
  		}
  	}
  
  	.evaluate-contentbox {
  		display: flex;
  		justify-content: center;
  		flex-direction: column;
  		padding: 30upx 30upx;
      margin: 10rpx 10rpx;
  		background-color: #FFFFFF;
      border-bottom: 2rpx solid #F3F4F5;
  		.evaluate-content {
  			width: 670upx;
  			display: flex;
  			justify-content: space-between;
  			.user-headSmallImg {
  				width: 46upx;
  				height: 46upx;
  				border-radius: 50%;
  			}
        .skuValue {
          text-align: left;
          padding-left: 30rpx;
        }
  		}
  
  		.evaluateImg-box {
  			display: flex;
  			flex-direction: row;
  			flex-wrap: wrap;
  			margin-left: -9upx;
  
  			.evaluate-Img {
  				width: 224upx;
  				height: 224upx;
  				border-radius: 10upx;
  				margin-left: 9upx;
  				margin-top: 9upx;
  			}
  		}
  
  		.goodsDes-box {
  			background-color: #F7F7F7;
  			padding: 20upx 44upx 20upx 20upx;
  
  			.goodsDes-img {
  				width: 180upx;
  				height: 180upx;
  				border-radius: 10upx;
  			}
  
  			.goodsDesText-box {
  				width: 416upx;
  				margin-left: 30upx;
  			}
  
  
  
  			.praise-box {
  				.praise-icon {
  					width: 50upx;
  					height: 50upx;
  				}
  
  			}
  		}
  
  		.addComments-box {
  			border-top: 1upx solid #EEEEEE;
  			margin-top: 35upx;
  		}
  	}
  }
  .praise-icon {
  	width: 50upx;
  	height: 50upx;
  }
  .addCommentsBut {
  	width: 140upx;
  	height: 58upx;
    background: #333333;
  	font-size: 26upx;
  	line-height: 58upx;
  	text-align: center;
  	color: #C5AA7B;
  }
  
  .addCommentsBut1 {
  	width: 140upx;
  	height: 58upx;
  	font-size: 26upx;
    background: #333333;
  	line-height: 58upx;
  	text-align: center;
  }
  </style>