From cf0d36bbe155ecdfd8bca429666405e830d0dc7a Mon Sep 17 00:00:00 2001
From: XIGUASSR <623844246@qq.com>
Date: Sat, 12 Nov 2022 04:22:49 +0800
Subject: [PATCH] 最新
---
src/page/user/Warehouse.vue | 437 ++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 341 insertions(+), 96 deletions(-)
diff --git a/src/page/user/Warehouse.vue b/src/page/user/Warehouse.vue
index fc3e8ed..2078b34 100644
--- a/src/page/user/Warehouse.vue
+++ b/src/page/user/Warehouse.vue
@@ -106,23 +106,33 @@
</div>
<div class="prices">
<div class="left_titles">
- <span class="numDemo" v-show="titleIndex == 1">{{ '¥ ' + $store.state.userInfo.allIndexFreezAmt? $store.state.userInfo.allIndexFreezAmt:'0.00'
+ <span class="numDemo" v-show="titleIndex == 1">{{ '¥ ' + $store.state.userInfo.allIndexFreezAmt ?
+ $store.state.userInfo.allIndexFreezAmt : '0.00'
}}</span>
- <span class="numDemo" v-show="titleIndex == 0">{{ '¥ ' + $store.state.userInfo.allFreezAmt?$store.state.userInfo.allFreezAmt :'0.00'}}</span>
- <span class="numDemo" v-show="titleIndex == 2">{{ '¥ ' + $store.state.userInfo.allFuturesFreezAmt?$store.state.userInfo.allFuturesFreezAmt:'0.00'
+ <span class="numDemo" v-show="titleIndex == 0">{{ '¥ ' +
+ $store.state.userInfo.allFreezAmt ? $store.state.userInfo.allFreezAmt : '0.00'
+ }}</span>
+ <span class="numDemo" v-show="titleIndex == 2">{{ '¥ ' +
+ $store.state.userInfo.allFuturesFreezAmt ? $store.state.userInfo.allFuturesFreezAmt : '0.00'
}}</span>
</div>
<div class="right_titles">
<span class="numDemo"
:class="$store.state.userInfo.allIndexProfitAndLose > 0 ? ' red' : $store.state.userInfo.allIndexProfitAndLose < 0 ? ' green' : ''"
- v-show="titleIndex == 1">{{ '¥ ' + $store.state.userInfo.allIndexProfitAndLose?$store.state.userInfo.allIndexProfitAndLose:'0.00' }}</span>
+ v-show="titleIndex == 1">{{ '¥ ' +
+ $store.state.userInfo.allIndexProfitAndLose ? $store.state.userInfo.allIndexProfitAndLose : '0.00'
+ }}</span>
<span class="numDemo"
:class="$store.state.userInfo.allProfitAndLose > 0 ? ' red' : $store.state.userInfo.allProfitAndLose < 0 ? ' green' : ''"
- v-show="titleIndex == 0">{{ '¥ ' + $store.state.userInfo.allProfitAndLose?$store.state.userInfo.allProfitAndLose:'0.00' }}</span>
+ v-show="titleIndex == 0">{{ '¥ ' +
+ $store.state.userInfo.allProfitAndLose ? $store.state.userInfo.allProfitAndLose : '0.00'
+ }}</span>
<span class="numDemo"
:class="$store.state.userInfo.allFuturesProfitAndLose > 0 ? 'red' : $store.state.userInfo.allFuturesProfitAndLose < 0 ? ' green' : ''"
- v-show="titleIndex == 2">{{ '¥'+$store.state.userInfo.allFuturesProfitAndLose?Number($store.state.userInfo.allFuturesProfitAndLose).toFixed(2):'0.00'}}</span>
+ v-show="titleIndex == 2">{{
+ '¥' + $store.state.userInfo.allFuturesProfitAndLose ? Number($store.state.userInfo.allFuturesProfitAndLose).toFixed(2) : '0.00'
+ }}</span>
</div>
</div>
@@ -133,63 +143,69 @@
<div class="tabs_top_title">
<div class="title_items" v-for="(item, index) in tabsArr" :key="index"
@click="handleTabsClick(item, index)" :class="index == 0 ? 'kuan' : 'kuan'">
- <span :class="tabsCurrentIndex === index ? 'active' : ''">{{ item }}{{ index == 0 ? '(' + total + ')' : '(' + totals + ')'}}</span>
+ <span :class="tabsCurrentIndex === index ? 'active' : ''">{{ item }}{{ index == 0 ? '(' + total + ')' : index == 1 ? '(' + totalss + ')' :
+ index == 2 ? '(' + totals + ')' : '(' + xgTotal + ')'
+ }}</span>
</div>
</div>
<!-- 持仓 currentIndex: 0 -->
<div class="over">
-
- <van-list v-model="loading" :finished="finished" finished-text="没有更多了" v-show="tabsCurrentIndex === 0&&total != 0" @load="onLoad" :immediate-check="immediate">
- <div class="tabs_o" >
- <div class="tabs_o_items" v-for="(item, index) in tabsPositionNumArr" :key="item.buyOrderId">
- <div class="tabs_o_title">
- <span class="title">{{ item.stockName }}</span>
- <span class="buy_to_sell" :class="item.orderDirection=='买跌'?'maichu':'mairu'">{{ item.orderDirection=="买跌"?'卖出':'买入' }}</span>
- <span class="multiple">{{ item.allProfitAndLose }}</span>
- <span class="nums">{{ item.orderNum / 100 + '手' }}</span>
+ <van-list v-model="loading" :finished="finished" finished-text="没有更多了"
+ v-show="tabsCurrentIndex === 0 && total != 0" @load="onLoad" :immediate-check="immediate">
+ <div class="tabs_o">
+ <div class="tabs_o_items" v-for="(item, index) in tabsPositionNumArr" :key="item.buyOrderId">
+ <div class="tabs_o_title">
+ <span class="title">{{ item.stockName }}</span>
+ <span class="buy_to_sell" :class="item.orderDirection == '买跌' ? 'maichu' : 'mairu'">{{
+ item.orderDirection == "买跌" ? '卖出' : '买入'
+ }}</span>
+ <span class="multiple">{{ item.allProfitAndLose }}</span>
+ <span class="nums">{{ item.orderNum / 100 + '手' }}</span>
+ </div>
+ <div class="center_price">
+ <div class="profit">
+ <span>{{ item.profitAndLose }}</span>
</div>
- <div class="center_price">
- <div class="profit">
- <span>{{ item.profitAndLose }}</span>
- </div>
- <div class="start_price jiantou">
- <span>{{ item.buyOrderPrice }}</span>
- </div>
- <div class="new_price">
- <span>{{ item.now_price }}</span>
- </div>
+ <div class="start_price jiantou">
+ <span>{{ item.buyOrderPrice }}</span>
</div>
- <div class="bottom_price_title">
- <div class="profit_title">
- <span>{{ '浮动净盈亏' }}</span>
- </div>
- <div class="start_price">
- <span>{{ '开仓价格' }}</span>
- </div>
- <div class="new_price">
- <span>{{ '当前价格' }}</span>
- </div>
- </div>
- <div class="right_btn">
- <span>{{ '平仓' }}</span>
+ <div class="new_price">
+ <span>{{ item.now_price }}</span>
</div>
</div>
-
-
- </div>
- </van-list>
+ <div class="bottom_price_title">
+ <div class="profit_title">
+ <span>{{ '浮动净盈亏' }}</span>
+ </div>
+ <div class="start_price">
+ <span>{{ '开仓价格' }}</span>
+ </div>
+ <div class="new_price">
+ <span>{{ '当前价格' }}</span>
+ </div>
+ </div>
+ <div class="right_btn">
+ <span>{{ '平仓' }}</span>
+ </div>
+ </div>
+ </div>
+ </van-list>
<div class="waiting" v-if="total == 0 && tabsCurrentIndex === 0">
<div class="waiting_box">
<div class="img_cont">
<img src="../../assets/img/zhaobudao.png" alt />
- <span class="gd">{{ '当前无挂单' }}</span>
+ <span class="gd">{{ '当前无持仓' }}</span>
<div class="trading" @click="$router.push('/trading-list')">
<span>{{ '开始交易' }}</span>
</div>
</div>
</div>
</div>
- <div class="waiting" v-if="totals == 0 && tabsCurrentIndex === 1">
+
+
+
+ <!-- 挂单 -->
+ <div class="waiting" v-if="totalss == 0 && tabsCurrentIndex === 1">
<div class="waiting_box">
<div class="img_cont">
<img src="../../assets/img/zhaobudao.png" alt />
@@ -200,29 +216,133 @@
</div>
</div>
</div>
-
- <van-list v-model="loadings" :finished="finisheds" finished-text="没有更多了" @load="onLoads" :immediate-check="immediate" v-show="tabsCurrentIndex === 1&&totals != 0">
- <div class="tabs_o">
- <div class="tabs_o_items oes" v-for="(item, index) in tabsPcArr" :key="index">
- <div class="tabs_o_title">
- <span class="title">{{ item.stockName }}</span>
- <span class="buy_to_sell">{{ item.orderDirection }}</span>
- <span class="multiple">{{ item.allProfitAndLose }}</span>
- <span class="nums">{{ item.orderNum / 100 + '手' }}</span>
- </div>
- <div class="bottom_price_title">
- <div class="profit_res">
- <span>平仓时间: {{ item.buyOrderTime | gettime }}</span>
+ <van-list v-model="loadingss" :finished="finishedss" finished-text="没有更多了"
+ v-show="tabsCurrentIndex === 1 && totalss != 0" @load="onLoad" :immediate-check="immediate">
+ <div class="tabs_o">
+ <div class="tabs_o_items" v-for="(item, index) in tabsOrderList" :key="item.id">
+ <div class="tabs_o_title">
+ <span class="title">{{ item.stockName }}</span>
+ <span class="buy_to_sell" :class="item.buyType == 1 ? 'maichu' : 'mairu'">{{
+ item.buyType == 1 ? '卖出' : '买入'
+ }}</span>
+ <span class="multiple">{{ item.lever }}X</span>
+ <span class="nums">{{ item.buyNum / 100 + '手' }}</span>
+ </div>
+ <div class="center_price">
+
+ <div class="start_price jiantou">
+ <span>{{ item.targetPrice }}</span>
+ </div>
+ <div class="new_price">
+ <span>{{ item.nowPrice }}</span>
+ </div>
+ </div>
+ <div class="bottom_price_title">
+
+ <div class="start_price">
+ <span>{{ '挂单价格' }}</span>
+ </div>
+ <div class="new_price">
+ <span>{{ '当前价格' }}</span>
+ </div>
+ </div>
+ <div class="right_btn" @click="gdClose(item)">
+ <span>{{ '撤销' }}</span>
</div>
</div>
- <div class="right_count" :class="item.profitAndLose > 0 ? 'red' : item.profitAndLose == 0 ? '' : 'green'">
- <span>{{ item.profitAndLose }}</span>
+ </div>
+ </van-list>
+
+
+
+
+ <!-- 平仓 -->
+ <div class="waiting" v-if="totals == 0 && tabsCurrentIndex === 2">
+ <div class="waiting_box">
+ <div class="img_cont">
+ <img src="../../assets/img/zhaobudao.png" alt />
+ <span class="gd">{{ '当前无平仓' }}</span>
+ <div class="trading" @click="$router.push('/trading-list')">
+ <span>{{ '开始交易' }}</span>
+ </div>
</div>
</div>
</div>
- </van-list>
+
+ <van-list v-model="loadings" :finished="finisheds" finished-text="没有更多了" @load="onLoads"
+ :immediate-check="immediate" v-show="tabsCurrentIndex === 2 && totals != 0">
+ <div class="tabs_o">
+ <div class="tabs_o_items oes" v-for="(item, index) in tabsPcArr" :key="index">
+ <div class="tabs_o_title">
+ <span class="title">{{ item.stockName }}</span>
+ <span class="buy_to_sell">{{ item.orderDirection }}</span>
+ <span class="multiple">{{ item.allProfitAndLose }}</span>
+ <span class="nums">{{ item.orderNum / 100 + '手' }}</span>
+ </div>
+ <div class="bottom_price_title">
+ <div class="profit_res">
+ <span>平仓时间: {{ item.buyOrderTime | gettime }}</span>
+ </div>
+ </div>
+ <div class="right_count"
+ :class="item.profitAndLose > 0 ? 'red' : item.profitAndLose == 0 ? '' : 'green'">
+ <span>{{ item.profitAndLose }}</span>
+ </div>
+ </div>
+ </div>
+ </van-list>
+ <!-- 新股 -->
+ <div class="waiting" v-if="xgTotal == 0 && tabsCurrentIndex === 3">
+ <div class="waiting_box">
+ <div class="img_cont">
+ <img src="../../assets/img/zhaobudao.png" alt />
+ <span class="gd">{{ '当前无申购' }}</span>
+ <div class="trading" @click="$router.push({path:'/trading-list',query:{listid:3}})">
+ <span>{{ '开始交易' }}</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ <van-list v-model="loadingXg" :finished="finishedXg" finished-text="没有更多了"
+ v-show="tabsCurrentIndex === 3 && xgTotal != 0" @load="onLoadXg" :immediate-check="immediate">
+ <div class="tabs_o">
+ <div class="tabs_o_items" v-for="(item, index) in tabsXgArr" :key="item.id">
+ <div class="tabs_o_title">
+ <span class="title">{{ item.newName }}</span>
+ <span class="buy_to_sell" :class="item.type == 0 ? 'maichu' : 'mairu'">{{
+ item.type == 0 ? '线下配售' : '新股申购'
+ }}</span>
+ <!-- <span class="multiple">{{ item.lever }}X</span>
+ <span class="nums">{{ item.buyNum / 100 + '手' }}</span> -->
+ </div>
+ <div class="center_price">
+
+ <div class="start_price jiantou">
+ <span>{{ item.buyPrice }}</span>
+ </div>
+ <div class="new_price">
+ <span>{{ item.applyNums }}</span>
+ </div>
+ </div>
+ <div class="bottom_price_title">
+
+ <div class="start_price">
+ <span>{{ '申购价格' }}</span>
+ </div>
+ <div class="new_price">
+ <span>{{ '申购数量' }}</span>
+ </div>
+ </div>
+ <div class="right_btn" @click="zcsg(item)">
+ <span>{{ '新股申购' }}</span>
+ </div>
+ </div>
+ </div>
+ </van-list>
+
+
</div>
-
+
</div>
</div>
</div>
@@ -232,11 +352,12 @@
</template>
<script>
+ import { Toast } from 'vant';
import * as api from "@/axios/api";
export default {
data() {
return {
- tabsArr: ["持仓", "已平仓"],
+ tabsArr: ["持仓", "挂单", "已平仓","新股"],
tabsCurrentIndex: 0,
titleName: "沪深京账户",
indexSettingInfo: {},
@@ -248,13 +369,22 @@
titleDialog: false,
total: 0,
totals: 0,
+ totalss:0,
loading: false,
finished: false,
- finisheds:false,
+ finisheds: false,
+ finishedss: false,
page: 1,
pages: 1,
- immediate:false,
- loadings:false,
+ pagess: 1,
+ immediate: false,
+ loadings: false,
+ loadingss:false,
+ tabsOrderList:[],
+ xgTotal:0,
+ tabsXgArr:[],
+ loadingXg:false,
+ finishedXg:false,
};
},
mounted() {
@@ -264,6 +394,15 @@
this.getSettingInfo();
this.getFuturesSetting();
this.getListDetails();
+ this.getorderList();
+ this.getNewXg();
+ },
+ created() {
+ if(this.$route.query.index){
+ this.tabsCurrentIndex = Number(this.$route.query.index)
+ }
+
+
},
methods: {
onLoad() {
@@ -279,37 +418,95 @@
onLoads() {
this.pages++;
switch (this.titleIndex) {
- case 1:
+ case 2:
this.getListDetails();
break;
default:
break;
}
},
- SetTitleIndex(index) {
- //账户选项卡
- this.titleIndex = index;
- this.page = 1;
- this.pages = 1;
- this.finished = false;
- this.finisheds = false;
- this.tabsPositionNumArr = [];
- this.tabsPcArr = [];
- switch (index) {
+ onLoadss() {
+ this.pagess++;
+ switch (this.titleIndex) {
+ case 1:
+ this.getorderList();
+ break;
+ default:
+ break;
+ }
+ },
+ onLoadXg() {
+ this.getNewXg();
+ },
+ async gdClose(item){
+ let opts = {
+ id:item.id
+ }
+ let data = await api.delGuaDan(opts)
+ if(data.status == 1){
+ Toast('撤单成功')
+ this.page = 1;
+ this.pages = 1;
+ this.finished = false;
+ this.finisheds = false;
+ this.tabsPositionNumArr = [];
+ this.tabsPcArr = [];
+ switch (this.titleIndex) {
case 0:
this.titleName = "沪深京账户";
this.getListDetail();
this.getListDetails();
+ this.getorderList();
break;
case 1:
this.titleName = "指数账户";
this.getzhishuListDetail();
this.getzhishuListDetails();
+ this.getorderList();
break;
case 2:
this.titleName = "期货账户";
this.getQhListDetail();
this.getQhListDetails();
+ this.getorderList();
+ break;
+ default:
+ break;
+ }
+ }else{
+ Toast(data.msg)
+ }
+ },
+ zcsg(item){
+ this.$router.push({path:'/trading-list',query:{listid:3}})
+ },
+ SetTitleIndex(index) {
+ //账户选项卡
+ this.titleIndex = index;
+ this.page = 1;
+ this.pages = 1;
+ this.finished = false;
+ this.finisheds = false;
+ this.tabsPositionNumArr = [];
+ this.tabsPcArr = [];
+ switch (index) {
+ case 0:
+ this.titleName = "沪深京账户";
+ this.getListDetail();
+ this.getListDetails();
+ this.getorderList();
+ break;
+ case 1:
+ this.titleName = "指数账户";
+ this.getzhishuListDetail();
+ this.getzhishuListDetails();
+ this.getorderList();
+ break;
+ case 2:
+ this.titleName = "期货账户";
+ this.getQhListDetail();
+ this.getQhListDetails();
+ this.getorderList();
break;
default:
break;
@@ -319,9 +516,29 @@
handleTabsClick(item, index) {
//持仓已平仓选项卡
this.tabsCurrentIndex = index;
+ if(index==3){
+ this.getNewXg();
+ }
},
handleOpenDialog() {
this.titleDialog = !this.titleDialog;
+ },
+ //挂单
+ async getorderList(){
+ let opts={}
+ let data = await api.getorderList(opts);
+ this.loadingss = false;
+ if (data.status === 0) {
+ if (data.data.length < 15) {
+ this.finishedss = true;
+ }
+ data.data.forEach(element => {
+ this.tabsOrderList.push(element)
+ })
+ this.totalss = data.data.length
+ } else {
+ Toast(data.msg)
+ }
},
async getIndexSettingInfo() {
// 网站设置信息 指数
@@ -449,7 +666,7 @@
let data = await api.getOrderList(opt)
this.loadings = false;
if (data.status === 0) {
- if(data.data.list.length <15){
+ if (data.data.list.length < 15) {
this.finisheds = true;
}
data.data.list.forEach(element => {
@@ -472,9 +689,9 @@
}
let data = await api.getIndexOrderList(opt)
this.loadings = false;
- if(data.data.list.length <15){
- this.finisheds = true;
- }
+ if (data.data.list.length < 15) {
+ this.finisheds = true;
+ }
if (data.status === 0) {
data.data.list.forEach(element => {
this.tabsPcArr.push(element)
@@ -497,13 +714,33 @@
let data = await api.getFuturesOrderList(opt)
this.loadings = false;
if (data.status === 0) {
- if(data.data.list.length <15){
+ if (data.data.list.length < 15) {
this.finisheds = true;
}
data.data.list.forEach(element => {
this.tabsPcArr.push(element)
})
this.totals = data.data.total
+ } else {
+ Toast(data.msg)
+ }
+ },
+ async getNewXg() {
+ //获取新股
+ this.loadingXg = true;
+ let opt = {
+ }
+ let data = await api.getUserNewGuList(opt)
+ this.loadingXg = false;
+ if (data.data.length < 15) {
+ this.finishedXg = true;
+ }
+ if (data.status === 0) {
+ this.tabsXgArr = data.data
+ // data.data.list.forEach(element => {
+ // this.tabsXgArr.push(element)
+ // })
+ this.xgTotal = data.data.length
} else {
Toast(data.msg)
}
@@ -548,8 +785,11 @@
display: flex;
justify-content: center;
align-items: center;
-};
+}
+
+;
@topCardColor: #bdbdbd;
+
.warehouse_page {
width: 100%;
height: calc(100% - 1.2974rem);
@@ -817,13 +1057,14 @@
.tabs_o {
width: 100%;
margin-top: 0.3rem;
-
+
>.tabs_o_items {
width: 100%;
height: 2.2rem;
position: relative;
border-bottom: 0.01rem solid #ececec;
margin-bottom: 0.1rem;
+
.tabs_o_title {
width: 100%;
height: 0.7179rem;
@@ -841,9 +1082,9 @@
}
.buy_to_sell {
-
+
padding: 0.08rem 0.1rem;
-
+
font-weight: 600;
}
@@ -955,8 +1196,8 @@
}
.right_btn {
- width: 1.7949rem;
- height: 0.6667rem;
+ width: 1.9949rem;
+ height: 0.7667rem;
position: absolute;
right: 1%;
top: 48%;
@@ -1083,20 +1324,24 @@
font-weight: 500 !important;
;
}
-.maichu{
- color: rgb(225,57,65);
- background: rgb(252,238,240);
+
+.maichu {
+ color: rgb(225, 57, 65);
+ background: rgb(252, 238, 240);
}
-.mairu{
+
+.mairu {
color: rgb(109, 175, 125);
- background: rgb(215, 243, 235);
+ background: rgb(215, 243, 235);
}
-.jiantou{
+
+.jiantou {
position: relative;
}
-.jiantou::before{
+
+.jiantou::before {
content: '';
- background-image: url('../../assets/img/youyou.png') ;
+ background-image: url('../../assets/img/youyou.png');
background-size: 100% 100%;
width: 0.6rem;
height: 0.2rem;
--
Gitblit v1.9.3