商品增加分类

This commit is contained in:
2024-04-19 13:44:31 +08:00
parent 7b3676eda7
commit 634e801eb5
3 changed files with 19 additions and 19 deletions

View File

@@ -87,8 +87,8 @@ onLoad(() => {
const fetchCategoryList = async () => {
if(companyConfigInfo.value.mallopen == 1) {
const list = await getCategoryList();
list.unshift({ typeName: '上新精选', typeId: '0' });
list.unshift({ typeName: '热销商品', typeId: '0' });
list.unshift({ typeName: '上新精选', typeId: '2' });
list.unshift({ typeName: '热销商品', typeId: '1' });
list.unshift({ typeName: '全部分类', typeId: '0' });
categoryList.value = list;
await changeCategory(0);
@@ -102,13 +102,27 @@ const changeCategory = async (index: number) => {
const fetchGoodsList = async (refresh: boolean = true) => {
currentPageNum.value = refresh ? 1 : currentPageNum.value + 1;
let typeId = [categoryList.value[categorySelectedIndex.value].typeId];
let sort = undefined;
if(typeId[0] === '0') {
typeId = [];
sort = undefined;
} else if(typeId[0] === '1') {
typeId = [];
sort = 'good_num DESC';
} else if(typeId[0] === '2') {
typeId = [];
sort = 'update_time DESC';
}
const { rows } = await getGoodsList({
page: {
pageNum: currentPageNum.value,
pageSize: 30,
bean: {
keyword: '',
typeIds: [categoryList.value[categorySelectedIndex.value].typeId]
typeIds: typeId,
sort: sort
}
}
});