11
jhzh
2024-08-01 4ebbadfe4c8c7aa6404dcd9b126cc8265bf03c0d
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<template>
  <div class="financial">
    <div class="flex justify-between box-border px-30 mt-43">
      <div @click="onTab(0)" :class="{ active: tapIndex === 0 }"
        class=" w-370 h-75 lh-75 rounded-lg font-27 text-center mr-20">{{ $t('货币理财') }}</div>
      <div @click="onTab(1)" :class="{ active: tapIndex === 1 }" class=" w-370 h-75 lh-75 rounded-lg font-27 text-center">
        {{ $t('矿池理财') }}</div>
    </div>
    <div class="box-border px-30 mt-42">
      <div class="flex justify-between text-grey relative">
        <div class="flex">
          <span class="text-grey font-30">{{ $t('总资产') }}(USDT)</span>
          <div @click.stop="changeEyes">
            <img :src="require('../../assets/image/assets-center/eye-open.png')" class="w-32 h-18" v-show="!eyetel" />
            <img :src="require('../../assets/image/assets-center/eye-close.png')" class="w-32 h-18" v-show="eyetel" />
          </div>
        </div>
        <div class="right-clock">
          <img v-if="tapIndex === 0" @click="$router.push({ path: '/financialHistory', query: { type: 0 } })"
            :src="require('../../assets/image/assets-center/Subtract.png')" class="w-36 h-40" />
          <img v-if="tapIndex === 1" @click="$router.push({ path: '/financialHistory', query: { type: 1 } })"
            :src="require('../../assets/image/assets-center/Subtract.png')" class="w-36 h-40" />
        </div>
      </div>
      <div class="font-700 font-66 mt-18 textColor" v-if="!eyetel">
        <template v-if="tapIndex === 0">{{ funds.money_finance || '--' }}</template>
        <template v-if="tapIndex === 1">{{ funds.money_miner || '--' }}</template>
        <span class="font-39 text-grey" v-if="tapIndex === 0">≈{{ currency.currency_symbol }}{{ funds.money_finance ?
          (funds.money_finance *
            currency.rate).toFixed(2) : ' --' }}</span>
        <span class="font-39 text-grey" v-if="tapIndex === 1">≈{{ currency.currency_symbol }}{{ funds.money_miner ?
          (funds.money_miner *
            currency.rate).toFixed(2) : ' --' }}</span>
      </div>
      <div class="font-70 font-66 mt-18" v-else>********</div>
      <div class="flex font-26 lh-32 mb-35 mt-40">
        <div class="flex flex-col ">
          <div>{{ $t('预计日收益') }}({{ finData.outputCurrency ? finData.outputCurrency.toUpperCase() : 'USDT' }})</div>
          <template v-if="!eyetel">
            <div class="font-40 mt-17 mb-9 textColor">{{ finData.today_profit || '--' }}</div>
            <!-- <div>≈{{currency.currency_symbol}}{{ finData.today_profit ? (finData.today_profit *
            currency.rate).toFixed(2) : ' --' }}</div> -->
          </template>
          <template v-else>
            <div class="font-40 mt-17 mb-9 textColor">********</div>
          </template>
        </div>
        <div class="flex flex-col ml-110">
          <div>{{ $t('累计收益') }}({{ finData.outputCurrency ? finData.outputCurrency.toUpperCase() : 'USDT' }})</div>
          <template v-if="!eyetel">
            <div class="font-40 mt-17 mb-9 textColor">{{ finData.aready_profit || '0.00' }}</div>
            <!-- <div>≈{{currency.currency_symbol}}{{ finData.aready_profit ? (finData.aready_profit *
            currency.rate).toFixed(2) : '0.00' }}</div> -->
          </template>
          <template v-else>
            <div class="font-40 mt-17 mb-9 textColor">********</div>
          </template>
        </div>
      </div>
      <div class="flex flex-col lh-32 mb-35 ">
        <div>{{ $t('托管中总订单') }}</div>
        <template v-if="!eyetel">
          <div class="font-40 mt-17 mb-9 textColor">{{ finData.order_sum || 0 }}</div>
        </template>
        <template v-else>
          <div class="font-40 mt-17 mb-9 textColor">********</div>
        </template>
      </div>
    </div>
    <div class="w-full h-13 contBackground"></div>
    <div class="px-30">
      <div class="flex justify-between h-36 mt-37">
        <div v-if="tapIndex === 0" class=" font-6 h-36 lh-36 textColor">{{ $t('所有理财') }}</div>
        <div v-if="tapIndex === 0" class="font-26 blue h-36 lh-36 colorMain"
          @click="$router.push({ path: '/fund-rule', query: { back: 0 } })">{{ $t('规则') }}</div>
        <div v-if="tapIndex === 1" class=" font-6 h-36 lh-36 textColor">{{ $t('所有矿机') }}</div>
        <div v-if="tapIndex === 1" class="font-26 blue h-36 lh-36 colorMain"
          @click="$router.push({ path: '/machine-rule', query: { back: 0 } })">{{ $t('规则') }}</div>
      </div>
      <template v-if="tapIndex === 0">
        <financial-list :list="finList" :type="tapIndex" :btnShow="true"></financial-list>
      </template>
      <template v-else>
        <financial-list :list="machineList" :type="tapIndex" :btnShow="true"></financial-list>
      </template>
 
    </div>
  </div>
