my-index.vue 3.9 KB

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