| | |
| | | |
| | | <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> |
| | | |
| | |
| | | }, |
| | | 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", |
| | | prop: "shuliang", //volume_open持仓总张数,volume表示剩余 |
| | | label: "message.home.shuliang", |
| | | }, |
| | | { |
| | | prop: "trade_avg_price", |
| | |
| | | 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: [], |
| | |
| | | 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)}%`; |
| | |
| | | }, |
| | | directionFormatter(row, column, val) { |
| | | return val === "buy" |
| | | ? this.$t("message.home.kaiduo") |
| | | : this.$t("message.home.kaikong"); |
| | | ? 'Long' |
| | | : 'Shot'; |
| | | }, |
| | | 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 { |
| | |
| | | }; |
| | | Axios.contractOrderList(data).then((res) => { |
| | | this.tableData = res.data; |
| | | this.tableData.forEach(item => { |
| | | let shuliang = item.deposit*item.lever_rate/item.trade_avg_price |
| | | item.shuliang = shuliang.toFixed(4) |
| | | }) |
| | | console.log(this.tableData,'this.tableData'); |
| | | this.$emit("getPositionNum", res.data.length); |
| | | // 未实现盈亏 |
| | | const profitLoss = res.data.reduce( |
| | |
| | | handleAllClose(data) { |
| | | this.$refs.closeAllDialog.open(data.row); |
| | | }, |
| | | zhiyingzhisunClose(data){ |
| | | this.order_no = data.row.order_no |
| | | this.dialogFormVisible = true |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | background: #409eff; |
| | | color: #fff; |
| | | } |
| | | /deep/ .el-dialog__header { |
| | | border-bottom: none; |
| | | } |
| | | </style> |