DESKTOP-CVS3R96\我恁爹
2022-11-15 d8f6c671a613b841566c8d7b1f36eb2bb9640ea9
src/page/user/Warehouse.vue
@@ -15,7 +15,7 @@
        </div>
        <div class="overflow_box item" @click="SetTitleIndex(0)">
          <div class="left_titles">
            <span>{{ '沪深京账户' }}</span>
            <span>{{ $t('hj114') }}</span>
          </div>
          <div class="right_price">
            <span>{{ '' }}</span>
@@ -23,7 +23,7 @@
        </div>
        <div class="overflow_box item" @click="SetTitleIndex(1)">
          <div class="left_titles">
            <span>{{ '指数账户' }}</span>
            <span>{{ $t('hj115') }}</span>
          </div>
          <div class="right_price">
            <span>{{ '' }}</span>
@@ -31,7 +31,7 @@
        </div>
        <div class="overflow_box item" @click="SetTitleIndex(2)">
          <div class="left_titles">
            <span>{{ '新股账户' }}</span>
            <span>{{ $t('hj116') }}</span>
          </div>
          <div class="right_price">
            <span>{{ '' }}</span>
@@ -42,7 +42,7 @@
        <div class="top_card">
          <div class="card_content">
            <div class="t_title">
              <span>{{ '总资产' }}</span>
              <span>{{ $t('hj49') }}</span>
            </div>
            <div class="t_price">
              <!-- <span class="price">{{ '49,619.05' }}</span>
@@ -67,10 +67,10 @@
            </div>
            <div class="balance">
              <div class="left_titles">
                {{ '强平线' }}
                {{ $t('hj50') }}
              </div>
              <div class="right_titles">
                {{ '可用资金' }}
                {{ $t('hj54') }}
              </div>
            </div>
            <div class="num">
@@ -98,10 +98,10 @@
            </div>
            <div class="margin">
              <div class="left_titles">
                {{ '冻结保证金' }}
                {{ $t('hj55') }}
              </div>
              <div class="right_titles">
                {{ '持仓总盈亏' }}
                {{ $t('hj56') }}
              </div>
            </div>
            <div class="prices">
@@ -142,27 +142,26 @@
        <div class="tabs_card">
          <div class="tabs_card_content">
            <div class="tabs_top_title">
              <div class="title_items" v-for="(item, index) in   tabsArr" :key="index"
              <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 + ')' :
                    index == 1 ? '(' + totalss + ')' :
                      index == 2 ? '(' + totals + ')' : '(' + xgTotal + ')'
                }}</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="没有更多了"
              <van-list v-model="loading" :finished="finished" :finished-text="$t('hj43')"
                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="title">{{ item.stockName ? item.stockName : item.indexName }}</span>
                      <span class="buy_to_sell" :class="item.orderDirection == '买跌' ? 'maichu' : 'mairu'">
                        {{ item.orderDirection == "买跌" ? $t('hj84') : $t('hj85') }}</span>
                      <span class="multiple">{{ item.allProfitAndLose }}</span>
                      <span class="nums">{{ item.orderNum / 100 + '手' }}</span>
                      <span class="nums">{{ item.orderNum / 100 + $t('hj117') }}</span>
                    </div>
                    <div class="center_price">
                      <div class="profit">
@@ -177,17 +176,17 @@
                    </div>
                    <div class="bottom_price_title">
                      <div class="profit_title">
                        <span>{{ '浮动净盈亏' }}</span>
                        <span>{{ $t('hj118') }}</span>
                      </div>
                      <div class="start_price">
                        <span>{{ '开仓价格' }}</span>
                        <span>{{ $t('hj119') }}</span>
                      </div>
                      <div class="new_price">
                        <span>{{ '当前价格' }}</span>
                        <span>{{ $t('hj120') }}</span>
                      </div>
                    </div>
                    <div class="right_btn">
                      <span>{{ '平仓' }}</span>
                    <div class="right_btn pingbtn" @click="getpingcang(item.positionSn)">
                      <span>{{ $t('hj121') }}</span>
                    </div>
                  </div>
                </div>
