<template>
|
<div>
|
<ul class="sport-tabs">
|
<li
|
:class="actives === item.key && 'active'"
|
v-for="item in tabsList"
|
:key="item.key"
|
@click="clickTabs(item)"
|
>
|
{{ item.title }}
|
</li>
|
</ul>
|
<van-list
|
v-model="loading"
|
:finished="finished"
|
:finished-text="$t('hj43')"
|
@load="onLoad"
|
>
|
<div
|
class="sport-content-li"
|
:style="actives === 1 ? 'height:5.52rem' : 'height:7.52rem'"
|
v-for="(item, index) in dataList"
|
:key="index"
|
@click="$router.push(`/Stockdetail?codes=${item.positionSn}`)"
|
>
|
<div @click.stop="pushRouter(item)">
|
<div class="title-box">
|
<div class="span">{{ item.stockName }}</div>
|
<div
|
class="states"
|
:class="item.orderDirection === '买跌' ? 'states-red' : ''"
|
>
|
{{ $t(item.orderDirection) }}
|
</div>
|
</div>
|
{{ item.stockCode }}
|
</div>
|
<!-- <div @click="$router.push('/Stockdetail')"></div> -->
|
<van-row>
|
<van-col span="8">
|
<div style="text-align: left">
|
<div class="sport-content-title2">
|
{{ $t("盈虧") }} ({{ activeObj.symbolCode }})
|
</div>
|
<div class="sport-content-text" style="color: #d04b64">
|
{{ item.profitAndLose }}
|
</div>
|
</div>
|
</van-col>
|
<van-col span="8">
|
<div style="text-align: center">
|
<div class="sport-content-title2">
|
{{ $t("hj141") }} ({{ activeObj.symbolCode }})
|
</div>
|
<div class="sport-content-text2">
|
{{ item.profitAndLoseParent }}
|
</div>
|
</div>
|
</van-col>
|
<van-col span="8">
|
<div style="text-align: right">
|
<div class="sport-content-title2">{{ $t("倉位(股)") }}</div>
|
<div class="sport-content-text">{{ item.orderNum }}</div>
|
</div></van-col
|
>
|
</van-row>
|
<van-row>
|
<van-col span="8">
|
<div style="text-align: left">
|
<div class="sport-content-title2">
|
{{ $t("hj40") }}({{ activeObj.symbolCode }})
|
</div>
|
<div class="sport-content-text2">{{ item.now_price }}</div>
|
</div>
|
</van-col>
|
<van-col span="8">
|
<div style="text-align: center">
|
<div class="sport-content-title2">
|
{{ $t("持倉價") }} ({{ activeObj.symbolCode }})
|
</div>
|
<div class="sport-content-text2">{{ item.buyOrderPrice }}</div>
|
</div>
|
</van-col>
|
<van-col span="8">
|
<div style="text-align: right">
|
<div class="sport-content-title2">
|
{{ $t("訂單金額") }} ({{ activeObj.symbolCode }})
|
</div>
|
<div class="sport-content-text2">{{ item.orderTotalPrice }}</div>
|
</div>
|
</van-col>
|
</van-row>
|
<van-row>
|
<van-col span="8">
|
<div style="text-align: left">
|
<div class="sport-content-title2">
|
{{ $t("hj44") }} ({{ activeObj.symbolCode }})
|
</div>
|
<div class="sport-content-text2">{{ item.orderFee }}</div>
|
</div>
|
</van-col>
|
<van-col span="8">
|
<div style="text-align: center">
|
<div class="sport-content-title2">
|
{{ $t("止損價") }} ({{ activeObj.symbolCode }})
|
</div>
|
<div class="sport-content-text2">
|
-{{ item.profitTargetPrice || "--" }}
|
</div>
|
</div>
|
</van-col>
|
<van-col span="8">
|
<div style="text-align: right">
|
<div class="sport-content-title2">
|
{{ $t("止盈價") }} ({{ activeObj.symbolCode }})
|
</div>
|
<div class="sport-content-text2">
|
-{{ item.stopTargetPrice || "--" }}
|
</div>
|
</div>
|
</van-col>
|
</van-row>
|
<van-row>
|
<van-col span="12">
|
<div style="text-align: left">
|
<div class="sport-content-title2">{{ $t("持倉時間") }}</div>
|
<div class="sport-content-text2">
|
{{ $moment(item.buyOrderTime).format("YYYY-MM-DD HH:mm:ss") }}
|
</div>
|
</div>
|
</van-col>
|
<van-col span="12">
|
<div style="text-align: right">
|
<div class="sport-content-title2">{{ $t("訂單編號") }}</div>
|
<div class="sport-content-text2">{{ item.buyOrderId }}</div>
|
</div>
|
</van-col>
|
</van-row>
|
|
<div class="but-box" v-if="actives === 0" @click.stop="close(item)">
|
<div class="but">{{ $t("平仓") }}</div>
|
<!-- <div class="but buts">止盈止损</div> -->
|
</div>
|
</div>
|
</van-list>
|
|
<!-- <van-popup v-model="show" position="top" :style="{ height: '30%' }" /> -->
|
|
<Dialog ref="closeDialog" :title="$t('确认平仓')" :confirm="confirm">
|
<template v-slot:center>
|
<div>
|
<div class="hang">
|
<div class="left">{{ $t("hj39") }}</div>
|
<div class="right">{{ closeSell.stockName }}</div>
|
</div>
|
<div class="hang">
|
<div class="left">{{ $t("買漲/買跌") }}</div>
|
<div class="right">{{ $t(closeSell.orderDirection) }}</div>
|
</div>
|
<div class="hang">
|
<div class="left">{{ $t("倉位(股)") }}</div>
|
<div class="right" style="color: rgb(3, 173, 143)">
|
{{ closeSell.orderNum }}
|
</div>
|
</div>
|
<div class="hang">
|
<div class="left">{{ $t("類型") }}</div>
|
<div class="right">{{ $t("市價") }}</div>
|
</div>
|
</div>
|
</template>
|
</Dialog>
|
</div>
|
</template>
|
|
<script>
|
import Dialog from "@/components/Dialog";
|
import { getchicang, sell } from "../../../axios/api";
|
import { Notify } from "vant";
|
export default {
|
components: { Dialog },
|
props: {
|
activeObj: {
|
type: Object,
|
default: {},
|
},
|
},
|
data() {
|
return {
|
pageNum: 1,
|
pageSize: 150,
|
loading: true,
|
finished: false,
|
closeSell: {},
|
show: false,
|
actives: 0,
|
dataList: [],
|
tabsList: [
|
{
|
title: this.$t("持倉"),
|
key: 0,
|
},
|
|
{
|
title: this.$t("平倉"),
|
key: 1,
|
},
|
],
|
};
|
},
|
|
methods: {
|
pushRouter(item) {
|
const obj = {
|
pid: item.stockCode || "",
|
type: item.stockGid || "",
|
};
|
window.localStorage.setItem("kLine", JSON.stringify(obj));
|
// return;
|
var codes = item.stockCode;
|
var names = item.stockName;
|
|
this.$router.push({
|
path: "/kline",
|
query: {
|
name: names,
|
code: codes,
|
if_us: "",
|
if_zhishu: 0,
|
sok: "",
|
type: item.stockGid,
|
},
|
});
|
},
|
onLoad() {
|
this.pageNum++;
|
this.loading = true;
|
},
|
async confirm() {
|
const res = await sell({
|
positionSn: this.closeSell.positionSn,
|
});
|
if (res.status === 0) {
|
this.$refs.closeDialog.show = false;
|
this.dataList = [];
|
this.pageNum = 1;
|
this.finished = false;
|
this.getList();
|
this.$emit("closingPosition");
|
} else {
|
Notify({ type: "danger", message: res.msg });
|
}
|
},
|
// 获取仓位列表
|
async getList(laber) {
|
if (laber) {
|
this.dataList = [];
|
this.pageNum = 1;
|
this.finished = false;
|
}
|
const res = await getchicang({
|
state: this.actives,
|
stockType: laber || this.activeObj.laber,
|
pageNum: this.pageNum,
|
pageSize: this.pageSize,
|
});
|
|
this.loading = false;
|
if (res.status === 0) {
|
this.dataList = res.data.list;
|
// if (res.data.total <= this.dataList.length) {
|
this.finished = true;
|
// }
|
} else {
|
this.loading = false;
|
this.finished = true;
|
}
|
},
|
close(item) {
|
this.closeSell = item;
|
this.$refs.closeDialog.show = true;
|
},
|
clickTabs(e) {
|
this.dataList = [];
|
this.pageNum = 1;
|
this.finished = false;
|
this.actives = e.key;
|
this.getList();
|
},
|
},
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.sport-tabs {
|
// font-family: PingFang SC;
|
font-family: "DINPro";
|
width: 100%;
|
height: 0.90667rem;
|
margin-top: 0.42667rem;
|
display: flex;
|
align-items: center;
|
box-sizing: border-box;
|
justify-content: space-around;
|
border-bottom: 0.16rem solid #f7f7fa;
|
position: sticky;
|
top: 0;
|
z-index: 99;
|
background-color: #fff;
|
li {
|
height: 0.90667rem;
|
line-height: 0.90667rem;
|
font-style: normal;
|
font-weight: 400;
|
font-size: 0.37333rem;
|
text-align: center;
|
color: #14181f;
|
box-sizing: border-box;
|
}
|
.active {
|
color: #0066ed;
|
border-bottom: 0.08rem solid #0066ed;
|
}
|
}
|
.sport-content-li {
|
width: 100%;
|
height: 7.52rem;
|
display: flex;
|
flex-direction: column;
|
justify-content: space-between;
|
padding: 0.26667rem 0.37333rem;
|
border-bottom: 0.02667rem solid #f0f2f3;
|
box-sizing: border-box;
|
}
|
.title-box {
|
display: flex;
|
font-style: normal;
|
font-weight: 500;
|
font-size: 0.37333rem;
|
color: #14181f;
|
display: flex;
|
align-items: center;
|
|
.span {
|
}
|
.states {
|
display: inline-flex;
|
justify-content: center;
|
padding: 0.05333rem 0.16rem;
|
align-items: center;
|
align-content: flex-start;
|
font-size: 0.26667rem;
|
height: 0.48rem;
|
margin-left: 0.10667rem;
|
line-height: 0.26667rem;
|
text-align: center;
|
color: #03ad8f;
|
border-radius: 0.05333rem;
|
background: rgba(3, 173, 143, 0.15);
|
flex-shrink: 0;
|
font-weight: 900;
|
}
|
|
.states-red {
|
background: rgba(208, 75, 100, 0.15);
|
color: rgb(208, 75, 100);
|
}
|
}
|
|
.sport-content-title2 {
|
font-style: normal;
|
font-weight: 400;
|
font-size: 0.29333rem;
|
color: #8c9fad;
|
// text-align: left;
|
}
|
.sport-content-text {
|
margin-top: 5px;
|
font-style: normal;
|
// font-weight: 500;
|
font-size: 0.48rem;
|
color: #14181f;
|
// font-family: "PingFang SC";
|
// line-height: 18px;
|
// text-align: right;
|
}
|
.sport-content-text2 {
|
margin-top: 5px;
|
// font-family: "PingFang SC";
|
font-style: normal;
|
// font-weight: 500;
|
font-size: 0.34667rem;
|
color: #14181f;
|
word-break: break-word;
|
// line-height: 18px;
|
}
|
|
.but-box {
|
display: flex;
|
justify-content: space-around;
|
.but {
|
text-align: center;
|
|
min-width: 2.13333rem;
|
height: 0.69333rem;
|
line-height: 0.69333rem;
|
background: #e6f2ff;
|
border-radius: 0.10667rem;
|
list-style: none;
|
font-style: normal;
|
font-weight: 400;
|
font-size: 0.29333rem;
|
color: #0067ed;
|
border: none;
|
}
|
.buts {
|
min-width: 2.13333rem;
|
height: 0.69333rem;
|
line-height: 0.69333rem;
|
background: #fff;
|
border-radius: 0.10667rem;
|
list-style: none;
|
font-style: normal;
|
font-weight: 400;
|
font-size: 0.29333rem;
|
border: 0.01333rem solid #e4eaed;
|
color: #14181f;
|
}
|
}
|
.hang {
|
display: flex;
|
justify-content: space-between;
|
.left {
|
font-style: normal;
|
font-weight: 500;
|
font-size: 0.34667rem;
|
color: #8c9fad;
|
}
|
.right {
|
font-style: normal;
|
font-weight: 500;
|
font-size: 0.34667rem;
|
color: #14181f;
|
text-align: right;
|
}
|
}
|
|
|
</style>
|