diff --git a/src/api/modules/marketing.js b/src/api/modules/marketing.js index f9a8c08..13a50d5 100644 --- a/src/api/modules/marketing.js +++ b/src/api/modules/marketing.js @@ -146,4 +146,12 @@ export const marketing = { data, }); }, + //概况 + overview: (data) => { + return $http.request({ + url: `/merchant-api/memberUnitUser/overview`, + method: "get", + params: data, + }); + }, }; diff --git a/src/api/modules/mer_admin.js b/src/api/modules/mer_admin.js index 4fe0cbc..82abafa 100644 --- a/src/api/modules/mer_admin.js +++ b/src/api/modules/mer_admin.js @@ -48,6 +48,10 @@ export const mer_admin = { getProductPage: (data) => { return $http.post(`/merchant-api/product/page`, data); }, + //商品概况 + getProductOverview: (data) => { + return $http.post(`/merchant-api/product/overview`, data); + }, //商户商品分类 getProductCategory: (data) => { return $http.request({ diff --git a/src/router/full-routers.js b/src/router/full-routers.js index d580fd2..7760a68 100644 --- a/src/router/full-routers.js +++ b/src/router/full-routers.js @@ -30,20 +30,46 @@ export default { menuId: getUUID(), parentId: 0, parentName: null, - name: "商品", - url: "local-course/resources", + name: "运营管理", + url: "operation-management", perms: "", type: 0, - elIcon: "el-icon-menu", + elIcon: "el-icon-s-help", orderNum: 0, open: null, list: [ + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "店铺列表", + url: "operation-management/shop-list/index", + perms: "", + type: 1, + elIcon: "el-icon-shopping-cart-full", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "分销商列表", + url: "operation-management/distributor/index", + perms: "", + type: 1, + elIcon: "el-icon-shopping-cart-full", + orderNum: 0, + open: null, + list: [], + }, { menuId: getUUID(), parentId: 0, parentName: null, name: "商品管理", - url: "product/commodity/index", + url: "operation-management/commodity/index", perms: "", type: 1, elIcon: "el-icon-menu", @@ -56,7 +82,7 @@ export default { parentId: 0, parentName: null, name: "订单管理", - url: "product/order/index", + url: "operation-management/order/index", perms: "", type: 1, elIcon: "el-icon-menu", @@ -69,7 +95,7 @@ export default { parentId: 0, parentName: null, name: "轮播图管理", - url: "product/banner/index", + url: "operation-management/banner/index", perms: "", type: 1, elIcon: "el-icon-menu", @@ -82,7 +108,7 @@ export default { parentId: 0, parentName: null, name: "公告管理", - url: "product/notice/index", + url: "operation-management/notice/index", perms: "", type: 1, elIcon: "el-icon-menu", @@ -90,123 +116,15 @@ export default { open: null, list: [], }, - ], - }, - { - menuId: getUUID(), - parentId: 0, - parentName: null, - name: "运费管理", - url: "", - perms: "", - type: 0, - elIcon: "el-icon-money", - orderNum: 0, - open: null, - list: [ { menuId: getUUID(), parentId: 0, parentName: null, - name: "运费模板", - url: "logistics-fare/logistics-template/index", + name: "角色管理", + url: "operation-management/role/index", perms: "", type: 1, - elIcon: "el-icon-postcard", - orderNum: 0, - open: null, - list: [], - }, - ], - }, - { - menuId: getUUID(), - parentId: 0, - parentName: null, - name: "银行卡管理", - url: "bank-card/index", - perms: "", - type: 0, - elIcon: "el-icon-picture-outline", - orderNum: 0, - open: null, - list: [], - hideInMenu: true, - }, - { - menuId: getUUID(), - parentId: 0, - parentName: null, - name: "品牌管理", - url: "", - perms: "", - type: 0, - elIcon: "el-icon-money", - orderNum: 0, - open: null, - list: [ - { - menuId: getUUID(), - parentId: 0, - parentName: null, - name: "品牌管理", - url: "brand/config/index", - perms: "", - type: 1, - elIcon: "el-icon-postcard", - orderNum: 0, - open: null, - list: [], - }, - ], - }, - { - menuId: getUUID(), - parentId: 0, - parentName: null, - name: "优惠卷管理", - url: "coupon/index", - perms: "", - type: 0, - elIcon: "el-icon-document-remove", - orderNum: 0, - open: null, - list: [], - }, - { - menuId: getUUID(), - parentId: 0, - parentName: null, - name: "预售管理", - url: "", - perms: "", - type: 0, - elIcon: "el-icon-data-analysis", - orderNum: 0, - open: null, - list: [ - { - menuId: getUUID(), - parentId: 0, - parentName: null, - name: "预售商品", - url: "presale/products/index", - perms: "", - type: 1, - elIcon: "el-icon-postcard", - orderNum: 0, - open: null, - list: [], - }, - { - menuId: getUUID(), - parentId: 0, - parentName: null, - name: "预售订单", - url: "presale/order/index", - perms: "", - type: 1, - elIcon: "el-icon-postcard", + elIcon: "el-icon-user", orderNum: 0, open: null, list: [], @@ -218,7 +136,7 @@ export default { parentId: 0, parentName: null, name: "数据中心", - url: "", + url: "datacenter", perms: "", type: 0, elIcon: "el-icon-tickets", @@ -270,8 +188,102 @@ export default { menuId: getUUID(), parentId: 0, parentName: null, - name: "营销管理", - url: "", + name: "银行卡管理", + url: "bank-card/index", + perms: "", + type: 0, + elIcon: "el-icon-picture-outline", + orderNum: 0, + open: null, + list: [], + hideInMenu: true, + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "品牌管理", + url: "brand", + perms: "", + type: 0, + elIcon: "el-icon-money", + orderNum: 0, + open: null, + list: [ + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "品牌管理", + url: "brand/config/index", + perms: "", + type: 1, + elIcon: "el-icon-postcard", + orderNum: 0, + open: null, + list: [], + }, + ], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "优惠卷营销工具管理", + url: "coupon/index", + perms: "", + type: 0, + elIcon: "el-icon-document-remove", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "预售营销工具管理", + url: "presale", + perms: "", + type: 0, + elIcon: "el-icon-data-analysis", + orderNum: 0, + open: null, + list: [ + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "预售商品", + url: "presale/products/index", + perms: "", + type: 1, + elIcon: "el-icon-postcard", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "预售订单", + url: "presale/order/index", + perms: "", + type: 1, + elIcon: "el-icon-postcard", + orderNum: 0, + open: null, + list: [], + }, + ], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "会员营销工具管理", + url: "marketing", perms: "", type: 0, elIcon: "el-icon-tickets", @@ -350,7 +362,7 @@ export default { parentId: 0, parentName: null, name: "代理商", - url: "", + url: "agent", perms: "", type: 0, elIcon: "el-icon-tickets", @@ -409,32 +421,6 @@ export default { open: null, list: [], }, - { - menuId: getUUID(), - parentId: 0, - parentName: null, - name: "店铺列表", - url: "agent/shop-list/index", - perms: "", - type: 1, - elIcon: "el-icon-shopping-cart-full", - orderNum: 0, - open: null, - list: [], - }, - { - menuId: getUUID(), - parentId: 0, - parentName: null, - name: "分销商列表", - url: "agent/distributor/index", - perms: "", - type: 1, - elIcon: "el-icon-shopping-cart-full", - orderNum: 0, - open: null, - list: [], - }, { menuId: getUUID(), parentId: 0, @@ -449,6 +435,7 @@ export default { list: [], }, ], + hideInMenu: true, }, { menuId: getUUID(), @@ -456,7 +443,7 @@ export default { parentName: null, name: "钱包管理", url: "local-course/resources", - perms: "", + perms: "wallet", type: 0, elIcon: "el-icon-menu", orderNum: 0, @@ -477,6 +464,33 @@ export default { }, ], }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "运费管理", + url: "ogistics-fare", + perms: "", + type: 0, + elIcon: "el-icon-money", + orderNum: 0, + open: null, + list: [ + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "运费模板", + url: "logistics-fare/logistics-template/index", + perms: "", + type: 1, + elIcon: "el-icon-postcard", + orderNum: 0, + open: null, + list: [], + }, + ], + }, ], code: 0, permissions: [], diff --git a/src/router/index.js b/src/router/index.js index 96c877a..d3f8feb 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,7 +8,7 @@ import Vue from "vue"; import Router from "vue-router"; import http from "@/utils/httpRequest"; import { isURL } from "@/utils/validate"; -import { clearLoginInfo } from "@/utils"; +import { clearLoginInfo, getMenu } from "@/utils"; import FULL_ROUTERS from "./full-routers"; import $api from "@/api/index.js"; import store from "@/store"; @@ -103,21 +103,24 @@ router.beforeEach((to, from, next) => { $api .getUserInfo() .then(({ data }) => { + let permissionsData = getMenu(data.data.role); const filterTreeData = (data, permissions) => { - return data; //临时性返回所有菜单方便调试 - // return data.reduce((filtered, node) => { - // // 如果节点的权限在权限数组中 - // if (permissions.includes(node.url)) { - // // 递归过滤子节点 - // const list = filterTreeData(node.list || [], permissions); - // // 创建一个新的节点,包含过滤后的子节点 - // filtered.push({ - // ...node, - // list, - // }); - // } - // return filtered; - // }, []); + console.log(data); + + // return data; //临时性返回所有菜单方便调试 + return data.reduce((filtered, node) => { + // 如果节点的权限在权限数组中 + if (permissions.includes(node.url)) { + // 递归过滤子节点 + const list = filterTreeData(node.list || [], permissions); + // 创建一个新的节点,包含过滤后的子节点 + filtered.push({ + ...node, + list, + }); + } + return filtered; + }, []); }; console.log(data, "用户信息"); sessionStorage.setItem("role", JSON.stringify(data.data.role)); @@ -160,10 +163,13 @@ router.beforeEach((to, from, next) => { JSON.stringify(data.data.permissions || "[]") ); //添加全量菜单,根据权限进行过滤 - let _menu = filterTreeData( - FULL_ROUTERS.menuList, - data.data.permissions - ); + // let _menu = filterTreeData( + // FULL_ROUTERS.menuList, + // data.data.permissions + // ); + console.log(permissionsData); + + let _menu = filterTreeData(FULL_ROUTERS.menuList, permissionsData); fnAddDynamicMenuRoutes(_menu); sessionStorage.setItem("menuList", JSON.stringify(_menu)); router.options.isAddDynamicMenuRoutes = true; diff --git a/src/utils/index.js b/src/utils/index.js index 31edfcf..81eeef1 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -136,6 +136,69 @@ function doHandleMonth(month) { } return m; } +/** + * 权限 + * @param {*} min + * @param {*} max + */ +export function getMenu(role) { + if (role == "ROLE_MERCHANT" || role == "ROLE_MANAGER") { + return [ + "operation-management", + "operation-management/commodity/index", + "operation-management/order/index", + "operation-management/banner/index", + "operation-management/notice/index", + "operation-management/role/index", + "datacenter", + "datacenter/customer-analysis/index", + "datacenter/product-analysis/index", + "datacenter/order-analysis/index", + "coupon/index", + "presale", + "presale/products/index", + "presale/order/index", + "marketing", + "marketing/level/index", + "marketing/user/index", + "marketing/points-setting/index", + "marketing/points-mall/index", + "marketing/points-order/index", + "local-course/resources", + "wallet/index", + "ogistics-fare", + "logistics-fare/logistics-template/index", + ]; + } else if (role == "ROLE_BRAND_MANAGER") { + return [ + "operation-management", + "operation-management/shop-list/index", + "operation-management/order/index", + "operation-management/role/index", + "datacenter", + "datacenter/customer-analysis/index", + "datacenter/product-analysis/index", + "datacenter/order-analysis/index", + "brand", + "brand/config/index", + "local-course/resources", + "wallet/index", + ]; + } else if (role == "ROLE_AGENT") { + return [ + "operation-management", + "operation-management/shop-list/index", + "operation-management/order/index", + "operation-management/role/index", + "datacenter", + "datacenter/customer-analysis/index", + "datacenter/product-analysis/index", + "datacenter/order-analysis/index", + "local-course/resources", + "wallet/index", + ]; + } +} export function isNumberStr(str) { return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str); diff --git a/src/views/common/home.vue b/src/views/common/home.vue index 743996c..c89f998 100644 --- a/src/views/common/home.vue +++ b/src/views/common/home.vue @@ -119,7 +119,7 @@ export default { JSON.parse(sessionStorage.getItem("password")) == "123456" && JSON.parse(sessionStorage.getItem("role")) === "ROLE_BRAND_MANAGER" ) { - this.dialogVisible = false; + this.dialogVisible = true; } }, methods: { @@ -128,8 +128,9 @@ export default { console.log(valid); if (valid) { this.$api.mer_admin - .simplePassword({ - password: this.form.password, + .changePassword({ + oldPassword: JSON.parse(sessionStorage.getItem("password")), + newPassword: this.form.password, }) .then((res) => { this.$api.logout().then(({ data }) => { diff --git a/src/views/modules/marketing/user/index.vue b/src/views/modules/marketing/user/index.vue index 11c8910..13a91f5 100644 --- a/src/views/modules/marketing/user/index.vue +++ b/src/views/modules/marketing/user/index.vue @@ -86,6 +86,35 @@ 重置 +
+
+ +
+
用户数量(人)
+
+ {{ + overviewList.totalCount + }} +
+
+
+
+ +
+
今日新增(人)
+
+ {{ + overviewList.todayCount + }} +
+
+
+
+
+ 导出 +
@@ -99,6 +128,8 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/views/modules/product/banner/index.vue b/src/views/modules/operation-management/banner/index.vue similarity index 91% rename from src/views/modules/product/banner/index.vue rename to src/views/modules/operation-management/banner/index.vue index a719add..7b46852 100644 --- a/src/views/modules/product/banner/index.vue +++ b/src/views/modules/operation-management/banner/index.vue @@ -73,6 +73,22 @@ + + + + + + 查询 { this.$refs.oTable.reload(); @@ -203,6 +231,8 @@ export default { this.formInline = { type: 0, ownerId: this.shopId, + module: "shop", + app: 1, }; this.$refs.oTable.reload(); }, diff --git a/src/views/modules/product/banner/popup/add-or-update.vue b/src/views/modules/operation-management/banner/popup/add-or-update.vue similarity index 100% rename from src/views/modules/product/banner/popup/add-or-update.vue rename to src/views/modules/operation-management/banner/popup/add-or-update.vue diff --git a/src/views/modules/product/banner/popup/set-sorting.vue b/src/views/modules/operation-management/banner/popup/set-sorting.vue similarity index 100% rename from src/views/modules/product/banner/popup/set-sorting.vue rename to src/views/modules/operation-management/banner/popup/set-sorting.vue diff --git a/src/views/modules/product/commodity/index.vue b/src/views/modules/operation-management/commodity/index.vue similarity index 83% rename from src/views/modules/product/commodity/index.vue rename to src/views/modules/operation-management/commodity/index.vue index ab0670b..f92adaa 100644 --- a/src/views/modules/product/commodity/index.vue +++ b/src/views/modules/operation-management/commodity/index.vue @@ -62,6 +62,44 @@ 重置 +
+
+ +
+
总商品数量(个)
+
+ {{overview.productCount}} +
+
+
+
+ +
+
上架中商品数量(个)
+
+ {{overview.productOnSaleCount}} +
+
+
+
+ +
+
折扣商品数量(个)
+
+ {{overview.productDiscountCount}} +
+
+
+
+ +
+
仓库中商品数量(个)
+
+ {{overview.productWarehouseCount}} +
+
+
+
@@ -128,6 +166,7 @@ export default { }, productFilterType: "SALE", selectList: [], + overview:{} }; }, created() { @@ -143,14 +182,14 @@ export default { methods: { //如果有多个菜市场调用 getData() { - this.$api.mer_admin - .storeList({ marketId: this.formInline.marketId }) - .then((res) => { - this.formInline.shopId = res.data.data[0].shopId; - this.$nextTick(() => { - this.$refs.oTable.reload(); - }); - }); + // this.$api.mer_admin + // .storeList({ marketId: this.formInline.marketId }) + // .then((res) => { + // this.formInline.shopId = res.data.data[0].shopId; + // this.$nextTick(() => { + // this.$refs.oTable.reload(); + // }); + // }); }, addProduct() { this.$refs.addOrUpdate.toggle().add(this.formInline.shopId); @@ -180,7 +219,6 @@ export default { }, queryList(pageNo, pageSize) { console.log(this.formInline); - this.$api.mer_admin .getProductPage({ p: { @@ -202,6 +240,10 @@ export default { .catch((err) => { this.$refs.oTable.complete(false); }); + this.$api.mer_admin.getProductOverview(this.formInline).then((res) => { + console.log(res,'概况'); + this.overview = res.data.data; + }); }, Reset() { this.formInline = { @@ -427,4 +469,27 @@ export default { }; - \ No newline at end of file + \ No newline at end of file diff --git a/src/views/modules/product/commodity/popup/add-attribute.vue b/src/views/modules/operation-management/commodity/popup/add-attribute.vue similarity index 100% rename from src/views/modules/product/commodity/popup/add-attribute.vue rename to src/views/modules/operation-management/commodity/popup/add-attribute.vue diff --git a/src/views/modules/product/commodity/popup/add-discount.vue b/src/views/modules/operation-management/commodity/popup/add-discount.vue similarity index 100% rename from src/views/modules/product/commodity/popup/add-discount.vue rename to src/views/modules/operation-management/commodity/popup/add-discount.vue diff --git a/src/views/modules/product/commodity/popup/add-or-update.vue b/src/views/modules/operation-management/commodity/popup/add-or-update.vue similarity index 100% rename from src/views/modules/product/commodity/popup/add-or-update.vue rename to src/views/modules/operation-management/commodity/popup/add-or-update.vue diff --git a/src/views/modules/product/commodity/popup/add-price.vue b/src/views/modules/operation-management/commodity/popup/add-price.vue similarity index 100% rename from src/views/modules/product/commodity/popup/add-price.vue rename to src/views/modules/operation-management/commodity/popup/add-price.vue diff --git a/src/views/modules/product/commodity/popup/add-specifications.vue b/src/views/modules/operation-management/commodity/popup/add-specifications.vue similarity index 100% rename from src/views/modules/product/commodity/popup/add-specifications.vue rename to src/views/modules/operation-management/commodity/popup/add-specifications.vue diff --git a/src/views/modules/product/commodity/popup/add-stock.vue b/src/views/modules/operation-management/commodity/popup/add-stock.vue similarity index 100% rename from src/views/modules/product/commodity/popup/add-stock.vue rename to src/views/modules/operation-management/commodity/popup/add-stock.vue diff --git a/src/views/modules/agent/distributor/index.vue b/src/views/modules/operation-management/distributor/index.vue similarity index 100% rename from src/views/modules/agent/distributor/index.vue rename to src/views/modules/operation-management/distributor/index.vue diff --git a/src/views/modules/product/notice/index.vue b/src/views/modules/operation-management/notice/index.vue similarity index 91% rename from src/views/modules/product/notice/index.vue rename to src/views/modules/operation-management/notice/index.vue index 8ea3149..ee02a54 100644 --- a/src/views/modules/product/notice/index.vue +++ b/src/views/modules/operation-management/notice/index.vue @@ -73,6 +73,22 @@ + + + + + + 查询 { this.$refs.oTable.reload(); @@ -203,6 +231,8 @@ export default { this.formInline = { type: 0, targetId: this.shopId, + position: "3", + app: 1, }; this.$refs.oTable.reload(); }, diff --git a/src/views/modules/product/notice/popup/add-or-update.vue b/src/views/modules/operation-management/notice/popup/add-or-update.vue similarity index 100% rename from src/views/modules/product/notice/popup/add-or-update.vue rename to src/views/modules/operation-management/notice/popup/add-or-update.vue diff --git a/src/views/modules/product/notice/popup/set-sorting.vue b/src/views/modules/operation-management/notice/popup/set-sorting.vue similarity index 100% rename from src/views/modules/product/notice/popup/set-sorting.vue rename to src/views/modules/operation-management/notice/popup/set-sorting.vue diff --git a/src/views/modules/product/order/index.vue b/src/views/modules/operation-management/order/index.vue similarity index 97% rename from src/views/modules/product/order/index.vue rename to src/views/modules/operation-management/order/index.vue index 49979af..da6f56b 100644 --- a/src/views/modules/product/order/index.vue +++ b/src/views/modules/operation-management/order/index.vue @@ -1,5 +1,4 @@ + + - + \ No newline at end of file diff --git a/src/views/modules/operation-management/role/index.vue b/src/views/modules/operation-management/role/index.vue new file mode 100644 index 0000000..cbdf777 --- /dev/null +++ b/src/views/modules/operation-management/role/index.vue @@ -0,0 +1,280 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/operation-management/role/popup/add-or-update.vue b/src/views/modules/operation-management/role/popup/add-or-update.vue new file mode 100644 index 0000000..788177b --- /dev/null +++ b/src/views/modules/operation-management/role/popup/add-or-update.vue @@ -0,0 +1,207 @@ + + + \ No newline at end of file diff --git a/src/views/modules/agent/shop-list/index.vue b/src/views/modules/operation-management/shop-list/index.vue similarity index 100% rename from src/views/modules/agent/shop-list/index.vue rename to src/views/modules/operation-management/shop-list/index.vue