DESKTOP-CVS3R96\我恁爹
2022-11-12 8ac736966cb9748724123373cf517c19d79b8f70
src/page/list/trading-list.vue
@@ -44,8 +44,8 @@
              <span>{{ '最新价' }}</span>
            </div>
            <div class="item_title applies">
              <span v-show="tabsItemIndex!=3">{{ '涨跌幅' }}</span>
              <span v-show="tabsItemIndex==3" style="width: 100%;text-align: center;">{{ '最大数量' }}</span>
              <span v-show="tabsItemIndex != 3">{{ '涨跌幅' }}</span>
              <span v-show="tabsItemIndex == 3" style="width: 100%;text-align: center;">{{ '申购类型' }}</span>
            </div>
          </div>
          <div class="list" :class="isToken == '' ? 'listHeight' : 'listHeights'">
@@ -55,70 +55,78 @@
                <div class="list_items">
                  <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)">
                          <span v-show="tabsItemIndex!=3" class="shu" :class="item.isOption == '1' ? 'shublue' : ''"></span>
                          <span v-show="tabsItemIndex==3" class="shu hongse"></span>
                        </span>
                        <span class="title_color">
                          {{ tabsItemIndex == 3 ? item.name : tabsItemIndex ==
                              2 ? item.name : tabsItemIndex == 0 ? item.name : item.indexName
                          }}
                        </span>
                    <div v-if="(tabsItemIndex == 3 && item.zt == 0) || tabsItemIndex != 3">
                      <div class="left_title">
                        <div class="tp">
                          <span class="collection" @click.stop="options(item)">
                            <span v-show="tabsItemIndex != 3" class="shu"
                              :class="item.isOption == '1' ? 'shublue' : ''"></span>
                            <span v-show="tabsItemIndex == 3" class="shu hongse"></span>
                          </span>
                          <span class="title_color">
                            {{ tabsItemIndex == 3 ? item.name : tabsItemIndex ==
                                2 ? item.name : tabsItemIndex == 0 ? item.name : item.indexName
                            }}
                          </span>
                        </div>
                        <div class="bt">
                          <span>
                            {{ tabsItemIndex == 3 ? item.stockType + item.code : tabsItemIndex == 2 ? item.gid :
                                tabsItemIndex
                                  ==
                                  0 ? item.gid : item.indexCode
                            }}
                          </span>
                        </div>
                      </div>
                      <div class="bt">
                        <span>
                          {{ tabsItemIndex == 3 ? item.code : tabsItemIndex == 2 ? item.code : tabsItemIndex
                              ==
                              0 ? item.code : item.indexCode
                          }}
                        </span>
                      <div class="center_price">
                        <div class="tp">
                          <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.price).toFixed(2) :
                                item.currentPoint
                            }}
                          </span>
                        </div>
                        <div class="bt">
                          <span v-if="tabsItemIndex == 3 || tabsItemIndex == 1">{{ tabsItemIndex == 3 ? 'Max:' +
                              Number(item.orderNumber) : '手续费:' + Number(item.transFee)
                          }}</span>
                          <span v-else>{{ item.today_min }}</span>
                        </div>
                      </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'">
                          {{ item.nowPrice
                          }}
                        </span>
                        <span class="price_color" v-else>
                          {{ tabsItemIndex == 3 ? Number(item.price).toFixed(2) :
                              item.currentPoint
                          }}
                        </span>
                      </div>
                      <div class="bt">
                        <span v-if="tabsItemIndex == 3 || tabsItemIndex == 1">{{ tabsItemIndex == 3? '' :'手续费:' + Number(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'">
                          {{
                              item.floatRate + '%'
                          }}
                        </span>
                        <!-- <span class="price_color" v-if="tabsItemIndex == 3"
                      <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'">
                            {{
                                item.floatRate + '%'
                            }}
                          </span>
                          <!-- <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) + '%'
                          }}
                        </span> -->
                        <span v-if="tabsItemIndex == 3" class="price_color" style="text-align: center;width: 100%;">
                          {{item.orderNumber}}
                        </span>
                          <div v-if="tabsItemIndex == 3" :class="item.type == 1 ? 'xgsgType' : 'xgsgTypeRed'">
                            <!-- {{item.orderNumber}} -->
                            {{ item.type == 1 ? '新股申购' : '线下配售' }}
                          </div>
                        </div>
                        <div class="bt">
                          <div v-if="tabsItemIndex != 1 && tabsItemIndex != 3">{{ item.preclose_px }}</div>
                          <!-- class="codeIcon"  item.stock_type.toUpperCase()-->
                        </div>
                      </div>
                      <div class="bt">
                        <div v-if="tabsItemIndex != 1 && tabsItemIndex != 3">{{ item.stock_type.toUpperCase() }}</div>
                        <!-- class="codeIcon" -->
                      </div>
                    </div>
                  </div>
                </div>
