Parcourir la source

商户后台-商品评论-增加展示图片

sunxiaobiao il y a 1 an
Parent
commit
953658f659
1 fichiers modifiés avec 300 ajouts et 274 suppressions
  1. 300 274
      src/views/product/Reviews/index.vue

+ 300 - 274
src/views/product/Reviews/index.vue

@@ -1,287 +1,313 @@
1 1
 <template>
2
-  <div class="divBox">
3
-    <el-card class="box-card">
4
-      <div slot="header" class="clearfix">
5
-        <div class="container">
6
-          <el-form size="small" label-width="100px">
7
-            <span class="seachTiele">时间选择:</span>
8
-            <el-radio-group
9
-              v-model="tableFrom.date"
10
-              type="button"
11
-              class="mr20"
12
-              size="small"
13
-              @change="selectChange(tableFrom.date)"
2
+    <div class="divBox">
3
+        <el-card class="box-card">
4
+            <div slot="header" class="clearfix">
5
+                <div class="container">
6
+                    <el-form size="small" label-width="100px">
7
+                        <span class="seachTiele">时间选择:</span>
8
+                        <el-radio-group
9
+                                v-model="tableFrom.date"
10
+                                type="button"
11
+                                class="mr20"
12
+                                size="small"
13
+                                @change="selectChange(tableFrom.date)"
14
+                        >
15
+                            <el-radio-button
16
+                                    v-for="(item,i) in fromList.fromTxt"
17
+                                    :key="i"
18
+                                    :label="item.val"
19
+                            >{{ item.text }}
20
+                            </el-radio-button>
21
+                        </el-radio-group>
22
+                        <el-date-picker
23
+                                v-model="timeVal"
24
+                                value-format="yyyy/MM/dd"
25
+                                format="yyyy/MM/dd"
26
+                                size="small"
27
+                                type="daterange"
28
+                                placement="bottom-end"
29
+                                placeholder="自定义时间"
30
+                                style="width: 250px;"
31
+                                @change="onchangeTime"
32
+                        />
33
+                        <div class="mt20">
34
+                            <span class="seachTiele">评价分类:</span>
35
+                            <el-select
36
+                                    v-model="tableFrom.is_reply"
37
+                                    placeholder="请选择"
38
+                                    class="filter-item selWidth mr20"
39
+                                    @change="getList"
40
+                            >
41
+                                <el-option
42
+                                        v-for="item in evaluationStatusList"
43
+                                        :key="item.value"
44
+                                        :label="item.label"
45
+                                        :value="item.value"
46
+                                />
47
+                            </el-select>
48
+                            <span class="seachTiele">商品信息:</span>
49
+                            <el-input
50
+                                    v-model="tableFrom.keyword"
51
+                                    placeholder="请输入商品ID或者商品信息"
52
+                                    class="selWidth mr20"
53
+                            />
54
+                            <span class="seachTiele">用户名称:</span>
55
+                            <el-input v-model="tableFrom.nickname" placeholder="请输入用户名称" class="selWidth mr20"/>
56
+                            <el-button size="small" type="primary" icon="el-icon-search" @click="getList">搜索</el-button>
57
+                        </div>
58
+                    </el-form>
59
+                </div>
60
+            </div>
61
+            <el-table
62
+                    v-loading="listLoading"
63
+                    :data="tableData.data"
64
+                    style="width: 100%"
65
+                    size="mini"
14 66
             >
