From 9ca581cca97e9ba95ff808f6b7a08c24a4758dbf Mon Sep 17 00:00:00 2001
From: DESKTOP-CVS3R96\我恁爹 <11>
Date: Fri, 11 Nov 2022 09:55:52 +0800
Subject: [PATCH] 9.55

---
 src/page/list/trading-list.vue |  264 +++++++++++++++++++---------------------------------
 1 files changed, 96 insertions(+), 168 deletions(-)

diff --git a/src/page/list/trading-list.vue b/src/page/list/trading-list.vue
index d90f0e7..cd04a2f 100644
--- a/src/page/list/trading-list.vue
+++ b/src/page/list/trading-list.vue
@@ -11,29 +11,16 @@
                   <img src="../../assets/img/searchs.png" alt />
                 </div>
                 <div class="search_input">
-                  <input
-                    type="text"
-                    class="searchs"
-                    placeholder="输入品种名称/代码搜索"
-                    ref="search"
-                    id="sousuo"
-                    onkeyup="value=value.replace(/[^a-zA-Z0-9]/g,'')"
-                    v-model="gpcode"
-                    @input="gpinput"
-                  />
+                  <input type="text" class="searchs" placeholder="输入品种名称/代码搜索" ref="search" id="sousuo"
+                    onkeyup="value=value.replace(/[^a-zA-Z0-9]/g,'')" v-model="gpcode" @input="gpinput" />
                 </div>
               </div>
             </div>
           </div>
           <div class="tab_class">
             <div class="scroll_tab">
-              <div
-                class="tab_items"
-                v-for="(item, index) in tabsClassArr"
-                :key="index"
-                :class="index == 0 ? 'mrt' : ''"
-                @click="handleTabsItem(item, index)"
-              >
+              <div class="tab_items" v-for="(item, index) in tabsClassArr" :key="index" :class="index == 0 ? 'mrt' : ''"
+                @click="handleTabsItem(item, index)">
                 <span :class="tabsItemIndex === index ? 'active' : ''">{{ item.name }}</span>
               </div>
             </div>
@@ -61,16 +48,12 @@
             </div>
           </div>
           <div class="list" :class="isToken == '' ? 'listHeight' : 'listHeights'">
-            <van-list
-              v-model="loading"
-              :finished="finished"
-              finished-text="没有更多了"
-              @load="onLoad"
-              :immediate-check="false"
-            >
+            <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad"
+              :immediate-check="false">
               <div class="van-clearfix">
                 <div class="list_items">
-                  <div class="item" v-for="(item, index) in listArr" :key="index" @click="handleGoToKlineDetail(item, index)">
+                  <div class="item" v-for="(item, index) in listArr" :key="index"
+                    @click="handleGoToKlineDetail(item, index)">
                     <div class="left_title">
                       <div class="tp">
                         <span class="collection" @click.stop="options(item)">
@@ -78,73 +61,57 @@
                         </span>
                         <span class="title_color">
                           {{ tabsItemIndex == 3 ? item.futuresName : tabsItemIndex ==
-                          2 ? item.name : tabsItemIndex == 0 ? item.name : item.indexName
+                              2 ? item.name : tabsItemIndex == 0 ? item.name : item.indexName
                           }}
                         </span>
                       </div>
                       <div class="bt">
                         <span>
                           {{ tabsItemIndex == 3 ? item.futuresCode : tabsItemIndex == 2 ? item.code : tabsItemIndex
-                          ==
-                          0 ? item.code : item.indexCode
+                              ==
+                              0 ? item.code : item.indexCode
                           }}
                         </span>
                       </div>
                     </div>
                     <div class="center_price">
                       <div class="tp">
-                        <span
-                          class="price_color"
-                          v-if="tabsItemIndex == 0 || tabsItemIndex == 2"
-                          :class="item.hcrate > 0 ? 'green' : 'red'"
-                        >
+                        <span class="price_color" v-if="tabsItemIndex == 0 || tabsItemIndex == 2"
+                          :class="item.hcrate > 0 ? 'green' : 'red'">
                           {{ item.nowPrice
                           }}
                         </span>
                         <span class="price_color" v-else>
                           {{ tabsItemIndex == 3 ? Number(item.nowPrice).toFixed(2) :
-                          item.currentPoint
+                              item.currentPoint
                           }}
                         </span>
                       </div>
                       <div class="bt">
