fix some bugs
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div class="h-full min-h-0">
|
||||
<BasicShowContext title="لیست کیف پول">
|
||||
<div class="flex h-full min-h-0 flex-col gap-3">
|
||||
<div class="hidden shrink-0 md:grid md:grid-cols-1 md:gap-3 lg:grid-cols-2">
|
||||
<div class="hidden shrink-0 md:grid md:grid-cols-1 md:gap-3 lg:grid-cols-2 xl:grid-cols-3">
|
||||
<div
|
||||
class="rounded-lg p-2.5 text-sm"
|
||||
:class="walletSumTone(sums?.cash)"
|
||||
@@ -23,20 +23,22 @@
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-for="metal in metalBalanceCards"
|
||||
:key="metal.metal_id"
|
||||
class="rounded-lg p-2.5 text-sm"
|
||||
:class="walletSumTone(sums?.gold)"
|
||||
:class="walletSumTone(metal.gold)"
|
||||
>
|
||||
<div class="mb-2 font-medium">مجموع موجودی کیف طلا</div>
|
||||
<div class="mb-2 font-medium">{{ totalMetalWalletTitle(metal.metal_id, metal.label) }}</div>
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="stat-inner rounded-lg px-2 py-1.5 text-center">
|
||||
<div class="text-xs text-gray-500">گرم</div>
|
||||
<div class="text-xs text-gray-500">{{ metal.display_unit ?? metalDisplayUnit(metal.metal_id) }}</div>
|
||||
<div class="mt-1 font-bold">
|
||||
{{ usePrice(sums?.gold ?? 0, true, 'گرم') }}
|
||||
{{ formatMetalDisplayValue(metal.gold ?? 0, metal.metal_id) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat-inner rounded-lg px-2 py-1.5 text-center">
|
||||
<div class="text-xs text-gray-500">ریال</div>
|
||||
<div class="mt-1 font-bold break-all">{{ usePrice(sums?.goldToCash ?? 0) }}</div>
|
||||
<div class="mt-1 font-bold break-all">{{ usePrice(metal.goldToCash ?? 0) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -77,13 +79,16 @@ import type { TableInput } from '@core/type/baseTable'
|
||||
import useBaseTable from '@core/components/BaseTableOld/hooks/useBaseTable'
|
||||
import Icon from '@core/components/BaseIcon/src/Icon.vue'
|
||||
import { changeCustomerActivation } from '@/api/customer'
|
||||
import { cols } from '../hooks/walletColumns'
|
||||
import { buildWalletColumns } from '../hooks/walletColumns'
|
||||
import { usePrefix } from '@core/composable/usePrefix'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { getWalletTable } from '@/api/wallet'
|
||||
import { usePrice } from '../../../../core/utils/usePrice'
|
||||
import WalletMobileCardList from './WalletMobileCardList.vue'
|
||||
import { isMobile } from '@core/utils/is'
|
||||
import { totalMetalWalletTitle } from '@/utils/adminMetalLabels'
|
||||
import type { WalletTableSums } from '@/model/wallet'
|
||||
import { formatMetalDisplayValue, metalDisplayUnit } from '@/utils/metalWeight'
|
||||
|
||||
const [submit, reload] = useBaseTable()
|
||||
const mobileListRef = ref<null | { fetch: () => Promise<void> }>(null)
|
||||
@@ -92,13 +97,38 @@ const emits = defineEmits(['delete', 'edit', 'add', 'info', 'sums'])
|
||||
const { prefixCls } = usePrefix('pophoverstatus')
|
||||
|
||||
const table = ref(null)
|
||||
const sums = ref<any>()
|
||||
const sums = ref<WalletTableSums>()
|
||||
|
||||
const metalBalanceCards = computed(() => {
|
||||
if (sums.value?.metalBalances?.length) {
|
||||
return sums.value.metalBalances
|
||||
}
|
||||
|
||||
if (sums.value?.gold != null || sums.value?.goldToCash != null) {
|
||||
return [
|
||||
{
|
||||
metal_id: 1,
|
||||
label: 'طلا',
|
||||
gold: sums.value.gold ?? 0,
|
||||
goldToCash: sums.value.goldToCash ?? 0
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
return []
|
||||
})
|
||||
|
||||
const tblProps = ref<any>({
|
||||
columns: cols,
|
||||
columns: buildWalletColumns(),
|
||||
api: async (params: TableInput) => {
|
||||
const data = await getWalletTable(params)
|
||||
sums.value = data?.sums
|
||||
const metals =
|
||||
data?.sums?.metalBalances?.map((metal) => ({
|
||||
metal_id: metal.metal_id,
|
||||
label: metal.label
|
||||
})) ?? []
|
||||
tblProps.value.columns = buildWalletColumns(metals)
|
||||
emits('sums', data?.sums)
|
||||
return data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user