From c24f01e317c68e8d490af53210cee83d46297e20 Mon Sep 17 00:00:00 2001
From: jhzh <1628036192@qq.com>
Date: Sun, 06 Jul 2025 15:33:16 +0800
Subject: [PATCH] 1

---
 src/views/position/components/financing-flat.vue |  604 +++++++++++++++++++++++++-----------------------------
 1 files changed, 275 insertions(+), 329 deletions(-)

diff --git a/src/views/position/components/financing-flat.vue b/src/views/position/components/financing-flat.vue
index 411a138..38f3fd6 100644
--- a/src/views/position/components/financing-flat.vue
+++ b/src/views/position/components/financing-flat.vue
@@ -19,8 +19,7 @@
                   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>
@@ -30,11 +29,6 @@
             <a-col :md="12" :lg="6" :sm="24">
               <a-form-item label="用户Id">
                 <a-input v-model="queryParam.userId" style="width: 100%" placeholder="请输入用户Id" />
-              </a-form-item>
-            </a-col>
-            <a-col :md="12" :lg="6" :sm="24">
-              <a-form-item label="手机号">
-                <a-input v-model="queryParam.phone" style="width: 100%" placeholder="请输入手机号" />
               </a-form-item>
             </a-col>
             <a-col :md="12" :lg="6" :sm="24">
@@ -51,8 +45,7 @@
                   style="width: 100%"
                   v-model="times"
                   @change="onChangeRangeDate"
-                  format="YYYY-MM-DD HH:mm:ss"
-                >
+                  format="YYYY-MM-DD HH:mm:ss">
                 </a-range-picker>
               </a-form-item>
             </a-col>
@@ -60,13 +53,13 @@
             <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>
@@ -82,30 +75,20 @@
       :columns="columns"
       :data-source="datalist"
       rowKey="id"
-      :scroll="{ x: 2800 }"
-    >
-      <span slot="stockName" slot-scope="text, record">
+      :scroll="{ x: 2800 }">
+      <span slot="stockName" slot-scope="text,record">
         <template>
           <div>
-            <span style="margin-right: 10px">{{ record.stockName }}</span>
+            <span style="margin-right:10px">{{ record.stockName }}</span>
             <a-tag
-              :color="
-                record.stockPlate == '科创'
-                  ? 'blue'
-                  : !record.stockPlate
-                  ? 'orange'
-                  : record.stockPlate == '创业'
-                  ? 'pink'
-                  : 'purple'
-              "
-            >
-              {{ record.stockPlate == '科创' ? '科创' : !record.stockPlate ? '股票' : record.stockPlate }}
+              :color="record.stockPlate == '科创' ? 'blue' : !record.stockPlate ? 'orange' : record.stockPlate == '创业' ? 'pink' : 'purple'">
+              {{ record.stockPlate == '科创' ? '科创' : !record.stockPlate ? 'A股' : record.stockPlate }}
             </a-tag>
             <p>({{ record.stockCode }})</p>
           </div>
         </template>
       </span>
-      <span slot="positionType" slot-scope="text, record">
+      <span slot="positionType" slot-scope="text,record">
         <template>
           <div>
             <a-tag :color="record.positionType == 1 ? 'blue' : 'green'">
@@ -114,7 +97,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'">
@@ -142,10 +125,8 @@
           </div>
         </template>
       </span>
-      <template slot="action" slot-scope="text, record">
+      <template slot="action" slot-scope="text,record">
         <a slot="action" href="javascript:;" @click="getFlatdetails(record)">查看详情</a>
-        <a-divider type="vertical" />
-        <a slot="action" href="javascript:;" @click="getDelflat(record.id)">删除</a>
       </template>
     </a-table>
     <a-modal title="融资详情" :width="1000" :visible="finacingDialog" :footer="false" @cancel="finacingDialog = false">
@@ -155,16 +136,7 @@
         </a-descriptions-item>
         <a-descriptions-item label="股票类型">
           <a-tag
