1
jhzh
2024-08-12 f1dc8f5a7f3a661ce19513a9ad47fe18e3e883ff
src/components/constract/PerpetualContract/positionCom/historyOrder.vue
@@ -40,6 +40,7 @@
import Axios from "@/api/perpetualContract.js";
import { ArrowLeft, ArrowRight } from "@element-plus/icons-vue";
import dateSearch from "./dateSearch.vue";
import {initDate} from "@/utils/utils"
export default {
  name: "historyOrder",
  props: {
@@ -69,19 +70,30 @@
          label: "message.jiaoyi.heyue",
          // formatter: this.nameFormatter,
        },
        {
          prop: "lever_rate",
          label: "message.home.gangganbeishu",
        },
        {
          prop: "direction",
          label: "message.home.fangxiang",
          formatter: this.directionFormatter,
        },
        {
          prop: "deposit_open",
          label: "message.home.baozhengjin",
        },
        {
          prop: "trade_avg_price",
          label: "message.home.chengjiaojunjia",
        },
        {
          prop: "close_avg_price",
          label: "message.home['平仓价']",
        },
        {
          prop: "volume_open",
          prop: "shuliang",
          label: "message.home.shuliang",
        },
        {
@@ -114,7 +126,11 @@
  },
  methods: {
    profitFormatter(row) {
      return Number(row.profit).toFixed(4);
      if(Number(row.profit) > 0){
        return '+' + Number(row.profit).toFixed(4);
      }else{
        return  Number(row.profit).toFixed(4);
      }
    },
    //分页
    changePageNum(type) {
@@ -130,7 +146,7 @@
      this.getList();
    },
    cellStyle({ row, column, rowIndex, columnIndex }) {
      if (columnIndex == 2) {
      if (columnIndex == 3) {
        if (row.direction == "sell") {
          return { color: "#E05561" };
        } else {
@@ -138,7 +154,7 @@
        }
      }
      // // 未实现盈亏
      if (columnIndex == 6) {
      if (columnIndex == 8) {
        if (row.profit < 0) {
          return { color: "#E05561" };
        } else {
@@ -150,8 +166,8 @@
    directionFormatter(row) {
      const { direction } = row;
      return direction == "buy"
        ? this.$t("message.home.pingduo")
        : this.$t("message.home.pingkong");
        ? 'Long'
        : 'Shot';
    },
    //获取列表数据
    getList(startTime = "", endTime = "", isReset) {
@@ -171,7 +187,17 @@
      };
      Axios.contractOrderList(data).then((res) => {
        let result = res.data
        // result.forEach((item) => {
        //   item.create_time = item.create_time.split(' ')[0] + ' ' + initDate(item.create_time.split(' ')[1])
        //   item.close_time = item.close_time.split(' ')[0] + ' ' + initDate(item.close_time.split(' ')[1])
        // })
        this.tableData = res.data;
        this.tableData.forEach(item => {
          let shuliang = item.deposit_open*item.lever_rate/item.trade_avg_price
          item.shuliang = shuliang.toFixed(4)
        })
        // console.log(this.tableData,'this.tableData');
        const noNext = res.data.length == 0 || res.data.length < 10;
        this.noNext = noNext;
      });