1
PC-20250623MANY\Administrator
2025-08-23 368676106d5a6e29b6447a8f3a09990cf78aab66
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import * as api from "@/axios/api";
export default {
  data() {
    return {
      pageNum: 1,
      pageSize: 10,
      total: 1,
      tableData: [],
      apiInterface: null,
 
      // 词典
      dictionary: {
        // 股票类型
        gplx: {
          0: this.$t("日内"),
          2: "IPO",
          3: this.$t("hj621"),
          4: "AI",
        },
        // ipo类型
        ipolx: {
          1: this.$t("申购中"),
          2: this.$t("hj132"),
          3: this.$t("hj133"),
          4: this.$t("hj134"),
          5: this.$t("hj135"),
          6: this.$t("已上市"),
        },
        // 基金类型
        jjlx: {
          1: this.$t("进行中"),
          2: this.$t("已赎回"),
        },
      },
 
      htu: 1, // HK转US汇率
      itu: 1, // IN转US汇率
      ttu: 1, // TW转US汇率
    };
  },
  watch: {
    // pageNum() {
    //   this.getList();
    // },
    // pageSize() {
    //   this.init();
    // },
    opt: {
      handler() {
        this.init();
      },
      deep: true,
    },
  },
  methods: {
    // 计算当前汇率
    rate(type) {
      let rate = 1;
      if (type == "HK") rate = this.htu;
      else if (type == "IN") rate = this.itu;
      else if (type == "TW") rate = this.ttu;
      return rate;
    },
    // 初始化
    init() {
      this.pageNum = 1;
      this.getList();
    },
    // 获取列表
    async getList() {
      let option = {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
      };
      if (this.opt) option = { ...option, ...this.opt };
      let data = await this.apiInterface(option);
      if (data.status === 0) {
        this.tableData = data.data.list || data.data.records || data.data;
        this.total = data.data.total;
 
        if (this.getListAfter) this.getListAfter(); // 获取列表后,如果方法getListAfter存在,则执行
      }
      // console.log("data", data);
    },
    // 翻页
    handleCurrentChange(val) {
      this.pageNum = val;
      this.getList();
    },
    // 获取汇率
    async getExchangeRate() {
      let data = await api.getRateInfo();
      data.data &&
        data.data.forEach((item) => {
          if (item.currency === "HKD" && item.conversionCurrency == "USD") {
            this.htu = item.rata;
          } else if (
            item.currency === "INR" &&
            item.conversionCurrency == "USD"
          ) {
            this.itu = item.rata;
          } else if (
            item.currency === "TWD" &&
            item.conversionCurrency == "USD"
          ) {
            this.ttu = item.rata;
          }
        });
    },
  },
};