5.10航天ui交易所pc端,代码jiem-pc
lxf
2025-06-13 066ec67b7080f07a0e47dda9864ee6be2e4b9053
src/components/constract/PerpetualContract/orderCom/amountSlider.vue
@@ -23,14 +23,17 @@
        v-model="sliderAmount"
        :format-tooltip="(v) => `${v}%`"
        :marks="marks"
        :step="25"
      >
      </el-slider>
    </div>
    <!-- 订单 -->
    <div v-if="existToken">
      <div v-if="typeNum == 0" class="submit-info-item">
        <div>{{ $t("message.home.kekaizhangshu") }}</div>
        <div>{{ `${maxAmount} ${$t("message.home.zhang")}` }}</div>
        <!-- <div>{{ $t("message.home.kekaizhangshu") }}</div>
        <div>{{ `${maxAmount} ${$t("message.home.zhang")}` }}</div> -->
        <div>{{ $t("message.jiaoyi.qianbaoyue") }}</div>
        <div>{{ walletMoney }} USDT</div>
      </div>
      <div v-if="typeNum == 1" class="submit-info-item">
@@ -53,6 +56,9 @@
import { mapState, mapActions, mapStores } from "pinia";
import { useUserStore } from "@/store/user";
import { useCurrencyStore } from "@/store/currency";
import Axios from "@/api/currency.js";
import bus from "vue3-eventbus";
export default {
  emits: ["getAmount"],
  name: "amountSlider",
@@ -90,15 +96,46 @@
        0: "0",
        25: "25%",
        50: "50%",
        75: "70%",
        75: "75%",
        100: "100%",
      },
      allowedSteps: [0, 25, 50, 75, 100],
      totalAsset: "0.000000", //总资产
      walletMoney: "0.000000", //钱包余额
      profitLoss: "0.000000", //未实现盈亏
      marginRate: "0.000000", //保证金比率
      maintenanceMargin: "0.000000", //维持保证金 = 钱包余额
    };
  },
  mounted() {
    if (this.existToken) {
      this.timer = setInterval(() => {
        this.getAssetTotal();
      }, 2000);
    }
  },
  computed: {
    ...mapState(useUserStore, ["existToken"]),
    //保证金余额
    marginBalance: function () {
      // 钱包余额 + 未实现盈亏
      return bigDecimal.add(this.walletMoney, this.profitLoss);
    },
  },
  methods: {
    //获取资产总余额
    getAssetTotal() {
      Axios.currencyPaypal().then((res) => {
        const { total, money_wallet, money_contract, money_contract_profit } =
          res.data;
        this.totalAsset = total; //总资产
        this.walletMoney = bigDecimal.round(money_wallet, 6); //钱包余额
        this.profitLoss = bigDecimal.round(money_contract_profit, 6); //永续合约总未实现盈亏
        bus.emit("moneyContract", money_contract); //合约可用余额
        // bus.emit("moneyContract", this.walletMoney); //合约可用余额
      });
    },
    //输入框事件
    inputChange(val) {
      this.$emit("getAmount", val);
@@ -127,7 +164,7 @@
      }
    },
    emptyValue() {
      this.sliderAmount = undefined;
      this.sliderAmount = 0;
    },
  },
};