优化店铺商品及分类管理
This commit is contained in:
@@ -3,8 +3,10 @@ import type { ApiResult, PageResult } from '@/api';
|
|||||||
import type { Goods, GoodsParam } from './model';
|
import type { Goods, GoodsParam } from './model';
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
import { MODULES_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
export async function getCount() {
|
export async function getCount(params: GoodsParam) {
|
||||||
const res = await request.get(MODULES_API_URL + '/shop/goods/data');
|
const res = await request.get(MODULES_API_URL + '/shop/goods/data', {
|
||||||
|
params
|
||||||
|
});
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
isShow: undefined,
|
isShow: undefined,
|
||||||
stock: undefined,
|
stock: undefined,
|
||||||
categoryId: undefined,
|
categoryId: undefined,
|
||||||
|
merchantId: undefined,
|
||||||
keywords: ''
|
keywords: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -104,7 +105,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const reload = () => {
|
const reload = () => {
|
||||||
getCount().then((data: any) => {
|
getCount(where).then((data: any) => {
|
||||||
goodsCount.value = data;
|
goodsCount.value = data;
|
||||||
});
|
});
|
||||||
emit('search', where);
|
emit('search', where);
|
||||||
@@ -138,9 +139,16 @@
|
|||||||
// () => {}
|
// () => {}
|
||||||
// );
|
// );
|
||||||
watch(
|
watch(
|
||||||
currentRoute,
|
() => props.merchantId,
|
||||||
() => {
|
(id) => {
|
||||||
reload();
|
if (Number(id) > 0) {
|
||||||
|
where.merchantId = id;
|
||||||
|
reload();
|
||||||
|
}else{
|
||||||
|
where.merchantId = undefined;
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -212,7 +212,8 @@
|
|||||||
// menuType 对应的值与后端不一致在前端处理
|
// menuType 对应的值与后端不一致在前端处理
|
||||||
// menuType: form.menuType === 2 ? 1 : 0,
|
// menuType: form.menuType === 2 ? 1 : 0,
|
||||||
parentId: form.parentId || 0,
|
parentId: form.parentId || 0,
|
||||||
merchantId: props.merchantId
|
merchantId: props.merchantId,
|
||||||
|
type: 1
|
||||||
};
|
};
|
||||||
const saveOrUpdate = isUpdate.value
|
const saveOrUpdate = isUpdate.value
|
||||||
? updateGoodsCategory
|
? updateGoodsCategory
|
||||||
|
|||||||
@@ -258,7 +258,9 @@
|
|||||||
// 表格数据源
|
// 表格数据源
|
||||||
const datasource: DatasourceFunction = ({ where }) => {
|
const datasource: DatasourceFunction = ({ where }) => {
|
||||||
where.title = searchText.value;
|
where.title = searchText.value;
|
||||||
|
where.type = 0;
|
||||||
if (merchantId.value) {
|
if (merchantId.value) {
|
||||||
|
where.type = 1;
|
||||||
where.merchantId = merchantId.value;
|
where.merchantId = merchantId.value;
|
||||||
}
|
}
|
||||||
return listGoodsCategory({ ...where });
|
return listGoodsCategory({ ...where });
|
||||||
|
|||||||
Reference in New Issue
Block a user