zzzz
2024-04-17 c34c87ff6bf310e461ae27c1988d39baef208da8
1
{"ast":null,"code":"import \"core-js/modules/es.array.push.js\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport { _getAllWallet } from \"@/API/fund.api\";\nimport Axios from \"@/API/assets\";\nimport { mapGetters } from \"vuex\";\nimport { _futrueOrderList, _orderListHold } from \"@/API/trade.api\";\nimport PerpetualPositionList from \"@/components/perpetual-position-list/index.vue\";\nimport futrueHoldList from \"@/page/deliveryContract/hold.vue\";\nimport financialList from \"@/components/assetsCenter/financialList\";\nimport { getfinacialProductsBought, getMachineBought } from \"@/API/financialManagement\";\nexport default {\n  components: {\n    PerpetualPositionList,\n    futrueHoldList,\n    financialList\n  },\n  data() {\n    return {\n      loading: true,\n      active: 1,\n      tabList1: [{\n        id: 1,\n        text: this.$t(\"充币\"),\n        // route: \"/recharge/rechargePage?symbol=usdt\",\n        route: \"/recharge/rechargeList\"\n      }, {\n        id: 2,\n        text: this.$t(\"提币\"),\n        route: \"/withdraw/withdrawPage\"\n      },\n      // {\n      //   id: 4,\n      //   text: this.$t(\"闪兑\"),\n      //   route: \"/exchange/exchangePage\",\n      // },\n      {\n        id: 5,\n        text: this.$t(\"货币理财\"),\n        route: \"/financialHistory\",\n        query: {\n          type: 0\n        }\n      }, {\n        id: 6,\n        text: this.$t(\"矿池理财\"),\n        route: \"/financialHistory\",\n        query: {\n          type: 1\n        }\n      }],\n      tabList: [{\n        id: 1,\n        text: this.$t(\"现货\")\n      }, {\n        id: 2,\n        text: this.$t(\"交割合约\")\n      }, {\n        id: 4,\n        text: this.$t(\"永续合约\")\n      }, {\n        id: 5,\n        text: this.$t(\"理财\")\n      }],\n      funds: [],\n      tabListData: {},\n      assetsFunds: {}\n    };\n  },\n  created() {\n    this.getAssetsFunds();\n    this.getAssets();\n  },\n  computed: {\n    ...mapGetters(\"home\", [\"currency\", \"theme\"]),\n    allAssets() {\n      if (this.assetsFunds.total) {\n        switch (this.active) {\n          case 1:\n            return this.assetsFunds.money_all_coin;\n          case 2:\n            return this.assetsFunds.money_futures;\n          case 4:\n            return this.assetsFunds.money_contract;\n          case 5:\n            return Number(this.assetsFunds.money_finance) + Number(this.assetsFunds.money_miner);\n          default:\n            break;\n        }\n      }\n      return \"--\";\n    },\n    allName() {\n      // console.log(this.tabList);\n      const arr = this.tabList.filter(item => item.id === this.active);\n      return arr[0].text;\n    },\n    allAssetsRate() {\n      if (this.assetsFunds.total) {\n        switch (this.active) {\n          case 1:\n            return (this.assetsFunds.money_all_coin * this.currency.rate).toFixed(2);\n          case 2:\n            return (this.assetsFunds.money_futures * this.currency.rate).toFixed(2);\n          case 4:\n            return (this.assetsFunds.money_contract * this.currency.rate).toFixed(2);\n          case 5:\n            return ((Number(this.assetsFunds.money_finance) + Number(this.assetsFunds.money_miner)) * this.currency.rate).toFixed(2);\n          default:\n            break;\n        }\n      }\n      return \"--\";\n    }\n  },\n  methods: {\n    routerList(item) {\n      this.$router.push({\n        path: item.route,\n        query: item.query\n      });\n    },\n    onTab() {\n      getfinacialProductsBought({\n        page_no: \"\",\n        state: \"1\"\n      }).then(res => {\n        this.loading = false;\n        if (this.active === 5) {\n          this.funds = [...this.funds, ...res];\n        }\n      });\n      getMachineBought({\n        page_no: 1,\n        state: 1\n      }).then(res => {\n        this.loading = false;\n        if (this.active === 5) {\n          this.funds = [...this.funds, ...res];\n        }\n      });\n    },\n    onRecall() {\n      // 撤单or 平仓 evt\n      // this.clearTimer()\n      // this[this.curTab](this.symbol)\n      // this.fetchOrderListHold()\n    },\n    async fetchFutrueHoldList() {\n      // 获取交割当前持仓\n      const res = await _futrueOrderList();\n      // const { code, data } = res;\n      this.loading = false;\n      if (this.active === 2) {\n        this.funds = res;\n      }\n    },\n    // 获取永续当前持仓\n    async get_orderListHold() {\n      const res = await _orderListHold();\n      this.loading = false;\n      if (this.active === 4) {\n        this.funds = res;\n      }\n    },\n    // 获取总资产\n    async getAssetsFunds() {\n      const res = await Axios.GetAllAssets();\n      const {\n        code,\n        data\n      } = res;\n      if (code) {\n        this.assetsFunds = data;\n      }\n    },\n    // 切换\n    activeCheng(item) {\n      this.active = item.id;\n      this.funds = [];\n      this.loading = true;\n      if (item.id === 4) {\n        this.get_orderListHold();\n      } else if (item.id === 2) {\n        this.fetchFutrueHoldList();\n      } else if (item.id === 1) {\n        this.getAssets();\n      } else if (item.id === 5) {\n        this.onTab();\n      }\n    },\n    getAssets() {\n      _getAllWallet().then(res => {\n        this.tabListData = {\n          usdt: res.usdt,\n          lock_money: res.lock_money\n        };\n        this.loading = false;\n        let list = res.extends;\n        if (this.active === 1) {\n          this.funds = list;\n        }\n      });\n    },\n    goRouter(parmas) {\n      if (parmas === \"/exchange/exchangeHistory\") {\n        this.$router.push({\n          path: parmas,\n          query: {\n            type: 1\n          }\n        });\n      } else {\n        this.$router.push(parmas);\n      }\n    }\n  }\n};","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}