| | |
| | | v-model="amount" |
| | | step-strictly="true" |
| | | :min="0" |
| | | :max="maxAmount" |
| | | @change="inputChange" |
| | | /> |
| | | |
| | |
| | | //滑块事件 |
| | | 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; |