my-index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <script>
  2. import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
  3. import blank from "@/components/en-utils/en-blank/en-blank.vue"
  4. import {
  5. getTotalMoney
  6. } from "@/api/money";
  7. import {
  8. getTeamList
  9. } from "@/api/member";
  10. export default {
  11. name: "my-index",
  12. props: {
  13. address: {
  14. default: ''
  15. }
  16. },
  17. components: {
  18. blank
  19. },
  20. watch: {
  21. 'address': function() {
  22. this.getIconNum()
  23. }
  24. },
  25. data() {
  26. return {
  27. coinNum: '',
  28. coinText: '',
  29. pledgeTotal: '',
  30. revenueTotal: '',
  31. list: [],
  32. page: 1,
  33. total: '',
  34. };
  35. },
  36. mounted() {
  37. this.getIconNum()
  38. this.getTotalMoney()
  39. this.getTeamList()
  40. },
  41. methods: {
  42. abbreviateString(str) {
  43. let startLength = 4;
  44. let endLength = 4;
  45. if (str.length <= startLength + endLength + 1) {
  46. return str; // 如果字符串长度不足以被截断,则返回原字符串
  47. }
  48. return str.slice(0, startLength) + '...' + str.slice(-endLength);
  49. },
  50. getTeamList() {
  51. getTeamList({
  52. 'page': this.page
  53. }).then(res => {
  54. if (res.code === 1) {
  55. this.list.push(...res.data.items)
  56. this.total = res.data.total
  57. }
  58. })
  59. },
  60. scrolltolower() {
  61. if (this.list.length < this.total) {
  62. ++this.page
  63. this.getTeamList()
  64. // console.log('触底');
  65. }
  66. },
  67. getTotalMoney() {
  68. getTotalMoney().then(res => {
  69. if (res.code === 1) {
  70. this.pledgeTotal = res.data.pledgeTotal
  71. this.revenueTotal = res.data.revenueTotal
  72. }
  73. })
  74. },
  75. getIconNum() {
  76. this.address = tokenpocketBnb.getMyAddress()
  77. if (this.address === '') {
  78. return
  79. }
  80. tokenpocketBnb.getTokenBalance(this.address, 0).then(coinNum => {
  81. this.coinNum = coinNum
  82. })
  83. },
  84. goUrl() {
  85. uni.navigateTo({
  86. url: 'pages/my/inner-page/all_profit'
  87. });
  88. },
  89. },
  90. }
  91. </script>
  92. <template>
  93. <view class="flex-common-box box-sizing-border">
  94. <view class="top-b bgc-f plr-20 box-sizing-border align-items-center flex-justify-space">
  95. <image class="img-box" src="@/static/img/logo/logo.png"></image>
  96. <view class="fs-30">
  97. {{abbreviateString(address)}}
  98. </view>
  99. </view>
  100. <view class="p-20">
  101. <view class="align-items-center mb-32">
  102. <view
  103. class="h-80 b-rad-20 bg-one flex-1 flex-direction-column align-items-center flex-justify-center mr-20">
  104. <view class="fs-28 fc-f">余额</view>
  105. <view class="fs-30 fc-f fw-b">
  106. {{coinNum}}
  107. </view>
  108. </view>
  109. <view
  110. class="h-80 b-rad-20 bg-two flex-1 flex-direction-column align-items-center flex-justify-center mr-20">
  111. <view class="fs-28 fc-f">贡献</view>
  112. <view class="fs-30 fc-f fw-b">
  113. {{pledgeTotal}}
  114. </view>
  115. </view>
  116. <view @click="goUrl"
  117. class="h-80 b-rad-20 bg-one flex-1 flex-direction-column align-items-center flex-justify-center">
  118. <view class="fs-28 fc-f">总收益</view>
  119. <view class="fs-30 fc-f fw-b">
  120. {{revenueTotal}}
  121. </view>
  122. </view>
  123. </view>
  124. <view class="fs-34 fw-b mb-20">
  125. 我的团队
  126. </view>
  127. <scroll-view :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
  128. <view class="bgc-f p-10 box-sizing-border b-rad-20" v-for="item in list">
  129. <view class="pb-10 border-bottom-e5e5e5 fs-28 mb-20">
  130. {{abbreviateString(item.address,6)}}
  131. </view>
  132. <view class="align-items-start flex-justify-space pb-10">
  133. <view class="flex-1 left-box">
  134. <view class="fs-28 mb-4">注册时间: {{item.created_date}}</view>
  135. <view class="fs-28 mb-4">团队人数:{{item.clanNum}}</view>
  136. <view class="fs-28">直推人数:{{item.recomNum}}</view>
  137. </view>
  138. <view class="flex-1 pl-20 box-sizing-border">
  139. <view class="fs-28 mb-4">自身业绩:{{item.recomPledge}}</view>
  140. <view class="fs-28">团队业绩:{{item.clanPledge}}</view>
  141. </view>
  142. </view>
  143. </view>
  144. </scroll-view>
  145. <view v-if="list.length<=0" class="blank-box align-items-center flex-justify-center">
  146. <blank :showBlank="list.length<=0?true:false" message="暂无数据"></blank>
  147. </view>
  148. </view>
  149. </view>
  150. </template>
  151. <style scoped lang="scss">
  152. .flex-common-box {
  153. width: 100%;
  154. height: calc(100vh - 138rpx);
  155. display: flex;
  156. flex-direction: column;
  157. }
  158. .bg-one {
  159. background-image: linear-gradient(270deg, #2353db, #54c8ff);
  160. }
  161. .bg-two {
  162. background-image: linear-gradient(270deg, #ffc62c, #ffa954);
  163. }
  164. .h-80 {
  165. height: 160rpx;
  166. }
  167. .left-box {
  168. border-right: 2rpx solid #ccc;
  169. }
  170. .img-box {
  171. width: 78rpx;
  172. height: 60rpx;
  173. }
  174. .top-b {
  175. width: 100%;
  176. height: 98rpx;
  177. line-height: 98rpx;
  178. }
  179. </style>