2026-01-24 17:45:54 +03:30
|
|
|
|
<template>
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<div class="dashboard-v2 box-border min-h-full w-full max-w-full overflow-x-hidden p-2 md:p-3">
|
|
|
|
|
|
<a-spin :spinning="loading">
|
|
|
|
|
|
<!-- Hero -->
|
|
|
|
|
|
<section
|
2026-06-21 21:55:54 +03:30
|
|
|
|
class="dashboard-hero rounded-xl bg-gradient-to-l from-[#0f766e] via-[#1e3a5f] to-[#0f172a] px-3 py-2.5 text-white shadow-md"
|
2026-01-24 17:45:54 +03:30
|
|
|
|
>
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<div class="flex flex-col gap-2.5 md:flex-row md:items-center md:justify-between md:gap-3">
|
|
|
|
|
|
<div class="order-2 min-w-0 md:order-1">
|
|
|
|
|
|
<div class="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5">
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<DashboardLabelWithHelp
|
2026-06-21 21:55:54 +03:30
|
|
|
|
label="مظنه"
|
|
|
|
|
|
:help="copy.hero"
|
2026-06-21 20:27:13 +03:30
|
|
|
|
size="xs"
|
|
|
|
|
|
text-class="text-[11px]"
|
2026-06-21 21:55:54 +03:30
|
|
|
|
label-class="text-white/80"
|
2026-01-26 11:21:13 +03:30
|
|
|
|
/>
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<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-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>
|
2026-01-26 11:21:13 +03:30
|
|
|
|
</div>
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<p v-if="master?.update_date" class="mt-1 text-[10px] leading-none text-white/55">
|
|
|
|
|
|
{{ toJalali(master.update_date) }}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="order-1 w-full shrink-0 md:order-2 md:w-auto">
|
|
|
|
|
|
<DashboardQuickActionsBar
|
|
|
|
|
|
:quick-action-loading="quickActionLoading"
|
|
|
|
|
|
:has-product-snapshot="hasProductSnapshot"
|
|
|
|
|
|
:product-snapshot-count="productSnapshotCount"
|
|
|
|
|
|
@wallet="showQuickWallet = true"
|
|
|
|
|
|
@deactivate-all="deactivateAll"
|
|
|
|
|
|
@restore-products="restoreProducts"
|
|
|
|
|
|
@close-all-buy="closeAllBuy"
|
|
|
|
|
|
@close-all-sell="closeAllSell"
|
|
|
|
|
|
@sync-prices="syncPrices"
|
|
|
|
|
|
@sync-show="syncShow"
|
|
|
|
|
|
/>
|
2026-01-26 11:21:13 +03:30
|
|
|
|
</div>
|
2026-06-21 20:27:13 +03:30
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<DashboardQuickWalletModal v-model:visible="showQuickWallet" />
|
|
|
|
|
|
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<!-- 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="کارمزد طلایی"
|
|
|
|
|
|
:value="usePrice(finance?.fullPriceKarmozd ?? finance?.fullPriceKaermozd ?? 0, true, '')"
|
|
|
|
|
|
:help="copy.kpi.commission"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<DashboardStatCard
|
|
|
|
|
|
tone="green"
|
|
|
|
|
|
icon="vuesax-linear:receipt-2"
|
|
|
|
|
|
title="تعداد سفارش"
|
|
|
|
|
|
:value="String(finance?.orderCount ?? 0)"
|
|
|
|
|
|
:help="copy.kpi.orderCount"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<DashboardStatCard
|
|
|
|
|
|
tone="blue"
|
|
|
|
|
|
icon="vuesax-linear:empty-wallet"
|
|
|
|
|
|
title="تراز طلایی"
|
|
|
|
|
|
:value="formatGram(balance?.goldBalance)"
|
|
|
|
|
|
:help="copy.kpi.goldBalance"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<DashboardStatCard
|
|
|
|
|
|
tone="rose"
|
|
|
|
|
|
icon="vuesax-linear:dollar-circle"
|
|
|
|
|
|
title="تراز ریالی"
|
|
|
|
|
|
:value="usePrice(balance?.cashBalance ?? 0, true, '')"
|
|
|
|
|
|
:help="copy.kpi.cashBalance"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<DashboardStatCard
|
|
|
|
|
|
tone="violet"
|
|
|
|
|
|
icon="vuesax-linear:chart-2"
|
|
|
|
|
|
title="تراز مظنه"
|
|
|
|
|
|
:value="usePrice(balance?.mazanehBalance ?? 0, true, '')"
|
|
|
|
|
|
:help="copy.kpi.mazanehBalance"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Date filter -->
|
|
|
|
|
|
<section
|
|
|
|
|
|
class="mt-2 rounded-xl border border-slate-200 bg-white px-3 py-2 dark:border-slate-600 dark:bg-slate-900"
|
|
|
|
|
|
>
|
|
|
|
|
|
<DashboardSectionHeader title="بازه گزارش" :help="copy.dateRange" />
|
|
|
|
|
|
<div class="mb-2 grid grid-cols-1 gap-2 sm:grid-cols-3">
|
2026-01-26 11:21:13 +03:30
|
|
|
|
<div
|
2026-06-21 20:27:13 +03:30
|
|
|
|
v-for="metric in dateRangeMetrics"
|
|
|
|
|
|
:key="metric.label"
|
|
|
|
|
|
class="rounded-lg bg-slate-50 px-2.5 py-2 dark:bg-slate-800/60"
|
2026-01-26 11:21:13 +03:30
|
|
|
|
>
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<DashboardLabelWithHelp
|
|
|
|
|
|
:label="metric.label"
|
|
|
|
|
|
:help="metric.help"
|
|
|
|
|
|
size="xs"
|
|
|
|
|
|
text-class="text-[10px]"
|
|
|
|
|
|
label-class="text-slate-600 dark:text-slate-400"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<p class="text-sm font-bold text-slate-900 dark:text-slate-50">{{ metric.value }}</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<div class="flex flex-wrap items-center gap-2">
|
|
|
|
|
|
<BaseDatePicker
|
|
|
|
|
|
v-model:value="startDate"
|
|
|
|
|
|
format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
|
class="!w-44"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<span class="text-xs text-slate-500 dark:text-slate-400">تا</span>
|
|
|
|
|
|
<BaseDatePicker
|
|
|
|
|
|
v-model:value="endDate"
|
|
|
|
|
|
format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
|
class="!w-44"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
|
|
<a-button type="primary" size="small" @click="applyDateRange">اعمال</a-button>
|
|
|
|
|
|
<a-button size="small" @click="refreshAll">بروزرسانی</a-button>
|
|
|
|
|
|
</div>
|
2026-06-21 20:27:13 +03:30
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Charts row 1 -->
|
|
|
|
|
|
<section class="mt-2 grid grid-cols-1 gap-2 xl:grid-cols-2">
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<div class="dashboard-panel">
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<DashboardSectionHeader title="ترکیب درآمد" :help="copy.charts.incomeMix" />
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<div class="dashboard-chart-wrap">
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<apexchart
|
|
|
|
|
|
v-if="(finance?.fullPriceSood ?? 0) + (finance?.fullPriceKarmozd ?? 0) > 0"
|
|
|
|
|
|
type="donut"
|
|
|
|
|
|
height="220"
|
|
|
|
|
|
:options="financeChartOptions"
|
|
|
|
|
|
:series="financeChartOptions.series"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-else
|
|
|
|
|
|
class="flex h-44 items-center justify-center text-xs text-slate-500 dark:text-slate-400"
|
|
|
|
|
|
>
|
|
|
|
|
|
در این بازه داده مالی ثبت نشده
|
|
|
|
|
|
</div>
|
2026-06-21 21:55:54 +03:30
|
|
|
|
</div>
|
2026-06-21 20:27:13 +03:30
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<div class="dashboard-panel">
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<div class="flex items-start justify-between gap-2">
|
|
|
|
|
|
<DashboardSectionHeader
|
|
|
|
|
|
class="!mb-0 min-w-0 flex-1"
|
|
|
|
|
|
title="حجم خرید و فروش"
|
|
|
|
|
|
:help="copy.charts.buySellVolume"
|
|
|
|
|
|
/>
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<a-radio-group
|
2026-06-21 20:27:13 +03:30
|
|
|
|
v-model:value="flowRange"
|
2026-06-21 21:55:54 +03:30
|
|
|
|
button-style="solid"
|
2026-06-21 20:27:13 +03:30
|
|
|
|
size="small"
|
2026-06-21 21:55:54 +03:30
|
|
|
|
class="shrink-0"
|
|
|
|
|
|
>
|
|
|
|
|
|
<a-radio-button value="week">۷ روز</a-radio-button>
|
|
|
|
|
|
<a-radio-button value="month">۳۰ روز</a-radio-button>
|
|
|
|
|
|
</a-radio-group>
|
2026-06-21 20:27:13 +03:30
|
|
|
|
</div>
|
|
|
|
|
|
<a-spin :spinning="flowLoading">
|
|
|
|
|
|
<apexchart
|
|
|
|
|
|
v-if="flowData.length"
|
|
|
|
|
|
type="bar"
|
2026-06-21 21:55:54 +03:30
|
|
|
|
:height="flowChartHeight"
|
2026-06-21 20:27:13 +03:30
|
|
|
|
:options="flowChartOptions"
|
|
|
|
|
|
:series="flowChartOptions.series"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-else
|
|
|
|
|
|
class="flex h-44 items-center justify-center text-xs text-slate-500 dark:text-slate-400"
|
|
|
|
|
|
>
|
|
|
|
|
|
دادهای برای نمودار نیست
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</a-spin>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Price chart -->
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<section class="dashboard-panel mt-2">
|
|
|
|
|
|
<div class="mb-3 flex flex-wrap items-start justify-between gap-2">
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<DashboardSectionHeader
|
|
|
|
|
|
class="!mb-0 min-w-0 flex-1"
|
|
|
|
|
|
title="نمودار مظنه"
|
|
|
|
|
|
:help="copy.charts.priceChart"
|
|
|
|
|
|
/>
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<a-radio-group
|
2026-06-21 20:27:13 +03:30
|
|
|
|
v-model:value="priceRange"
|
2026-06-21 21:55:54 +03:30
|
|
|
|
button-style="solid"
|
2026-06-21 20:27:13 +03:30
|
|
|
|
size="small"
|
2026-06-21 21:55:54 +03:30
|
|
|
|
class="dashboard-price-range shrink-0"
|
|
|
|
|
|
>
|
|
|
|
|
|
<a-radio-button value="DAILY">24 ساعت اخیر</a-radio-button>
|
|
|
|
|
|
<a-radio-button value="WEEKLY">هفته گذشته</a-radio-button>
|
|
|
|
|
|
<a-radio-button value="MONTHLY">ماه گذشته</a-radio-button>
|
|
|
|
|
|
</a-radio-group>
|
2026-06-21 20:27:13 +03:30
|
|
|
|
</div>
|
|
|
|
|
|
<apexchart
|
|
|
|
|
|
v-if="priceSeries.length"
|
2026-06-21 21:55:54 +03:30
|
|
|
|
:key="priceRange"
|
2026-06-21 20:27:13 +03:30
|
|
|
|
type="area"
|
|
|
|
|
|
height="200"
|
|
|
|
|
|
:options="priceChartOptions"
|
|
|
|
|
|
:series="priceChartOptions.series"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-else
|
|
|
|
|
|
class="flex h-40 items-center justify-center text-xs text-slate-500 dark:text-slate-400"
|
|
|
|
|
|
>
|
|
|
|
|
|
داده نمودار قیمت در دسترس نیست
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<!-- Orders + side charts -->
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<section class="mt-2 grid grid-cols-1 gap-2 xl:grid-cols-3">
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<div class="flex flex-col gap-2 xl:col-span-1">
|
|
|
|
|
|
<div class="dashboard-panel">
|
|
|
|
|
|
<div class="mb-2 flex items-start justify-between gap-2">
|
|
|
|
|
|
<DashboardSectionHeader
|
|
|
|
|
|
class="!mb-0 min-w-0 flex-1"
|
|
|
|
|
|
title="ساعات شلوغ سفارش"
|
|
|
|
|
|
:help="copy.orders.peakHours"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<a-radio-group
|
|
|
|
|
|
v-model:value="peakHoursRange"
|
|
|
|
|
|
button-style="solid"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
class="shrink-0"
|
|
|
|
|
|
>
|
|
|
|
|
|
<a-radio-button :value="7">۷ روز</a-radio-button>
|
|
|
|
|
|
<a-radio-button :value="30">۳۰ روز</a-radio-button>
|
|
|
|
|
|
</a-radio-group>
|
2026-01-26 11:21:13 +03:30
|
|
|
|
</div>
|
2026-06-21 21:55:54 +03:30
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-if="peakHoursData?.peak_hour != null && peakHoursData.peak_count > 0"
|
|
|
|
|
|
class="mb-3 flex flex-wrap items-center gap-1.5"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span
|
|
|
|
|
|
class="inline-flex items-center rounded-full bg-amber-50 px-2.5 py-1 text-[11px] font-semibold text-amber-800 dark:bg-amber-950/40 dark:text-amber-200"
|
|
|
|
|
|
>
|
|
|
|
|
|
شلوغترین: {{ formatPeakHourLabel(peakHoursData.peak_hour) }}
|
|
|
|
|
|
<span class="mr-1 font-normal opacity-75">({{ peakHoursData.peak_count }} سفارش)</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span
|
|
|
|
|
|
v-for="slot in topPeakHours.slice(1)"
|
|
|
|
|
|
:key="slot.hour"
|
|
|
|
|
|
class="inline-flex items-center rounded-full bg-slate-100 px-2 py-0.5 text-[10px] text-slate-600 dark:bg-slate-800 dark:text-slate-300"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ formatPeakHourLabel(slot.hour) }} · {{ slot.total }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<a-spin :spinning="peakHoursLoading">
|
|
|
|
|
|
<apexchart
|
|
|
|
|
|
v-if="peakHoursData?.total_orders"
|
|
|
|
|
|
type="bar"
|
|
|
|
|
|
:height="peakHoursChartHeight"
|
|
|
|
|
|
:options="peakHoursChartOptions"
|
|
|
|
|
|
:series="peakHoursChartOptions.series"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-else
|
|
|
|
|
|
class="flex h-44 items-center justify-center text-xs text-slate-500 dark:text-slate-400"
|
|
|
|
|
|
>
|
|
|
|
|
|
در این بازه سفارشی ثبت نشده
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</a-spin>
|
2026-01-26 11:21:13 +03:30
|
|
|
|
</div>
|
2026-06-21 21:55:54 +03:30
|
|
|
|
|
|
|
|
|
|
<div class="dashboard-panel">
|
|
|
|
|
|
<div class="mb-3 flex flex-wrap items-start justify-between gap-2">
|
|
|
|
|
|
<DashboardSectionHeader
|
|
|
|
|
|
class="!mb-0 min-w-0 flex-1"
|
|
|
|
|
|
title="فعالیت محصولات"
|
|
|
|
|
|
:help="copy.charts.productActivity"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<a-radio-group
|
|
|
|
|
|
v-model:value="productActivityRange"
|
|
|
|
|
|
button-style="solid"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
class="dashboard-product-range shrink-0"
|
|
|
|
|
|
>
|
|
|
|
|
|
<a-radio-button value="day">روزانه</a-radio-button>
|
|
|
|
|
|
<a-radio-button value="week">هفتگی</a-radio-button>
|
|
|
|
|
|
<a-radio-button value="month">ماهانه</a-radio-button>
|
|
|
|
|
|
<a-radio-button value="year">سالانه</a-radio-button>
|
|
|
|
|
|
</a-radio-group>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<a-spin :spinning="productActivityLoading">
|
|
|
|
|
|
<div v-if="productReportItems.length" class="dashboard-product-chart min-w-0">
|
|
|
|
|
|
<apexchart
|
|
|
|
|
|
:key="`${productActivityRange}-${productChartHeight}-${productChartLabelWidth}`"
|
|
|
|
|
|
type="bar"
|
|
|
|
|
|
:height="productChartHeight"
|
|
|
|
|
|
:options="productChartOptions"
|
|
|
|
|
|
:series="productChartOptions.series"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-else
|
|
|
|
|
|
class="flex h-44 items-center justify-center text-xs text-slate-500 dark:text-slate-400"
|
|
|
|
|
|
>
|
|
|
|
|
|
در این بازه معاملهای برای محصولات ثبت نشده
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</a-spin>
|
2026-06-21 20:27:13 +03:30
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-01-26 11:21:13 +03:30
|
|
|
|
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<div class="dashboard-panel xl:col-span-2">
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<div class="mb-2 flex items-start justify-between gap-2">
|
|
|
|
|
|
<DashboardSectionHeader
|
|
|
|
|
|
class="!mb-0 min-w-0 flex-1"
|
|
|
|
|
|
title="آخرین سفارشات"
|
|
|
|
|
|
:help="copy.orders.recent"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<router-link :to="{ name: 'ordersMain' }">
|
|
|
|
|
|
<a-button type="link" class="!px-0">همه سفارشات</a-button>
|
|
|
|
|
|
</router-link>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="overflow-x-auto">
|
|
|
|
|
|
<table class="w-full min-w-[52rem] text-sm">
|
|
|
|
|
|
<thead>
|
|
|
|
|
|
<tr class="border-b border-slate-200 text-xs text-slate-600 dark:border-slate-700 dark:text-slate-300">
|
|
|
|
|
|
<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>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
<tr
|
|
|
|
|
|
v-for="order in recentOrders"
|
|
|
|
|
|
:key="order.id"
|
|
|
|
|
|
class="border-b border-slate-100 text-slate-800 hover:bg-slate-50 dark:border-slate-800 dark:text-slate-200 dark:hover:bg-slate-800/50"
|
2026-01-26 11:21:13 +03:30
|
|
|
|
>
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<td class="px-2 py-2.5 font-medium">#{{ order.id }}</td>
|
|
|
|
|
|
<td class="px-2 py-2.5">
|
|
|
|
|
|
<span class="rounded-md px-2 py-0.5 text-xs" :class="directionClass(order.direction)">
|
|
|
|
|
|
{{ directionLabel(order.direction) }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</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 text-emerald-700 dark:text-emerald-400">
|
|
|
|
|
|
{{ usePrice(order.fee ?? 0, true, '') }}
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="px-2 py-2.5 font-semibold text-emerald-700 dark:text-emerald-400">
|
|
|
|
|
|
{{ usePrice(order.total_fee ?? 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)">
|
|
|
|
|
|
{{ stsLabel(order) }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="whitespace-nowrap px-2 py-2.5 text-xs text-slate-500 dark:text-slate-400">
|
|
|
|
|
|
{{ order.created_at ? toJalali(order.created_at) : '—' }}
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
2026-01-26 11:21:13 +03:30
|
|
|
|
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<!-- Bottom row -->
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<section class="mt-2 grid grid-cols-1 gap-2 xl:grid-cols-2">
|
|
|
|
|
|
<div class="dashboard-panel">
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<DashboardSectionHeader title="مشتریان" :help="copy.customers" />
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<div class="grid grid-cols-2 gap-2.5 md:grid-cols-4">
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<div
|
|
|
|
|
|
v-for="item in customerMetricItems"
|
|
|
|
|
|
:key="item.label"
|
2026-06-21 21:55:54 +03:30
|
|
|
|
class="dashboard-metric-cell"
|
2026-06-21 20:27:13 +03:30
|
|
|
|
:class="item.bgClass"
|
|
|
|
|
|
>
|
|
|
|
|
|
<DashboardLabelWithHelp
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:help="item.help"
|
|
|
|
|
|
size="xs"
|
2026-06-21 21:55:54 +03:30
|
|
|
|
text-class="text-[11px]"
|
2026-06-21 20:27:13 +03:30
|
|
|
|
:label-class="item.labelClass"
|
2026-06-21 21:55:54 +03:30
|
|
|
|
root-class="dashboard-metric-label"
|
2026-06-21 20:27:13 +03:30
|
|
|
|
/>
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<p class="dashboard-metric-value" :class="item.valueClass">{{ item.value }}</p>
|
2026-01-26 11:21:13 +03:30
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-06-21 20:27:13 +03:30
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<div class="dashboard-panel">
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<DashboardSectionHeader title="موجودی کیف پولها" :help="copy.wallet" />
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<div class="grid grid-cols-1 gap-2.5 sm:grid-cols-3">
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<div
|
|
|
|
|
|
v-for="item in walletMetricItems"
|
|
|
|
|
|
:key="item.label"
|
2026-06-21 21:55:54 +03:30
|
|
|
|
class="dashboard-metric-cell"
|
2026-06-21 20:27:13 +03:30
|
|
|
|
:class="item.bgClass"
|
|
|
|
|
|
>
|
|
|
|
|
|
<DashboardLabelWithHelp
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:help="item.help"
|
2026-06-21 21:55:54 +03:30
|
|
|
|
size="xs"
|
|
|
|
|
|
text-class="text-[11px]"
|
|
|
|
|
|
label-class="text-slate-600 dark:text-slate-400"
|
|
|
|
|
|
root-class="dashboard-metric-label"
|
2026-06-21 20:27:13 +03:30
|
|
|
|
/>
|
2026-06-21 21:55:54 +03:30
|
|
|
|
<p class="dashboard-metric-value text-slate-900 dark:text-slate-50">{{ item.value }}</p>
|
2026-06-21 20:27:13 +03:30
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
2026-01-24 17:45:54 +03:30
|
|
|
|
</a-spin>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-06-21 21:55:54 +03:30
|
|
|
|
import { computed, ref } from 'vue'
|
2026-06-21 20:27:13 +03:30
|
|
|
|
import DashboardLabelWithHelp from '@/pages/dashboard/components/DashboardLabelWithHelp.vue'
|
2026-06-21 21:55:54 +03:30
|
|
|
|
import DashboardQuickActionsBar from '@/pages/dashboard/components/DashboardQuickActionsBar.vue'
|
|
|
|
|
|
import DashboardQuickWalletModal from '@/pages/dashboard/components/DashboardQuickWalletModal.vue'
|
2026-06-21 20:27:13 +03:30
|
|
|
|
import DashboardSectionHeader from '@/pages/dashboard/components/DashboardSectionHeader.vue'
|
|
|
|
|
|
import DashboardStatCard from '@/pages/dashboard/components/DashboardStatCard.vue'
|
|
|
|
|
|
import {
|
|
|
|
|
|
dashboardCharts,
|
|
|
|
|
|
dashboardCustomerMetrics,
|
|
|
|
|
|
dashboardCustomers,
|
|
|
|
|
|
dashboardDateMetrics,
|
|
|
|
|
|
dashboardDateRange,
|
|
|
|
|
|
dashboardGateway,
|
|
|
|
|
|
dashboardHero,
|
|
|
|
|
|
dashboardKpi,
|
|
|
|
|
|
dashboardOrders,
|
|
|
|
|
|
dashboardWallet,
|
|
|
|
|
|
dashboardWalletMetrics,
|
|
|
|
|
|
} from '@/pages/dashboard/dashboardSectionCopy'
|
|
|
|
|
|
import { useDashboardPage } from '@/pages/dashboard/composables/useDashboardPage'
|
2026-06-21 21:55:54 +03:30
|
|
|
|
import { useDashboardQuickActions } from '@/pages/dashboard/composables/useDashboardQuickActions'
|
2026-05-31 11:51:52 +03:30
|
|
|
|
|
2026-06-21 20:27:13 +03:30
|
|
|
|
const copy = {
|
|
|
|
|
|
hero: dashboardHero,
|
|
|
|
|
|
gateway: dashboardGateway,
|
|
|
|
|
|
kpi: dashboardKpi,
|
|
|
|
|
|
dateRange: dashboardDateRange,
|
|
|
|
|
|
charts: dashboardCharts,
|
|
|
|
|
|
orders: dashboardOrders,
|
|
|
|
|
|
customers: dashboardCustomers,
|
|
|
|
|
|
wallet: dashboardWallet,
|
2026-01-24 17:45:54 +03:30
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-21 20:27:13 +03:30
|
|
|
|
const {
|
|
|
|
|
|
loading,
|
|
|
|
|
|
flowLoading,
|
|
|
|
|
|
startDate,
|
|
|
|
|
|
endDate,
|
|
|
|
|
|
master,
|
|
|
|
|
|
finance,
|
|
|
|
|
|
balance,
|
|
|
|
|
|
walletSums,
|
|
|
|
|
|
recentOrders,
|
2026-06-21 21:55:54 +03:30
|
|
|
|
peakHoursRange,
|
|
|
|
|
|
peakHoursData,
|
|
|
|
|
|
peakHoursLoading,
|
|
|
|
|
|
topPeakHours,
|
2026-06-21 20:27:13 +03:30
|
|
|
|
priceRange,
|
|
|
|
|
|
flowRange,
|
|
|
|
|
|
flowData,
|
|
|
|
|
|
priceSeries,
|
2026-06-21 21:55:54 +03:30
|
|
|
|
productActivityRange,
|
|
|
|
|
|
productActivityLoading,
|
|
|
|
|
|
productReportItems,
|
|
|
|
|
|
productChartHeight,
|
|
|
|
|
|
productChartLabelWidth,
|
2026-06-21 20:27:13 +03:30
|
|
|
|
refreshAll,
|
|
|
|
|
|
applyDateRange,
|
|
|
|
|
|
loadFlow,
|
2026-06-21 21:55:54 +03:30
|
|
|
|
loadProductActivity,
|
2026-06-21 20:27:13 +03:30
|
|
|
|
formatGram,
|
|
|
|
|
|
directionLabel,
|
|
|
|
|
|
directionClass,
|
|
|
|
|
|
stsClass,
|
|
|
|
|
|
stsLabel,
|
|
|
|
|
|
financeChartOptions,
|
|
|
|
|
|
flowChartOptions,
|
2026-06-21 21:55:54 +03:30
|
|
|
|
flowChartHeight,
|
|
|
|
|
|
peakHoursChartOptions,
|
|
|
|
|
|
peakHoursChartHeight,
|
|
|
|
|
|
formatPeakHourLabel,
|
2026-06-21 20:27:13 +03:30
|
|
|
|
priceChartOptions,
|
|
|
|
|
|
productChartOptions,
|
|
|
|
|
|
usePrice,
|
|
|
|
|
|
toJalali,
|
2026-06-21 21:55:54 +03:30
|
|
|
|
customerStats,
|
2026-06-21 20:27:13 +03:30
|
|
|
|
} = useDashboardPage()
|
2026-01-24 17:45:54 +03:30
|
|
|
|
|
2026-06-21 21:55:54 +03:30
|
|
|
|
const {
|
|
|
|
|
|
quickActionLoading,
|
|
|
|
|
|
hasProductSnapshot,
|
|
|
|
|
|
productSnapshotCount,
|
|
|
|
|
|
loadSnapshotStatus,
|
|
|
|
|
|
deactivateAll,
|
|
|
|
|
|
restoreProducts,
|
|
|
|
|
|
closeAllBuy,
|
|
|
|
|
|
closeAllSell,
|
|
|
|
|
|
syncShow,
|
|
|
|
|
|
syncPrices,
|
|
|
|
|
|
} = useDashboardQuickActions(refreshAll)
|
|
|
|
|
|
|
|
|
|
|
|
const showQuickWallet = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
void loadSnapshotStatus()
|
|
|
|
|
|
|
2026-06-21 20:27:13 +03:30
|
|
|
|
const dateRangeMetrics = computed(() => [
|
2026-01-24 17:45:54 +03:30
|
|
|
|
{
|
2026-06-21 20:27:13 +03:30
|
|
|
|
label: 'واریز بانکی',
|
|
|
|
|
|
value: usePrice(balance.value?.income_money ?? 0),
|
|
|
|
|
|
help: dashboardDateMetrics.bankDeposit,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: 'درآمد خالص',
|
|
|
|
|
|
value: usePrice(finance.value?.sumAll ?? 0),
|
|
|
|
|
|
help: dashboardDateMetrics.netIncome,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: 'هدایا',
|
|
|
|
|
|
value: `${finance.value?.Gifts ?? '0'} گرم`,
|
|
|
|
|
|
help: dashboardDateMetrics.gifts,
|
|
|
|
|
|
},
|
|
|
|
|
|
])
|
2026-01-24 17:45:54 +03:30
|
|
|
|
|
2026-06-21 20:27:13 +03:30
|
|
|
|
const customerMetricItems = computed(() => [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: 'کل مشتریان',
|
|
|
|
|
|
value: customerStats.value.total,
|
|
|
|
|
|
help: dashboardCustomerMetrics.total,
|
|
|
|
|
|
bgClass: 'bg-slate-50 dark:bg-slate-800/60',
|
|
|
|
|
|
labelClass: 'text-slate-600 dark:text-slate-400',
|
|
|
|
|
|
valueClass: 'text-slate-900 dark:text-slate-50',
|
2026-01-24 17:45:54 +03:30
|
|
|
|
},
|
2026-06-21 20:27:13 +03:30
|
|
|
|
{
|
|
|
|
|
|
label: 'جدید (۳ ماه)',
|
|
|
|
|
|
value: customerStats.value.newCount,
|
|
|
|
|
|
help: dashboardCustomerMetrics.new,
|
|
|
|
|
|
bgClass: 'bg-slate-50 dark:bg-slate-800/60',
|
|
|
|
|
|
labelClass: 'text-slate-600 dark:text-slate-400',
|
|
|
|
|
|
valueClass: 'text-slate-900 dark:text-slate-50',
|
2026-01-24 17:45:54 +03:30
|
|
|
|
},
|
2026-06-21 20:27:13 +03:30
|
|
|
|
{
|
|
|
|
|
|
label: 'فعال',
|
|
|
|
|
|
value: customerStats.value.active,
|
|
|
|
|
|
help: dashboardCustomerMetrics.active,
|
|
|
|
|
|
bgClass: 'bg-emerald-50 dark:bg-emerald-950/40',
|
|
|
|
|
|
labelClass: 'text-emerald-800 dark:text-emerald-300',
|
|
|
|
|
|
valueClass: 'text-emerald-800 dark:text-emerald-300',
|
2026-01-24 17:45:54 +03:30
|
|
|
|
},
|
2026-06-21 20:27:13 +03:30
|
|
|
|
{
|
|
|
|
|
|
label: 'بدون احراز',
|
|
|
|
|
|
value: customerStats.value.notVerified,
|
|
|
|
|
|
help: dashboardCustomerMetrics.notVerified,
|
|
|
|
|
|
bgClass: 'bg-rose-50 dark:bg-rose-950/40',
|
|
|
|
|
|
labelClass: 'text-rose-800 dark:text-rose-300',
|
|
|
|
|
|
valueClass: 'text-rose-800 dark:text-rose-300',
|
2026-01-24 17:45:54 +03:30
|
|
|
|
},
|
2026-06-21 20:27:13 +03:30
|
|
|
|
])
|
2026-01-24 17:45:54 +03:30
|
|
|
|
|
2026-06-21 20:27:13 +03:30
|
|
|
|
const walletMetricItems = computed(() => [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: 'طلای مشتریان',
|
|
|
|
|
|
value: formatGram(walletSums.value?.gold),
|
|
|
|
|
|
help: dashboardWalletMetrics.gold,
|
|
|
|
|
|
bgClass: 'bg-amber-50 dark:bg-amber-950/35',
|
2026-01-24 17:45:54 +03:30
|
|
|
|
},
|
2026-06-21 20:27:13 +03:30
|
|
|
|
{
|
|
|
|
|
|
label: 'ریال مشتریان',
|
|
|
|
|
|
value: usePrice(walletSums.value?.cash ?? 0, true, ''),
|
|
|
|
|
|
help: dashboardWalletMetrics.cash,
|
|
|
|
|
|
bgClass: 'bg-sky-50 dark:bg-sky-950/35',
|
2026-01-24 17:45:54 +03:30
|
|
|
|
},
|
2026-06-21 20:27:13 +03:30
|
|
|
|
{
|
|
|
|
|
|
label: 'ارزش طلا به ریال',
|
|
|
|
|
|
value: usePrice(walletSums.value?.goldToCash ?? 0, true, ''),
|
|
|
|
|
|
help: dashboardWalletMetrics.goldToCash,
|
|
|
|
|
|
bgClass: 'bg-violet-50 dark:bg-violet-950/35',
|
2026-01-24 17:45:54 +03:30
|
|
|
|
},
|
2026-06-21 20:27:13 +03:30
|
|
|
|
])
|
2026-01-24 17:45:54 +03:30
|
|
|
|
</script>
|
|
|
|
|
|
|
2026-06-21 20:27:13 +03:30
|
|
|
|
<style scoped>
|
2026-06-21 21:55:54 +03:30
|
|
|
|
.dashboard-panel {
|
|
|
|
|
|
@apply rounded-xl border border-slate-200 bg-white p-4 dark:border-slate-600 dark:bg-slate-900;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dashboard-metric-cell {
|
|
|
|
|
|
@apply flex min-h-[4.75rem] flex-col justify-between rounded-lg px-3 py-3;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dashboard-metric-value {
|
|
|
|
|
|
@apply mt-2 text-base font-bold leading-snug break-words;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dashboard-v2 :deep(.dashboard-metric-label) {
|
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
line-height: 1.4;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dashboard-v2 :deep(.dashboard-metric-label > span:first-child) {
|
|
|
|
|
|
overflow: visible;
|
|
|
|
|
|
text-overflow: unset;
|
|
|
|
|
|
white-space: normal;
|
|
|
|
|
|
line-height: 1.4;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dashboard-chart-wrap {
|
|
|
|
|
|
@apply px-1 pb-1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dashboard-v2 :deep(.apexcharts-legend) {
|
|
|
|
|
|
padding-inline: 12px !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dashboard-v2 :deep(.apexcharts-legend-series) {
|
|
|
|
|
|
margin-inline: 8px !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-21 20:27:13 +03:30
|
|
|
|
.dashboard-v2 :deep(.apexcharts-tooltip) {
|
|
|
|
|
|
direction: rtl;
|
2026-01-24 17:45:54 +03:30
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-21 21:55:54 +03:30
|
|
|
|
.dashboard-v2 :deep(.dashboard-section-header) {
|
|
|
|
|
|
overflow: visible;
|
|
|
|
|
|
padding-bottom: 2px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dashboard-v2 :deep(.dashboard-section-title) {
|
|
|
|
|
|
line-height: 1.6;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dashboard-v2 :deep(.dashboard-section-title > span:first-child) {
|
|
|
|
|
|
line-height: 1.6;
|
|
|
|
|
|
overflow: visible;
|
|
|
|
|
|
padding-bottom: 2px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-21 20:27:13 +03:30
|
|
|
|
.dashboard-v2 :deep(.dashboard-label-with-help .ant-tooltip-disabled-compatible-wrapper),
|
|
|
|
|
|
.dashboard-v2 :deep(.dashboard-label-with-help .dashboard-help-trigger) {
|
|
|
|
|
|
display: inline-flex !important;
|
|
|
|
|
|
align-items: center !important;
|
2026-06-21 21:55:54 +03:30
|
|
|
|
line-height: 1 !important;
|
|
|
|
|
|
vertical-align: baseline !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dashboard-product-chart {
|
|
|
|
|
|
@apply min-w-0 px-0.5 md:px-1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dashboard-product-chart :deep(.apexcharts-yaxis-texts-g text) {
|
|
|
|
|
|
text-anchor: start !important;
|
|
|
|
|
|
direction: rtl;
|
|
|
|
|
|
unicode-bidi: plaintext;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dashboard-product-chart :deep(.apexcharts-yaxis) {
|
|
|
|
|
|
transform: translateX(-2px);
|
2026-01-24 17:45:54 +03:30
|
|
|
|
}
|
|
|
|
|
|
</style>
|