大宝管理后台代码
ne1
zzzz
2024-04-07 69ff731fbacf2f2ae16f98a355506bfeb01dd567
src/views/position/components/financing-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,14 +64,23 @@
      :columns="columns"
      :data-source="datalist"
      rowKey="id"
      :scroll="{ x: 2800 }">
      :scroll="{ x: 2800 }"
    >
      <span slot="stockName" slot-scope="text,record">
        <template>
          <div>
            <span style="margin-right:10px">{{ record.stockName }}</span>
            <a-tag
              :color="record.stockPlate == '科创' ? 'blue' : !record.stockPlate ? 'orange' : record.stockPlate == '创业' ? 'pink' : 'purple'">
              :color="
                record.stockPlate == '科创'
                  ? 'blue'
                  : !record.stockPlate
                  ? 'orange'
                  : record.stockPlate == '创业'
                  ? 'pink'
                  : 'purple'
              "
            >
              {{ record.stockPlate == '科创' ? '科创' : !record.stockPlate ? '股票' : record.stockPlate }}
            </a-tag>
            <p>({{ record.stockCode }})</p>
@@ -100,7 +109,14 @@
        <template>
          <div>
            <p
              :class="Number(record.now_price) - record.buyOrderPrice < 0 ? 'greens' : Number(record.now_price) - record.buyOrderPrice > 0 ? 'reds' : ''">
              :class="
                Number(record.now_price) - record.buyOrderPrice < 0
                  ? 'greens'
                  : Number(record.now_price) - record.buyOrderPrice > 0
                  ? 'reds'
                  : ''
              "
            >
              {{ record.now_price }}
            </p>
          </div>
@@ -129,8 +145,13 @@
        <a
          slot="action"
          href="javascript:;"
          @click="Lockvisibledialog = true; clickpositionId = record.id"
          v-if="record.isLock == 0">锁仓</a>
          @click="
            Lockvisibledialog = 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>
@@ -142,12 +163,14 @@
      :visible="Lockvisibledialog"
      :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>
@@ -167,13 +190,13 @@
                    dataIndex: 'stockName',
                    align: 'center',
                    width: 180,
                    scopedSlots: { customRender: 'stockName' }
          scopedSlots: { customRender: 'stockName' },
                },
                {
                    title: '账户类型',
                    dataIndex: 'positionType',
                    align: 'center',
                    scopedSlots: { customRender: 'positionType' }
          scopedSlots: { customRender: 'positionType' },
                },
                {
                    title: '用户名称(ID)',
@@ -181,8 +204,7 @@
                    align: 'center',
                    customRender: (text, row, index) => {
                        return `${row.nickName}(${row.userId})`
                    }
          },
                },
                {
                    title: '持仓订单号(ID)',
@@ -190,14 +212,13 @@
                    align: 'center',
                    customRender: (text, row, index) => {
                        return `${row.positionSn}(${row.id})`
                    }
          },
                },
                {
                    title: '买卖方向',
                    dataIndex: 'orderDirection',
                    align: 'center',
                    scopedSlots: { customRender: 'orderDirection' }
          scopedSlots: { customRender: 'orderDirection' },
                },
                {
                    title: '买入价',
@@ -205,65 +226,65 @@
                    align: 'center',
                    customRender: (text, row, index) => {
                        return text.toFixed(2)
                    }
          },
                },
                {
                    title: '现价',
                    dataIndex: 'now_price',
                    align: 'center',
                    scopedSlots: { customRender: 'now_price' }
          scopedSlots: { customRender: 'now_price' },
                },
                {
                    title: '浮动盈亏',
                    dataIndex: 'profitAndLose',
                    align: 'center',
                    scopedSlots: { customRender: 'profitAndLose' }
          scopedSlots: { customRender: 'profitAndLose' },
                },
                {
                    title: '总盈亏',
                    dataIndex: 'allProfitAndLose',
                    align: 'center',
                    scopedSlots: { customRender: 'allProfitAndLose' }
          scopedSlots: { customRender: 'allProfitAndLose' },
                },
                {
                    title: '数量(股)',
                    dataIndex: 'orderNum',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '总市值',
                    dataIndex: 'orderTotalPrice',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '杠杆倍数',
                    dataIndex: 'orderLever',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '手续费',
                    dataIndex: 'orderFee',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '印花税',
                    dataIndex: 'orderSpread',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '留仓费',
                    dataIndex: 'orderStayFee',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '留仓天数',
                    dataIndex: 'orderStayDays',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '锁定原因',
                    dataIndex: 'lockMsg',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '买入时间',
@@ -272,7 +293,7 @@
                    width: 180,
                    customRender: (text, row, index) => {
                        return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''
                    }
          },
                },
                {
                    title: '操作',
@@ -280,8 +301,8 @@
                    align: 'center',
                    fixed: 'right',
                    width: 150,
                    scopedSlots: { customRender: 'action' }
                }
          scopedSlots: { customRender: 'action' },
        },
            ],
            // 表头
            pagination: {
@@ -291,7 +312,7 @@
                pageSizeOptions: ['10', '20', '50', '100'], // 每页中显示的数据
                onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize), // 改变每页数量时更新显示
                onChange: (page, pageSize) => this.onPageChange(page, pageSize), // 点击页码事件
                showTotal: total => `共有 ${total} 条数据` // 分页中显示总的数据
        showTotal: (total) => `共有 ${total} 条数据`, // 分页中显示总的数据
            },
            loading: false,
            queryParam: {
@@ -301,7 +322,7 @@
                agentId: undefined,
                userId: '',
                positionSn: '',
                state: 0
        state: 0,
            },
            datalist: [],
            agentlist: [],
