zzzz
2024-04-22 a5f4dd223bd0fc3ef727891d68b830ef825e23ba
src/page/trading/buy.vue
@@ -8,10 +8,10 @@
          </div>
          <div class="right_title">
            <div class="t_t" style="white-space: nowrap">
              <span>{{ name | getName }}</span>
              <span>{{ name }}</span>
            </div>
            <div class="b_t">
              <span>{{ code }}</span>
              <span>{{ spell }}</span>
            </div>
          </div>
        </div>
@@ -113,20 +113,11 @@
              </div>
            </div>
          </div>
          <div class="tr_rs gg" @click="showGg = true">
            <div class="top_bzz">
              <span>{{ $t("hj101") }}</span>
              <span>{{ selectCycle + "X" }}</span>
            </div>
            <!-- <div class="bottom_bzz">
                <span>{{  }}</span>
                <span>{{  }}</span>
              </div> -->
          </div>
          <div class="tr_rs">
            <div class="top_bzz" style="padding-bottom: 0.2rem">
              <span style="text-align: left">
                {{ $t("hj102") }}({{ moneyData.symbol || "$" }})
                {{ $t("交易总额") }}({{ moneyData.symbol || "$" }})
              </span>
              <span style="text-align: right">
                {{ $t("hj103") }}({{ moneyData.symbol || "$" }})
@@ -228,6 +219,7 @@
<script>
import * as api from "@/axios/api";
import { mapActions } from "vuex";
export default {
  name: "trBuy",
@@ -251,6 +243,9 @@
    if (this.$route.query.name) {
      this.name = this.$route.query.name;
    }
    if (this.$route.query.spell) {
      this.spell = this.$route.query.spell;
    }
    if (this.$route.query.type) {
      this.type = this.$route.query.type;
    }
@@ -272,6 +267,7 @@
      type: 0,
      code: "",
      name: "",
      spell: "",
      settingInfo: [],
      selectCycle: 1,
      siteLeverList: [],
@@ -313,7 +309,7 @@
    } else if (this.bayType == "qh") {
      this.priceTabs = [this.$t("hj108")];
    }
    this.getUserInfo();
    this.setUseInfo();
    this.getMoneyData();
    this.getSettingInfo();
  },
@@ -332,6 +328,8 @@
    },
  },
  methods: {
    ...mapActions(["setUseInfo"]),
    async getMoneyData() {
      let data = await api.getMoney();
      let type = this.bayType === "SZHB" ? "US" : this.bayType;
@@ -434,7 +432,7 @@
      let opts = {
        stockId: this.code,
        buyNum: this.num,
        lever: this.selectCycle ? this.selectCycle : 0,
        lever: 1,
        targetPrice: this.nums,
      };
      if (this.tabsCurrentIndex == 0) {
@@ -458,7 +456,7 @@
          elAlertType: "success",
        });
        this.getUserInfo();
        this.$router.push("/warehouse?index=1");
        this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
      } else {
        this.$store.commit("elAlertShow", {
          elAlertShow: true,
@@ -476,15 +474,7 @@
        this.$router.push("/authentications");
        return;
      }
      // if (!this.agree) {
      //   Toast('需同意合作协议才能交易!')
      // } else if (isNull(this.selectNumber) && isNull(this.autoNumber)) {
      //   Toast('请选择购买手数')
      // } else if (isNull(this.selectType)) {
      //   Toast('请选择买卖方向')
      // } else if(isNull(this.subaccountNumber)) {
      //   Toast('请选择子账户')
      // } else {}
      if (this.buying) {
        return;
      }
@@ -500,7 +490,7 @@
        // 买入是买涨buyType:0, 卖出是买跌buyType:1,卖出的状态是0,买入的状态是1
        buyNum: this.num, // 单位为手
        // buyNum: (this.num.match(/\d+/g))[0] * 100, // 单位为手
        lever: this.selectCycle ? this.selectCycle : 0,
        lever: 1,
      };
      if (this.tabsCurrentIndex == 0) {
        opts.buyType = 1;
@@ -538,7 +528,13 @@
          elAlertType: "success",
        });
        this.getUserInfo();
        this.$router.push("/warehouse?index=0");
        var buyType = "";
        if (this.tabsCurrentIndex == 0) {
          buyType = 1;
        } else {
          buyType = 0;
        }
        this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
      } else {
        if (data.msg.indexOf("不在交易时段内") > -1) {
          this.$store.commit("elAlertShow", {
@@ -565,7 +561,7 @@
          elAlertType: "success",
        });
        this.getUserInfo();
        this.$router.push("/warehouse?index=0");
        this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
      } else {
        this.$store.commit("elAlertShow", {
          elAlertShow: true,
@@ -643,7 +639,7 @@
  filters: {
    getName(name) {
      if (name.length > 15) {
        return name.substring(0, 14);
        return name;
      } else {
        return name;
      }