15
-              <el-radio-button
16
-                v-for="(item,i) in fromList.fromTxt"
17
-                :key="i"
18
-                :label="item.val"
19
-              >{{ item.text }}</el-radio-button>
20
-            </el-radio-group>
21
-            <el-date-picker
22
-              v-model="timeVal"
23
-              value-format="yyyy/MM/dd"
24
-              format="yyyy/MM/dd"
25
-              size="small"
26
-              type="daterange"
27
-              placement="bottom-end"
28
-              placeholder="自定义时间"
29
-              style="width: 250px;"
30
-              @change="onchangeTime"
31
-            />
32
-            <div class="mt20">
33
-              <span class="seachTiele">评价分类:</span>
34
-              <el-select
35
-                v-model="tableFrom.is_reply"
36
-                placeholder="请选择"
37
-                class="filter-item selWidth mr20"
38
-                @change="getList"
39
-              >
40
-                <el-option
41
-                  v-for="item in evaluationStatusList"
42
-                  :key="item.value"
43
-                  :label="item.label"
44
-                  :value="item.value"
67
+                <el-table-column
68
+                        prop="product_id"
69
+                        label="商品ID"
70
+                        min-width="50"
71
+                />
72
+                <el-table-column label="商品信息" min-width="180">
73
+                    <template slot-scope="scope">
74
+                        <div class="demo-image__preview">
75
+                            <el-image referrerpolicy='no-referrer'
76
+                                      :src="scope.row.image"
77
+                                      :preview-src-list="[scope.row.image]"
78
+                            />
79
+                            <span class="maxw180">{{ scope.row.store_name }}</span>
80
+                            <!-- <span>春季牛仔女士短外套女春秋装女装2019新款春款2020年新品网红衣服</span> -->
81
+                        </div>
82
+                    </template>
83
+                </el-table-column>
84
+                <el-table-column
85
+                        prop="nickname"
86
+                        label="用户名称"
87
+                        min-width="80"
88
+                />
89
+                <el-table-column
90
+                        prop="product_score"
91
+                        label="产品评分"
92
+                        min-width="50"
93
+                        sortable
94
+                />
95
+                <el-table-column
96
+                        prop="service_score"
97
+                        label="服务评分"
98
+                        min-width="50"
99
+                        sortable
100
+                />
101
+                <el-table-column
102
+                        prop="postage_score"
103
+                        label="物流评分"
104
+                        min-width="50"
105
+                        sortable
106
+                />
107
+                <el-table-column
108
+                        prop="comment"
109
+                        label="	评价内容"
110
+                        min-width="90"
111
+                />
112
+                <el-table-column
113
+                        label="评论图片"
114
+                        min-width="150"
115
+                >
116
+                    <template slot-scope="scope">
117
+                        <div v-if="scope.row.pics && scope.row.pics.length > 0">
118
+                            <el-image
119
+                                    v-for="(picUrl, index) in scope.row.pics"
120
+                                    :key="index"
121
+                                    :src="picUrl"
122
+                                    referrerpolicy="no-referrer"
123
+                                    :preview-src-list="scope.row.pics"
124
+                                    style="width: 50px; height: 50px; margin-right: 4px; object-fit: cover; cursor: pointer;"
125
+                            />
126
+                        </div>
127
+                        <span v-else>-</span> <!-- 如果没有图片,显示短横线 -->
128
+                    </template>
129
+                </el-table-column>
130
+                <el-table-column
131
+                        prop="merchant_reply_content"
132
+                        label="回复内容"
133
+                        min-width="100"
134
+                />
135
+                <el-table-column
136
+                        prop="create_time"
137
+                        label="评价时间"
138
+                        min-width="100"
139
+                        sortable
140
+                />
141
+                <el-table-column label="操作" min-width="80" fixed="right">
142
+                    <template slot-scope="scope">
143
+                        <el-button type="text" size="small" @click="handleReply(scope.row.reply_id)">回复</el-button>
144
+                    </template>
145
+                </el-table-column>
146
+            </el-table>
147
+            <div class="block">
148
+                <el-pagination
149
+                        :page-sizes="[20, 40, 60, 80]"
150
+                        :page-size="tableFrom.limit"
151
+                        :current-page="tableFrom.page"
152
+                        layout="total, sizes, prev, pager, next, jumper"
153
+                        :total="tableData.total"
154
+                        @size-change="handleSizeChange"
155
+                        @current-change="pageChange"
45 156
                 />
