main
bibi 3 years ago
parent f6f13ff574
commit 94735ef4ae

@ -32,7 +32,14 @@ export function cateUpdate(params) {
}
export function cateInsert(params) {
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',
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",
title: "缴费管理",
component: Layout,
redirect: '/',
redirect: '/ChargeStandardManage',
meta: {title: '缴费管理'},
children: [
...payment,

@ -6,4 +6,42 @@
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @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),
meta: {title: '商城轮播图管理'}
},
// {
// path: '/ScoreSetting',
// name: "ScoreSetting",
// title: "积分设置",
// hide: false,
// icon: 'crown',
// component: resolve => require(['@/views/Shop/ScoreSetting'], resolve),
// meta: {title: '积分设置'}
// },
{
path: '/ScoreSetting',
name: "ScoreSetting",
title: "积分设置",
hide: false,
icon: 'crown',
component: resolve => require(['@/views/Shop/ScoreSetting'], resolve),
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,
showQuickJumper: true,
}
export const rules = {
name:[{required:true,message:'请输入名称',trigger:'blur'}],
parentId:[{required:true,message:'请选择',trigger:'change',type:'array'}],
}

@ -1,103 +1,165 @@
<template>
<div>
<div class="cardTitle">商品分类</div>
<div class="content">
<a-button class="add-btn" style="margin-left: 10px" @click="addCate"
<div class="content flexbox">
<div class="tree">
<a-button class="add-btn" style="margin-left: 10px" @click="addCate"
>新增商品分类</a-button
>
<a-row>
<a-col
:span="3"
style="
border-right: 1px solid #0000000f;
height: 100vh;
margin-right: 40px;
<a-tree
v-model="checkedKeys"
:expanded-keys="expandedKeys"
:auto-expand-parent="autoExpandParent"
:selected-keys="selectedKeys"
:tree-data="treeData"
@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
class="tree"
v-model="checkedKeys"
:expanded-keys="expandedKeys"
:auto-expand-parent="autoExpandParent"
:selected-keys="selectedKeys"
:tree-data="treeData"
@expand="onExpand"
@select="onSelect"
:replaceFields="{
children: 'shopCategoryVoList',
title: 'name',
key: 'id',
}"
>
</a-tree>
</a-col>
<a-col :span="20">
<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="show(row.id)" v-if="row.isShow===0"></a>
<a class="ant-dropdown-link" @click="show(row.id)" v-else-if="row.isShow===1">隐藏</a>
<a class="ant-dropdown-link" @click="edit(row)"></a>
</a-space>
</span>
<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>
<span slot="action" slot-scope="text, row">
<a-space>
<a @click="edit(row)"></a>
<a
@click="show(row.id)"
v-if="row.isShow === 0"
>显示</a
>
<a
@click="show(row.id)"
v-else-if="row.isShow === 1"
>隐藏</a
>
<a class="ant-dropdown-link" @click="del([row.id])"></a>
</a-space>
</span>
<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>
<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>
</div>
</div>
<a-drawer
width="30%"
:title="drawer.title"
placement="right"
:closable="false"
:visible="drawer.show"
@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>
</div>
</template>
<script>
import { cateList, cateInfo,cateShow } from "@/api/shop/goods/cate.js";
import { columns, pagination } from "./depend/config";
import {
cateList,
cateInfo,
cateShow,
cateInsert,
cateUpdate,
cateDel
} from "@/api/shop/goods/cate.js";
import { columns, pagination, rules } from "./depend/config";
export default {
data() {
return {
columns,
pagination,
rules,
// index
selectedRowKeys: [],
tableData: [],
fileList:[],
drawer: {
show: false,
title: "新增分类",
},
form:{
categoryId:undefined,
name:undefined,
imgList:[],
form: {
categoryId:undefined,// id
parentId: undefined,
name: undefined,
imgList: [],
},
expandedKeys: [],
autoExpandParent: true,
@ -105,11 +167,12 @@ export default {
selectedKeys: [],
treeData: [
{
id:0,
name:'所有分类',
shopCategoryVoList:[]
}
id: 0,
name: "所有分类",
shopCategoryVoList: [],
},
],
cascVal: [],
};
},
mounted() {
@ -119,21 +182,110 @@ export default {
async getData() {
let res = await cateList();
this.treeData[0].shopCategoryVoList = res.data;
this.onSelect(this.selectedKeys);
},
addCate() {},
onClose() {},
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)
addCate() {
this.drawer.show = true;
this.drawer.title = "新增分类";
},
del(ids) {
this.$confirm({
title: "是否删除",
// okText:'',
// 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);
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) {
this.selectedRowKeys = data;
@ -151,11 +303,26 @@ export default {
this.expandedKeys = expandedKeys;
this.autoExpandParent = false;
},
handleMenuClick(data) {
console.log(data);
if (data.key === "del") {
this.del(this.selectedRowKeys);
}
},
async onSelect(selectedKeys) {
this.selectedKeys = selectedKeys;
let res = await cateInfo({ parentId: this.selectedKeys[0],pageNum:this.pagination.current,size:this.pagination.pageSize });
this.tableData = res.data.rows
this.pagination.total = res.data.total
let res = await cateInfo({
parentId: this.selectedKeys[0],
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;
height: 40px;
}
.flexbox{
display: flex;
justify-content: space-between;
}
.tree {
padding-left: 10px;
padding-left: 30px;
min-width: 200px ;
}
.table{
width: 80%;
}
</style>

@ -1,114 +1,11 @@
export const formItem = [
{
type: 'input',
label:'标题',
prop:'title',
placeholder:'请输入'
},
{
type: 'select',
label:'推送对象',
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,
export const setForm = {
enableFirstLoginSetting: undefined,
amount: undefined,
enableSignSetting: undefined,
signType: 1,
signBeginTime: undefined,
signEndTime: undefined,
signReward: 1,
signName: undefined,
signRewardSetting: undefined,
}

@ -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>
<div>
<div class="cardTitle">公告</div>
<searchForm :formItem="formItem" @getSearch="getData($event)"></searchForm>
<a-button style="margin: 10px" class="add-btn" @click="drawer.show = true"
>新增公告</a-button
<div class="cardTitle">任务设置</div>
<a-form-model
class="form"
:model="setForm"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-table
:columns="columns"
:data-source="tableData"
:pagination="pagination"
:scroll="{ x: 1600 }"
@change="handleTableChange"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: selectionChoosed,
}"
:row-key="
(record, index) => {
return record.id;
}
"
>
<span slot="action" slot-scope="text, row">
<div class="title">首次登录设置</div>
<a-form-model-item label="是否开启" prop="enableFirstLoginSetting">
<a-radio-group
v-model="setForm.enableFirstLoginSetting"
button-style="solid"
>
<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="amount">
<a-input-number v-model.number="setForm.amount" :disabled='setForm.enableFirstLoginSetting===false'></a-input-number>
</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">
<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 class="ant-dropdown-link" @click="edit(row.id)"></a>
<a class="ant-dropdown-link" @click="del([row.id])"></a>
<span :class='[setForm.enableSignSetting===false?"disabled":""]'>{{ setForm.signType === 1 ? "一周每日签到模式" : "" }}</span>
<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>
</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>
<addForm
:show="drawer.show"
@success="success"
@addClose="addClose"
:editId="editId"
></addForm>
</a-form-model-item>
<a-form-model-item label="活动时间" prop="signTime">
<a-range-picker
:disabled='setForm.enableSignSetting===false'
style="width: 400px"
@change="changeTime"
v-model="time"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</a-form-model-item>
<a-form-model-item label="签到奖励" prop="signReward">
<span :class='[setForm.enableSignSetting===false?"disabled":""]' >{{ setForm.signReward === 1 ? "商城积分" : "" }}</span>
</a-form-model-item>
<a-form-model-item label="签到活动名称" prop="signName">
<a-input v-model="setForm.signName" :disabled='setForm.enableSignSetting===false' style="width: 300px"></a-input>
</a-form-model-item>
<a-form-model-item label="签到奖励设置" prop="signRewardSetting">
<div v-for="(item, index) in dailyScore" :key="index">
<a-space
>{{ item.label
}}<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>
</template>
<script>
import { announcementList, announcementDel } from "@/api/operation/announcement";
import { formItem, columns, pagination } from "./depend/config";
import addForm from "./depend/form.vue";
import { setForm } from "./depend/config";
import { getSetting, Setting } from "@/api/shop/score";
export default {
components: {
addForm,
},
data() {
return {
drawer: {
show: false,
},
editId: null,
tableData: [],
searchForm: {
title:undefined,
status:undefined,
object:undefined,
modifyStartTime:undefined,
modifyEndTime:undefined,
},
formItem,
columns,
pagination,
// index
selectedRowKeys: [],
setForm,
labelCol: { span: 4 },
wrapperCol: { span: 20 },
time:[],
dailyScore: [
{
label: "第一天",
value: 0,
},
{
label: "第二天",
value: 0,
},
{
label: "第三天",
value: 0,
},
{
label: "第四天",
value: 0,
},
{
label: "第五天",
value: 0,
},
{
label: "第六天",
value: 0,
},
{
label: "第七天",
value: 0,
},
],
};
},
mounted() {
this.getData();
},
methods: {
async getData(data) {
if (data !== undefined) {
console.log(data);
this.searchForm = data;
console.log(this.searchForm);
}
let res = await announcementList({
pageNum: this.pagination.current,
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;
async getData() {
let res = await getSetting();
this.setForm = res.data;
res.data.signRewardSetting.split(',').forEach((ele,index)=>{
this.dailyScore[index].value = ele
})
this.time[0] = res.data.signBeginTime
this.time[1] = res.data.signEndTime
},
del(ids) {
console.log(ids);
this.$confirm({
title: "是否删除",
// okText:'',
// cancelText:'',
icon: "delete",
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);
async onSubmit() {
let res = await Setting(this.setForm);
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
}
},
//
handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination };
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;
changeTime(date) {
console.log(date);
this.setForm.signBeginTime = date[0];
this.setForm.signEndTime = date[1];
},
},
};
</script>
<style lang="less" scoped>
.table-img {
width: 40px;
height: 40px;
/deep/.ant-input {
display: inline;
}
.disabled {
color: #00000040;
}
.title {
color: #000;
font-size: 15px;
font-weight: 500;
padding-left: 140px;
}
</style>

Loading…
Cancel
Save