price changes
This commit is contained in:
@@ -102,6 +102,7 @@ import { isProductPriceInactive } from '@/utils/productPrice'
|
||||
import { isMetalCommodityGroup, isMeltedTradeGroup } from '@/utils/productCategories'
|
||||
import { isBoursecuDealProductGroup } from '@/utils/productDealMethod'
|
||||
import { loadServiceFeeFromSettings } from '@/utils/serviceFee'
|
||||
import { loadProductCategoryTabNames } from '@/utils/categoryTabs'
|
||||
import { getLastPrices, startLastPricePolling, stopLastPricePolling } from '@/utils/price'
|
||||
|
||||
const activekey = ref('طلا' ||'آبشده')
|
||||
@@ -158,9 +159,18 @@ function changeTab() {
|
||||
|
||||
const firstItems = ref<Product[]>()
|
||||
const items = ref<Product[]>()
|
||||
const typeItems = ref([])
|
||||
const typeItems = ref<string[]>([])
|
||||
let productListInterval: ReturnType<typeof setInterval> | undefined
|
||||
|
||||
async function loadCategoryTabs() {
|
||||
try {
|
||||
typeItems.value = await loadProductCategoryTabNames()
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
typeItems.value = []
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* رفرش بیصدای لیست محصولات (هر ۱۰ ثانیه تا وقتی در این صفحهایم).
|
||||
* آپدیت درجا انجام میشود تا لیست re-render کامل نشود و نپرد؛
|
||||
@@ -173,12 +183,6 @@ async function refreshProducts() {
|
||||
return
|
||||
}
|
||||
|
||||
fresh.forEach((val) => {
|
||||
if (!typeItems.value.includes(val.group_type)) {
|
||||
typeItems.value.push(val.group_type)
|
||||
}
|
||||
})
|
||||
|
||||
const freshById = new Map(fresh.map((p) => [p.id, p]))
|
||||
const current = firstItems.value
|
||||
|
||||
@@ -220,12 +224,7 @@ onMounted(async () => {
|
||||
openTime.value = items.value[0].auto_open_at
|
||||
}
|
||||
|
||||
items.value?.forEach((val, index) => {
|
||||
if (!typeItems.value.includes(val.group_type)){
|
||||
typeItems.value.push(val.group_type)
|
||||
}
|
||||
// typeItems.value[index] = val.group_type
|
||||
})
|
||||
await loadCategoryTabs()
|
||||
firstItems.value = items.value
|
||||
await loadServiceFeeFromSettings()
|
||||
productListInterval = setInterval(refreshProducts, 10000)
|
||||
|
||||
Reference in New Issue
Block a user