From 55b003c2bf5d836057069c1101baf95f68987b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8?= Date: Fri, 12 Jun 2026 13:12:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/locales/zh-CN/index.ts | 4 +- .../withdraw/components/WithdrawDialog.vue | 182 +- src/views/dashboard/components/view/index.vue | 1635 +++++++++++------ src/views/user/Register.vue | 27 +- 4 files changed, 1198 insertions(+), 650 deletions(-) diff --git a/src/i18n/locales/zh-CN/index.ts b/src/i18n/locales/zh-CN/index.ts index 8d1f77a..4c66c34 100644 --- a/src/i18n/locales/zh-CN/index.ts +++ b/src/i18n/locales/zh-CN/index.ts @@ -138,8 +138,8 @@ export default { pointDiff: '点差佣金', service: '服务费', risk: '风险金', - profit: '头寸', - headPosition: '头寸', + profit: '盈亏', + headPosition: '盈亏', available: '可用余额', }, table: { diff --git a/src/views/capital/withdraw/components/WithdrawDialog.vue b/src/views/capital/withdraw/components/WithdrawDialog.vue index 37f6cbd..742a5d5 100644 --- a/src/views/capital/withdraw/components/WithdrawDialog.vue +++ b/src/views/capital/withdraw/components/WithdrawDialog.vue @@ -8,29 +8,9 @@
-
- {{ t('withdraw.wallet.feeHandling') }} - {{ walletInfo.commission_fee_handling || '0.00' }} -
-
- {{ t('withdraw.wallet.pointDiff') }} - {{ walletInfo.commission_point_diff || '0.00' }} -
-
- {{ t('withdraw.wallet.service') }} - {{ walletInfo.service || '0.00' }} -
-
- {{ t('withdraw.wallet.risk') }} - {{ walletInfo.risk || '0.00' }} -
-
- {{ t('withdraw.wallet.profit') }} - {{ walletInfo.closing_profit || '0.00' }} -
-
- {{ t('withdraw.wallet.available') }} - {{ availableBalance || '0.00' }} +
+ {{ item.label }} + {{ item.value }}
@@ -248,7 +228,7 @@ const isAgent = computed(() => roleId >= 5) // 当前货币类型(从渠道信息获取) const currentCurrency = computed(() => props.channelInfo?.currency?.symbol || '-') -// 计算可用余额 = amount - freeze - (手续费 + 点差 + 服务费 + 风险金 + 头寸) +// 计算可用余额 = amount - freeze - (手续费 + 点差 + 服务费 + 风险金 + 盈亏) const availableBalance = computed(() => { const amount = parseFloat(walletInfo.value.amount || '0') const freeze = parseFloat(walletInfo.value.freeze || '0') @@ -259,7 +239,7 @@ const availableBalance = computed(() => { Math.max(0, parseFloat(walletInfo.value.service || '0')) + Math.max(0, parseFloat(walletInfo.value.risk || '0')) + Math.max(0, parseFloat(walletInfo.value.closing_profit || '0')) - return Math.max(0, amount - freeze - walletSum) + return Math.max(0, amount - walletSum) }) // 计算钱包余额总和(用于验证输入金额上限) @@ -267,8 +247,9 @@ const availableBalance = computed(() => { const totalWalletBalance = computed(() => { const amount = parseFloat(walletInfo.value.amount || '0') const freeze = parseFloat(walletInfo.value.freeze || '0') + console.log('walletInfo.value:', walletInfo.value); - // 钱包余额总和(手续费 + 点差 + 服务费 + 风险金 + 头寸) + // 钱包余额总和(手续费 + 点差 + 服务费 + 风险金 + 盈亏) const walletSum = parseFloat(walletInfo.value.commission_fee_handling || '0') + parseFloat(walletInfo.value.commission_point_diff || '0') + @@ -279,49 +260,71 @@ const totalWalletBalance = computed(() => { if (roleId >= 5) { // roleId >= 5 时,总余额包含可用余额 // availableBalance = amount - freeze - walletSum - const availableBal = Math.max(0, amount - freeze - walletSum) + const availableBal = Math.max(0, amount - walletSum) return walletSum + availableBal } return walletSum }) -// 根据角色显示对应的费用项 -const showRiskFee = computed(() => [1].includes(roleId)) - -// 费用项顺序 -const feeOrder = computed(() => { - const orders: Record = { - 1: ['手续费', '点差', '服务费', '风险金', '头寸', '可用余额'], // 平台 - 2: ['手续费', '点差', '服务费', '可用余额'], // 承包商 - 3: ['手续费', '点差', '服务费', '头寸', '可用余额'], // 特殊做市商 - 4: ['手续费', '点差', '服务费', '头寸', '可用余额'], // 普通做市商 - 5: ['手续费', '点差', '可用余额'], // 代理 - 6: ['手续费', '点差', '可用余额'], // 用户 - } - return orders[roleId] ?? orders[6] ?? [] -}) - -// 费用项对应的字段 -const feeFieldMap: Record = { - '手续费': 'commission_fee_handling', - '点差': 'commission_point_diff', - '服务费': 'service', - '风险金': 'risk', - '头寸': 'closing_profit', - '可用余额': 'available', // 特殊处理,用 computed 计算 -} - // 费用项标签映射 const feeLabelMap: Record = { '手续费': '手续费佣金', '点差': '点差佣金', '服务费': '服务费', '风险金': '风险金', - '头寸': '头寸', + '盈亏': '盈亏', '可用余额': '可用余额', } +// 费用项对应的字段 +const feeFieldMap: Record = { + '手续费': 'commission_fee_handling', + '点差': 'commission_point_diff', + '服务费': 'service', + '风险金': 'risk', + '盈亏': 'closing_profit', + '可用余额': 'available', // 特殊处理,用 computed 计算 +} + +// 费用项顺序 +const feeOrder = computed(() => { + const orders: Record = { + 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({ user_id: '', @@ -523,13 +526,39 @@ const handleNextStep = () => { return } - // 填充表单数据 - formData.value.withdraw_fee_handle = calculatedData.value.find(item => item.type === '手续费')?.deducted || '0' - formData.value.withdraw_point_diff = calculatedData.value.find(item => item.type === '点差')?.deducted || '0' - formData.value.withdraw_service_fee = calculatedData.value.find(item => item.type === '服务费')?.deducted || '0' - formData.value.withdraw_risk_fee = calculatedData.value.find(item => item.type === '风险金')?.deducted || '0' - formData.value.withdraw_head_fee = calculatedData.value.find(item => item.type === '头寸')?.deducted || '0' - formData.value.withdraw_blance = calculatedData.value.find(item => item.type === '可用余额')?.deducted || '0' + // 清空所有费用字段 + 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 } @@ -548,14 +577,35 @@ const handleSubmit = async () => { const params: any = { channel_id: props.channelId, amount: +withdrawAmount.value, - withdraw_fee_handle: formData.value.withdraw_fee_handle, - withdraw_point_diff: formData.value.withdraw_point_diff, 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) { // 用户取款 - params.withdraw_blance = formData.value.withdraw_blance params.beneficiary_name = formData.value.beneficiary_name params.beneficiary_bank_name = formData.value.beneficiary_bank_name params.swift_bic_code = formData.value.swift_bic_code @@ -565,10 +615,6 @@ const handleSubmit = async () => { await withdraw(params) } else { // 代理取款 - params.withdraw_service_fee = formData.value.withdraw_service_fee - params.withdraw_head_fee = formData.value.withdraw_head_fee - params.withdraw_risk_fee = formData.value.withdraw_risk_fee - await agentWithdraw(params) } diff --git a/src/views/dashboard/components/view/index.vue b/src/views/dashboard/components/view/index.vue index 81be4cb..181b18e 100644 --- a/src/views/dashboard/components/view/index.vue +++ b/src/views/dashboard/components/view/index.vue @@ -1,278 +1,431 @@ diff --git a/src/views/user/Register.vue b/src/views/user/Register.vue index 0a17300..6c81166 100644 --- a/src/views/user/Register.vue +++ b/src/views/user/Register.vue @@ -65,7 +65,7 @@ @@ -87,8 +87,8 @@ v-model="registerForm.inviteCode" /> - - + 我已阅读并同意 隐私条例、 退款政策、 AML&CTF政策、
执行政策 和 网站条款和条件
@@ -108,6 +108,7 @@ defineOptions({ }) // type类型 import type { FormInstance, FormRules } from 'element-plus' +import { ElMessage } from 'element-plus' // 组件 import UserHeader from './components/Header.vue' import UserText from './components/Text.vue' @@ -155,12 +156,25 @@ const registerForm = ref({ password: '', code: '', inviteCode: '', + agreeAgreement: false, }) const registerRules = ref({ email: emailRules().email, phone: phoneRules(registerForm.value).phone, password: passwordRules(registerForm.value).password, code: codeRules().code, + agreeAgreement: [ + { + validator: (rule: any, value: any, callback: any) => { + if (!value) { + callback(new Error('请勾选同意注册协议')) + } else { + callback() + } + }, + trigger: 'change', + }, + ], }) //初始化验证码倒计时状态(添加页面前缀隔离不同页面的倒计时状态) @@ -215,6 +229,13 @@ const handleSendCode = async () => { //注册 const handleRegister = async () => { if (!registerFormRef.value) return + + // 先检查协议勾选状态 + if (!registerForm.value.agreeAgreement) { + ElMessage.error('请勾选同意注册协议') + return + } + try { // 提交时再次验证(显示错误提示) await registerFormRef.value.validate()