feat(提现相关页面): 增加获取提现最低金额和手续费的接口,对提现的提示文本进行调整,对输入的金额与获取的最低金额进行比较处理
This commit is contained in:
parent
a1542f9e43
commit
71afa388e4
@ -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} 返回当前的余额信息
|
||||
|
||||
@ -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": "سياسة المشرف",
|
||||
|
||||
|
||||
@ -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": "অ্যাডমিন নীতি",
|
||||
|
||||
|
||||
@ -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",
|
||||
|
||||
|
||||
@ -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ı",
|
||||
|
||||
|
||||
@ -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": "管理员政策",
|
||||
|
||||
|
||||
@ -338,7 +338,9 @@
|
||||
</div>
|
||||
|
||||
<div style="color: rgba(0, 0, 0, 0.4); font-weight: 600; font-size: 0.9em">
|
||||
{{ t('new_year_cash_out_minimum') }}
|
||||
{{ t('withdrawal_rule_1', { amount: withdrawalThresholdDisplay }) }}
|
||||
<br />
|
||||
{{ t('withdrawal_rule_2', { fee: withdrawalServiceChargeDisplay }) }}
|
||||
</div>
|
||||
|
||||
<div style="display: flex; justify-content: center; align-items: center">
|
||||
@ -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() // 获取正在使用的银行卡
|
||||
})
|
||||
|
||||
@ -52,9 +52,9 @@
|
||||
|
||||
<!-- 规则 -->
|
||||
<div style="color: #f00; font-weight: 500; font-size: 0.8em">
|
||||
{{ t('withdrawal_rule_1') }}
|
||||
{{ t('withdrawal_rule_1', { amount: withdrawalThresholdDisplay }) }}
|
||||
<br />
|
||||
{{ t('withdrawal_rule_2') }}
|
||||
{{ t('withdrawal_rule_2', { fee: withdrawalServiceChargeDisplay }) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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() // 获取正在使用的银行卡
|
||||
})
|
||||
|
||||
@ -696,7 +696,9 @@
|
||||
</div>
|
||||
|
||||
<div style="color: rgba(0, 0, 0, 0.4); font-weight: 600; font-size: 0.9em">
|
||||
{{ t('cash_out_minimum') }}
|
||||
{{ t('withdrawal_rule_1', { amount: withdrawalThresholdDisplay }) }}
|
||||
<br />
|
||||
{{ t('withdrawal_rule_2', { fee: withdrawalServiceChargeDisplay }) }}
|
||||
</div>
|
||||
|
||||
<div style="display: flex; justify-content: center; align-items: center">
|
||||
@ -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() // 获取正在使用的银行卡
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user