1
jhzh
2025-04-20 d157d0892f1ab5517dbe3a08328ccb9c4e446615
pages/base/contract.vue
@@ -23,28 +23,14 @@
    <!-- 开仓 -->
    <view class="layout-main">
      <open-position
        :query="query"
        :collect="collect"
        @option="option"
        :isShow="isShow"
        ref="openposition"
        :increase="increase"
        @symbol="symbolListShow = true"
        @getSymbolDetail="symbolDetail = $event"
        :symbolDetail="symbolDetail"
        :tabs="tabs"
         v-if="tab == 0"
      />
         <open-position :query="query" :collect="collect" @option="option" :isShow="isShow" ref="openposition"
            :increase="increase" @symbol="symbolListShow = true" @getSymbolDetail="symbolDetail = $event"
            :symbolDetail="symbolDetail" :tabs="tabs" v-if="tab == 0" />
    </view>
    <!-- 持仓 -->
    <main class="layout-main" v-if="tab == 1">
      <position
        :isShow="isShow"
        :symbolDetail="symbolDetail"
        :symbolLeft="symbolLeft"
      />
         <position :isShow="isShow" :symbolDetail="symbolDetail" :symbolLeft="symbolLeft" />
    </main>
    <!-- 委托 -->
    <main class="layout-main" v-if="tab == 2">
@@ -58,30 +44,13 @@
    <main class="layout-main" v-if="tab == 4">
      <contract-bill :symbolLeft="symbolLeft" />
    </main>
    <van-popup
      :show="symbolListShow"
      @close="symbolListShow = false"
      close-on-popstate
      position="left"
      custom-style="height:100%;width:70%"
    >
      <symbol-list
        :collect="collect"
        :title="$t('contract.a4')"
        :marketList="marketList"
        :heyue="1"
        :symbols="symbols"
        @check-symbol="checkSymbol"
      />
      <van-popup :show="symbolListShow" @close="symbolListShow = false" close-on-popstate position="left"
         custom-style="height:100%;width:70%">
         <symbol-list :collect="collect" :title="$t('contract.a4')" :marketList="marketList" :heyue="1"
            :symbols="symbols" @check-symbol="checkSymbol" />
    </van-popup>
    <van-dialog
      use-slot
      :show="contractStatusShow"
      :title="contractAgreement.title"
      @confirm="openContract"
      show-cancel-button
      @cancel="contractStatusShow = false"
    >
      <van-dialog use-slot :show="contractStatusShow" :title="contractAgreement.title" @confirm="openContract"
         show-cancel-button @cancel="contractStatusShow = false">
      <view class="p-md overflow-scroll">
        <rich-text class="p-md" :nodes="contractAgreement.body"></rich-text>
      </view>
@@ -97,7 +66,9 @@
import contractBill from "@/pages/exchange/contract-bill";
import Home from "@/api/home";
import Contract from "@/api/contract";
import { mapState } from "vuex";
   import {
      mapState
   } from "vuex";
export default {
  name: "contract",
  props: {
@@ -136,8 +107,24 @@
      symbols:''
    }
  },
      onShow() {
         // if (this.$route.query) {
         //    const username = this.$route.query;
         //    console.log(decodeURIComponent(username.symbol), 1); // 输出:JohnDoe
         //    this.query.symbol = decodeURIComponent(username.symbol)
         // }
      },
      mounted() {
         // if (this.$route.query) {
         //    const username = this.$route.query;
         //    console.log(decodeURIComponent(username.symbol), 1); // 输出:JohnDoe
         //    this.query.symbol = decodeURIComponent(username.symbol)
         // }
      },
  computed: {
    symbolLeft() {
      if (!this.query.symbol) return "";
      return this.query.symbol.split("/")[0];
    },
@@ -190,7 +177,9 @@
      this.symbols=obj.coin_name
      this.symbolListShow = false;
      if (obj.pair_name != this.query.symbol)
        this.query = { symbol: obj.pair_name };
               this.query = {
                  symbol: obj.pair_name
               };
    },
    // 获取自选列表
    getCollect() {
@@ -211,7 +200,10 @@
      });
      this.ws.on("message", (res) => {
        if(!this.isShow) return;
        let { data, sub } = res;
               let {
                  data,
                  sub
               } = res;
        if (sub == msg) {
          this.marketList = data.map((item) => {
            item.marketInfoList.forEach((el) => {
@@ -267,6 +259,11 @@
    },
  },
  created() {
         if (this.$route.query.symbol) {
            const username = this.$route.query;
            console.log(decodeURIComponent(username.symbol), 1); // 输出:JohnDoe
            this.query.symbol = decodeURIComponent(username.symbol)
         }
    this.getMarketList();
    this.getCollect();
    // this.openStatus();