diff --git a/main/vite.config.js b/main/vite.config.js index 4bd92b3..39d8c37 100644 --- a/main/vite.config.js +++ b/main/vite.config.js @@ -31,6 +31,14 @@ export default defineConfig(({ command, mode }) => { 'Access-Control-Allow-Origin': '*', }, proxy: { + // 仅 Brand 模块走子应用 DevServer + '/api/brand': { + target: 'http://localhost:9526', + changeOrigin: true, + // 如果想去掉 /api/brand 前缀(比如子应用实际监听的是 /brand/...), + // 可以加一个 rewrite: + // rewrite: path => path.replace(/^\/api\/brand/, '/brand'), + }, [VITE_APP_BASE_API]: { target: VITE_APP_BASE_URL, changeOrigin: true, diff --git a/sub-operation-service/src/apis/brand.js b/sub-operation-service/src/apis/brand.js new file mode 100644 index 0000000..64c4492 --- /dev/null +++ b/sub-operation-service/src/apis/brand.js @@ -0,0 +1,21 @@ +// src/apis/brand.js +import axios from '@/utils/axios'; + +export const getProducts = (params) => { + return axios.get('/api/brand/products', { + params, + apisType: 'mock', + }); +}; + +export const getApplyList = () => { + return axios.get('/api/brand/apply-list', { + apisType: 'mock', + }); +}; + +export const getMonitorList = () => { + return axios.get('/api/brand/monitor-list', { + apisType: 'mock', + }); +}; diff --git a/sub-operation-service/src/apis/products.js b/sub-operation-service/src/apis/products.js deleted file mode 100644 index 74cd322..0000000 --- a/sub-operation-service/src/apis/products.js +++ /dev/null @@ -1,23 +0,0 @@ -export default { - // 模拟获取商品列表 - getProducts: () => { - return new Promise((resolve) => { - setTimeout(() => { - resolve([ - { id: 1, name: '耿马绿色蔬菜', imageUrl: 'images/brand/11.png' }, - { id: 2, name: '云南高山茶', imageUrl: 'images/brand/12.png' }, - { id: 3, name: '新疆大枣', imageUrl: 'images/brand/13.png' }, - { id: 4, name: '东北大米', imageUrl: 'images/brand/14.png' }, - { id: 5, name: '山东苹果', imageUrl: 'images/brand/15.png' }, - { id: 6, name: '四川泡菜', imageUrl: 'images/brand/16.png' }, - { id: 7, name: '江苏阳澄湖大闸蟹', imageUrl: 'images/brand/11.png' }, - { id: 8, name: '海南椰子', imageUrl: 'images/brand/12.png' }, - { id: 9, name: '广东早茶', imageUrl: 'images/brand/13.png' }, - { id: 10, name: '北京烤鸭', imageUrl: 'images/brand/14.png' }, - { id: 11, name: '西藏青稞酒', imageUrl: 'images/brand/15.png' }, - { id: 12, name: '青海牦牛肉', imageUrl: 'images/brand/16.png' }, - ]); - }, 500); // 模拟网络延迟 - }); - }, -}; diff --git a/sub-operation-service/src/assets/images/brand/1532.png b/sub-operation-service/src/assets/images/brand/1532.png index 49d5ed0..92d4f83 100644 Binary files a/sub-operation-service/src/assets/images/brand/1532.png and b/sub-operation-service/src/assets/images/brand/1532.png differ diff --git a/sub-operation-service/src/assets/images/brand/1533.png b/sub-operation-service/src/assets/images/brand/1533.png index ac5f55f..c99d2c6 100644 Binary files a/sub-operation-service/src/assets/images/brand/1533.png and b/sub-operation-service/src/assets/images/brand/1533.png differ diff --git a/sub-operation-service/src/assets/images/brand/Authorization.png b/sub-operation-service/src/assets/images/brand/autho.png similarity index 100% rename from sub-operation-service/src/assets/images/brand/Authorization.png rename to sub-operation-service/src/assets/images/brand/autho.png diff --git a/sub-operation-service/src/assets/images/brand/cardLeft.png b/sub-operation-service/src/assets/images/brand/cardLeft.png new file mode 100644 index 0000000..1063aac Binary files /dev/null and b/sub-operation-service/src/assets/images/brand/cardLeft.png differ diff --git a/sub-operation-service/src/assets/images/brand/cardRight.png b/sub-operation-service/src/assets/images/brand/cardRight.png new file mode 100644 index 0000000..5666bd0 Binary files /dev/null and b/sub-operation-service/src/assets/images/brand/cardRight.png differ diff --git a/sub-operation-service/src/mock/brand.mock.js b/sub-operation-service/src/mock/brand.mock.js new file mode 100644 index 0000000..0598ad2 --- /dev/null +++ b/sub-operation-service/src/mock/brand.mock.js @@ -0,0 +1,136 @@ +// src/mock/brand.mock.js +export default [ + { + url: '/api/brand/products', + method: 'get', + response: () => ({ + code: 200, + data: products, + }), + }, + { + url: '/api/brand/apply-list', + method: 'get', + response: () => ({ + code: 200, + data: applyData, + }), + }, + { + url: '/api/brand/monitor-list', + method: 'get', + response: () => ({ + code: 200, + data: monitor, + }), + }, +]; + +const products = [ + { + id: 1, + name: '耿马镇沙疆西红柿', + batch: '10021', + duration: '6个月', + expireDate: '2025.01.01', + status: 'authorized', + statusLabel: '已授权', + img: 'images/brand/product4.png', + }, + { + id: 2, + name: '孟弄乡沙地土豆', + batch: '10022', + duration: '6个月', + expireDate: '2025.01.02', + status: 'authorized', + statusLabel: '已授权', + img: 'images/brand/product6.png', + }, + { + id: 3, + name: '芒洪乡水果彩椒', + batch: '10021', + duration: '6个月', + expireDate: '2025.01.01', + status: 'authorized', + statusLabel: '已授权', + img: 'images/brand/product2.png', + }, + { + id: 4, + name: '耿马镇沙疆西红柿', + batch: '10021', + duration: '6个月', + expireDate: '2025.01.01', + status: 'approving', + statusLabel: '审批中', + img: 'images/brand/product4.png', + }, + { + id: 5, + name: '孟弄乡沙地土豆', + batch: '10022', + duration: '6个月', + expireDate: '2025.01.02', + status: 'approving', + statusLabel: '审批中', + img: 'images/brand/product6.png', + }, + { + id: 6, + name: '芒洪乡水果彩椒', + batch: '10021', + duration: '6个月', + expireDate: '2025.01.01', + status: 'expired', + statusLabel: '已失效', + img: 'images/brand/product2.png', + }, +]; + +const applyData = [ + { id: 1, name: '耿马绿色蔬菜', imageUrl: 'images/brand/11.png' }, + { id: 2, name: '云南高山茶', imageUrl: 'images/brand/12.png' }, + { id: 3, name: '新疆大枣', imageUrl: 'images/brand/13.png' }, + { id: 4, name: '东北大米', imageUrl: 'images/brand/14.png' }, + { id: 5, name: '山东苹果', imageUrl: 'images/brand/15.png' }, + { id: 6, name: '四川泡菜', imageUrl: 'images/brand/16.png' }, + { id: 7, name: '江苏阳澄湖大闸蟹', imageUrl: 'images/brand/11.png' }, + { id: 8, name: '海南椰子', imageUrl: 'images/brand/12.png' }, + { id: 9, name: '广东早茶', imageUrl: 'images/brand/13.png' }, + { id: 10, name: '北京烤鸭', imageUrl: 'images/brand/14.png' }, + { id: 11, name: '西藏青稞酒', imageUrl: 'images/brand/15.png' }, + { id: 12, name: '青海牦牛肉', imageUrl: 'images/brand/16.png' }, +]; + +const monitor = [ + { + id: 1, + name: '耿马镇沙疆西红柿', + img: 'images/brand/product4.png', + monthlySales: 999, + stock: 10000, + price: 3.0, + status: 'onSale', + }, + { + id: 2, + name: '耿马镇沙疆土豆', + img: 'images/brand/product6.png', + monthlySales: 123, + stock: 5000, + price: 2.5, + status: 'onSale', + }, + { + id: 3, + name: '彩椒南瓜混合', + img: 'images/brand/product1.png', + monthlySales: 456, + stock: 8000, + price: 4.2, + status: 'offShelf', + }, + // … 更多数据 +]; diff --git a/sub-operation-service/src/router/index.js b/sub-operation-service/src/router/index.js index 3af58b4..a61b556 100644 --- a/sub-operation-service/src/router/index.js +++ b/sub-operation-service/src/router/index.js @@ -66,7 +66,7 @@ export const constantRoutes = [ name: 'userOrders', meta: { title: '我的订单' }, }, - { + { path: '/sub-operation-service/userLands', component: () => import('@/views/userCenter/userLands.vue'), name: 'userLands', @@ -184,17 +184,54 @@ export const constantRoutes = [ path: '/sub-operation-service/brand', name: 'brand', component: Layout, - redirect: '/sub-operation-service/brand/index', + redirect: '/sub-operation-service/brand/apply', // 默认页 meta: { title: '公共品牌' }, children: [ { - path: '/sub-operation-service/brand/index', + path: 'apply', component: () => import('@/views/brand/index.vue'), - name: 'brandMain', - meta: { title: '公共品牌首页' }, + children: [ + { + path: '', + component: () => import('@/views/brand/components/ApplyList.vue'), + name: 'brandApplyList', + meta: { title: '使用申请' }, + }, + { + path: ':id', + component: () => import('@/views/brand/components/ApplyDetail.vue'), + name: 'brandApplyDetail', + meta: { title: '产品申请' }, + }, + ], + }, + { + path: 'auth', + component: () => import('@/views/brand/index.vue'), + children: [ + { + path: '', + component: () => import('@/views/brand/components/Auth.vue'), + name: 'brandAuth', + meta: { title: '授权管理' }, + }, + ], + }, + { + path: 'monitor', + component: () => import('@/views/brand/index.vue'), + children: [ + { + path: '', + component: () => import('@/views/brand/components/Monitor.vue'), + name: 'brandMonitor', + meta: { title: '使用监管' }, + }, + ], }, ], }, + { path: '/sub-operation-service/ecommerce', name: 'ecommerce', diff --git a/sub-operation-service/src/utils/axios.js b/sub-operation-service/src/utils/axios.js index 9b2f79d..d4d4683 100644 --- a/sub-operation-service/src/utils/axios.js +++ b/sub-operation-service/src/utils/axios.js @@ -50,6 +50,10 @@ publicAxios.interceptors.request.use(async (config) => { config.headers['Content-Type'] = config.uploadType; break; } + case 'mock': { + config.baseURL = ''; // 不走 VITE_APP_BASE_API,直接请求 mock 路径 + break; + } default: { config.baseURL = VITE_APP_BASE_API; } diff --git a/sub-operation-service/src/views/brand/components/ApplyDetail.vue b/sub-operation-service/src/views/brand/components/ApplyDetail.vue new file mode 100644 index 0000000..d1af96f --- /dev/null +++ b/sub-operation-service/src/views/brand/components/ApplyDetail.vue @@ -0,0 +1,129 @@ + + + + 使用申请 + 我要申请 + + + + + + 请选择溯源农产品申请 + + + + + + + + + + + + + 点击上传 + + + + + + + + + + + + + + + + + + + + + 提交 + + + + + + + + diff --git a/sub-operation-service/src/views/brand/components/ApplyManagement.vue b/sub-operation-service/src/views/brand/components/ApplyList.vue similarity index 68% rename from sub-operation-service/src/views/brand/components/ApplyManagement.vue rename to sub-operation-service/src/views/brand/components/ApplyList.vue index a8885df..fef228d 100644 --- a/sub-operation-service/src/views/brand/components/ApplyManagement.vue +++ b/sub-operation-service/src/views/brand/components/ApplyList.vue @@ -3,10 +3,10 @@ - + {{ product.name }} - 我要申请 + 我要申请 @@ -16,32 +16,25 @@ @@ -95,6 +88,7 @@ onMounted(() => { .button { width: 96px; height: 40px; + border-radius: 8px; } } diff --git a/sub-operation-service/src/views/brand/components/Auth.vue b/sub-operation-service/src/views/brand/components/Auth.vue new file mode 100644 index 0000000..82ad282 --- /dev/null +++ b/sub-operation-service/src/views/brand/components/Auth.vue @@ -0,0 +1,390 @@ + + + + + + + + + + 999 件 + 授权产品 + + + + + 较上月上涨 7 件 + + + + + + + + + 999 件 + 授权产品 + + + + + 较上月上涨 7 件 + + + + + + + + + + + + + + + + + + + {{ product.name }} + + 检测批次: + {{ product.batch }} + + + 授权期限: + {{ product.duration }} + + + 到期时间: + {{ product.expireDate }} + + + + + {{ product.statusLabel }} + + 授权证书 + + + + + + + + + + + + + + + + + diff --git a/sub-operation-service/src/views/brand/components/AuthManagement.vue b/sub-operation-service/src/views/brand/components/AuthManagement.vue deleted file mode 100644 index 91c9b6f..0000000 --- a/sub-operation-service/src/views/brand/components/AuthManagement.vue +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - ✔ - - 999 件 - 授权产品 - - - - - - ⚠ - - 199 件 - 临期产品 - - - - - - - - - - - - - - - - - - - {{ product.statusLabel }} - {{ product.name }} - - - - 检测批次: - {{ product.batch }} - - - 授权期限: - {{ product.duration }} - - - 到期时间: - {{ product.expireDate }} - - - - 授权证书 - - - - - - - - diff --git a/sub-operation-service/src/views/brand/components/UsageMonitor.vue b/sub-operation-service/src/views/brand/components/Monitor.vue similarity index 58% rename from sub-operation-service/src/views/brand/components/UsageMonitor.vue rename to sub-operation-service/src/views/brand/components/Monitor.vue index 57c7e88..5db0d1d 100644 --- a/sub-operation-service/src/views/brand/components/UsageMonitor.vue +++ b/sub-operation-service/src/views/brand/components/Monitor.vue @@ -1,13 +1,12 @@ - - - - - - - + + + + + + @@ -19,20 +18,17 @@ {{ p.name }} 月售 {{ p.monthlySales }} · 库存 {{ p.stock }} + ¥ {{ p.price }} /kg - - ¥ {{ p.price }} /kg - - - - 抽查 - 取消授权 - - - - - {{ tabLabels[activeTab] }} + + + {{ tabLabels[activeTab] }} + + + 抽查 + 取消授权 + @@ -41,6 +37,8 @@
{{ product.name }}
较上月上涨 7 件