-                        <span
-                          v-if="tabsItemIndex == 3 || tabsItemIndex == 1"
-                        >{{ '手续费:' + item.transFee }}</span>
+                        <span v-if="tabsItemIndex == 3 || tabsItemIndex == 1">{{ '手续费:' + item.transFee }}</span>
                         <span v-else>{{ item.today_min }}</span>
                       </div>
                     </div>
                     <div class="right_bs">
                       <div class="tp">
-                        <span
-                          class="price_color"
-                          v-if="tabsItemIndex == 0 || tabsItemIndex == 2"
-                          :class="item.hcrate > 0 ? 'green' : 'red'"
-                        >{{ item.hcrate }}</span>
-                        <span
-                          class="price_color"
-                          v-if="tabsItemIndex == 1"
-                          :class="item.floatRate > 0 ? 'green' : 'red'"
-                        >
+                        <span class="price_color" v-if="tabsItemIndex == 0 || tabsItemIndex == 2"
+                          :class="item.hcrate > 0 ? 'green' : 'red'">{{ item.hcrate }}</span>
+                        <span class="price_color" v-if="tabsItemIndex == 1"
+                          :class="item.floatRate > 0 ? 'green' : 'red'">
                           {{
-                          item.floatRate + '%'
+                              item.floatRate + '%'
                           }}
                         </span>
-                        <span
-                          class="price_color"
-                          v-if="tabsItemIndex == 3"
-                          :class="((item.nowPrice - item.lastClose) / item.lastClose * 100).toFixed(2) > 0 ? 'green' : 'red'"
-                        >
+                        <span class="price_color" v-if="tabsItemIndex == 3"
+                          :class="((item.nowPrice - item.lastClose) / item.lastClose * 100).toFixed(2) > 0 ? 'green' : 'red'">
                           {{
-                          item.lastClose == "" ? 0.00 : ((Number(item.nowPrice) - Number(item.lastClose)) /
-                          Number(item.lastClose) * 100).toFixed(2) + '%'
+                              item.lastClose == "" ? 0.00 : ((Number(item.nowPrice) - Number(item.lastClose)) /
+                                Number(item.lastClose) * 100).toFixed(2) + '%'
                           }}
                         </span>
                       </div>
                       <div class="bt">
-                        <div
-                          v-if="tabsItemIndex != 1 && tabsItemIndex != 3"
-                        >{{ item.stock_type.toUpperCase() }}</div>
+                        <div v-if="tabsItemIndex != 1 && tabsItemIndex != 3">{{ item.stock_type.toUpperCase() }}</div>
                         <!-- class="codeIcon" -->
                       </div>
                     </div>
@@ -163,14 +130,8 @@
                   <img src="../../assets/img/searchs.png" alt />
                 </div>
                 <div class="search_input">
-                  <input
-                    type="text"
-                    class="searchs"
-                    placeholder="输入品种名称/代码搜索"
-                    onkeyup="value=value.replace(/[^a-zA-Z0-9]/g,'')"
-                    v-model="gpcodes"
-                    @input="gpinputs"
-                  />
+                  <input type="text" class="searchs" placeholder="输入品种名称/代码搜索"
+                    onkeyup="value=value.replace(/[^a-zA-Z0-9]/g,'')" v-model="gpcodes" @input="gpinputs" />
                 </div>
               </div>
             </div>
@@ -188,13 +149,8 @@
           </div>
 
           <div class="list zxlist">
-            <van-list
-              v-model="loadings"
-              :finished="finisheds"
-              finished-text="没有更多了"
-              @load="onLoads"
-              :immediate-check="false"
-            >
+            <van-list v-model="loadings" :finished="finisheds" finished-text="没有更多了" @load="onLoads"
+              :immediate-check="false">
               <div class="van-clearfix">
                 <div class="list_items">
                   <div class="item" v-for="(item, index) in listArrs" :key="item.indexCode">
