bibi 3 years ago
parent f6f13ff574
commit 94735ef4ae

@ -32,7 +32,14 @@ export function cateUpdate(params) {
} }
export function cateInsert(params) { export function cateInsert(params) {
return httpService({ return httpService({
url: `/user/shopCategory/insertCategory`, url: `/user/shopCategory/insert`,
method: 'post',
data: params,
})
}
export function cateDel(params) {
return httpService({
url: `/user/shopCategory/delete`,
method: 'post', method: 'post',
data: params, data: params,
}) })

@ -0,0 +1,18 @@
import httpService from "@/request"
// 获取任务设置
export function getSetting(params) {
return httpService({
url: `/user/pointsSetting/earnPointsSettingInfo`,
method: 'get',
params: params,
})
}
// 保存任务设置
export function Setting(params) {
return httpService({
url: `/user/pointsSetting/savePintsSetting`,
method: 'post',
data: params,
})
}

@ -57,7 +57,7 @@ const router = [
name: "payment", name: "payment",
title: "缴费管理", title: "缴费管理",
component: Layout, component: Layout,
redirect: '/', redirect: '/ChargeStandardManage',
meta: {title: '缴费管理'}, meta: {title: '缴费管理'},
children: [ children: [
...payment, ...payment,

@ -6,4 +6,42 @@
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /LittleBeeSaas/src/router/payment.js * @FilePath: /LittleBeeSaas/src/router/payment.js
*/ */
export default [] export default [
{
path: '/ChargeStandardManage',
name: "ChargeStandardManage",
title: "收费标准管理",
icon: 'form',
hide: false,
component: resolve => require(['@/views/Payment/ChargeStandardManage'], resolve),
meta: {title: '收费标准管理'},
},
// {
// path: '/Activity',
// name: "Activity",
// title: "活动",
// icon: 'notification',
// hide: false,
// component: resolve => require(['@/views/Operation/Activity'], resolve),
// redirect: '/Activity/ActivityManage',
// meta: {title: '活动'},
// children: [
// {
// path: '/Activity/ActivityManage',
// name: "ActivityManage",
// title: "活动管理",
// hide: false,
// component: resolve => require(['@/views/Operation/Activity/_activityManage'], resolve),
// meta: {title: '活动管理'},
// },
// {
// path: '/Activity/Organizers',
// name: "Organizers",
// title: "活动主办方",
// hide: false,
// component: resolve => require(['@/views/Operation/Activity/_organizers'], resolve),
// meta: {title: '活动主办方'},
// },
// ]
// },
]

@ -104,13 +104,13 @@ export default [
component: resolve => require(['@/views/Shop/SwiperManage'], resolve), component: resolve => require(['@/views/Shop/SwiperManage'], resolve),
meta: {title: '商城轮播图管理'} meta: {title: '商城轮播图管理'}
}, },
// { {
// path: '/ScoreSetting', path: '/ScoreSetting',
// name: "ScoreSetting", name: "ScoreSetting",
// title: "积分设置", title: "积分设置",
// hide: false, hide: false,
// icon: 'crown', icon: 'crown',
// component: resolve => require(['@/views/Shop/ScoreSetting'], resolve), component: resolve => require(['@/views/Shop/ScoreSetting'], resolve),
// meta: {title: '积分设置'} meta: {title: '积分设置'}
// }, },
] ]

@ -0,0 +1,46 @@
export const formItem = [
{
type: 'input',
label:'费用名称',
prop:'name',
placeholder:'请输入'
},
]
export const columns = [
{
title: "费用名称",
dataIndex: "name",
},
{
title: "计费方式",
dataIndex: "type",
},
{
title: "计量方式",
dataIndex: "name",
},
{
title: "单价",
dataIndex: "price",
},
{
title: "单价",
dataIndex: "unit",
},
{
title: "操作",
dataIndex: "action",
key: "action",
width: "180",
fixed: "right",
scopedSlots: { customRender: "action" },
},
]
export const pagination = {
current: 1,
total: 0,
pageSize: 10,
showTotal: (total) => `${total}`,
showSizeChanger: true,
showQuickJumper: true,
}

@ -0,0 +1,7 @@
export const form = {
id:null,
brandName: undefined,
}
export const rules = {
brandName:[{required:true,message:'请输入品牌名',trigger:'blur'}],
}

@ -0,0 +1,230 @@
<template>
<div>
<div class="cardTitle">
<a-space size="large">收费标准管理
<a-radio-group default-value="a" button-style="solid">
<a-radio-button value="1">
房屋收费标准
</a-radio-button>
<a-radio-button value="2">
仪表收费标准
</a-radio-button>
<a-radio-button value="3">
车位收费标准
</a-radio-button>
<a-radio-button value="4">
临时收费标准
</a-radio-button>
</a-radio-group></a-space>
</div>
<searchForm :formItem="formItem" @getSearch="getData($event)"></searchForm>
<a-button style="margin: 10px" class="add-btn" @click="drawer.show = true"
>添加费用</a-button
>
<a-table
:columns="columns"
:data-source="tableData"
:pagination="pagination"
@change="handleTableChange"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: selectionChoosed,
}"
:row-key="
(record, index) => {
return record.id;
}
"
>
<span slot="action" slot-scope="text, row">
<a-space>
<a class="ant-dropdown-link" @click="edit(row)"></a>
<a class="ant-dropdown-link" @click="del([row.id])"></a>
</a-space>
</span>
</a-table>
<div class="action">
<a-dropdown :disabled="!hasSelected">
<a-menu slot="overlay" @click="handleMenuClick">
<a-menu-item key="del"> 批量删除 </a-menu-item>
</a-menu>
<a-button> 批量操作 <a-icon type="down" /> </a-button>
</a-dropdown>
<span style="margin-left: 8px">
<template v-if="hasSelected">
{{ `已选择 ${selectedRowKeys.length}` }}
</template>
</span>
</div>
<a-drawer
:title="drawer.title"
:width="720"
:visible="drawer.show"
:body-style="{ paddingBottom: '80px' }"
@close="addClose"
>
<div class="drawer-content">
基本信息
<a-divider></a-divider>
<a-form-model
ref="ruleForm"
:model="form"
:rules="rules"
layout="vertical"
>
<a-form-model-item prop="brandName" label="品牌名称">
<a-input
v-model="form.brandName"
placeholder="请输入品牌名称"
style="width: 50%"
></a-input>
</a-form-model-item>
</a-form-model>
</div>
<div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="addClose">
关闭
</a-button>
<a-button type="primary" @click="submit"> </a-button>
</div>
</a-drawer>
</div>
</template>
<script>
import {
brandList,
brandInsert,
brandDel,
brandUpdate,
} from "@/api/shop/goods/brand.js";
import { formItem, columns, pagination } from "./depend/config";
import { form, rules } from "./depend/form.js";
export default {
data() {
return {
drawer: {
show: false,
title: "新增品牌"
},
tableData: [],
searchForm: {
name: undefined,
},
formItem,
columns,
form,
rules,
pagination,
// index
selectedRowKeys: [],
};
},
mounted() {
this.getData();
},
methods: {
async getData(data) {
if (data !== undefined) {
console.log(data);
this.searchForm = data;
console.log(this.searchForm);
}
let res = await brandList({
pageNum: this.pagination.current,
size: this.pagination.pageSize,
...this.searchForm,
});
this.tableData = res.data.rows;
this.pagination.total = res.data.total;
this.selectedRowKeys = [];
},
edit(data) {
this.form.brandName = data.brandName
this.form.id = data.id
this.drawer.show = true;
this.drawer.title = '修改品牌';
},
del(ids) {
this.$confirm({
title: "是否删除",
// okText:'',
// cancelText:'',
icon: "delete",
onOk: async () => {
let res = await brandDel({ ids: ids });
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
}
},
});
},
// id
selectionChoosed(data) {
this.selectedRowKeys = data;
},
//
handleMenuClick(data) {
console.log(data);
if (data.key === "del") {
this.del(this.selectedRowKeys);
}
},
//
handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination };
pager.current = pagination.current;
pager.pageSize = pagination.pageSize;
this.pagination = pager;
this.getData();
},
addClose() {
this.$refs.ruleForm.resetFields();
this.drawer.show = false;
this.drawer.title = '新增品牌';
},
submit() {
console.log(this.form);
this.$refs.ruleForm.validate(async (valid) => {
if (valid) {
if (this.form.id === null) {
let res = await brandInsert(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.addClose();
this.getData();
} else {
this.$message.error(res.msg);
}
} else {
console.log(this.form);
let res = await brandUpdate(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.addClose();
this.getData();
} else {
this.$message.error(res.msg);
}
}
}
});
},
},
computed: {
hasSelected() {
return this.selectedRowKeys.length > 0;
},
},
};
</script>
<style lang="less" scoped>
.table-img {
width: 40px;
height: 40px;
}
</style>

