price calulator changed 5

This commit is contained in:
2026-07-02 20:58:29 +03:30
parent 148acafdc0
commit 7381baca0d
5 changed files with 70 additions and 11 deletions
+3 -1
View File
@@ -338,6 +338,7 @@ import {
calcRialFromLockedGram,
calcSellGoldDebit,
calcSellTargetCash,
calcTradeTargetCash,
feeDeductFromGold,
loadServiceFeeFromSettings,
serviceFeePercentage,
@@ -803,7 +804,8 @@ async function ok() {
direction: isBuy.value ? 1 : 2,
price: Math.round(unitPrice.value),
amount: orderGoldAmount.value,
target_cash: calcSellTargetCash(
target_cash: calcTradeTargetCash(form.value.goldCash, inputLock.value)
?? calcSellTargetCash(
form.value.goldCash,
form.value.goldValue,
unitPrice.value,
@@ -32,8 +32,8 @@
{{ usePriceWithoutType(props.item.cash ?? 0) }} ریال
</div>
<div class="dtxn-row__status">
<ATag color="blue" class="!py-1 !px-4 !ml-0 !text-xs">
{{ props.item.order?.sts_str ?? props.item.withdraw?.sts_str }}
<ATag v-if="statusLabel" color="blue" class="!py-1 !px-4 !ml-0 !text-xs">
{{ statusLabel }}
</ATag>
</div>
</button>
@@ -83,8 +83,8 @@
<div class="flex w-full justify-between mt-2">
<div class="text-gray-500">وضعیت :</div>
<div class="text-gray-500 flex gap-1 text-xs items-center">
<ATag class="!py-1 !px-6 !ml-0" color="blue">
{{ props.item.order?.sts_str ?? props.item.withdraw?.sts_str }}
<ATag v-if="statusLabel" class="!py-1 !px-6 !ml-0" color="blue">
{{ statusLabel }}
</ATag>
</div>
</div>
@@ -118,6 +118,7 @@ import {
formatGoldAmount,
getTransactionGoldAmount,
getTransactionTradePrice,
resolveTransactionStatusLabel,
usePriceWithoutType,
} from '@/utils/usePrice'
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
@@ -140,6 +141,7 @@ const props = withDefaults(
const goldAmount = computed(() => getTransactionGoldAmount(props.item))
const tradePrice = computed(() => getTransactionTradePrice(props.item))
const statusLabel = computed(() => resolveTransactionStatusLabel(props.item))
const isUp = computed(
() =>
@@ -93,8 +93,8 @@
<div :class="variant === 'desktop' ? 'dtxn-detail__row' : 'flex justify-between mb-3'">
<div :class="variant === 'desktop' ? 'dtxn-detail__label' : 'text-primary'">وضعیت:</div>
<div class="flex text-xs items-center">
<ATag color="blue" class="!py-1 !px-6 !ml-0">
{{ item.order?.sts_str ?? item.withdraw?.sts_str }}
<ATag v-if="statusLabel" color="blue" class="!py-1 !px-6 !ml-0">
{{ statusLabel }}
</ATag>
</div>
</div>
@@ -115,7 +115,7 @@
<script lang="ts" setup>
import { computed } from 'vue'
import { formatGoldAmount, usePriceWithoutType } from '@/utils/usePrice'
import { formatGoldAmount, resolveTransactionStatusLabel, usePriceWithoutType } from '@/utils/usePrice'
import type { Transaction } from '@/models/transaction'
import {
getCashWalletLabel,
@@ -139,6 +139,7 @@ const props = withDefaults(
)
const tradeProduct = computed(() => resolveTransactionTradeProduct(props.item))
const statusLabel = computed(() => resolveTransactionStatusLabel(props.item))
const tradeProductLabel = computed(
() => (tradeProduct.value?.title ?? '').trim() || getMeltedGoldTradeLabel(),
)