change copper&silver prices
This commit is contained in:
@@ -26,6 +26,7 @@ export interface Product {
|
||||
wallet: Wallet
|
||||
auto_close_at: string
|
||||
auto_open_at: string
|
||||
price_profit: number
|
||||
}
|
||||
|
||||
export interface PInventory {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="text-gray-700 font-bold">{{ !isBuy ? 'قیمت فروش' : 'قیمت خرید' }}</div>
|
||||
<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">
|
||||
{{ 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>
|
||||
@@ -164,7 +164,7 @@
|
||||
<div class="flex justify-between mt-3">
|
||||
<div>مظنه:</div>
|
||||
<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>
|
||||
</div>
|
||||
@@ -277,8 +277,37 @@ const sellPagination = ref<TableEngineInput>({
|
||||
}], limit: 6, page: 0
|
||||
})
|
||||
|
||||
const finalPrice = computed(() => (form.value?.goldValue * (isBuy.value ? price.value?.buy ?? 0 : price.value?.sell ?? 0)))
|
||||
// const payablePrice = computed(() => finalPrice.value + finalPrice.value * 0.007)
|
||||
const basePriceValue = computed(() => {
|
||||
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 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 (isBuy.value) {
|
||||
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 = false
|
||||
}
|
||||
@@ -521,7 +550,7 @@ function calculateGold(val: number) {
|
||||
}
|
||||
else {
|
||||
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 = false
|
||||
} else if (val.toString() === '') {
|
||||
|
||||
Reference in New Issue
Block a user