bibi 3 years ago
parent 0fe77bb4f0
commit 6e58f4c30a

@ -9,3 +9,31 @@ export function shopPushList(params) {
params: params,
})
}
export function jcookGoodsList(params) {
return httpService({
url: `/user/shop/jcookGoodsList`,
method: 'get',
params: params,
})
}
export function offShelf(params) {
return httpService({
url: `/user/shop/offShelf`,
method: 'post',
data: params,
})
}
export function onShelf(params) {
return httpService({
url: `/user/shop/onShelf`,
method: 'post',
data: params,
})
}
export function jcookGoodsBatchPush(params) {
return httpService({
url: `/user/shop/jcookGoodsBatchPush`,
method: 'post',
data: params,
})
}

@ -25,6 +25,14 @@ export default [
component: resolve => require(['@/views/Shop/GoodsManage/_goodsList'], resolve),
meta: {title: '商品列表'},
},
{
path: '/GoodsManage/JcookList',
name: "JcookList",
title: "jcook商品库",
hide: false,
component: resolve => require(['@/views/Shop/GoodsManage/_jcookList'], resolve),
meta: {title: 'jcook商品库'},
},
{
path: '/GoodsManage/GoodsCate',
name: "GoodsCate",

@ -33,6 +33,9 @@
<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,
@ -62,6 +65,7 @@ export default {
},
handleCancel(){
this.$emit('close')
this.selectedRowKeys = []
},
handleOk(){
if(this.selectedRowKeys.length === 0){
@ -72,10 +76,19 @@ export default {
}else{
for(let k of this.tableData){
if(k.id===this.selectedRowKeys[0]){
this.joinString = k.skuName
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 = []
}
},
@ -84,6 +97,7 @@ export default {
type: {
handler(val) {
if (val === 2) {
this.typeMean = 'shop'
shopPushList({
pageNum: this.pagination.current,
size: this.pagination.pageSize,
@ -91,8 +105,33 @@ export default {
this.tableData = res.data.rows;
this.pagination.total = res.data.total;
});
}else{
this.typeMean = 'shop'
}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,

@ -75,9 +75,190 @@ export const columns = {
dataIndex: "viewsNum",
},
],
news: [],
notice: [],
active:[]
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,

@ -98,7 +98,11 @@
</a-input-group>
</a-descriptions-item>
<a-descriptions-item label="是否显示在用户端">
<a-switch checked-children="" un-checked-children="" v-model="form.isShow"></a-switch>
<a-switch
checked-children="开"
un-checked-children="关"
v-model="form.isShow"
></a-switch>
</a-descriptions-item>
<a-descriptions-item label="显示权重">
<a-input
@ -159,14 +163,14 @@ export default {
newSwiper() {
this.add = {
show: true,
title: "添加轮播图"
title: "添加轮播图",
};
},
//
edit(data) {
this.add = {
show: true,
title: "修改轮播图"
title: "修改轮播图",
};
console.log(data);
this.form.id = data.id;
@ -266,9 +270,9 @@ export default {
console.log(data);
this.fileList = data;
//
if(this.fileList.length===0){
this.form.imgUrls=[]
}else if (data[0].status === "done") {
if (this.fileList.length === 0) {
this.form.imgUrls = [];
} else if (data[0].status === "done") {
this.form.imgUrls.push(data[0].response.data);
}
},

@ -73,6 +73,28 @@ export const columns = [
width: "8%",
dataIndex: "viewsNum",
},
{
title: "操作",
dataIndex: "action",
key: "action",
width: "180",
fixed: "right",
scopedSlots: { customRender: "action" },
},
]
export const formItem = [
{
type: 'input',
label:'sku编码',
prop:'skuId',
placeholder:'请输入'
},
{
type: 'input',
label:'商品名称',
prop:'skuName',
placeholder:'请输入'
},
]
export const pagination = {
current: 1,

@ -1,5 +1,9 @@
<template>
<div>
<div class="cardTitle">
<span>商品管理</span>
</div>
<searchForm :formItem="formItem" @getSearch="getData($event)"></searchForm>
<a-table
:columns="columns"
:data-source="tableData"
@ -16,17 +20,41 @@
}
"
>
<span slot="action" slot-scope="text, row">
<a-space>
<a class="ant-dropdown-link" @click="onSell([row.id])"></a>
<a class="ant-dropdown-link" @click="offSell([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="on"> 批量上架 </a-menu-item>
<a-menu-item key="off"> 批量下架 </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>
</template>
<script>
import { columns,pagination } from "./depend/config.js";
import { shopPushList } from "@/api/shop/goods";
import { columns,pagination,formItem } from "./depend/config.js";
import { shopPushList,offShelf,onShelf} from "@/api/shop/goods";
export default {
data() {
return {
columns,pagination,
searchForm: {
skuId:undefined,
skuName:undefined
},
columns,pagination,formItem,
tableData: [],
selectedRowKeys: [],
};
@ -35,8 +63,14 @@ export default {
this.getData();
},
methods: {
getData() {
getData(data) {
if (data !== undefined) {
console.log(data);
this.searchForm = data;
console.log(this.searchForm);
}
shopPushList({
...this.searchForm,
pageNum: this.pagination.current,
size: this.pagination.pageSize,
}).then((res) => {
@ -56,6 +90,51 @@ export default {
this.pagination = pager;
this.getData();
},
onSell(ids) {
console.log(ids);
this.$confirm({
title: "是否上架",
icon: "caret-up",
onOk: async () => {
let res = await onShelf({ ids: ids });
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
}
},
});
},
offSell(ids) {
console.log(ids);
this.$confirm({
title: "是否下架",
icon: "caret-down",
onOk: async () => {
let res = await offShelf({ ids: ids });
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
}
},
});
},
handleMenuClick(data) {
console.log(data);
if (data.key === "on") {
this.onSell(this.selectedRowKeys);
}else if(data.key === "off"){
this.offSell(this.selectedRowKeys);
}
},
},
computed: {
hasSelected() {
return this.selectedRowKeys.length > 0;
},
},
};
</script>

@ -0,0 +1,149 @@
export const columns = [
{
title: "商品名称",
width: "8%",
dataIndex: "skuName",
},
{
title: "sku编码",
width: "8%",
dataIndex: "skuId",
},
{
title: "店铺名",
width: "8%",
dataIndex: "shopName",
},
{
title: "品牌名",
width: "8%",
dataIndex: "brandName",
},
{
title: "供应商名",
width: "8%",
dataIndex: "vendorName",
},
{
title: "一级分类名称",
width: "5%",
dataIndex: "categoryFirstName",
},
{
title: "二级分类名称",
width: "5%",
dataIndex: "categorySecondName",
},
{
title: "三级分类名称",
width: "5%",
dataIndex: "categoryThirdName",
},
{
title: "上架状态",
width: "5%",
dataIndex: "status",
customRender: function (status) {
switch (status) {
case false:
return '下架'
break;
case true:
return '上架'
default:
break;
}
}
},
{
title: "app商品库推送状态",
width: "5%",
dataIndex: "appShopPush",
customRender: function (appShopPush) {
switch (appShopPush) {
case false:
return '未推送'
break;
case true:
return '已推送'
default:
break;
}
}
},
{
title: "主图url",
width: "8%",
dataIndex: "mainPhoto",
},
{
title: "供货价",
width: "5%",
dataIndex: "supplyPrices",
},
{
title: "指导价",
width: "5%",
dataIndex: "guidePrices",
},
{
title: "更新时间",
width: "8%",
dataIndex: "updatedAt",
},
{
title: "操作",
dataIndex: "action",
key: "action",
width: "180",
fixed: "right",
scopedSlots: { customRender: "action" },
},
]
export const formItem = [
{
type: 'input',
label:'sku编码',
prop:'jcookSkuId',
placeholder:'请输入'
},
{
type: 'select',
label:'上架状态',
prop:'status',
option:[{ id:0,name:'下架'},{ id:1,name:'上架'},],
placeholder:'请选择状态'
},
{
type: 'input',
label:'商品名称',
prop:'skuName',
placeholder:'请输入'
},
{
type: 'input',
label:'店铺名',
prop:'shopName',
placeholder:'请输入'
},
{
type: 'input',
label:'供应商名称',
prop:'vendorName',
placeholder:'请输入'
},
{
type: 'input',
label:'品牌名称',
prop:'brandName',
placeholder:'请输入'
},
]
export const pagination = {
current: 1,
total: 0,
pageSize: 10,
showTotal: (total) => `${total}`,
showSizeChanger: true,
showQuickJumper: true,
}

@ -0,0 +1,21 @@
export const form = {
id:undefined,
title:undefined,
categoryId:undefined,
status:undefined,
content:undefined,
imgUrls:[]
}
export const rules = {
title:[{required:true,message:'请输入标题',trigger:'blur'}],
categoryId:[{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:'已发布' },
],
categoryId:[]
}

@ -0,0 +1,201 @@
<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-row>
<a-col :span="12">
<a-form-model-item prop="title" label="标题">
<a-input
v-model="form.title"
placeholder="请输入标题"
style="width: 80%"
></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="categoryId" label="资讯分类">
<a-select
v-model="form.categoryId"
placeholder="请选择"
style="width: 80%"
>
<a-select-option
v-for="item in options.categoryId"
:key="item.id"
:value="item.id"
>{{ item.name }}</a-select-option
>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<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-col>
<a-col :span="24">
<a-form-model-item prop="content" label="内容">
<a-textarea
v-model="form.content"
placeholder="请输入内容"
style="width: 80%"
></a-textarea>
</a-form-model-item>
</a-col>
<a-col :span="24">
资讯封面图片
<commonUpload
:fileList="fileList"
@handleChange="handleChange"
></commonUpload>
</a-col>
</a-row>
</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 { form, rules, options } from "./form.js";
import {
newsInsert,
newsUpdate,
newsInfo,
itemSelect
} from "@/api/operation/news/index.js";
export default {
props: {
show: {
type: Boolean,
default: false,
},
editId: Number,
},
data() {
return {
title: "新增资讯",
form,
rules,
options,
fileList: [],
};
},
mounted() {
this.getItem();
},
methods: {
async getItem() {
let res = await itemSelect();
this.options.categoryId = res.data;
},
addClose() {
this.$refs.ruleForm.resetFields();
this.fileList = [];
this.form.imgUrls = [];
this.$emit("addClose");
},
success() {
this.$emit("success");
this.addClose();
},
submit() {
this.$refs.ruleForm.validate(async (valid) => {
if (valid) {
if (this.editId === null) {
let res = await newsInsert(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 newsUpdate(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.success();
} else {
this.$message.error(res.msg);
}
}
}
});
},
handleChange(data) {
this.fileList = data;
if (data[0].status === "done") {
console.log("-------done-------");
this.form.imgUrls.push(data[0].response.data);
}
},
},
watch: {
editId: {
handler(val) {
if (val !== null) {
this.title = "修改资讯";
this.form.id = val;
newsInfo({ informationId: val }).then((res) => {
this.form = res.data;
if (res.data.imgList.length > 0) {
console.log(res.data.imgList);
const pic = [];
for (let item of res.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),
};
pic.push(obj);
}
this.fileList = pic;
} else {
this.form.imgUrls = [];
}
});
} else {
this.title = "新增资讯";
}
},
// immediate: true,
},
},
};
</script>
<style></style>

@ -0,0 +1,156 @@
<template>
<div>
<div class="cardTitle">jcook商品库</div>
<searchForm :formItem="formItem" @getSearch="getData($event)" ></searchForm>
<a-table
:columns="columns"
:data-source="tableData"
:pagination="pagination"
:scroll="{ x: 2600 }"
@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="push(row)"></a>
</a-space>
</span>
</a-table>
<div class="action">
<a-dropdown :disabled="!hasSelected">
<a-menu slot="overlay" @click="handleMenuClick">
<a-menu-item key="on"> 批量上架</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 { jcookGoodsList,jcookGoodsBatchPush } from "@/api/shop/goods";
import { formItem, columns, pagination } from "./depend/config";
import addForm from "./depend/form.vue";
export default {
components: {
addForm,
},
data() {
return {
drawer: {
show: false,
detail:false
},
editId: null,
tableData: [],
searchForm: {
jcookSkuId:'',
skuName:'',
shopName:'',
vendorName:'',
brandName:'',
status: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 jcookGoodsList({
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;
},
handleMenuClick(data) {
console.log(data);
if (data.key === "on") {
this.onSell(this.selectedRowKeys);
}
},
onSell(ids) {
console.log(ids);
this.$confirm({
title: "是否上架",
icon: "caret-up",
onOk: async () => {
let res = await jcookGoodsBatchPush({ ids: ids });
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
}
},
});
},
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();
},
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>
Loading…
Cancel
Save