</template>
 
<script>
import { Icon } from 'vant';
import { mapGetters } from "vuex";
import financialList from "@/components/assetsCenter/financialList";
import { financeStatics, getMiningRevenueStatisticsList, getMachineBought, getfinacialProductsBought } from '@/API/financialManagement'
export default {
  name: "financial",
  components: {
    [Icon.name]: Icon,
    financialList
  },
  props: ['funds', 'index'],
  data() {
    return {
      tapIndex: 0,
      eyetel: false,
      total: "",
      finData: {},
      finList: [],
      machineList: []
      // minData: {}
    }
  },
  watch: {
    index: {
      handler: function (val) {
        this.tapIndex = val / 1
      },
      immediate: true
    }
  },
  computed: {
    ...mapGetters('home', ['currency'])
  },
  mounted() {
    console.log(this.currency)
    this.onTab(this.tapIndex)
  },
  methods: {
    onTab(index) {
      this.tapIndex = index
      if (index === 0) { // 理财
        this.getFin()
        getfinacialProductsBought({
          page_no: this.page,
          state: '1'
        }).then(res => {
          this.finList = res
          console.log('已购理财', res)
          // console.log(data)
        })
      } else { // 矿机
        this.getMin()
        getMachineBought({
          page_no: 1,
          state: 1
        }).then(res => {
          this.machineList = res
          console.log('已购矿机产品', res)
        })
      }
    },
    getFin() {
      financeStatics().then(data => {
        this.finData = data
      })
    },
    getMin() {
      getMiningRevenueStatisticsList().then(data => {
        this.finData = data
      })
    },
    changeEyes() {
      this.eyetel = !this.eyetel;
    },
  }
}
</script>
 
<style  lang="scss" scoped>
.w-370 {
  border: 1px solid #EAEDF2;
  color: #868D9A;
}
 
.active {
  color: #00D6CA;
 
 
  @include themify() {
    border-color: themed("btn_main");
  }
}
 
.lh-32 {
  color: #848E9C;
}
 
.font-40 {
  font-weight: 700;
}
 
.cl {
  color: #333333;
  background: #EBECF0;
}
 
.mr-13 {
  font-weight: 600;
  color: #333333;
}
 
.col {
  color: #848E9C;
}
 
.font-6 {
  font-weight: 600;
}
 
font-4 {
  font-weight: 400;
}
 
cl-33 {
  color: #333333;
}
</style>