index.vue
11.6 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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
186
187
188
189
190
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
218
219
220
221
222
223
224
225
226
227
228
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
260
261
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
302
303
304
305
306
307
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
<template>
<div style="padding: 10px;background-color:#F2F3F5">
<div class="comment_manage_page">
<div style="height:32px;">
<div style="color:#0006"> <span>评论管理</span> <span style="padding:0 5px;">></span> <span style="color:#000000e6">评论管理</span></div>
</div>
<div class="content">
<el-tabs v-model="formParams.ifSensitive" @tab-click="selectItem">
<el-tab-pane
v-for="(item, index) in tabList"
:key="index"
:label="item.name"
:name="item.id.toString()"
/>
</el-tabs>
<div class="toolbar">
<el-form :inline="true" :model="formParams">
<el-form-item label="商家名称">
<el-input v-model="formParams.shopName" />
</el-form-item>
<el-form-item label="商家编码">
<el-input v-model="formParams.shopCode" />
</el-form-item>
<el-form-item label="商品ID">
<el-input v-model="formParams.productId" />
</el-form-item>
<el-form-item label="关键词">
<el-input v-model="formParams.keyword"/>
</el-form-item>
<el-form-item>
<el-button @click="search" style="background-color: #3F9B6A;color: #fff">查询</el-button>
<el-button @click="clear" class="buttonHover"
style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;" >重置</el-button>
</el-form-item>
</el-form>
</div>
<div class="content_table">
<div class="table">
<el-table :data="tableData"
:header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}"
>
<el-table-column prop="shopName" label="商家名称" />
<el-table-column prop="shopCode" label="商家编码" />
<el-table-column prop="productId" label="商品ID" />
<el-table-column prop="name" label="评论人" />
<el-table-column prop="createTime" label="评论日期" />
<el-table-column label="操作">
<template slot-scope="scope">
<div v-if="Number(formParams.ifSensitive)">
<div @click="details(scope.row)" class="tableBtn greens">查看</div>
</div>
<div v-else>
<div @click="details(scope.row)" class="tableBtn greens">查看</div>
<div
class="tableBtn greens"
@click="handle(scope.row)"
>{{ scope.row.state ? "显示" : "隐藏" }}</div>
<div @click="deletes(scope.row.commentId)" class="tableBtn greens">删除</div>
</div>
</template>
</el-table-column>
</el-table>
<div class="fenye">
<el-pagination
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="10"
background
small
layout="total, sizes, prev, pager, next, jumper"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
</div>
</div>
<!-- ******************************************************弹框开始***************************************************************** -->
<!-- 查看评论弹框 -->
<el-dialog
title="评论详情"
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:before-close="handleClose"
width="60%"
center
>
<div class="pinStyle">
<div class="comment">
<div class="com_left">评论:</div>
<div class="com_right">{{ commentDetails.comment }}</div>
</div>
<div v-if="commentDetails.images.length != 0" class="comment_imgList">
<div class="img_left">图片:</div>
<div class="imgList">
<el-image
v-for="(item,index) in commentDetails.images"
:key="index"
:src="$baseURL+item"
:preview-src-list="commentDetails.images"
/>
</div>
</div>
<div class="line" />
<div v-if="commentDetails.addComment !=''" class="addComment">{{ commentDetails.time }}天后追评</div>
<div class="comment">
<div v-if="commentDetails.addComment !=''" class="com_left">追评:</div>
<div class="com_right">{{ commentDetails.addComment }}</div>
</div>
<div v-if="commentDetails.addImages.length != 0" class="comment_imgList">
<div class="img_left">图片</div>
<div class="imgList">
<el-image
v-for="(item,index) in commentDetails.addImages"
:key="index"
:src="$baseURL+item"
:preview-src-list="commentDetails.addImages"
/>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button v-if="Number(formParams.ifSensitive)" @click="toShow" style="background-color: #3F9B6A;color: #fff">允许展示</el-button>
<el-button v-else @click="noneShow(state)" style="background-color: #3F9B6A;color: #fff">{{ state ? "显示" : "隐藏" }}</el-button>
<el-button class="buttonHover"
style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;" @click="del">删除</el-button>
</span>
</el-dialog>
</div>
</div>
</template>
<script>
import {
commentSysGetall,
commentSysGetById,
commentSysUpdate,
commentSysDelete,
commentAllow
} from '@/api/comment'
export default {
data() {
return {
formParams: {
ifSensitive: '0', // 是否敏感词审核 1-是 0-否
shopName: '', // 商家名称
shopCode: '', // 商家编码
productId: '', // 商品id
keyword: '', // 关键词
page: '1', // 当前页
pageSize: '10' // 每页记录数
},
date: [],
tableData: [],
tabList: [
{ name: '全部评论', id: 0 },
{ name: '敏感评论', id: 1 }
],
total: 1,
currentPage: 1,
dialogVisible: false,
commentDetails: { images: [], addImages: [] },
commentId: '',
state: 0
}
},
created() {
this.getList(this.formParams)
},
methods: {
handleSizeChange(val) {
this.formParams.pageSize = val
this.getList(this.formParams)
},
handleCurrentChange(val) {
this.formParams.page = val
this.getList(this.formParams)
},
selectItem(tab, event) {
this.formParams.ifSensitive = tab.name
console.log(tab.name)
this.getList(this.formParams)
},
// 查询
search() {
this.total = 1
this.formParams.page = 1
this.getList(this.formParams)
},
// 重置
clear() {
this.formParams = {
ifSensitive: '0', // 是否敏感词审核 1-是 0-否
shopName: '', // 商家名称
shopCode: '', // 商家编码
productId: '', // 商品id
keyword: '', // 关键词
page: '1', // 当前页
pageSize: '10' // 每页记录数
}
this.getList(this.formParams)
},
async handle(row) {
if (row.state === 1) {
const res = await commentSysUpdate({
commentId: row.commentId,
state: 0
})
if (res.code === '') {
this.$message.success('显示成功')
this.dialogVisible = false
this.getList(this.formParams)
}
console.log(res)
} else {
const res = await commentSysUpdate({
commentId: row.commentId,
state: 1
})
if (res.code === '') {
this.$message.success('隐藏成功')
this.dialogVisible = false
this.getList(this.formParams)
}
console.log(res)
}
},
// 允许展示
async toShow() {
const res = await commentAllow({
commentId: this.commentId
})
if (res.code === '') {
this.$message.success('成功')
this.dialogVisible = false
}
},
// 隐藏
async noneShow(type) {
const res = await commentSysUpdate({
commentId: this.commentId,
state: type === 0 ? 1 : 0
})
if (res.code === '') {
if (type === 0) {
this.$message.success('隐藏成功')
} else {
this.$message.success('显示成功')
}
this.dialogVisible = false
this.getList(this.formParams)
}
},
// 删除
async del() {
const res = await commentSysDelete({
commentId: this.commentId
})
if (res.code === '') {
this.$message.success('删除成功')
this.dialogVisible = false
this.getList(this.formParams)
}
},
async deletes(id) {
const res = await commentSysDelete({
commentId: id
})
if (res.code === '') {
this.$message.success('删除成功')
this.getList(this.formParams)
}
},
// 详情
async details(row) {
this.state = row.state
this.dialogVisible = true
const res = await commentSysGetById({ commentId: row.commentId })
this.commentId = row.commentId
this.commentDetails = res.data
},
handleClose() {
this.dialogVisible = false
},
// 初始化查询所有数据
async getList(formParams) {
const res = await commentSysGetall(formParams)
this.tableData = res.data.list
this.total = res.data.total
}
}
}
</script>
<style lang='scss' scoped>
@import url("../../../styles/elDialog.scss");
.comment_manage_page {
padding: 20px;
min-height: calc(100vh - 50px - 20px);
background-color:#fff;
}
.pinStyle {
.comment {
margin-bottom: 20px;
display: flex;
align-items: center;
.com_left {
font-size: 20px;
color: #333333;
margin-right: 20px;
}
.com_right {
font-size: 18px;
color: #333333;
}
}
.comment_imgList {
display: flex;
margin-bottom: 20px;
align-items: center;
.img_left {
font-size: 20px;
color: #333333;
margin-right: 20px;
width: 60px;
}
.imgList {
display: flex;
justify-content: flex-start;
align-items: center;
flex-wrap: wrap;
.el-image {
width: 200px;
height: 134px;
border-radius: 4px;
margin-right: 20px;
margin-bottom: 20px;
}
}
}
.line {
width: 890px;
height: 1px;
background: #e0e5eb;
margin: 0 auto;
margin-bottom: 33px;
}
.addComment {
font-size: 20px;
color: #ff7911;
margin-bottom: 20px;
}
}
::v-deep .el-form-item__label{
font-weight: normal;
font-size: 14px;
}
::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active {
background-color: #3F9B6A;
}
.tableBtn {
display: inline-block;
margin-right: 10px;
}
.greens {
color: #3F9B6A ;
}
::v-deep .buttonHover:hover{
color:#3f9b6a !important;
border-color: #c5e1d2 !important;
background-color: #ecf5f0 !important;
outline: none;
}
::v-deep .el-pagination__total {
position: absolute;
left: 10px;
}
</style>