46
-              </el-select>
47
-              <span class="seachTiele">商品信息:</span>
48
-              <el-input
49
-                v-model="tableFrom.keyword"
50
-                placeholder="请输入商品ID或者商品信息"
51
-                class="selWidth mr20"
52
-              />
53
-              <span class="seachTiele">用户名称:</span>
54
-              <el-input v-model="tableFrom.nickname" placeholder="请输入用户名称" class="selWidth mr20" />
55
-              <el-button size="small" type="primary" icon="el-icon-search" @click="getList">搜索</el-button>
56
-            </div>
57
-          </el-form>
58
-        </div>
59
-      </div>
60
-      <el-table
61
-        v-loading="listLoading"
62
-        :data="tableData.data"
63
-        style="width: 100%"
64
-        size="mini"
65
-      >
66
-        <el-table-column
67
-          prop="product_id"
68
-          label="商品ID"
69
-          min-width="50"
70
-        />
71
-        <el-table-column label="商品信息" min-width="180">
72
-          <template slot-scope="scope">
73
-            <div class="demo-image__preview">
74
-              <el-image  referrerpolicy='no-referrer' 
75
-                :src="scope.row.image"
76
-                :preview-src-list="[scope.row.image]"
77
-              />
78
-              <span class="maxw180">{{ scope.row.store_name }}</span>
79
-              <!-- <span>春季牛仔女士短外套女春秋装女装2019新款春款2020年新品网红衣服</span> -->
80 157
             </div>
81
-          </template>
82
-        </el-table-column>
83
-        <el-table-column
84
-          prop="nickname"
85
-          label="用户名称"
86
-          min-width="80"
87
-        />
88
-        <el-table-column
89
-          prop="product_score"
90
-          label="产品评分"
91
-          min-width="50"
92
-          sortable
93
-        />
94
-        <el-table-column
95
-          prop="service_score"
96
-          label="服务评分"
97
-          min-width="50"
98
-          sortable
99
-        />
100
-        <el-table-column
101
-          prop="postage_score"
102
-          label="物流评分"
103
-          min-width="50"
104
-          sortable
105
-        />
106
-        <el-table-column
107
-          prop="comment"
108
-          label="	评价内容"
109
-          min-width="90"
110
-        />
111
-        <el-table-column
112
-          prop="merchant_reply_content"
113
-          label="回复内容"
114
-          min-width="100"
115
-        />
116
-        <el-table-column
117
-          prop="create_time"
118
-          label="评价时间"
119
-          min-width="100"
120
-          sortable
121
-        />
122
-        <el-table-column label="操作" min-width="80" fixed="right">
123
-          <template slot-scope="scope">
124
-            <el-button type="text" size="small" @click="handleReply(scope.row.reply_id)">回复</el-button>
125
-          </template>
126
-        </el-table-column>
127
-      </el-table>
128
-      <div class="block">
129
-        <el-pagination
130
-          :page-sizes="[20, 40, 60, 80]"
131
-          :page-size="tableFrom.limit"
132
-          :current-page="tableFrom.page"
133
-          layout="total, sizes, prev, pager, next, jumper"
134
-          :total="tableData.total"
135
-          @size-change="handleSizeChange"
136
-          @current-change="pageChange"
137
-        />
138
-      </div>
139
-    </el-card>
140
-    <!--详情-->
141
-  </div>
158
+        </el-card>
159
+        <!--详情-->
160
+    </div>
142 161
 </template>
143 162
 
144 163
 <script>
145
-import { reviewLstApi, reviewReplyApi } from '@/api/product'
164
+    import {reviewLstApi, reviewReplyApi} from '@/api/product'
146 165
 