@@ -196,9 +195,9 @@
                <div class="waiting_box">
                  <div class="img_cont">
                    <img src="../../assets/img/zhaobudao.png" alt />
                    <span class="gd">{{ '当前无持仓' }}</span>
                    <span class="gd">{{ $t('hj122') }}</span>
                    <div class="trading" @click="$router.push('/trading-list')">
                      <span>{{ '开始交易' }}</span>
                      <span>{{ $t('hj123') }}</span>
                    </div>
                  </div>
                </div>
@@ -211,24 +210,24 @@
                <div class="waiting_box">
                  <div class="img_cont">
                    <img src="../../assets/img/zhaobudao.png" alt />
                    <span class="gd">{{ '当前无挂单' }}</span>
                    <span class="gd">{{ $t('hj124') }}</span>
                    <div class="trading" @click="$router.push('/trading-list')">
                      <span>{{ '开始交易' }}</span>
                      <span>{{ $t('hj123') }}</span>
                    </div>
                  </div>
                </div>
              </div>
              <van-list v-model="loadingss" :finished="finishedss" finished-text="没有更多了"
              <van-list v-model="loadingss" :finished="finishedss" :finished-text="$t('hj43')"
                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="title">{{ item.stockName ? item.stockName : item.indexName }}</span>
                      <span class="buy_to_sell" :class="item.buyType == 1 ? 'maichu' : 'mairu'">{{
                          item.buyType == 1 ? '卖出' : '买入'
                          item.buyType == 1 ? $t('hj84') : $t('hj85')
                      }}</span>
                      <span class="multiple">{{ item.lever }}X</span>
                      <span class="nums">{{ item.buyNum / 100 + '手' }}</span>
                      <span class="nums">{{ item.buyNum / 100 + $t('hj117') }}</span>
                    </div>
                    <div class="center_price">
@@ -242,14 +241,14 @@
                    <div class="bottom_price_title">
                      <div class="start_price">
                        <span>{{ '挂单价格' }}</span>
                        <span>{{ $t('hj125') }}</span>
                      </div>
                      <div class="new_price">
                        <span>{{ '当前价格' }}</span>
                        <span>{{ $t('hj120') }}</span>
                      </div>
                    </div>
                    <div class="right_btn" @click="gdClose(item)">
                      <span>{{ '撤销' }}</span>
                      <span>{{ $t('hj126') }}</span>
                    </div>
                  </div>
                </div>
@@ -263,27 +262,30 @@
                <div class="waiting_box">
                  <div class="img_cont">
                    <img src="../../assets/img/zhaobudao.png" alt />
                    <span class="gd">{{ '当前无平仓' }}</span>
                    <span class="gd">{{ $t('hj127') }}</span>
                    <div class="trading" @click="$router.push('/trading-list')">
                      <span>{{ '开始交易' }}</span>
                      <span>{{ $t('hj123') }}</span>
                    </div>
                  </div>
                </div>
              </div>
              <van-list v-model="loadings" :finished="finisheds" finished-text="没有更多了" @load="onLoads"
              <van-list v-model="loadings" :finished="finisheds" :finished-text="$t('hj43')" @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="title">{{ item.stockName ? item.stockName : item.indexName }}</span>
                      <span class="buy_to_sell" :class="item.orderDirection == '买跌' ? 'maichu' : 'mairu'">{{
                          item.orderDirection == "买跌" ?
                            $t('hj84') : $t('hj85')
                      }}</span>
                      <span class="multiple">{{ item.allProfitAndLose }}</span>
                      <span class="nums">{{ item.orderNum / 100 + '手' }}</span>
                      <span class="nums">{{ item.orderNum / 100 + $t('hj117') }}</span>
                    </div>
                    <div class="bottom_price_title">
                      <div class="profit_res">
                        <span>平仓时间: {{ item.buyOrderTime | gettime }}</span>
                        <span>{{ $t('hj128') }}: {{ item.buyOrderTime | gettime }}</span>
                      </div>
                    </div>
                    <div class="right_count"
