bibi 3 years ago
parent e070925cf8
commit 67c042df6f

@ -70,7 +70,7 @@ export function cateSelect(params) {
// 店铺
export function shopSelect(params) {
return httpService({
url: `/user/shop/?`,
url: `/user/shopShop/allList`,
method: 'get',
params: params,
})
@ -78,7 +78,7 @@ export function shopSelect(params) {
// 供应商
export function vendorSelect(params) {
return httpService({
url: `/user/shop/?`,
url: `/user/shopVendor/allList`,
method: 'get',
params: params,
})
@ -86,7 +86,7 @@ export function vendorSelect(params) {
// 品牌
export function brandSelect(params) {
return httpService({
url: `/user/shop/?`,
url: `/user/shopBrand/allList`,
method: 'get',
params: params,
})

@ -77,4 +77,40 @@ export default [
component: resolve => require(['@/views/Shop/OrderManage/depend/detail'], resolve),
meta: {title: '订单详情'}
},
// {
// path: '/SupplierManage',
// name: "SupplierManage",
// title: "供应商管理",
// hide: false,
// icon: 'contacts',
// component: resolve => require(['@/views/Shop/SupplierManage'], resolve),
// meta: {title: '供应商管理'}
// },
// {
// path: '/StoreManage',
// name: "StoreManage",
// title: "店铺管理",
// hide: false,
// icon: 'shop',
// component: resolve => require(['@/views/Shop/StoreManage'], resolve),
// meta: {title: '店铺管理'}
// },
// {
// path: '/SwiperManage',
// name: "SwiperManage",
// title: "商城轮播图管理",
// hide: false,
// icon: 'bars',
// 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: '积分设置'}
// },
]

@ -17,7 +17,6 @@ export const rules = {
status:[{required:true,message:'请选择',trigger:'change'}],
vendorId:[{required:true,message:'请选择',trigger:'change'}],
brandId: [{ required: true, message: '请选择', trigger: 'change' }],
cateValue: [{ required: true, message: '请选择', trigger: 'change',type: 'array'}],
sellPrice:[{required:true,message:'请输入',trigger:'blur'}],
discountPrice:[{required:true,message:'请输入',trigger:'blur'}],
}

@ -17,60 +17,51 @@
layout="vertical"
>
<a-row>
<a-form-model-item prop="defaultSkuName" label="使用默认商品名称">
<a-switch v-model="form.defaultSkuName"></a-switch>
</a-form-model-item>
<a-col :span="12">
<a-form-model-item prop="status" label="上架状态">
<a-switch v-model="form.status"></a-switch
></a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item
v-if="form.defaultSkuName === false"
prop="skuName"
label="自定义商品名称"
label="商品名称"
>
<a-input v-model="form.skuName" style="width: 60%"></a-input>
</a-form-model-item>
<a-form-model-item prop="defaultShopName" label="使用默认店铺">
<a-switch v-model="form.defaultShopName"></a-switch>
<a-input v-model="form.skuName" placeholder="请输入商品名称" style='width:60%'></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item
v-if="form.defaultShopName === false"
prop="shopId"
label="自定义选择店铺"
label="店铺"
>
<a-select v-model="form.shopId" style="width: 60%">
<a-select v-model="form.shopId" placeholder="请选择店铺" style='width:60%'>
<a-select-option v-for="item in options.shop" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item prop="defaultVendorName" label="使用默认供应商">
<a-switch v-model="form.defaultVendorName"></a-switch>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item
v-if="form.defaultVendorName === false"
prop="vendorId"
label="自定义选择供应商"
label="供应商"
>
<a-select v-model="form.vendorId" style="width: 60%">
<a-select v-model="form.vendorId" placeholder="请选择供应商" style='width:60%'>
<a-select-option v-for="item in options.vendor" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item prop="defaultBrandName" label="使用默认品牌">
<a-switch v-model="form.defaultBrandName"></a-switch>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item
v-if="form.defaultBrandName === false"
prop="brandId"
label="自定义选择品牌"
label="品牌"
>
<a-select v-model="form.brandId" style="width: 60%">
<a-select v-model="form.brandId" placeholder="请选择品牌" style='width:60%'>
<a-select-option v-for="item in options.brand" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item prop="defaultCategoryName" label="使用默认分类">
<a-switch v-model="form.defaultCategoryName"></a-switch>
</a-form-model-item>
<a-form-model-item
v-if="form.defaultCategoryName === false"
prop="cateValue"
label="自定义选择分类"
>
</a-col>
<a-col :span="12">
<a-form-model-item prop="cateValue" label="商品分类">
<a-cascader
v-model="cateValue"
:options="options.cate"
@ -82,17 +73,20 @@
}"
@change="change"
style="width: 60%"
></a-cascader>
</a-form-model-item>
></a-cascader> </a-form-model-item
></a-col>
<a-col :span="12">
<a-form-model-item prop="sellPrice" label="售卖价">
<a-input v-model="form.sellPrice" style="width: 60%"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="discountPrice" label="划线价">
<a-input
v-model="form.discountPrice"
style="width: 60%"
></a-input>
</a-form-model-item>
></a-input> </a-form-model-item
></a-col>
</a-row>
</a-form-model>
</div>
@ -108,7 +102,14 @@
<script>
import { form, rules, options } from "./form.js";
import { cateSelect,shopSelect,vendorSelect,brandSelect,goodsEdit,goodsInfo } from "@/api/shop/goods"
import {
cateSelect,
shopSelect,
vendorSelect,
brandSelect,
goodsEdit,
goodsInfo,
} from "@/api/shop/goods";
export default {
props: {
show: {
@ -127,17 +128,22 @@ export default {
};
},
mounted() {
// this.getItem();
this.getItem();
},
methods: {
getItem() {
//
Promise.all([cateSelect(),shopSelect(),vendorSelect(),brandSelect()]).then(res=>{
this.options.cate = res[0].data
this.options.shop = res[1].data
this.options.vendor = res[2].data
this.options.brand = res[3].data
})
Promise.all([
cateSelect(),
shopSelect(),
vendorSelect(),
brandSelect(),
]).then((res) => {
this.options.cate = res[0].data;
this.options.shop = res[1].data;
this.options.vendor = res[2].data;
this.options.brand = res[3].data;
});
},
addClose() {
this.$refs.ruleForm.resetFields();
@ -152,6 +158,7 @@ export default {
this.addClose();
},
change(data) {
// console.log(data);
this.form.categoryFirstId = data[0];
this.form.categorySecondId = data[1];
this.form.categoryThirdId = data[2];
@ -175,9 +182,13 @@ export default {
handler(val) {
if (val !== null) {
this.form.id = val;
goodsInfo({appGoodsPushId:val}).then(res=>{
this.form = res.data
})
goodsInfo({ appGoodsPushId: val }).then((res) => {
this.form = res.data;
this.cateValue[0] = res.data.categoryFirstId
this.cateValue[1] = res.data.categorySecondId
this.cateValue[2] = res.data.categoryThirdId
// console.log(this.cateValue);
});
}
},
immediate: true,

@ -20,7 +20,6 @@ export const rules = {
shopId:[{required:true,message:'请选择',trigger:'change'}],
vendorId:[{required:true,message:'请选择',trigger:'change'}],
brandId: [{ required: true, message: '请选择', trigger: 'change' }],
cateValue: [{ required: true, message: '请选择', trigger: 'change',type: 'array'}],
sellPrice:[{required:true,message:'请输入',trigger:'blur'}],
discountPrice:[{required:true,message:'请输入',trigger:'blur'}],
}

@ -127,7 +127,7 @@ export default {
};
},
mounted() {
// this.getItem();
this.getItem();
},
methods: {
getItem() {

@ -0,0 +1,114 @@
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,
}

@ -0,0 +1,28 @@
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:'管家' },
],
}

@ -0,0 +1,241 @@
<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>

@ -0,0 +1,163 @@
<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
>
<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">
<a-space>
<a class="ant-dropdown-link" @click="edit(row.id)"></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>
<addForm
:show="drawer.show"
@success="success"
@addClose="addClose"
:editId="editId"
></addForm>
</div>
</template>
<script>
import { announcementList, announcementDel } from "@/api/operation/announcement";
import { formItem, columns, pagination } from "./depend/config";
import addForm from "./depend/form.vue";
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: [],
};
},
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;
},
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);
}
},
//
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;
},
},
};
</script>
<style lang="less" scoped>
.table-img {
width: 40px;
height: 40px;
}
</style>