@ -40,3 +40,7 @@ export const pagination = {
showSizeChanger: true, showSizeChanger: true,
showQuickJumper: true, showQuickJumper: true,
} }
export const rules = {
name:[{required:true,message:'请输入名称',trigger:'blur'}],
parentId:[{required:true,message:'请选择',trigger:'change',type:'array'}],
}

@ -1,103 +1,165 @@
<template> <template>
<div> <div>
<div class="cardTitle">商品分类</div> <div class="cardTitle">商品分类</div>
<div class="content"> <div class="content flexbox">
<a-button class="add-btn" style="margin-left: 10px" @click="addCate"
<div class="tree">
<a-button class="add-btn" style="margin-left: 10px" @click="addCate"
>新增商品分类</a-button >新增商品分类</a-button
> >
<a-row> <a-tree
<a-col v-model="checkedKeys"
:span="3" :expanded-keys="expandedKeys"
style=" :auto-expand-parent="autoExpandParent"
border-right: 1px solid #0000000f; :selected-keys="selectedKeys"
height: 100vh; :tree-data="treeData"
margin-right: 40px; @expand="onExpand"
@select="onSelect"
:replaceFields="{
children: 'shopCategoryVoList',
title: 'name',
key: 'id',
}"
>
</a-tree>
</div>
<a-divider type="vertical" style="height:100vh"></a-divider>
<div class='table'>
<a-table
:columns="columns"
:data-source="tableData"
:pagination="pagination"
@change="handleTableChange"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: selectionChoosed,
}"
:row-key="
(record, index) => {
return record.id;
}
" "
> >
<a-tree <span slot="action" slot-scope="text, row">
class="tree" <a-space>
v-model="checkedKeys" <a @click="edit(row)"></a>
:expanded-keys="expandedKeys" <a
:auto-expand-parent="autoExpandParent" @click="show(row.id)"
:selected-keys="selectedKeys" v-if="row.isShow === 0"
:tree-data="treeData" >显示</a
@expand="onExpand" >
@select="onSelect" <a
:replaceFields="{ @click="show(row.id)"
children: 'shopCategoryVoList', v-else-if="row.isShow === 1"
title: 'name', >隐藏</a
key: 'id', >
}" <a class="ant-dropdown-link" @click="del([row.id])"></a>
> </a-space>
</a-tree> </span>
</a-col> <span slot="imgpic" slot-scope="text, row">
<a-col :span="20"> <img
<a-table v-if="row.imgUrls.length > 0"
:columns="columns" :src="$ImgUrl(row.imgUrls[0].url)"
:data-source="tableData" class="table-img"
:pagination="pagination" alt=""
@change="handleTableChange" />
:row-selection="{ <span v-else></span>
selectedRowKeys: selectedRowKeys, </span>
onChange: selectionChoosed, </a-table>
}" <div class="action">
:row-key=" <a-dropdown :disabled="!hasSelected">
(record, index) => { <a-menu slot="overlay" @click="handleMenuClick">
return record.id; <a-menu-item key="del"> 批量删除 </a-menu-item>
} </a-menu>
" <a-button> 批量操作 <a-icon type="down" /> </a-button>
> </a-dropdown>
<span slot="action" slot-scope="text, row"> <span style="margin-left: 8px">
<a-space> <template v-if="hasSelected">
<a class="ant-dropdown-link" @click="show(row.id)" v-if="row.isShow===0"></a> {{ `已选择 ${selectedRowKeys.length}` }}
<a class="ant-dropdown-link" @click="show(row.id)" v-else-if="row.isShow===1">隐藏</a> </template>
<a class="ant-dropdown-link" @click="edit(row)"></a> </span>
</a-space> </div>
</span> </div>
<span slot="imgpic" slot-scope="text, row">
<img
v-if="row.imgUrls.length > 0"
:src="$ImgUrl(row.imgUrls[0].url)"
class="table-img"
alt=""
/>
<span v-else></span>
</span>
</a-table>
</a-col>
</a-row>
</div> </div>
<a-drawer <a-drawer
width="30%"
:title="drawer.title" :title="drawer.title"
placement="right" placement="right"
:closable="false" :closable="false"
:visible="drawer.show" :visible="drawer.show"
@close="onClose" @close="onClose"
> >
<div class="main"></div> <div class="main">
<a-form-model ref="ruleForm" :model="form" :rules="rules">
<a-form-model-item prop="name" label="分类名称">
<a-input
placeholder="请输入分类名称"
v-model="form.name"
style="width: 80%"
></a-input>
</a-form-model-item>
<a-form-model-item prop="name" label="上级分类" v-if="drawer.title==='新增分类'">
<a-cascader
style="width: 80%"
:field-names="{
label: 'name',
value: 'id',
children: 'shopCategoryVoList',
}"
:options="treeData"
placeholder="请选择"
change-on-select
@change="onChange"
v-model="cascVal"
/>
</a-form-model-item>
<a-form-model-item label="分类图片">
<commonUpload
:fileList="fileList"
@handleChange="handleChange"
></commonUpload>
</a-form-model-item>
</a-form-model>
</div>
<div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="onClose">
关闭
</a-button>
<a-button type="primary" @click="onSubmit"> </a-button>
</div>
</a-drawer> </a-drawer>
</div> </div>
</template> </template>
<script> <script>
import { cateList, cateInfo,cateShow } from "@/api/shop/goods/cate.js"; import {
import { columns, pagination } from "./depend/config"; cateList,
cateInfo,
cateShow,
cateInsert,
cateUpdate,
cateDel
} from "@/api/shop/goods/cate.js";
import { columns, pagination, rules } from "./depend/config";
export default { export default {
data() { data() {
return { return {
columns, columns,
pagination, pagination,
rules,
// index // index
selectedRowKeys: [], selectedRowKeys: [],
tableData: [], tableData: [],
fileList:[],
drawer: { drawer: {
show: false, show: false,
title: "新增分类", title: "新增分类",
}, },
form:{ form: {
categoryId:undefined, categoryId:undefined,// id
name:undefined, parentId: undefined,
imgList:[], name: undefined,
imgList: [],
}, },
expandedKeys: [], expandedKeys: [],
autoExpandParent: true, autoExpandParent: true,
@ -105,11 +167,12 @@ export default {
selectedKeys: [], selectedKeys: [],
treeData: [ treeData: [
{ {
id:0, id: 0,
name:'所有分类', name: "所有分类",
shopCategoryVoList:[] shopCategoryVoList: [],
} },
], ],
cascVal: [],
}; };
}, },
mounted() { mounted() {
@ -119,21 +182,110 @@ export default {
async getData() { async getData() {
let res = await cateList(); let res = await cateList();
this.treeData[0].shopCategoryVoList = res.data; this.treeData[0].shopCategoryVoList = res.data;
this.onSelect(this.selectedKeys);
}, },
addCate() {}, addCate() {
onClose() {}, this.drawer.show = true;
async show(id){ this.drawer.title = "新增分类";
let res = await cateShow({shopCategoryId:id}) },
if(res.code === 200){ del(ids) {
this.$message.success(res.msg) this.$confirm({
this.onSelect(this.selectedKeys) title: "是否删除",
}else{ // okText:'',
this.$message.error(res.msg) // cancelText:'',
icon: "delete",
onOk: async () => {
let res = await cateDel({ ids: ids });
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
}
},
});
},
onSubmit() {
this.$refs.ruleForm.validate(async (valid) => {
if (valid) {
if (this.drawer.title === "新增分类") {
let res = await cateInsert(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
this.onClose()
} else {
this.$message.error(res.msg);
}
} else if (this.drawer.title === "修改分类") {
let res = await cateUpdate(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
this.onClose()
} else {
this.$message.error(res.msg);
}
}
}
});
},
onClose() {
this.drawer.show = false;
this.form = {
categoryId:undefined,// id
parentId: undefined,
name: undefined,
imgList: [],
},
this.cascVal=[]
this.fileList = []
},
async show(id) {
let res = await cateShow({ shopCategoryId: id });
if (res.code === 200) {
this.$message.success(res.msg);
this.onSelect(this.selectedKeys);
} else {
this.$message.error(res.msg);
} }
}, },
edit(data){ onChange(value) {
this.form.parentId = value[value.length - 1];
},
edit(data) {
console.log(data); console.log(data);
this.drawer.show = true this.drawer.show = true;
this.drawer.title = "修改分类";
this.form.name = data.name;
this.form.categoryId = data.id;
// this.fileList.push
if (data.imgUrls.length > 0) {
console.log(data.imgUrls);
this.form.imgList.push(data.imgUrls[0].url);
const pic = [];
for (let item of data.imgUrls) {
let obj = {
name: item.url.split("_")[0] + "." + item.url.split(".")[1],
url: this.$ImgUrl(item.url),
uid: item.url.split("_")[1],
status: "done",
thumbUrl: this.$ImgUrl(item.url),
};
pic.push(obj);
}
this.fileList = pic;
} else {
this.form.imgList = [];
}
},
handleChange(data){
this.fileList = data;
this.form.imgList=[]
if (data[0].status === "done") {
console.log('-------done-------');
this.form.imgList.push(data[0].response.data);
}
}, },
selectionChoosed(data) { selectionChoosed(data) {
this.selectedRowKeys = data; this.selectedRowKeys = data;
@ -151,11 +303,26 @@ export default {
this.expandedKeys = expandedKeys; this.expandedKeys = expandedKeys;
this.autoExpandParent = false; this.autoExpandParent = false;
}, },
handleMenuClick(data) {
console.log(data);
if (data.key === "del") {
this.del(this.selectedRowKeys);
}
},
async onSelect(selectedKeys) { async onSelect(selectedKeys) {
this.selectedKeys = selectedKeys; this.selectedKeys = selectedKeys;
let res = await cateInfo({ parentId: this.selectedKeys[0],pageNum:this.pagination.current,size:this.pagination.pageSize }); let res = await cateInfo({
this.tableData = res.data.rows parentId: this.selectedKeys[0],
this.pagination.total = res.data.total pageNum: this.pagination.current,
size: this.pagination.pageSize,
});
this.tableData = res.data.rows;
this.pagination.total = res.data.total;
},
},
computed: {
hasSelected() {
return this.selectedRowKeys.length > 0;
}, },
}, },
}; };
@ -166,7 +333,15 @@ export default {
width: 40px; width: 40px;
height: 40px; height: 40px;
} }
.flexbox{
display: flex;
justify-content: space-between;
}
.tree { .tree {
padding-left: 10px; padding-left: 30px;
min-width: 200px ;
}
.table{
width: 80%;
} }
</style> </style>

@ -1,114 +1,11 @@
export const formItem = [ export const setForm = {
{ enableFirstLoginSetting: undefined,
type: 'input', amount: undefined,
label:'标题', enableSignSetting: undefined,
prop:'title', signType: 1,
placeholder:'请输入' signBeginTime: undefined,
}, signEndTime: undefined,
{ signReward: 1,
type: 'select', signName: undefined,
label:'推送对象', signRewardSetting: undefined,
prop:'object',
option:[{ id:1,name:'全部'},{ id:2,name:'住户'},{ id:3,name:'业主'},{ id:4,name:'租户'},{ id:5,name:'管家'}],
placeholder:'请选择'
},
{
type: 'select',
label:'发布状态',
prop:'status',
option:[{ id:1,name:'未发布'},{ id:2,name:'已发布'}],
placeholder:'请选择'
},
{
type: 'time',
label:'更新时间',
start: 'modifyStartTime',
end:'modifyEndTime'
},
]
export const columns = [
{
title: "标题",
dataIndex: "title",
width: "16%",
},
{
title: "推送对象",
dataIndex: "object",
width: "10%",
customRender: function (object) {
switch (object) {
case 1:
return '全部'
break;
case 2:
return '住户'
break;
case 3:
return '业主'
break;
case 4:
return '租户'
break;
case 5:
return '管家'
break;
default:
break;
}
}
},
{
title: "状态",
dataIndex: "status",
width: "10%",
customRender: function (status) {
switch (status) {
case 1:
return '未发布'
break;
case 2:
return '已发布'
break;
default:
break;
}
}
},
{
title: "内容",
dataIndex: "content",
width: "13%",
},
{
title: "阅读量",
dataIndex: "readingVolume",
width: "10%",
},
{
title: "附件下载次数",
dataIndex: "downloadNum",
width: "10%",
},
{
title: "更新时间",
dataIndex: "modifyDate",
width: "14%",
},
{
title: "操作",
dataIndex: "action",
key: "action",
width: "180",
fixed: "right",
scopedSlots: { customRender: "action" },
},
]
export const pagination = {
current: 1,
total: 0,
pageSize: 10,
showTotal: (total) => `${total}`,
showSizeChanger: true,
showQuickJumper: true,
} }

@ -1,28 +0,0 @@
export const form = {
id:undefined,
title:undefined,
object:undefined,
status:undefined,
content:undefined,
coverImgUrls:[],
annexUrls:[],
}
export const rules = {
title:[{required:true,message:'请输入标题',trigger:'blur'}],
object:[{required:true,message:'请选择',trigger:'change'}],
status:[{required:true,message:'请选择',trigger:'change'}],
content:[{required:true,message:'请输入标题',trigger:'blur'}],
}
export const options = {
status:[
{ id:1, name:'未发布' },
{ id:2, name:'已发布' },
],
object:[
{ id:1, name:'全部' },
{ id:2, name:'住户' },
{ id:3, name:'业主' },
{ id:4, name:'租户' },
{ id:5, name:'管家' },
],
}

@ -1,241 +0,0 @@
<template>
<div>
<a-drawer
:title="title"
:width="720"
:visible="show"
:body-style="{ paddingBottom: '80px' }"
@close="addClose"
>
<div class="drawer-content">
基本信息
<a-divider></a-divider>
<a-form-model
ref="ruleForm"
:model="form"
:rules="rules"
layout="vertical"
>
<a-form-model-item prop="title" label="标题">
<a-input
v-model="form.title"
placeholder="请输入标题"
style="width: 80%"
></a-input>
</a-form-model-item>
<a-form-model-item prop="object" label="推送对象">
<a-select
v-model="form.object"
placeholder="请选择"
style="width: 80%"
>
<a-select-option
v-for="item in options.object"
:key="item.id"
:value="item.id"
>{{ item.name }}</a-select-option
>
</a-select>
</a-form-model-item>
<a-form-model-item prop="status" label="状态">
<a-select
v-model="form.status"
placeholder="请选择"
style="width: 80%"
>
<a-select-option
v-for="item in options.status"
:key="item.id"
:value="item.id"
>{{ item.name }}</a-select-option
>
</a-select>
</a-form-model-item>
<a-form-model-item prop="content" label="内容">
<a-textarea
v-model="form.content"
placeholder="请输入内容"
style="width: 80%"
></a-textarea>
</a-form-model-item>
封面图片
<commonUpload
:fileList="fileList"
@handleChange="handleChange"
></commonUpload>
附件
<a-upload
name="file"
:multiple="true"
:action="`${$upload}`"
:file-list="documentList"
accept=".doc,.DOC,.xls,.XLS,.xlsx,.XLSX,.pdf,.PDF"
:headers="uploadHeaders"
@change="changeFile"
>
<a-button> <a-icon type="upload" /> 上传附件</a-button>
</a-upload>
</a-form-model>
</div>
<div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="addClose">
关闭
</a-button>
<a-button type="primary" @click="submit"> </a-button>
</div>
</a-drawer>
</div>
</template>
<script>
import store from "@/store";
import { form, rules, options } from "./form.js";
import {
announcementInsert,
announcementUpdate,
announcementInfo,
} from "@/api/operation/announcement";
export default {
props: {
show: {
type: Boolean,
default: false,
},
editId: Number,
},
data() {
return {
title: "新增公告",
form,
rules,
options,
fileList: [],
documentList: [],
uploadHeaders: {
"manage-login-token": store.getters.getToken,
},
};
},
methods: {
addClose() {
this.$refs.ruleForm.resetFields();
this.fileList = [];
this.documentList = [];
this.form.coverImgUrls = [];
this.form.annexUrls = [];
this.$emit("addClose");
},
success() {
this.$emit("success");
this.addClose();
},
submit() {
console.log(this.documentList);
let arr = [];
for (let k of this.documentList) {
if (k.response) {
arr.push(k.response.data);
} else {
arr.push(k.url.split("/")[k.url.split("/").length - 1]);
}
}
this.form.annexUrls = arr;
console.log(this.form);
this.$refs.ruleForm.validate(async (valid) => {
if (valid) {
if (this.editId === null) {
let res = await announcementInsert(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.success();
} else {
this.$message.error(res.msg);
}
} else {
console.log(this.form);
let res = await announcementUpdate(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.success();
} else {
this.$message.error(res.msg);
}
}
}
});
},
changeFile(info) {
this.documentList = info.fileList;
if (info.file.status !== "uploading") {
console.log(info.file, info.fileList);
}
if (info.file.status === "done") {
this.$message.success(`${info.file.name} 上传成功`);
// this.form.annexUrls.push(info.file.response.data);
} else if (info.file.status === "error") {
this.$message.error(`${info.file.name} 上传失败`);
}
},
handleChange(data) {
this.fileList = data;
this.form.coverImgUrls = [];
if (data[0].status === "done") {
console.log("-------done-------");
this.form.coverImgUrls.push(data[0].response.data);
}
},
},
watch: {
editId: {
handler(val) {
if (val !== null) {
this.title = "修改公告";
this.form.id = val;
announcementInfo({ announcementId: val }).then((res) => {
this.form = res.data;
if (res.data.coverImgList.length > 0) {
console.log(res.data.coverImgList);
const pic = [];
for (let item of res.data.coverImgList) {
let obj = {
name: item.url.split("_")[0] + "." + item.url.split(".")[1],
url: this.$ImgUrl(item.url),
uid: item.url.split("_")[1],
status: "done",
thumbUrl: this.$ImgUrl(item.url),
};
pic.push(obj);
}
this.fileList = pic;
} else {
this.form.coverImgList = [];
}
if (res.data.annexImgList.length > 0) {
console.log(res.data.annexImgList);
const file = [];
for (let item of res.data.annexImgList) {
let obj = {
name: item.url.split("_")[0] + "." + item.url.split(".")[1],
url: this.$ImgUrl(item.url),
uid: item.url.split("_")[1],
status: "done",
thumbUrl: this.$ImgUrl(item.url),
};
file.push(obj);
}
this.documentList = file;
} else {
this.form.coverImgList = [];
}
});
} else {
this.title = "新增公告";
}
},
immediate: true,
},
},
};
</script>
<style></style>

@ -1,163 +1,171 @@
<template> <template>
<div> <div>
<div class="cardTitle">公告</div> <div class="cardTitle">任务设置</div>
<searchForm :formItem="formItem" @getSearch="getData($event)"></searchForm> <a-form-model
<a-button style="margin: 10px" class="add-btn" @click="drawer.show = true" class="form"
>新增公告</a-button :model="setForm"
:label-col="labelCol"
:wrapper-col="wrapperCol"
> >
<a-table <div class="title">首次登录设置</div>
:columns="columns" <a-form-model-item label="是否开启" prop="enableFirstLoginSetting">
:data-source="tableData" <a-radio-group
:pagination="pagination" v-model="setForm.enableFirstLoginSetting"
:scroll="{ x: 1600 }" button-style="solid"
@change="handleTableChange" >
:row-selection="{ <a-radio-button :value="true"> 开启 </a-radio-button>
selectedRowKeys: selectedRowKeys, <a-radio-button :value="false"> 关闭 </a-radio-button>
onChange: selectionChoosed, </a-radio-group>
}" </a-form-model-item>
:row-key=" <a-form-model-item label="获取积分数额" prop="amount">
(record, index) => { <a-input-number v-model.number="setForm.amount" :disabled='setForm.enableFirstLoginSetting===false'></a-input-number>
return record.id; </a-form-model-item>
} <div class="title">签到奖励设置</div>
" <a-form-model-item label="是否开启签到" prop="enableSignSetting">
> <a-radio-group v-model="setForm.enableSignSetting" button-style="solid">
<span slot="action" slot-scope="text, row"> <a-radio-button :value="true"> 开启 </a-radio-button>
<a-radio-button :value="false"> 关闭 </a-radio-button>
</a-radio-group>
</a-form-model-item>
<a-form-model-item label="签到方式" prop="signType">
<a-space> <a-space>
<a class="ant-dropdown-link" @click="edit(row.id)"></a> <span :class='[setForm.enableSignSetting===false?"disabled":""]'>{{ setForm.signType === 1 ? "一周每日签到模式" : "" }}</span>
<a class="ant-dropdown-link" @click="del([row.id])"></a> <a-popover>
<template slot="content">
<p style="width: 300px">
一周签到模式在后台设置每周累计1天至
累计7天不同的签到积分奖励用户签到时按照
实际累计登陆天数签到A用户周一签到
周二缺签周三签到时可领取累计2天的签到奖励
每周一的凌晨00:00将会重置所有累计签到次数
用户将由第一天起重新签到
</p>
</template>
<a-icon type="question-circle" />
</a-popover>
</a-space> </a-space>
</span> </a-form-model-item>
</a-table> <a-form-model-item label="活动时间" prop="signTime">
<div class="action"> <a-range-picker
<a-dropdown :disabled="!hasSelected"> :disabled='setForm.enableSignSetting===false'
<a-menu slot="overlay" @click="handleMenuClick"> style="width: 400px"
<a-menu-item key="del"> 批量删除 </a-menu-item> @change="changeTime"
</a-menu> v-model="time"
<a-button> 批量操作 <a-icon type="down" /> </a-button> value-format="YYYY-MM-DD HH:mm:ss"
</a-dropdown> />
<span style="margin-left: 8px"> </a-form-model-item>
<template v-if="hasSelected"> <a-form-model-item label="签到奖励" prop="signReward">
{{ `已选择 ${selectedRowKeys.length}` }} <span :class='[setForm.enableSignSetting===false?"disabled":""]' >{{ setForm.signReward === 1 ? "商城积分" : "" }}</span>
</template> </a-form-model-item>
</span> <a-form-model-item label="签到活动名称" prop="signName">
</div> <a-input v-model="setForm.signName" :disabled='setForm.enableSignSetting===false' style="width: 300px"></a-input>
<addForm </a-form-model-item>
:show="drawer.show" <a-form-model-item label="签到奖励设置" prop="signRewardSetting">
@success="success" <div v-for="(item, index) in dailyScore" :key="index">
@addClose="addClose" <a-space
:editId="editId" >{{ item.label
></addForm> }}<a-input
type="number"
:disabled='setForm.enableSignSetting===false'
v-model.number="dailyScore[index].value"
addon-after="分"
style="width: 100px"
></a-input
></a-space>
</div>
</a-form-model-item>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="onSubmit"> </a-button>
<a-button style="margin-left: 10px" @click="getData"> </a-button>
</a-form-model-item>
</a-form-model>
</div> </div>
</template> </template>
<script> <script>
import { announcementList, announcementDel } from "@/api/operation/announcement"; import { setForm } from "./depend/config";
import { formItem, columns, pagination } from "./depend/config"; import { getSetting, Setting } from "@/api/shop/score";
import addForm from "./depend/form.vue";
export default { export default {
components: {
addForm,
},
data() { data() {
return { return {
drawer: { setForm,
show: false, labelCol: { span: 4 },
}, wrapperCol: { span: 20 },
editId: null, time:[],
tableData: [], dailyScore: [
searchForm: { {
title:undefined, label: "第一天",
status:undefined, value: 0,
object:undefined, },
modifyStartTime:undefined, {
modifyEndTime:undefined, label: "第二天",
}, value: 0,
formItem, },
columns, {
pagination, label: "第三天",
// index value: 0,
selectedRowKeys: [], },
{
label: "第四天",
value: 0,
},
{
label: "第五天",
value: 0,
},
{
label: "第六天",
value: 0,
},
{
label: "第七天",
value: 0,
},
],
}; };
}, },
mounted() { mounted() {
this.getData(); this.getData();
}, },
methods: { methods: {
async getData(data) { async getData() {
if (data !== undefined) { let res = await getSetting();
console.log(data); this.setForm = res.data;
this.searchForm = data; res.data.signRewardSetting.split(',').forEach((ele,index)=>{
console.log(this.searchForm); this.dailyScore[index].value = ele
} })
let res = await announcementList({ this.time[0] = res.data.signBeginTime
pageNum: this.pagination.current, this.time[1] = res.data.signEndTime
size: this.pagination.pageSize,
...this.searchForm
});
this.tableData = res.data.rows;
this.pagination.total = res.data.total;
this.selectedRowKeys=[]
},
edit(id) {
this.editId = id;
this.drawer.show = true;
}, },
del(ids) { async onSubmit() {
console.log(ids); let res = await Setting(this.setForm);
this.$confirm({ if (res.code === 200) {
title: "是否删除", this.$message.success(res.msg);
// okText:'', this.getData();
// cancelText:'', } else {
icon: "delete", this.$message.error(res.msg);
onOk: async () => {
let res = await announcementDel({ activityOrganizerIds: ids });
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
}
},
});
},
// id
selectionChoosed(data) {
this.selectedRowKeys = data;
},
//
handleMenuClick(data) {
console.log(data);
if (data.key === "del") {
this.del(this.selectedRowKeys);
} }
}, },
// changeTime(date) {
handleTableChange(pagination) { console.log(date);
console.log(pagination); this.setForm.signBeginTime = date[0];
const pager = { ...this.pagination }; this.setForm.signEndTime = date[1];
pager.current = pagination.current;
pager.pageSize = pagination.pageSize;
this.pagination = pager;
this.getData();
},
addClose() {
this.drawer.show = false;
this.editId = null;
},
success() {
this.getData();
},
},
computed: {
hasSelected() {
return this.selectedRowKeys.length > 0;
}, },
}, },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.table-img { /deep/.ant-input {
width: 40px; display: inline;
height: 40px; }
.disabled {
color: #00000040;
}
.title {
color: #000;
font-size: 15px;
font-weight: 500;
padding-left: 140px;
} }
</style> </style>

Loading…
Cancel
Save