@@ -298,21 +300,21 @@
                <div class="waiting_box">
                  <div class="img_cont">
                    <img src="../../assets/img/zhaobudao.png" alt />
                    <span class="gd">{{ '当前无申购' }}</span>
                    <span class="gd">{{ $t('hj129') }}</span>
                    <div class="trading" @click="$router.push({ path: '/trading-list', query: { listid: 3 } })">
                      <span>{{ '开始交易' }}</span>
                      <span>{{ $t('hj123') }}</span>
                    </div>
                  </div>
                </div>
              </div>
              <van-list v-model="loadingXg" :finished="finishedXg" finished-text="没有更多了"
              <van-list v-model="loadingXg" :finished="finishedXg" :finished-text="$t('hj43')"
                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 == 1 ? 'mairu' : 'maichu'">{{
                          item.type == 1 ? '新股申购' : '线下配售'
                          item.type == 1 ? $t('hj45') : $t('hj46')
                      }}</span>
                      <!-- <span class="multiple">{{ item.lever  }}X</span>
                      <span class="nums">{{ item.buyNum / 100 + '手' }}</span> -->
@@ -329,17 +331,18 @@
                    <div class="bottom_price_title">
                      <div class="start_price">
                        <span>{{ '申购价格' }}</span>
                        <span>{{ $t('hj130') }}</span>
                      </div>
                      <div class="new_price">
                        <span>{{ '申购数量' }}</span>
                        <span>{{ $t('hj57') }}</span>
                      </div>
                    </div>
                    <div class="right_btn" @click="zcsg(item)" :class="item.status == 1 ? 'pink' : item.status == 2 ? 'red'
                                : item.status == 3 ? 'greeen' : item.status == 4 ? 'blue' : item.status == 5 ? 'purple' : ''">
                    : item.status == 3 ? 'greeen' : item.status == 4 ? 'blue' : item.status == 5 ? 'purple' : ''">
                      <span>{{ item.status == 1 ?
                          '已认购' : item.status == 2 ? '未中签'
                            : item.status == 3 ? '已中签' : item.status == 4 ? '已缴纳' : item.status == 5 ? '已转持仓'
                          $t('hj131') : item.status == 2 ? $t('hj132')
                            : item.status == 3 ? $t('hj133') : item.status == 4 ? $t('hj134') : item.status == 5 ?
                              $t('hj135')
                              : ''
                      }}</span>
                    </div>
