diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index f3cf3e1..db3b4e1 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -1007,7 +1007,14 @@ const local: any = { action:'Action', geterr:'Failed to get the billing rule', updatesuc:'Update successful', - updateerr:'Update failed' + updateerr:'Update failed', + currencySettings: 'Currency Settings', + currencySelect: 'Select Currency', + currentCurrency: 'Current Currency', + currencyName: 'Currency Name', + currencyCode: 'Currency Code', + currencySymbol: 'Currency symbol', + paymentMethods:'Pay Methods', }, ratelimit:{ title:'Rate limit management', diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 6dffc13..2004186 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -1007,7 +1007,14 @@ const local:any = { action:'操作', geterr:'获取计费规则失败', updatesuc:'更新成功', - updateerr:'更新失败' + updateerr:'更新失败', + currencySettings: '货币设置', + currencySelect: '选择货币', + currentCurrency: '当前货币', + currencyName: '货币名称', + currencyCode: '货币代码', + currencySymbol: '货币符号', + paymentMethods:'支付方式', }, ratelimit:{ title:'限速管理', diff --git a/src/service/api/auth.ts b/src/service/api/auth.ts index 271ce94..d892d7f 100644 --- a/src/service/api/auth.ts +++ b/src/service/api/auth.ts @@ -490,6 +490,29 @@ export function updateUserProfile(data: { email: string; code: string }) { data }); } +/** 更新支付配置 */ +export function updatePaymentConfig(data: { + currency: string; + currencySymbol: string; + paymentMethods: string[]; +}) { + return request({ + url: '/system/config/pay', + method: 'put', + data + }); +} +/** 获取支付配置 */ +export function getPaymentConfig() { + return request<{ + currency: string; + currencySymbol: string; + paymentMethods: string[]; + }>({ + url: '/system/config/pay', + method: 'get' + }); +} diff --git a/src/typings/auto-imports.d.ts b/src/typings/auto-imports.d.ts index 5dbf030..77dbf2c 100644 --- a/src/typings/auto-imports.d.ts +++ b/src/typings/auto-imports.d.ts @@ -183,6 +183,7 @@ declare global { const getFixedTabs: typeof import('../store/modules/tab/shared')['getFixedTabs'] const getGlobalMenusByAuthRoutes: typeof import('../store/modules/route/shared')['getGlobalMenusByAuthRoutes'] const getLocalizedTimeUnit: typeof import('../utils/units')['getLocalizedTimeUnit'] + const getPaymentConfig: typeof import('../service/api/auth')['getPaymentConfig'] const getPortalConfig: typeof import('../service/api/auth')['getPortalConfig'] const getRouteIcons: typeof import('../store/modules/tab/shared')['getRouteIcons'] const getSelectedMenuKeyPathByKey: typeof import('../store/modules/route/shared')['getSelectedMenuKeyPathByKey'] @@ -313,6 +314,7 @@ declare global { const updateLocaleOfGlobalMenus: typeof import('../store/modules/route/shared')['updateLocaleOfGlobalMenus'] const updatePackage: typeof import('../service/api/auth')['updatePackage'] const updatePasswordByOld: typeof import('../service/api/auth')['updatePasswordByOld'] + const updatePaymentConfig: typeof import('../service/api/auth')['updatePaymentConfig'] const updatePortalConfig: typeof import('../service/api/auth')['updatePortalConfig'] const updateSite: typeof import('../service/api/auth')['updateSite'] const updateTabByI18nKey: typeof import('../store/modules/tab/shared')['updateTabByI18nKey'] diff --git a/src/views/billing/package/index.vue b/src/views/billing/package/index.vue index 5e59cad..e98fa07 100644 --- a/src/views/billing/package/index.vue +++ b/src/views/billing/package/index.vue @@ -76,8 +76,7 @@ :min="0.01" :precision="2" style="width: 100%" - :formatter="value => `¥ ${value}`" - :parser="value => (value || '').replace(/[¥\s,]/g, '')" + :addon-before="currencyStore.symbol" /> @@ -166,8 +165,8 @@ import { computed, shallowRef, ref, onMounted } from 'vue'; import { useElementSize } from '@vueuse/core'; import { fetchPackageList, addPackage, fetchRateLimitList, updatePackage, deletePackage } from '@/service/api/auth'; import { Button as AButton, message, Modal, Form as AForm, Input as AInput, InputNumber as AInputNumber, Select as ASelect, Switch as ASwitch, Tag as ATag } from 'ant-design-vue'; -import { PlusOutlined } from '@ant-design/icons-vue'; import type { Rule } from 'ant-design-vue/es/form'; +import { useCurrencyStore } from '@/views/billing/rule/modules/currency'; import { formatBandwidth, formatStorage, @@ -185,6 +184,7 @@ const timeUnits = useTimeUnits(); const formatTime = useFormatTime(); const wrapperEl = shallowRef(null); const { height: wrapperElHeight } = useElementSize(wrapperEl); +const currencyStore = useCurrencyStore(); const scrollConfig = computed(() => { return { @@ -241,9 +241,9 @@ const { columns, columnChecks, data, loading, getData, mobilePagination } = useT { key: 'price', dataIndex: 'price', - title: t('page.package.price'), + title: t('page.package.price')+currencyStore.symbol, align: 'center', - customRender: ({ text }) => `${Number(text).toFixed(2)}` + customRender: ({ text }) => `${Number(text).toFixed(2)} ${currencyStore.symbol}` }, { key: 'traffic', diff --git a/src/views/billing/rule/index.vue b/src/views/billing/rule/index.vue index 5087ed4..1adaa34 100644 --- a/src/views/billing/rule/index.vue +++ b/src/views/billing/rule/index.vue @@ -1,11 +1,53 @@