@@ -312,8 +333,8 @@
            clickpositionId: '',
            agentqueryParam: {
                pageNum: 1,
                pageSize: 100
            }
        pageSize: 100,
      },
        }
    },
    created () {
@@ -327,22 +348,24 @@
                content: '确认要强制平仓吗?',
                onOk () {
                    var data = {
                        positionSn: val
            positionSn: val,
                    }
                    positionsell(data).then(res => {
          positionsell(data)
            .then((res) => {
                        if (res.status == 0) {
                            that.$message.success({ content: res.msg, duration: 2 })
                that.$message.success(res.msg)
                            that.getlist()
                        } else {
                            that.$message.error({ content: '平仓失败' })
                        }
                    }).catch(error => {
            })
            .catch((error) => {
                        that.$message.error({ content: '平仓失败' })
                    })
                },
                onCancel () {
                    console.log('Cancel')
                }
        },
            })
        },
        getLockopen (val) {
@@ -353,20 +376,20 @@
                onOk () {
                    var data = {
                        state: 0,
                        positionId: val
            positionId: val,
                    }
                    positionlock(data).then(res => {
          positionlock(data).then((res) => {
                        if (res.status == 0) {
                            that.$message.success({ content: res.msg, duration: 2 })
              that.$message.success(res.msg)
                            that.getlist()
                        } else {
                            that.$message.error({ content: res.msg })
              that.$message.error(res.msg)
                        }
                    })
                },
                onCancel () {
                    console.log('Cancel')
                }
        },
            })
        },
        handleCancel () {
@@ -382,19 +405,21 @@
                    var data = {
                        state: 1,
                        lockMsg: values.lockMsg,
                        positionId: this.clickpositionId
            positionId: this.clickpositionId,
                    }
                    positionlock(data).then(res => {
          positionlock(data)
            .then((res) => {
                        if (res.status == 0) {
                            this.Lockvisibledialog = false
                            this.$message.success({ content: res.msg, duration: 2 })
                this.$message.success(res.msg)
                            form.resetFields()
                            this.getlist()
                        } else {
                            this.$message.error({ content: res.msg })
                this.$message.error(res.msg)
                        }
                        this.Lockvisibleloading = false
                    }).catch(error => {
            })
            .catch((error) => {
                        reject(error)
                    })
                }
@@ -408,7 +433,7 @@
                agentId: undefined,
                userId: '',
                positionSn: '',
                state: 0
        state: 0,
            }
            this.getlist()
        },
@@ -420,13 +445,13 @@
                agentId: undefined,
                userId: '',
                positionSn: '',
                state: 0
        state: 0,
            }
        },
        getagentlist () {
            var that = this
            this.agentloading = true
            nextagent(this.agentqueryParam).then(res => {
      nextagent(this.agentqueryParam).then((res) => {
                this.agentlist = res.data.list
                setTimeout(() => {
                    that.agentloading = false
@@ -435,7 +460,7 @@
        },
        getlist () {
            this.loading = true
            positionlist(this.queryParam).then(res => {
      positionlist(this.queryParam).then((res) => {
                this.datalist = res.data.list
                this.pagination.total = res.data.total
                this.loading = false
@@ -449,8 +474,8 @@
            this.queryParam.pageNum = current
            this.queryParam.pageSize = pageSize
            this.getlist()
        }
    }
    },
  },
}
</script>
<style scoped>