From 71afa388e474db7384037ceb8dee038de555316b Mon Sep 17 00:00:00 2001 From: hzj <1304805162@qq.com> Date: Wed, 15 Apr 2026 19:17:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8F=90=E7=8E=B0=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2):=20=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=8F=90=E7=8E=B0=E6=9C=80=E4=BD=8E=E9=87=91=E9=A2=9D=E5=92=8C?= =?UTF-8?q?=E6=89=8B=E7=BB=AD=E8=B4=B9=E7=9A=84=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E6=8F=90=E7=8E=B0=E7=9A=84=E6=8F=90=E7=A4=BA=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E8=BF=9B=E8=A1=8C=E8=B0=83=E6=95=B4=EF=BC=8C=E5=AF=B9?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E7=9A=84=E9=87=91=E9=A2=9D=E4=B8=8E=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=9A=84=E6=9C=80=E4=BD=8E=E9=87=91=E9=A2=9D=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=AF=94=E8=BE=83=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/wallet.js | 24 +++++++++ src/locales/ar.json | 6 +-- src/locales/bn.json | 6 +-- src/locales/en.json | 6 +-- src/locales/tr.json | 6 +-- src/locales/zh.json | 6 +-- src/views/Wallet/CashOut/CashOut.vue | 60 ++++++++++++++++++++++- src/views/Wallet/CashOut/CashWithdraw.vue | 59 ++++++++++++++++++++-- src/views/Wallet/availableIncome.vue | 59 +++++++++++++++++++++- 9 files changed, 205 insertions(+), 27 deletions(-) diff --git a/src/api/wallet.js b/src/api/wallet.js index f3c753f..a63e5e7 100644 --- a/src/api/wallet.js +++ b/src/api/wallet.js @@ -387,6 +387,30 @@ export const apiGetWithdrawEnabled = async () => { } } +// 获取提现美金手续费 +export const apiGetUsdWithdrawServiceCharge = async () => { + try { + const response = await get(`/wallet/bank/service-charge`) + return response + } catch (error) { + console.error('Failed to fetch withdraw service charge:', error) + console.error('error:' + error.response.errorMsg) + throw error + } +} + +// 获取提现美金门槛 +export const apiGetUsdWithdrawalThreshold = async () => { + try { + const response = await get(`/wallet/bank/withdrawal-threshold`) + return response + } catch (error) { + console.error('Failed to fetch withdraw threshold:', error) + console.error('error:' + error.response.errorMsg) + throw error + } +} + /** * 获取当前余额 * @returns {Promise} 返回当前的余额信息 diff --git a/src/locales/ar.json b/src/locales/ar.json index 31acc09..4daa88e 100644 --- a/src/locales/ar.json +++ b/src/locales/ar.json @@ -273,8 +273,6 @@ "please_select_bank_card": "يرجى اختيار بطاقة مصرفية", "change_withdrawal_method": "تغيير طريقة السحب", "enter_cash_out_amount": "يرجى إدخال مبلغ السحب", - "cash_out_minimum": "*يجب أن يكون مبلغ السحب أكبر من أو يساوي 50 دولارًا", - "new_year_cash_out_minimum": "*يجب أن يكون مبلغ السحب أكبر من أو يساوي 10 دولارًا", "cash_withdraw": "سحب نقدي", "bank_card": "بطاقة مصرفية", @@ -300,8 +298,8 @@ "confirm_modify_kyc": "هل أنت متأكد من أنك تريد تعديل المعلومات الحالية؟", "salary_balance": "رصيد الراتب: ${amount}", "enter_withdraw_amount": "أدخل مبلغ السحب", - "withdrawal_rule_1": "*(1)يجب أن يكون مبلغ السحب >=$50", - "withdrawal_rule_2": "(2)ستفرض المنصة رسوم معالجة بنسبة 20% على مبلغ السحب الحالي.", + "withdrawal_rule_1": "*(1)يجب أن يكون مبلغ السحب >=${amount}", + "withdrawal_rule_2": "(2)ستفرض المنصة رسوم معالجة بنسبة {fee}% على مبلغ السحب الحالي.", "admin_policy": "سياسة المشرف", diff --git a/src/locales/bn.json b/src/locales/bn.json index b102376..a87e848 100644 --- a/src/locales/bn.json +++ b/src/locales/bn.json @@ -273,8 +273,6 @@ "please_select_bank_card": "দয়া করে একটি ব্যাংক কার্ড নির্বাচন করুন", "change_withdrawal_method": "উত্তোলন পদ্ধতি পরিবর্তন", "enter_cash_out_amount": "দয়া করে নগদ উত্তোলনের পরিমাণ লিখুন", - "cash_out_minimum": "*নগদ উত্তোলনের পরিমাণ >= $50 হতে হবে", - "new_year_cash_out_minimum": "*নগদ উত্তোলনের পরিমাণ >= $10 হতে হবে", "cash_withdraw": "নগদ উত্তোলন", "bank_card": "ব্যাংক কার্ড", @@ -300,8 +298,8 @@ "confirm_modify_kyc": "আপনি কি বর্তমান তথ্য পরিবর্তন করতে চান?", "salary_balance": "বেতন ব্যালেন্স: ${amount}", "enter_withdraw_amount": "উত্তোলনের পরিমাণ লিখুন", - "withdrawal_rule_1": "*(1)উত্তোলনের পরিমাণ অবশ্যই >=$50 হতে হবে", - "withdrawal_rule_2": "(2)প্ল্যাটফর্ম বর্তমান উত্তোলনের পরিমাণের উপর 20% হ্যান্ডলিং ফি চার্জ করবে।", + "withdrawal_rule_1": "*(1)উত্তোলনের পরিমাণ অবশ্যই >=${amount} হতে হবে", + "withdrawal_rule_2": "(2)প্ল্যাটফর্ম বর্তমান উত্তোলনের পরিমাণের উপর {fee}% হ্যান্ডলিং ফি চার্জ করবে।", "admin_policy": "অ্যাডমিন নীতি", diff --git a/src/locales/en.json b/src/locales/en.json index 0b34bdc..68fbea2 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -273,8 +273,6 @@ "please_select_bank_card": "Please select a bank card", "change_withdrawal_method": "Change withdrawal method", "enter_cash_out_amount": "Please enter the cash out amount", - "cash_out_minimum": "*The cash out amount must be >= $50", - "new_year_cash_out_minimum": "*The cash out amount must be >= $10", "cash_withdraw": "Cash Withdraw", "bank_card": "Bank Card", @@ -300,8 +298,8 @@ "confirm_modify_kyc": "Are you sure you want to modify the current information?", "salary_balance": "Salary Balance: ${amount}", "enter_withdraw_amount": "Enter withdraw amount", - "withdrawal_rule_1": "*(1)Withdrawal amount must be >=$50", - "withdrawal_rule_2": "(2)The platform will charge a 20% handling fee on the current withdrawal amount.", + "withdrawal_rule_1": "*(1)Withdrawal amount must be >=${amount}", + "withdrawal_rule_2": "(2)The platform will charge a {fee}% handling fee on the current withdrawal amount.", "admin_policy": "Admin Policy", diff --git a/src/locales/tr.json b/src/locales/tr.json index a3ce060..9923481 100644 --- a/src/locales/tr.json +++ b/src/locales/tr.json @@ -273,8 +273,6 @@ "please_select_bank_card": "Lütfen bir banka kartı seçin", "change_withdrawal_method": "Çekim yöntemini değiştir", "enter_cash_out_amount": "Lütfen nakit çekme miktarını girin", - "cash_out_minimum": "*Nakit çekme miktarı >= $50 olmalıdır", - "new_year_cash_out_minimum": "*Nakit çekme miktarı >= $10 olmalıdır", "cash_withdraw": "Nakit Çekim", "bank_card": "Banka Kartı", @@ -300,8 +298,8 @@ "confirm_modify_kyc": "Mevcut bilgileri değiştirmek istediğinizden emin misiniz?", "salary_balance": "Maaş Bakiyesi: ${amount}", "enter_withdraw_amount": "Çekim miktarını girin", - "withdrawal_rule_1": "*(1)Çekim miktarı >=$50 olmalıdır", - "withdrawal_rule_2": "(2)Platform, mevcut çekim miktarı üzerinden %20 işlem ücreti alacaktır.", + "withdrawal_rule_1": "*(1)Çekim miktarı >=${amount} olmalıdır", + "withdrawal_rule_2": "(2)Platform, mevcut çekim miktarı üzerinden %{fee} işlem ücreti alacaktır.", "admin_policy": "Yönetici Politikası", diff --git a/src/locales/zh.json b/src/locales/zh.json index cba699e..1023285 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -273,8 +273,6 @@ "please_select_bank_card": "请选择银行卡", "change_withdrawal_method": "更改提现方式", "enter_cash_out_amount": "请输入提现金额", - "cash_out_minimum": "*提现金额必须大于等于50美元", - "new_year_cash_out_minimum": "*提现金额必须大于等于10美元", "cash_withdraw": "现金提现", "bank_card": "银行卡", @@ -300,8 +298,8 @@ "confirm_modify_kyc": "您确定要修改当前信息吗?", "salary_balance": "薪资余额:${amount}", "enter_withdraw_amount": "请输入提现金额", - "withdrawal_rule_1": "*(1)提现金额必须 >=$50", - "withdrawal_rule_2": "(2)平台将收取当前提现金额 20% 的手续费。", + "withdrawal_rule_1": "*(1)提现金额必须 >=${amount}", + "withdrawal_rule_2": "(2)平台将收取当前提现金额 {fee}% 的手续费。", "admin_policy": "管理员政策", diff --git a/src/views/Wallet/CashOut/CashOut.vue b/src/views/Wallet/CashOut/CashOut.vue index 45cdbeb..800cadc 100644 --- a/src/views/Wallet/CashOut/CashOut.vue +++ b/src/views/Wallet/CashOut/CashOut.vue @@ -338,7 +338,9 @@
- {{ t('new_year_cash_out_minimum') }} + {{ t('withdrawal_rule_1', { amount: withdrawalThresholdDisplay }) }} +
+ {{ t('withdrawal_rule_2', { fee: withdrawalServiceChargeDisplay }) }}
@@ -427,6 +429,7 @@ import { setApplyInfo, getApplyInfo } from '@/utils/applyStore.js' import { ref, onMounted, computed, onUnmounted } from 'vue' import { useRouter, useRoute } from 'vue-router' import { setDocumentDirection } from '@/locales/i18n' +import { showError } from '@/utils/toast.js' import { withdrawableAmount, //获取可提现金额 @@ -435,6 +438,8 @@ import { import { getBankCardList, //获取正在使用的银行卡 getWithdrawInfoList, //获取申请提现信息 + apiGetUsdWithdrawServiceCharge, // 获取提现美金手续费 + apiGetUsdWithdrawalThreshold, // 获取提现美金门槛 } from '@/api/wallet.js' import GeneralHeader from '@/components/GeneralHeader.vue' @@ -452,6 +457,10 @@ const cashOutTypeShow = ref(false) const cashOutShow = ref(false) const cashOutAmount = ref(null) +// 提现手续费比例,接口成功后会覆盖默认值 +const withdrawalServiceCharge = ref(20) +// 提现最低金额,接口成功后会覆盖默认值 +const withdrawalThreshold = ref(50) const maskLayerShow = computed(() => { return cashOutTipShow.value || cashOutShow.value || cashOutTypeShow.value @@ -477,6 +486,27 @@ const hasKYC = computed(() => { return bankCardInfo.value != null }) +// 统一处理规则文案中的数字,避免出现 NaN 或空值 +const formatRuleNumber = (value) => { + const numericValue = Number(value) + + if (!Number.isFinite(numericValue)) { + return '0' + } + + return numericValue.toString() +} + +// 提现规则中展示的手续费比例 +const withdrawalServiceChargeDisplay = computed(() => { + return formatRuleNumber(withdrawalServiceCharge.value) +}) + +// 提现规则中展示的最低提现金额 +const withdrawalThresholdDisplay = computed(() => { + return formatRuleNumber(withdrawalThreshold.value) +}) + // 前往选择提交方式 const gotoselectBank = () => { router.push('/bank-card') @@ -503,7 +533,11 @@ const CashOut = () => { // 是否可以提现 const checkStatus = computed(() => { - return bankCardInfo.value?.status == 'PASS' && usedBankCard.value?.id && cashOutAmount.value >= 10 + return ( + bankCardInfo.value?.status == 'PASS' && + usedBankCard.value?.id && + cashOutAmount.value >= withdrawalThreshold.value + ) }) // 确认提现 @@ -540,6 +574,27 @@ const getDrawableAmount = async () => { } } +// 获取提现配置 +const getWithdrawConfig = async () => { + try { + const resServiceCharge = await apiGetUsdWithdrawServiceCharge() + if (resServiceCharge.status && typeof resServiceCharge.body === 'number') { + withdrawalServiceCharge.value = resServiceCharge.body + } + } catch (error) { + console.error('获取提现手续费失败:', error) + } + + try { + const resThreshold = await apiGetUsdWithdrawalThreshold() + if (resThreshold.status && typeof resThreshold.body === 'number') { + withdrawalThreshold.value = resThreshold.body + } + } catch (error) { + console.error('获取提现门槛失败:', error) + } +} + const handleCashOutAmountInput = (event) => { let value = event.target.value @@ -601,6 +656,7 @@ const getBankCards = async () => { onMounted(() => { getDrawableAmount() //获取可提现金额 + getWithdrawConfig() // 获取提现配置 getWithdrawInfoListData() // 获取提现信息列表 getBankCards() // 获取正在使用的银行卡 }) diff --git a/src/views/Wallet/CashOut/CashWithdraw.vue b/src/views/Wallet/CashOut/CashWithdraw.vue index c5d6b46..aec7664 100644 --- a/src/views/Wallet/CashOut/CashWithdraw.vue +++ b/src/views/Wallet/CashOut/CashWithdraw.vue @@ -52,9 +52,9 @@
- {{ t('withdrawal_rule_1') }} + {{ t('withdrawal_rule_1', { amount: withdrawalThresholdDisplay }) }}
- {{ t('withdrawal_rule_2') }} + {{ t('withdrawal_rule_2', { fee: withdrawalServiceChargeDisplay }) }}
@@ -612,6 +612,8 @@ import { getBankCardList, // 获取正在使用的银行卡 getWithdrawInfoList, // 获取申请提现信息 useBankCard, // 设置默认银行卡 + apiGetUsdWithdrawServiceCharge, // 获取提现美金手续费 + apiGetUsdWithdrawalThreshold, // 获取提现美金门槛 withdrawApply, //提现 } from '@/api/wallet.js' @@ -630,6 +632,10 @@ const cashOutTypeShow = ref(false) const cashOutShow = ref(false) const cashOutAmount = ref(null) +// 提现手续费比例,接口成功后会覆盖默认值 +const withdrawalServiceCharge = ref(20) +// 提现最低金额,接口成功后会覆盖默认值 +const withdrawalThreshold = ref(50) const identityStore = useIdentityStore() const maskLayerShow = computed(() => { @@ -652,6 +658,27 @@ const hasKYC = computed(() => { return bankCardInfo.value != null }) +// 统一处理规则文案中的数字,避免出现 NaN 或空值 +const formatRuleNumber = (value) => { + const numericValue = Number(value) + + if (!Number.isFinite(numericValue)) { + return '0' + } + + return numericValue.toString() +} + +// 提现规则中展示的手续费比例 +const withdrawalServiceChargeDisplay = computed(() => { + return formatRuleNumber(withdrawalServiceCharge.value) +}) + +// 提现规则中展示的最低提现金额 +const withdrawalThresholdDisplay = computed(() => { + return formatRuleNumber(withdrawalThreshold.value) +}) + // 前往选择银行卡 const goToSelectBank = () => { router.push('/bank-card') @@ -669,7 +696,11 @@ const goToKYC = () => { // 是否可以提现 const checkStatus = computed(() => { - return bankCardInfo.value?.status == 'PASS' && usedBankCard.value?.id && cashOutAmount.value >= 50 + return ( + bankCardInfo.value?.status == 'PASS' && + usedBankCard.value?.id && + cashOutAmount.value >= withdrawalThreshold.value + ) }) // 确认提现 @@ -728,6 +759,27 @@ const getDrawableAmount = async () => { } } +// 获取提现配置 +const getWithdrawConfig = async () => { + try { + const resServiceCharge = await apiGetUsdWithdrawServiceCharge() + if (resServiceCharge.status && typeof resServiceCharge.body === 'number') { + withdrawalServiceCharge.value = resServiceCharge.body + } + } catch (error) { + console.error('获取提现手续费失败:', error) + } + + try { + const resThreshold = await apiGetUsdWithdrawalThreshold() + if (resThreshold.status && typeof resThreshold.body === 'number') { + withdrawalThreshold.value = resThreshold.body + } + } catch (error) { + console.error('获取提现门槛失败:', error) + } +} + // 数字处理 const handleCashOutAmountInput = (event) => { let value = event.target.value @@ -809,6 +861,7 @@ const setDefaultBankCard = async (cardId) => { onMounted(() => { getDrawableAmount() //获取可提现金额 + getWithdrawConfig() // 获取提现配置 getWithdrawInfoListData() // 获取提现信息列表 getBankCards() // 获取正在使用的银行卡 }) diff --git a/src/views/Wallet/availableIncome.vue b/src/views/Wallet/availableIncome.vue index d712fd4..12ecf92 100644 --- a/src/views/Wallet/availableIncome.vue +++ b/src/views/Wallet/availableIncome.vue @@ -696,7 +696,9 @@
- {{ t('cash_out_minimum') }} + {{ t('withdrawal_rule_1', { amount: withdrawalThresholdDisplay }) }} +
+ {{ t('withdrawal_rule_2', { fee: withdrawalServiceChargeDisplay }) }}
@@ -793,6 +795,8 @@ import { apiGetBankBalance, //获取当前余额 apiExchange, //兑换 apiTransfer, //转账 + apiGetUsdWithdrawServiceCharge, // 获取提现美金手续费 + apiGetUsdWithdrawalThreshold, // 获取提现美金门槛 getBankCardList, //获取正在使用的银行卡 getWithdrawInfoList, //获取申请提现信息 withdrawApply, //提现 @@ -827,6 +831,10 @@ const cashOutTypeShow = ref(false) const cashOutShow = ref(false) const cashOutAmount = ref(null) +// 提现手续费比例,接口成功后会覆盖默认值 +const withdrawalServiceCharge = ref(20) +// 提现最低金额,接口成功后会覆盖默认值 +const withdrawalThreshold = ref(50) const maskLayerShow = computed(() => { return exchangeTipShow.value || cashOutTipShow.value || cashOutShow.value || cashOutTypeShow.value @@ -894,6 +902,27 @@ const hasKYC = computed(() => { return bankCardInfo.value != null }) +// 统一处理规则文案中的数字,避免出现 NaN 或空值 +const formatRuleNumber = (value) => { + const numericValue = Number(value) + + if (!Number.isFinite(numericValue)) { + return '0' + } + + return numericValue.toString() +} + +// 提现规则中展示的手续费比例 +const withdrawalServiceChargeDisplay = computed(() => { + return formatRuleNumber(withdrawalServiceCharge.value) +}) + +// 提现规则中展示的最低提现金额 +const withdrawalThresholdDisplay = computed(() => { + return formatRuleNumber(withdrawalThreshold.value) +}) + const formattedAmount = (amount) => { if (locale.value === 'ar') { return `${amount}$` @@ -994,6 +1023,27 @@ const fetchBankBalance = async () => { } } +// 获取提现配置 +const getWithdrawConfig = async () => { + try { + const resServiceCharge = await apiGetUsdWithdrawServiceCharge() + if (resServiceCharge.status && typeof resServiceCharge.body === 'number') { + withdrawalServiceCharge.value = resServiceCharge.body + } + } catch (error) { + console.error('获取提现手续费失败:', error) + } + + try { + const resThreshold = await apiGetUsdWithdrawalThreshold() + if (resThreshold.status && typeof resThreshold.body === 'number') { + withdrawalThreshold.value = resThreshold.body + } + } catch (error) { + console.error('获取提现门槛失败:', error) + } +} + // 前往提交个人资料 const gotoKYC = () => { router.push({ path: '/KYC', query: { from: '/available-income', activeAction: 'Cash out' } }) @@ -1147,7 +1197,11 @@ const handleExchange = async () => { // 是否可以提现 const checkStatus = computed(() => { - return bankCardInfo.value?.status == 'PASS' && usedBankCard.value?.id && cashOutAmount.value >= 50 + return ( + bankCardInfo.value?.status == 'PASS' && + usedBankCard.value?.id && + cashOutAmount.value >= withdrawalThreshold.value + ) }) // 确认提现 @@ -1182,6 +1236,7 @@ const Receive = async () => { // 页面加载时获取银行余额和初始化收款人 onMounted(() => { fetchBankBalance() // 获取银行余额 + getWithdrawConfig() // 获取提现配置 initializePayee() // 初始化收款人信息 getWithdrawInfoListData() // 获取提现信息列表 getBankCards() // 获取正在使用的银行卡