@ -0,0 +1,114 @@
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,
}

@ -0,0 +1,28 @@
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:'管家' },
],
}

@ -0,0 +1,241 @@
<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>

@ -0,0 +1,163 @@
<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
>
<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">
<a-space>
<a class="ant-dropdown-link" @click="edit(row.id)"></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>
<addForm
:show="drawer.show"
@success="success"
@addClose="addClose"
:editId="editId"
></addForm>
</div>
</template>
<script>
import { announcementList, announcementDel } from "@/api/operation/announcement";
import { formItem, columns, pagination } from "./depend/config";
import addForm from "./depend/form.vue";
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: [],
};
},
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;
},
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);
}
},
//
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;
},
},
};
</script>
<style lang="less" scoped>
.table-img {
width: 40px;
height: 40px;
}
</style>

@ -0,0 +1,114 @@
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,
}

@ -0,0 +1,28 @@
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:'管家' },
],
}

@ -0,0 +1,241 @@
<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>

@ -0,0 +1,163 @@
<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
>
<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">
<a-space>
<a class="ant-dropdown-link" @click="edit(row.id)"></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>
<addForm
:show="drawer.show"
@success="success"
@addClose="addClose"
:editId="editId"
></addForm>
</div>
</template>
<script>
import { announcementList, announcementDel } from "@/api/operation/announcement";
import { formItem, columns, pagination } from "./depend/config";
import addForm from "./depend/form.vue";
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: [],
};
},
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;
},
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);
}
},
//
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;
},
},
};
</script>
<style lang="less" scoped>
.table-img {
width: 40px;
height: 40px;
}
</style>

