From 9cfa2918724bd8fa63e6d678e595db113fca8152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Sun, 28 Jul 2024 00:34:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BA=97=E9=93=BA=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=8F=8A=E5=88=86=E7=B1=BB=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/shop/goods/index.ts | 6 ++++-- src/views/shop/goods/{add => add__bak}/index.vue | 0 src/views/shop/goods/components/search.vue | 16 ++++++++++++---- .../components/merchant-category-edit.vue | 3 ++- src/views/shop/goodsCategory/index.vue | 2 ++ 5 files changed, 20 insertions(+), 7 deletions(-) rename src/views/shop/goods/{add => add__bak}/index.vue (100%) diff --git a/src/api/shop/goods/index.ts b/src/api/shop/goods/index.ts index b8ed504..a514aeb 100644 --- a/src/api/shop/goods/index.ts +++ b/src/api/shop/goods/index.ts @@ -3,8 +3,10 @@ import type { ApiResult, PageResult } from '@/api'; import type { Goods, GoodsParam } from './model'; import { MODULES_API_URL } from '@/config/setting'; -export async function getCount() { - const res = await request.get(MODULES_API_URL + '/shop/goods/data'); +export async function getCount(params: GoodsParam) { + const res = await request.get(MODULES_API_URL + '/shop/goods/data', { + params + }); if (res.data.code === 0) { return res.data.data; } diff --git a/src/views/shop/goods/add/index.vue b/src/views/shop/goods/add__bak/index.vue similarity index 100% rename from src/views/shop/goods/add/index.vue rename to src/views/shop/goods/add__bak/index.vue diff --git a/src/views/shop/goods/components/search.vue b/src/views/shop/goods/components/search.vue index bc60ecd..edfbe5d 100644 --- a/src/views/shop/goods/components/search.vue +++ b/src/views/shop/goods/components/search.vue @@ -73,6 +73,7 @@ isShow: undefined, stock: undefined, categoryId: undefined, + merchantId: undefined, keywords: '' }); @@ -104,7 +105,7 @@ }; const reload = () => { - getCount().then((data: any) => { + getCount(where).then((data: any) => { goodsCount.value = data; }); emit('search', where); @@ -138,9 +139,16 @@ // () => {} // ); watch( - currentRoute, - () => { - reload(); + () => props.merchantId, + (id) => { + if (Number(id) > 0) { + where.merchantId = id; + reload(); + }else{ + where.merchantId = undefined; + reload(); + } + }, { immediate: true } ); diff --git a/src/views/shop/goodsCategory/components/merchant-category-edit.vue b/src/views/shop/goodsCategory/components/merchant-category-edit.vue index d673b58..a1d17b1 100644 --- a/src/views/shop/goodsCategory/components/merchant-category-edit.vue +++ b/src/views/shop/goodsCategory/components/merchant-category-edit.vue @@ -212,7 +212,8 @@ // menuType 对应的值与后端不一致在前端处理 // menuType: form.menuType === 2 ? 1 : 0, parentId: form.parentId || 0, - merchantId: props.merchantId + merchantId: props.merchantId, + type: 1 }; const saveOrUpdate = isUpdate.value ? updateGoodsCategory diff --git a/src/views/shop/goodsCategory/index.vue b/src/views/shop/goodsCategory/index.vue index 286f0b7..d3aa73d 100644 --- a/src/views/shop/goodsCategory/index.vue +++ b/src/views/shop/goodsCategory/index.vue @@ -258,7 +258,9 @@ // 表格数据源 const datasource: DatasourceFunction = ({ where }) => { where.title = searchText.value; + where.type = 0; if (merchantId.value) { + where.type = 1; where.merchantId = merchantId.value; } return listGoodsCategory({ ...where });