From 3cc72b946df3b4caa972eeb93c2a68d6eb57b96c Mon Sep 17 00:00:00 2001 From: zhongzm Date: Sun, 27 Apr 2025 20:17:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A4=9A=E6=94=AF=E4=BB=98=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E8=B4=A7=E5=B8=81=E7=AC=A6=E5=8F=B7=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order-confirm/orderConfirmModal.vue | 49 +++++++++++++++---- src/router/elegant/routes.ts | 2 +- src/service/api/payment.ts | 7 +++ src/typings/auto-imports.d.ts | 1 + src/typings/components.d.ts | 1 + src/utils/paypal.ts | 4 +- src/views/billing/packagehistories/index.vue | 17 ++++++- src/views/billing/rechargehistory/index.vue | 17 ++++++- src/views/home/modules/header-banner.vue | 25 ++++++++-- src/views/recharge/balancerecharge/index.vue | 30 +++++++++--- src/views/recharge/package/index.vue | 18 ++++++- 11 files changed, 142 insertions(+), 29 deletions(-) diff --git a/src/components/order-confirm/orderConfirmModal.vue b/src/components/order-confirm/orderConfirmModal.vue index 20916e5..312d756 100644 --- a/src/components/order-confirm/orderConfirmModal.vue +++ b/src/components/order-confirm/orderConfirmModal.vue @@ -1,10 +1,10 @@ diff --git a/src/views/home/modules/header-banner.vue b/src/views/home/modules/header-banner.vue index dfa639f..4c1e7b3 100644 --- a/src/views/home/modules/header-banner.vue +++ b/src/views/home/modules/header-banner.vue @@ -6,9 +6,26 @@ import type { ECOption } from '@/hooks/common/echarts'; import { useI18n } from 'vue-i18n'; import { useAuthStore } from '@/store/modules/auth'; import { clientAuth } from '@/service/ue/client'; +import { getPaymentConfig } from '@/service/api/payment'; const { t } = useI18n(); const authStore = useAuthStore(); + +// 添加货币符号的响应式引用 +const currencySymbol = ref('¥'); + +// 获取货币符号 +const fetchCurrencySymbol = async () => { + try { + const response = await getPaymentConfig(); + if (response && response.data) { + currencySymbol.value = response.data.currencySymbol || '¥'; + } + } catch (error) { + console.error('Failed to fetch currency symbol:', error); + } +}; + defineOptions({ name: 'HeaderBanner' }); @@ -307,7 +324,7 @@ async function mockDataUpdate() { value: numBalance, max: Math.max(numBalance, 100), displayValue:formatBalance(response.balance), - unit: t('page.headerbanner.money'), + unit: currencySymbol.value, subTitle: t('page.headerbanner.deviceCount') + `: ${ response.packageName ? ( !response.clientNumEnable @@ -422,6 +439,8 @@ let timer: ReturnType | null = null; // 初始化 async function init() { // 立即执行一次数据更新 + // 先获取货币符号 + await fetchCurrencySymbol(); await mockDataUpdate(); // 设置定期执行的定时器 timer = setInterval(mockDataUpdate, 30000); @@ -500,7 +519,7 @@ const getDeviceCount = (subTitle?: string, clientNumEnable?: boolean): string =>
{{ t('page.headerbanner.price') }} - {{ packageInfo.price === '-' ? '-' : '¥' + packageInfo.price }} + {{ packageInfo.price === '-' ? '-' : currencySymbol + packageInfo.price }}
{{ t('page.headerbanner.monthflowr') }} @@ -531,7 +550,7 @@ const getDeviceCount = (subTitle?: string, clientNumEnable?: boolean): string =>
{{ t('page.headerbanner.Remainingcredit') }} - {{ baseData[0].displayValue === '-' ? '-' : '¥' + baseData[0].displayValue }} + {{ baseData[0].displayValue === '-' ? '-' : currencySymbol + baseData[0].displayValue }}
{{ t('page.headerbanner.client') }} diff --git a/src/views/recharge/balancerecharge/index.vue b/src/views/recharge/balancerecharge/index.vue index bdd04a7..fec0266 100644 --- a/src/views/recharge/balancerecharge/index.vue +++ b/src/views/recharge/balancerecharge/index.vue @@ -8,6 +8,7 @@ import { useRouterPush } from '@/hooks/common/router'; import type { Ref } from 'vue'; import OrderConfirmModal from '@/components/order-confirm/orderConfirmModal.vue'; import { useAppStore } from '@/store/modules/app'; +import { getPaymentConfig } from '@/service/api/payment'; defineOptions({ name: 'BalanceRecharge' @@ -16,7 +17,18 @@ defineOptions({ const { t } = useI18n(); const { routerPushByKey } = useRouterPush(); const appStore = useAppStore(); +const currencySymbol = ref('¥'); +const fetchCurrencySymbol = async () => { + try { + const response = await getPaymentConfig(); + if (response && response.data) { + currencySymbol.value = response.data.currencySymbol || '¥'; + } + } catch (error) { + console.error('Failed to fetch currency symbol:', error); + } +}; interface RechargeOption { amount: number; displayAmount: string; @@ -27,13 +39,13 @@ const customAmount = ref(undefined); const selectedAmount = ref(null); const isCustomMode = ref(false); -const rechargeOptions: Ref = ref([ - { amount: 10, displayAmount: `${t('page.carddata.money')}10`, price: 10.00 }, - { amount: 20, displayAmount: `${t('page.carddata.money')}20`, price: 20.00 }, - { amount: 30, displayAmount: `${t('page.carddata.money')}30`, price: 30.00 }, - { amount: 50, displayAmount: `${t('page.carddata.money')}50`, price: 50.00 }, - { amount: 100, displayAmount: `${t('page.carddata.money')}100`, price: 100.00 }, - { amount: 200, displayAmount: `${t('page.carddata.money')}200`, price: 200.00 }, +const rechargeOptions = computed(() => [ + { amount: 10, displayAmount: `${currencySymbol.value}10`, price: 10.00 }, + { amount: 20, displayAmount: `${currencySymbol.value}20`, price: 20.00 }, + { amount: 30, displayAmount: `${currencySymbol.value}30`, price: 30.00 }, + { amount: 50, displayAmount: `${currencySymbol.value}50`, price: 50.00 }, + { amount: 100, displayAmount: `${currencySymbol.value}100`, price: 100.00 }, + { amount: 200, displayAmount: `${currencySymbol.value}200`, price: 200.00 }, ]); const paymentAmount = computed(() => { @@ -76,10 +88,12 @@ const handleBlur = () => { }; onMounted(() => { + fetchCurrencySymbol(); document.addEventListener('click', handleClickOutside); }); onUnmounted(() => { + fetchCurrencySymbol(); document.removeEventListener('click', handleClickOutside); }); @@ -202,7 +216,7 @@ const handlePaymentConfirm = async (paymentMethod: 'alipay' | 'wxpay') => { :disabled="!paymentAmount || paymentAmount <= 0" @click="handleRecharge" > - ¥{{ paymentAmount.toFixed(2) }} {{ t('page.carddata.pay') }} + {{ currencySymbol }}{{ paymentAmount.toFixed(2) }} {{ t('page.carddata.pay') }}
diff --git a/src/views/recharge/package/index.vue b/src/views/recharge/package/index.vue index e10fbc0..753ba02 100644 --- a/src/views/recharge/package/index.vue +++ b/src/views/recharge/package/index.vue @@ -8,10 +8,23 @@ import { aliPayPcPay,aliPayWapPay, wxPayScanCode, payBalance } from '@/service/a import { useRouterPush } from '@/hooks/common/router'; import { useAppStore } from '@/store/modules/app'; import { useAuthStore} from '@/store/modules/auth'; +import { getPaymentConfig } from '@/service/api/payment'; defineOptions({ name: 'PackageSubscription' }); +const currencySymbol = ref('¥'); + +const fetchCurrencySymbol = async () => { + try { + const response = await getPaymentConfig(); + if (response && response.data) { + currencySymbol.value = response.data.currencySymbol || '¥'; + } + } catch (error) { + console.error('Failed to fetch currency symbol:', error); + } +}; const { t } = useI18n(); const authStore = useAuthStore(); interface RateLimit { @@ -343,6 +356,7 @@ const isPackageActive = computed(() => { }); onMounted(async () => { + await fetchCurrencySymbol(); fetchDashboardData(); await fetchPackages(); await fetchUserBalance(); @@ -354,7 +368,7 @@ onMounted(async () => {
- ¥ + {{ currencySymbol }} {{ selectedPackage.price }}
{{ selectedPackage.packageName }}
@@ -380,7 +394,7 @@ onMounted(async () => { {{ t('page.setmeal.highlyrecommended') }}
{{ option.packageName }}
-
¥{{ option.price }}
+
{{ currencySymbol }}{{ option.price }}
{{ option.trafficEnable ? option.trafficDisplay : t('page.setmeal.unlimit') }}
{{ option.clientNumEnable ? `${option.clientNum} ${t('page.setmeal.device')}` : t('page.setmeal.unlimit') }}