-            :color="
-              clickitem.stockPlate == '科创'
-                ? 'blue'
-                : !clickitem.stockPlate
-                ? 'orange'
-                : clickitem.stockPlate == '创业'
-                ? 'pink'
-                : 'purple'
-            "
-          >
+            :color="clickitem.stockPlate == '科创' ? 'blue' : !clickitem.stockPlate ? 'orange' : clickitem.stockPlate == '创业' ? 'pink' : 'purple'">
             {{ clickitem.stockPlate == '科创' ? '科创' : !clickitem.stockPlate ? 'A股' : clickitem.stockPlate }}
           </a-tag>
         </a-descriptions-item>
@@ -184,20 +156,14 @@
           </span>
         </a-descriptions-item>
         <a-descriptions-item label="总盈亏">
-          <span :class="clickitem.allProfitAndLose > 0 ? 'reds' : clickitem.allProfitAndLose < 0 ? 'greens' : ''">
+          <span
+            :class="clickitem.allProfitAndLose > 0 ? 'reds' : clickitem.allProfitAndLose < 0 ? 'greens' : ''">
             {{ clickitem.allProfitAndLose }}
           </span>
         </a-descriptions-item>
         <a-descriptions-item label="当前价格" v-if="clickitem.now_price">
           <span
-            :class="
-              clickitem.now_price - clickitem.buyOrderPrice > 0
-                ? 'reds'
-                : clickitem.now_price - clickitem.buyOrderPrice < 0
-                ? 'greens'
-                : ''
-            "
-          >
+            :class="clickitem.now_price - clickitem.buyOrderPrice > 0 ? 'reds' : clickitem.now_price - clickitem.buyOrderPrice < 0 ? 'greens' : ''">
             {{ clickitem.now_price }}
           </span>
         </a-descriptions-item>
@@ -278,297 +244,277 @@
   </div>
 </template>
 <script>
