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 router from '@/router'
|
||||||
import ProductItem from '@/views/base/products/components/ProductItem.vue'
|
import ProductItem from '@/views/base/products/components/ProductItem.vue'
|
||||||
import { getProducts } from '@/api/products'
|
import { getProducts } from '@/api/products'
|
||||||
import { getStoreCategories } from '@/api/categories'
|
|
||||||
import {
|
import {
|
||||||
getLastPrices,
|
getLastPrices,
|
||||||
lastPrice,
|
lastPrice,
|
||||||
@@ -77,6 +76,7 @@ import { message } from 'ant-design-vue'
|
|||||||
import BasicButton from "@/App.vue";
|
import BasicButton from "@/App.vue";
|
||||||
import BasicIcon from "@/components/BasicPacks/BasicIcon.vue";
|
import BasicIcon from "@/components/BasicPacks/BasicIcon.vue";
|
||||||
import ProductItemVertical from "@/views/base/products/components/ProductItemVertical.vue";
|
import ProductItemVertical from "@/views/base/products/components/ProductItemVertical.vue";
|
||||||
|
import { loadProductCategoryTabNames } from '@/utils/categoryTabs'
|
||||||
|
|
||||||
const activekey = ref('همه')
|
const activekey = ref('همه')
|
||||||
const showFilter = ref()
|
const showFilter = ref()
|
||||||
@@ -111,8 +111,7 @@ function sortProductsByInventory(products: Product[] | undefined) {
|
|||||||
|
|
||||||
async function loadCategoryTabs() {
|
async function loadCategoryTabs() {
|
||||||
try {
|
try {
|
||||||
const categories = await getStoreCategories()
|
typeItems.value = await loadProductCategoryTabNames()
|
||||||
typeItems.value = categories.map((item) => item.name)
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
typeItems.value = []
|
typeItems.value = []
|
||||||
@@ -130,13 +129,6 @@ onMounted(async () => {
|
|||||||
items.value = products
|
items.value = products
|
||||||
firstItems.value = products
|
firstItems.value = products
|
||||||
await loadCategoryTabs()
|
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 initPrice()
|
||||||
// await setIntervalGetLastPrice()
|
// await setIntervalGetLastPrice()
|
||||||
// console.log('run product')
|
// console.log('run product')
|
||||||
|
|||||||
Reference in New Issue
Block a user