@ -0,0 +1,9 @@
export const form = {
id: undefined,
type: undefined,
showWeights: 0,
customizeUrl: "",
isShow: false,
associationId: undefined,
imgUrls: [],
}

@ -0,0 +1,144 @@
<template>
<div>
<a-modal
width="90%"
title="选择链接"
:visible="show"
@ok="handleOk"
@cancel="handleCancel"
>
<div>
<a-table
:columns="columns[typeMean]"
:data-source="tableData"
:pagination="pagination"
:scroll="{ x: 1400 }"
@change="handleTableChange"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: selectionChoosed,
}"
:row-key="
(record, index) => {
return record.id;
}
"
>
</a-table>
</div>
</a-modal>
</div>
</template>
<script>
import { columns, pagination } from "./tableConfig.js";
import { shopPushList } from "@/api/shop/goods";
import { newsList } from "@/api/operation/news";
import { announcementList } from "@/api/operation/announcement";
import { activityList } from "@/api/operation/activity";
export default {
props: {
type: Number,
show:Boolean
},
data() {
return {
columns,
pagination,
typeMean: "shop",
tableData: [],
selectedRowKeys: [],
joinString:''
};
},
methods: {
selectionChoosed(data) {
this.selectedRowKeys = data;
},
handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination };
pager.current = pagination.current;
pager.pageSize = pagination.pageSize;
this.pagination = pager;
this.getData();
},
handleCancel(){
this.$emit('close')
this.selectedRowKeys = []
},
handleOk(){
if(this.selectedRowKeys.length === 0){
this.$message.error('请选择')
}
else if(this.selectedRowKeys.length > 1){
this.$message.error('只能选择一条链接')
}else{
for(let k of this.tableData){
if(k.id===this.selectedRowKeys[0]){
if(this.typeMean === 'shop'){
this.joinString = k.skuName
}else if(this.typeMean === 'news'){
this.joinString = k.title
}else if(this.typeMean === 'announcement'){
this.joinString = k.title
}else if(this.typeMean === 'activity'){
this.joinString = k.title
}
}
}
this.$emit('submit',this.selectedRowKeys,this.joinString)
this.selectedRowKeys = []
}
},
},
watch: {
type: {
handler(val) {
if (val === 2) {
this.typeMean = 'shop'
shopPushList({
pageNum: this.pagination.current,
size: this.pagination.pageSize,
}).then((res) => {
this.tableData = res.data.rows;
this.pagination.total = res.data.total;
});
}else if (val === 3) {
this.typeMean = 'news'
newsList({
pageNum: this.pagination.current,
size: this.pagination.pageSize,
}).then((res) => {
this.tableData = res.data.rows;
this.pagination.total = res.data.total;
});
}else if (val === 4) {
this.typeMean = 'announcement'
announcementList({
pageNum: this.pagination.current,
size: this.pagination.pageSize,
}).then((res) => {
this.tableData = res.data.rows;
this.pagination.total = res.data.total;
});
}else if (val === 5) {
this.typeMean = 'activity'
activityList({
pageNum: this.pagination.current,
size: this.pagination.pageSize,
}).then((res) => {
this.tableData = res.data.rows;
this.pagination.total = res.data.total;
});
}
},
immediate: true,
},
},
};
</script>
<style>
</style>

