From 5932f9b2c934f901dcd6876beab081f82eaa0f16 Mon Sep 17 00:00:00 2001
From: dcc <dcc@163.com>
Date: Thu, 18 Jul 2024 10:35:40 +0800
Subject: [PATCH] 7.17修改
---
src/components/constract/PerpetualContract/positionCom/currentPosition.vue | 83 +++++++++++++++++++++++++++++++++++++----
1 files changed, 74 insertions(+), 9 deletions(-)
diff --git a/src/components/constract/PerpetualContract/positionCom/currentPosition.vue b/src/components/constract/PerpetualContract/positionCom/currentPosition.vue
index fa454bd..8a91d88 100644
--- a/src/components/constract/PerpetualContract/positionCom/currentPosition.vue
+++ b/src/components/constract/PerpetualContract/positionCom/currentPosition.vue
@@ -41,12 +41,36 @@
<el-button class="btn" size="small" @click="handleAllClose(scope)">{{
$t("message.home.pingcang")
+ }}</el-button
+ >
+ <el-button class="btn" size="small" @click="zhiyingzhisunClose(scope)">{{
+ $t("message.jiaoyi.zhiyingzhisun")
}}</el-button>
</template>
</el-table-column>
</el-table>
<close-all-dialog ref="closeAllDialog"></close-all-dialog>
<close-dialog ref="closeDialog"></close-dialog>
+ <el-dialog v-model="dialogFormVisible" width="400">
+ <el-form :model="form">
+ <el-form-item :label="$t('message.jiaoyi.zhiying')" :label-width="formLabelWidth">
+ <el-input v-model="form.zhiying" :placeholder="$t(`message.jiaoyi['请输入止盈金额']`)" autocomplete="off" />
+ </el-form-item>
+ </el-form>
+ <el-form :model="form">
+ <el-form-item :label="$t('message.jiaoyi.zhisun')" :label-width="formLabelWidth">
+ <el-input v-model="form.zhisun" :placeholder="$t(`message.jiaoyi['请输入止损金额']`)" autocomplete="off" />
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="dialogFormVisible = false">{{ $t('message.jiaoyi.quxiao') }}</el-button>
+ <el-button type="primary" @click="quedingSetting">
+ {{ $t('message.user.queding') }}
+ </el-button>
+ </div>
+ </template>
+ </el-dialog>
</div>
</template>
@@ -77,12 +101,19 @@
},
data() {
return {
+ formLabelWidth: '40px',
+ form: {
+ zhiying: "",
+ zhisun: ""
+ },
+ order_no: '',
+ dialogFormVisible: false,
pageNum: 1,
timer: null,
tables: [
{
prop: "volume", //volume_open持仓总张数,volume表示剩余
- label: "message.home.zhangshu",
+ label: "message.home.shuliang",
},
{
prop: "trade_avg_price",
@@ -98,19 +129,24 @@
formatter: this.directionFormatter,
},
- {
- prop: "change_ratio",
- label: "message.home.baozhengjinbilv",
- formatter: this.ratioFormatter,
- },
+ // {
+ // prop: "change_ratio",
+ // label: "message.home.baozhengjinbilv",
+ // formatter: this.ratioFormatter,
+ // },
{
prop: "deposit",
label: "message.home.baozhengjin",
},
{
prop: "profit",
- label: "message.user.weishixianyingkui(shouyilv)",
+ label: "message.user.weishixianyingkui",
formatter: this.formatterData,
+ },
+ {
+ prop: "profit",
+ label: "message.user.shouyilv",
+ formatter: this.formatterData1,
},
],
tableData: [],
@@ -131,6 +167,22 @@
clearInterval(this.timer);
},
methods: {
+ quedingSetting(){
+ const data = {
+ order_no: this.order_no,
+ stop_price_profit: this.form.zhiying,
+ stop_price_loss: this.form.zhisun,
+ }
+ Axios.quedingSetting(data).then(res => {
+ if(res.code == 0) {
+ this.$message({
+ message: this.$t("message.user.chenggong"),
+ type: "success",
+ });
+ this.dialogFormVisible = false
+ }
+ })
+ },
ratioFormatter(row) {
const { change_ratio } = row;
const ratio = `${bigDecimal.divide(change_ratio, 100, 4)}%`;
@@ -144,11 +196,17 @@
formatterData(row) {
const ratio = this.ratioFormatter(row);
const profit = Number(row.profit).toFixed(4);
- return `${profit}(${ratio})`;
+ return profit > 0 ?`+${profit}`: `${profit}`;
},
+ formatterData1(row) {
+ const ratio = this.ratioFormatter(row);
+ const profit = Number(row.profit).toFixed(4);
+ return ratio > 0 ? `+${ratio}` : `${ratio}`;
+ },
+
//设置单个单元格样式 行下标:rowIndex 列下标:columnIndex
cellStyle({ row, column, rowIndex, columnIndex }) {
- if (columnIndex == 6) {
+ if (columnIndex == 6 || columnIndex == 5) {
if (Number(row.profit) > 0) {
return { color: "#62C885" };
} else {
@@ -196,6 +254,10 @@
handleAllClose(data) {
this.$refs.closeAllDialog.open(data.row);
},
+ zhiyingzhisunClose(data){
+ this.order_no = data.row.order_no
+ this.dialogFormVisible = true
+ }
},
};
</script>
@@ -229,4 +291,7 @@
background: #409eff;
color: #fff;
}
+/deep/ .el-dialog__header {
+ border-bottom: none;
+}
</style>
--
Gitblit v1.9.3