fix some bug
This commit is contained in:
@@ -16,10 +16,10 @@
|
||||
label-class="text-white/80"
|
||||
/>
|
||||
<span class="text-[11px] text-white/80">/گرم</span>
|
||||
<span class="text-lg font-bold leading-none">{{ usePrice(master?.price ?? 0, true, '') }}</span>
|
||||
<span class="text-lg font-bold leading-none">{{ usePrice(master?.price ?? 0, true, 'ریال') }}</span>
|
||||
<span class="text-white/35">·</span>
|
||||
<span class="text-[11px] text-white/80">مثقال</span>
|
||||
<span class="text-sm font-semibold leading-none">{{ usePrice(master?.pricem ?? 0, true, '') }}</span>
|
||||
<span class="text-sm font-semibold leading-none">{{ usePrice(master?.pricem ?? 0, true, 'ریال') }}</span>
|
||||
</div>
|
||||
<p v-if="master?.update_date" class="mt-1 text-[10px] leading-none text-white/55">
|
||||
{{ toJalali(master.update_date) }}
|
||||
@@ -45,45 +45,33 @@
|
||||
|
||||
<DashboardQuickWalletModal v-model:visible="showQuickWallet" />
|
||||
|
||||
<!-- KPI -->
|
||||
<section class="mt-2 grid grid-cols-2 items-stretch gap-2 md:grid-cols-3 xl:grid-cols-6">
|
||||
<DashboardStatCard
|
||||
tone="gold"
|
||||
icon="vuesax-linear:money-receive"
|
||||
title="سود معاملات"
|
||||
:value="usePrice(finance?.fullPriceSood ?? 0, true, '')"
|
||||
:help="copy.kpi.profit"
|
||||
/>
|
||||
<DashboardStatCard
|
||||
tone="amber"
|
||||
icon="vuesax-linear:coin"
|
||||
:title="metalLabel.goldCommission()"
|
||||
:value="usePrice(finance?.fullPriceKarmozd ?? finance?.fullPriceKaermozd ?? 0, true, '')"
|
||||
:help="copy.kpi.commission"
|
||||
/>
|
||||
<DashboardTradingIncomeSummary :finance="finance" />
|
||||
|
||||
<!-- تراز و آمار — ۴ کارت در یک ردیف -->
|
||||
<section class="dashboard-metrics-row mt-2">
|
||||
<DashboardStatCard
|
||||
tone="green"
|
||||
icon="vuesax-linear:receipt-2"
|
||||
title="تعداد سفارش"
|
||||
subtitle="ثبتشده در بازه"
|
||||
:value="String(finance?.orderCount ?? 0)"
|
||||
:help="copy.kpi.orderCount"
|
||||
/>
|
||||
<template v-if="metalBalanceItems.length">
|
||||
<DashboardStatCard
|
||||
v-for="item in metalBalanceItems"
|
||||
:key="item.metal_id"
|
||||
tone="blue"
|
||||
icon="vuesax-linear:empty-wallet"
|
||||
:title="metalBalanceTitle(item.metal_id, item.label)"
|
||||
:value="formatGram(item.goldBalance, item.metal_id)"
|
||||
:help="copy.kpi.goldBalance"
|
||||
/>
|
||||
</template>
|
||||
<DashboardStatCard
|
||||
v-if="metalBalanceItems.length === 1"
|
||||
tone="blue"
|
||||
icon="vuesax-linear:empty-wallet"
|
||||
:title="metalBalanceTitle(metalBalanceItems[0].metal_id, metalBalanceItems[0].label)"
|
||||
subtitle="تراز وزن — سفارش موفق"
|
||||
:value="formatGram(metalBalanceItems[0].goldBalance, metalBalanceItems[0].metal_id)"
|
||||
:help="copy.kpi.goldBalance"
|
||||
/>
|
||||
<DashboardStatCard
|
||||
v-else
|
||||
tone="blue"
|
||||
icon="vuesax-linear:empty-wallet"
|
||||
:title="metalLabel.goldBalance()"
|
||||
subtitle="تراز وزن — سفارش موفق"
|
||||
:value="formatGram(balance?.goldBalance)"
|
||||
:help="copy.kpi.goldBalance"
|
||||
/>
|
||||
@@ -91,22 +79,26 @@
|
||||
tone="rose"
|
||||
icon="vuesax-linear:dollar-circle"
|
||||
title="تراز ریالی"
|
||||
:value="usePrice(balance?.cashBalance ?? 0, true, '')"
|
||||
subtitle="ورود/خروج نقد"
|
||||
:value="formatDashboardAmount(balance?.cashBalance)"
|
||||
:unit="DASHBOARD_RIAL_UNIT"
|
||||
:help="copy.kpi.cashBalance"
|
||||
/>
|
||||
<DashboardStatCard
|
||||
tone="violet"
|
||||
icon="vuesax-linear:chart-2"
|
||||
title="تراز مظنه"
|
||||
:value="usePrice(balance?.mazanehBalance ?? 0, true, '')"
|
||||
subtitle="میانگین موزون"
|
||||
:value="formatDashboardAmount(balance?.mazanehBalance)"
|
||||
:unit="DASHBOARD_RIAL_UNIT"
|
||||
:help="copy.kpi.mazanehBalance"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<!-- Date filter -->
|
||||
<!-- بازه گزارش -->
|
||||
<section class="dashboard-panel mt-2">
|
||||
<DashboardSectionHeader title="بازه گزارش" :help="copy.dateRange" />
|
||||
<div class="mb-2 grid grid-cols-1 gap-2 sm:grid-cols-3">
|
||||
<div class="dashboard-metrics-row mb-2">
|
||||
<div
|
||||
v-for="metric in dateRangeMetrics"
|
||||
:key="metric.label"
|
||||
@@ -149,7 +141,7 @@
|
||||
<DashboardSectionHeader title="ترکیب درآمد" :help="copy.charts.incomeMix" />
|
||||
<div class="dashboard-chart-wrap">
|
||||
<apexchart
|
||||
v-if="(finance?.fullPriceSood ?? 0) + (finance?.fullPriceKarmozd ?? 0) > 0"
|
||||
v-if="(finance?.fullPriceSood ?? 0) + (finance?.fullPriceKarmozd ?? 0) + (finance?.GiftsPrise ?? 0) > 0"
|
||||
type="donut"
|
||||
height="220"
|
||||
:options="financeChartOptions"
|
||||
@@ -349,8 +341,9 @@
|
||||
<th class="px-2 py-2 text-right">مقدار</th>
|
||||
<th class="px-2 py-2 text-right">مظنه/گرم</th>
|
||||
<th class="px-2 py-2 text-right">قیمت مشتری</th>
|
||||
<th class="px-2 py-2 text-right">سود/گرم</th>
|
||||
<th class="px-2 py-2 text-right">سود کل</th>
|
||||
<th class="px-2 py-2 text-right">سود اسپرد/گرم</th>
|
||||
<th class="px-2 py-2 text-right">سود اسپرد کل</th>
|
||||
<th class="px-2 py-2 text-right">کارمزد (ریال)</th>
|
||||
<th class="px-2 py-2 text-right">وضعیت</th>
|
||||
<th class="px-2 py-2 text-right">تاریخ</th>
|
||||
</tr>
|
||||
@@ -369,13 +362,16 @@
|
||||
</td>
|
||||
<td class="max-w-[8rem] truncate px-2 py-2.5">{{ order.customer?.name ?? '—' }}</td>
|
||||
<td class="px-2 py-2.5">{{ formatGram(order.amount) }}</td>
|
||||
<td class="px-2 py-2.5">{{ usePrice(order.price_original ?? 0, true, '') }}</td>
|
||||
<td class="px-2 py-2.5">{{ usePrice(order.price ?? 0, true, '') }}</td>
|
||||
<td class="px-2 py-2.5">{{ usePrice(order.price_original ?? 0, true, 'ریال') }}</td>
|
||||
<td class="px-2 py-2.5">{{ usePrice(order.price ?? 0, true, 'ریال') }}</td>
|
||||
<td class="dashboard-profit px-2 py-2.5">
|
||||
{{ usePrice(order.fee ?? 0, true, '') }}
|
||||
{{ usePrice(order.fee ?? 0, true, 'ریال') }}
|
||||
</td>
|
||||
<td class="dashboard-profit px-2 py-2.5 font-semibold">
|
||||
{{ usePrice(order.total_fee ?? 0, true, '') }}
|
||||
{{ usePrice(order.total_fee ?? 0, true, 'ریال') }}
|
||||
</td>
|
||||
<td class="px-2 py-2.5">
|
||||
{{ usePrice(order.service_charge_price ?? 0, true, 'ریال') }}
|
||||
</td>
|
||||
<td class="px-2 py-2.5">
|
||||
<span class="rounded-md px-2 py-0.5 text-xs" :class="stsClass(order.sts)">
|
||||
@@ -449,6 +445,7 @@ import DashboardQuickActionsBar from '@/pages/dashboard/components/DashboardQuic
|
||||
import DashboardQuickWalletModal from '@/pages/dashboard/components/DashboardQuickWalletModal.vue'
|
||||
import DashboardSectionHeader from '@/pages/dashboard/components/DashboardSectionHeader.vue'
|
||||
import DashboardStatCard from '@/pages/dashboard/components/DashboardStatCard.vue'
|
||||
import DashboardTradingIncomeSummary from '@/pages/dashboard/components/DashboardTradingIncomeSummary.vue'
|
||||
import {
|
||||
dashboardCharts,
|
||||
dashboardCustomerMetrics,
|
||||
@@ -462,6 +459,7 @@ import {
|
||||
dashboardWallet,
|
||||
dashboardWalletMetrics,
|
||||
} from '@/pages/dashboard/dashboardSectionCopy'
|
||||
import { DASHBOARD_RIAL_UNIT, formatDashboardAmount } from '@/pages/dashboard/dashboardFormat'
|
||||
import { useDashboardPage } from '@/pages/dashboard/composables/useDashboardPage'
|
||||
import { useDashboardQuickActions } from '@/pages/dashboard/composables/useDashboardQuickActions'
|
||||
import { metalBalanceTitle, metalLabel } from '@/utils/adminMetalLabels'
|
||||
@@ -523,6 +521,12 @@ const {
|
||||
customerStats,
|
||||
} = useDashboardPage()
|
||||
|
||||
const tradingProfitTotal = computed(() => {
|
||||
const spread = Number(finance.value?.fullPriceSood ?? 0)
|
||||
const commission = Number(finance.value?.fullPriceKarmozd ?? finance.value?.fullPriceKaermozd ?? 0)
|
||||
return Number(finance.value?.totalTradingProfit ?? spread + commission)
|
||||
})
|
||||
|
||||
const {
|
||||
quickActionLoading,
|
||||
hasProductSnapshot,
|
||||
@@ -543,16 +547,21 @@ void loadSnapshotStatus()
|
||||
const dateRangeMetrics = computed(() => [
|
||||
{
|
||||
label: 'واریز بانکی',
|
||||
value: usePrice(balance.value?.income_money ?? 0),
|
||||
value: `${formatDashboardAmount(balance.value?.income_money)} ${DASHBOARD_RIAL_UNIT}`,
|
||||
help: dashboardDateMetrics.bankDeposit,
|
||||
},
|
||||
{
|
||||
label: 'درآمد خالص',
|
||||
value: usePrice(finance.value?.sumAll ?? 0),
|
||||
label: 'جمع سود معاملات',
|
||||
value: `${formatDashboardAmount(tradingProfitTotal.value)} ${DASHBOARD_RIAL_UNIT}`,
|
||||
help: dashboardDateMetrics.totalTradingProfit,
|
||||
},
|
||||
{
|
||||
label: 'تراز قیمت−پرداخت (پس از هدیه)',
|
||||
value: `${formatDashboardAmount(finance.value?.sumAll)} ${DASHBOARD_RIAL_UNIT}`,
|
||||
help: dashboardDateMetrics.netIncome,
|
||||
},
|
||||
{
|
||||
label: 'هدایا',
|
||||
label: 'هدایا (گرم)',
|
||||
value: `${finance.value?.Gifts ?? '0'} گرم`,
|
||||
help: dashboardDateMetrics.gifts,
|
||||
},
|
||||
@@ -594,13 +603,13 @@ const walletMetricItems = computed(() => [
|
||||
},
|
||||
{
|
||||
label: 'ریال مشتریان',
|
||||
value: usePrice(walletSums.value?.cash ?? 0, true, ''),
|
||||
value: `${formatDashboardAmount(walletSums.value?.cash)} ${DASHBOARD_RIAL_UNIT}`,
|
||||
help: dashboardWalletMetrics.cash,
|
||||
variant: 'sky',
|
||||
},
|
||||
{
|
||||
label: metalLabel.goldValueInRial(),
|
||||
value: usePrice(walletSums.value?.goldToCash ?? 0, true, ''),
|
||||
value: `${formatDashboardAmount(walletSums.value?.goldToCash)} ${DASHBOARD_RIAL_UNIT}`,
|
||||
help: dashboardWalletMetrics.goldToCash,
|
||||
variant: 'violet',
|
||||
},
|
||||
@@ -616,6 +625,24 @@ const walletMetricItems = computed(() => [
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.dashboard-metrics-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.dashboard-metrics-row {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.dashboard-metrics-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.dashboard-text {
|
||||
color: var(--admin-text);
|
||||
}
|
||||
@@ -630,6 +657,10 @@ const walletMetricItems = computed(() => [
|
||||
|
||||
.dashboard-inline-metric {
|
||||
background: var(--admin-bg-muted);
|
||||
min-height: 3.75rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.dashboard-profit {
|
||||
|
||||
Reference in New Issue
Block a user