@ -0,0 +1,268 @@
export const columns = {
shop:[
{
title: "商品名称",
width: "12%",
dataIndex: "skuName",
},
{
title: "sku编码",
width: "12%",
dataIndex: "skuId",
},
{
title: "商品类型",
width: "7%",
dataIndex: "mallType",
customRender: function (mallType) {
switch (mallType) {
case 1:
return 'Jcook'
break;
default:
break;
}
}
},
{
title: "店铺名",
width: "8%",
dataIndex: "shopName",
},
{
title: "品牌名",
width: "8%",
dataIndex: "brandName",
},
{
title: "供应商名",
width: "8%",
dataIndex: "vendorName",
},
{
title: "一级分类名称",
width: "8%",
dataIndex: "categoryFirstName",
},
{
title: "二级分类名称",
width: "8%",
dataIndex: "categorySecondName",
},
{
title: "三级分类名称",
width: "8%",
dataIndex: "categoryThirdName",
},
{
title: "主图url",
width: "8%",
dataIndex: "mainPhoto",
},
{
title: "售卖价",
width: "8%",
dataIndex: "sellPrice",
},
{
title: "折扣价",
width: "8%",
dataIndex: "discountPrice",
},
{
title: "浏览量",
width: "8%",
dataIndex: "viewsNum",
},
],
news: [
{
title: "标题",
dataIndex: "title",
},
{
title: "分类",
dataIndex: "categoryName",
},
{
title: "发布状态",
dataIndex: "status",
customRender: function (status) {
switch (status) {
case 1:
return '未发布'
case 2:
return '已发布'
}
}
},
{
title: "阅读量",
dataIndex: "viewsNum",
},
{
title: "创建时间",
dataIndex: "createDate",
},
],
announcement: [
{
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%",
}
],
activity:[
{
title: "发布时间",
dataIndex: "createDate",
width: "12%",
},
{
title: "图片",
dataIndex: "imgpic",
width: "10%",
scopedSlots: { customRender: "imgpic"}
},
{
title: "活动状态",
dataIndex: "status",
width: "6%",
customRender: function (status) {
switch (status) {
case 1:
return '报名未开始'
case 2:
return '报名进行中'
case 3:
return '活动未开始'
case 4:
return '活动进行中'
case 5:
return '活动已结束'
}
}
},
{
title: "活动标题",
dataIndex: "title",
width: "8%",
},
{
title: "活动地点",
dataIndex: "activityAddress",
width: "8%",
},
{
title: "是否显示在app",
dataIndex: "isShow",
width: "5%",
customRender: function (isShow) {
switch (isShow) {
case true:
return '显示'
case false:
return '不显示'
}
}
},
{
title: "主办方",
dataIndex: "organizerName",
width: "8%",
},
{
title: "活动内容",
dataIndex: "content",
width: "8%",
},
{
title: "报名人数",
dataIndex: "registrationNum",
width: "5%",
},
{
title: "报名时间",
width: "12%",
customRender: function (data) {
return (data.registrationStartTime + '——' + data.registrationEndTime)
}
},
{
title: "活动时间",
width: "12%",
customRender: function (data) {
return (data.activityStartTime + '——' + data.activityEndTime)
}
}
]
}
export const pagination = {
current: 1,
total: 0,
pageSize: 5,
showTotal: (total) => `${total}`,
}

