|
|
@@ -72,11 +72,13 @@
|
|
|
<div class="order-tpsl" v-if="quote?.tpslflag">
|
|
|
<div class="order-tpsl__tp">
|
|
|
<div class="left">
|
|
|
- <Checkbox v-model="formData.TPFlag" :disabled="!!quote.tpslforceflag">{{ $t('tss.tpspforceflag')}}</Checkbox>
|
|
|
+ <Checkbox v-model="formData.TPFlag" :disabled="!!quote.tpslforceflag">{{
|
|
|
+ $t('tss.tpspforceflag') }}
|
|
|
+ </Checkbox>
|
|
|
</div>
|
|
|
<div class="right">
|
|
|
<div class="right-top">
|
|
|
- <span>{{ $t('tss.takeProfitSpread')}}{{ (tpsl.takeProfitSpread > 0 ? '+' : '')
|
|
|
+ <span>{{ $t('tss.takeProfitSpread') }}{{ (tpsl.takeProfitSpread > 0 ? '+' : '')
|
|
|
+ tpsl.takeProfitSpread.toFixed(quote.decimalplace) }}</span>
|
|
|
<span class="g-price-up">[{{ takeProfitRatio.toFixed(2) }}%]</span>
|
|
|
<span class="g-price-up">+{{ tpsl.takeProfit.toFixed(2) }}</span>
|
|
|
@@ -89,11 +91,13 @@
|
|
|
</div>
|
|
|
<div class="order-tpsl__sl">
|
|
|
<div class="left">
|
|
|
- <Checkbox v-model="formData.SLFlag" :disabled="!!quote?.tpslforceflag">{{ $t('tss.tpslforceflag')}}</Checkbox>
|
|
|
+ <Checkbox v-model="formData.SLFlag" :disabled="!!quote?.tpslforceflag">{{
|
|
|
+ $t('tss.tpslforceflag') }}
|
|
|
+ </Checkbox>
|
|
|
</div>
|
|
|
<div class="right">
|
|
|
<div class="right-top">
|
|
|
- <span>{{ $t('tss.takeProfitSpread')}}{{ (tpsl.stopLossSpread > 0 ? '+' : '')
|
|
|
+ <span>{{ $t('tss.takeProfitSpread') }}{{ (tpsl.stopLossSpread > 0 ? '+' : '')
|
|
|
+ tpsl.stopLossSpread.toFixed(quote.decimalplace) }}</span>
|
|
|
<span class="g-price-down">[{{ stopLossRatio.toFixed(2) }}%]</span>
|
|
|
<span class="g-price-down">-{{ tpsl.stopLoss.toFixed(2) }}</span>
|
|
|
@@ -163,7 +167,7 @@ const takeProfitRatio = shallowRef(0) // 止盈比例
|
|
|
const stopLossRatio = shallowRef(0) // 止损比例
|
|
|
|
|
|
// 计算盈亏
|
|
|
-const calcProfitLoss = (ratio: number) => usedMargin.value.deposit * (ratio / 100)
|
|
|
+const calcProfitLoss = (ratio: number, profitLoss: 1 | -1) => usedMargin.value.deposit * (ratio / 100) * profitLoss
|
|
|
|
|
|
// 计算价差
|
|
|
const calcSpread = (value: number) => {
|
|
|
@@ -173,9 +177,9 @@ const calcSpread = (value: number) => {
|
|
|
|
|
|
// 止盈止损
|
|
|
const tpsl = computed(() => {
|
|
|
- const takeProfit = calcProfitLoss(takeProfitRatio.value) // 盈利
|
|
|
+ const takeProfit = calcProfitLoss(takeProfitRatio.value, 1) // 盈利
|
|
|
const takeProfitSpread = calcSpread(takeProfit) // 止盈价差
|
|
|
- const stopLoss = calcProfitLoss(stopLossRatio.value) // 亏损
|
|
|
+ const stopLoss = calcProfitLoss(stopLossRatio.value, -1) // 亏损
|
|
|
const stopLossSpread = calcSpread(stopLoss) // 止损价差
|
|
|
|
|
|
return {
|