Commit 930c000f by cwq0219

直播间-控制台

1 parent 81dc9689
......@@ -33,4 +33,67 @@ const getLiveRoomInfoApi = params => {
})
}
export { getLiveRoomListApi, insertLiveRoomApi, getLiveRoomInfoApi }
const getControlInfoApi = params => {
params.method = `${defaultPath}get.control`
return http({
url: 'rop-scrm-live/router',
method: 'POST',
data: params,
sign: true
})
}
const getControlImportListApi = params => {
params.method = `${defaultPath}get.import.goods`
return http({
url: 'rop-scrm-live/router',
method: 'POST',
data: params,
sign: true
})
}
const getWaitImportListApi = params => {
params.method = `${defaultPath}get.wait.import.goods`
return http({
url: 'rop-scrm-live/router',
method: 'POST',
data: params,
sign: true
})
}
const importGoodsApi = params => {
params.method = `${defaultPath}import.goods`
return http({
url: 'rop-scrm-live/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
const updateCommentApi = params => {
params.method = `${defaultPath}update.comment`
return http({
url: 'rop-scrm-live/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
const updateReplayApi = params => {
params.method = `${defaultPath}update.replay`
return http({
url: 'rop-scrm-live/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export { getLiveRoomListApi, insertLiveRoomApi, getLiveRoomInfoApi, getControlInfoApi, getControlImportListApi, getWaitImportListApi, importGoodsApi, updateCommentApi, updateReplayApi }
<!-- 搜索 -->
<template>
<div class="glsx-combi-form">
<el-form :ref="formRef" :inline="true" :model="formObj" :label-width="labelWidth" :rules="formRules" size="mini" class="glsx-combi-form-block">
<el-form :ref="formRef" :inline="true" :model="formObj" :label-width="labelWidth" :rules="formRules" size="small" class="glsx-combi-form-block">
<template v-for="(item, index) in formData">
<el-form-item v-if="!item.isHide" :key="index" :class="{ 'no-label': !item.label, isBlock: isBlock }" :label="item.label ? item.label + ':' : ''" :prop="item.name">
<span v-if="!item.isHide && item.tips" class="tips-block" slot="label">
......
<!-- 选择商品弹窗 -->
<template>
<glsx-dialog class="muti-pro" title="选择商品" :isVisible.sync="isMutiSelectVisible" width="70%" @confirmDialog="handleMutiSelectConfirm" @closeDialog="handleMutiSelectClose">
<div class="flex">
<el-form :inline="true" :model="searchForm">
<el-form-item label="商品名称:">
<el-input :size="size" v-model="searchForm.name" placeholder="请输入商品名称" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button :size="size" type="primary" @click="getList(true)">查询</el-button>
<el-button :size="size" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</div>
<GLTable ref="mutiProRef" :tableData="productList" :searchForm="searchForm" :tableParams="tableParams" @refreshTable="getList">
<span slot="coverImgUrl" slot-scope="scope">
<img class="m-t-10 img-60" :src="scope.scope.coverImgUrl" />
</span>
</GLTable>
</glsx-dialog>
</template>
<script>
// import { getGoodsList } from '@/api/modules/common'
import glsxDialog from '@/components/glsx-dialog'
export default {
name: 'selectMutiProDialog',
data() {
return {
size: 'small',
// 表格组件
// getListApi: getGoodsList,
productList: [],
// pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'id',
// 多选ref的名称
mutiSelectName: 'list',
tableColumns: [
{
label: '商品名称',
prop: 'name'
},
{
label: '缩略图',
prop: 'coverImgUrl',
addHtml: 'coverImgUrl'
},
{
label: '价格(元)',
prop: 'price1',
formatter: cellValue => {
return cellValue.price2 && cellValue.price1 != cellValue.price2 ? (cellValue.price1 / 100).toFixed(2) + '-' + (cellValue.price2 / 100).toFixed(2) : (cellValue.price1 / 100).toFixed(2)
}
},
{
label: '来源门店',
prop: 'merchantName'
}
]
}
}
},
props: {
isMutiSelectVisible: {
type: Boolean,
default: false
},
selectedProList: {
type: Array,
default: () => []
},
getListApi: {
type: Function,
default: () => {}
},
searchForm: {
type: Object,
default: () => {}
}
},
components: {
glsxDialog
},
mounted() {
this.getList(true)
},
methods: {
getList(isMounted = false) {
var params = {
// goodsStatus: 1,
// goodsSource: 1,
...this.searchForm,
pageNum: isMounted ? 1 : this.$refs.mutiProRef.page.pageNum,
pageSize: isMounted ? 10 : this.$refs.mutiProRef.page.pageSize
}
var that = this
this.getListApi(params).then(res => {
// console.log(res)
this.productList = res.list
this.$refs.mutiProRef.tableTotal = res.total
this.recoverySelected()
})
},
handleReset() {
this.searchForm.name = ''
this.getList()
},
recoverySelected() {
if (this.selectedProList.length) {
this.selectedProList.forEach(row => {
this.$refs.mutiProRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(row)
})
}
},
handleMutiSelectConfirm() {
var selectedData = this.$refs.mutiProRef.mutiSelectArr[this.tableParams.mutiSelectName]
console.log(selectedData)
this.$emit('handleMutiSelectConfirm', selectedData)
},
handleMutiSelectClose() {
this.$emit('handleMutiSelectClose')
}
}
}
</script>
<style>
.muti-pro .m-t-10 {
margin-top: 10px;
}
</style>
......@@ -49,7 +49,7 @@ const staticRoutes = Object.freeze([
},
{
name: 'liveControl',
path: '/liveRoom/liveControl',
path: '/liveRoom/liveControl/:id',
component: resolve => require([`@/views/liveRoom/liveControl.vue`], resolve),
meta: {}
}
......
......@@ -33,7 +33,6 @@
<script>
import _ from 'lodash'
// import '@/assets/css/public.scss'
import glsxCombiForm from '@/components/glsx-combi-form'
import selectSingleProDialog from './selectSingleProDialog'
import { uploadImg } from '@/api/modules/common'
......
<!-- 控制台 -->
<template>
<div class="live-control">
<div class="container edit-container">
<div class="live-room live-control">
<div class="container">
<div class="box">
<p class="edit-title">直播控制台</p>
<div class="head-box flex">
<img class="head-img" src="https://img2.baidu.com/it/u=4276914015,335466661&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500" />
<div class="head-box flex-start">
<img class="head-img" :src="editForm.shareImgUrl" />
<div>
<p>{{ liveRoomData.title }}</p>
<p>开播时间:{{ liveRoomData.time }}</p>
<p>房间号:{{ liveRoomData.roomNum }}</p>
<p>主播:{{ liveRoomData.anchor }}</p>
<p>微信号:{{ liveRoomData.wechat }}</p>
<p v-if="countDown">开播倒计时:{{ countDown }}</p>
<p class="head-title m-b-18">{{ editForm.name }}</p>
<p class="txt m-b-18">开播时间:{{ editForm.startTime + '-' + editForm.endTime }}</p>
<p class="txt m-b-18">房间号:{{ editForm.id }}</p>
<p class="txt m-b-18">
<span class="m-r-20">主播:{{ editForm.anchorName }}</span>
<span>微信号:{{ editForm.anchorWechat }}</span>
</p>
<p class="count-down" v-if="countDown">倒计时{{ countDown }}</p>
</div>
</div>
</div>
</div>
<div class="container">
<div class="box">
<div class="content">
<p class="edit-sub-title">直播数据</p>
<p class="edit-title no-border">直播数据</p>
<GLTable :tableParams="liveTableParams" :tableData="liveDataTable" :hasPage="false">
<span slot="coverImgUrl" slot-scope="scope">
<img class="img-60" :src="scope.scope.coverImgUrl" />
</span>
</GLTable>
</div>
</div>
</div>
<div class="container">
<div class="box">
<div class="content">
<p class="edit-sub-title">商品数据</p>
<p>累计推送次数</p>
<p>商品点击人数</p>
<p>商品点击次数</p>
<p class="edit-title">商品数据</p>
<div class="flex pro-data">
<div class="w-25">
<p>直播成交总金额</p>
<p class="price">¥{{ editForm.saleAmtTotal || '0' }}</p>
</div>
<div class="w-25">
<p>累计推送次数</p>
<p class="price">{{ editForm.pushNum }}</p>
</div>
<div class="w-25">
<p>商品点击人数</p>
<p class="price">{{ editForm.clickUserNum }}</p>
</div>
<div class="w-25">
<p>商品点击次数</p>
<p class="price">{{ editForm.clickNum }}</p>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="box">
<div class="content">
<div class="flex" style="justify-content: space-between;">
<p class="edit-sub-title">商品配置</p>
<el-button size="mini" @click="handleImportPro">导入商品</el-button>
<p class="edit-title no-border">商品配置</p>
<div class="flex">
<el-form :inline="true" :model="searchConfigForm">
<el-form-item label="商品名称:">
<el-input :size="size" v-model="searchConfigForm.name" placeholder="请输入商品名称" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button :size="size" type="primary" @click="handleConfigSearch">查询</el-button>
<el-button :size="size" @click="handleConfigReset">重置</el-button>
</el-form-item>
</el-form>
<el-form>
<el-form-item>
<el-button type="primary" size="mini" @click="handleConfigImport">导入商品</el-button>
</el-form-item>
</el-form>
</div>
<GLTable ref="liveRoomRef" :searchForm="searchConfigForm" :tableParams="tableParams" :tableData="tableData" :pageConf="pageConf" :beforeSearchFn="beforeConfigSearchFn">
<span slot="showImg" slot-scope="scope">
<img style="width: 100px; height: 100px;" :src="scope.scope.img" />
<GLTable ref="controlConfigRef" :searchForm="searchConfigForm" :tableParams="tableParams" :getListApi="getControlImportListApi" :pageConf="pageConf" :beforeSearchFn="beforeConfigSearchFn">
<span slot="coverImgUrl" slot-scope="scope">
<img class="img-60" :src="scope.scope.coverImgUrl" />
</span>
<span slot="auth-button" slot-scope="scope" :data="scope.scope">
<el-button type="text" @click="handlePush(scope.scope.id)">{{ targetId === scope.scope.id ? '已推送' + pushCountDown + 's' : '推送' }}</el-button>
<el-button type="text" @click="handleUpOrDown(scope.scope)">{{ scope.scope.status == '1' ? '下架' : '上架' }}</el-button>
<el-button type="text" @click="handleUpOrDown(scope.scope)">{{ scope.scope.onSale == '1' ? '下架' : '上架' }}</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</span>
</GLTable>
</div>
</div>
</div>
<div class="container">
<div class="box">
<div class="content">
<p class="edit-sub-title">直播设置</p>
<p class="edit-title">直播设置</p>
<div class="flex">
<div>
<p class="edit-title no-border">直播间禁言</p>
<p class="txt">
开启后,所有观众无法在直播间发表评论。
<el-switch :size="size" v-model="editForm.closeComment" active-value="1" inactive-value="0" @change="handleChangeComment"></el-switch>
</p>
</div>
<div>
<p class="edit-title no-border">直播回放</p>
<p class="txt">
开启后,观众可在直播结束页面查看本场直播。
<el-switch :size="size" v-model="editForm.closeReplay" active-value="1" inactive-value="0" @change="handleChangeReplay"></el-switch>
</p>
</div>
</div>
</div>
</div>
<select-muti-pro-dialog :isMutiSelectVisible="isMutiSelectVisible" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose"></select-muti-pro-dialog>
</div>
<select-muti-pro-dialog v-if="isMutiSelectVisible" :isMutiSelectVisible="isMutiSelectVisible" :searchForm="searchWaitForm" :getListApi="getWaitImportListApi" :selectedProList="selectedProList" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose">
<!-- <template slot="search">
<div class="flex">
<el-form :inline="true" :model="searchWaitForm">
<el-form-item label="商品名称:">
<el-input :size="size" v-model="searchWaitForm.name" placeholder="请输入商品名称" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button :size="size" type="primary" @click="handleConfigSearch">查询</el-button>
<el-button :size="size" @click="handleConfigReset">重置</el-button>
</el-form-item>
</el-form>
</div>
</template> -->
</select-muti-pro-dialog>
</div>
</template>
<script>
import selectMutiProDialog from './selectMutiProDialog'
import { getControlInfoApi, getControlImportListApi, getWaitImportListApi, importGoodsApi, updateCommentApi, updateReplayApi } from '@/api/modules/liveRoom'
// import selectMutiProDialog from './selectMutiProDialog'
import selectMutiProDialog from '@/components/select-muti-pro'
export default {
name: 'liveControl',
data() {
return {
size: 'small',
countDown: 0,
timer: null,
liveRoomData: {
tilte: '直播间名字',
time: '2021-9-27 10:00:00',
roomNum: '1',
anchor: '主播名字',
wechat: '微信号'
editForm: {},
// 直播数据 - 表格
liveDataTable: [],
liveTableParams: {
tableColumns: [
{
label: '商品名称',
prop: 'goodsName',
line: 1
},
{
label: '商品图片',
prop: 'coverImgUrl',
addHtml: 'coverImgUrl'
},
{
label: '成交单量',
prop: 'saleNum',
line: 1
},
{
label: '成交金额',
prop: 'saleAmt',
line: 1
},
{
label: '来源门店',
prop: 'merchantName',
line: 1
}
]
},
// 导入商品
isMutiSelectVisible: false,
searchWaitForm: {},
selectedProList: [],
getWaitImportListApi: getWaitImportListApi,
// 商品配置 - 表格
getListApi: '',
getControlImportListApi: getControlImportListApi,
searchConfigForm: {},
pushTimer: null,
pushCountDown: 0,
targetId: '',
tableData: [
{
id: '1',
status: '1',
img: 'https://img2.baidu.com/it/u=4276914015,335466661&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
},
{
id: '2',
status: '0',
img: 'https://img2.baidu.com/it/u=4276914015,335466661&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
tableParams: {
listName: 'list',
......@@ -91,44 +191,47 @@ export default {
tableColumns: [
{
label: '商品图片',
prop: 'img',
prop: 'coverImgUrl',
line: 1,
addHtml: 'showImg'
addHtml: 'coverImgUrl'
},
{
label: '商品标题',
prop: '',
prop: 'name',
line: 1
},
{
label: '商品价格',
prop: ''
prop: 'price',
formatter: cellValue => {
return cellValue.price2 && cellValue.price1 != cellValue.price2 ? (cellValue.price1 / 100).toFixed(2) + '-' + (cellValue.price2 / 100).toFixed(2) : (cellValue.price1 / 100).toFixed(2)
}
},
{
label: '状态',
prop: 'status',
prop: 'onSale',
formatter: cellValue => {
return {
0: '下架',
1: '已上架'
}[cellValue.status]
1: '上架'
}[cellValue.onSale]
}
},
{
label: '点击次数',
prop: ''
prop: 'clickNumber'
},
{
label: '点击人数',
prop: ''
},
{
label: '点赞次数',
prop: ''
prop: 'clickUserNumber'
},
// {
// label: '点赞次数',
// prop: ''
// },
{
label: '来源门店',
prop: ''
prop: 'merchantName'
}
]
}
......@@ -142,7 +245,11 @@ export default {
computed: {},
mounted() {
this.countDownTime()
this.routeInfo = this.$route.params
this.searchWaitForm = {
id: this.routeInfo.id
}
this.getInfo()
},
beforeDestroy() {
this.timer && clearInterval(this.timer)
......@@ -150,11 +257,32 @@ export default {
},
methods: {
getInfo() {
getControlInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm = res
this.liveDataTable = res.liveStatisticsDTOList
console.log(this.editForm)
this.countDownTime()
})
},
beforeConfigSearchFn() {
return new Promise(resolve => {
this.searchConfigForm.id = this.$route.params.id
resolve()
})
},
handleConfigSearch() {
this.$refs.controlConfigRef.refreshTable()
},
handleConfigReset() {
this.searchConfigForm.name = ''
this.handleConfigSearch()
},
countDownTime() {
clearInterval(this.timer)
if (new Date() < new Date(this.liveRoomData.time)) {
if (new Date() < new Date(this.editForm.startTime)) {
this.timer = setInterval(() => {
var leftTime = new Date(this.liveRoomData.time) - new Date()
var leftTime = new Date(this.editForm.startTime) - new Date()
//计算剩余的天数
var days = parseInt(leftTime / 1000 / 60 / 60 / 24, 10)
//计算剩余的小时
......@@ -163,11 +291,11 @@ export default {
var minutes = parseInt((leftTime / 1000 / 60) % 60, 10)
//计算剩余的秒数
var seconds = parseInt((leftTime / 1000) % 60, 10)
days = this.checkTime(days)
hours = this.checkTime(hours)
minutes = this.checkTime(minutes)
seconds = this.checkTime(seconds)
this.countDown = days + '天' + hours + '小时' + minutes + '分' + seconds + '秒'
// days = this.checkTime(days)
// hours = this.checkTime(hours)
// minutes = this.checkTime(minutes)
// seconds = this.checkTime(seconds)
this.countDown = (days ? days + '天' : '') + hours + '小时' + minutes + '分' + seconds + '秒'
this.countDownTime()
}, 1000)
}
......@@ -179,11 +307,6 @@ export default {
}
return i
},
beforeConfigSearchFn() {
return new Promise(resolve => {
resolve()
})
},
handlePush(id) {
if (!this.targetId) {
this.targetId = id
......@@ -202,37 +325,123 @@ export default {
this.pushCountDown = 0
}
},
handleImportPro() {
handleConfigImport() {
this.isMutiSelectVisible = !this.isMutiSelectVisible
},
handleMutiSelectConfirm(selectData) {},
handleMutiSelectConfirm(selectedProInfo) {
var params = {
roomId: this.routeInfo.id,
goodsIds: selectedProInfo.map(item => item.id)
}
console.log(params)
importGoodsApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleConfigReset()
}
})
},
handleMutiSelectClose() {
this.handleImportPro()
}
this.handleConfigImport()
},
handleChangeComment(val) {
var params = {
id: this.routeInfo.id,
banComment: val
}
updateCommentApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code != '0') {
this.editForm.closeComment = val ? 0 : 1
}
})
},
handleChangeReplay(val) {
var params = {
id: this.routeInfo.id,
closeReplay: val
}
updateReplayApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code != '0') {
this.editForm.closeReplay = val ? 0 : 1
}
})}
}
}
</script>
<style>
.live-control {
/* .live-control {
padding: 20px;
}
.live-control p {
} */
/* .live-control p {
margin: 0 0 10px 0;
color: #666666;
}
.live-control .box {
} */
/* .live-control .box {
padding: 10px;
border: 1px solid #cccccc;
} */
.live-control {
font-size: 16px;
color: #333333;
}
.live-control .flex {
.live-control .flex-start {
display: flex;
justify-content: flex-start;
}
.live-control .no-border{
border: 0;
}
.live-control .m-b-18 {
margin-bottom: 18px;
}
.live-control .m-r-20 {
margin-right: 20px;
}
.live-control .head-box {
padding: 16px 0;
position: relative;
padding: 32px 10px 17px;
}
.live-control .head-box .head-title {
line-height: 20px;
font-weight: bold;
}
.live-control .txt {
font-size: 14px;
line-height: 20px;
color: #666666;
}
.live-control .head-box .count-down {
position: absolute;
right: 20px;
top: 100px;
font-size: 20px;
color: #5850FF;
}
.live-control .head-box .head-img {
width: 200px;
height: 160px;
width: 170px;
height: 136px;
padding-right: 20px;
}
.live-control .pro-data {
padding: 40px 20px;
}
.pro-data .w-25 {
width: 25%;
text-align: center;
}
.live-control .pro-data .price {
font-size: 30px;
margin-top: 20px;
}
</style>
......@@ -149,9 +149,10 @@ export default {
handleDetail(row) {
this.$router.push({
// name: 'liveControl',
path: '/liveroom/liveControl',
query: {
id: row ? row.id : ''
// path: '/liveRoom/liveControl',
name: 'ServicesLiveRoomLiveControl',
params: {
id: row.id
}
})
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!