Commit fdf9e632 by 前端

活动记录联调

1 parent 0d1a3246
import { http } from '@/main'
const url = '/rop-scrm-entmicro/router'
// 获取活动记录列表
const getActivityRecord = params => {
params.method = 'entmicro.api.business.activityRecord.page'
return http({
url: url,
method: 'GET',
data: params,
sign: true
})
}
// 新增活动记录列表
const addActivityRecord = params => {
params.method = 'entmicro.api.business.activityRecord.add'
return http({
url: url,
method: 'post',
data: params,
sign: true
})
}
// 更新活动记录列表
const updateActivityRecord = params => {
params.method = 'entmicro.api.business.activityRecord.update'
return http({
url: url,
method: 'post',
data: params,
sign: true
})
}
// 查询活动记录
const getActivityRecordDetail = params => {
params.method = 'entmicro.api.business.activityRecord.detail'
return http({
url: url,
method: 'post',
data: params,
sign: true
})
}
// 删除活动记录
const delActivityRecord = params => {
params.method = 'entmicro.api.business.activityRecord.delete'
return http({
url: url,
method: 'post',
data: params,
sign: true
})
}
export default {
getActivityRecord,
addActivityRecord,
getActivityRecordDetail,
delActivityRecord,
updateActivityRecord
}
......@@ -16,6 +16,18 @@ const staticRoutes = Object.freeze([
component: resolve => require([`@/views/activityRecord/index.vue`], resolve),
meta: {}
},
{
name: 'addRecord',
path: '/activityRecord/addRecord',
component: resolve => require([`@/views/activityRecord/addRecord.vue`], resolve),
meta: {}
},
{
name: 'viewRecord',
path: '/activityRecord/viewRecord',
component: resolve => require([`@/views/activityRecord/viewRecord.vue`], resolve),
meta: {}
},
// 众筹订单
{
......
<template>
<div class="role-home-page">
<div class="top_widget">
<div class="add-btn">
<!-- <GLButton :size="size" fn="创建角色" icon="el-icon-plus" type="primary" @click="toCreatePage" mode="el-button">创建角色</GLButton> -->
<el-button size="small" icon="el-icon-plus" type="primary" @click="toCreatePage">新建活动记录</el-button>
<el-button size="small" icon="el-icon-plus" type="primary" @click="toCreatePage(1)">新增活动记录</el-button>
</div>
<div class="table_widget">
<div>
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" :searchSelectObj="searchSelectObj" @handleOk="toFindData" @handleRest="reSetFindData"></GLCombiForm>
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" :searchSelectObj="searchSelectObj" @handleOk="handleSearch" @handleRest="handleRest"></GLCombiForm>
</div>
<GLTable ref="table" :pageConf="pageConf" :tableParams="tableParams">
<div slot="statusName" class="dot" slot-scope="scope">
<span :class="roleStatus[scope.scope.statusName]"></span>
{{ scope.scope.statusName }}
<GLTable ref="recordTable" :pageConf="pageConf" :getListApi="getListApi" :noDataImg="url" :tableParams="tableParams" :searchForm="searchForm">
<!-- 活动时间 -->
<div slot="activityTime" slot-scope="scope">
<span>{{ scope.scope.beginTime }}至{{ scope.scope.endTime }}</span>
</div>
<!-- 省市 -->
<div slot="province" slot-scope="scope">
<span>{{ scope.scope.province }}-{{ scope.scope.city }}</span>
</div>
<!-- 状态 -->
<div slot="status" class="dot" slot-scope="scope">
<span :class="recordStatus[scope.scope.status]"></span>
{{ scope.scope.status }}
</div>
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope.scope"></GLTableButton>
<!-- <GLTableButton :buttonList="buttonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton> -->
<el-button type="text" @click="toLookPage(scope.scope)">查看</el-button>
<el-button type="text" @click="toCreatePage(2, scope.scope)">编辑</el-button>
<el-button type="text" @click="todelete(scope.scope)">删除</el-button>
</template>
</GLTable>
</div>
</div>
</template>
<script>
const roleStatus = {
const recordStatus = {
正常: 'normal',
草稿: 'draft'
}
......@@ -29,134 +41,147 @@ export default {
name: '',
data() {
return {
roleStatus: roleStatus,
recordStatus: recordStatus,
searchForm: {
activityName: '',
storeName: ''
merchantName: ''
},
searchFormData: [
{
label: '活动名称',
name: 'merchantName',
name: 'activityName',
type: 'input',
isClear: true
},
{
label: '门店名称',
name: 'corpAlias',
name: 'merchantName',
type: 'input',
isClear: true
}
],
//表格配置
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
tableParams: {
tableOption: {
width: '150'
},
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data',
// tableOption: false,
tableColumns: [
{
label: '活动名称',
prop: 'roleName',
prop: 'activityName',
minWidth: '250'
},
{
label: '门店名称',
prop: 'roleCode',
prop: 'merchantName',
minWidth: '220'
},
{
label: '活动时间',
prop: 'statusName',
addHtml: 'activityTime',
prop: 'beginTime',
minWidth: '220'
},
{
label: '省市',
prop: 'createdTime',
addHtml: 'province',
prop: 'province',
minWidth: '180'
},
{
label: '参与人数',
prop: 'updatedTime',
prop: 'participants',
minWidth: '180'
},
{
label: '活动状态',
prop: 'updatedTime',
prop: 'status',
addHtml: 'status',
minWidth: '180'
},
{
label: '操作',
prop: 'auth-button',
width: '180',
addHtml: 'auth-button',
fixed: 'right'
}
]
},
tableData: [
{
id: 1,
activityName: 'dff',
merchantName: 888,
beginTime: '2021-2-2',
endTime: '2021-12-2',
province: 'hunan',
city: 'yiyang',
updatedTime: 2,
status: 1
}
],
buttonList: [
{
type: 'GLButton',
name: row => {
return '查看'
},
name: '查看',
attrs: {
type: 'text',
fn: '查看'
},
condition: row => {
return true
fn: '查看活动记录'
},
listeners: {
click: this.toLookPage
click: row => this.toLookPage(row)
}
},
{
type: 'GLButton',
name: row => {
return '编辑'
},
name: '编辑',
attrs: {
type: 'text',
fn: '编辑'
},
condition: row => {
return true
fn: '新增活动记录'
},
listeners: {
click: this.toEditPage
click: row => this.toCreatePage(2, row)
}
},
{
type: 'el-button',
name: row => {
return '删除'
},
condition: row => {
return row.delFlag
},
name: '删除',
attrs: {
type: 'text'
type: 'text',
fn: '删除活动记录'
},
listeners: {
click: this.todelete
click: row => this.todelete(row)
}
}
],
tableData: [],
merchantList: [],
tableTotal: 0,
accountLevel: 1,
list: [],
distoryTable: true
// 表格
getListApi: this.$apis.record.getActivityRecord
}
},
methods: {
// 查询
toFindData() {
this.getTableData()
},
// 去创建角色页面
toCreatePage() {
this.$router.push('/role/create')
// 去创建/修改页面
toCreatePage(addOrEdit, scope) {
let params = {
addOrEdit: addOrEdit,
$title: encodeURI(addOrEdit == 1 ? '创建活动记录' : '编辑活动记录'),
id: scope ? scope.id : ''
}
this.$router.push({
path: '/activityRecord/addRecord',
query: params
})
},
// 去修改角色页面
toEditPage(row) {
this.$router.push('/role/create/' + row.id)
// 去查看页面
toLookPage(scope) {
let params = {
id: scope.id
}
this.$router.push({
path: '/activityRecord/viewRecord',
query: params
})
},
// 去删除草稿
todelete(row) {
......@@ -166,9 +191,8 @@ export default {
customClass: 'gl-message-box',
type: 'warning'
}).then(() => {
this.$apis.role.deleteRole({ id: row.id }).then(res => {
this.$apis.record.delActivityRecord({ id: row.id }).then(res => {
if (res) {
this.getTableData()
this.$message({
type: 'success',
message: '删除成功!'
......@@ -176,11 +200,24 @@ export default {
}
})
})
},
handleRest() {
this.searchForm = {
activityName: '',
merchantName: ''
}
this.handleSearch()
},
handleSearch() {
this.$refs.recordTable.refreshTable()
}
}
}
</script>
<style lang="scss" scoped>
.add-btn {
margin-bottom: 16px;
}
.role-home-page {
box-sizing: border-box;
display: flex;
......
<template>
<div>
<div class="record-box">
<div class="title">活动记录</div>
<div class="record-form">
<div class="record-flex record-center record-bottom">
<div class="record-type">活动ID:</div>
<div class="record-text">{{ recordForm.crowdFundActivityId }}</div>
<el-button size="small" type="primary">更新数据</el-button>
</div>
<!-- 活动详情 -->
<div class="activity-detail">
<div class="activity-detail-left">
<div class="activity-detail-content activity-bottom">
<div class="activity-title">活动名称:</div>
<div class="activity-content">{{ recordForm.activityName }}</div>
</div>
<div class="activity-detail-content">
<div class="activity-title">活动地址:</div>
<div class="activity-content">{{ recordForm.province }}-{{ recordForm.city }}</div>
</div>
</div>
<div class="activity-detail-right">
<div class="activity-detail-content activity-bottom">
<div class="activity-title">主办方:</div>
<div class="activity-content">{{ recordForm.merchantName }}</div>
</div>
<div class="activity-detail-content">
<div class="activity-title">活动时间:</div>
<div class="activity-content">{{ recordForm.beginTime }}-{{ recordForm.endTime }}</div>
</div>
</div>
</div>
<div class="record-flex">
<div class="record-type">活动介绍:</div>
<div>{{ recordForm.activityEvent }}</div>
</div>
</div>
</div>
<div class="record-box">
<div class="title">活动素材</div>
<div class="record-form">
<div class="record-flex record-bottom">
<div class="record-type">活动视频:</div>
<div v-if="recordForm.videoUrl">
<div class="video-box">
<video width="100%" height="100%" preload loop muted>
<source :src="recordForm.videoUrl" type="video/mp4" />
</video>
<div class="mask">
<div class="video-pane-close" @click="handleEnlarge(recordForm.videoUrl, 'video')">
<img src="../../assets/material/view.png" alt="" />
</div>
</div>
</div>
</div>
</div>
<div class="record-flex">
<div class="record-type">活动图片:</div>
<div class="record-flex" v-if="recordForm.imageUrl && recordForm.imageUrl.length > 0">
<div v-for="(item, index) in recordForm.imageUrl" :key="index">
<div class="video-box">
<img class="photo-activity" :src="item" alt="" />
<div class="mask">
<div class="video-pane-close" @click="handleEnlarge(item)">
<img src="../../assets/material/view.png" alt="" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="record-flex">
<el-button class="back-btn" size="medium" type="primary" @click="goback">返回</el-button>
</div>
<el-dialog class="image-dialog" :visible.sync="dialogVisibleImg" width="50%">
<img :src="dialogSrc" width="100%" v-if="dialogType == 'img'" />
<video width="100%" autoplay controls :src="dialogSrc" v-else></video>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
recordForm: {
name: '',
desc: '',
imageUrl: ['https://scrm.test.glsx.com.cn/group1/M00/03/60/wKgD3mOfzE2AWDPFAABLPhZhrpM684.png', 'https://scrm.test.glsx.com.cn/group1/M00/03/60/wKgD3mOfzE2AWDPFAABLPhZhrpM684.png'],
videoUrl: 'https://scrm.test.glsx.com.cn/group1/M00/03/5E/wKgD3mOcNtuAAF2VAAjFv3YDi0M222.mp4'
},
dialogVisibleImg: false
}
},
created() {
this.routeInfo = this.$route.query
this.getActivityRecordDetail(this.routeInfo.id)
},
methods: {
// 获取活动记录详情
getActivityRecordDetail(id) {
this.$apis.record.getActivityRecordDetail({ Id: id }).then(res => {
console.log(res)
if (res) {
this.recordForm = res
this.recordForm.imageUrl = this.recordForm.imageUrl.split(',')
}
console.log(this.recordForm, '==')
})
},
// 预览图文
handleEnlarge(src, type) {
this.dialogVisibleImg = true
this.dialogSrc = src
this.dialogType = type ? type : 'img'
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style lang="scss" scoped>
.record-box {
width: 100%;
background-color: #fff;
margin-bottom: 16px;
}
.title {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 16px;
padding: 15px 0 15px 20px;
border-bottom: 1px solid #d8d8d8;
}
.record-form {
padding: 32px 0;
}
.record-flex {
display: flex;
}
.record-center {
align-items: center;
}
.record-bottom {
margin-bottom: 10px;
}
.record-text {
margin-right: 20px;
}
.back-btn {
margin: auto;
}
.record-introducer {
display: flex;
padding-right: 100px;
&-left {
width: 665px;
text-align: right;
}
}
.record-type {
width: 154px;
text-align: right;
}
.activity-detail {
display: flex;
justify-content: space-around;
margin: 0 0 20px 154px;
background: #f9f9f9;
padding: 20px 0;
max-width: 600px;
&-content {
display: flex;
.activity-title {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #666666;
}
.activity-content {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
.activity-bottom {
margin-bottom: 20px;
}
}
.video-box {
position: relative;
width: 104px;
height: 104px;
border-radius: 4px;
margin-right: 8px;
&:hover .mask {
opacity: 1;
}
.video {
position: absolute;
object-fit: fill;
}
.photo-activity {
position: absolute;
width: 104px;
height: 104px;
}
.mask {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
background: rgba(0, 0, 0, 0.5);
color: #ffffff;
opacity: 0;
top: 0;
right: 0;
width: 100%;
height: 100%;
z-index: 999;
.video-pane-close {
width: 14px;
height: 14px;
cursor: pointer;
margin-right: 8px;
}
}
}
.image-dialog {
/deep/ {
.el-dialog__header {
border-bottom: 0px;
padding: 0px;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!