@@ -215,15 +223,18 @@
                  {{ '¥' + $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.userAmt != undefined && tabsItemIndex == 3" style="white-space: nowarp;">
                <span v-if="$store.state.userInfo.userAmt != undefined && tabsItemIndex == 3"
                  style="white-space: nowarp;">
                  {{ '¥ ' + $store.state.userInfo.userAmt
                  }}
                </span>
@@ -295,7 +306,7 @@
                      $store.state.userInfo.allIndexFreezAmt) * indexSettingInfo.forceSellPercent).toFixed(2)
                }}
              </span>
              <span v-show="tabsItemIndex == 0||tabsItemIndex == 3">
              <span v-show="tabsItemIndex == 0 || tabsItemIndex == 3">
                {{ $store.state.hide ? '****' : Number(($store.state.userInfo.enableAmt
                    +
                    $store.state.userInfo.allFreezAmt) * settingInfo.forceStopPercent).toFixed(2)
@@ -331,7 +342,7 @@
          <div class="bottom_price">
            <div>
              <span v-show="tabsItemIndex == 1">{{ '¥ ' + $store.state.userInfo.userIndexAmt }}</span>
              <span v-show="tabsItemIndex == 0||tabsItemIndex == 3">{{ '¥ ' + $store.state.userInfo.userAmt }}</span>
              <span v-show="tabsItemIndex == 0 || tabsItemIndex == 3">{{ '¥ ' + $store.state.userInfo.userAmt }}</span>
              <span v-show="tabsItemIndex == 2">{{ '¥ ' + $store.state.userInfo.userAmt }}</span>
              <!-- <span v-show="tabsItemIndex == 3">{{ '¥ ' + $store.state.userInfo.userFuturesAmt }}</span> -->
            </div>
@@ -346,7 +357,7 @@
          <div class="bottom_price">
            <div>
              <span v-show="tabsItemIndex == 1">{{ '¥ ' + $store.state.userInfo.enableIndexAmt }}</span>
              <span v-show="tabsItemIndex == 0||tabsItemIndex == 3">{{ '¥ ' + $store.state.userInfo.enableAmt }}</span>
              <span v-show="tabsItemIndex == 0 || tabsItemIndex == 3">{{ '¥ ' + $store.state.userInfo.enableAmt }}</span>
              <span v-show="tabsItemIndex == 2">{{ '¥ ' + $store.state.userInfo.enableAmt }}</span>
              <!-- <span v-show="tabsItemIndex == 3">{{ '¥ ' + $store.state.userInfo.enableFuturesAmt }}</span> -->
            </div>
@@ -361,7 +372,8 @@
          <div class="bottom_price">
            <div>
              <span v-show="tabsItemIndex == 1">{{ '¥ ' + $store.state.userInfo.allIndexFreezAmt }}</span>
              <span v-show="tabsItemIndex == 0||tabsItemIndex == 3">{{ '¥ ' + $store.state.userInfo.allFreezAmt }}</span>
              <span v-show="tabsItemIndex == 0 || tabsItemIndex == 3">{{ '¥ ' + $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> -->
            </div>
@@ -380,7 +392,8 @@
                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||tabsItemIndex == 3">{{ '¥ ' + $store.state.userInfo.allProfitAndLose }}</span>
                v-show="tabsItemIndex == 0 || tabsItemIndex == 3">{{ '¥ ' + $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>
@@ -392,10 +405,59 @@
        </div>
      </div>
    </div>
    <!-- 新股弹窗 -->
    <van-popup v-model="settingDialog" position="bottom" :style="{ height: '35%' }" @close="popClose">
      <div class="setting_content">
        <div class="old_password">
          <div class="left_titles">
            <span>{{ '申购数量:' }}</span>
          </div>
          <div class="right_password_input">
            <input type="number" v-model="sgNum" />
          </div>
        </div>
        <div class="btn_setting" @click="changeSg()">
          <span>{{ '立即申购' }}</span>
        </div>
        <div class="shijian">
          <div class="xgsj">
            <div class="sjtlt">申购时间: </div>
            <div class="xgTime" v-if="this.sgsj">{{ this.sgsj | getTimeYear }}</div>
          </div>
          <div class="xgsj">
            <div class="sjtlt">认缴时间: </div>
            <div class="xgTime" v-if="this.rjsj">{{ this.rjsj | getTimeYear }}</div>
          </div>
        </div>
        <!-- <div class="old_password">
          <div class="left_titles">
            <span>{{ '新密码:' }}</span>
          </div>
          <div class="right_password_input">
            <input type="password" v-model="newPassword" />
          </div>
        </div>
        <div class="old_password">
          <div class="left_titles">
            <span>{{ '确认新密码:' }}</span>
          </div>
          <div class="right_password_input">
            <input type="password" v-model="cirNewPassword" />
          </div>
        </div> -->
      </div>
    </van-popup>
  </div>
</template>
<script>
//Toast
import { Toast } from 'vant';
import * as api from "@/axios/api";
export default {
  name: "trading",
@@ -420,9 +482,15 @@
      loadings: false,
      finished: false,
      finisheds: false,
      settingDialog: false,
      sgNum: 1,
      sgCode: '',
      gpcode: "",
      gpcodes: "",
      texts: "",
      sgsj: "",
      rjsj: "",
      orderNumber: "",
      elAlertShow: false,
      elAlertText: "",
      tabsClassArr: [
@@ -461,10 +529,12 @@
        this.$refs.search.focus();
      });
    }
    if(this.$route.query.listid){
      this.tabsItemIndex = Number(this.$route.query.listid)
    }
  },
  mounted() {
    this.loading = true;
    this.getStock();
    this.isToken = window.localStorage.getItem("USERTOKEN");
@@ -508,7 +578,7 @@
      // }
    },
    gpinput() {
      this.pageNum = 1;
      this.listArr = [];
      this.loading = true;
@@ -555,7 +625,7 @@
        // this.getProductSetting()
        this.$store.state.userInfo = data.data;
      } else {
        this.$store.commit('elAlertShow',{'elAlertShow':true,'elAlertText': data.msg});
        this.$store.commit('elAlertShow', { 'elAlertShow': true, 'elAlertText': data.msg });
      }
      this.$store.state.user = this.user;
    },
@@ -566,7 +636,7 @@
        // 成功
        this.indexSettingInfo = data.data;
      } else {
        this.$store.commit('elAlertShow',{'elAlertShow':true,'elAlertText': data.msg});
        this.$store.commit('elAlertShow', { 'elAlertShow': true, 'elAlertText': data.msg });
      }
    },
    async getFuturesSetting() {
@@ -576,7 +646,7 @@
        // 成功
        this.futuresSettingInfo = data.data;
      } else {
        this.$store.commit('elAlertShow',{'elAlertShow':true,'elAlertText': data.msg});
        this.$store.commit('elAlertShow', { 'elAlertShow': true, 'elAlertText': data.msg });
      }
    },
    async getSettingInfo() {
@@ -585,7 +655,7 @@
        // 成功
        this.settingInfo = data.data;
      } else {
       ` this.$store.commit('elAlertShow',{'elAlertShow':true,'elAlertText': data.msg});`
        ` this.$store.commit('elAlertShow',{'elAlertShow':true,'elAlertText': data.msg});`
      }
    },
    async getListMarket() {
@@ -663,8 +733,48 @@
        this.alertShow = true;
      }
    },
    popClose() {
      this.sgCode = '';
      this.sgsj = '';
      this.rjsj = '';
      this.orderNumber = '';
    },
    async changeSg() {
      if (!this.sgNum) {
        Toast('数量不能为空');
        return;
      };
      //this.sgNum必须是数字并且不能小于1
      if (this.sgNum < 1) {
        Toast('数量不能小于1');
        return;
      }
      if (this.sgNum > this.orderNumber) {
        Toast('数量不能大于' + this.orderNumber);
        return;
      }
      let opt = {
        newCode: this.sgCode,
        applyNums: this.sgNum,
        phone: this.$store.state.userInfo.phone,
      };
      let data = await api.getNewAdd(opt);
      if (data.status === 0) {
        this.sgShow = false;
        this.sgCode = '';
        this.sgsj = '';
        this.rjsj = '';
        this.orderNumber = '';
        Toast('申购成功');
        this.$router.push({ path: '/warehouse?index=3' });
      } else {
        Toast(data.msg);
      }
    },
    handleGoToKlineDetail(item) {
      var codes = "";
      var names = "";
      var stock_type = "";
@@ -693,7 +803,11 @@
          if_zhishu = '0';
          break;
        case 3:
          this.sgCode = item.code;
          this.sgsj = item.subscribeTime;
          this.rjsj = item.subscriptionTime;
          this.orderNumber = item.orderNumber;
          this.settingDialog = true;
          return;
          codes = item.futuresGid;
          names = item.futuresName;
@@ -728,8 +842,8 @@
    async getFutures() {
      // 获取期货列表
      let opt = {
      };
      let data = await api.getNewGu(opt);
      this.loading = false;
@@ -814,7 +928,6 @@
      this.pageNum = 1;
      this.finished = false;
      this.loading = true;
      console.log(item.type,"阿斯顿八岁的跟随阿达");
      switch (item.type) {
        case 1:
          this.listArr = [];
@@ -993,6 +1106,35 @@
      }
      //17:35:2922-06-2022
      return h + ":" + m + ":" + c;
    },
    getTimeYear(time) {
      if (!time) {
        return "";
      }
      var nd = new Date(time);
      var y = nd.getFullYear();
      var mm = nd.getMonth() + 1;
      var d = nd.getDate();
      var h = nd.getHours();
      var m = nd.getMinutes();
      var c = nd.getSeconds();
      if (mm < 10) {
        mm = "0" + mm;
      }
      if (d < 10) {
        d = "0" + d;
      }
      if (h < 10) {
        h = "0" + h;
      }
      if (m < 10) {
        m = "0" + m;
      }
      if (c < 10) {
        c = "0" + c;
      }
      //17:35:2922-06-2022
      return y + '-' + mm + '-' + d + ' ' + h + ":" + m + ":" + c;
    }
  }
};
@@ -1081,7 +1223,7 @@
  position: fixed;
  background: #fff;
  top: 0;
  z-index: 9999999;
  z-index: 2000;
  transition: all 0.5s;
  overflow: hidden;
  border-radius: 0 0 0.2rem 0.2rem;
