<template>
|
<!--
|
作者:yj
|
时间:2022-05-26
|
描述:插件中心-活动-列表
|
-->
|
<div>
|
<div class="common-level-rail"><el-button size="small" type="primary" icon="el-icon-plus" @click="add">添加活动</el-button></div>
|
<div class="table-wrap">
|
<el-table :data="tableData" style="width: 100%" v-loading="loading">
|
<el-table-column prop="activity_id" label="活动ID" width="60"></el-table-column>
|
<el-table-column prop="address" label="封面" width="50">
|
<template slot-scope="scope">
|
<img v-img-url="'image.file_path',scope.row" width="30" height="30" />
|
</template>
|
</el-table-column>
|
<el-table-column prop="activity_title" label="活动标题">
|
<template slot-scope="scope">
|
<div class="text-ellipsis" :title="scope.row.activity_title">{{scope.row.activity_title}}</div>
|
</template>
|
</el-table-column>
|
<el-table-column prop="category.name" label="活动分类" width="120"></el-table-column>
|
<el-table-column prop="activity_fee" label="活动费用" width="100"></el-table-column>
|
<el-table-column prop="limit_num" label="活动名额" width="100"></el-table-column>
|
<el-table-column prop="register_time_text" label="报名时间" width="280">
|
<template slot-scope="scope">
|
<div class="text-ellipsis" :title="scope.row.register_time_text">{{scope.row.register_time_text}}</div>
|
</template>
|
</el-table-column>
|
<el-table-column prop="activity_time_text" label="活动时间" width="280">
|
<template slot-scope="scope">
|
<div class="text-ellipsis" :title="scope.row.activity_time_text">{{scope.row.activity_time_text}}</div>
|
</template>
|
</el-table-column>
|
<!-- <el-table-column prop="activity_sort" label="排序" width="100"></el-table-column> -->
|
<el-table-column prop="register_status" label="报名状态" width="100">
|
<template slot-scope="scope">
|
<span v-if="scope.row.register_status == 1" class="green">开启</span>
|
<span v-if="scope.row.register_status == 0" class="gray">关闭</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="activity_status" label="活动状态" width="100">
|
<template slot-scope="scope">
|
<span v-if="scope.row.activity_status == 1" class="green">启用</span>
|
<span v-if="scope.row.activity_status == 0" class="gray">关闭</span>
|
</template>
|
</el-table-column>
|
<!-- <el-table-column prop="create_time" label="添加时间" width="140"></el-table-column> -->
|
<el-table-column prop="name" label="操作" width="90">
|
<template slot-scope="scope">
|
<el-button @click="viewAct(scope.row)" type="text" size="small">报名记录</el-button>
|
<el-button @click="editAct(scope.row)" type="text" size="small">编辑</el-button>
|
<el-button @click="deleteAct(scope.row)" type="text" size="small">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<!--分页-->
|
<div class="pagination">
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
background
|
:current-page="curPage"
|
:page-size="pageSize"
|
layout="total, prev, pager, next, jumper"
|
:total="totalDataNumber"
|
></el-pagination>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import RegApi from '@/api/regactivity.js';
|
export default {
|
components: {},
|
data() {
|
return {
|
/*分类*/
|
categoryData: [],
|
/*表单数据*/
|
tableData: [],
|
/*是否打开添加弹窗*/
|
open_add: false,
|
/*是否打开编辑弹窗*/
|
open_edit: false,
|
/*当前编辑的对象*/
|
userModel: {},
|
commentData: [],
|
loading: true,
|
/*一页多少条*/
|
pageSize: 20,
|
/*一共多少条数据*/
|
totalDataNumber: 0,
|
/*当前是第几页*/
|
curPage: 1
|
};
|
},
|
created() {
|
/*获取列表*/
|
this.getTableList();
|
},
|
methods: {
|
|
/*获取活动列表*/
|
getTableList() {
|
let self = this;
|
let Params = {};
|
Params.page = self.curPage;
|
Params.list_rows = self.pageSize;
|
RegApi.getList(Params, true)
|
.then(data => {
|
self.loading = false;
|
self.tableData = data.data.list.data;
|
self.totalDataNumber = data.data.list.total;
|
})
|
.catch(error => {
|
self.loading = false;
|
});
|
},
|
|
/*添加*/
|
add() {
|
this.$router.push({
|
path: '/plus/regactivity/regactivity/add'
|
});
|
},
|
|
/*编辑*/
|
editAct(row) {
|
let params = row.activity_id;
|
this.$router.push({
|
path: '/plus/regactivity/regactivity/edit',
|
query: {
|
activity_id: params
|
}
|
});
|
},
|
|
/*报名记录*/
|
viewAct(row) {
|
let params = row.activity_id;
|
this.$router.push({
|
path: '/plus/regactivity/user/User',
|
query: {
|
activity_id: params
|
}
|
});
|
},
|
|
|
/*选择第几页*/
|
handleCurrentChange(val) {
|
let self = this;
|
self.curPage = val;
|
self.loading = true;
|
self.getTableList();
|
},
|
|
/*每页多少条*/
|
handleSizeChange(val) {
|
this.curPage = 1;
|
this.pageSize = val;
|
this.getTableList();
|
},
|
|
/*删除*/
|
deleteAct(row) {
|
let self = this;
|
self
|
.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
self.loading = true;
|
RegApi.delete(
|
{
|
activity_id: row.activity_id
|
},
|
true
|
)
|
.then(data => {
|
self.$message({
|
message: data.msg,
|
type: 'success'
|
});
|
self.loading = false;
|
self.getTableList();
|
})
|
.catch(error => {});
|
})
|
.catch(() => {});
|
},
|
|
/*删除分类*/
|
deleteCategory(row) {
|
let self = this;
|
self
|
.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
RegApi.deleteCategory(
|
{
|
category_id: row.category_id
|
},
|
true
|
)
|
.then(data => {
|
self.$message({
|
message: data.msg,
|
type: 'success'
|
});
|
self.getTableList();
|
})
|
.catch(error => {});
|
})
|
.catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
handleClick(tab, event) {},
|
|
/*打开分类添加*/
|
addCategory() {
|
this.open_add = true;
|
},
|
|
/*打开分类编辑*/
|
editCategory(item) {
|
this.userModel = item;
|
this.open_edit = true;
|
},
|
|
/*关闭弹窗*/
|
closeDialogFunc(e, f) {
|
if (f == 'add') {
|
this.open_add = e.openDialog;
|
if (e.type == 'success') {
|
this.getTableList();
|
}
|
}
|
if (f == 'edit') {
|
this.open_edit = e.openDialog;
|
if (e.type == 'success') {
|
this.getTableList();
|
}
|
}
|
}
|
}
|
};
|
</script>
|
|
<style></style>
|