Commit 7f3f4c8c authored by denghr's avatar denghr

活动列表

parent 6185dd1f
...@@ -21,4 +21,16 @@ export function getObj(id) { ...@@ -21,4 +21,16 @@ export function getObj(id) {
url: '/api/activity/management/getOne/'+id, url: '/api/activity/management/getOne/'+id,
method: 'Get' method: 'Get'
}) })
}
/**
* 编辑某一条数据
* @param query
*/
export function editObj(data) {
return fetch({
url: '/api/activity/management/update',
method: 'put',
data: data
})
} }
\ No newline at end of file
<template> <template>
<div class="app-container calendar-list-container" v-loading.body="showLoadingBody"> <div class="app-container calendar-list-container" v-loading.body="showLoadingBody">
<div> <div>
<el-table :key='tableKey' :data="list" border fit highlight-current-row <el-table :key='tableKey' :data="list" border fit highlight-current-row style="width: 100%;">
style="width: 100%;">
<el-table-column type="index" align="center" label="活动ID" width="100"> <el-table-column type="index" align="center" label="活动ID" width="100">
<template scope="scope"> <template scope="scope">
<span>{{scope.row.id}}</span> <span>{{scope.row.id}}</span>
...@@ -77,7 +76,7 @@ ...@@ -77,7 +76,7 @@
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="add('form')">确认</el-button> <el-button type="primary" @click="update('form')">确定</el-button>
</div> </div>
</el-dialog> </el-dialog>
...@@ -85,14 +84,13 @@ ...@@ -85,14 +84,13 @@
<el-dialog title="活动数据" :visible.sync="newPeopelDataVisible"> <el-dialog title="活动数据" :visible.sync="newPeopelDataVisible">
<el-form :model="newPeopelDataQuery" style="margin-bottom:20px"> <el-form :model="newPeopelDataQuery" style="margin-bottom:20px">
<el-row> <el-row>
<el-date-picker v-model="newPeopelDataQuery.starTimeStr" type = "datetime" placeholder = "开始时间" value-format=" yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" :picker-options="newPeopelpickerOptionsStart"></el-date-picker> <el-date-picker v-model="newPeopelDataQuery.starTimeStr" type = "datetime" placeholder = "开始时间" value-format=" yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm"></el-date-picker>
<span> - </span> <span> - </span>
<el-date-picker v-model="newPeopelDataQuery.endTimeStr" type = "datetime" placeholder = "结束时间" value-format=" yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" :picker-options="newPeopelpickerOptionsEnd"></el-date-picker> <el-date-picker v-model="newPeopelDataQuery.endTimeStr" type = "datetime" placeholder = "结束时间" value-format=" yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" :picker-options="newPeopelpickerOptionsEnd"></el-date-picker>
<el-button class="filter-item" type="primary" v-waves icon="search" @click="handleFilter">搜索</el-button> <el-button class="filter-item" type="primary" v-waves icon="search" @click="handleNewPeopelFilter" style="margin-left:20px">搜索</el-button>
</el-row> </el-row>
</el-form> </el-form>
<el-table :key='tableKey' :data="list" border fit highlight-current-row <el-table :key='newPeopeltableKey' :data="list" border fit highlight-current-row style="width: 100%;">
style="width: 100%;">
<el-table-column type="index" align="center" label="数据描述" width="200"> <el-table-column type="index" align="center" label="数据描述" width="200">
<template scope="scope"> <template scope="scope">
<span>{{scope.row.id}}</span> <span>{{scope.row.id}}</span>
...@@ -125,7 +123,7 @@ ...@@ -125,7 +123,7 @@
<div class="pagination-container"> <div class="pagination-container">
<el-pagination @size-change="newPeopelDataSizeChange" @current-change="newPeopelDataCurrentChange" <el-pagination @size-change="newPeopelDataSizeChange" @current-change="newPeopelDataCurrentChange"
:current-page.sync="newPeopelDataQuery.page" :page-sizes="[10,20,30,40,50]" :page-size="newPeopelDataQuery.limit" :current-page.sync="newPeopelDataQuery.page" :page-sizes="[10,20,30,40,50]" :page-size="newPeopelDataQuery.limit"
layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination> layout="total, sizes, prev, pager, next, jumper" :total="newPeopelDataTotal"></el-pagination>
</div> </div>
</el-dialog> </el-dialog>
...@@ -134,14 +132,13 @@ ...@@ -134,14 +132,13 @@
<el-dialog title="活动数据" :visible.sync="shareDataVisible"> <el-dialog title="活动数据" :visible.sync="shareDataVisible">
<el-form :model="shareDataQuery" style="margin-bottom:20px"> <el-form :model="shareDataQuery" style="margin-bottom:20px">
<el-row> <el-row>
<el-date-picker v-model="shareDataQuery.starTimeStr" type = "datetime" placeholder = "开始时间" value-format=" yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" :picker-options="shareDatapickerOptionsStart"></el-date-picker> <el-date-picker v-model="shareDataQuery.starTimeStr" type = "datetime" placeholder = "开始时间" value-format=" yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm"></el-date-picker>
<span> - </span> <span> - </span>
<el-date-picker v-model="shareDataQuery.endTimeStr" type = "datetime" placeholder = "结束时间" value-format=" yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" :picker-options="shareDatapickerOptionsEnd"></el-date-picker> <el-date-picker v-model="shareDataQuery.endTimeStr" type = "datetime" placeholder = "结束时间" value-format=" yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" :picker-options="shareDatapickerOptionsEnd"></el-date-picker>
<el-button class="filter-item" type="primary" v-waves icon="search" @click="handleFilter">搜索</el-button> <el-button class="filter-item" type="primary" v-waves icon="search" @click="handleShareDataFilter" style="margin-left:20px">搜索</el-button>
</el-row> </el-row>
</el-form> </el-form>
<el-table :key='tableKey' :data="list" border fit highlight-current-row <el-table :key='shareDatatableKey' :data="list" border fit highlight-current-row style="width: 100%;">
style="width: 100%;">
<el-table-column type="index" align="center" label="数据描述" width="200"> <el-table-column type="index" align="center" label="数据描述" width="200">
<template scope="scope"> <template scope="scope">
<span>{{scope.row.id}}</span> <span>{{scope.row.id}}</span>
...@@ -174,7 +171,7 @@ ...@@ -174,7 +171,7 @@
<div class="pagination-container"> <div class="pagination-container">
<el-pagination @size-change="shareDataSizeChange" @current-change="shareDataCurrentChange" <el-pagination @size-change="shareDataSizeChange" @current-change="shareDataCurrentChange"
:current-page.sync="shareDataQuery.page" :page-sizes="[10,20,30,40,50]" :page-size="shareDataQuery.limit" :current-page.sync="shareDataQuery.page" :page-sizes="[10,20,30,40,50]" :page-size="shareDataQuery.limit"
layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination> layout="total, sizes, prev, pager, next, jumper" :total="shareDataTotal"></el-pagination>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
...@@ -202,7 +199,8 @@ ...@@ -202,7 +199,8 @@
} from 'utils/auth'; } from 'utils/auth';
import { import {
activityList, activityList,
getObj getObj,
editObj
} from 'api/activityManagement'; } from 'api/activityManagement';
import Element1 from "../admin/menu/components/element"; import Element1 from "../admin/menu/components/element";
import ElRow from "element-ui/packages/row/src/row"; import ElRow from "element-ui/packages/row/src/row";
...@@ -219,10 +217,8 @@ ...@@ -219,10 +217,8 @@
return { return {
rules:{ rules:{
numLimit: { numLimit: {
type: 'string',
required: true, required: true,
message: '请输入参与人数', message: '请输入参与人数',
trigger: 'blur'
} }
}, },
newPeopelVisible:false, newPeopelVisible:false,
...@@ -232,6 +228,10 @@ ...@@ -232,6 +228,10 @@
showLoadingBody: false, showLoadingBody: false,
list: null, list: null,
total: null, total: null,
shareDataList : null,
shareDataTotal : null,
newPeopelDataList : null,
newPeopelDataTotal : null,
listLoading: true, listLoading: true,
listQuery: { listQuery: {
page: 1, page: 1,
...@@ -251,7 +251,10 @@ ...@@ -251,7 +251,10 @@
}, },
inline: true, inline: true,
tableKey: 0, tableKey: 0,
newPeopeltableKey:1,
shareDatatableKey:2,
formdata:{}, formdata:{},
//编辑
pickerOptionsStart: { pickerOptionsStart: {
disabledDate(time) { disabledDate(time) {
return time.getTime() < Date.now() - 8.64e7; return time.getTime() < Date.now() - 8.64e7;
...@@ -265,6 +268,7 @@ ...@@ -265,6 +268,7 @@
} }
} }
}, },
//邀请有礼活动数据弹窗
shareDatapickerOptionsStart:{ shareDatapickerOptionsStart:{
disabledDate(time) { disabledDate(time) {
return time.getTime() < Date.now() - 8.64e7; return time.getTime() < Date.now() - 8.64e7;
...@@ -278,6 +282,7 @@ ...@@ -278,6 +282,7 @@
} }
} }
}, },
//新人活动数据弹窗
newPeopelpickerOptionsStart:{ newPeopelpickerOptionsStart:{
disabledDate(time) { disabledDate(time) {
return time.getTime() < Date.now() - 8.64e7; return time.getTime() < Date.now() - 8.64e7;
...@@ -332,18 +337,89 @@ ...@@ -332,18 +337,89 @@
this.listQuery.page = val; this.listQuery.page = val;
this.getList(); this.getList();
}, },
//新人活动-活动数据弹窗
handleNewPeopelFilter() {
this.newPeopelDataQuery.page = 1;
this.getNewPeopelDataList();
},
newPeopelDataSizeChange(val) { newPeopelDataSizeChange(val) {
this.newPeopelDataQuery.limit = val; this.newPeopelDataQuery.limit = val;
this.getNewPeopelDataList();
}, },
newPeopelDataCurrentChange(val) { newPeopelDataCurrentChange(val) {
this.newPeopelDataQuery.page = val; this.newPeopelDataQuery.page = val;
this.getNewPeopelDataList();
},
getNewPeopelDataList(){
var that =this;
this.listLoading = true;
if(this.newPeopelDataQuery.starTimeStr||this.newPeopelDataQuery.endTimeStr){
if(new Date(this.newPeopelDataQuery.endTimeStr).getTime()<new Date(this.newPeopelDataQuery.starTimeStr).getTime()){
this.$notify({
title: '警告',
message: '结束时间不能小于起始时间',
type: 'warning',
duration: 2000
});
this.listLoading = false;
return false;
}
}
// activityList(this.listQuery).then(response => {
// let totalCountRs = undefined;
// let listRs = undefined;
// if (!this.$utils.isEmpty(response.data.list) && this.$utils.isInteger(response.data.total)) {
// listRs = response.data.list;
// totalCountRs = response.data.total;
// }
// this.listLoading = false;
// this.newPeopelDataList = listRs;
// this.newPeopelDataTotal = totalCountRs;
// })
},
//邀请有礼-活动数据弹窗
handleShareDataFilter() {
this.shareDataQuery.page = 1;
this.getShareDataList();
}, },
shareDataSizeChange(val) { shareDataSizeChange(val) {
this.shareDataQuery.limit = val; this.shareDataQuery.limit = val;
this.getShareDataList();
}, },
shareDataCurrentChange(val) { shareDataCurrentChange(val) {
this.shareDataQuery.page = val; this.shareDataQuery.page = val;
this.getShareDataList();
}, },
getShareDataList(){
var that =this;
this.listLoading = true;
if(this.shareDataQuery.starTimeStr||this.shareDataQuery.endTimeStr){
if(new Date(this.shareDataQuery.endTimeStr).getTime()<new Date(this.shareDataQuery.starTimeStr).getTime()){
this.$notify({
title: '警告',
message: '结束时间不能小于起始时间',
type: 'warning',
duration: 2000
});
this.listLoading = false;
return false;
}
}
// activityList(this.listQuery).then(response => {
// let totalCountRs = undefined;
// let listRs = undefined;
// if (!this.$utils.isEmpty(response.data.list) && this.$utils.isInteger(response.data.total)) {
// listRs = response.data.list;
// totalCountRs = response.data.total;
// }
// this.listLoading = false;
// this.shareDataList = listRs;
// this.shareDataTotal = totalCountRs;
// })
},
handleUpdate(row){ handleUpdate(row){
var that = this; var that = this;
getObj(row.id).then(response => { getObj(row.id).then(response => {
...@@ -368,12 +444,68 @@ ...@@ -368,12 +444,68 @@
handleActivityData(row){ handleActivityData(row){
// 1--新人尊享; 2--推广活动表 // 1--新人尊享; 2--推广活动表
if(row.type==1){ if(row.type==1){
this.newPeopelDataQuery={
page: 1,
limit: 20,
starTimeStr:'',
endTimeStr:''
}
this.newPeopelDataVisible = true; this.newPeopelDataVisible = true;
} }
if(row.type==2){ if(row.type==2){
this.shareDataQuery={
page: 1,
limit: 20,
starTimeStr:'',
endTimeStr:''
}
this.shareDataVisible = true; this.shareDataVisible = true;
} }
} },
/**
* 编辑-更新
* */
update(formName) {
let that = this;
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
that.formdata.status = that.formdata.status_name=='上架'?1:that.formdata.status_name=='下架'?2:'';
that.formdata.startTime = new Date(this.formdata.starTimeStr).getTime();
that.formdata.endTime = new Date(this.formdata.endTimeStr).getTime();
if(new Date(this.formdata.endTimeStr).getTime()<new Date(this.formdata.starTimeStr).getTime()){
this.$notify({
title: '警告',
message: '结束时间不能小于起始时间',
type: 'warning',
duration: 2000
});
return false;
}
editObj(this.formdata).then(response => {
if (response.status === 200) {
this.newPeopelVisible = false;
this.getList();
this.$notify({
title: '成功',
message: '编辑成功',
type: 'success',
duration: 2000
});
} else {
this.$notify({
title: '失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
} else {
return false;
}
});
},
} }
} }
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment