Commit 186e751c by cwq0219

直播间

1 parent e1624ae8
......@@ -5912,6 +5912,35 @@
}
}
},
"glsx-table": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/glsx-table/-/glsx-table-1.1.0.tgz",
"integrity": "sha512-2GTdGxOYFCG90TzZKxyGnz/Uaj2o+kMc2Rz44wuLwu5J1EsY07y4S1k4wn/ErpsBhK+PIzvjucJYRTlVzAyPBQ==",
"requires": {
"element-ui": "^2.13.1",
"vue": "^2.6.12"
},
"dependencies": {
"element-ui": {
"version": "2.15.6",
"resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.15.6.tgz",
"integrity": "sha512-rcYXEKd/j2G0AgficAOk1Zd1AsnHRkhmrK4yLHmNOiimU2JfsywgfKUjMoFuT6pQx0luhovj8lFjpE4Fnt58Iw==",
"requires": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
"deepmerge": "^1.2.0",
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.0",
"throttle-debounce": "^1.0.1"
}
},
"vue": {
"version": "2.6.14",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.14.tgz",
"integrity": "sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ=="
}
}
},
"graceful-fs": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz",
......@@ -7212,10 +7241,9 @@
}
},
"lodash": {
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
"dev": true
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"lodash.defaultsdeep": {
"version": "4.6.1",
......
......@@ -14,6 +14,8 @@
"element-ui": "^2.4.5",
"glsx-common": "^1.3.2",
"glsx-components": "^1.0.1",
"glsx-table": "^1.1.0",
"lodash": "^4.17.21",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vuex": "^3.1.2"
......
.edit-title {
font-size: 18px;
font-weight: bold;
height: 48px;
line-height: 48px;
color: #0947C6;
border-bottom: 1px solid #E7EAEC;
// padding-left: 20px;
margin: 0 0;
}
.edit-sub-title::before {
position: absolute;
display: inline-block;
content: '';
height: 18px;
width: 4px;
top: 2px;
left: 0;
background-color: #0947C6;
}
.edit-sub-title {
position: relative;
font-size: 16px;
font-weight: 700;
color: #333333;
margin: 0 0 30px 0;
padding-left: 8px;
}
\ No newline at end of file
/**
* 时间控件-限制月份
*/
export const beforeRangePickerOptions = {
disabledDate(date) {
if (date > new Date()) {
return true
}
return false
}
}
export const afterRangePickerOptions = {
disabledDate(date) {
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1))
if (date < yesterday) {
return true
}
return false
}
}
<!-- 搜索 -->
<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">
<template v-for="(item, index) in formData">
<el-form-item v-if="!item.isHide" :key="index" :class="{ 'no-label': !item.label, isBlock: isBlock, tips: item.tips }" :label="item.label ? item.label + ':' : ''" :prop="item.name">
<slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot>
<el-input v-else-if="item.type === 'input'" :placeholder="item.placeholder || '请输入' + item.label" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :style="{ width: item.width || 'auto' }" :show-word-limit="item.showLimit || false" @keydown.native="e => handleInputDown(e, item)"></el-input>
<!-- 选择-输入框 -->
<el-input v-else-if="item.type === 'selectInput'" :placeholder="'请输入' + item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).label" v-model.trim="searchSelectObj[item.selectName].value" :clearable="item.isClear || false" class="input-with-select">
<el-select v-model="searchSelectObj[item.selectName].attr" style="width: 130px" slot="prepend" placeholder="请选择" @change="item.handleSelectChange">
<el-option v-for="(subItem, subIndex) in item.selectOption" :key="subIndex" :label="subItem.label" :value="subItem.name"></el-option>
</el-select>
</el-input>
<!-- 选择-时间选择框 -->
<template v-else-if="item.type === 'selectDatePicker'">
<el-select v-model="searchSelectObj[item.selectName].attr" style="width: 130px" placeholder="请选择" @change="item.handleSelectChange">
<el-option v-for="(subItem, subIndex) in item.selectOption" :key="subIndex" :label="subItem.label" :value="subItem.name"></el-option>
</el-select>
<el-date-picker v-model="searchSelectObj[item.selectName].value" style="width: calc(100% - 130px)" :type="item.dateType || 'daterange'" :clearable="item.isClear || false" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOption[item.pickerOptions]"></el-date-picker>
</template>
<!-- 双选择框 -->
<template v-else-if="item.type === 'selectDouble'">
<el-select v-model="searchSelectObj[item.selectName].attr" style="width: 130px" placeholder="请选择" @change="item.handleSelectChange">
<el-option v-for="(subItem, subIndex) in item.selectOption" :key="subIndex" :label="subItem.label" :value="subItem.name"></el-option>
</el-select>
<el-select v-model="searchSelectObj[item.selectName].value" style="width: calc(100% - 130px)" :placeholder="'请选择' + item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).label">
<el-option label="全部" value=""></el-option>
<el-option v-for="subItem in item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).optionList" :key="subItem[item.optionId]" :label="subItem[item.optionLabel]" :value="subItem[item.optionId]"></el-option>
</el-select>
</template>
<!-- 选择框 -->
<el-select v-else-if="item.type === 'select'" :style="{ width: item.width || '100%' }" v-model="formObj[item.name]" :clearable="item.isClear || false" :placeholder="'请选择' + item.label" :filterable="!item.noFilter" :disabled="item.isDisabled" :no-data-text="item.noDataText || '无数据'" :multiple="item.multiple || false" :collapse-tags="item.collapseTags || true" @change="selectAddAttr($event, item)">
<el-option v-for="subItem in item.optionList" :key="subItem[item.optionId]" :label="subItem[item.optionLabel]" :value="subItem[item.optionId]" :disabled="subItem.isDisabled || false"></el-option>
</el-select>
<!-- radio -->
<el-radio-group v-else-if="item.type === 'radio'" v-model="formObj[item.name]" :disabled="item.isDisabled" @change="item.handleRadioChange">
<el-radio v-for="subItem in item.optionList" :key="subItem[item.optionId]" :label="subItem[item.optionId]">{{ subItem[item.optionLabel] }}</el-radio>
</el-radio-group>
<el-date-picker v-else-if="item.type === 'datePicker'" v-model="formObj[item.name]" :type="item.dateType || 'daterange'" :clearable="item.isClear || false" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOption[item.pickerOptions]"></el-date-picker>
<!-- 图片上传 -->
<el-upload v-else-if="item.type === 'upload'" action="#" list-type="picture-card" :auto-upload="false" :limit="item.limitNum || 1" :fileList="formObj[item.name]" accept="image/jpeg,image/png,image/jpg" :on-change="(file, fileList) => handleChangeUpload(file, fileList, item)">
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{ file }">
<img class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="handleImgPreview(file)">
<i class="el-icon-zoom-in"></i>
</span>
<span class="el-upload-list__item-delete" @click="handleImgRemove(file, item)">
<i class="el-icon-delete"></i>
</span>
</span>
</div>
</el-upload>
</el-form-item>
</template>
<slot name="footer"></slot>
</el-form>
<el-dialog :visible.sync="isImgVisible">
<img width="100%" :src="dialogImageUrl" alt="" />
</el-dialog>
</div>
</template>
<script>
import { beforeRangePickerOptions, afterRangePickerOptions } from './common'
export default {
name: 'glsx-combi-form',
data() {
return {
pickerOption: {
beforeRangePickerOptions: beforeRangePickerOptions,
afterRangePickerOptions: afterRangePickerOptions
},
isImgVisible: false,
dialogImageUrl: ''
}
},
props: {
isBlock: {
type: Boolean,
default: false
},
formRef: {
type: String,
default: 'formRef'
},
labelWidth: {
type: String,
default: '85px'
},
formData: {
type: Array,
default: () => []
},
formObj: {
type: Object,
default: () => {}
},
hasTitle: {
type: Boolean,
default: true
},
formRules: {
type: Object,
default: () => {}
},
// 搜索+输入框/搜索组合组件,搜索栏绑值
searchSelectObj: {
type: Object,
default: () => {}
}
},
mounted() {},
methods: {
// 选择框-添加其他属性
selectAddAttr(value, targetItem) {
targetItem.changeAttr && targetItem.changeAttr(value, targetItem)
},
handleInputDown(e, item) {
if (e.keyCode === 13 && item.hasOwnProperty('keyFn')) {
item.keyFn()
}
},
// 图片上传
handleChangeUpload(file, fileList, targetItem) {
const limitSize = targetItem.limitSize || 10
const isType = ['image/jpeg', 'image/png', 'image/jpg'].includes(file.raw.type)
const isLt10M = file.size / 1024 / 1024 < limitSize
if (!isType) {
this.$message.error('上传图片不是jpg、jpeg或png的格式!')
this.formObj[targetItem.name] = this.formObj[targetItem.name].filter(item => item.uid != file.uid)
return true
}
if (!isLt10M) {
this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
this.formObj[targetItem.name] = this.formObj[targetItem.name].filter(item => item.uid != file.uid)
return true
}
targetItem.handleUpload(file, fileList, targetItem)
},
handleImgPreview(file) {
this.dialogImageUrl = file.url
this.isImgVisible = true
},
handleImgRemove(file, targetItem) {
this.formObj[targetItem.name] = this.formObj[targetItem.name].filter(item => item.uid != file.uid)
}
}
}
</script>
<style>
/* .glsx-combi-form {
min-width: 922px;
} */
.glsx-combi-form .glsx-combi-form-block {
padding: 16px 40px 0;
}
.glsx-combi-form .isBlock {
display: block;
}
/* .glsx-combi-form .el-form-item {
width: 65%;
} */
.glsx-combi-form .no-label.el-form-item--mini .el-form-item__content,
.el-form-item--mini .el-form-item__label {
width: 100%;
}
/* .glsx-combi-form .el-form-item--mini .el-form-item__content {
width: calc(100% - 85px);
} */
.glsx-combi-form .el-col {
margin-bottom: 10px;
}
.glsx-combi-form .el-select {
width: 100%;
}
.glsx-combi-form .item-height {
height: 37px;
}
.glsx-combi-form input::-webkit-outer-spin-button,
.glsx-combi-form input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
}
.glsx-combi-form input[type='number'] {
-moz-appearance: textfield !important;
}
.glsx-combi-form .input-with-select .el-input-group__prepend {
background-color: #fff;
}
.glsx-combi-form .tips {
margin: 0;
}
</style>
<!-- 弹窗 -->
<template>
<div>
<el-dialog :title="title" :visible.sync="isVisible" :show-close="showClose" :before-close="handleClose" :close-on-click-modal="false" :width="width">
<span slot="title">
{{ title }}
<span class="dialog-sub-title">
<slot name="sub-title"></slot>
</span>
</span>
<slot></slot>
<div slot="footer">
<slot name="btn-start"></slot>
<el-button type="primary" :size="btnSize" @click="handleConfirm">{{ btnOkLabel }}</el-button>
<el-button v-if="!noCancel" :size="btnSize" @click="handleClose">取消</el-button>
<slot name="btn-middle"></slot>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'glsx-dialog',
data() {
return {}
},
props: {
title: {
type: String,
default: ''
},
isVisible: {
type: Boolean,
default: false
},
showClose: {
type: Boolean,
default: true
},
btnOkLabel: {
type: String,
default: '确定'
},
noCancel: {
type: Boolean,
default: false
},
width: {
type: String,
default: '580px'
},
btnSize: {
type: String,
default: 'mini'
}
},
methods: {
handleClose() {
this.$emit('closeDialog')
},
handleConfirm() {
this.$emit('confirmDialog')
}
}
}
</script>
<style scoped>
.dialog-sub-title {
font-size: 12px;
color: #666666;
}
</style>
......@@ -11,11 +11,12 @@ import Vue from 'vue'
import App from './App.vue'
import apis from './api'
import store from './store'
import { message } from './plugins/element.js'
import { message, messageBox } from './plugins/element.js'
import { fetchConfig } from '@/config'
import { GLButton } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { Http, utils } from 'glsx-common'
import { VueRouter, routes as staticRoutes, getRoutes } from './router'
import glsxTable from 'glsx-table'
import 'glsx-components/dist/glsx-components.css'
import './public-path'
Vue.config.productionTip = false
......@@ -44,7 +45,10 @@ async function qiankunRender(props = {}) {
async function _render(http, routes, base, permissions) {
Vue.prototype.$http = http
Vue.prototype.$apis = apis
Vue.prototype.$message = message
Vue.prototype.$messageBox = messageBox
Vue.use(GLButton, { permissions })
Vue.use(glsxTable)
router = new VueRouter({
base,
routes,
......
import Vue from 'vue'
import { Message, Button, ButtonGroup, Form, FormItem, Input, Radio, RadioGroup, Checkbox, CheckboxGroup, Switch, Select, Option, TimePicker, Col, DatePicker, Tree, Card, Table, TableColumn, Pagination, Loading, Dialog, Container } from 'element-ui'
import { Message, Button, ButtonGroup, Form, FormItem, Input, Radio, RadioGroup, Checkbox, CheckboxGroup, Switch, Select, Option, TimePicker, Col, DatePicker, Tree, Card, Table, TableColumn, Pagination, Loading, Dialog, MessageBox, Upload, Container } from 'element-ui'
Vue.use(Button)
Vue.use(ButtonGroup)
Vue.use(Form)
......@@ -22,4 +22,6 @@ Vue.use(TableColumn)
Vue.use(Pagination)
Vue.use(Loading)
Vue.use(Dialog)
Vue.use(Upload)
export const message = Message
export const messageBox = MessageBox
......@@ -10,6 +10,25 @@ const staticRoutes = Object.freeze([
path: '/cmmodityLibrary/warehousingList',
component: resolve => require([`@/views/cmmodityLibrary/warehousingList.vue`], resolve),
meta: {}
},
{
name: 'liveRoom',
path: '/liveRoom/liveRoomList',
component: resolve => require([`@/views/liveRoom/liveRoomList.vue`], resolve),
meta: {}
},
{
name: 'editLiveRoom',
path: '/liveRoom/EditLiveRoom',
// component: () => import('@/views/liveRoom/editLiveRoom.vue'),
component: resolve => require([`@/views/liveRoom/editLiveRoom.vue`], resolve),
meta: {}
},
{
name: 'liveControl',
path: '/liveRoom/liveControl',
component: resolve => require([`@/views/liveRoom/liveControl.vue`], resolve),
meta: {}
}
])
export default staticRoutes
<!-- 编辑直播间 -->
<template>
<div>
<p class="edit-title">{{ title }}</p>
<!-- <p class="edit-sub-title" style="margin-top: 10px;">关联门店信息</p> -->
<glsx-combi-form ref="editFormRef" labelWidth="140px" :isBlock="isBlock" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="wechatAccount" slot-scope="item">
<el-button type="text" @click="handlSelectWechat(item)">从成员中选择</el-button>
</div>
<div slot="liveRoomCof">
<el-button type="primary" size="mini" class="el-icon-plus" @click="handleRelateStoreClose">直播间配置</el-button>
</div>
<div slot="footer">
<el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button type="default" @click="handleCancel">取消</el-button>
</div>
</glsx-combi-form>
<glsx-dialog title="选择成员" width="620px" :isVisible="isWechatVisible" @closeDialog="handleWechatClose" @confirmDialog="handleWechatConfirm"></glsx-dialog>
<relate-store-dialog
v-if="relateStoreVisible"
ref="relateStore"
:relateStoreVisible="relateStoreVisible"
:storeApi="storeApi"
:storeSearchForm="storeSearchForm"
:storeSelected="storeSelected"
@handleRelateStoreConfirm="handleRelateStoreConfirm"
@handleRelateStoreClose="handleRelateStoreClose"
>
<!-- <el-row>
<el-form
:model="storeSearchForm"
:rules="rules"
ref="relate"
:inline="true"
>
<el-form-item label="园区店:">
<el-input
v-model.trim="storeSearchForm.yqMerchantName"
placeholder="园区店名称"
@keydown.native="handleStoreInput"
clearable
></el-input>
</el-form-item>
<el-form-item label="4S店:">
<el-input
v-model.trim="storeSearchForm.merchantName"
placeholder="4S店名称"
@keydown.native="handleStoreInput"
clearable
></el-input>
</el-form-item>
<el-button
type="primary"
@click="handleSearchStore"
>搜索</el-button>
</el-form>
</el-row> -->
</relate-store-dialog>
</div>
</template>
<script>
import '@/assets/css/public.scss'
import _ from 'lodash'
import glsxCombiForm from '@/components/glsx-combi-form'
import glsxDialog from '@/components/glsx-dialog'
import relateStoreDialog from './relateStoreDialog'
export default {
name: 'editLiveRoom',
data() {
return {
title: '新建直播间',
// 1-新增;2-编辑
addOrEdit: 1,
editChildRef: 'editChildRef',
editForm: {
title: '',
time: '',
wechatConfigImg: [],
officalStyle: [],
backWall: []
},
editRule: {},
isBlock: true,
editFormData: [
{
label: '直播间标题',
name: 'title',
width: '480px',
type: 'input',
maxlength: 20
},
{
label: '开播时间',
name: 'time',
type: 'datePicker',
isClear: true,
pickerOptions: 'afterRangePickerOptions'
},
{
label: '主播昵称',
name: 'title',
width: '480px',
type: 'input',
maxlength: 10
},
{
label: '主播微信账号',
name: '',
addHtml: 'wechatAccount'
},
{
label: '主播副号',
name: '',
width: '480px',
type: 'input',
maxlength: 20
},
{
label: '分享卡片样式配置',
name: 'wechatConfigImg',
type: 'upload',
handleUpload: (file, fileList, targetItem) => {
this.editForm[targetItem.name] = fileList
// this.editForm[targetItem.name].pop()
}
},
{
label: '官方收录样式',
name: 'officalStyle',
type: 'upload',
handleUpload: (file, fileList, targetItem) => {
this.editForm[targetItem.name] = fileList
// this.editForm[targetItem.name].pop()
}
},
{
label: '主播间背景墙',
name: 'backWall',
type: 'upload',
handleUpload: (file, fileList, targetItem) => {
this.editForm[targetItem.name] = fileList
// this.editForm[targetItem.name].pop()
}
},
{
label: '关联发现频道',
name: 'channelId',
type: 'select',
// isDisabled: false,
width: '480px',
optionList: [],
optionId: 'dictValue',
optionLabel: 'dictLabel',
optionsName: 'channnelList'
// changeAttr: (value, targetItem) => {
// this.editForm.menuId = ''
// this.editForm.menuName = ''
// this.getMenuTree(value)
// }
},
{
label: '',
name: '',
addHtml: 'liveRoomCof'
}
],
// 选择成员
isWechatVisible: false,
// 直播配置
relateStoreVisible: false,
storeApi: '',
storeSearchForm: {},
storeSelected: [],
baseData: {
channnelList: [
{
dictValue: 1,
dictLabel: '商户'
},
{
dictValue: 2,
dictLabel: '门店'
}
]
}
}
},
components: {
glsxCombiForm,
glsxDialog,
relateStoreDialog
},
mounted() {
this.addOrEdit = this.$route.params.addOrEdit
if (this.$route.params.addOrEdit == 2) {
this.editForm = this.$route.params.row
this.title = '编辑直播间'
}
this.getOptionsList('editFormData', false)
},
methods: {
getOptionsList(formName, hasAll = true) {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', _.cloneDeep(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
},
relateCloseReset() {
this.storeSelected = []
},
handleRelateStoreClose() {
this.relateStoreVisible = !this.relateStoreVisible
this.relateCloseReset()
},
handleRelateStoreConfirm(selectedData) {
if (!selectedData.length) {
this.$message({
message: '请选择关联门店',
type: 'warning',
showClose: true
})
return true
}
// this.couponsForm.merchantCouponDTOList = selectedData
// this.couponsNumList = new Array(selectedData.length).fill(999)
// this.couponsForm.merchantCouponDTOList.forEach((item, idx) => {
// if (!item.hasOwnProperty('amount')) {
// item['amount'] = 999
// } else {
// this.couponsNumList[idx] = item.amount
// }
// })
this.handleRelateStoreClose()
// this.$refs.couponAddForm.clearValidate('merchantCouponDTOList')
},
handleWechatClose() {
this.isWechatVisible = !this.isWechatVisible
},
handleWechatConfirm() {
this.handleWechatClose()
},
handlSelectWechat(obj) {
this.handleWechatClose()
},
handleConfirm() {
this.handleCancel()
},
handleCancel() {
this.$router.push({
name: 'liveRoom'
})
}
}
}
</script>
<style scoped></style>
<!-- 控制台 -->
<template>
<div class="live-control">
<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>
<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>
</div>
</div>
<div class="content">
<p class="edit-sub-title">直播数据</p>
</div>
<div class="content">
<p class="edit-sub-title">商品数据</p>
<p>累计推送次数</p>
<p>商品点击人数</p>
<p>商品点击次数</p>
</div>
<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>
</div>
<glsx-table
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"
/>
</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="handleDelete(scope.scope)"
>删除</el-button>
</span>
</glsx-table>
</div>
<div class="content">
<p class="edit-sub-title">直播设置</p>
</div>
</div>
<select-muti-pro-dialog :isMutiSelectVisible="isMutiSelectVisible" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose"></select-muti-pro-dialog>
</div>
</template>
<script>
import selectMutiProDialog from './selectMutiProDialog'
export default {
name: 'liveControl',
data() {
return {
countDown: 0,
timer: null,
liveRoomData: {
tilte: '直播间名字',
time: '2021-9-27 10:00:00',
roomNum: '1',
anchor: '主播名字',
wechat: '微信号'
},
// 导入商品
isMutiSelectVisible: false,
// 商品配置 - 表格
getListApi: '',
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',
tableOption: true,
tableColumns: [
{
label: '商品图片',
prop: 'img',
line: 1,
addHtml: 'showImg'
},
{
label: '商品标题',
prop: '',
line: 1
},
{
label: '商品价格',
prop: ''
},
{
label: '状态',
prop: 'status',
formatter: cellValue => {
return {
0: '下架',
1: '已上架'
}[cellValue.status]
}
},
{
label: '点击次数',
prop: ''
},
{
label: '点击人数',
prop: ''
},
{
label: '点赞次数',
prop: ''
},
{
label: '来源门店',
prop: ''
}
]
},
}
},
components: {
selectMutiProDialog
},
computed: {},
mounted() {
this.countDownTime()
},
beforeDestroy() {
this.timer && clearInterval(this.timer)
this.pushTimer && clearInterval(this.pushTimer)
},
methods: {
countDownTime() {
clearInterval(this.timer)
if (new Date() < new Date(this.liveRoomData.time)) {
this.timer = setInterval(() => {
var leftTime = new Date(this.liveRoomData.time) - new Date()
//计算剩余的天数
var days = parseInt(leftTime / 1000 / 60 / 60 / 24, 10)
//计算剩余的小时
var hours = parseInt((leftTime / 1000 / 60 / 60) % 24, 10)
//计算剩余的分钟
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 + '秒'
this.countDownTime()
}, 1000)
}
},
//将0-9的数字前面加上0,例1变为01
checkTime(i) {
if (i < 10) {
i = '0' + i
}
return i
},
beforeConfigSearchFn() {
return new Promise(resolve => {
resolve()
})
},
handlePush(id) {
if (!this.targetId) {
this.targetId = id
this.pushTimeDown()
}
},
pushTimeDown() {
clearInterval(this.pushTimer)
if (this.pushCountDown != 60) {
this.pushTimer = setInterval(() => {
this.pushCountDown++
this.pushTimeDown()
}, 1000)
} else {
this.targetId = ''
this.pushCountDown = 0
}
},
handleImportPro() {
this.isMutiSelectVisible = !this.isMutiSelectVisible
},
handleMutiSelectConfirm(selectData) {},
handleMutiSelectClose() {
this.handleImportPro()
}
}
}
</script>
<style>
.live-control {
padding: 20px;
}
.live-control p {
margin: 0 0 10px 0;
color: #666666;
}
.live-control .box {
padding: 10px;
border: 1px solid #cccccc;
}
.live-control .flex {
display: flex;
}
.live-control .head-box {
padding: 16px 0;
}
.live-control .head-box .head-img {
width: 200px;
height: 160px;
padding-right: 20px;
}
</style>
<!-- 直播间列表 -->
<template>
<div class="live-room">
<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="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<div>
<el-button :size="size" type="primary" class="el-icon-plus" @click="handleEdit(1)">新增</el-button>
</div>
<glsx-table ref="liveRoomRef" :searchForm="searchForm" :tableParams="tableParams" :tableData="tableData" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<span slot="showImg" slot-scope="scope">
<img style="width: 100px; height: 100px;" :src="scope.scope.img" />
</span>
<span slot="auth-button" slot-scope="scope" :data="scope.scope">
<el-button type="text" @click="handleDetail(scope.scope)">控制台</el-button>
<el-button type="text" @click="handleShare(scope.scope)">分享</el-button>
<el-button type="text" @click="handleEdit(2, scope.scope)">编辑</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</span>
</glsx-table>
<glsx-dialog title="分享" width="620px" :isVisible="isShareVisible" :noCancel="noCancel" @closeDialog="handleShareClose" @confirmDialog="handleShareClose">
<div class="share-dialog">
<div class="flex">
<div class="flex box poster">
<div>
<p>直播间分享海报</p>
<p>小程序码不带参数</p>
<el-button :size="size">保存图片</el-button>
</div>
<img src="https://img0.baidu.com/it/u=2322199322,1491298297&fm=26&fmt=auto" />
</div>
<div class="flex box poster">
<div>
<p>直播间小程序码</p>
<p>小程序码不带参数</p>
<el-button :size="size">保存图片</el-button>
</div>
<img src="https://img0.baidu.com/it/u=2322199322,1491298297&fm=26&fmt=auto" />
</div>
</div>
<div class="box page-route">
<div>
<p>直播间页面路径</p>
<p>www</p>
<el-button :size="size">复制链接</el-button>
<p>链接是直播间原始页面路径,如需加入参数,详见使用方法</p>
</div>
</div>
</div>
</glsx-dialog>
</div>
</template>
<script>
import glsxDialog from '@/components/glsx-dialog'
export default {
name: 'liveRoom',
data() {
return {
size: 'mini',
searchForm: {
name: ''
},
tableData: [
{
time: '2021-10-01',
title: '直播间名称',
roomNum: '1001',
name: '主播',
img: 'https://img2.baidu.com/it/u=4276914015,335466661&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
status: '1'
}
],
// 分享 - 弹窗
isShareVisible: false,
noCancel: true,
// 表格组件
getListApi: '',
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '最近开播',
prop: 'time'
},
{
label: '直播间名称',
prop: 'title'
},
{
label: '房间号',
prop: 'roomNum'
},
{
label: '主播',
prop: 'name'
},
{
label: '直播间图片',
prop: 'img',
line: 1,
addHtml: 'showImg'
},
{
label: '直播状态',
prop: 'status',
formatter: cellValue => {
return {
0: '未开始',
1: '已结束',
2: '过期',
3: '直播中'
}[cellValue.status]
}
}
]
}
}
},
components: {
glsxDialog
},
mounted() {},
methods: {
beforeSearchFn() {
return new Promise(resolve => {
resolve()
})
},
handleShare(row) {
this.isShareVisible = !this.isShareVisible
},
handleShareClose() {
this.handleShare()
},
handleDetail(row) {
this.$router.push({
name: 'liveControl'
})
},
handleDelete(row) {
this.$messageBox.alert('是否删除该直播间?', '删除', {
confirmButtonText: '确定',
type: 'error',
callback: action => {
this.$message({
type: 'success',
message: '操作成功'
})
}
})
},
// 1-新增;2-编辑
handleEdit(addOrEdit, row) {
this.$router.push({
name: 'editLiveRoom',
params: {
addOrEdit: addOrEdit,
row: row || {}
}
})
},
handleSearch() {
// this.$refs.liveRoomRef.refreshTable()
}
}
}
</script>
<style>
.live-room .flex {
display: flex;
justify-content: space-between;
}
.live-room .share-dialog .box {
background: #f7f7f7;
border-radius: 6px;
padding: 30px;
}
.live-room .share-dialog .poster img {
width: 100px;
height: 150px;
margin-left: 10px;
}
.live-room .share-dialog .page-route {
margin-top: 16px;
}
</style>
<!-- 关联门店弹窗 -->
<template>
<glsx-dialog
title="关联门店"
:isVisible.sync="relateStoreVisible"
width="70%"
btnOkLabel="关联"
@confirmDialog="handleRelateStoreConfirm"
@closeDialog="handleRelateStoreClose"
class="relateStore"
>
<slot></slot>
<el-row>
<el-col :span="12">
<el-table
ref="seletingTable"
:data="selectingData"
height="464px"
class="table"
border
@select="handleChange"
@select-all="handleAll"
>
<el-table-column
type="selection"
width="55"
align="center"
:selectable="selectable"
></el-table-column>
<el-table-column
v-if="sourcePage != 'serviceStore'"
prop="yqMerchantName"
label="园区店名称"
align="center"
>
<template slot-scope="scope">
<span :class="{'red': !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)}">{{scope.row.yqMerchantName}}</span>
</template>
</el-table-column>
<el-table-column
prop="merchantName"
label="4S店名称"
align="center"
>
<template slot-scope="scope">
<span :class="{'red': !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)}">{{scope.row.merchantName}}</span>
<el-tooltip
v-if="!scope.row.isSetUpgradeSettleRule"
popper-class="tooltip-class"
effect="dark"
content="该门店无配置财务分润规则,无法关联!"
placement="top"
>
<span
v-if="!scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)"
class="tip-icon"
>?</span>
</el-tooltip>
</template></el-table-column>
</el-table>
<el-pagination
small
background
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
:page-size="pageSize"
layout="total, prev, pager, next"
:total="total"
></el-pagination>
</el-col>
<el-col :span="12">
<el-table
:data="selectedData"
class="table"
border
height="464px"
>
<el-table-column
v-if="sourcePage != 'serviceStore'"
prop="yqMerchantName"
label="园区店名称"
align="center"
></el-table-column>
<el-table-column
prop="merchantName"
label="4S店名称"
align="center"
></el-table-column>
<el-table-column
label="删除"
align="center"
width="50px"
>
<template slot-scope="scope">
<el-button
class="el-icon-delete"
@click="handleDelete(scope.row)"
type="text"
>
</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</glsx-dialog>
</template>
<script>
import glsxDialog from '@/components/glsx-dialog'
export default {
name: 'relateStoreDialog',
data() {
return {
selectedData: [],
selectingData: [],
needTip: ['editProduct'],
// 分页
total: 0,
currentPage: 1,
pageSize: 20
}
},
props: {
relateStoreVisible: {
type: Boolean,
default: false
},
// 页面来源
sourcePage: {
type: String,
default: ''
},
storeApi: {
type: Function,
default: () => { }
},
storeSelected: {
type: Array,
default: () => []
},
storeSearchForm: {
type: Object,
default: () => { }
}
// 去掉表格中某些字段
// noTableField: {
// type: Array,
// default: () => []
// }
},
components: {
glsxDialog
},
mounted() {
this.selectedData = this.storeSelected
this.getSelectingList()
},
methods: {
selectable(row, index) {
var isSelect = row.hasOwnProperty('beServed') ? !row.beServed : true
if (this.sourcePage === 'editProduct') {
isSelect = row.isSetUpgradeSettleRule
}
return isSelect
},
recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantId)
this.selectingData.forEach(item => {
exitIds.includes(item.merchantId) && this.$refs.seletingTable.toggleRowSelection(item, true)
})
},
getSelectingList() {
this.storeApi({
...this.storeSearchForm,
currentPage: this.currentPage,
pageSize: this.pageSize
}).then(res => {
this.selectingData = res.list
this.total = res.total
this.$nextTick(() => {
this.recoverySelection()
})
})
},
handleChange(selection, row) {
var addOrDelete = !!selection.find(item => item.merchantId === row.merchantId)
addOrDelete
? this.selectedData.push(row)
: (this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId))
},
handleAll(selection) {
this.selectingData.forEach(item => {
var isExit = this.selectedData.findIndex(subItem => subItem.merchantId === item.merchantId)
var isServed = item.hasOwnProperty('beServed') ? item.beServed : false
if (selection.length && (isExit === -1) && !isServed) {
this.selectedData.push(item)
} else if (!selection.length && (isExit !== -1)) {
this.selectedData.splice(isExit, 1)
}
})
},
handleDelete(row) {
this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId)
this.$refs.seletingTable.toggleRowSelection(row)
},
handleCurrentChange(val) {
this.currentPage = val
this.getSelectingList()
},
handleRelateStoreConfirm() {
this.$emit('handleRelateStoreConfirm', this.selectedData)
},
handleRelateStoreClose() {
this.$emit('handleRelateStoreClose')
}
}
}
</script>
<style>
.relateStore .table {
margin: 0 auto 20px !important;
width: 98%;
}
.service-store .relateStore .el-table .cell,
.d2-form .relateStore .el-table .cell {
line-height: 26px !important;
}
.service-store .relateStore .el-table--medium td,
.d2-form .relateStore .el-table--medium td {
padding: 6px 8px !important;
}
.relateStore .red {
color: red;
}
.relateStore .tip-icon {
position: absolute;
display: inline-block;
height: 10px;
width: 10px;
line-height: 10px;
color: #ffffff;
background-color: red;
border: 1px solid red;
border-radius: 50%;
cursor: pointer;
font-size: 6px;
margin-left: 2px;
}
</style>
<!-- 选择商品弹窗 -->
<template>
<glsx-dialog
class="muti-pro"
title="选择商品"
:isVisible.sync="isMutiSelectVisible"
width="70%"
@confirmDialog="handleMutiSelectConfirm"
@closeDialog="handleMutiSelectClose"
>
<glsx-table
ref="mutiProRef"
:searchForm="searchForm"
:tableParams="tableParams"
:tableData="tableData"
:pageConf="pageConf"
:beforeSearchFn="beforeSearchFn"
></glsx-table>
</glsx-dialog>
</template>
<script>
import glsxDialog from '@/components/glsx-dialog'
export default {
name: 'selectMutiProDialog',
data() {
return {
// 表格组件
getListApi: '',
tableData: [{
id: 1,
name: '商品名称1'
}, {
id: 2,
name: '商品名称2'
}],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'id',
// 多选ref的名称
mutiSelectName: 'list',
tableOption: true,
tableColumns: [{
label: '商品名称',
prop: 'name'
}, {
label: '缩略图',
prop: 'title'
}, {
label: '价格(元)',
prop: 'status'
}, {
label: '来源门店',
prop: ''
}]
}
}
},
props: {
isMutiSelectVisible: {
type: Boolean,
default: false
}
},
components: {
glsxDialog
},
mounted() { },
methods: {
handleMutiSelectConfirm() {
var selectedData = this.$refs.mutiProRef.mutiSelectArr[this.tableParams.mutiSelectName]
console.log(selectedData)
this.$emit('handleMutiSelectConfirm', selectedData)
},
handleMutiSelectClose() {
this.$emit('handleMutiSelectClose')
}
}
}
</script>
<style>
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!