-import { positionlist, positiondel } from '@/api/position'
-import { nextagent } from '@/api/home'
+import { positionlist } from '@/api/position'
+import { agentgetSecondAgent } from '@/api/home'
 import moment from 'moment'
 export default {
-  name: 'Financingflat',
-  data() {
-    return {
-      columns: [
-        {
-          title: '融资名称',
-          dataIndex: 'stockName',
-          align: 'center',
-          width: 180,
-          scopedSlots: { customRender: 'stockName' },
-        },
-        {
-          title: '账户类型',
-          dataIndex: 'positionType',
-          align: 'center',
-          scopedSlots: { customRender: 'positionType' },
-        },
-        {
-          title: '用户名称(ID)',
-          dataIndex: 'nickName',
-          align: 'center',
-          customRender: (text, row, index) => {
-            return `${row.nickName}(${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: 'sellOrderPrice',
-          align: 'center',
-          customRender: (text, row, index) => {
-            return text.toFixed(2)
-          },
-        },
-        {
-          title: '浮动盈亏',
-          dataIndex: 'profitAndLose',
-          align: 'center',
-          scopedSlots: { customRender: 'profitAndLose' },
-        },
-        {
-          title: '总盈亏',
-          dataIndex: 'allProfitAndLose',
-          align: 'center',
-          scopedSlots: { customRender: 'allProfitAndLose' },
-        },
-        {
-          title: '数量(股)',
-          dataIndex: 'orderNum',
-          align: 'center',
-        },
+    name: 'Financingflat',
+    data () {
+        return {
+            columns: [
+                {
+                    title: '融资名称',
+                    dataIndex: 'stockName',
+                    align: 'center',
+                    width: 180,
+                    scopedSlots: { customRender: 'stockName' }
+                },
+                {
+                    title: '账户类型',
+                    dataIndex: 'positionType',
+                    align: 'center',
+                    scopedSlots: { customRender: 'positionType' }
+                },
+                {
+                    title: '代理',
+                    dataIndex: 'agentName',
+                    align: 'center',
+                //     customRender: (text, row, index) => {
+                //         return `${row.nickName}(${row.userId})`
+                //     }
+                
+                },
+                {
+                    title: '手机号',
+                    dataIndex: 'phone',
+                    align: 'center',
+                    // customRender: (text, row, index) => {
+                    //     return `${row.nickName}(${row.userId})`
+                    // }
+                
+                },
+                {
+                    title: '用户名称(ID)',
+                    dataIndex: 'nickName',
+                    align: 'center',
+                    customRender: (text, row, index) => {
+                        return `${row.nickName}(${row.userId})`
+                    }
 
-        {
-          title: '账号',
-          dataIndex: 'phone',
-          align: 'center',
-        },
-        {
-          title: '所属代理(ID)',
-          dataIndex: 'agentName_Id',
-          align: 'center',
-          customRender: (text, row, index) => {
-            return `${row.agentName}(${row.agentId})`
-          },
-        },
-        {
-          title: '总市值',
-          dataIndex: 'orderTotalPrice',
-          align: 'center',
-        },
-        {
-          title: '杠杆倍数',
-          dataIndex: 'orderLever',
-          align: 'center',
-        },
-        {
-          title: '手续费',
-          dataIndex: 'orderFee',
-          align: 'center',
-        },
-        {
-          title: '印花税',
-          dataIndex: 'orderSpread',
-          align: 'center',
-        },
-        {
-          title: '留仓费',
-          dataIndex: 'orderStayFee',
-          align: 'center',
-        },
-        {
-          title: '留仓天数',
-          dataIndex: 'orderStayDays',
-          align: 'center',
-        },
-        {
-          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: '卖出时间',
-          dataIndex: 'sellOrderTime',
-          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: '',
-        phone: '',
+                },
+                {
+                    title: '持仓订单号(ID)',
+                    dataIndex: 'positionSn',
+                    align: 'center',
+                    customRender: (text, row, index) => {
+                        return `${row.positionSn}(${row.id})`
+                    }
 
-        state: 1,
-        beginTime: '',
-        endTime: '',
-      },
-      datalist: [],
-      agentlist: [],
-      agentloading: false,
-      times: [],
-      finacingDialog: false,
-      clickitem: {},
-      agentqueryParam: {
-        pageNum: 1,
-        pageSize: 100,
-      },
-    }
-  },
-  created() {},
-  methods: {
-    getFlatdetails(item) {
-      this.clickitem = item
-      this.finacingDialog = true
-    },
-    getDelflat(val) {
-      var that = this
-      this.$confirm({
-        title: '提示',
-        content: '确认删除平仓单吗?此操作不可恢复',
-        onOk() {
-          var data = {
-            positionId: val,
-          }
-          positiondel(data).then((res) => {
-            if (res.status == 0) {
-              that.$message.success(res.msg)
-              that.getlist()
-            } else {
-              that.$message.error(res.msg)
+                },
+                {
+                    title: '买卖方向',
+                    dataIndex: 'orderDirection',
+                    align: 'center',
+                    scopedSlots: { customRender: 'orderDirection' }
+                },
+                {
+                    title: '买入价',
+                    dataIndex: 'buyOrderPrice',
+                    align: 'center',
+                    customRender: (text, row, index) => {
+                        return text.toFixed(2)
+                    }
+                },
+                {
+                    title: '卖出价',
+                    dataIndex: 'sellOrderPrice',
+                    align: 'center',
+                    customRender: (text, row, index) => {
+                        return text.toFixed(2)
+                    }
+                },
+                {
+                    title: '浮动盈亏',
+                    dataIndex: 'profitAndLose',
+                    align: 'center',
+                    scopedSlots: { customRender: 'profitAndLose' }
+                },
+                {
+                    title: '总盈亏',
+                    dataIndex: 'allProfitAndLose',
+                    align: 'center',
+                    scopedSlots: { customRender: 'allProfitAndLose' }
+                },
+                {
+                    title: '数量(股)',
+                    dataIndex: 'orderNum',
+                    align: 'center'
+                },
+                {
+                    title: '总市值',
+                    dataIndex: 'orderTotalPrice',
+                    align: 'center'
+                },
+                {
+                    title: '杠杆倍数',
+                    dataIndex: 'orderLever',
+                    align: 'center'
+                },
+                {
+                    title: '手续费',
+                    dataIndex: 'orderFee',
+                    align: 'center'
+                },
+                {
+                    title: '印花税',
+                    dataIndex: 'orderSpread',
+                    align: 'center'
+                },
+                {
+                    title: '留仓费',
+                    dataIndex: 'orderStayFee',
+                    align: 'center'
+                },
+                {
+                    title: '留仓天数',
+                    dataIndex: 'orderStayDays',
+                    align: 'center'
+                },
+                {
+                    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: '卖出时间',
+                    dataIndex: 'sellOrderTime',
+                    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: 1,
+                beginTime: '',
+                endTime: ''
+            },
+            datalist: [],
+            agentlist: [],
+            agentloading: false,
+            times: [],
+            finacingDialog: false,
+            clickitem: {},
+            agentqueryParam: {
+                pageNum: 1,
+                pageSize: 100
             }
-          })
+        }
+    },
+    created () {
+    },
+    methods: {
+        getFlatdetails (item) {
+            this.clickitem = item
+            this.finacingDialog = true
         },
-        onCancel() {
-          console.log('Cancel')
+        getinit () {
+            this.queryParam = {
+                pageNum: 1,
+                pageSize: 10,
+                positionType: '',
+                agentId: undefined,
+                userId: '',
+                positionSn: '',
+                state: 1,
+                beginTime: '',
+                endTime: ''
+            }
+            this.times = []
+            this.getlist()
         },
-      })
-    },
-    getinit() {
-      this.queryParam = {
-        pageNum: 1,
-        pageSize: 10,
-        positionType: '',
-        agentId: undefined,
-        userId: '',
-        positionSn: '',
-        phone: '',
-        state: 1,
-        beginTime: '',
-        endTime: '',
-      }
-      this.times = []
-      this.getlist()
-    },
-    onChangeRangeDate(value, dateString) {
-      this.queryParam.beginTime = dateString[0]
-      this.queryParam.endTime = dateString[1]
-    },
-    getqueryParam() {
-      this.queryParam = {
-        pageNum: 1,
-        pageSize: 10,
-        positionType: '',
-        phone: '',
-        agentId: undefined,
-        userId: '',
-        positionSn: '',
-        state: 1,
-        beginTime: '',
-        endTime: '',
-      }
-      this.times = []
-    },
-    getagentlist() {
-      var that = this
-      this.agentloading = true
-      nextagent(this.agentqueryParam).then((res) => {
-        this.agentlist = res.data.list
-        setTimeout(() => {
-          that.agentloading = false
-        }, 500)
-      })
-    },
-    getlist() {
-      var that = this
-      this.loading = true
-      positionlist(this.queryParam).then((res) => {
-        this.datalist = res.data.list
-        this.pagination.total = res.data.total
-        setTimeout(() => {
-          that.loading = false
-        }, 500)
-      })
-    },
-    onPageChange(page, pageSize) {
-      this.queryParam.pageNum = page
-      this.getlist()
-    },
-    onSizeChange(current, pageSize) {
-      this.queryParam.pageNum = current
-      this.queryParam.pageSize = pageSize
-      this.getlist()
-    },
-  },
+        onChangeRangeDate (value, dateString) {
+            this.queryParam.beginTime = dateString[0]
+            this.queryParam.endTime = dateString[1]
+        },
+        getqueryParam () {
+            this.queryParam = {
+                pageNum: 1,
+                pageSize: 10,
+                positionType: '',
+                agentId: undefined,
+                userId: '',
+                positionSn: '',
+                state: 1,
+                beginTime: '',
+                endTime: ''
+            }
+            this.times = []
+        },
+        getagentlist () {
+            var that = this
+            this.agentloading = true
+            agentgetSecondAgent(this.agentqueryParam).then(res => {
+                this.agentlist = res.data.list
+                setTimeout(() => {
+                    that.agentloading = false
+                }, 500)
+            })
+        },
+        getlist () {
+            var that = this
+            this.loading = true
+            positionlist(this.queryParam).then(res => {
+                this.datalist = res.data.list
+                this.pagination.total = res.data.total
+                setTimeout(() => {
+                    that.loading = false
+                }, 500)
+            })
+        },
+        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