@@ -203,15 +159,15 @@
                         <span class="collection" @click="optionszx(item)">
                           <span class="shu" :class="item.isOption == '1' ? 'shublue' : ''"></span>
                         </span>
-                        <span class="title_color">{{ item.stockName}}</span>
+                        <span class="title_color">{{ item.stockName }}</span>
                       </div>
                       <div class="bt">
-                        <span>{{ item.stockCode}}</span>
+                        <span>{{ item.stockCode }}</span>
                       </div>
                     </div>
                     <div class="center_price">
                       <div class="tp">
-                        <span class="price_color">{{item.nowPrice}}</span>
+                        <span class="price_color">{{ item.nowPrice }}</span>
                       </div>
                       <div class="bt">
                         <span>{{ item.addTime }}</span>
@@ -219,10 +175,7 @@
                     </div>
                     <div class="right_bs">
                       <div class="tp">
-                        <span
-                          class="price_color"
-                          :class="item.hcrate > 0 ? 'green' : 'red'"
-                        >{{ item.hcrate }}</span>
+                        <span class="price_color" :class="item.hcrate > 0 ? 'green' : 'red'">{{ item.hcrate }}</span>
                       </div>
                       <div class="bt">
                         <!-- <div>{{ item.stock_type.toUpperCase() }}</div> -->
@@ -241,12 +194,7 @@
     <div class="top_title" ref="topTitle">
       <div>
         <div class="tabs_title">
-          <div
-            class="tb"
-            v-for="(item, index) in tabsArr"
-            :key="index"
-            @click="handleTabsClick(item, index)"
-          >
+          <div class="tb" v-for="(item, index) in tabsArr" :key="index" @click="handleTabsClick(item, index)">
             <span :class="index === tabsIndex ? 'active' : ''">{{ item }}</span>
           </div>
         </div>
@@ -257,38 +205,28 @@
                 <span>{{ '余额' }}</span>
               </div>
               <div class="right">
-                <span v-if="$store.state.userInfo.userAmt==undefined">¥0.00</span>
-                <span v-if="$store.state.userInfo&&tabsItemIndex == 1" style="white-space: nowarp;">
+                <span v-if="$store.state.userInfo.userAmt == undefined">¥0.00</span>
+                <span v-if="$store.state.userInfo && tabsItemIndex == 1" style="white-space: nowarp;">
                   {{ '¥' + $store.state.userInfo.userIndexAmt
                   }}
                 </span>
-                <span
-                  v-if="$store.state.userInfo.userAmt!=undefined&&tabsItemIndex == 0"
-                  style="white-space: nowarp;"
-                >
+                <span v-if="$store.state.userInfo.userAmt != undefined && tabsItemIndex == 0" style="white-space: nowarp;">
                   {{ '¥ ' + $store.state.userInfo.userAmt
                   }}
                 </span>
-                <span
-                  v-if="$store.state.userInfo.userAmt!=undefined&&tabsItemIndex == 2"
-                  style="white-space: nowarp;"
-                >
+                <span v-if="$store.state.userInfo.userAmt != undefined && tabsItemIndex == 2" style="white-space: nowarp;">
                   {{ '¥ ' + $store.state.userInfo.userAmt
                   }}
                 </span>
-                <span v-if="$store.state.userInfo&&tabsItemIndex == 3" style="white-space: nowarp;">
+                <span v-if="$store.state.userInfo && tabsItemIndex == 3" style="white-space: nowarp;">
                   {{
-                  '¥' + $store.state.userInfo.userFuturesAmt
+                      '¥' + $store.state.userInfo.userFuturesAmt
                   }}
                 </span>
               </div>
               <div class="sanjiao">
-                <img
-                  :class="dialogFlag ? 'xuanz' : ''"
-                  style="transition: all 0.5s;"
-                  src="../../assets/img/xiala.png"
-                  alt
-                />
+                <img :class="dialogFlag ? 'xuanz' : ''" style="transition: all 0.5s;" src="../../assets/img/xiala.png"
+                  alt />
               </div>
             </div>
             <div class="bottom_balance">
