1
admin
2026-01-11 fff675a093a912ecdda8e5498421a3e41ab0b596
src/page/trading/TradeNew.vue
@@ -1,14 +1,20 @@
<template>
  <div class="trade_new">
    <tab-head></tab-head>
    <tab-head>
      <!-- <van-popover v-model="showPopover" trigger="click" :actions="actions" @select="onSelect" slot="left">
        <template #reference>
          <van-button type="primary">{{ $t("一键平仓") }}</van-button>
        </template>
      </van-popover> -->
    </tab-head>
    <div class="order_tabs">
      <van-tabs v-model="active" swipe-threshold="1">
        <van-tab :title="$t('hj160')" name=""></van-tab>
        <van-tab :title="$t('美股指数')" name="US"></van-tab>
        <van-tab :title="$t('hksi')" name="HK"></van-tab>
        <van-tab :title="$t('tsi')" name="TW"></van-tab>
        <van-tab :title="$t('ni')" name="IN"></van-tab>
        <van-tab :title="$t('日股指数')" name="JP"></van-tab>
        <!-- <van-tab :title="$t('hksi')" name="HK"></van-tab>
        <van-tab :title="$t('tsi')" name="TW"></van-tab> -->
      </van-tabs>
    </div>
@@ -84,6 +90,7 @@
import tabHead from "@/components/tabHead.vue";
import * as api from "@/axios/api";
import nPagination from "@/components/nPagination.vue";
import { Notify } from "vant";
export default {
  components: {
@@ -102,7 +109,9 @@
        2: "IPO",
        3: this.$t("hj621"),
        4: "AI"
      }
      },
      actions: [{ text: '确定', key: '1' }, { text: '取消', key: '2' }],
      showPopover: false,
    };
  },
  watch: {
@@ -158,6 +167,19 @@
      times = setInterval(() => {
        this.getList();
      }, 3000);
    },
    // 一键平仓确认弹框
    onSelect(action) {
      if (action.key == 1) this.oneClose();
    },
    // 一键平仓
    async oneClose() {
      const res = await api.allsell();
      if (res.status === 0) {
        Notify({ type: "success", message: res.msg });
      } else {
        Notify({ type: "danger", message: res.msg });
      }
    }
  }
};