@ -0,0 +1,307 @@
<template>
<div>
<div class="cardTitle">商城轮播图设置</div>
<a-divider></a-divider>
<a-button class="add-btn" style="margin: 10px" @click="newSwiper"
>添加轮播图</a-button
>
<a-card
hoverable
style="width: 70%; margin-top: 10px"
v-for="item in cardList"
:key="item.id"
>
<span class="card-close" @click="del(item.id)">×</span>
<a-row>
<a-col :span="9">
<div style="color: #00000073; padding-bottom: 10px">
上传图片尺寸: 750*300
</div>
<img
:src="$ImgUrl(item.imgList[0].url)"
v-if="item.imgList.length > 0"
class="list-img"
alt=""
/>
<span v-else></span>
</a-col>
<a-col :span="11">
<a-descriptions layout="vertical" :column="1">
<a-descriptions-item label="链接设置">
{{ item.customizeUrl }}
</a-descriptions-item>
<a-descriptions-item label="是否显示在用户端">
{{ item.isShow ? "是" : "否" }}
</a-descriptions-item>
<a-descriptions-item label="显示权重">
{{ item.showWeights }}
</a-descriptions-item>
</a-descriptions>
</a-col>
<a-col :span="4">
<a-button class="add-btn" @click="edit(item)"></a-button>
</a-col>
</a-row>
</a-card>
<!-- list -->
<a-modal
:title="add.title"
:visible="add.show"
@ok="saveSetting"
@cancel="newSwiperClose"
width="900px"
>
<a-row>
<a-col :span="9">
<div style="color: #00000073; padding-bottom: 10px">
上传图片尺寸: 750*300
</div>
<commonUpload
:fileList="fileList"
@handleChange="handleChange"
></commonUpload>
</a-col>
<a-col :span="15">
<a-descriptions layout="vertical" :column="1">
<a-descriptions-item label="链接设置">
<a-input-group compact>
<a-select
style="width: 120px"
v-model="form.type"
placeholder="请选择类型"
@change="changeType"
>
<a-select-option :value="1"> 自定义链接 </a-select-option>
<a-select-option :value="2"> 商城 </a-select-option>
<a-select-option :value="3"> 资讯 </a-select-option>
<a-select-option :value="4"> 公告 </a-select-option>
<a-select-option :value="5"> 活动 </a-select-option>
</a-select>
<a-input
v-if="form.type === 1"
style="width: 200px; background: #0000000f"
placeholder="请输入链接"
v-model="form.customizeUrl"
></a-input>
<a-button
v-else-if="form.type !== 1 && form.customizeUrl === ''"
style="width: 100px; background: #0000000f"
@click="table.show = true"
>请选择链接
</a-button>
<a-button
style="width: 70%; background: #0000000f; overflow: hidden"
@click="table.show = true"
v-else
>{{ form.customizeUrl }}</a-button
>
</a-input-group>
</a-descriptions-item>
<a-descriptions-item label="是否显示在用户端">
<a-switch
checked-children="开"
un-checked-children="关"
v-model="form.isShow"
></a-switch>
</a-descriptions-item>
<a-descriptions-item label="显示权重">
<a-input
type="number"
v-model.number="form.showWeights"
></a-input>
</a-descriptions-item>
</a-descriptions>
</a-col>
</a-row>
</a-modal>
<chooseTable
:show="table.show"
:type="form.type"
@submit="submit"
@close="close"
/>
</div>
</template>
<script>
import { form } from "./depend/config";
import {
swiperList,
swiperInsert,
swiperDel,
swiperUpdate,
} from "@/api/operation/swiper";
import chooseTable from "./depend/table.vue";
export default {
components: {
chooseTable,
},
data() {
return {
table: {
show: false,
},
fileList: [],
cardList: [],
add: {
show: false,
title: "添加轮播图",
},
form,
};
},
mounted() {
this.getData();
},
methods: {
async getData() {
let res = await swiperList();
this.cardList = res.data;
},
//
newSwiper() {
this.add = {
show: true,
title: "添加轮播图",
};
},
//
edit(data) {
this.add = {
show: true,
title: "修改轮播图",
};
console.log(data);
this.form.id = data.id;
this.form.isShow = data.isShow;
this.form.showWeights = data.showWeights;
this.form.type = data.type;
this.form.customizeUrl = data.customizeUrl;
this.form.associationId = data.associationId;
if (data.imgList.length > 0) {
//
this.form.imgUrls.push(data.imgList[0].url);
const file = [];
for (let item of data.imgList) {
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.fileList = file;
}
},
newSwiperClose() {
this.add = {
show: false,
title: "添加轮播图",
};
this.fileList = [];
this.form.imgUrls = [];
this.form = {
id: undefined,
type: undefined,
showWeights: 0,
customizeUrl: "",
isShow: false,
associationId: undefined,
imgUrls: [],
};
},
//
submit(data, customizeUrl) {
this.form.customizeUrl = customizeUrl;
this.form.associationId = data[0];
this.close();
},
//
async saveSetting() {
if (this.add.title === "添加轮播图") {
let res = await swiperInsert(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
this.newSwiperClose();
} else {
this.$message.error(res.msg);
}
} else if (this.add.title === "修改轮播图") {
let res = await swiperUpdate(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
this.newSwiperClose();
} else {
this.$message.error(res.msg);
}
}
},
//
close() {
this.table.show = false;
},
changeType() {
this.form.customizeUrl = "";
},
//
async del(id) {
this.$confirm({
title: "是否删除",
icon: "delete",
onOk: async () => {
swiperDel({ homepageCarouselId: id }).then((res) => {
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
}
});
},
});
},
//
handleChange(data) {
console.log(data);
this.fileList = data;
//
if (this.fileList.length === 0) {
this.form.imgUrls = [];
} else if (data[0].status === "done") {
this.form.imgUrls.push(data[0].response.data);
}
},
},
};
</script>
<style lang="less" scoped>
/deep/.ant-upload.ant-upload-select-picture-card {
width: 90%;
height: 200px;
}
/deep/.ant-upload-list-picture-card .ant-upload-list-item {
width: 90%;
height: 200px;
}
/deep/.ant-upload-list-picture-card-container {
width: 90%;
height: 200px;
}
.list-img {
width: 90%;
height: 200px;
}
.card-close {
position: absolute;
right: 10px;
top: -3px;
cursor: pointer;
font-size: 20px;
}
</style>
Loading…
Cancel
Save