@@ -308,26 +246,20 @@
           </div>
           <div class="bottom_price">
             <div>
-              <p
-                v-if="this.$store.state.settingForm.indexDisplay && !this.$store.state.settingForm.futuresDisplay"
-                class="account"
-              >
+              <p v-if="this.$store.state.settingForm.indexDisplay && !this.$store.state.settingForm.futuresDisplay"
+                class="account">
                 ¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt +
-                $store.state.userInfo.userIndexAmt).toFixed(2)
+                    $store.state.userInfo.userIndexAmt).toFixed(2)
                 }}
               </p>
-              <p
-                v-else-if="!this.$store.state.settingForm.indexDisplay && this.$store.state.settingForm.futuresDisplay"
-                class="account"
-              >
+              <p v-else-if="!this.$store.state.settingForm.indexDisplay && this.$store.state.settingForm.futuresDisplay"
+                class="account">
                 ¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt +
-                $store.state.userInfo.userFuturesAmt).toFixed(2)
+                    $store.state.userInfo.userFuturesAmt).toFixed(2)
                 }}
               </p>
-              <p
-                v-else-if="!this.$store.state.settingForm.indexDisplay && !this.$store.state.settingForm.futuresDisplay"
-                class="account"
-              >¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt).toFixed(2) }}</p>
+              <p v-else-if="!this.$store.state.settingForm.indexDisplay && !this.$store.state.settingForm.futuresDisplay"
+                class="account">¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt).toFixed(2) }}</p>
               <!-- <p
                 v-else-if="this.$store.state.settingForm.indexDisplay && this.$store.state.settingForm.futuresDisplay"
                 class="account"
@@ -350,26 +282,26 @@
             <div>
               <span v-show="tabsItemIndex == 1">
                 {{ $store.state.hide ? '****' :
-                Number(($store.state.userInfo.enableIndexAmt +
-                $store.state.userInfo.allIndexFreezAmt) * indexSettingInfo.forceSellPercent).toFixed(2)
+                    Number(($store.state.userInfo.enableIndexAmt +
+                      $store.state.userInfo.allIndexFreezAmt) * indexSettingInfo.forceSellPercent).toFixed(2)
                 }}
               </span>
               <span v-show="tabsItemIndex == 0">
                 {{ $store.state.hide ? '****' : Number(($store.state.userInfo.enableAmt
-                +
-                $store.state.userInfo.allFreezAmt) * settingInfo.forceStopPercent).toFixed(2)
+                    +
+                    $store.state.userInfo.allFreezAmt) * settingInfo.forceStopPercent).toFixed(2)
                 }}
               </span>
               <span v-show="tabsItemIndex == 2">
                 {{ $store.state.hide ? '****' : Number(($store.state.userInfo.enableAmt
-                +
-                $store.state.userInfo.allFreezAmt) * settingInfo.forceStopPercent).toFixed(2)
+                    +
+                    $store.state.userInfo.allFreezAmt) * settingInfo.forceStopPercent).toFixed(2)
                 }}
               </span>
               <span v-show="tabsItemIndex == 3">
                 {{ $store.state.hide ? '****' :
-                Number(($store.state.userInfo.enableFuturesAmt +
-                $store.state.userInfo.allFuturesFreezAmt) * futuresSettingInfo.forceSellPercent).toFixed(2)
+                    Number(($store.state.userInfo.enableFuturesAmt +
+                      $store.state.userInfo.allFuturesFreezAmt) * futuresSettingInfo.forceSellPercent).toFixed(2)
                 }}
               </span>
             </div>
@@ -380,8 +312,8 @@
             <div>
               <span>
                 {{ tabsItemIndex == 1 ? '指数' : tabsItemIndex == 0 ? '沪深' : tabsItemIndex == 2 ? '科创' :
-                tabsItemIndex ==
-                3 ? '期货' : ''
+                    tabsItemIndex ==
+                      3 ? '期货' : ''
                 }}
               </span>
               <span>{{ '资产' }}</span>
