From bb7ac9bf08d65289b32af8087743a55d1550966a Mon Sep 17 00:00:00 2001 From: tianyongbao Date: Wed, 12 Feb 2025 17:59:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8A=95=E8=B5=84=E4=BA=A4=E6=98=93?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=EF=BC=8C=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/invest/investAccountDeal/index.vue | 44 ++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/src/views/invest/investAccountDeal/index.vue b/src/views/invest/investAccountDeal/index.vue index d63ebd6..36ec528 100644 --- a/src/views/invest/investAccountDeal/index.vue +++ b/src/views/invest/investAccountDeal/index.vue @@ -60,7 +60,7 @@ - + @@ -72,10 +72,16 @@ - + - + + + + + + + @@ -99,6 +105,7 @@ import { } from '@/api/invest/accountDealRecord' // eslint-disable-next-line no-unused-vars import { listAccounts } from '@/api/invest/accounts' +import { getFutureStocks } from '@/api/invest/futureStocks' import dayjs from 'dayjs' import { require } from '@/utils/require' const { proxy } = getCurrentInstance() @@ -113,6 +120,9 @@ const single = ref(true) const multiple = ref(true) const total = ref(0) const title = ref('') +const futuresShow = ref(false) +//账户类型 +const accountType = ref(0) const accountList = ref([]) const operateList = ref([ { id: 'view', icon: 'View', title: '查看', hasPermi: ['invest:accountDealRecord:query'] }, @@ -141,6 +151,8 @@ const data = reactive({ accountId: [{ required: true, message: '投资账户不能为空', trigger: 'blur' }], amount: [{ required: true, message: '交易金额不能为空', trigger: 'blur' }], dealType: [{ required: true, message: '交易类型不能为空', trigger: 'change' }], + closedPosition: [{ required: true, message: '平仓盈亏不能为空', trigger: 'blur' }], + commission: [{ required: true, message: '手续费不能为空', trigger: 'blur' }], createTime: [{ required: true, message: '交易时间不能为空', trigger: 'blur' }] } }) @@ -163,6 +175,26 @@ const handleOperate = (operate, row) => { const { queryParams, queryAccountParams, queryAddAccountParams, form, rules } = toRefs(data) +const handleAccountChange = (accountId) => { + if (accountId != null && accountId != '') { + getFutureStocks(accountId).then((response) => { + const account = response.data + accountType.value = account.type + if (account.type == '1') { + futuresShow.value = true + form.value.amount = 0 + form.value.closedPosition = null + form.value.commission = null + } else { + futuresShow.value = false + form.value.amount = null + form.value.closedPosition = 0 + form.value.commission = 0 + } + }) + } +} + /** 查询账户管理列表 */ function getAccountList() { listAccounts(queryAccountParams.value).then((response) => { @@ -250,6 +282,7 @@ const handleView = (row) => { /** 新增按钮操作 */ function handleAdd() { reset() + futuresShow.value = false open.value = true title.value = '添加投资交易记录' } @@ -269,6 +302,11 @@ function handleUpdate(row) { function submitForm() { proxy.$refs.accountDealRecordRef.validate((valid) => { if (valid) { + //如果是期货,给备注 + if (accountType.value == '1') { + form.value.remark = '平仓盈亏' + form.value.closedPosition + ',手续费' + form.value.commission + form.value.amount = form.value.closedPosition - form.value.commission + } if (form.value.id != null) { updateAccountDealRecord(form.value).then((response) => { proxy.$modal.msgSuccess('修改成功')