index.vue
11.7 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
390
391
392
393
394
395
<template>
<div class="liveRoomPage">
<nav>
<el-form :inline="true" :model="listQuery" class="demo-form-inline">
<el-form-item label="状态:" label-width="100px">
<el-radio-group v-model="listQuery.state" @change="searchTypeChange">
<el-radio-button
v-for="item in searchType"
:key="item.value"
:label="item.value"
>
{{ item.label }}
</el-radio-button>
</el-radio-group>
</el-form-item>
<br>
<el-form-item label="关键字:" label-width="100px">
<el-input
v-model="listQuery.search"
placeholder="请输入直播间名称/ID/主播昵称/微信号"
class="inputKeyWord"
style="width:400px;"
>
<el-button slot="append" icon="el-icon-search" @click="getList" />
</el-input>
</el-form-item>
</el-form>
</nav>
<section>
<el-table
ref="multipleTable"
:data="roomList"
border
:header-cell-style="{ background: '#EEF3FF', color: '#333333' }"
tooltip-effect="dark"
style="width: 100%"
>
<el-table-column prop="id" label="直播间id" />
<el-table-column prop="title" label="直播间标题" />
<el-table-column prop="anchorNickname" label="主播昵称" />
<el-table-column prop="anchorWechat" label="主播微信号" />
<el-table-column prop="startTime" label="直播开始时间" />
<el-table-column prop="endTime" label="预计结束时间" />
<el-table-column prop="createTime" label="创建时间" />
<el-table-column label="审核状态" width="100">
<template slot-scope="scope">
<el-tag v-if="scope.row.state == 0" type="warning">
待审核
</el-tag>
<el-tag v-if="scope.row.state == 1" type="success">
已通过
</el-tag>
<el-tag v-if="scope.row.state == 2" type="danger">
未通过
</el-tag>
</template>
</el-table-column>
<!-- <el-table-column prop="createTime" label="直播回放">
<template slot-scope="scope">
<el-switch
v-model="scope.row.reply"
active-text="开"
active-color="#13ce66"
inactive-text="关"
inactive-color="#ff4949"
/>
</template>
</el-table-column> -->
<el-table-column label="操作" show-overflow-tooltip>
<template slot-scope="scope">
<div class="btnList">
<el-button
v-if="scope.row.state == 0"
type="text"
@click="audit(scope.row)"
>审核</el-button>
<el-button
type="text"
@click="seeMore(scope.row)"
>详情</el-button>
</div>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination
:current-page="listQuery.page"
:page-sizes="[10, 20, 50, 100]"
:page-size="10"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</section>
<el-dialog
:title="'直播间信息'"
:visible.sync="DetailsLiveShow"
width="50%"
center
:close-on-click-modal="false"
>
<el-row>
<el-col :span="12">
<el-form :model="liveForm" size="mini" label-width="180px">
<el-form-item label="直播间标题:">
{{ liveForm.title }}
</el-form-item>
<el-form-item label="直播间id:">
{{ liveForm.id }}
</el-form-item>
<el-form-item label="直播间开始时间:">
{{ liveForm.startTime }}
</el-form-item>
<el-form-item label="背景图:">
<img :src="liveForm.coverImg" alt="" srcset="">
</el-form-item>
<el-form-item label="直播间类型:">
{{ liveForm.liveType == 1 ? "推流" : "手机" }}
</el-form-item>
<el-form-item label="是否开启点赞:">
{{ liveForm.closeLike == 0 ? "是" : "否" }}
</el-form-item>
<el-form-item label="是否开启评论:">
{{ liveForm.closeComment == 0 ? "是" : "否" }}
</el-form-item>
</el-form>
</el-col>
<el-col :span="12">
<el-form :model="liveForm" size="mini" label-width="180px">
<el-form-item label="主播微信号:">
{{ liveForm.anchorWechat }}
</el-form-item>
<el-form-item label="主播昵称:">
{{ liveForm.anchorNickname }}
</el-form-item>
<el-form-item label="直播间结束时间:">
{{ liveForm.endTime }}
</el-form-item>
<el-form-item label="分享图:">
<img :src="liveForm.shareImg" alt="" srcset="">
</el-form-item>
<el-form-item label="是否开启回放:">
{{ liveForm.closePlayback == 0 ? "是" : "否" }}
</el-form-item>
<el-form-item label="是否开启预约:">
{{ liveForm.closeAppointment == 0 ? "是" : "否" }}
</el-form-item>
</el-form>
</el-col>
</el-row>
<div>
<el-table
ref="multipleTable"
:data="roomProList"
border
:header-cell-style="{ background: '#EEF3FF', color: '#333333' }"
tooltip-effect="dark"
style="width: 100%"
>
<el-table-column prop="productId" label="商品ID" />
<el-table-column prop="productImage" label="商品图片">
<template slot-scope="scope">
<img
style="width: 40px; height: 40px"
:src="scope.row.productImage"
alt=""
>
</template>
</el-table-column>
<el-table-column prop="productName" label="商品名称" />
<el-table-column prop="stockNumber" label="库存" />
<el-table-column prop="fixedPrice" label="价格">
<template slot-scope="scope">
<span v-if="scope.row.priceType == 1">
一口价: {{ scope.row.fixedPrice }}
</span>
<span v-if="scope.row.priceType == 2">
最低价:{{ scope.row.minPrice }} <br> 最高价:{{ scope.row.maxPrice }}
</span>
<span v-if="scope.row.priceType == 3">
现价: {{ scope.row.marketPrice }}
</span>
</template>
</el-table-column>
<el-table-column prop="saleNumber" label="销售数量" />
<el-table-column prop="saleAmount" label="销售金额" />
</el-table>
<el-pagination
style="margin-top: 20px"
:current-page="proListQuery.page"
:page-sizes="[10, 20, 50, 100]"
:page-size="10"
layout="total, sizes, prev, pager, next, jumper"
:total="proTotal"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"
/>
</div>
<div v-if="liveForm.remark" style="text-align: center; margin-top: 20px">
<span style="color: red">备注:</span>
{{ liveForm.remark }}
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="closeFn">关 闭</el-button>
</span>
</el-dialog>
<!-- 审核 -->
<el-dialog
:title="'审核'"
:visible.sync="auditShow"
width="30%"
center
:close-on-click-modal="false"
>
<el-form :model="auditForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="审核状态">
<el-radio-group v-model="auditFormState">
<el-radio :label="1">通过</el-radio>
<el-radio :label="2">未通过</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="auditFormState == 2" label="理由">
<el-input
v-model="auditForm.remark"
placeholder="请输入内容"
/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="auditShow = false">取 消</el-button>
<el-button type="prime" @click="submint">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {
liveGetList,
// liveGetById,
livePutAudit,
liveGetProduct,
} from '@/api/live';
export default {
data () {
return {
searchType: [
{
label: '全部',
value: null,
},
{
label: '待审核',
value: 0,
},
{
label: '审核已通过',
value: 1,
},
{
label: '审核未通过',
value: 2,
},
],
listQuery: {
state: null,
search: '',
page: 0,
pageSize: 10,
shopId: null,
},
proListQuery: {
liveId: null,
page: 0,
pageSize: 10,
shopId: null,
},
roomList: [], // 直播间列表
roomProList: [], // 直播相关产品列表
total: 0,
proTotal: 0,
DetailsLiveShow: false,
activeName: 'first',
disabled: false,
liveForm: {}, // 添加直播间
liveRules: [], // 直播间添加验证
rules: [],
auditShow: false,
auditForm: {},
auditFormState: 1,
};
},
created () {
this.getList();
},
methods: {
// 获取直播间列表
getList () {
liveGetList(this.listQuery).then(res => {
this.total = res.data.total;
this.roomList = res.data.list;
});
},
// 获取直播间相关产品信息
getProList () {
this.proListQuery.shopId = this.liveForm.shopId;
this.proListQuery.liveId = this.liveForm.id;
liveGetProduct(this.proListQuery).then(res => {
console.log(res);
this.roomProList = res.data.list;
this.proTotal = res.data.total;
});
},
audit (row) {
const item = Object.assign({}, row)
this.auditForm = item;
this.auditShow = true;
},
submint () {
this.auditForm.state = this.auditFormState;
livePutAudit(this.auditForm).then(res => {
this.$message.success('状态审核成功');
this.auditShow = false;
this.getList();
});
},
seeMore (row) {
this.liveForm = row;
this.DetailsLiveShow = true;
this.getProList();
},
// 选择查询状态
searchTypeChange (e) {
this.listQuery.state = e;
this.getList();
},
// 分页
handleCurrentChange (e) {
this.listQuery.page = e;
this.getList();
},
handleSizeChange (e) {
this.listQuery.pageSize = e;
this.getList();
},
handleCurrentChange1 (e) {
this.proListQuery.page = e;
this.getList();
},
handleSizeChange1 (e) {
this.proListQuery.pageSize = e;
this.getList();
},
closeFn () {
this.DetailsLiveShow = false;
},
},
};
</script>
<style lang="scss" scpoed>
// img {
// width: 100px;
// height: 100px;
// }
.liveRoomPage {
padding: 32px 20px;
nav {
.search {
line-height: 40px;
margin: 10px 0;
display: flex;
.title {
min-width: 120px;
text-align: right;
}
.inputKeyWord {
max-width: 400px;
min-width: 200px;
}
}
}
section {
padding: 12px 8px;
background-color: #fff;
.pagination {
margin-top: 30px;
}
}
}
</style>