147
-export default {
148
-  data() {
149
-    return {
150
-      tableData: {
151
-        data: [],
152
-        total: 0
153
-      },
154
-      listLoading: true,
155
-      tableFrom: {
156
-        is_reply: '',
157
-        nickname: '',
158
-        keyword: '',
159
-        order_sn: '',
160
-        status: '',
161
-        date: '',
162
-        page: 1,
163
-        limit: 20
164
-      },
165
-      timeVal: [],
166
-      fromList: {
167
-        title: '选择时间',
168
-        custom: true,
169
-        fromTxt: [
170
-          { text: '全部', val: '' },
171
-          { text: '今天', val: 'today' },
172
-          { text: '昨天', val: 'yesterday' },
173
-          { text: '最近7天', val: 'lately7' },
174
-          { text: '最近30天', val: 'lately30' },
175
-          { text: '本月', val: 'month' },
176
-          { text: '本年', val: 'year' }
177
-        ]
178
-      },
179
-      selectionList: [],
180
-      ids: '',
181
-      tableFromLog: {
182
-        page: 1,
183
-        limit: 10
184
-      },
185
-      tableDataLog: {
186
-        data: [],
187
-        total: 0
188
-      },
189
-      LogLoading: false,
190
-      dialogVisible: false,
191
-      evaluationStatusList: [
192
-        { value: 1, label: '已回复' },
193
-        { value: 0, label: '未回复' }
194
-      ],
195
-      orderDatalist: null
166
+    export default {
167
+        data() {
168
+            return {
169
+                tableData: {
170
+                    data: [],
171
+                    total: 0
172
+                },
173
+                listLoading: true,
174
+                tableFrom: {
175
+                    is_reply: '',
176
+                    nickname: '',
177
+                    keyword: '',
178
+                    order_sn: '',
179
+                    status: '',
180
+                    date: '',
181
+                    page: 1,
182
+                    limit: 20
183
+                },
184
+                timeVal: [],
185
+                fromList: {
186
+                    title: '选择时间',
187
+                    custom: true,
188
+                    fromTxt: [
189
+                        {text: '全部', val: ''},
190
+                        {text: '今天', val: 'today'},
191
+                        {text: '昨天', val: 'yesterday'},
192
+                        {text: '最近7天', val: 'lately7'},
193
+                        {text: '最近30天', val: 'lately30'},
194
+                        {text: '本月', val: 'month'},
195
+                        {text: '本年', val: 'year'}
196
+                    ]
197
+                },
198
+                selectionList: [],
199
+                ids: '',
200
+                tableFromLog: {
201
+                    page: 1,
202
+                    limit: 10
203
+                },
204
+                tableDataLog: {
205
+                    data: [],
206
+                    total: 0
207
+                },
208
+                LogLoading: false,
209
+                dialogVisible: false,
210
+                evaluationStatusList: [
211
+                    {value: 1, label: '已回复'},
212
+                    {value: 0, label: '未回复'}
213
+                ],
214
+                orderDatalist: null
215
+            }
216
+        },
217
+        mounted() {
218
+            this.getList()
219
+        },
220
+        methods: {
221
+            // 回复
222
+            handleReply(id) {
223
+                this.$modalForm(reviewReplyApi(id)).then(() => this.getList())
224
+            },
225
+            handleSelectionChange(val) {
226
+                this.selectionList = val
227
+                const data = []
228
+                this.selectionList.map(item => {
229
+                    data.push(item.id)
230
+                })
231
+                this.ids = data.join(',')
232
+            },
233
+            // 选择时间
234
+            selectChange(tab) {
235
+                this.tableFrom.date = tab
236
+                this.timeVal = []
237
+                this.getList()
238
+            },
239
+            // 具体日期
240
+            onchangeTime(e) {
241
+                this.timeVal = e
242
+                this.tableFrom.date = e ? this.timeVal.join('-') : ''
243
+                this.getList()
244
+            },
245
+            // 列表
246
+            getList() {
247
+                this.listLoading = true
248
+                reviewLstApi(this.tableFrom)
249
+                    .then(res => {
250
+                        this.tableData.data = res.data.list
251
+                        this.tableData.total = res.data.count
252
+                        this.listLoading = false
253
+                    })
254
+                    .catch(res => {
255
+                        this.$message.error(res.message)
256
+                        this.listLoading = false
257
+                    })
258
+            },
259
+            pageChange(page) {
260
+                this.tableFrom.page = page
261
+                this.getList()
262
+            },
263
+            handleSizeChange(val) {
264
+                this.tableFrom.limit = val
265
+                this.getList()
266
+            }
267
+        }
196 268
     }
197
-  },
198
-  mounted() {
199
-    this.getList()
200
-  },
201
-  methods: {
202
-    // 回复
203
-    handleReply(id) {
204
-      this.$modalForm(reviewReplyApi(id)).then(() => this.getList())
205
-    },
206
-    handleSelectionChange(val) {
207
-      this.selectionList = val
208
-      const data = []
209
-      this.selectionList.map(item => {
210
-        data.push(item.id)
211
-      })
212
-      this.ids = data.join(',')
213
-    },
214
-    // 选择时间
215
-    selectChange(tab) {
216
-      this.tableFrom.date = tab
217
-      this.timeVal = []
218
-      this.getList()
219
-    },
220
-    // 具体日期
221
-    onchangeTime(e) {
222
-      this.timeVal = e
223
-      this.tableFrom.date = e ? this.timeVal.join('-') : ''
224
-      this.getList()
225
-    },
226
-    // 列表
227
-    getList() {
228
-      this.listLoading = true
229
-      reviewLstApi(this.tableFrom)
230
-        .then(res => {
231
-          this.tableData.data = res.data.list
232
-          this.tableData.total = res.data.count
233
-          this.listLoading = false
234
-        })
235
-        .catch(res => {
236
-          this.$message.error(res.message)
237
-          this.listLoading = false
238
-        })
239
-    },
240
-    pageChange(page) {
241
-      this.tableFrom.page = page
242
-      this.getList()
243
-    },
244
-    handleSizeChange(val) {
245
-      this.tableFrom.limit = val
246
-      this.getList()
247
-    }
248
-  }
249
-}
250 269
 </script>
251 270
 
252 271
 <style lang="scss" scoped>
253
-.selWidth {
254
-  width: 300px;
255
-}
256
-.el-dropdown-link {
257
-  cursor: pointer;
258
-  color: #409eff;
259
-  font-size: 12px;
260
-}
261
-.el-icon-arrow-down {
262
-  font-size: 12px;
263
-}
264
-.tabBox_tit {
265
-  width: 60%;
266
-  font-size: 12px !important;
267
-  margin: 0 2px 0 10px;
268
-  letter-spacing: 1px;
269
-  padding: 5px 0;
270
-  box-sizing: border-box;
271
-}
272
-.mt20 {
273
-  margin-top: 20px;
274
-}
275
-.demo-image__preview{
276
-  position: relative;
277
-  padding-left: 40px;
278
-}
279
-.demo-image__preview .el-image, .el-image__error{
280
-  position: absolute;
281
-  left: 0;
282
-}
283
-.maxw180{
284
-  display: inline-block;
285
-  max-width: 180px;
286
-}
272
+    .selWidth {
273
+        width: 300px;
274
+    }
275
+
276
+    .el-dropdown-link {
277
+        cursor: pointer;
278
+        color: #409eff;
279
+        font-size: 12px;
280
+    }
281
+
282
+    .el-icon-arrow-down {
283
+        font-size: 12px;
284
+    }
285
+
286
+    .tabBox_tit {
287
+        width: 60%;
288
+        font-size: 12px !important;
289
+        margin: 0 2px 0 10px;
290
+        letter-spacing: 1px;
291
+        padding: 5px 0;
292
+        box-sizing: border-box;
293
+    }
294
+
295
+    .mt20 {
296
+        margin-top: 20px;
297
+    }
298
+
299
+    .demo-image__preview {
300
+        position: relative;
301
+        padding-left: 40px;
302
+    }
303
+
304
+    .demo-image__preview .el-image, .el-image__error {
305
+        position: absolute;
306
+        left: 0;
307
+    }
308
+
309
+    .maxw180 {
310
+        display: inline-block;
311
+        max-width: 180px;
312
+    }
287 313
 </style>