Browse Source

改动

master
lizhixin 4 years ago
parent
commit
40510ccfb9
  1. 202
      src/pages/MainSec/OrderTable.vue
  2. 39
      src/pages/MainSec/SignalTable.vue
  3. 6
      src/pages/Robot/order.vue
  4. 1
      src/pages/RobotSec/Account.vue
  5. 51
      src/pages/prePages/js/columns.js
  6. 22
      src/pages/prePages/js/selectoptions.js
  7. 4
      src/utils/plugin/axios-plugin.js

202
src/pages/MainSec/OrderTable.vue

@ -1,6 +1,159 @@
<template>
<card>
<el-tabs v-model="activeName">
<card class="rol">
<div class="my-flex">
<div><card>机器人总资产522222</card></div>
<div><card>周转资金522222</card></div>
<div><card>当前持仓资金522222</card></div>
<div><card>浮动盈亏522222</card></div>
<div><card>总利息522222</card></div>
<div><card>总手续费522222</card></div>
<div><card>总收益522222</card></div>
</div>
<card></card>
<el-table
:data="latestOrderList"
height="600"
size="mini"
class="customer-no-border-table"
>
<el-table-column
v-for="i in secondTradeColumns"
:label="i.name"
:width="i.width || 60"
:prop="i.prop"
:key="i.prop"
>
<template slot-scope="scope">
<!-- 卖卖类型 -->
<div v-if="i.customSlot == 'OrderType'">
<p>买入</p>
<p>卖出</p>
</div>
<!-- 手持资金 -->
<div v-else-if="i.customSlot == 'CapitalAfter'">
<p>
{{
(scope.row.CapitalAfterPurchase &&
scope.row.CapitalAfterPurchase.toFixed(2)) ||
0
}}
</p>
<p>
{{
(scope.row.CapitalAfterSale &&
scope.row.CapitalAfterSale.toFixed(2)) ||
0
}}
</p>
</div>
<!-- 买卖时间 -->
<div v-else-if="i.customSlot == 'KLineId'">
<p>
{{
scope.row.PurchaseKLineId
? moment(scope.row.PurchaseKLineId * 1000).format(
"YYYY-MM-DD HH:mm:ss"
)
: "-"
}}
</p>
<p>
{{
scope.row.SaleKLineId
? moment(scope.row.SaleKLineId * 1000).format(
"YYYY-MM-DD HH:mm:ss"
)
: "-"
}}
</p>
</div>
<!-- 下单方式 -->
<div v-else-if="i.customSlot == 'OrderWay'">
<p>市价单</p>
<p>市价单</p>
</div>
<!-- 信号价 -->
<div v-else-if="i.customSlot == 'SignalPrice'">
<p>{{ scope.row.PurchasePrice }}</p>
<p>{{ scope.row.SalePrice }}</p>
</div>
<!-- 下单方式 -->
<div v-else-if="i.customSlot == 'Fee'">
<p>{{ scope.row.PurchaseFee }}</p>
<p>{{ scope.row.SaleFee }}</p>
</div>
<!-- 买卖数量 -->
<div v-else-if="i.customSlot == 'Count'">
<p>{{ scope.row.PurchaseCoinCount || "-" }}</p>
<p>{{ scope.row.SaleCoinCount || "-" }}</p>
</div>
<!-- 成交总价 -->
<div v-else-if="i.customSlot == 'Total'">
<p>{{ scope.row.TotalPurchasePrice || "-" }}</p>
<p>{{ scope.row.TotalSalePrice || "-" }}</p>
</div>
<!-- 借币金额 -->
<div v-else-if="i.customSlot == 'LoanAmount'">
<p>
{{ scope.row.LoanAmount.toFixed(2) || "-" }}
</p>
</div>
<!-- 借币利息 -->
<div v-else-if="i.customSlot == 'LoanFee'">
<p>
{{ scope.row.LoanFee.toFixed(2) || "-" }}
</p>
</div>
<!-- 借币比例 -->
<div v-else-if="i.customSlot == 'LoanRatio'">
<p>{{ scope.row.LoanRatio.toFixed(2) || "-" }}%</p>
</div>
<!-- 最大浮亏 -->
<div v-else-if="i.customSlot == 'MaxLossRatio'">
<p>{{ scope.row.MaxLossPrice || "-" }}</p>
<p>{{ scope.row.MaxLossRatio || "-" }}%</p>
</div>
<!-- 盈亏 -->
<div v-else-if="i.customSlot == 'Profit'">
<p>{{ scope.row.Profit }}</p>
<p v-if="scope.row.Profit">
{{
(
(scope.row.Profit / scope.row.TotalPurchasePrice) *
100
).toFixed(2)
}}%
</p>
<p v-else>-</p>
</div>
<!-- 累计盈亏 -->
<div v-else-if="i.customSlot == 'TotalProfit'">
<p>{{ scope.row.TotalProfit }}</p>
<p v-if="scope.row.TotalProfit">
{{ scope.row.TotalProfitRatio }}%
</p>
<p v-else>-</p>
</div>
<div v-else>
<p>{{ scope.row[i.prop] }}</p>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination
small
:hide-on-single-page="true"
layout="prev, pager, next"
:total="historyOrdersPagination.total"
:page-size="historyOrdersPagination.pageSize"
:current-page="historyOrdersPagination.current"
>
</el-pagination>
<!-- <el-tabs v-model="activeName">
<el-tab-pane label="历史订单" name="first">
<custom-base-table
:data="historyOrders"
@ -24,7 +177,7 @@
thead-classes="text-primary"
></custom-base-table>
</el-tab-pane>
</el-tabs>
</el-tabs> -->
<card>
<h5 slot="header" class="title">账号配置信息</h5>
@ -86,7 +239,10 @@
</card>
</template>
<script>
import { OrderColumns } from "../../pages/prePages/js/columns";
import {
OrderColumns,
secondTradeColumns
} from "../../pages/prePages/js/columns";
import CustomBaseTable from "../../components/CustomBaseTable";
import Bus from "../../common/bus";
@ -110,8 +266,10 @@ export default {
},
data() {
return {
secondTradeColumns,
activeName: "first",
OrderColumns,
latestOrderList: [],
historyOrders: [],
nowOrders: [],
basic: {},
@ -121,7 +279,8 @@ export default {
},
created() {
this.initOrders(); //
// this.initOrders(); //
this.initHistoryOrders();
},
mounted() {
@ -131,25 +290,29 @@ export default {
beforeDestroy() {
closeWebSocket();
localStorage.clear();
localStorage.removeItem("missPkg");
localStorage.removeItem("pingTimeStamp");
clearInterval(this.pingInterval);
},
methods: {
initOrders() {
this.initHistoryOrders();
this.initNowOrders();
latestOrder() {
this.$http.get("/Api/Order/GetSpotOrderList");
},
// initOrders() {
// this.initHistoryOrders();
// this.initNowOrders();
// },
initHistoryOrders() {
let pageIndex = this.historyOrdersPagination.current;
let pageSize = this.historyOrdersPagination.pageSize;
this.$http
.get(
`/Api/Order/GetHistorySpotGoodsOrder?pageIndex=${pageIndex}&pageSize=${pageSize}&robotId=${this.RobotId}`
`/Api/Order/GetSpotOrderList?pageIndex=${pageIndex}&pageSize=${pageSize}&robotId=${this.RobotId}`
)
.then(res => {
if (res.Code == 200) {
this.historyOrders = res.Data.List;
this.latestOrderList = res.Data.List;
const pager = { ...this.historyOrdersPagination };
pager.total = res.Data.Count;
this.historyOrdersPagination = pager;
@ -235,7 +398,8 @@ export default {
*/
console.log("达到丢包次数", missPkgCount);
clearInterval(this.pingInterval);
localStorage.clear();
localStorage.removeItem("missPkg");
localStorage.removeItem("pingTimeStamp");
closeWebSocket();
this.initOrders();
this.initWs();
@ -352,4 +516,18 @@ export default {
.el-pager li {
background-color: transparent;
}
.el-table th > .cell {
font-size: 10px;
}
.my-flex {
display: flex;
justify-content: space-between;
font-size: 16px;
font-weight: 800;
color: rgba(255, 255, 255, 0.926);
}
.rol {
height: 800px;
overflow: auto;
}
</style>

39
src/pages/MainSec/SignalTable.vue

@ -5,7 +5,7 @@
thead-classes="text-primary"
>
<template slot="LogType" slot-scope="item">
{{ typeRender(item.row.item.LogType) }}
{{ LogTypes.filter(i => i.value == item.row.item.LogType)[0].title }}
</template>
</custom-base-table>
</template>
@ -14,6 +14,8 @@
import Bus from "../../common/bus";
import CustomBaseTable from "../../components/CustomBaseTable";
import moment from "moment";
import { LogTypes } from "../prePages/js/selectoptions";
import { secondLogColumns } from "../prePages/js/columns";
export default {
props: {
RobotId: { type: String, default: "60521323-28C3-AC14-0076-48B075584510" }
@ -21,21 +23,8 @@ export default {
components: { CustomBaseTable },
data() {
return {
columns: [
{ name: "RobotId", prop: "RobotId" },
{ name: "内容", prop: "Content" },
{
name: "日志类型",
prop: "LogType",
customSlot: "LogType"
},
{
name: "订单Id",
prop: "SpotGoodsOrderId"
},
{ name: "创建时间", prop: "CreateTime" }
],
LogTypes,
columns: secondLogColumns,
data: [],
noMoreData: false,
endTime: null,
@ -88,24 +77,6 @@ export default {
}
},
typeRender(logType) {
switch (logType) {
case 0:
return "买入";
case 1:
return "卖出";
case 2:
return "做多";
case 3:
return "做空";
case 4:
return "大趋势看多";
case 5:
return "大趋势看空";
case 10:
return "自动卖出";
}
},
getLatestLog(endTime) {
this.spinning = true;
let _endTime = endTime.format("YYYY-MM-DD HH:mm:ss");

6
src/pages/Robot/order.vue

@ -131,7 +131,8 @@ export default {
beforeDestroy() {
closeWebSocket();
localStorage.clear();
localStorage.removeItem("missPkg");
localStorage.removeItem("pingTimeStamp");
clearInterval(this.pingInterval);
},
@ -235,7 +236,8 @@ export default {
*/
console.log("达到丢包次数", missPkgCount);
clearInterval(this.pingInterval);
localStorage.clear();
localStorage.removeItem("missPkg");
localStorage.removeItem("pingTimeStamp");
closeWebSocket();
this.initOrders();
this.initWs();

1
src/pages/RobotSec/Account.vue

@ -108,6 +108,7 @@
<el-select
class="select-danger"
placeholder="选择交易对"
filterable
style="width:100%"
v-model="apiKeyform.Symbol"
>

51
src/pages/prePages/js/columns.js

@ -203,19 +203,19 @@ export const tradeColumns = [
name: "借币金额",
prop: "BorrowAmount",
key: "BorrowAmount",
customSlot: "BorrowAmount"
customSlot: "LoanAmount"
},
{
name: "借币利息",
prop: "BorrowFee",
key: "BorrowFee",
customSlot: "BorrowFee"
customSlot: "LoanFee"
},
{
name: "借币比例",
prop: "BorrowRatio",
key: "BorrowRatio",
customSlot: "BorrowRatio"
customSlot: "LoanRatio"
},
{
name: "成交总价",
@ -264,7 +264,8 @@ export const secondTradeColumns = [
{
name: "ID",
prop: "Id",
key: "Id"
key: "Id",
width: 120
},
{
name: "类型",
@ -277,86 +278,100 @@ export const secondTradeColumns = [
name: "下单方式",
prop: "OrderWay",
key: "OrderWay",
customSlot: "OrderWay"
customSlot: "OrderWay",
width: 80
},
{
name: "委托数量",
prop: "Count",
key: "Count",
customSlot: "Count"
customSlot: "Count",
width: 80
},
{
name: "成交数量",
prop: "Count",
key: "Count",
customSlot: "Count"
customSlot: "Count",
width: 80
},
{
name: "成交均价",
prop: "Count",
key: "Count",
customSlot: "Count"
customSlot: "Count",
width: 80
},
{
name: "信号价",
prop: "SignalPrice",
key: "SignalPrice",
customSlot: "SignalPrice"
customSlot: "SignalPrice",
width: 80
},
{
name: "成交总价",
prop: "Total",
key: "Total",
customSlot: "Total"
customSlot: "Total",
width: 80
},
{
name: "借币金额",
prop: "BorrowAmount",
key: "BorrowAmount",
customSlot: "BorrowAmount"
customSlot: "BorrowAmount",
width: 80
},
{
name: "借币比例",
prop: "BorrowRatio",
key: "BorrowRatio",
customSlot: "BorrowRatio"
customSlot: "BorrowRatio",
width: 80
},
{
name: "借币利息",
prop: "BorrowFee",
key: "BorrowFee",
customSlot: "BorrowFee"
customSlot: "BorrowFee",
width: 80
},
{
name: "手续费",
prop: "Fee",
key: "Fee",
customSlot: "Fee"
customSlot: "Fee",
width: 90
},
{
name: "波段盈亏",
prop: "Profit",
key: "Profit",
customSlot: "Profit"
customSlot: "Profit",
width: 80
},
{
name: "波段总盈亏",
prop: "TotalProfit",
fixed: true,
key: "TotalProfit",
customSlot: "TotalProfit"
customSlot: "TotalProfit",
width: 100
},
{
name: "持币盈亏",
prop: "PriceGap",
key: "PriceGap"
key: "PriceGap",
width: 80
},
{
name: "持币总盈亏",
prop: "HistoryTotalPriceGap",
key: "HistoryTotalPriceGap"
key: "HistoryTotalPriceGap",
width: 100
},
{
name: "状态",

22
src/pages/prePages/js/selectoptions.js

@ -55,16 +55,18 @@ export const fallTime = [
];
export const periodSignal = [
{ title: "1min", value: 0 },
{ title: "5min", value: 1 },
{ title: "15min", value: 2 },
{ title: "30min", value: 3 },
{ title: "60min", value: 4 },
{ title: "4hour", value: 5 },
{ title: "1day", value: 6 },
{ title: "1week", value: 7 },
{ title: "1mon", value: 8 },
{ title: "1year", value: 9 }
{ title: "30s", value: 0 },
{ title: "1min", value: 1 },
{ title: "3min", value: 2 },
{ title: "5min", value: 3 },
{ title: "15min", value: 4 },
{ title: "30min", value: 5 },
{ title: "60min", value: 6 },
{ title: "4hour", value: 7 },
{ title: "1day", value: 8 },
{ title: "1week", value: 9 },
{ title: "1mon", value: 10 },
{ title: "1year", value: 11 }
];
export const orderModes = [

4
src/utils/plugin/axios-plugin.js

@ -1,9 +1,9 @@
/* eslint-disable */
import axios from "axios";
const rootUrl = "http://58.23.153.12:88/"; //test
// const rootUrl = "http://58.23.153.12:88/"; //test
// const rootUrl = "http://trapi.iheyinet.com"; //latest
const rootUrl = "http://trapi.iheyinet.com"; //latest
const Axios = axios.create({
baseURL: rootUrl,

Loading…
Cancel
Save