@@ -422,9 +354,7 @@
               <span v-show="tabsItemIndex == 1">{{ '¥ ' + $store.state.userInfo.allIndexFreezAmt }}</span>
               <span v-show="tabsItemIndex == 0">{{ '¥ ' + $store.state.userInfo.allFreezAmt }}</span>
               <span v-show="tabsItemIndex == 2">{{ '¥ ' + $store.state.userInfo.allFreezAmt }}</span>
-              <span
-                v-show="tabsItemIndex == 3"
-              >{{ '¥ ' + $store.state.userInfo.allFuturesFreezAmt }}</span>
+              <span v-show="tabsItemIndex == 3">{{ '¥ ' + $store.state.userInfo.allFuturesFreezAmt }}</span>
             </div>
           </div>
         </div>
@@ -438,20 +368,16 @@
             <div>
               <span
                 :class="$store.state.userInfo.allIndexProfitAndLose > 0 ? ' red' : $store.state.userInfo.allIndexProfitAndLose < 0 ? ' green' : ''"
-                v-show="tabsItemIndex == 1"
-              >{{ '¥ ' + $store.state.userInfo.allIndexProfitAndLose }}</span>
+                v-show="tabsItemIndex == 1">{{ '¥ ' + $store.state.userInfo.allIndexProfitAndLose }}</span>
               <span
                 :class="$store.state.userInfo.allProfitAndLose > 0 ? ' red' : $store.state.userInfo.allProfitAndLose < 0 ? ' green' : ''"
-                v-show="tabsItemIndex == 0"
-              >{{ '¥ ' + $store.state.userInfo.allProfitAndLose }}</span>
+                v-show="tabsItemIndex == 0">{{ '¥ ' + $store.state.userInfo.allProfitAndLose }}</span>
               <span
                 :class="$store.state.userInfo.allProfitAndLose > 0 ? ' red' : $store.state.userInfo.allProfitAndLose < 0 ? ' green' : ''"
-                v-show="tabsItemIndex == 2"
-              >{{ '¥ ' + $store.state.userInfo.allProfitAndLose }}</span>
+                v-show="tabsItemIndex == 2">{{ '¥ ' + $store.state.userInfo.allProfitAndLose }}</span>
               <span
                 :class="$store.state.userInfo.allFuturesProfitAndLose > 0 ? 'red' : $store.state.userInfo.allFuturesProfitAndLose < 0 ? ' green' : ''"
-                v-show="tabsItemIndex == 3"
-              >{{ '¥ '+Number($store.state.userInfo.allFuturesProfitAndLose).toFixed(2)}}</span>
+                v-show="tabsItemIndex == 3">{{ '¥' +Number($store.state.userInfo.allFuturesProfitAndLose).toFixed(2)}}</span>
             </div>
           </div>
         </div>
@@ -461,13 +387,10 @@
 </template>
 
 <script>
-import { Toast } from 'mint-ui'
 import * as api from "@/axios/api";
-import elalert from "@/components/elalert.vue";
 export default {
   name: "trading",
   components: {
-    elalert
   },
   data() {
     return {
@@ -491,6 +414,8 @@
       gpcode: "",
       gpcodes: "",
       texts: "",
+      elAlertShow: false,
+      elAlertText: "",
       tabsClassArr: [
         {
           name: "沪深京",
@@ -530,6 +455,7 @@
   },
 
   mounted() {
+    
     this.loading = true;
     this.getStock();
     this.isToken = window.localStorage.getItem("USERTOKEN");
@@ -619,7 +545,7 @@
         // this.getProductSetting()
         this.$store.state.userInfo = data.data;
       } else {
-        Toast(data.msg);
+        this.$store.commit('elAlertShow',{'elAlertShow':true,'elAlertText': data.msg});
       }
       this.$store.state.user = this.user;
     },
@@ -630,7 +556,7 @@
         // 成功
         this.indexSettingInfo = data.data;
       } else {
-        Toast(data.msg);
+        this.$store.commit('elAlertShow',{'elAlertShow':true,'elAlertText': data.msg});
       }
     },
     async getFuturesSetting() {
@@ -640,7 +566,7 @@
         // 成功
         this.futuresSettingInfo = data.data;
       } else {
-        Toast(data.msg);
+        this.$store.commit('elAlertShow',{'elAlertShow':true,'elAlertText': data.msg});
       }
     },
     async getSettingInfo() {
@@ -649,7 +575,7 @@
         // 成功
         this.settingInfo = data.data;
       } else {
-        Toast(data.msg);
+        this.$store.commit('elAlertShow',{'elAlertShow':true,'elAlertText': data.msg});
       }
     },
     async getListMarket() {
@@ -685,14 +611,14 @@
           this.finished = true;
         }
         if (this.tabsItemIndex == 0) {
-          if(this.gpcode){
+          if (this.gpcode) {
             this.listArr = data.data.list;
-          }else{
+          } else {
             data.data.list.forEach(element => {
-            this.listArr.push(element);
-          });
+              this.listArr.push(element);
+            });
           }
