From f5ea5838364d7ba31020acaed6c1d9007ac60ad4 Mon Sep 17 00:00:00 2001 From: safavimohadeseh78 Date: Thu, 14 May 2026 16:28:08 +0330 Subject: [PATCH] dynamic fee --- src/views/base/gold/index.vue | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/views/base/gold/index.vue b/src/views/base/gold/index.vue index db8ab27..6dbfefb 100644 --- a/src/views/base/gold/index.vue +++ b/src/views/base/gold/index.vue @@ -125,13 +125,10 @@
- -
کارمزد:
-
{{ parseFloat(((form.goldValue ?? 0) * 0.01).toFixed(4)) }}
- +
{{ parseFloat(((form.goldValue ?? 0) * (Number(feeAmount))).toFixed(4)) }}
گرم
@@ -170,7 +167,7 @@
کارمزد:
-
{{ parseFloat(((form.goldValue ?? 0) * 0.01).toFixed(4)) }}
+
{{ parseFloat(((form.goldValue ?? 0) * (Number(feeAmount))).toFixed(4)) }}
گرم
@@ -234,6 +231,7 @@ import { getLastPrices, getUpPrice, lastPrice, setIntervalGetAllPrice, stopPrice import type { Product } from '@/models/products' import { useFundUserStore } from '@/store/fundStore' import {useConfigStore} from "@/store/configStore"; +import { getSettings } from '@/api/configuration' // import Bg_main from "@/components/bg_main.vue"; const infoVisible = ref(false) @@ -247,6 +245,7 @@ const sellItems = ref([]) const priceErrorVisible = ref(false) const buyTableOutput = ref | null>(null) const sellTableOutput = ref | null>(null) +const feeAmount = ref(0.01) const el = ref() interface Prop { @@ -344,6 +343,16 @@ async function initSellTable() { } } +async function getFeePercentage() { + const settings = await getSettings() + if (settings && Array.isArray(settings)) { + const feeSetting = settings.find(s => s?.key === 'fee_service_charge_percentage' && s?.is_active === true) + if(feeSetting && feeSetting.value !== undefined && feeSetting.value !== null) { + feeAmount.value = feeSetting.value + } + } +} + // if (!userStore.isSingle) { /*useInfiniteScroll( el, @@ -390,6 +399,7 @@ onMounted(async () => { break } await initPrice() + await getFeePercentage() /* await initSellTable() await initBuyTable()*/ })