handle huge things!

This commit is contained in:
2026-06-03 22:04:45 +03:30
parent 198f0a164b
commit f82a0c3873
29 changed files with 778 additions and 445 deletions
+20 -26
View File
@@ -232,7 +232,7 @@ import type { Transaction } from '@/models/transaction'
import type { TableEngineInput, TableOutput } from '@/models/table'
import { useInfiniteScroll } from '@vueuse/core'
import { getTransactionTable } from '@/api/transaction'
import { getLastPrices, getUpPrice, lastPrice, setIntervalGetAllPrice, stopPriceInterval } from '@/utils/price'
import { getLastPrices, getTradeBuyPrice, getTradeSellPrice, lastPrice, setIntervalGetAllPrice, stopPriceInterval } from '@/utils/price'
import type { Product } from '@/models/products'
import { useFundUserStore } from '@/store/fundStore'
import {useConfigStore} from "@/store/configStore";
@@ -327,7 +327,8 @@ const disableTransaction = computed(() =>
form.value?.goldCash === undefined ||
(isBuy.value ? (form.value?.goldCash ?? 0) < 500000 : (form.value?.goldValue ?? 0) < 0.001) ||
(!isBuy.value && form.value.goldValue > walletStore?.walletInfo?.gold) ||
price.value?.buy === undefined)
!lastPrice.value ||
(isBuy.value ? getTradeBuyPrice(lastPrice.value) <= 0 : getTradeSellPrice(lastPrice.value) <= 0))
function refreshTable() {
sellItems.value = []
@@ -515,7 +516,7 @@ const limitedPrice = computed(() => {
}
}*/
function syncFormWithLatestPrice() {
if (!price.value) return
if (!lastPrice.value) return
const goldValue = form.value.goldValue
if (goldValue !== undefined && goldValue !== null && goldValue !== '' && !isNaN(Number(goldValue))) {
@@ -538,26 +539,20 @@ watch(
function calculateCash(val: number) {
priceErrorVisible.value = false
if (price.value) {
form.value.goldVazn = parseFloat((val * (( props?.ProductItem?.price) + (props?.ProductItem?.cash_fee_buy)))/lastPrice.value?.buy).toFixed(1)
if (isBuy.value) {
if (val) {
form.value.goldCash = parseFloat(val * (( props?.ProductItem?.price) + (props?.ProductItem?.cash_fee_buy))).toFixed(0)
}
else {
form.value.goldCash = 0
form.value.goldVazn = 0
}
}
else {
if (val)
form.value.goldCash = parseFloat((val * props?.ProductItem?.price) - (props?.ProductItem?.cash_fee_sell)).toFixed(0)
else{
form.value.goldCash = 0
form.value.goldVazn = 0
}
}
console.log(form.value.goldVazn)
if (!lastPrice.value) return
const tradeBuy = getTradeBuyPrice(lastPrice.value)
form.value.goldVazn = parseFloat((val * ((props?.ProductItem?.price) + (props?.ProductItem?.cash_fee_buy))) / tradeBuy).toFixed(1)
if (isBuy.value) {
form.value.goldCash = val
? parseFloat(String(val * ((props?.ProductItem?.price) + (props?.ProductItem?.cash_fee_buy))))
: 0
if (!val) form.value.goldVazn = 0
} else {
form.value.goldCash = val
? parseFloat(String((val * props?.ProductItem?.price) - (props?.ProductItem?.cash_fee_sell)))
: 0
if (!val) form.value.goldVazn = 0
}
}
@@ -629,15 +624,14 @@ const price = computed((): Price => <Price>lastPrice.value ?? 0)
const goldPriceValue = computed(() => {
if (!lastPrice.value?.price) return 0
return isBuy.value
? (lastPrice.value.buy ?? 0)
: (lastPrice.value.sell ?? 0)
? getTradeBuyPrice(lastPrice.value)
: getTradeSellPrice(lastPrice.value)
})
async function initPrice() {
try {
// chartLoading.value = true
await getLastPrices()
await getUpPrice()
await setIntervalGetAllPrice()
loading.value = true
} catch (e) {