取款计算金额
This commit is contained in:
parent
2e09a787fd
commit
0c291f2870
|
|
@ -0,0 +1,17 @@
|
|||
# 生产环境标识(Vite 内置变量,无需修改)
|
||||
NODE_ENV = production
|
||||
|
||||
# 生产环境接口基础地址
|
||||
VITE_API_BASE_URL = https://adminapi.apimcapital.top/api
|
||||
|
||||
# 请求超时时间(毫秒)
|
||||
VITE_REQUEST_TIMEOUT = 10000
|
||||
|
||||
# 可选:生产环境其他配置(如关闭调试)
|
||||
VITE_DEBUG = false
|
||||
|
||||
# 交易mqtt
|
||||
VITE_MQTT_TRANSACTION_HOST=wss://adminapi.apimcapital.top/mqtt
|
||||
|
||||
# exe 下载基础地址
|
||||
VITE_EXE_DOWNLOAD_BASE_URL = https://adminh5.apimcapital.top
|
||||
|
|
@ -14,4 +14,4 @@ VITE_DEBUG = true
|
|||
VITE_MQTT_TRANSACTION_HOST = wss://adminapi.duxiang.wiki/mqtt
|
||||
|
||||
# exe 下载基础地址
|
||||
VITE_EXE_DOWNLOAD_BASE_URL = https://adminh5.duxiang.wiki
|
||||
VITE_EXE_DOWNLOAD_BASE_URL = https://adminh5.duxiang.wiki
|
||||
|
|
@ -6,8 +6,9 @@
|
|||
"scripts": {
|
||||
"dev": "vite",
|
||||
"dev:test": "vite --mode test",
|
||||
"dev:pro": "vite --mode pro",
|
||||
"build": "run-p type-check \"build-only {@}\" --",
|
||||
"build:prod": "vite build --mode production",
|
||||
"build:prod": "vite build --mode pro",
|
||||
"build:test": "vite build --mode test",
|
||||
"preview": "vite preview",
|
||||
"build-only": "vite build",
|
||||
|
|
|
|||
|
|
@ -1,65 +1,25 @@
|
|||
<template>
|
||||
<Dialog :visible="dialogVisible"
|
||||
:title="currentStep === 1 ? t('withdraw.dialog.title1') : t('withdraw.dialog.title2')" width="600px"
|
||||
:show-footer="false" @close="handleUpdateVisible">
|
||||
<!-- 第一步:输入金额并展示计算明细 -->
|
||||
:show-footer="false" @close="handleCloseDialog">
|
||||
<!-- 第一步:输入金额 -->
|
||||
<div v-if="currentStep === 1" class="step1-container">
|
||||
<!-- 钱包余额展示 -->
|
||||
<div class="wallet-section">
|
||||
<div class="section-label">{{ t('withdraw.dialog.walletBalance') }}</div>
|
||||
<div class="wallet-grid">
|
||||
<div v-for="(item, index) in walletItems" :key="index" class="wallet-item">
|
||||
<span class="wallet-label">{{ item.label }}</span>
|
||||
<span class="wallet-value" :class="{ available: item.field === 'available' }">{{ item.value }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 钱包余额(简化展示) -->
|
||||
<div class="wallet-balance">
|
||||
<span class="wallet-label">{{ t('withdraw.dialog.walletBalance') }}:</span>
|
||||
<span class="wallet-value">{{ walletBalance }}</span>
|
||||
<!-- <span class="wallet-currency">{{ currentCurrency }}</span> -->
|
||||
</div>
|
||||
|
||||
<!-- 金额输入 -->
|
||||
<div class="amount-section">
|
||||
<div class="section-label">
|
||||
{{ t('withdraw.dialog.amount') }}
|
||||
<span class="max-balance">(最大可取:{{ totalWalletBalance }})</span>
|
||||
<span class="max-balance">(最大可取:{{ walletBalance }})</span>
|
||||
</div>
|
||||
<el-input v-model="withdrawAmount" type="number" :placeholder="t('withdraw.dialog.amountPlaceholder')"
|
||||
@input="handleAmountInput">
|
||||
<template #prepend>{{ currentCurrency }}</template>
|
||||
<el-input v-model="withdrawAmount" type="number" :placeholder="t('withdraw.dialog.amountPlaceholder')">
|
||||
<!-- <template #prepend>{{ currentCurrency }}</template> -->
|
||||
</el-input>
|
||||
<div v-if="amountError" class="amount-error">{{ amountError }}</div>
|
||||
</div>
|
||||
|
||||
<!-- 合计扣除 -->
|
||||
<div v-if="totalDeducted && parseFloat(totalDeducted) > 0" class="total-section">
|
||||
<div class="total-label">{{ t('withdraw.dialog.totalDeducted') }}:</div>
|
||||
<div class="total-value">-{{ totalDeducted }} {{ currentCurrency }}</div>
|
||||
</div>
|
||||
|
||||
<!-- 扣除计算明细 - 用盒子展示 -->
|
||||
<div v-if="withdrawAmount && calculatedData.length > 0" class="calculation-section">
|
||||
<div class="section-label">{{ t('withdraw.dialog.deductionDetails') }}</div>
|
||||
<div class="calculation-grid">
|
||||
<div v-for="(item, index) in calculatedData" :key="index" class="calc-item">
|
||||
<div class="calc-type">{{ item.type }}</div>
|
||||
<div class="calc-values">
|
||||
<div class="calc-original">
|
||||
<span class="label">{{ t('withdraw.dialog.originalBalance') }}</span>
|
||||
<span class="value">{{ item.original }}</span>
|
||||
</div>
|
||||
<div class="calc-deducted">
|
||||
<span class="label">{{ t('withdraw.dialog.deductedAmount') }}</span>
|
||||
<span class="value deducted">-{{ item.deducted }}</span>
|
||||
</div>
|
||||
<div class="calc-remaining">
|
||||
<span class="label">{{ t('withdraw.dialog.remaining') }}</span>
|
||||
<span class="value">{{ item.remaining }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="calc-summary">
|
||||
<span class="label">{{ t('withdraw.dialog.totalDeducted') }}:</span>
|
||||
<span class="total-value">{{ totalDeducted }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 快捷金额 -->
|
||||
|
|
@ -84,11 +44,7 @@
|
|||
<div class="amount-info">
|
||||
<div class="info-row">
|
||||
<span class="info-label">{{ t('withdraw.dialog.withdrawAmount') }}:</span>
|
||||
<span class="info-value">{{ withdrawAmount }} USD</span>
|
||||
</div>
|
||||
<div class="info-row" v-for="(item, index) in calculatedData" :key="index">
|
||||
<span class="info-label">{{ item.typeLabel }}:</span>
|
||||
<span class="info-value">{{ item.deducted }} USD</span>
|
||||
<span class="info-value">{{ withdrawAmount }} </span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -139,8 +95,7 @@ import { ref, computed, watch } from 'vue'
|
|||
import { useI18n } from 'vue-i18n'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import Dialog from '@/components/common/Dialog.vue'
|
||||
import { getWalletCapital, agentWithdraw, withdraw } from '@/api/modules/capital/withdraw'
|
||||
import { getStorage } from '@/utils/storage'
|
||||
import { getWalletCapital, withdraw } from '@/api/modules/capital/withdraw'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
|
|
@ -154,7 +109,6 @@ interface Props {
|
|||
channel_code?: string
|
||||
currency?: {
|
||||
symbol: string
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -165,29 +119,9 @@ interface Emits {
|
|||
}
|
||||
|
||||
interface WalletInfo {
|
||||
user_id: string
|
||||
amount: string
|
||||
commission_point_diff: string
|
||||
freeze: string
|
||||
risk: string
|
||||
service: string
|
||||
toucun_percent: string
|
||||
fee_handling_percent: string
|
||||
commission_fee_handling: string
|
||||
bail: string
|
||||
bail_stop_order: string
|
||||
bail_change_order: string
|
||||
risk_control_id: string
|
||||
fee_setting_id: string
|
||||
closing_profit: string
|
||||
}
|
||||
|
||||
interface CalculatedItem {
|
||||
type: string
|
||||
typeLabel: string
|
||||
original: string
|
||||
deducted: string
|
||||
remaining: string
|
||||
freeze: string
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
|
|
@ -197,179 +131,40 @@ const dialogVisible = ref(props.visible)
|
|||
const currentStep = ref(1)
|
||||
const withdrawAmount = ref('')
|
||||
const submitLoading = ref(false)
|
||||
const amountError = ref('')
|
||||
|
||||
// 处理金额输入
|
||||
const handleAmountInput = (value: string) => {
|
||||
const numValue = parseFloat(value)
|
||||
if (isNaN(numValue)) {
|
||||
amountError.value = ''
|
||||
calculatedData.value = []
|
||||
return
|
||||
}
|
||||
|
||||
if (numValue > totalWalletBalance.value) {
|
||||
amountError.value = `输入金额不能超过最大可取金额 ${totalWalletBalance.value.toFixed(2)}`
|
||||
calculatedData.value = []
|
||||
return
|
||||
}
|
||||
|
||||
amountError.value = ''
|
||||
calculateWithdraw()
|
||||
}
|
||||
|
||||
// 用户信息
|
||||
const userInfo: any = getStorage('userInfo')
|
||||
const roleId = userInfo?.role_id || 6
|
||||
|
||||
// 角色判断
|
||||
const isAgent = computed(() => roleId >= 5)
|
||||
|
||||
// 当前货币类型(从渠道信息获取)
|
||||
const currentCurrency = computed(() => props.channelInfo?.currency?.symbol || '-')
|
||||
// const currentCurrency = computed(() => props.channelInfo?.currency?.symbol || '-')
|
||||
|
||||
// 计算可用余额 = amount - freeze - (手续费 + 点差 + 服务费 + 风险金 + 盈亏)
|
||||
const availableBalance = computed(() => {
|
||||
const amount = parseFloat(walletInfo.value.amount || '0')
|
||||
const freeze = parseFloat(walletInfo.value.freeze || '0')
|
||||
// 钱包余额总和
|
||||
let walletSum =
|
||||
Math.max(0, parseFloat(walletInfo.value.freeze)) +
|
||||
Math.max(0, parseFloat(walletInfo.value.risk || '0')) +
|
||||
Math.max(0, parseFloat(walletInfo.value.service || '0')) +
|
||||
Math.max(0, parseFloat(walletInfo.value.commission_fee_handling || '0')) +
|
||||
Math.max(0, parseFloat(walletInfo.value.commission_point_diff || '0'));
|
||||
|
||||
if (+roleId === 3 || +roleId === 4) {
|
||||
walletSum += Math.max(0, parseFloat(walletInfo.value.closing_profit || '0'))
|
||||
}
|
||||
return floorMoney(amount - walletSum)
|
||||
})
|
||||
|
||||
// 计算钱包余额总和(用于验证输入金额上限)
|
||||
// roleId >= 5 时,totalWalletBalance 需要包含 availableBalance
|
||||
const totalWalletBalance = computed(() => {
|
||||
const amount = parseFloat(walletInfo.value.amount || '0')
|
||||
const freeze = parseFloat(walletInfo.value.freeze || '0')
|
||||
console.log('walletInfo.value:', amount, freeze);
|
||||
|
||||
// 钱包余额总和(手续费 + 点差 + 服务费 + 风险金 + 盈亏)
|
||||
const walletSum =
|
||||
parseFloat(walletInfo.value.commission_fee_handling || '0') +
|
||||
parseFloat(walletInfo.value.commission_point_diff || '0') +
|
||||
parseFloat(walletInfo.value.service || '0') +
|
||||
parseFloat(walletInfo.value.risk || '0') +
|
||||
parseFloat(Math.max(0, +walletInfo.value.closing_profit) + '')
|
||||
if (roleId >= 5) {
|
||||
// roleId >= 5 时,总余额包含可用余额
|
||||
// availableBalance = amount - freeze - walletSum
|
||||
// const availableBal = Math.max(0, amount - walletSum)
|
||||
return floorMoney(amount - freeze)
|
||||
}
|
||||
return floorMoney(walletSum)
|
||||
})
|
||||
|
||||
const floorMoney = (num: number) => {
|
||||
const cents = Math.floor(num * 100);
|
||||
return cents / 100;
|
||||
}
|
||||
|
||||
// 费用项标签映射
|
||||
const feeLabelMap: Record<string, string> = {
|
||||
'手续费': '手续费佣金',
|
||||
'点差': '点差佣金',
|
||||
'服务费': '服务费',
|
||||
'风险金': '风险金',
|
||||
'盈亏': '盈亏',
|
||||
'可用余额': '可用余额',
|
||||
}
|
||||
|
||||
// 费用项对应的字段
|
||||
const feeFieldMap: Record<string, keyof WalletInfo | 'available'> = {
|
||||
'手续费': 'commission_fee_handling',
|
||||
'点差': 'commission_point_diff',
|
||||
'服务费': 'service',
|
||||
'风险金': 'risk',
|
||||
'盈亏': 'closing_profit',
|
||||
'可用余额': 'available', // 特殊处理,用 computed 计算
|
||||
}
|
||||
|
||||
// 费用项顺序
|
||||
const feeOrder = computed(() => {
|
||||
const orders: Record<number, string[]> = {
|
||||
1: ['手续费', '点差', '服务费', '风险金', '盈亏'], // 平台
|
||||
2: ['手续费', '点差', '服务费'], // 承包商
|
||||
3: ['手续费', '点差', '服务费', '盈亏'], // 特殊做市商
|
||||
4: ['手续费', '点差', '服务费', '盈亏'], // 普通做市商
|
||||
5: ['手续费', '点差', '可用余额'], // 代理
|
||||
6: ['手续费', '点差', '可用余额'], // 用户
|
||||
}
|
||||
return orders[roleId] ?? orders[6] ?? []
|
||||
})
|
||||
|
||||
// 根据角色动态计算钱包项
|
||||
const walletItems = computed(() => {
|
||||
const items: { label: string; value: string; field: string }[] = []
|
||||
|
||||
for (const feeType of feeOrder.value) {
|
||||
const field = feeFieldMap[feeType]
|
||||
if (!field) continue
|
||||
|
||||
let value: string
|
||||
if (field === 'available') {
|
||||
value = availableBalance.value.toFixed(2)
|
||||
} else {
|
||||
value = walletInfo.value[field] || '0.00'
|
||||
}
|
||||
|
||||
items.push({
|
||||
label: feeLabelMap[feeType] || feeType,
|
||||
value,
|
||||
field,
|
||||
})
|
||||
}
|
||||
|
||||
return items
|
||||
})
|
||||
|
||||
// 钱包信息
|
||||
// 钱包信息(只保留需要的三个字段)
|
||||
const walletInfo = ref<WalletInfo>({
|
||||
user_id: '',
|
||||
amount: '',
|
||||
commission_point_diff: '0',
|
||||
freeze: '0',
|
||||
risk: '0',
|
||||
service: '0',
|
||||
toucun_percent: '0',
|
||||
fee_handling_percent: '0',
|
||||
commission_fee_handling: '0',
|
||||
amount: '0',
|
||||
bail: '0',
|
||||
bail_stop_order: '0',
|
||||
bail_change_order: '0',
|
||||
risk_control_id: '',
|
||||
fee_setting_id: '',
|
||||
closing_profit: '0',
|
||||
freeze: '0',
|
||||
})
|
||||
|
||||
// 计算后的扣除明细
|
||||
const calculatedData = ref<CalculatedItem[]>([])
|
||||
|
||||
// 合计扣除
|
||||
const totalDeducted = computed(() => {
|
||||
return calculatedData.value.reduce((sum, item) => sum + parseFloat(item.deducted || '0'), 0).toFixed(2)
|
||||
// 钱包余额 = amount - bail - freeze(直接截取最后2位小数,不四舍五入)
|
||||
const walletBalance = computed(() => {
|
||||
const amount = parseFloat(walletInfo.value.amount || '0')
|
||||
const bail = parseFloat(walletInfo.value.bail || '0')
|
||||
const freeze = parseFloat(walletInfo.value.freeze || '0')
|
||||
const result = amount - bail - freeze
|
||||
// 转字符串后直接截取最后两位小数,避开 toFixed 的四舍五入和 JS 浮点精度问题
|
||||
const [intPart, decPart = ''] = String(result).split('.')
|
||||
const truncatedDec = (decPart + '00').slice(0, 2)
|
||||
return `${intPart}.${truncatedDec}`
|
||||
})
|
||||
|
||||
// 快捷金额
|
||||
const quickAmounts = ['100', '500', '1000', '5000']
|
||||
|
||||
// 当前选中的渠道编码(优先从 props 获取,否则从 channelInfo 获取)
|
||||
// 当前选中的渠道编码
|
||||
const currentChannelCode = computed(() => {
|
||||
return props.channelCode || props.channelInfo?.channel_code || ''
|
||||
})
|
||||
|
||||
// 是否为加密货币渠道(TRC/ERC)
|
||||
const isCryptoChannel = computed(() => {
|
||||
return ['TRC', 'ERC', "ADJUST"].includes(currentChannelCode.value)
|
||||
return ['TRC', 'ERC', 'ADJUST'].includes(currentChannelCode.value)
|
||||
})
|
||||
|
||||
// 是否为银行渠道(BANK)
|
||||
|
|
@ -380,21 +175,10 @@ const isBankChannel = computed(() => {
|
|||
// 表单数据
|
||||
const formRef = ref<FormInstance>()
|
||||
const formData = ref({
|
||||
channel_id: '',
|
||||
withdraw_address: '',
|
||||
// 代理取款字段
|
||||
withdraw_fee_handle: '',
|
||||
withdraw_point_diff: '',
|
||||
withdraw_service_fee: '',
|
||||
withdraw_head_fee: '',
|
||||
withdraw_risk_fee: '',
|
||||
withdraw_blance: '', // 可用余额使用量
|
||||
// 用户取款额外字段
|
||||
beneficiary_name: '',
|
||||
beneficiary_enname: '',
|
||||
beneficiary_bank_name: '',
|
||||
swift_bic_code: '',
|
||||
beneficiary_bank_address: '',
|
||||
beneficiary_bank_account: '',
|
||||
})
|
||||
|
||||
|
|
@ -419,28 +203,22 @@ watch(() => props.visible, (val) => {
|
|||
const initData = async () => {
|
||||
currentStep.value = 1
|
||||
withdrawAmount.value = ''
|
||||
calculatedData.value = []
|
||||
formData.value = {
|
||||
withdraw_address: '',
|
||||
beneficiary_name: '',
|
||||
beneficiary_enname: '',
|
||||
beneficiary_bank_name: '',
|
||||
beneficiary_bank_account: '',
|
||||
}
|
||||
|
||||
// 获取钱包信息
|
||||
try {
|
||||
const res: any = await getWalletCapital()
|
||||
if (res) {
|
||||
walletInfo.value = {
|
||||
commission_fee_handling: res.commission_fee_handling || '0',
|
||||
commission_point_diff: '' + floorMoney(res.commission_point_diff - res.freeze || 0) || '0',
|
||||
service: res.service || '0',
|
||||
risk: res.risk || '0',
|
||||
closing_profit: res.closing_profit || '0',
|
||||
toucun_percent: res.toucun_percent || '0',
|
||||
amount: res.amount || '0',
|
||||
user_id: res.user_id || '',
|
||||
freeze: res.freeze || '0',
|
||||
bail: res.bail || '0',
|
||||
bail_stop_order: res.bail_stop_order || '0',
|
||||
bail_change_order: res.bail_change_order || '0',
|
||||
risk_control_id: res.risk_control_id || '',
|
||||
fee_setting_id: res.fee_setting_id || '',
|
||||
fee_handling_percent: res.fee_handling_percent || '0',
|
||||
freeze: res.freeze || '0',
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
@ -448,58 +226,14 @@ const initData = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
// 计算扣除明细
|
||||
const calculateWithdraw = () => {
|
||||
const amount = parseFloat(withdrawAmount.value) || 0
|
||||
if (amount <= 0) {
|
||||
calculatedData.value = []
|
||||
return
|
||||
}
|
||||
|
||||
const results: CalculatedItem[] = []
|
||||
let remaining = amount
|
||||
|
||||
for (const feeType of feeOrder.value) {
|
||||
const field = feeFieldMap[feeType]
|
||||
if (!field) continue
|
||||
|
||||
// 获取原始值(特殊处理 available)
|
||||
let original: number
|
||||
if (field === 'available') {
|
||||
original = availableBalance.value
|
||||
} else {
|
||||
original = parseFloat(walletInfo.value[field] || '0')
|
||||
}
|
||||
|
||||
if (original <= 0) continue
|
||||
|
||||
const deducted = Math.min(remaining, original).toFixed(2)
|
||||
const newRemaining = Math.max(0, remaining - original)
|
||||
|
||||
results.push({
|
||||
type: feeType,
|
||||
typeLabel: feeLabelMap[feeType] || feeType,
|
||||
original: original.toFixed(2),
|
||||
deducted: deducted,
|
||||
remaining: Math.max(0, original - parseFloat(deducted)).toFixed(2),
|
||||
})
|
||||
|
||||
remaining = newRemaining
|
||||
if (remaining <= 0) break
|
||||
}
|
||||
|
||||
calculatedData.value = results
|
||||
}
|
||||
|
||||
// 快捷金额
|
||||
const handleQuickAmount = (amount: string) => {
|
||||
withdrawAmount.value = amount
|
||||
calculateWithdraw()
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const handleUpdateVisible = (val: boolean) => {
|
||||
emit('update:visible', val)
|
||||
// Dialog 关闭事件(不带参数)
|
||||
const handleCloseDialog = () => {
|
||||
emit('update:visible', false)
|
||||
}
|
||||
|
||||
// 取消
|
||||
|
|
@ -516,50 +250,17 @@ const handleBack = () => {
|
|||
// 下一步
|
||||
const handleNextStep = () => {
|
||||
const amount = parseFloat(withdrawAmount.value)
|
||||
if (!withdrawAmount.value || amount <= 0) {
|
||||
if (!withdrawAmount.value || isNaN(amount) || amount <= 0) {
|
||||
ElMessage.warning('请输入取款金额')
|
||||
return
|
||||
}
|
||||
|
||||
if (amount > totalWalletBalance.value) {
|
||||
ElMessage.warning(`输入金额不能超过最大可取金额 ${totalWalletBalance.value.toFixed(2)}`)
|
||||
const maxBalance = parseFloat(walletBalance.value)
|
||||
if (amount > maxBalance) {
|
||||
ElMessage.warning(`输入金额不能超过钱包余额 ${walletBalance.value}`)
|
||||
return
|
||||
}
|
||||
|
||||
// 清空所有费用字段
|
||||
formData.value.withdraw_fee_handle = '0'
|
||||
formData.value.withdraw_point_diff = '0'
|
||||
formData.value.withdraw_service_fee = '0'
|
||||
formData.value.withdraw_risk_fee = '0'
|
||||
formData.value.withdraw_head_fee = '0'
|
||||
formData.value.withdraw_blance = '0'
|
||||
|
||||
// 根据当前角色的费用项顺序填充表单数据
|
||||
for (const feeType of feeOrder.value) {
|
||||
const deducted = calculatedData.value.find(item => item.type === feeType)?.deducted || '0'
|
||||
|
||||
switch (feeType) {
|
||||
case '手续费':
|
||||
formData.value.withdraw_fee_handle = deducted
|
||||
break
|
||||
case '点差':
|
||||
formData.value.withdraw_point_diff = deducted
|
||||
break
|
||||
case '服务费':
|
||||
formData.value.withdraw_service_fee = deducted
|
||||
break
|
||||
case '风险金':
|
||||
formData.value.withdraw_risk_fee = deducted
|
||||
break
|
||||
case '盈亏':
|
||||
formData.value.withdraw_head_fee = deducted
|
||||
break
|
||||
case '可用余额':
|
||||
formData.value.withdraw_blance = deducted
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
currentStep.value = 2
|
||||
}
|
||||
|
||||
|
|
@ -577,75 +278,30 @@ const handleSubmit = async () => {
|
|||
const params: any = {
|
||||
channel_id: props.channelId,
|
||||
amount: +withdrawAmount.value,
|
||||
withdraw_address: formData.value.withdraw_address,
|
||||
}
|
||||
|
||||
// 根据当前角色的费用项顺序添加对应的费用参数
|
||||
for (const feeType of feeOrder.value) {
|
||||
switch (feeType) {
|
||||
case '手续费':
|
||||
params.withdraw_fee_handle = formData.value.withdraw_fee_handle
|
||||
break
|
||||
case '点差':
|
||||
params.withdraw_point_diff = formData.value.withdraw_point_diff
|
||||
break
|
||||
case '服务费':
|
||||
params.withdraw_service_fee = formData.value.withdraw_service_fee
|
||||
break
|
||||
case '风险金':
|
||||
params.withdraw_risk_fee = formData.value.withdraw_risk_fee
|
||||
break
|
||||
case '盈亏':
|
||||
params.withdraw_head_fee = formData.value.withdraw_head_fee
|
||||
break
|
||||
case '可用余额':
|
||||
params.withdraw_blance = formData.value.withdraw_blance
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (isAgent.value) {
|
||||
// 用户取款 - 根据渠道类型处理字段
|
||||
if (isCryptoChannel.value) {
|
||||
// 加密货币渠道 - 只传钱包地址,其他字段默认 --
|
||||
params.beneficiary_name = '--'
|
||||
params.beneficiary_enname = '--'
|
||||
params.beneficiary_bank_name = '--'
|
||||
params.beneficiary_bank_account = '--'
|
||||
} else if (isBankChannel.value) {
|
||||
// 银行渠道 - 传银行相关字段
|
||||
params.beneficiary_name = formData.value.beneficiary_name
|
||||
params.beneficiary_enname = formData.value.beneficiary_enname
|
||||
params.beneficiary_bank_name = formData.value.beneficiary_bank_name
|
||||
params.beneficiary_bank_account = formData.value.beneficiary_bank_account
|
||||
// 银行渠道不需要钱包地址
|
||||
params.withdraw_address = '--'
|
||||
}
|
||||
// 统一默认 -- 的字段
|
||||
if (isCryptoChannel.value) {
|
||||
// 加密货币渠道 - 只传钱包地址,其他字段默认 --
|
||||
params.withdraw_address = formData.value.withdraw_address
|
||||
params.beneficiary_name = '--'
|
||||
params.beneficiary_enname = '--'
|
||||
params.beneficiary_bank_name = '--'
|
||||
params.beneficiary_bank_account = '--'
|
||||
params.swift_bic_code = '--'
|
||||
params.beneficiary_bank_address = '--'
|
||||
} else if (isBankChannel.value) {
|
||||
// 银行渠道 - 传银行相关字段,不需要钱包地址
|
||||
params.withdraw_address = '--'
|
||||
params.beneficiary_name = formData.value.beneficiary_name
|
||||
params.beneficiary_enname = formData.value.beneficiary_enname
|
||||
params.beneficiary_bank_name = formData.value.beneficiary_bank_name
|
||||
params.beneficiary_bank_account = formData.value.beneficiary_bank_account
|
||||
params.swift_bic_code = '--'
|
||||
params.beneficiary_bank_address = '--'
|
||||
|
||||
await withdraw(params)
|
||||
} else {
|
||||
// 代理取款 - 所有未展示字段默认传 --
|
||||
|
||||
if (isBankChannel.value) {
|
||||
params.withdraw_address = '--'
|
||||
params.beneficiary_name = formData.value.beneficiary_name
|
||||
params.beneficiary_enname = formData.value.beneficiary_enname
|
||||
params.beneficiary_bank_name = formData.value.beneficiary_bank_name
|
||||
params.beneficiary_bank_account = formData.value.beneficiary_bank_account
|
||||
} else {
|
||||
params.beneficiary_name = '--'
|
||||
params.beneficiary_enname = '--'
|
||||
params.beneficiary_bank_name = '--'
|
||||
params.beneficiary_bank_account = '--'
|
||||
params.swift_bic_code = '--'
|
||||
params.beneficiary_bank_address = '--'
|
||||
}
|
||||
await agentWithdraw(params)
|
||||
}
|
||||
|
||||
await withdraw(params)
|
||||
|
||||
ElMessage.success('取款申请已提交')
|
||||
dialogVisible.value = false
|
||||
emit('update:visible', false)
|
||||
|
|
@ -660,187 +316,62 @@ const handleSubmit = async () => {
|
|||
|
||||
<style scoped lang="scss">
|
||||
.step1-container {
|
||||
.section-label {
|
||||
margin-bottom: 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
}
|
||||
|
||||
.wallet-section {
|
||||
margin-bottom: 20px;
|
||||
padding: 16px;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border-radius: 8px;
|
||||
color: #fff;
|
||||
|
||||
.section-label {
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.wallet-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.wallet-item {
|
||||
.wallet-balance {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 12px;
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
border-radius: 6px;
|
||||
align-items: baseline;
|
||||
padding: 16px 20px;
|
||||
margin-bottom: 20px;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border-radius: 8px;
|
||||
color: #fff;
|
||||
|
||||
.wallet-label {
|
||||
margin-bottom: 6px;
|
||||
font-size: 12px;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
margin-right: 8px;
|
||||
font-size: 14px;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
}
|
||||
|
||||
.wallet-value {
|
||||
font-size: 18px;
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.amount-section {
|
||||
margin-bottom: 16px;
|
||||
|
||||
.section-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
|
||||
.max-balance {
|
||||
margin-left: 8px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
font-weight: normal;
|
||||
.wallet-currency {
|
||||
margin-left: 6px;
|
||||
font-size: 14px;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
}
|
||||
}
|
||||
|
||||
.amount-error {
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
color: #f56c6c;
|
||||
}
|
||||
}
|
||||
.amount-section {
|
||||
margin-bottom: 16px;
|
||||
|
||||
.total-section {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16px;
|
||||
margin-bottom: 16px;
|
||||
background: #fef0f0;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #fde2e2;
|
||||
|
||||
.total-label {
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.total-value {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #f56c6c;
|
||||
}
|
||||
}
|
||||
|
||||
.calculation-section {
|
||||
margin-bottom: 24px;
|
||||
|
||||
.section-label {
|
||||
margin-bottom: 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.calculation-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.calc-item {
|
||||
padding: 16px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
.calc-type {
|
||||
margin-bottom: 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.calc-values {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.calc-original,
|
||||
.calc-deducted,
|
||||
.calc-remaining {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.label {
|
||||
margin-bottom: 4px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
.section-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
|
||||
&.deducted {
|
||||
color: #f56c6c;
|
||||
.max-balance {
|
||||
margin-left: 8px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.calc-summary {
|
||||
.quick-amounts {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 16px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid #ebeef5;
|
||||
|
||||
.label {
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.total-value {
|
||||
margin-left: 8px;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: #f56c6c;
|
||||
}
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.quick-amounts {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ export const withdrawCheckTableColumns = [
|
|||
{ prop: 'real_amount', label: '到账金额', align: 'center' as const, width: 120, isNumber: true },
|
||||
{ prop: 'rate', label: '汇率', align: 'center' as const, width: 100 },
|
||||
{ prop: 'channel_name', label: '渠道', align: 'center' as const, width: 140 },
|
||||
{ prop: 'withdraw_service_fee', label: '服务费', align: 'center' as const, width: 100, isNumber: true },
|
||||
{ prop: 'withdraw_head_fee', label: '头寸', align: 'center' as const, width: 120, isNumber: true },
|
||||
{ prop: 'withdraw_fee_handle', label: '代理手续费', align: 'center' as const, width: 120, isNumber: true },
|
||||
{ prop: 'withdraw_point_diff', label: '点差', align: 'center' as const, width: 100, isNumber: true },
|
||||
{ prop: 'withdraw_risk_fee', label: '风控费', align: 'center' as const, isNumber: true , width: 180},
|
||||
// { prop: 'withdraw_service_fee', label: '服务费', align: 'center' as const, width: 100, isNumber: true },
|
||||
// { prop: 'withdraw_head_fee', label: '头寸', align: 'center' as const, width: 120, isNumber: true },
|
||||
// { prop: 'withdraw_fee_handle', label: '代理手续费', align: 'center' as const, width: 120, isNumber: true },
|
||||
// { prop: 'withdraw_point_diff', label: '点差', align: 'center' as const, width: 100, isNumber: true },
|
||||
// { prop: 'withdraw_risk_fee', label: '风控费', align: 'center' as const, isNumber: true , width: 180},
|
||||
{ prop: 'withdraw_address', label: '提现地址', align: 'center' as const, width: 180},
|
||||
{ prop: 'beneficiary_bank_account', label: '银行账号', align: 'center' as const, width: 180},
|
||||
{ prop: 'beneficiary_bank_name', label: '银行名称', align: 'center' as const, width: 180},
|
||||
|
|
|
|||
|
|
@ -136,11 +136,11 @@ const tagType = computed<'danger' | 'success' | 'warning' | 'primary'>(() => {
|
|||
|
||||
const cardData = ref([
|
||||
{ label: '总金额', value: '0', icon: markRaw(Money) },
|
||||
{ label: '盈利', value: '0', icon: markRaw(Trophy) },
|
||||
{ label: '手续费佣金', value: '0', icon: markRaw(Coin) },
|
||||
{ label: '可提现点差佣金', value: '0', icon: markRaw(Wallet) },
|
||||
// { label: '盈利', value: '0', icon: markRaw(Trophy) },
|
||||
// { label: '手续费佣金', value: '0', icon: markRaw(Coin) },
|
||||
// { label: '可提现点差佣金', value: '0', icon: markRaw(Wallet) },
|
||||
{ label: '冻结点差佣金', value: '0', icon: markRaw(Lock) },
|
||||
{ label: '服务费', value: '0', icon: markRaw(DataAnalysis) },
|
||||
// { label: '服务费', value: '0', icon: markRaw(DataAnalysis) },
|
||||
{ label: '保证金', value: '0', icon: markRaw(TrendCharts) }
|
||||
])
|
||||
|
||||
|
|
|
|||
|
|
@ -152,8 +152,8 @@ const handleTableDataAfterLoad = () => {
|
|||
const targetRow = savedId ? tableData.value.find((item) => item.id === savedId) : null
|
||||
const rowToSelect = targetRow || tableData.value[0]
|
||||
|
||||
// 仅设置当前行,由 el-table 的 current-change 事件触发 handleCurrentChange,避免重复请求详情接口
|
||||
setCurrent(rowToSelect)
|
||||
handleCurrentChange(rowToSelect)
|
||||
}
|
||||
|
||||
// 获取详情数据
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ export const tableColumns = [
|
|||
{ prop: 'real_currency_symbol', label: '到账币种', align: 'center' as const, width: 100 },
|
||||
{ prop: 'real_amount', label: '到账金额', align: 'center' as const, width: 120, isNumber: true },
|
||||
{ prop: 'channel_name', label: '渠道', align: 'center' as const, width: 140 },
|
||||
{ prop: 'withdraw_service_fee', label: '服务费', align: 'center' as const, width: 100, isNumber: true },
|
||||
{ prop: 'withdraw_head_fee', label: '头寸', align: 'center' as const, width: 120, isNumber: true },
|
||||
{ prop: 'withdraw_fee_handle', label: '代理手续费', align: 'center' as const, width: 120, isNumber: true },
|
||||
{ prop: 'withdraw_point_diff', label: '点差', align: 'center' as const, width: 100, isNumber: true },
|
||||
{ prop: 'withdraw_risk_fee', label: '风控费', width: 140, align: 'center' as const, isNumber: true },
|
||||
{ prop: 'withdraw_blance', label: '余额费用', align: 'center' as const, width: 180},
|
||||
// { prop: 'withdraw_service_fee', label: '服务费', align: 'center' as const, width: 100, isNumber: true },
|
||||
// { prop: 'withdraw_head_fee', label: '头寸', align: 'center' as const, width: 120, isNumber: true },
|
||||
// { prop: 'withdraw_fee_handle', label: '代理手续费', align: 'center' as const, width: 120, isNumber: true },
|
||||
// { prop: 'withdraw_point_diff', label: '点差', align: 'center' as const, width: 100, isNumber: true },
|
||||
// { prop: 'withdraw_risk_fee', label: '风控费', width: 140, align: 'center' as const, isNumber: true },
|
||||
// { prop: 'withdraw_blance', label: '余额费用', align: 'center' as const, width: 180},
|
||||
{ prop: 'withdraw_address', label: '提现地址', width: 140, align: 'center' as const },
|
||||
{
|
||||
prop: 'status', label: '状态', align: 'center' as const, width: 140, options: [{
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const marketTableColumns = [
|
|||
{ label: '接单状态', prop: 'market_status', align: 'center' as const, width: '120px' },
|
||||
//基本账户
|
||||
{ label: '基本账户', prop: 'basicAccount', align: 'center' as const, isNumber: true , width: '200px' },
|
||||
{ label: '冻结点差', prop: 'freeze', align: 'center' as const, isNumber: true , width: '200px' },
|
||||
// { label: '冻结点差', prop: 'freeze', align: 'center' as const, isNumber: true , width: '200px' },
|
||||
//保证金
|
||||
{ label: '保证金', prop: 'margin', align: 'center' as const, width: '200px', isNumber: true },
|
||||
//停止接单保证金
|
||||
|
|
@ -41,21 +41,21 @@ export const marketTableColumns = [
|
|||
//头寸比率
|
||||
{ label: '头寸比率', prop: 'positionRatio', align: 'center' as const, width: '150px', isNumber: true },
|
||||
//点差返佣
|
||||
{ label: '点差返佣', prop: 'pointSpreadCommission', align: 'center' as const, width: '200px', isNumber: true },
|
||||
// { label: '点差返佣', prop: 'pointSpreadCommission', align: 'center' as const, width: '200px', isNumber: true },
|
||||
//点差
|
||||
{ label: '点差', slotName: 'pointSpread', align: 'center' as const, width: '150px' },
|
||||
//手续费比例
|
||||
{ label: '手续费比例', prop: 'commissionRatio', align: 'center' as const, width: '150px', isNumber: true },
|
||||
//手续费返佣
|
||||
{ label: '手续费返佣', prop: 'commissionReturn', align: 'center' as const, width: '150px', isNumber: true },
|
||||
// { label: '手续费返佣', prop: 'commissionReturn', align: 'center' as const, width: '150px', isNumber: true },
|
||||
//浮动盈亏
|
||||
{ label: '浮动盈亏', slotName: 'floatProfitLoss', align: 'center' as const, width: '100px', isNumber: true },
|
||||
//平仓盈亏
|
||||
{ label: '平仓盈亏', prop: 'closeProfitLoss', align: 'center' as const, width: '150px', isNumber: true },
|
||||
//风险金
|
||||
{ label: '风险金', prop: 'riskMargin', align: 'center' as const, width: '150px', isNumber: true },
|
||||
//服务费
|
||||
{ label: '服务费', prop: 'serviceFee', align: 'center' as const, width: '150px', isNumber: true },
|
||||
// { label: '风险金', prop: 'riskMargin', align: 'center' as const, width: '150px', isNumber: true },
|
||||
// //服务费
|
||||
// { label: '服务费', prop: 'serviceFee', align: 'center' as const, width: '150px', isNumber: true },
|
||||
]
|
||||
|
||||
//做市商添加配置
|
||||
|
|
|
|||
Loading…
Reference in New Issue