money.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <view class="container">
  3. <view class="topBox">
  4. <image :src="`../../static/img/userIcon${type=='USDT'?1:2}.png`" class="logo" mode="scaleToFill"></image>
  5. <view class="money">{{money}}</view>
  6. </view>
  7. <view class="listBox">
  8. <view class="listName flex">
  9. <text>
  10. {{$t('user.交易记录')}}
  11. </text>
  12. <navigator :url="'./transfer?type='+type">
  13. <view class="targetText">
  14. {{$t('user.转账')}}
  15. </view>
  16. </navigator>
  17. </view>
  18. <view class="listTpl flex" v-for="item,index in list" :key="index">
  19. <view class="tplInfo flex_item">
  20. <image src="/static/img/moneyIcon.png" style="width: 39rpx;height: 43rpx;" mode="widthFix"></image>
  21. <view class="tpl">{{item.title}}<text>{{item.createtime|dateFormat}}</text></view>
  22. </view>
  23. <view class="tip" :class="{'text-linear-gradient':item.pm == 1}">
  24. {{ item.pm == 1?'+':'-'}}
  25. {{item.money*1}}
  26. </view>
  27. </view>
  28. </view>
  29. <u-loadmore :status="loadingType" line :loadmoreText="$t('base.加载更多')" :loadingText="$t('base.正在加载')"
  30. :nomoreText="$t('base.没有更多了')" />
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. moneyLog,
  36. } from '@/api/index.js';
  37. import {
  38. getUserInfo
  39. } from '@/api/user.js';
  40. import dayjs from '@/libs/dayjs/dayjs.min.js';
  41. export default {
  42. data() {
  43. return {
  44. money: 0,
  45. page: 1,
  46. limit:10,
  47. loadingType: "more",
  48. list: [],
  49. type: '',
  50. };
  51. },
  52. filters: {
  53. dateFormat: function(value) {
  54. return dayjs(value * 1000).format('YYYY/MM/DD hh:mm:ss');
  55. }
  56. },
  57. onLoad(opt) {
  58. this.type = opt.type;
  59. this.loadData();
  60. this.getUserInfo();
  61. uni.setNavigationBarTitle({
  62. title: this.type
  63. })
  64. },
  65. onShow() {},
  66. onReachBottom() {
  67. this.loadData()
  68. },
  69. methods: {
  70. getUserInfo() {
  71. const that = this;
  72. getUserInfo().then((res) => {
  73. that.money = res.data[that.type] * 1;
  74. console.log(that.money)
  75. })
  76. },
  77. loadData() {
  78. let obj = this;
  79. if (obj.loadingType == "nomore" ||
  80. obj.loadingType == "loading") {
  81. return;
  82. }
  83. obj.loadingType = "loading";
  84. moneyLog({
  85. page: obj.page,
  86. limit: obj.limit,
  87. token: obj.type
  88. }).then(res => {
  89. let ar = res.data.list.map((re) => {
  90. return re;
  91. })
  92. if (ar.length > 0) {
  93. obj.list = obj.list.concat(ar);
  94. obj.page++;
  95. if (obj.limit == ar.length) {
  96. obj.loadingType = "more";
  97. } else {
  98. obj.loadingType = "nomore";
  99. }
  100. } else {
  101. obj.loadingType = "nomore";
  102. }
  103. });
  104. },
  105. },
  106. };
  107. </script>
  108. <style lang="scss" scoped>
  109. .targetText {
  110. background: linear-gradient(90deg, #7D32FF, #3EE0FF);
  111. border-top-left-radius: 100rpx;
  112. border-bottom-left-radius: 100rpx;
  113. padding: 10rpx 30rpx;
  114. padding-left: 50rpx;
  115. }
  116. .container {
  117. padding: 25rpx 25rpx;
  118. line-height: 1;
  119. background-color: rgb(12, 8, 21);
  120. min-height: 100vh;
  121. }
  122. .logo {
  123. width: 120rpx;
  124. height: 120rpx;
  125. border-radius: 100%;
  126. background-color: #e3e3e3;
  127. }
  128. .topBox {
  129. text-align: center;
  130. padding-top: 25rpx;
  131. .money {
  132. font-family: Kozuka Gothic Pr6N;
  133. font-weight: normal;
  134. font-size: 26rpx;
  135. color: #FFFFFF;
  136. line-height: 55rpx;
  137. }
  138. }
  139. .listBox {
  140. color: #FFFFFF;
  141. .listName {
  142. font-weight: 500;
  143. font-size: 30rpx;
  144. padding-bottom: 30rpx;
  145. }
  146. .listTpl {
  147. background: rgba(255, 255, 255, .09);
  148. border-radius: 10rpx;
  149. padding: 40rpx 40rpx;
  150. margin-bottom: 20rpx;
  151. font-weight: 400;
  152. .tplInfo {
  153. .tpl {
  154. padding-left: 25rpx;
  155. font-size: 30rpx;
  156. text {
  157. font-size: 24rpx;
  158. color: #999999;
  159. padding-left: 15rpx;
  160. }
  161. }
  162. }
  163. .tip {
  164. font-size: 36rpx;
  165. }
  166. }
  167. }
  168. </style>