diff --git a/src/api/modules/coupon.js b/src/api/modules/coupon.js new file mode 100644 index 0000000..4e399d4 --- /dev/null +++ b/src/api/modules/coupon.js @@ -0,0 +1,28 @@ +import $http from "@/utils/httpRequest.js"; + +export const coupon = { + //优惠券列表 + couponList: (data) => { + return $http.request({ + url: `/merchant-api/coupon/page`, + method: "get", + params: data, + }); + }, + //添加优惠卷 + addCoupon: (data) => { + return $http.post(`/merchant-api/coupon/save`, data); + }, + //新增优惠卷数量 + addNumCoupon: (data) => { + return $http.post(`/merchant-api/coupon/addNum`, data); + }, + //优惠卷状态 + couponStatus: (data) => { + return $http.post(`/merchant-api/coupon/update/status`, data); + }, + //删除优惠卷 + deleteCoupon: (data) => { + return $http.post(`/merchant-api/coupon/batch/delete`, data); + }, +}; diff --git a/src/api/modules/datacenter.js b/src/api/modules/datacenter.js new file mode 100644 index 0000000..d9c4f5d --- /dev/null +++ b/src/api/modules/datacenter.js @@ -0,0 +1,32 @@ +import $http from "@/utils/httpRequest.js"; +// +export const dataCenter = { + customerAnalysis: (data) => { + return $http.request({ + url: `/merchant-api/pc/data/analyse/customer/analyse`, + method: "get", + params: data, + }); + }, + customerTrend: (data) => { + return $http.request({ + url: `/merchant-api/pc/data/analyse/customer/trend`, + method: "get", + params: data, + }); + }, + updatePreSaleProducts: (data) => { + return $http.request({ + url: `/merchant-api/product/save/advance/sell`, + method: "post", + data, + }); + }, + closePreSaleProducts: (data) => { + return $http.request({ + url: `/merchant-api/product/update/advance/sell/status`, + method: "post", + data, + }); + }, +}; diff --git a/src/api/modules/marketing.js b/src/api/modules/marketing.js new file mode 100644 index 0000000..09537cc --- /dev/null +++ b/src/api/modules/marketing.js @@ -0,0 +1,34 @@ +import $http from "@/utils/httpRequest.js"; + +export const marketing = { + // 会员等级列表 + marketingLevelPage: (data) => { + return $http.request({ + url: `/merchant-api/memberUnitMemberLevel/list`, + method: "post", + data, + }); + }, + addMarketingLevel: (data) => { + return $http.request({ + url: `/merchant-api/memberUnitMemberLevel/saveAll`, + method: "post", + data: data, + }); + }, + marketingUserPage: (data) => { + return $http.request({ + url: `/merchant-api/memberUnitUser/page`, + method: "get", + params: data, + }); + }, + //积分列表 + integralList: (data) => { + return $http.request({ + url: `/merchant-api/memberUnitMemberTask/list`, + method: "post", + data, + }); + }, +}; diff --git a/src/api/modules/mer_admin.js b/src/api/modules/mer_admin.js index ad3bcd0..f06c096 100644 --- a/src/api/modules/mer_admin.js +++ b/src/api/modules/mer_admin.js @@ -49,12 +49,12 @@ export const mer_admin = { return $http.post(`/merchant-api/product/page`, data); }, //商户商品分类 - getProductCategory: () => { - return $http.get( - `/merchant-api/product/category/list?shopId=${ - JSON.parse(sessionStorage.getItem("userInfo")).shopId - }` - ); + getProductCategory: (data) => { + return $http.request({ + url: `/merchant-api/product/category/list`, + method: "get", + params: data, + }); }, //上架或下架 putOnShelvesProducts: (data) => { @@ -142,9 +142,23 @@ export const mer_admin = { params: data, }); }, - //添加商家端银行卡 + //添加商家端私账银行卡 bankCardAdd: (data) => { - return $http.post(`/merchant-api/bank/com-create`, data); + return $http.post(`/merchant-api/bank/pri-create`, data); + }, + //添加商家端公账银行卡 + publicAccountBankCardAdd: (data) => { + return $http.post(`/merchant-api/bank/pub-create`, data); + }, + //删除银行卡 + bankCardDelete: (data) => { + return $http.post(`/merchant-api/bank/delete?id=${data}`); + }, + //设置默认银行卡 + defaultBank: (data) => { + return $http.post( + `/merchant-api/bank/default-bank?linkId=${data.linkId}&bankId=${data.bankId}` + ); }, //获取银行卡详情 bankCardDetail: (id) => { @@ -154,6 +168,14 @@ export const mer_admin = { params: { id }, }); }, + //市场下的店铺列表 + storeList: (data) => { + return $http.request({ + method: "get", + url: `/merchant-api/market/shop_list`, + params: data, + }); + }, //获取品牌信息 getBrandInfo: () => { return $http.request({ @@ -162,4 +184,24 @@ export const mer_admin = { params: {}, }); }, + //编辑品牌信息 + editBrandInfo: (data) => { + return $http.put(`/merchant-api/brand/edit`, data); + }, + //修改密码 + changePassword: (data) => { + return $http.put(`/merchant-api/auth/change/pwd`, data); + }, + //修改管理员 + editAdmin: (data) => { + return $http.put(`/merchant-api/brand/change/administrator`, data); + }, + //获取验证码 + getCaptcha: (data) => { + return $http.request({ + method: "get", + url: `/merchant-api/brand/sms_code`, + params: data, + }); + }, }; diff --git a/src/api/modules/pre-sale.js b/src/api/modules/pre-sale.js new file mode 100644 index 0000000..3dd4ac2 --- /dev/null +++ b/src/api/modules/pre-sale.js @@ -0,0 +1,34 @@ +import $http from "@/utils/httpRequest.js"; + +export const preSale = { + //预售商品列表 + preSaleProducts: (data) => { + return $http.request({ + url: `/merchant-api/product/advance/sell/page`, + method: "post", + data, + }); + }, + addPreSaleProducts: (data) => { + return $http.request({ + url: `/merchant-api/product/batch/save/advance/sell`, + method: "post", + data, + }); + }, + updatePreSaleProducts: (data) => { + return $http.request({ + url: `/merchant-api/product/save/advance/sell`, + method: "post", + data, + }); + }, + closePreSaleProducts: (data) => { + return $http.request({ + url: `/merchant-api/product/update/advance/sell/status`, + method: "post", + data, + }); + }, +}; + diff --git a/src/api/modules/wallet.js b/src/api/modules/wallet.js new file mode 100644 index 0000000..ac64f7a --- /dev/null +++ b/src/api/modules/wallet.js @@ -0,0 +1,44 @@ +import $http from "@/utils/httpRequest.js"; + +export const wallet = { + //钱包管理 + myWallet: (data) => { + return $http.request({ + url: `/merchant-api/wallet/wallet`, + method: "post", + data, + }); + }, + //钱包明细 + Withdrawal: (data) => { + return $http.request({ + url: `/merchant-api/walletDrawCashOrder/apply`, + method: "post", + data, + }); + }, + //钱包提现订单 + WithdrawalRecord: (data) => { + return $http.request({ + url: `/merchant-api/walletDrawCashOrder/page`, + method: "get", + params: data, + }); + }, + //钱包账单收支金额 + totalAmount: (data) => { + return $http.request({ + url: `/merchant-api/walletBill/totalAmount`, + method: "post", + data: data, + }); + }, + //钱包账单 + getBankInfo: (data) => { + return $http.request({ + url: `/merchant-api/walletBill/page`, + method: "get", + params: data, + }); + }, +}; diff --git a/src/router/full-routers.js b/src/router/full-routers.js index d307d85..5a0a63c 100644 --- a/src/router/full-routers.js +++ b/src/router/full-routers.js @@ -92,6 +92,7 @@ export default { orderNum: 0, open: null, list: [], + hideInMenu: true, }, { menuId: getUUID(), @@ -120,72 +121,323 @@ export default { }, ], }, - // { - // "menuId": getUUID(), - // "parentId": 0, - // "parentName": null, - // "name": "教务管理", - // "url": "local-affairs", - // "perms": "", - // "type": 0, - // "elIcon": "el-icon-office-building", - // "orderNum": 0, - // "open": null, - // list: [ - // { - // "menuId": getUUID(), - // "parentId": 2, - // "parentName": null, - // "name": "年级管理", - // "url": "local-affairs/grade", - // "perms": "", - // "type": 1, - // "icon": "log", - // "orderNum": 0, - // "open": null, - // "list": [] - // }, - // { - // "menuId": getUUID(), - // "parentId": 2, - // "parentName": null, - // "name": "班级管理", - // "url": "local-affairs/class", - // "perms": "", - // "type": 1, - // "icon": "log", - // "orderNum": 0, - // "open": null, - // "list": [] - // }, - // { - // "menuId": getUUID(), - // "parentId": 2, - // "parentName": null, - // "name": "教师管理", - // "url": "local-teacher/teacher", - // "perms": "", - // "type": 1, - // "icon": "log", - // "orderNum": 0, - // "open": null, - // "list": [] - // }, - // { - // "menuId": getUUID(), - // "parentId": 0, - // "parentName": null, - // "name": "学校管理", - // "url": "local-school/school", - // "perms": "", - // "type": 1, - // "elIcon": "el-icon-school", - // "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", + orderNum: 0, + open: null, + list: [], + }, + ], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "数据中心", + url: "", + perms: "", + type: 0, + elIcon: "el-icon-tickets", + orderNum: 0, + open: null, + list: [ + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "客户分析", + url: "datacenter/customer-analysis/index", + perms: "", + type: 1, + elIcon: "el-icon-user", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "商品分析", + url: "datacenter/product-analysis/index", + perms: "", + type: 1, + elIcon: "el-icon-data-analysis", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "订单统计分析", + url: "datacenter/order-analysis/index", + perms: "", + type: 1, + elIcon: "el-icon-shopping-cart-full", + orderNum: 0, + open: null, + list: [], + }, + ], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "营销管理", + url: "", + perms: "", + type: 0, + elIcon: "el-icon-tickets", + orderNum: 0, + open: null, + list: [ + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "会员等级管理", + url: "marketing/level/index", + perms: "", + type: 1, + elIcon: "el-icon-user", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "用户管理", + url: "marketing/user/index", + perms: "", + type: 1, + elIcon: "el-icon-data-analysis", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "积分设置", + url: "marketing/points-setting/index", + perms: "", + type: 1, + elIcon: "el-icon-shopping-cart-full", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "积分商城", + url: "marketing/points-mall/index", + perms: "", + type: 1, + elIcon: "el-icon-shopping-cart-full", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "积分订单", + url: "marketing/points-order/index", + perms: "", + type: 1, + elIcon: "el-icon-shopping-cart-full", + orderNum: 0, + open: null, + list: [], + }, + ], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "代理商", + url: "", + perms: "", + type: 0, + elIcon: "el-icon-tickets", + orderNum: 0, + open: null, + list: [ + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "数据面板", + url: "agent/data-panel/index", + perms: "", + type: 1, + elIcon: "el-icon-user", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "品牌管理", + url: "agent/brand/index", + perms: "", + type: 1, + elIcon: "el-icon-data-analysis", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "报表", + url: "agent/report-form/index", + perms: "", + type: 1, + elIcon: "el-icon-shopping-cart-full", + orderNum: 0, + open: null, + list: [], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "市场列表", + url: "agent/market-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/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, + parentName: null, + name: "权限管理", + url: "agent/jurisdiction/index", + perms: "", + type: 1, + elIcon: "el-icon-shopping-cart-full", + orderNum: 0, + open: null, + list: [], + }, + ], + }, + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "钱包管理", + url: "local-course/resources", + perms: "", + type: 0, + elIcon: "el-icon-menu", + orderNum: 0, + open: null, + list: [ + { + menuId: getUUID(), + parentId: 0, + parentName: null, + name: "我的钱包", + url: "wallet/index", + perms: "", + type: 1, + elIcon: "el-icon-menu", + orderNum: 0, + open: null, + list: [], + }, + ], + }, ], code: 0, permissions: [], diff --git a/src/router/index.js b/src/router/index.js index 92190ac..2eea2dd 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -4,111 +4,183 @@ * 建议: * 1. 代码中路由统一使用name属性跳转(不使用path属性) */ -import Vue from 'vue' -import Router from 'vue-router' -import http from '@/utils/httpRequest' -import { isURL } from '@/utils/validate' -import { clearLoginInfo } from '@/utils' +import Vue from "vue"; +import Router from "vue-router"; +import http from "@/utils/httpRequest"; +import { isURL } from "@/utils/validate"; +import { clearLoginInfo } from "@/utils"; import FULL_ROUTERS from "./full-routers"; -import $api from "@/api/index.js" -import { Loading } from 'element-ui'; +import $api from "@/api/index.js"; +import store from "@/store"; +import { Loading } from "element-ui"; -Vue.use(Router) +Vue.use(Router); // 开发环境不使用懒加载, 因为懒加载页面太多的话会造成webpack热更新太慢, 所以只有生产环境使用懒加载 -const _import = require('./import-' + process.env.NODE_ENV) +const _import = require("./import-" + process.env.NODE_ENV); // 全局路由(无需嵌套上左右整体布局) const globalRoutes = [ - { path: '/404', component: _import('common/404'), name: '404', meta: { title: '404未找到' } }, - { path: '/login', component: _import('common/login'), name: 'login', meta: { title: '登录' } }, + { + path: "/404", + component: _import("common/404"), + name: "404", + meta: { title: "404未找到" }, + }, + { + path: "/login", + component: _import("common/login"), + name: "login", + meta: { title: "登录" }, + }, //test用,会员管理 -] +]; // 主入口路由(需嵌套上左右整体布局) const mainRoutes = { - path: '/', - component: _import('main'), - name: 'main', - redirect: { name: 'home' }, - meta: { title: '主入口整体布局' }, + path: "/", + component: _import("main"), + name: "main", + redirect: { name: "home" }, + meta: { title: "主入口整体布局" }, children: [ // 通过meta对象设置路由展示方式 // 1. isTab: 是否通过tab展示内容, true: 是, false: 否 // 2. iframeUrl: 是否通过iframe嵌套展示内容, '以http[s]://开头': 是, '': 否 // 提示: 如需要通过iframe嵌套展示内容, 但不通过tab打开, 请自行创建组件使用iframe处理! - { path: '/home', component: _import('common/home'), name: 'home', meta: { title: '首页' } }, - { path: '/theme', component: _import('common/theme'), name: 'theme', meta: { title: '主题' } }, - { path: '/demo-echarts', component: _import('demo/echarts'), name: 'demo-echarts', meta: { title: 'demo-echarts', isTab: true } } + { + path: "/home", + component: _import("common/home"), + name: "home", + meta: { title: "首页" }, + }, + { + path: "/theme", + component: _import("common/theme"), + name: "theme", + meta: { title: "主题" }, + }, + { + path: "/demo-echarts", + component: _import("demo/echarts"), + name: "demo-echarts", + meta: { title: "demo-echarts", isTab: true }, + }, ], beforeEnter(to, from, next) { - let token = Vue.cookie.get('token') + let token = Vue.cookie.get("token"); if (!token || !/\S/.test(token)) { - clearLoginInfo() - next({ name: 'login' }) + clearLoginInfo(); + next({ name: "login" }); } - next() - } -} + next(); + }, +}; const router = new Router({ - mode: 'hash', + mode: "hash", // mode:"history", scrollBehavior: () => ({ y: 0 }), isAddDynamicMenuRoutes: false, // 是否已经添加动态(菜单)路由 - routes: globalRoutes.concat(mainRoutes) -}) + routes: globalRoutes.concat(mainRoutes), +}); router.beforeEach((to, from, next) => { console.log("beforeEach"); // 添加动态(菜单)路由 // 1. 已经添加 or 全局路由, 直接访问 // 2. 获取菜单列表, 添加并保存本地存储 - if (router.options.isAddDynamicMenuRoutes || fnCurrentRouteType(to, globalRoutes) === 'global') { - next() + if ( + router.options.isAddDynamicMenuRoutes || + fnCurrentRouteType(to, globalRoutes) === "global" + ) { + next(); } else { let loadingInstance = Loading.service({ - text:"正在初始化中...", - background:'rgba(255,255,255,0.7)' + text: "正在初始化中...", + background: "rgba(255,255,255,0.7)", }); - $api.getUserInfo() + $api + .getUserInfo() .then(({ data }) => { - 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; - }, []); - } + 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); + if (data.data.markets?.length > 0) { + // 存在多个市场 + $api.mer_admin + .storeList({ marketId: data.data.markets[0].marketId }) + .then((res) => { + store.commit("userData/setState", { + isMerchant: true, + marketList: data.data.markets, + storeList: res.data.data, + marketId: data.data.markets[0].marketId, + shopId: res.data.data[0].shopId, + }); + }); + console.log(data.data.markets); + } else if (data.data.shopId) { + // 存在单个店铺 + store.commit("userData/setState", { + isMerchant: true, + marketList: [], + storeList: [], + marketId: data.data.marketId, + shopId: data.data.shopId, + }); + } else { + // 不存在店铺 + store.commit("userData/setState", { + isMerchant: false, + marketList: [], + storeList: [], + marketId: "", + shopId: "", + }); + } sessionStorage.setItem("userInfo", JSON.stringify(data.data)); - sessionStorage.setItem('permissions', JSON.stringify(data.data.permissions || '[]')) + sessionStorage.setItem( + "permissions", + JSON.stringify(data.data.permissions || "[]") + ); //添加全量菜单,根据权限进行过滤 - let _menu=filterTreeData(FULL_ROUTERS.menuList, data.data.permissions); - fnAddDynamicMenuRoutes(_menu) - sessionStorage.setItem('menuList', JSON.stringify(_menu)) - router.options.isAddDynamicMenuRoutes = true - next({ ...to, replace: true }) + let _menu = filterTreeData( + FULL_ROUTERS.menuList, + data.data.permissions + ); + fnAddDynamicMenuRoutes(_menu); + sessionStorage.setItem("menuList", JSON.stringify(_menu)); + router.options.isAddDynamicMenuRoutes = true; + next({ ...to, replace: true }); }) .catch((e) => { - sessionStorage.setItem('menuList', '[]') - sessionStorage.setItem('permissions', '[]') - console.log(`%c${e} 请求菜单列表和权限失败,跳转至登录页!!`, 'color:blue') - router.push({ name: 'login' }) - next() + sessionStorage.setItem("menuList", "[]"); + sessionStorage.setItem("permissions", "[]"); + console.log( + `%c${e} 请求菜单列表和权限失败,跳转至登录页!!`, + "color:blue" + ); + router.push({ name: "login" }); + next(); }) - .finally(()=>{ + .finally(() => { loadingInstance.close(); - }) + }); // http({ // url: '/sys/menu/nav', // method: 'get', @@ -128,22 +200,25 @@ router.beforeEach((to, from, next) => { // router.push({ name: 'login' }) // }) } -}) +}); /** * 判断当前路由类型, global: 全局路由, main: 主入口路由 * @param {*} route 当前路由 */ function fnCurrentRouteType(route, globalRoutes = []) { - var temp = [] + var temp = []; for (var i = 0; i < globalRoutes.length; i++) { if (route.path === globalRoutes[i].path) { - return 'global' - } else if (globalRoutes[i].children && globalRoutes[i].children.length >= 1) { - temp = temp.concat(globalRoutes[i].children) + return "global"; + } else if ( + globalRoutes[i].children && + globalRoutes[i].children.length >= 1 + ) { + temp = temp.concat(globalRoutes[i].children); } } - return temp.length >= 1 ? fnCurrentRouteType(route, temp) : 'main' + return temp.length >= 1 ? fnCurrentRouteType(route, temp) : "main"; } /** @@ -152,53 +227,59 @@ function fnCurrentRouteType(route, globalRoutes = []) { * @param {*} routes 递归创建的动态(菜单)路由 */ function fnAddDynamicMenuRoutes(menuList = [], routes = []) { - var temp = [] + var temp = []; for (var i = 0; i < menuList.length; i++) { if (menuList[i].list && menuList[i].list.length >= 1) { - temp = temp.concat(menuList[i].list) + temp = temp.concat(menuList[i].list); } else if (menuList[i].url && /\S/.test(menuList[i].url)) { - menuList[i].url = menuList[i].url.replace(/^\//, '') + menuList[i].url = menuList[i].url.replace(/^\//, ""); var route = { - path: menuList[i].url.replace('/', '-'), + path: menuList[i].url.replace("/", "-"), component: null, - name: menuList[i].url.replace('/', '-'), + name: menuList[i].url.replace("/", "-"), meta: { menuId: menuList[i].menuId, title: menuList[i].name, isDynamic: true, isTab: true, - iframeUrl: '', - isMicroApp:menuList[i].isMicroApp - } - } + iframeUrl: "", + isMicroApp: menuList[i].isMicroApp, + }, + }; // url以http[s]://开头, 通过iframe展示,或者启用microApp框架 if (isURL(menuList[i].url)) { - route['path'] = `i-${menuList[i].menuId}` - route['name'] = `i-${menuList[i].menuId}` - route['meta']['iframeUrl'] = menuList[i].url + route["path"] = `i-${menuList[i].menuId}`; + route["name"] = `i-${menuList[i].menuId}`; + route["meta"]["iframeUrl"] = menuList[i].url; } else { try { - route['component'] = _import(`modules/${menuList[i].url}`) || null - } catch (e) { } + route["component"] = _import(`modules/${menuList[i].url}`) || null; + } catch (e) {} } - routes.push(route) + routes.push(route); } } if (temp.length >= 1) { - fnAddDynamicMenuRoutes(temp, routes) + fnAddDynamicMenuRoutes(temp, routes); } else { - mainRoutes.name = 'main-dynamic' - mainRoutes.children = routes - router.addRoutes([ - mainRoutes, - { path: '*', redirect: { name: '404' } } - ]) - sessionStorage.setItem('dynamicMenuRoutes', JSON.stringify(mainRoutes.children || '[]')) - console.log('\n') - console.log('%c!<-------------------- 动态(菜单)路由 s -------------------->', 'color:blue') - console.log(mainRoutes.children) - console.log('%c!<-------------------- 动态(菜单)路由 e -------------------->', 'color:blue') + mainRoutes.name = "main-dynamic"; + mainRoutes.children = routes; + router.addRoutes([mainRoutes, { path: "*", redirect: { name: "404" } }]); + sessionStorage.setItem( + "dynamicMenuRoutes", + JSON.stringify(mainRoutes.children || "[]") + ); + console.log("\n"); + console.log( + "%c!<-------------------- 动态(菜单)路由 s -------------------->", + "color:blue" + ); + console.log(mainRoutes.children); + console.log( + "%c!<-------------------- 动态(菜单)路由 e -------------------->", + "color:blue" + ); } } -export default router +export default router; diff --git a/src/store/index.js b/src/store/index.js index 258c9f1..8c0098b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,23 +1,25 @@ -import Vue from 'vue' -import Vuex from 'vuex' -import cloneDeep from 'lodash/cloneDeep' -import common from './modules/common' -import user from './modules/user' +import Vue from "vue"; +import Vuex from "vuex"; +import cloneDeep from "lodash/cloneDeep"; +import common from "./modules/common"; +import user from "./modules/user"; +import userData from "./modules/userData"; -Vue.use(Vuex) +Vue.use(Vuex); export default new Vuex.Store({ modules: { common, - user + user, + userData, }, mutations: { // 重置vuex本地储存状态 - resetStore (state) { + resetStore(state) { Object.keys(state).forEach((key) => { - state[key] = cloneDeep(window.SITE_CONFIG['storeState'][key]) - }) - } + state[key] = cloneDeep(window.SITE_CONFIG["storeState"][key]); + }); + }, }, - strict: process.env.NODE_ENV !== 'production' -}) + strict: process.env.NODE_ENV !== "production", +}); diff --git a/src/store/modules/userData.js b/src/store/modules/userData.js new file mode 100644 index 0000000..75584fd --- /dev/null +++ b/src/store/modules/userData.js @@ -0,0 +1,30 @@ +const state = { + isMerchant: false, //是否是经营者还是摊铺 不是就是为false + marketList: [], //经营的市场 + storeList: [], //经营的店铺 + marketId: "", + shopId: "", +}; + +// actions +const actions = {}; + +// mutations +const mutations = { + setState(state, data) { + console.log(data, "传过来的数据"); + + state.isMerchant = data.isMerchant; + state.marketList = data.marketList; + state.storeList = data.storeList; + state.marketId = data.marketId; + state.shopId = data.shopId; + }, +}; + +export default { + namespaced: true, + state, + mutations, + actions, +}; diff --git a/src/views/main-sidebar.vue b/src/views/main-sidebar.vue index 3dce11f..bf261f5 100644 --- a/src/views/main-sidebar.vue +++ b/src/views/main-sidebar.vue @@ -87,7 +87,7 @@ } let filterMenu=filterMethod(JSON.parse(JSON.stringify(this.menuList)),this.keyWord); console.log(filterMenu); - return filterMenu; + return filterMenu.filter(item=>item.hideInMenu!=true); }, //是否展示菜单搜索界面 showSearchInput(){ diff --git a/src/views/modules/agent/brand/index.vue b/src/views/modules/agent/brand/index.vue new file mode 100644 index 0000000..ae73936 --- /dev/null +++ b/src/views/modules/agent/brand/index.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/agent/data-panel/index.vue b/src/views/modules/agent/data-panel/index.vue new file mode 100644 index 0000000..902c9b7 --- /dev/null +++ b/src/views/modules/agent/data-panel/index.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/agent/distributor/index.vue b/src/views/modules/agent/distributor/index.vue new file mode 100644 index 0000000..1937f7c --- /dev/null +++ b/src/views/modules/agent/distributor/index.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/agent/jurisdiction/index.vue b/src/views/modules/agent/jurisdiction/index.vue new file mode 100644 index 0000000..0a3f262 --- /dev/null +++ b/src/views/modules/agent/jurisdiction/index.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/agent/market-list/index.vue b/src/views/modules/agent/market-list/index.vue new file mode 100644 index 0000000..100959b --- /dev/null +++ b/src/views/modules/agent/market-list/index.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/agent/report-form/index.vue b/src/views/modules/agent/report-form/index.vue new file mode 100644 index 0000000..df33af1 --- /dev/null +++ b/src/views/modules/agent/report-form/index.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/agent/shop-list/index.vue b/src/views/modules/agent/shop-list/index.vue new file mode 100644 index 0000000..fddeffc --- /dev/null +++ b/src/views/modules/agent/shop-list/index.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/bank-card/index.vue b/src/views/modules/bank-card/index.vue index cb8fa67..1abb680 100644 --- a/src/views/modules/bank-card/index.vue +++ b/src/views/modules/bank-card/index.vue @@ -133,12 +133,25 @@ export default { { title: "银行卡号", align: "center", - field: "cardId", + field: "cardNo", + }, + { + title: "账户类型", + align: "center", + field: "bankAcctType", + type: "jsx", + render: ({ row }) => { + if (row.bankAcctType == 2) { + return 对私; + } else { + return 对公; + } + }, }, { title: "手机号", align: "center", - field: "telNo", + field: "legalMp", }, { title: "企业名称", @@ -160,13 +173,65 @@ export default { } }, }, + { + title: "默认银行卡", + align: "center", + field: "status", + type: "jsx", + render: ({ row }) => { + let defaultBank = () => { + if (row.default) { + this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + this.$api.mer_admin + .defaultBank({ + linkId: row.linkId, + bankId: row.id, + }) + .then((res) => { + this.$refs.oTable.reload(); + }) + .catch((err) => { + this.$refs.oTable.reload(); + }); + }) + .catch(() => { + this.$refs.oTable.reload(); + }); + } + }; + return ( + + ); + }, + }, + { + title: "创建时间", + align: "center", + field: "createTime", + }, { title: "操作", fixed: "right", type: "jsx", align: "center", - width: "140px", + width: "160px", render: (row) => { + let deleteBank = () => { + this.$api.mer_admin.bankCardDelete(row.row.id).then((res) => { + this.$refs.oTable.reload(); + }); + }; let edit = () => { this.$refs.viewDetails.toggle(row).update(); }; @@ -175,6 +240,13 @@ export default { 详情 + + + + 删除 + + + ); }, diff --git a/src/views/modules/bank-card/popup/add-or-update.vue b/src/views/modules/bank-card/popup/add-or-update.vue index 0fa56a6..221e783 100644 --- a/src/views/modules/bank-card/popup/add-or-update.vue +++ b/src/views/modules/bank-card/popup/add-or-update.vue @@ -8,8 +8,8 @@ :modalHandles="modalHandles" > + \ No newline at end of file diff --git a/src/views/modules/brand/config/popup/to-configure.vue b/src/views/modules/brand/config/popup/to-configure.vue index 40e998e..093b114 100644 --- a/src/views/modules/brand/config/popup/to-configure.vue +++ b/src/views/modules/brand/config/popup/to-configure.vue @@ -1,13 +1,158 @@ - \ No newline at end of file diff --git a/src/views/modules/coupon/index.vue b/src/views/modules/coupon/index.vue new file mode 100644 index 0000000..35a7036 --- /dev/null +++ b/src/views/modules/coupon/index.vue @@ -0,0 +1,443 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/coupon/popup/add-or-update.vue b/src/views/modules/coupon/popup/add-or-update.vue new file mode 100644 index 0000000..61d9872 --- /dev/null +++ b/src/views/modules/coupon/popup/add-or-update.vue @@ -0,0 +1,274 @@ + + + \ No newline at end of file diff --git a/src/views/modules/coupon/popup/commodity.vue b/src/views/modules/coupon/popup/commodity.vue new file mode 100644 index 0000000..8a9d37b --- /dev/null +++ b/src/views/modules/coupon/popup/commodity.vue @@ -0,0 +1,230 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/coupon/popup/full-reduction.vue b/src/views/modules/coupon/popup/full-reduction.vue new file mode 100644 index 0000000..63a5a39 --- /dev/null +++ b/src/views/modules/coupon/popup/full-reduction.vue @@ -0,0 +1,307 @@ + + + \ No newline at end of file diff --git a/src/views/modules/coupon/popup/new-powder.vue b/src/views/modules/coupon/popup/new-powder.vue new file mode 100644 index 0000000..e3867f6 --- /dev/null +++ b/src/views/modules/coupon/popup/new-powder.vue @@ -0,0 +1,307 @@ + + + \ No newline at end of file diff --git a/src/views/modules/datacenter/customer-analysis/index.vue b/src/views/modules/datacenter/customer-analysis/index.vue new file mode 100644 index 0000000..fe31609 --- /dev/null +++ b/src/views/modules/datacenter/customer-analysis/index.vue @@ -0,0 +1,301 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/datacenter/order-analysis/index.vue b/src/views/modules/datacenter/order-analysis/index.vue new file mode 100644 index 0000000..08d4d97 --- /dev/null +++ b/src/views/modules/datacenter/order-analysis/index.vue @@ -0,0 +1,285 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/datacenter/product-analysis/index.vue b/src/views/modules/datacenter/product-analysis/index.vue new file mode 100644 index 0000000..6279d4c --- /dev/null +++ b/src/views/modules/datacenter/product-analysis/index.vue @@ -0,0 +1,242 @@ + + + + + \ No newline at end of file diff --git a/src/views/modules/logistics-fare/logistics-template/index.vue b/src/views/modules/logistics-fare/logistics-template/index.vue index 4049b63..e9844d5 100644 --- a/src/views/modules/logistics-fare/logistics-template/index.vue +++ b/src/views/modules/logistics-fare/logistics-template/index.vue @@ -1,6 +1,6 @@