5.10航天ui交易所pc端,代码jiem-pc
lxf
2025-06-30 4cbc5a9d0f04b1d9b1f44563a5f99af9fb35e470
src/components/constract/PerpetualContract/positionCom/currentPosition.vue
@@ -7,16 +7,16 @@
      :empty-text="$t('message.home.noData')"
    >
      <!-- 合约会显示buy和杠杆 -->
      <el-table-column :label="$t('message.jiaoyi.heyue')" width="280">
      <el-table-column :label="$t('message.jiaoyi.heyue')" width="140">
        <template #default="scope">
          <div class="first-column">
            <span
              class="direction"
              :class="`direction-${scope.row.direction}`"
            ></span>
            <span class="name"
              >{{ scope.row.name }} {{ $t("message.home.yongxu") }}</span
            >
            <span class="name" style="color: rgb(98, 200, 133)"
              >{{ scope.row.name }}
            </span>
            <!-- <span class="lever_rate">{{
              scope.row.lever_rate ? `${scope.row.lever_rate}x` : "1x"
            }}</span> -->
@@ -29,6 +29,7 @@
        :prop="item.prop"
        :label="$t(item.label)"
        :formatter="item.formatter"
        :width="item.width"
      />
      <el-table-column :label="$t('message.home.caozuo')" min-width="100">
        <template #default="scope">
@@ -40,7 +41,7 @@
          > -->
          <el-button class="btn" size="small" @click="handleAllClose(scope)">{{
            $t("message.home.pingcang")
            $t("message.home.pingcang2")
          }}</el-button>
        </template>
      </el-table-column>
@@ -84,6 +85,7 @@
          prop: "profit",
          label: "message.user.weishixianyingkui(shouyilv)",
          formatter: this.formatterData,
          width: 260,
        },
        {
          prop: "volume", //volume_open持仓总张数,volume表示剩余
@@ -93,22 +95,26 @@
        {
          prop: "trade_avg_price",
          label: "message.user.kaicangjiage",
          formatter: (row) => {
            const { trade_avg_price } = row;
            return bigDecimal.round(trade_avg_price, 6);
          },
        },
        // {
        //   prop: "mark_price",
        //   label: "message.home.biaojijiage",
        // },
        {
          prop: "direction",
          label: "message.home.fangxiang",
          formatter: this.directionFormatter,
        },
        {
          prop: "change_ratio",
          label: "message.home.baozhengjinbilv",
          formatter: this.ratioFormatter,
          prop: "lever_rate",
          label: "message.home.gangganbeishu",
        },
        // {
        //   prop: "change_ratio",
        //   label: "message.home.baozhengjinbilv",
        //   // formatter: this.ratioFormatter,
        // },
        {
          prop: "deposit",
          label: "message.home.baozhengjin",
@@ -152,9 +158,9 @@
        : this.$t("message.home.kaikong");
    },
    formatterData(row) {
      const ratio = this.ratioFormatter(row);
      const profit = Number(row.profit).toFixed(4);
      return `${profit}/n(${ratio})`;
      // const ratio = this.ratioFormatter(row);
      // const profit = Number(row.profit).toFixed(6);
      return `${row.profit}(${row.change_ratio}%)`;
    },
    //设置单个单元格样式   行下标:rowIndex    列下标:columnIndex
    cellStyle({ row, column, rowIndex, columnIndex }) {
@@ -166,6 +172,15 @@
        }
      }
      if (columnIndex == 3) {
        return row.direction === "buy"
          ? { color: "#62C885" }
          : { color: "#E05561" };
      }
      if (columnIndex == 1) {
        return row.profit > 0 ? { color: "#62C885" } : { color: "#E05561" };
      }
      if (columnIndex == 4) {
        return row.direction === "buy"
          ? { color: "#62C885" }
          : { color: "#E05561" };
@@ -186,7 +201,7 @@
          (accumulator, cur) => Number(accumulator) + Number(cur.profit),
          0
        );
        const dataloss = bigDecimal.round(profitLoss, 2);
        const dataloss = bigDecimal.round(profitLoss, 6);
        // 保证金率
        const marginRate = res.data.reduce(
          (accumulator, cur) =>