From 69ff731fbacf2f2ae16f98a355506bfeb01dd567 Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Sun, 07 Apr 2024 21:47:08 +0800
Subject: [PATCH] ne1
---
src/views/position/components/futures-hold.vue | 617 ++++++++++++++++++++++++++++---------------------------
1 files changed, 312 insertions(+), 305 deletions(-)
diff --git a/src/views/position/components/futures-hold.vue b/src/views/position/components/futures-hold.vue
index f396833..8bc85f1 100644
--- a/src/views/position/components/futures-hold.vue
+++ b/src/views/position/components/futures-hold.vue
@@ -19,7 +19,8 @@
v-model="queryParam.agentId"
placeholder="请选择下级代理"
@focus="getagentlist"
- :loading="agentloading">
+ :loading="agentloading"
+ >
<a-select-option v-for="(item, index) in agentlist" :key="index" :value="item.id">
{{ item.agentName }}
</a-select-option>
@@ -41,15 +42,14 @@
<a-col :md="12" :lg="6" :sm="24">
<a-form-item>
<span class="table-page-search-submitButtons">
- <a-button @click="getqueryParam" icon="redo">
- 重置</a-button>
+ <a-button @click="getqueryParam" icon="redo"> 重置</a-button>
<a-button
type="primary"
icon="search"
style="margin-left: 8px"
- @click="queryParam.pageNum = 1, getlist()">查询
+ @click=";(queryParam.pageNum = 1), getlist()"
+ >查询
</a-button>
-
</span>
</a-form-item>
</a-col>
@@ -64,9 +64,9 @@
:columns="columns"
:data-source="datalist"
rowKey="id"
- :scroll="{ x: 2800 }">
-
- <span slot="positionType" slot-scope="text,record">
+ :scroll="{ x: 2800 }"
+ >
+ <span slot="positionType" slot-scope="text, record">
<template>
<div>
<a-tag :color="record.positionType == 1 ? 'blue' : 'green'">
@@ -75,7 +75,7 @@
</div>
</template>
</span>
- <span slot="orderDirection" slot-scope="text,record">
+ <span slot="orderDirection" slot-scope="text, record">
<template>
<div>
<a-tag :color="record.orderDirection == '买涨' ? 'red' : 'green'">
@@ -84,43 +84,51 @@
</div>
</template>
</span>
- <span slot="nowPrice" slot-scope="text,record">
+ <span slot="nowPrice" slot-scope="text, record">
<template>
<div>
<p
- :class="Number(record.nowPrice) - record.buyOrderPrice < 0 ? 'greens' : Number(record.nowPrice) - record.buyOrderPrice > 0 ? 'reds' : ''">
+ :class="
+ Number(record.nowPrice) - record.buyOrderPrice < 0
+ ? 'greens'
+ : Number(record.nowPrice) - record.buyOrderPrice > 0
+ ? 'reds'
+ : ''
+ "
+ >
{{ Number(record.nowPrice).toFixed(2) }}
</p>
</div>
</template>
</span>
- <span slot="profitAndLose" slot-scope="text,record">
+ <span slot="profitAndLose" slot-scope="text, record">
<template>
<div>
- <p :class="text < 0 ? 'greens' : text > 0 ? 'reds' : ''">
- {{ text }}{{ record.coinCode }}
- </p>
+ <p :class="text < 0 ? 'greens' : text > 0 ? 'reds' : ''">{{ text }}{{ record.coinCode }}</p>
<P>≈{{ (record.profitAndLose * record.coinRate).toFixed(2) }} CNY</P>
</div>
</template>
</span>
- <span slot="allProfitAndLose" slot-scope="text,record">
+ <span slot="allProfitAndLose" slot-scope="text, record">
<template>
<div>
- <p :class="text < 0 ? 'greens' : text > 0 ? 'reds' : ''">
- {{ text }}{{ record.coinCode }}
- </p>
+ <p :class="text < 0 ? 'greens' : text > 0 ? 'reds' : ''">{{ text }}{{ record.coinCode }}</p>
<P>≈{{ (record.allProfitAndLose * record.coinRate).toFixed(2) }} CNY</P>
</div>
</template>
</span>
- <template slot="action" slot-scope="text,record">
+ <template slot="action" slot-scope="text, record">
<a
slot="action"
href="javascript:;"
- @click="Lockvisibledialig = true; clickpositionId = record.id"
- v-if="record.isLock == 0">锁仓</a>
+ @click="
+ Lockvisibledialig = true
+ clickpositionId = record.id
+ "
+ v-if="record.isLock == 0"
+ >锁仓</a
+ >
<a slot="action" href="javascript:;" @click="getLockopen(record.id)" v-else>解锁</a>
<a-divider type="vertical" />
<a slot="action" href="javascript:;" @click="getCompulsoryclosing(record.positionSn)">强制平仓</a>
@@ -132,12 +140,14 @@
:visible="Lockvisibledialig"
:confirmLoading="Lockvisibleloading"
@ok="getDialogok"
- @cancel="handleCancel">
+ @cancel="handleCancel"
+ >
<a-form :form="Lockvisibleform" ref="createModal">
<a-form-item>
<a-input
v-decorator="['lockMsg', { rules: [{ required: true, message: '请输入锁仓原因!', whitespace: true }] }]"
- placeholder="请输入锁仓原因!" />
+ placeholder="请输入锁仓原因!"
+ />
</a-form-item>
</a-form>
</a-modal>
@@ -148,303 +158,300 @@
import { nextagent } from '@/api/home'
import moment from 'moment'
export default {
- name: 'FuturesHold',
- data () {
- return {
- columns: [
- {
- title: '期货名称',
- dataIndex: 'futuresName',
- align: 'center',
- width: 180,
- customRender: (text, row, index) => {
- return `${row.futuresName}(${row.futuresCode})`
- }
- },
- {
- title: '账户类型',
- dataIndex: 'positionType',
- align: 'center',
- scopedSlots: { customRender: 'positionType' }
- },
- {
- title: '用户名称(ID)',
- dataIndex: 'realName',
- align: 'center',
- customRender: (text, row, index) => {
- return `${row.realName}(${row.userId})`
- }
-
- },
- {
- title: '持仓订单号(ID)',
- dataIndex: 'positionSn',
- align: 'center',
- customRender: (text, row, index) => {
- return `${row.positionSn}(${row.id})`
- }
-
- },
- {
- title: '买卖方向',
- dataIndex: 'orderDirection',
- align: 'center',
- scopedSlots: { customRender: 'orderDirection' }
- },
- {
- title: '买入点数',
- dataIndex: 'buyOrderPrice',
- align: 'center',
- customRender: (text, row, index) => {
- return text.toFixed(2)
- }
- },
- {
- title: '最新点数',
- dataIndex: 'nowPrice',
- align: 'center',
- scopedSlots: { customRender: 'nowPrice' }
- },
- {
- title: '保证金(CNY)',
- dataIndex: 'allDepositAmt',
- align: 'center'
- },
- {
- title: '浮动盈亏',
- dataIndex: 'profitAndLose',
- align: 'center',
- scopedSlots: { customRender: 'profitAndLose' }
- },
- {
- title: '总盈亏',
- dataIndex: 'allProfitAndLose',
- align: 'center',
- scopedSlots: { customRender: 'allProfitAndLose' }
- },
- {
- title: '数量(手)',
- dataIndex: 'orderNum',
- align: 'center'
- },
- {
- title: '每标准手',
- dataIndex: 'futuresStandard',
- align: 'center',
- customRender: (text, row, index) => {
- return row.futuresStandard + row.futuresUnit
- }
- },
- {
- title: '手续费',
- dataIndex: 'orderFee',
- align: 'center',
- customRender: (text, row, index) => {
- return `${row.orderFee} ${row.coinCode} ≈ ${(row.orderFee * row.coinRate).toFixed(2)} CNY`
- }
- },
- {
- title: '当前汇率',
- dataIndex: 'coinCode',
- align: 'center',
- customRender: (text, row, index) => {
- return `1${row.coinCode} ≈ ${row.coinRate}CNY`
- }
- },
- {
- title: '锁定原因',
- dataIndex: 'lockMsg',
- align: 'center'
- },
- {
- title: '买入时间',
- dataIndex: 'buyOrderTime',
- align: 'center',
- width: 180,
- customRender: (text, row, index) => {
- return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''
- }
- },
- {
- title: '操作',
- key: 'action',
- align: 'center',
- fixed: 'right',
- width: 150,
- scopedSlots: { customRender: 'action' }
- }
- ],
- // 表头
- pagination: {
- total: 0,
- pageSize: 10, // 每页中显示10条数据
- showSizeChanger: true,
- pageSizeOptions: ['10', '20', '50', '100'], // 每页中显示的数据
- onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize), // 改变每页数量时更新显示
- onChange: (page, pageSize) => this.onPageChange(page, pageSize), // 点击页码事件
- showTotal: total => `共有 ${total} 条数据` // 分页中显示总的数据
- },
- loading: false,
- queryParam: {
- pageNum: 1,
- pageSize: 10,
- positionType: '',
- agentId: undefined,
- userId: '',
- positionSn: '',
- state: 0
- },
- datalist: [],
- agentlist: [],
- agentloading: false,
- Lockvisibledialig: false,
- Lockvisibleloading: false,
- Lockvisibleform: this.$form.createForm(this),
- clickpositionId: '',
- agentqueryParam: {
- pageNum: 1,
- pageSize: 100
- }
- }
- },
- created () {
- },
- methods: {
- getCompulsoryclosing (val) {
- var that = this
- this.$confirm({
- title: '提示',
- content: '确认要强制平仓吗?',
- onOk () {
- var data = {
- positionSn: val
- }
- futurespositionsell(data).then(res => {
- if (res.status == 0) {
- that.$message.success({ content: res.msg, duration: 2 })
- that.getlist()
- } else {
- that.$message.error({ content: '平仓失败' })
- }
- })
- },
- onCancel () {
- console.log('Cancel')
- }
- })
+ name: 'FuturesHold',
+ data() {
+ return {
+ columns: [
+ {
+ title: '期货名称',
+ dataIndex: 'futuresName',
+ align: 'center',
+ width: 180,
+ customRender: (text, row, index) => {
+ return `${row.futuresName}(${row.futuresCode})`
+ },
},
- getLockopen (val) {
- var that = this
- this.$confirm({
- title: '提示',
- content: '确认要解锁该持仓单?',
- onOk () {
- var data = {
- state: 0,
- positionId: val
- }
- futurespositionlock(data).then(res => {
- if (res.status == 0) {
- that.$message.success({ content: res.msg, duration: 2 })
- that.getlist()
- } else {
- that.$message.error({ content: res.msg })
- }
- })
- },
- onCancel () {
- console.log('Cancel')
- }
- })
+ {
+ title: '账户类型',
+ dataIndex: 'positionType',
+ align: 'center',
+ scopedSlots: { customRender: 'positionType' },
},
- handleCancel () {
- this.Lockvisibledialig = false
- const form = this.$refs.createModal.form
- form.resetFields()
+ {
+ title: '用户名称(ID)',
+ dataIndex: 'realName',
+ align: 'center',
+ customRender: (text, row, index) => {
+ return `${row.realName}(${row.userId})`
+ },
},
- getDialogok () {
- const form = this.$refs.createModal.form
- form.validateFields((errors, values) => {
- if (!errors) {
- this.Lockvisibleloading = true
- var data = {
- state: 1,
- lockMsg: values.lockMsg,
- positionId: this.clickpositionId
- }
- futurespositionlock(data).then(res => {
- if (res.status == 0) {
- this.Lockvisibledialig = false
- this.$message.success({ content: res.msg, duration: 2 })
- form.resetFields()
- this.getlist()
- } else {
- this.$message.error({ content: res.msg })
- }
- this.Lockvisibleloading = false
- })
- }
- })
+ {
+ title: '持仓订单号(ID)',
+ dataIndex: 'positionSn',
+ align: 'center',
+ customRender: (text, row, index) => {
+ return `${row.positionSn}(${row.id})`
+ },
},
- getinit () {
- this.queryParam = {
- pageNum: 1,
- pageSize: 10,
- positionType: '',
- agentId: undefined,
- userId: '',
- positionSn: '',
- state: 0
- }
- this.getlist()
+ {
+ title: '买卖方向',
+ dataIndex: 'orderDirection',
+ align: 'center',
+ scopedSlots: { customRender: 'orderDirection' },
},
- getqueryParam () {
- this.queryParam = {
- pageNum: 1,
- pageSize: 10,
- positionType: '',
- agentId: undefined,
- userId: '',
- positionSn: '',
- state: 0
- }
+ {
+ title: '买入点数',
+ dataIndex: 'buyOrderPrice',
+ align: 'center',
+ customRender: (text, row, index) => {
+ return text.toFixed(2)
+ },
},
- getagentlist () {
- var that = this
- this.agentloading = true
- nextagent(this.agentqueryParam).then(res => {
- this.agentlist = res.data.list
- setTimeout(() => {
- that.agentloading = false
- }, 500)
- })
+ {
+ title: '最新点数',
+ dataIndex: 'nowPrice',
+ align: 'center',
+ scopedSlots: { customRender: 'nowPrice' },
},
- getlist () {
- this.loading = true
- futurespositionlist(this.queryParam).then(res => {
- this.datalist = res.data.list
- this.pagination.total = res.data.total
- this.loading = false
- })
+ {
+ title: '保证金(CNY)',
+ dataIndex: 'allDepositAmt',
+ align: 'center',
},
- onPageChange (page, pageSize) {
- this.queryParam.pageNum = page
- this.getlist()
+ {
+ title: '浮动盈亏',
+ dataIndex: 'profitAndLose',
+ align: 'center',
+ scopedSlots: { customRender: 'profitAndLose' },
},
- onSizeChange (current, pageSize) {
- this.queryParam.pageNum = current
- this.queryParam.pageSize = pageSize
- this.getlist()
- }
+ {
+ title: '总盈亏',
+ dataIndex: 'allProfitAndLose',
+ align: 'center',
+ scopedSlots: { customRender: 'allProfitAndLose' },
+ },
+ {
+ title: '数量(手)',
+ dataIndex: 'orderNum',
+ align: 'center',
+ },
+ {
+ title: '每标准手',
+ dataIndex: 'futuresStandard',
+ align: 'center',
+ customRender: (text, row, index) => {
+ return row.futuresStandard + row.futuresUnit
+ },
+ },
+ {
+ title: '手续费',
+ dataIndex: 'orderFee',
+ align: 'center',
+ customRender: (text, row, index) => {
+ return `${row.orderFee} ${row.coinCode} ≈ ${(row.orderFee * row.coinRate).toFixed(2)} CNY`
+ },
+ },
+ {
+ title: '当前汇率',
+ dataIndex: 'coinCode',
+ align: 'center',
+ customRender: (text, row, index) => {
+ return `1${row.coinCode} ≈ ${row.coinRate}CNY`
+ },
+ },
+ {
+ title: '锁定原因',
+ dataIndex: 'lockMsg',
+ align: 'center',
+ },
+ {
+ title: '买入时间',
+ dataIndex: 'buyOrderTime',
+ align: 'center',
+ width: 180,
+ customRender: (text, row, index) => {
+ return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''
+ },
+ },
+ {
+ title: '操作',
+ key: 'action',
+ align: 'center',
+ fixed: 'right',
+ width: 150,
+ scopedSlots: { customRender: 'action' },
+ },
+ ],
+ // 表头
+ pagination: {
+ total: 0,
+ pageSize: 10, // 每页中显示10条数据
+ showSizeChanger: true,
+ pageSizeOptions: ['10', '20', '50', '100'], // 每页中显示的数据
+ onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize), // 改变每页数量时更新显示
+ onChange: (page, pageSize) => this.onPageChange(page, pageSize), // 点击页码事件
+ showTotal: (total) => `共有 ${total} 条数据`, // 分页中显示总的数据
+ },
+ loading: false,
+ queryParam: {
+ pageNum: 1,
+ pageSize: 10,
+ positionType: '',
+ agentId: undefined,
+ userId: '',
+ positionSn: '',
+ state: 0,
+ },
+ datalist: [],
+ agentlist: [],
+ agentloading: false,
+ Lockvisibledialig: false,
+ Lockvisibleloading: false,
+ Lockvisibleform: this.$form.createForm(this),
+ clickpositionId: '',
+ agentqueryParam: {
+ pageNum: 1,
+ pageSize: 100,
+ },
}
+ },
+ created() {},
+ methods: {
+ getCompulsoryclosing(val) {
+ var that = this
+ this.$confirm({
+ title: '提示',
+ content: '确认要强制平仓吗?',
+ onOk() {
+ var data = {
+ positionSn: val,
+ }
+ futurespositionsell(data).then((res) => {
+ if (res.status == 0) {
+ that.$message.success(res.msg)
+ that.getlist()
+ } else {
+ that.$message.error({ content: '平仓失败' })
+ }
+ })
+ },
+ onCancel() {
+ console.log('Cancel')
+ },
+ })
+ },
+ getLockopen(val) {
+ var that = this
+ this.$confirm({
+ title: '提示',
+ content: '确认要解锁该持仓单?',
+ onOk() {
+ var data = {
+ state: 0,
+ positionId: val,
+ }
+ futurespositionlock(data).then((res) => {
+ if (res.status == 0) {
+ that.$message.success(res.msg)
+ that.getlist()
+ } else {
+ that.$message.error(res.msg)
+ }
+ })
+ },
+ onCancel() {
+ console.log('Cancel')
+ },
+ })
+ },
+ handleCancel() {
+ this.Lockvisibledialig = false
+ const form = this.$refs.createModal.form
+ form.resetFields()
+ },
+ getDialogok() {
+ const form = this.$refs.createModal.form
+ form.validateFields((errors, values) => {
+ if (!errors) {
+ this.Lockvisibleloading = true
+ var data = {
+ state: 1,
+ lockMsg: values.lockMsg,
+ positionId: this.clickpositionId,
+ }
+ futurespositionlock(data).then((res) => {
+ if (res.status == 0) {
+ this.Lockvisibledialig = false
+ this.$message.success(res.msg)
+ form.resetFields()
+ this.getlist()
+ } else {
+ this.$message.error(res.msg)
+ }
+ this.Lockvisibleloading = false
+ })
+ }
+ })
+ },
+ getinit() {
+ this.queryParam = {
+ pageNum: 1,
+ pageSize: 10,
+ positionType: '',
+ agentId: undefined,
+ userId: '',
+ positionSn: '',
+ state: 0,
+ }
+ this.getlist()
+ },
+ getqueryParam() {
+ this.queryParam = {
+ pageNum: 1,
+ pageSize: 10,
+ positionType: '',
+ agentId: undefined,
+ userId: '',
+ positionSn: '',
+ state: 0,
+ }
+ },
+ getagentlist() {
+ var that = this
+ this.agentloading = true
+ nextagent(this.agentqueryParam).then((res) => {
+ this.agentlist = res.data.list
+ setTimeout(() => {
+ that.agentloading = false
+ }, 500)
+ })
+ },
+ getlist() {
+ this.loading = true
+ futurespositionlist(this.queryParam).then((res) => {
+ this.datalist = res.data.list
+ this.pagination.total = res.data.total
+ this.loading = false
+ })
+ },
+ onPageChange(page, pageSize) {
+ this.queryParam.pageNum = page
+ this.getlist()
+ },
+ onSizeChange(current, pageSize) {
+ this.queryParam.pageNum = current
+ this.queryParam.pageSize = pageSize
+ this.getlist()
+ },
+ },
}
</script>
<style scoped>
.greens {
- color: #52c41a;
+ color: #52c41a;
}
.reds {
- color: #f5222d;
+ color: #f5222d;
}
</style>
--
Gitblit v1.9.3