115 lines
3.9 KiB
Vue
115 lines
3.9 KiB
Vue
<template>
|
||
<div class="dfund">
|
||
<div class="dfund__container">
|
||
<header class="dfund-topbar">
|
||
<button type="button" class="dfund-topbar__back" @click="goBack()">
|
||
<BasicIcon icon="vuesax-linear:arrow-right-1" size="18" />
|
||
بازگشت
|
||
</button>
|
||
<div class="dfund-topbar__meta">
|
||
<p class="dfund-topbar__eyebrow">دارایی</p>
|
||
<h1 class="dfund-topbar__title">داراییها</h1>
|
||
<p class="dfund-topbar__subtitle">نمای کلی موجودی محصولات و کیف پول</p>
|
||
</div>
|
||
</header>
|
||
|
||
<section class="dfund-summary dfund-summary--ghatreh">
|
||
<img :src="fundHeaderBackground" alt="" class="dfund-summary__bg" />
|
||
<div class="dfund-summary__content">
|
||
<h2 class="dfund-summary__title">موجودی داراییها</h2>
|
||
|
||
<div v-if="meta?.has_count_based_products" class="dfund-summary__row">
|
||
<span>محصولات</span>
|
||
<strong>{{ countBasedInventory }} عدد</strong>
|
||
</div>
|
||
|
||
<template v-if="meta?.single_metal && primaryMetalTotal">
|
||
<div class="dfund-summary__row">
|
||
<span>{{ primaryMetalTotal.label }}</span>
|
||
<strong>{{ formatMetalTotal(primaryMetalTotal) }}</strong>
|
||
</div>
|
||
</template>
|
||
<template v-else>
|
||
<div
|
||
v-for="metal in metalTotals"
|
||
:key="`metal-${metal.metal_id}`"
|
||
class="dfund-summary__row"
|
||
>
|
||
<span>{{ metal.label }}</span>
|
||
<strong>{{ formatMetalTotal(metal) }}</strong>
|
||
</div>
|
||
</template>
|
||
|
||
<div v-if="meta?.has_count_based_products" class="dfund-summary__row">
|
||
<span>مجموع موجودی</span>
|
||
<strong>{{ countBasedInventory }} عدد</strong>
|
||
</div>
|
||
<div class="dfund-summary__row">
|
||
<span>دارایی ریالی</span>
|
||
<strong class="number-ltr">{{ usePriceWithoutType(cashWallet) }} ریال</strong>
|
||
</div>
|
||
<div class="dfund-summary__row dfund-summary__row--highlight">
|
||
<span>معادل ریالی مجموع</span>
|
||
<strong class="number-ltr">{{ usePriceWithoutType(totalRialValue) }} ریال</strong>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="dfund-inventory">
|
||
<div class="dfund-inventory__header">
|
||
<h3 class="dfund-inventory__title">لیست داراییها</h3>
|
||
<span class="dfund-inventory__count">{{ inventoryCards.length }} مورد</span>
|
||
</div>
|
||
|
||
<div
|
||
v-if="inventoryCards.length === 0 && !loading"
|
||
class="dfund-inventory__empty"
|
||
>
|
||
<img :src="fundEmptyImage" alt="" class="dfund-inventory__empty-img" />
|
||
<p>{{ fundEmptyText }}</p>
|
||
</div>
|
||
|
||
<a-spin :spinning="loading">
|
||
<div v-if="inventoryCards.length" class="dfund-inventory__grid">
|
||
<button
|
||
v-for="item in inventoryCards"
|
||
:key="item.product_id"
|
||
type="button"
|
||
class="dfund-inventory__card"
|
||
@click="openFundInfo(item.product_id)"
|
||
>
|
||
<Item :item="item" variant="desktop" />
|
||
</button>
|
||
</div>
|
||
</a-spin>
|
||
</section>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script lang="ts" setup>
|
||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||
import { loading } from '@/utils'
|
||
import { usePriceWithoutType } from '@/utils/usePrice'
|
||
import Item from '../components/Item.vue'
|
||
import { useFundPageContext } from '../composables/useFundPage'
|
||
|
||
const {
|
||
meta,
|
||
inventoryCards,
|
||
metalTotals,
|
||
primaryMetalTotal,
|
||
cashWallet,
|
||
totalRialValue,
|
||
countBasedInventory,
|
||
fundHeaderBackground,
|
||
fundEmptyImage,
|
||
fundEmptyText,
|
||
formatMetalTotal,
|
||
openFundInfo,
|
||
goBack,
|
||
} = useFundPageContext()
|
||
</script>
|
||
|
||
<style lang="less" src="./styles/desktop-fund.less"></style>
|