@@ -360,13 +363,14 @@
<script>
import { Toast } from 'vant';
import { MessageBox } from 'mint-ui'
import * as api from "@/axios/api";
export default {
  data() {
    return {
      tabsArr: ["持仓", "挂单", "已平仓", "新股"],
      tabsArr: [this.$t('hj2'), this.$t('hj109'), this.$t('hj136'), this.$t('hj3')],
      tabsCurrentIndex: 0,
      titleName: "沪深京账户",
      titleName: this.$t('hj114'),
      indexSettingInfo: {},
      futuresSettingInfo: {},
      tabsPositionNumArr: [],
@@ -412,6 +416,58 @@
  },
  methods: {
    getpingcang(val) {
      if (!this.$store.state.userInfo.idCard) {
        Toast(this.$t('hj138'))
        this.$router.push('/authentication')
        return
      }
      if (this.titleIndex == 0) {
        MessageBox.confirm(this.$t('hj139') + '?', this.$t('hj165'), {
          confirmButtonText: this.$t('hj161'),
          cancelButtonText: this.$t('hj106'),
        }).then(async () => {
          let opt = {
            positionSn: val
          }
          let data = await api.sell(opt)
          if (data.status === 0) {
            Toast(data.msg)
            this.getzhishuListDetail();
            this.getzhishuListDetails();
            this.getorderList();
          } else if (data.msg.indexOf('不在交易时段内') > -1) {
            Toast(this.$t('hj140'))
          } else {
            Toast(data.msg)
          }
        }).catch(() => {
        });
      } else {
        MessageBox.confirm(this.$t('hj139') + '?', this.$t('hj165'), {
          confirmButtonText: this.$t('hj161'),
          cancelButtonText: this.$t('hj106'),
        }).then(async () => {
          let opt = {
            positionSn: val
          }
          let data = await api.sellIndex(opt)
          if (data.status === 0) {
            Toast(data.msg)
            this.getzhishuListDetail();
            this.getzhishuListDetails();
            this.getorderList();
          } else if (data.msg.indexOf('不在交易时段内') > -1) {
            Toast(this.$t('hj140'))
          } else {
            Toast(data.msg)
          }
        }).catch(() => {
        });
      }
    },
    onLoad() {
      this.page++;
      switch (this.titleIndex) {
@@ -451,7 +507,7 @@
      }
      let data = await api.delGuaDan(opts)
      if (data.status == 1) {
        Toast('撤单成功')
        Toast(this.$t('hj137'))
        this.page = 1;
        this.pages = 1;
        this.finished = false;
@@ -460,19 +516,19 @@
        this.tabsPcArr = [];
        switch (this.titleIndex) {
          case 0:
            this.titleName = "沪深京账户";
            this.titleName = this.$t('hj114');
            this.getListDetail();
            this.getListDetails();
            this.getorderList();
            break;
          case 1:
            this.titleName = "指数账户";
            this.titleName = this.$t('hj115');
            this.getzhishuListDetail();
            this.getzhishuListDetails();
            this.getorderList();
            break;
          case 2:
            this.titleName = "新股账户";
            this.titleName = this.$t('hj116');
            this.getQhListDetail();
            this.getQhListDetails();
            this.getorderList();
@@ -498,31 +554,37 @@
      this.tabsPcArr = [];
      switch (index) {
        case 0:
          this.titleName = "沪深京账户";
          this.titleName = this.$t('hj114');
          this.getListDetail();
          this.getListDetails();
          this.getorderList();
          this.handleTabsClick('', 0)
          break;
        case 1:
          this.titleName = "指数账户";
          this.titleName = this.$t('hj115');
          this.getzhishuListDetail();
          this.getzhishuListDetails();
          this.getorderList();
          this.handleTabsClick('', 0)
          break;
        case 2:
          this.titleName = "新股账户";
          this.getQhListDetail();
          this.getQhListDetails();
          this.getorderList();
          this.totalss = 0;
          this.totals = 0;
          this.total = 0;
          this.titleName = this.$t('hj116');
          this.handleTabsClick('', 3)
          // this.getQhListDetail();
          // this.getQhListDetails();
          // this.getorderList();
          break;
        default:
          break;
      }
      this.titleDialog = false;
      if (navigator.vibrate) {
          // 支持
          navigator.vibrate([55]);
        }
        // 支持
        navigator.vibrate([55]);
      }
    },
    handleTabsClick(item, index) {
      //持仓已平仓选项卡
@@ -531,9 +593,9 @@
        this.getNewXg();
      }
      if (navigator.vibrate) {
          // 支持
          navigator.vibrate([55]);
        }
        // 支持
        navigator.vibrate([55]);
      }
    },
    handleOpenDialog() {
      this.titleDialog = !this.titleDialog;
@@ -796,31 +858,49 @@
</script>
<style scoped lang="less">
.pink{
/deep/ .mint-msgbox-title {
  font-size: 0.4rem !important;
}
.pingbtn {
  width: auto !important;
  height: auto !important;
  background: rgb(45, 106, 233);
  color: rgb(255, 255, 255);
  padding: 0.2rem 0.4rem;
  border-radius: 0.2rem !important;
}
.pink {
  color: #eb2f96;
    background: #fff0f6;
    border-color: #ffadd2;
  background: #fff0f6;
  border-color: #ffadd2;
}
.red{
.red {
  color: #f5222d;
    background: #fff1f0;
    border-color: #ffa39e;
  background: #fff1f0;
  border-color: #ffa39e;
}
.blue{
.blue {
  color: #1890ff;
    background: #e6f7ff;
    border-color: #91d5ff;
  background: #e6f7ff;
  border-color: #91d5ff;
}
.green{
.green {
  color: #52c41a;
    background: #f6ffed;
    border-color: #b7eb8f;
  background: #f6ffed;
  border-color: #b7eb8f;
}
.purple{
.purple {
  color: #722ed1;
    background: #f9f0ff;
    border-color: #d3adf7;
  background: #f9f0ff;
  border-color: #d3adf7;
}
@boxCenter: {
  display: flex;
  justify-content: center;
@@ -1241,7 +1321,7 @@
  height: 0.7667rem;
  position: absolute;
  right: 1%;
  top: 48%;
  top: 27%;
  // background: #f7f7f7;
  // color: #3773dd;
  display: flex;