home-index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <script>
  2. import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
  3. import {
  4. getTotalMoney
  5. } from "@/api/money";
  6. import {
  7. getDividendList
  8. } from "@/api/pledge";
  9. import blank from "@/components/en-utils/en-blank/en-blank.vue"
  10. export default {
  11. name: "home-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. listTab:1,
  28. coinNum: '',
  29. pledgeTotal: '',
  30. revenueTotal: '',
  31. price: '',
  32. page: 1,
  33. total: '',
  34. pledgeNUm: '',
  35. list: []
  36. };
  37. },
  38. mounted() {
  39. this.getIconNum()
  40. this.getTotalMoney()
  41. this.getDividendList()
  42. },
  43. methods: {
  44. setListTab(listTab) {
  45. if (this.listTab !== listTab) {
  46. this.listTab = listTab
  47. }
  48. },
  49. getDividendList() {
  50. getDividendList({
  51. 'page': this.page
  52. }).then(res => {
  53. if (res.code === 1) {
  54. this.list.push(...res.data.items)
  55. this.total = res.data.total
  56. }
  57. })
  58. },
  59. scrolltolower() {
  60. if (this.list.length < this.total) {
  61. ++this.page
  62. this.getDividendList()
  63. // console.log('触底');
  64. }
  65. },
  66. getTotalMoney() {
  67. getTotalMoney().then(res => {
  68. if (res.code === 1) {
  69. this.pledgeTotal = res.data.pledgeTotal
  70. this.revenueTotal = res.data.revenueTotal
  71. this.price = res.data.price
  72. }
  73. })
  74. },
  75. async getIconNum() {
  76. if (this.address === '') {
  77. return
  78. }
  79. setTimeout(async () => {
  80. this.coinNum = await tokenpocketBnb.getTokenBalance(this.address, 0)
  81. console.log(this.coinNum, "icon-num----------------------")
  82. }, 100)
  83. },
  84. setMax(){
  85. if(this.type===1){
  86. this.formNUm=this.usdtNum
  87. }else {
  88. this.formNUm=this.iconNum
  89. }
  90. },
  91. },
  92. }
  93. </script>
  94. <template>
  95. <view>
  96. <view class="bgc-f p-20 box-sizing-border b-rad-20 mb-40">
  97. <image class="head-img" :src="require('@/static/img/index/index/bannerhome.png')" mode="widthFix"></image>
  98. </view>
  99. <view class="bgc-f p-20 box-sizing-border b-rad-20 mb-40">
  100. <view class="b-rad-20 h-80 align-items-center bgc-f1f9fe">
  101. <view class="flex-1 flex-direction-column align-items-center flex-justify-center">
  102. <view class="fs-28 mb-8">
  103. DAO價格($)
  104. </view>
  105. <view class="fs-28 fw-b">
  106. {{price}}
  107. </view>
  108. </view>
  109. <view class="flex-1 flex-direction-column align-items-center flex-justify-center">
  110. <view class="fs-28 mb-8">
  111. DAO餘額
  112. </view>
  113. <view class="fs-28 fw-b">
  114. {{coinNum}}
  115. </view>
  116. </view>
  117. <view class="flex-1 flex-direction-column align-items-center flex-justify-center">
  118. <view class="fs-28 mb-8">
  119. 贡献总额
  120. </view>
  121. <view class="fs-28 fw-b">
  122. {{pledgeTotal}}
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. <view class="list-tab">
  128. <view class="tab-items">
  129. <view class="tab-item" @click="setListTab(1)" :class="{'option-tab':listTab===1}">
  130. 质押
  131. </view>
  132. <view class="tab-item" @click="setListTab(2)" :class="{'option-tab':listTab===2}">
  133. 解压
  134. </view>
  135. <!-- <view class="tab-item" @click="setListTab(3)" :class="{'option-tab':listTab===3}">-->
  136. <!-- {{ $t('index.index.code') }}-->
  137. <!-- </view>-->
  138. </view>
  139. <view class="tab-item-bg"
  140. :class="{'bg-location-1':listTab===1,'bg-location-2':listTab===2,'bg-location-3':listTab===3}"></view>
  141. <view class="bgc-f p-40">
  142. <view class="bgc-F6F7FA b-rad-20 mb-20 p-20 box-sizing-border mb-20" >
  143. <view class="align-items-start flex-justify-space mb-20">
  144. <view class="align-items-center">
  145. <image
  146. class="t-img mr-8"
  147. :src="require('@/static/img/logo/logo.png')"
  148. ></image>
  149. <view class="fs-28">DAO</view>
  150. </view>
  151. <view class="max-box b-rad-20 fs-28" @click="setMax">
  152. Max {{listTab===1 ?coinNum:pledgeTotal}}
  153. </view>
  154. </view>
  155. <view>
  156. <input v-model="pledgeNUm" :placeholder="'输入要'+(listTab===1 ?'质押':'解压')+'的DAO数量'" placeholder-class="fs-28"></input>
  157. </view>
  158. </view>
  159. <view class="convent-but b-rad-20 text-align-center fs-28 fc-f" @click="">
  160. 确定
  161. </view>
  162. </view>
  163. </view>
  164. <view class="bgc-f p-20 box-sizing-border b-rad-20" v-if="listTab===2">
  165. <view class="fs-28 pt-5 mb-8">
  166. 贡献收益记录
  167. </view>
  168. <view v-if="list.length<=0" class="blank-box align-items-center flex-justify-center">
  169. <blank :showBlank="list.length<=0?true:false" message="暂无数据"></blank>
  170. </view>
  171. <view class="bgc-F6F7FA" v-else>
  172. <view class="item-box align-items-center flex-justify-space" v-for="item in list" :key="item.id">
  173. <view>
  174. <view class="mb-8 fs-28 fw-b">贡献数量</view>
  175. <view class="fs-24">{{item.created_date}}</view>
  176. </view>
  177. <view class="align-items-center">
  178. <view class="fs-24">奖励:</view>
  179. <view class="fs-28 fc-ED301D">{{item.sorting_money}}</view>
  180. </view>
  181. </view>
  182. <view class="h-50 text-align-center fs-28">
  183. ~暂无记录
  184. </view>
  185. </view>
  186. </view>
  187. <view class="bgc-f p-20 box-sizing-border b-rad-20" v-else>
  188. <view class="fs-28 pt-5 mb-8">
  189. 质押记录
  190. </view>
  191. <view v-if="list.length<=0" class="blank-box align-items-center flex-justify-center">
  192. <blank :showBlank="list.length<=0?true:false" message="暂无数据"></blank>
  193. </view>
  194. <view class="bgc-F6F7FA" v-else>
  195. <view class="item-box align-items-center flex-justify-space" v-for="item in list" :key="item.id">
  196. <view>
  197. <view class="mb-8 fs-28 fw-b">贡献数量</view>
  198. <view class="fs-24">{{item.created_date}}</view>
  199. </view>
  200. <view class="align-items-center">
  201. <view class="fs-24">奖励:</view>
  202. <view class="fs-28 fc-ED301D">{{item.sorting_money}}</view>
  203. </view>
  204. </view>
  205. <view class="h-50 text-align-center fs-28">
  206. ~暂无记录
  207. </view>
  208. </view>
  209. </view>
  210. </view>
  211. </template>
  212. <style scoped lang="scss">
  213. .head-img {
  214. width: 100%;
  215. // height: 128px;
  216. }
  217. .h-80 {
  218. height: 160rpx;
  219. }
  220. .h-50 {
  221. height: 100rpx;
  222. line-height: 100rpx;
  223. }
  224. .item-box {
  225. width: 100%;
  226. height: 120rpx;
  227. padding: 10rpx 20rpx;
  228. box-sizing: border-box;
  229. border-top: 2rpx solid #e5e5e5;
  230. }
  231. .item-box:first-child {
  232. border-top: none;
  233. }
  234. .list-tab {
  235. width: 100%;
  236. height: 100%;
  237. background: #eaf2ff;
  238. border-radius: 10rpx;
  239. cursor: pointer;
  240. position: relative;
  241. margin: 20rpx 0 ;
  242. .tab-items {
  243. z-index: 10;
  244. display: flex;
  245. justify-content: space-between;
  246. border-radius: 10rpx;
  247. .tab-item {
  248. z-index: 10;
  249. width: calc(100% / 2);
  250. font-size: 13px;
  251. color: #adbad0;
  252. display: block;
  253. height: 32px;
  254. line-height: 32px;
  255. text-align: center;
  256. }
  257. .option-tab {
  258. color: #292929;
  259. }
  260. }
  261. .tab-item-bg {
  262. position: absolute;
  263. border-radius: 10rpx 10rpx 0 0;
  264. background: #fff;
  265. transition: .5s ease;
  266. height: 32px;
  267. width: calc(100% / 2);
  268. top: 0;
  269. }
  270. .bg-location-1 {
  271. left: 0;
  272. transition: .5s ease;
  273. }
  274. .bg-location-2 {
  275. left: 50%;
  276. transition: .5s ease;
  277. }
  278. }
  279. .t-img{
  280. width: 70rpx;
  281. height: 60rpx;
  282. }
  283. .max-box{
  284. color: #0d81cf;
  285. border: 2rpx solid #0d81cf;
  286. padding: 6rpx 20rpx;
  287. }
  288. .convent-but{
  289. height: 80rpx;
  290. background: #0d81cf;
  291. color: #fff;
  292. line-height: 80rpx;
  293. }
  294. </style>