4 changed files with 140 additions and 2 deletions
@ -0,0 +1,121 @@ |
|||||
|
<template> |
||||
|
<card> |
||||
|
<h5 slot="header"> |
||||
|
总资金管理 |
||||
|
</h5> |
||||
|
<div class="row"> |
||||
|
<div class="col-md-6"> |
||||
|
<base-input |
||||
|
label="总资金" |
||||
|
placeholder="总资金" |
||||
|
v-model="form.NowCapital" |
||||
|
></base-input> |
||||
|
<base-input |
||||
|
label="冻结利润比" |
||||
|
placeholder="冻结利润比" |
||||
|
v-model="form.FrozenProfit" |
||||
|
></base-input> |
||||
|
<base-input |
||||
|
label="下单金额比(%)" |
||||
|
placeholder="下单金额比(%)" |
||||
|
v-model="form.TradeAmountRatio" |
||||
|
></base-input> |
||||
|
<base-input |
||||
|
label="下单金额(根据下单金额比例和总资金得出)请参考右图,需满足条件: 最小下单金额 < 下单金额 < 最大下单金额" |
||||
|
placeholder="单金额" |
||||
|
v-model="total" |
||||
|
disabled |
||||
|
></base-input> |
||||
|
<base-button :disabled="!canSubmit" @click="submitCapital" |
||||
|
>提交</base-button |
||||
|
> |
||||
|
</div> |
||||
|
<div class="col-md-6"> |
||||
|
<custom-base-table |
||||
|
:data="data" |
||||
|
:columns="columns" |
||||
|
thead-classes="text-primary" |
||||
|
> |
||||
|
</custom-base-table> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div></div> |
||||
|
</card> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import CustomBaseTable from "../../components/CustomBaseTable"; |
||||
|
export default { |
||||
|
components: { CustomBaseTable }, |
||||
|
data() { |
||||
|
return { |
||||
|
data: [], |
||||
|
form: {}, |
||||
|
columns: [ |
||||
|
{ name: "币种", prop: "Symbol" }, |
||||
|
{ name: "最小下单金额", prop: "BuyMarketMinValue" }, |
||||
|
{ name: "最大下单金额", prop: "BuyMarketMaxValue" } |
||||
|
] |
||||
|
}; |
||||
|
}, |
||||
|
computed: { |
||||
|
total() { |
||||
|
return (this.form.NowCapital * this.form.TradeAmountRatio) / 100; |
||||
|
}, |
||||
|
canSubmit() { |
||||
|
return ( |
||||
|
this.data && |
||||
|
this.data[1] && |
||||
|
this.data.every( |
||||
|
i => |
||||
|
i.BuyMarketMinValue < this.total && i.BuyMarketMaxValue > this.total |
||||
|
) |
||||
|
); |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
this.getAllSymbol(); |
||||
|
this.getCapital(); |
||||
|
}, |
||||
|
methods: { |
||||
|
//获取所有交易对 |
||||
|
getAllSymbol() { |
||||
|
this.$http.get("/Api/Symbol/GetList").then(res => { |
||||
|
if (res.Code == 200) { |
||||
|
this.data = res.Data; |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
//获取总资金配置 |
||||
|
getCapital() { |
||||
|
this.$http.get("/Api/Capital/GetCapital").then(res => { |
||||
|
if (res.Code == 200) { |
||||
|
this.form = res.Data; |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
submitCapital() { |
||||
|
this.$http |
||||
|
.put("/Api/Capital/EditCapital", { |
||||
|
...this.form, |
||||
|
Captial: this.form.NowCapital |
||||
|
}) |
||||
|
.then(res => { |
||||
|
if (res.Code == 200) { |
||||
|
this.sMessage("success", "提交成功"); |
||||
|
} else { |
||||
|
this.sMessage("danger", res.Message); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
// 封装showNotification |
||||
|
sMessage(type, message) { |
||||
|
this.$notify({ |
||||
|
type: type, |
||||
|
message, |
||||
|
timeout: 1800 |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
</script> |
Loading…
Reference in new issue