5.10航天ui交易所pc端,代码jiem-pc
lxf
2025-06-20 bb4bf63aed5e87e23052a3c060dd7fa294a070ed
bug: 偶尔出现不显示数量
1 files modified
85 ■■■■ changed files
src/components/constract/PerpetualContract/orderCom/amountSlider.vue 85 ●●●● patch | view | raw | blame | history
src/components/constract/PerpetualContract/orderCom/amountSlider.vue
@@ -12,7 +12,6 @@
        v-model="amount"
        step-strictly="true"
        :min="0"
        :max="maxAmount"
        @change="inputChange"
      />
@@ -157,50 +156,52 @@
    //滑块事件
    sliderAmountChange(val) {
      let data;
      if (this.maxAmount) {
        // if (val == 0) {
        //   this.amount = undefined;
        // } else {
      console.log(val, "sliderAmountChange");
        const rate = val / 100; //如0.25
        let sxf = 0;
        switch (Number(this.lever_rate)) {
          case 25:
            sxf = 0.0375;
            break;
          case 50:
            sxf = 0.075;
            break;
          case 100:
            sxf = 0.15;
            break;
          case 200:
            sxf = 0.3;
            break;
          default:
            sxf = 0;
        }
        // const fl =
        // this.walletMoney * sxf * this.initOpen.amount * this.lever_rate * rate;
        // const maxAmount =
        // this.walletMoney * this.initOpen.amount * this.lever_rate;
        const maxAmount =
          Math.floor(this.walletMoney / (1 + sxf)) * this.lever_rate;
        const fl = maxAmount * sxf;
        console.log(maxAmount * rate, fl);
      // if (val) {
      // if (val == 0) {
      //   this.amount = undefined;
      // } else {
        // data = maxAmount * rate - fl;
        data = maxAmount;
        // if (this.lever_rate) {
        //   data = math.format((this.maxAmount * rate), 2);
        // } else {
        //   data = math.format((this.maxAmount * rate) / 1, 2);
        // }
        this.amount = parseInt(data);
        // }
        this.$emit("getAmount", this.amount);
      const rate = val / 100; //如0.25
      let sxf = 0;
      switch (Number(this.lever_rate)) {
        case 25:
          sxf = 0.0375;
          break;
        case 50:
          sxf = 0.075;
          break;
        case 100:
          sxf = 0.15;
          break;
        case 200:
          sxf = 0.3;
          break;
        default:
          sxf = 0;
      }
      // const fl =
      // this.walletMoney * sxf * this.initOpen.amount * this.lever_rate * rate;
      // const maxAmount =
      // this.walletMoney * this.initOpen.amount * this.lever_rate;
      const maxAmount =
        Math.floor((this.walletMoney / (1 + sxf)) * rate) * this.lever_rate;
      // const fl = maxAmount * sxf;
      console.log(maxAmount * rate);
      // data = maxAmount * rate - fl;
      data = maxAmount;
      // this.maxAmount = maxAmount;
      // if (this.lever_rate) {
      //   data = math.format((this.maxAmount * rate), 2);
      // } else {
      //   data = math.format((this.maxAmount * rate) / 1, 2);
      // }
      this.amount = data;
      // }
      this.$emit("getAmount", this.amount);
      // }
    },
    emptyValue() {
      this.sliderAmount = 0;