-         
+
         }
       } else {
         this.texts = data.msg;
@@ -714,12 +640,12 @@
           this.finished = true;
         }
         if (this.tabsItemIndex == 2) {
-          if(this.gpcode){
+          if (this.gpcode) {
             this.listArr = data.data.list;
-          }else{
+          } else {
             data.data.list.forEach(element => {
-            this.listArr.push(element);
-          });
+              this.listArr.push(element);
+            });
           }
         }
       } else {
@@ -728,7 +654,7 @@
       }
     },
     handleGoToKlineDetail(item) {
-      var codes ="";
+      var codes = "";
       var names = "";
       var stock_type = "";
       var soks = "";
@@ -741,21 +667,21 @@
           soks = this.filterSH(item.stock_type);
           if_zhishu = '0';
           break;
-          case 1:
+        case 1:
           codes = item.indexGid;
           names = item.indexName;
           stock_type = 'sh';
           if_zhishu = item.indexCode;
           soks = 0;
           break;
-          case 2:
+        case 2:
           codes = item.code;
           names = item.name;
           stock_type = item.stock_type;
           soks = this.filterSH(item.stock_type);
           if_zhishu = '0';
           break;
-          case 3:
+        case 3:
           codes = item.futuresGid;
           names = item.futuresName;
           soks = 0;
@@ -765,7 +691,7 @@
         default:
           break;
       }
-     
+
       this.$router.push({
         path: "/kline",
         query: {
@@ -773,7 +699,7 @@
           stockplate: item.stock_plate,
           code: codes,
           type: stock_type,
-          sok:  soks,
+          sok: soks,
           if_zhishu: if_zhishu,
         }
       });
@@ -1046,7 +972,7 @@
   height: calc(100% - 1.3rem);
   background: #fff;
 
-  > .content {
+  >.content {
     width: 100%;
     height: 100%;
   }
@@ -1065,6 +991,7 @@
     justify-content: center;
     padding: 0 0.3rem;
     position: relative;
+
     .search_content {
       width: 100%;
       height: 90%;
@@ -1127,7 +1054,7 @@
   overflow: hidden;
   border-radius: 0 0 0.2rem 0.2rem;
 
-  > div {
+  >div {
     width: 100%;
     height: 1.2821rem;
     display: flex;
@@ -1171,7 +1098,7 @@
   display: -webkit-box;
   white-space: nowrap;
 
-  > div {
+  >div {
     display: inline-block;
     width: 15%;
     height: 100%;
@@ -1261,14 +1188,14 @@
     margin-top: -0.5rem;
     width: 100%;
 
-    > div {
+    >div {
       width: 100%;
       height: 1.0256rem;
       display: flex;
       margin: 0.5rem 0;
 
-      > div {
-        > div {
+      >div {
+        >div {
           display: flex;
           align-items: center;
         }
@@ -1310,7 +1237,7 @@
   color: #a1a2a4;
   display: flex;
 
-  > div {
+  >div {
     display: flex;
     align-items: center;
   }
@@ -1418,6 +1345,7 @@
       margin-left: 0.1rem;
       margin-right: 0.1rem;
       min-width: 1.9rem;
+
       span {
         font-weight: 600;
         text-align: right;

--
Gitblit v1.9.3