bug fixed
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import { getStoreCategories } from '@/api/categories'
|
||||
|
||||
/** تبهای فیلتر محصول — فقط از API دستهبندی (هماهنگ با پنل ادمین) */
|
||||
export async function loadProductCategoryTabNames(): Promise<string[]> {
|
||||
const categories = await getStoreCategories()
|
||||
return categories.map((item) => item.name)
|
||||
}
|
||||
@@ -58,7 +58,6 @@ import { onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import router from '@/router'
|
||||
import ProductItem from '@/views/base/products/components/ProductItem.vue'
|
||||
import { getProducts } from '@/api/products'
|
||||
import { getStoreCategories } from '@/api/categories'
|
||||
import {
|
||||
getLastPrices,
|
||||
lastPrice,
|
||||
@@ -77,6 +76,7 @@ import { message } from 'ant-design-vue'
|
||||
import BasicButton from "@/App.vue";
|
||||
import BasicIcon from "@/components/BasicPacks/BasicIcon.vue";
|
||||
import ProductItemVertical from "@/views/base/products/components/ProductItemVertical.vue";
|
||||
import { loadProductCategoryTabNames } from '@/utils/categoryTabs'
|
||||
|
||||
const activekey = ref('همه')
|
||||
const showFilter = ref()
|
||||
@@ -111,8 +111,7 @@ function sortProductsByInventory(products: Product[] | undefined) {
|
||||
|
||||
async function loadCategoryTabs() {
|
||||
try {
|
||||
const categories = await getStoreCategories()
|
||||
typeItems.value = categories.map((item) => item.name)
|
||||
typeItems.value = await loadProductCategoryTabNames()
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
typeItems.value = []
|
||||
@@ -130,13 +129,6 @@ onMounted(async () => {
|
||||
items.value = products
|
||||
firstItems.value = products
|
||||
await loadCategoryTabs()
|
||||
if (!typeItems.value.length) {
|
||||
products.forEach((val) => {
|
||||
if (val.group_type && !typeItems.value.includes(val.group_type)) {
|
||||
typeItems.value.push(val.group_type)
|
||||
}
|
||||
})
|
||||
}
|
||||
await initPrice()
|
||||
// await setIntervalGetLastPrice()
|
||||
// console.log('run product')
|
||||
|
||||
Reference in New Issue
Block a user