change copper&silver prices

This commit is contained in:
2026-02-17 17:01:45 +03:30
parent 22a5b26607
commit 37ef179288
2 changed files with 36 additions and 6 deletions
+1
View File
@@ -26,6 +26,7 @@ export interface Product {
wallet: Wallet wallet: Wallet
auto_close_at: string auto_close_at: string
auto_open_at: string auto_open_at: string
price_profit: number
} }
export interface PInventory { export interface PInventory {
+35 -6
View File
@@ -27,7 +27,7 @@
<div class="text-gray-700 font-bold">{{ !isBuy ? 'قیمت فروش' : 'قیمت خرید' }}</div> <div class="text-gray-700 font-bold">{{ !isBuy ? 'قیمت فروش' : 'قیمت خرید' }}</div>
<div v-if="price" class="flex gap-1 mt-3 text-xs items-center"> <div v-if="price" class="flex gap-1 mt-3 text-xs items-center">
<div :class="!isBuy? 'text-red-700' : 'text-green-700'" class="font-bold text-2xl color-transition"> <div :class="!isBuy? 'text-red-700' : 'text-green-700'" class="font-bold text-2xl color-transition">
{{ usePriceWithoutType(isBuy ? ((props?.ProductItem?.price ?? 0) + (props?.ProductItem?.cash_fee_buy ?? 0)) : ((props?.ProductItem?.price ?? 0) - (props?.ProductItem?.cash_fee_sell ?? 0))) }} {{ usePriceWithoutType(basePriceValue) }}
</div> </div>
ریال ریال
</div> </div>
@@ -164,7 +164,7 @@
<div class="flex justify-between mt-3"> <div class="flex justify-between mt-3">
<div>مظنه:</div> <div>مظنه:</div>
<div class="flex items-center"> <div class="flex items-center">
<div class="font-bold">{{ usePriceWithoutType(isBuy ? price.buy ?? 0 : price.sell ?? 0) }}</div> <div class="font-bold">{{ usePriceWithoutType(((props?.ProductItem?.price_profit) + (props?.ProductItem?.price))) }}</div>
<div class="text-xs mr-1">ریال</div> <div class="text-xs mr-1">ریال</div>
</div> </div>
</div> </div>
@@ -277,8 +277,37 @@ const sellPagination = ref<TableEngineInput>({
}], limit: 6, page: 0 }], limit: 6, page: 0
}) })
const finalPrice = computed(() => (form.value?.goldValue * (isBuy.value ? price.value?.buy ?? 0 : price.value?.sell ?? 0))) const basePriceValue = computed(() => {
// const payablePrice = computed(() => finalPrice.value + finalPrice.value * 0.007) const product = props?.ProductItem
if (!product) return undefined
const { price_profit = 0, price = 0, cash_fee_buy = 0, cash_fee_sell = 0 } = product
const base = price_profit + price
const rawPrice = isBuy.value
? base + cash_fee_buy
: base - cash_fee_sell
return rawPrice
})
const finalPrice = computed(() => {
const gold = form.value?.goldValue ?? 0
const product = props?.ProductItem
if (!product) return 0
const { price_profit = 0, price = 0, cash_fee_buy = 0, cash_fee_sell = 0 } = product
const base = price_profit + price
if (isBuy.value) {
return gold * (base + cash_fee_buy)
} else {
return gold * (base - cash_fee_sell)
}
})
const payablePrice = computed(() => finalPrice.value) const payablePrice = computed(() => finalPrice.value)
const equivalentPrice = computed(() => usePriceWithoutType(((isBuy ? price.value?.buy ?? 0 : price.value?.sell ?? 0) * (parseFloat(((form.value?.goldValue ?? 0) * 0.01).toFixed(4))) ).toFixed(0)) ) const equivalentPrice = computed(() => usePriceWithoutType(((isBuy ? price.value?.buy ?? 0 : price.value?.sell ?? 0) * (parseFloat(((form.value?.goldValue ?? 0) * 0.01).toFixed(4))) ).toFixed(0)) )
@@ -506,7 +535,7 @@ function calculateGold(val: number) {
if (price.value) { if (price.value) {
if (isBuy.value) { if (isBuy.value) {
if (val) { if (val) {
form.value.goldValue = toFixedDownThreeChar(parseFloat(val / price?.value?.buy)) form.value.goldValue = toFixedDownThreeChar(parseFloat(val / (((props?.ProductItem?.price_profit) + (props?.ProductItem?.price)) + (props?.ProductItem?.cash_fee_buy))))
if (parseInt(finalPrice.value) > 0) priceErrorVisible.value = true if (parseInt(finalPrice.value) > 0) priceErrorVisible.value = true
if (parseInt(finalPrice.value) === 0) priceErrorVisible.value = false if (parseInt(finalPrice.value) === 0) priceErrorVisible.value = false
} }
@@ -521,7 +550,7 @@ function calculateGold(val: number) {
} }
else { else {
if (val) { if (val) {
form.value.goldValue = toFixedDownThreeChar(parseFloat((val / price?.value?.sell))) form.value.goldValue = toFixedDownThreeChar(parseFloat(val / (((props?.ProductItem?.price_profit) + (props?.ProductItem?.price)) + (props?.ProductItem?.cash_fee_sell))))
if (parseInt(finalPrice.value) > 0) priceErrorVisible.value = true if (parseInt(finalPrice.value) > 0) priceErrorVisible.value = true
if (parseInt(finalPrice.value) === 0) priceErrorVisible.value = false if (parseInt(finalPrice.value) === 0) priceErrorVisible.value = false
} else if (val.toString() === '') { } else if (val.toString() === '') {