fix some bugs

This commit is contained in:
2026-06-23 22:31:07 +03:30
parent 4e7d6bca00
commit 71764f7e9a
68 changed files with 1941 additions and 1288 deletions
@@ -12,6 +12,7 @@ import {
toggleGateway,
} from '@/api/dashboard'
import { getWalletTable } from '@/api/wallet'
import { formatMetalWeightFromGrams } from '@/utils/metalWeight'
import type {
DashboardFlowPoint,
DashboardFinance,
@@ -23,6 +24,7 @@ import type { Order } from '@/model/order'
import type { Balance } from '@/model/product'
import { usePrice } from '@core/utils/usePrice'
import { toJalali } from '@core/utils/useDataTime'
import { metalLabel } from '@/utils/adminMetalLabels'
import { isMobile } from '@core/utils/is'
import { isStoreApp } from '@/utils/config'
import { useAdminTheme } from '@core/composable/useAdminTheme'
@@ -229,7 +231,10 @@ export function useDashboardPage() {
master.value = await getDashboard()
}
function formatGram(value?: number) {
function formatGram(value?: number, metalId?: number) {
if (metalId != null) {
return formatMetalWeightFromGrams(value ?? 0, metalId)
}
return `${Number(value ?? 0).toLocaleString('fa-IR', { maximumFractionDigits: 3 })} گرم`
}
@@ -277,7 +282,7 @@ export function useDashboardPage() {
return {
...chartSurfaceOptions(),
chart: { type: 'donut', fontFamily: 'inherit', offsetY: 4, foreColor: chartSurfaceOptions().chart.foreColor },
labels: ['سود معامله', 'کارمزد طلایی', 'هدایای طلا'],
labels: ['سود معامله', metalLabel.goldCommission(), metalLabel.goldGifts()],
colors: ['#10b981', '#f59e0b', '#8b5cf6'],
legend: {
position: 'bottom',
@@ -576,6 +581,8 @@ export function useDashboardPage() {
}
})
const metalBalanceItems = computed(() => balance.value?.metalBalances ?? [])
onMounted(() => {
void refreshAll()
})
@@ -588,6 +595,7 @@ export function useDashboardPage() {
master,
finance,
balance,
metalBalanceItems,
walletSums,
recentOrders,
customerStats,