revenue.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <view class="revenue">
  3. <view class="top-jg"></view>
  4. <view class="nav-wrapper">
  5. <view class="nav-item" v-for="(item, index) in navList" :key="index" :class="{ active: currentIndex === index }" @click="navClick(index)">{{ item.title }}</view>
  6. </view>
  7. <view class="list">
  8. <view class="list-item flex">
  9. <view class="item-tpl">
  10. <view class="tpl name">有效算力</view>
  11. <view class="tpl num">{{ list.doing }}{{ navList[currentIndex].slUnit }}</view>
  12. </view>
  13. <view class="item-tpl">
  14. <view class="tpl name">待生效算力</view>
  15. <view class="tpl num">{{ list.stand }}{{ navList[currentIndex].slUnit }}</view>
  16. </view>
  17. </view>
  18. <view class="list-item">
  19. <view class="item-tpl tols">
  20. <view class="tpl name">累计挖币</view>
  21. <view class="tpl num">{{ list.all_mining }}{{ navList[currentIndex].unit }}</view>
  22. </view>
  23. <!-- <view class="item-tpl">
  24. <view class="tpl name">当前锁仓</view>
  25. <view class="tpl num">{{list.all_lock}}FIL</view>
  26. </view> -->
  27. </view>
  28. </view>
  29. <view class="all-num">
  30. <view class="num-item">
  31. <view class="title">总收益</view>
  32. <view class="num">{{ all_get }}{{ navList[currentIndex].unit }}</view>
  33. </view>
  34. <view class="num-item">
  35. <view class="title">累计释放</view>
  36. <view class="num">{{ all_unlock }}{{ navList[currentIndex].unit }}</view>
  37. </view>
  38. <view class="num-item">
  39. <view class="title">待释放</view>
  40. <view class="num">{{ all_lock }}{{ navList[currentIndex].unit }}</view>
  41. </view>
  42. </view>
  43. <view class="tip">
  44. <view class="line"></view>
  45. <view class="title">每日收益记录</view>
  46. <view class="line"></view>
  47. </view>
  48. <scroll-view :style="{ height: height }" class="days" scroll-y @scrolltolower="loadData()">
  49. <empty v-if="navList[currentIndex].loaded === true && navList[currentIndex].list.length === 0"></empty>
  50. <view class="day-item" v-for="(item, index) in navList[currentIndex].list" :key="index">
  51. <view class="item">
  52. <view class="item-title">结算日期:</view>
  53. <view class="item-value">{{item.add_date}}</view>
  54. </view>
  55. <view class="item">
  56. <view class="item-title">
  57. 今日可用
  58. <text>{{item.machine.second_step_get_ratio*1}}%</text>
  59. </view>
  60. <view class="item-value">{{item.unlock}}{{item.get_money_type}}</view>
  61. </view>
  62. <view class="item">
  63. <view class="item-title">
  64. 今日冻结
  65. <text>{{100-item.machine.second_step_get_ratio*1}}%</text>
  66. </view>
  67. <view class="item-value">{{item.all_lock}}{{item.get_money_type}}</view>
  68. </view>
  69. <view class="item">
  70. <view class="item-title">
  71. 今日释放
  72. <text>1/{{item.machine.third_step_time}}</text>
  73. </view>
  74. <view class="item-value">{{item.unstand}}{{item.get_money_type}}</view>
  75. </view>
  76. </view>
  77. <uni-load-more :status="navList[currentIndex].loadingType"></uni-load-more>
  78. </scroll-view>
  79. </view>
  80. </template>
  81. <script>
  82. import empty from '@/components/empty';
  83. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  84. import { mining, miningIndex, myMiningGet } from '@/api/calculation.js';
  85. export default {
  86. components: {
  87. empty,
  88. uniLoadMore
  89. },
  90. data() {
  91. return {
  92. list: '',
  93. navList: [
  94. {
  95. title: 'Fil',
  96. unit: 'FIL',
  97. slUnit: 'T',
  98. list: [],
  99. page: 1,
  100. limit: 10,
  101. loadingType: 'more'
  102. },
  103. {
  104. title: 'Chia',
  105. unit: 'XCH',
  106. slUnit: 'T',
  107. list: [],
  108. page: 1,
  109. limit: 10,
  110. loadingType: 'more'
  111. },
  112. {
  113. title: 'Bzz',
  114. unit: 'BZZ',
  115. slUnit: '节点',
  116. list: [],
  117. page: 1,
  118. limit: 10,
  119. loadingType: 'more'
  120. }
  121. ],
  122. currentIndex: 0,
  123. height: 0,
  124. allIncome: 0, //总收益
  125. ljIncome: 0, //累计收益
  126. wait: 0, //待释放,
  127. all_lock: 0, //待释放
  128. all_get: 0, //总收益
  129. all_unlock: 0 //累计释放
  130. };
  131. },
  132. onReady(res) {
  133. var _this = this;
  134. uni.getSystemInfo({
  135. success: resu => {
  136. const query = uni.createSelectorQuery();
  137. query.select('.days').boundingClientRect();
  138. query.exec(function(res) {
  139. console.log(res, 'ddddddddddddd');
  140. _this.height = resu.windowHeight - res[0].top + 'px';
  141. console.log('打印页面的剩余高度', _this.height);
  142. });
  143. },
  144. fail: res => {}
  145. });
  146. },
  147. onLoad() {
  148. let userInfo = uni.getStorageSync('userInfo') || '';
  149. this.level = userInfo.level;
  150. this.loadData();
  151. this.loadTopDate('FIL');
  152. },
  153. methods: {
  154. async loadTopDate(type) {
  155. uni.showLoading({
  156. title: '加载中...'
  157. });
  158. let obj = this;
  159. miningIndex({
  160. type: type
  161. }).then(({ data }) => {
  162. obj.list = data;
  163. uni.hideLoading();
  164. console.log(obj.list);
  165. });
  166. },
  167. //切换币种
  168. navClick(index) {
  169. if (index !== this.currentIndex) {
  170. this.currentIndex = index;
  171. this.loadTopDate(this.navList[index].unit);
  172. this.loadData('tabChange');
  173. }
  174. },
  175. loadData(source) {
  176. console.log('loadnoe')
  177. //这里是将list挂载到nav列表下
  178. let index = this.currentIndex;
  179. let navItem = this.navList[index];
  180. // let state = navItem.state;
  181. if (source === 'tabChange' && navItem.loaded === true) {
  182. //tab切换只有第一次需要加载数据
  183. return;
  184. }
  185. if (navItem.loadingType === 'loading') {
  186. //防止重复加载
  187. return;
  188. }
  189. if (navItem.loadingType === 'noMore') {
  190. //防止重复加载
  191. return;
  192. }
  193. // 修改当前对象状态为加载中
  194. navItem.loadingType = 'loading';
  195. myMiningGet({
  196. type: navItem.unit,
  197. page: navItem.page,
  198. limit: navItem.limit
  199. }).then(({ data }) => {
  200. console.log(data, '888888888888888888888');
  201. this.all_lock = data.all_lock;
  202. this.all_get = data.all_get;
  203. let arr = data.list.data.map(e => {
  204. return e;
  205. });
  206. navItem.list = navItem.list.concat(arr);
  207. console.log(arr)
  208. navItem.page++;
  209. if (navItem.limit == data.list.data.length) {
  210. //判断是否还有数据, 有改为 more, 没有改为noMore
  211. navItem.loadingType = 'more';
  212. console.log('more')
  213. return;
  214. } else {
  215. //判断是否还有数据, 有改为 more, 没有改为noMore
  216. navItem.loadingType = 'noMore';
  217. console.log('noMore')
  218. }
  219. this.$set(navItem, 'loaded', true);
  220. }).catch( e => {
  221. console.log(e)
  222. })
  223. // orderList({
  224. // type: state,
  225. // page: navItem.page,
  226. // limit: navItem.limit
  227. // })
  228. // .then(({ data }) => {
  229. // let arr = data.map(e => {
  230. // return e;
  231. // });
  232. // navItem.list = navItem.list.concat(arr);
  233. // // console.log(navItem.orderList);
  234. // navItem.page++;
  235. // if (navItem.limit == data.length) {
  236. // //判断是否还有数据, 有改为 more, 没有改为noMore
  237. // navItem.loadingType = 'more';
  238. // return;
  239. // } else {
  240. // //判断是否还有数据, 有改为 more, 没有改为noMore
  241. // navItem.loadingType = 'noMore';
  242. // }
  243. // this.$set(navItem, 'loaded', true);
  244. // })
  245. // .catch(e => {
  246. // console.log(e);
  247. // });
  248. //假数据
  249. // let arr = []
  250. // navItem.list = navItem.list.concat(arr)
  251. // navItem.page++
  252. // navItem.loadingType = 'noMore'
  253. // this.$set(navItem, 'loaded', true)
  254. // console.log(this.navList)
  255. }
  256. }
  257. };
  258. </script>
  259. <style lang="scss" scoped>
  260. page {
  261. width: 100%;
  262. }
  263. .top-jg {
  264. height: 55rpx;
  265. }
  266. .nav-wrapper {
  267. margin: 0rpx auto 10rpx;
  268. width: 627rpx;
  269. height: 60rpx;
  270. border: 2px solid #5771df;
  271. border-radius: 5rpx;
  272. display: flex;
  273. .nav-item {
  274. width: 209rpx;
  275. text-align: center;
  276. line-height: 60rpx;
  277. font-size: 28rpx;
  278. font-family: PingFang SC;
  279. font-weight: bold;
  280. color: #5771df;
  281. }
  282. .active {
  283. background: #5771df;
  284. color: #fff;
  285. }
  286. }
  287. .all-num {
  288. width: 627rpx;
  289. margin: 0 auto;
  290. display: flex;
  291. justify-content: space-between;
  292. font-size: 30rpx;
  293. font-family: PingFang SC;
  294. font-weight: bold;
  295. color: #333333;
  296. .num-item {
  297. width: 33.3%;
  298. flex-shrink: 0;
  299. display: flex;
  300. flex-direction: column;
  301. justify-content: center;
  302. align-items: center;
  303. .title {
  304. padding-bottom: 20rpx;
  305. }
  306. .num {
  307. font-weight: 500;
  308. }
  309. }
  310. }
  311. .tip {
  312. width: 627rpx;
  313. margin: 80rpx auto 70rpx;
  314. display: flex;
  315. justify-content: space-between;
  316. align-items: center;
  317. .line {
  318. width: 193rpx;
  319. height: 2rpx;
  320. background: #5771df;
  321. }
  322. .title {
  323. font-size: 28rpx;
  324. font-family: PingFang SC;
  325. font-weight: bold;
  326. color: #5771df;
  327. }
  328. }
  329. .days {
  330. // background-color: red;
  331. padding: 0 65rpx;
  332. .day-item {
  333. // height: 230rpx;
  334. border-bottom: 1px solid #f3f4f6;
  335. background-color: #fff;
  336. font-size: 24rpx;
  337. font-family: PingFang SC;
  338. font-weight: bold;
  339. color: #333333;
  340. display: flex;
  341. flex-direction: column;
  342. justify-content: space-around;
  343. padding: 20rpx 0;
  344. .item {
  345. display: flex;
  346. justify-content: space-between;
  347. text {
  348. display: inline-block;
  349. margin-left: 10rpx;
  350. }
  351. }
  352. }
  353. }
  354. .list {
  355. padding: 10rpx 65rpx 0;
  356. .list-item {
  357. // padding: 90rpx 118rpx 0 118rpx;
  358. margin-bottom: 15rpx;
  359. .item-tpl {
  360. background-color: #f7f6fb;
  361. text-align: center;
  362. // background-color: #FFFFFF;
  363. padding: 41rpx 0;
  364. width: 48%;
  365. .name {
  366. color: #666666;
  367. font-size: 24rpx;
  368. }
  369. .num {
  370. font-size: 32rpx;
  371. color: #333333;
  372. font-weight: bold;
  373. padding-top: 10rpx;
  374. }
  375. }
  376. }
  377. .tols {
  378. width: 100% !important;
  379. }
  380. }
  381. </style>