@@ -1227,19 +1369,25 @@
      margin: 0.5rem 0;
      >div {
        width: 100%;
        height: 1.0256rem;
        display: flex;
        >div {
          display: flex;
          align-items: center;
        }
          >div {
            display: flex;
            align-items: center;
          }
        .tp {
          width: 100%;
          height: 70%;
        }
          .tp {
            width: 100%;
            height: 70%;
          }
        .bt {
          width: 100%;
          height: 30%;
          .bt {
            width: 100%;
            height: 30%;
          }
        }
      }
    }
@@ -1526,8 +1674,140 @@
/deep/.van-list__loading {
  margin-top: 0.2rem;
}
.hongse{
  background-color: #4d73b1!important;
.hongse {
  background-color: #4d73b1 !important;
}
.xgsgType {
  position: relative;
  top: 30%;
  left: 0;
  right: 0;
  margin: auto;
  width: 85%;
  height: 80%;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 0.1rem;
  background-color: rgba(102, 204, 153, 0.1);
  border: 0.04rem solid #5CE398;
  color: #5CE398;
}
.xgsgTypeRed {
  position: relative;
  top: 30%;
  left: 0;
  right: 0;
  margin: auto;
  width: 85%;
  height: 80%;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 0.1rem;
  background-color: rgba(223, 59, 59, 0.062);
  border: 0.04rem solid rgb(231, 61, 61);
  color: rgb(231, 61, 61);
}
.setting_content {
  width: 100%;
  height: 5rem;
  padding: 0.3rem;
  .old_password {
    width: 100%;
    height: 1.6rem;
    background: rgb(243, 243, 243);
    border-radius: 0.15rem;
    display: flex;
    margin-top: 0.8rem;
    .left_titles {
      margin-left: 0.2rem;
      width: 25%;
      height: 100%;
      display: flex;
      align-items: center;
      padding-left: 0.2rem;
      font-size: 0.3975rem;
      // justify-content: flex-end;
      span {
        font-weight: 600;
        letter-spacing: 0.04rem;
      }
    }
    .right_password_input {
      width: 75%;
      height: 100%;
      display: flex;
      align-items: center;
      input {
        width: 100%;
        height: 100%;
        padding-left: 0.2rem;
        border-radius: 0 0.2rem 0.2rem 0;
        font-size: 0.3975rem;
        font-weight: 600;
        //文字间距
        letter-spacing: 0.04rem;
      }
    }
  }
  .btn_setting {
    width: 100%;
    height: 1.3rem;
    border-radius: 0.15rem;
    background: #2d6ae9;
    color: #fff;
    font-size: 0.4615rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    span {
      font-weight: 600;
    }
  }
}
.shijian {
  width: 100%;
  height: 1.6rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}
.xgsj {
  font-size: 0.3875rem;
  font-weight: 600;
  display: flex;
  height: 50%;
  align-items: center;
}
.sjtlt {
  width: 25%;
  margin-left: 0.4rem;
}
.xgTime() {
  width: 75%;
}
/deep/.van-popup {
  border-radius: 0.2rem 0.2rem 0 0;
}
</style>