today.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <view class="container">
  3. <view class="list-box flex">
  4. <view class="list-tpl">
  5. <view class="num">{{count || 0}}</view>
  6. <view class="name">新增会员数</view>
  7. </view>
  8. <view class="list-tpl">
  9. <view class="num">{{people_num || 0}}</view>
  10. <view class="name">新增算力数</view>
  11. </view>
  12. </view>
  13. <view class="list-cell" v-if="list.length > 0">
  14. <view class="cell-name flex">
  15. <view class="title">成员信息</view>
  16. <view class="title-box flex">
  17. <view class="title">状态</view>
  18. <view class="title">算力</view>
  19. <view class="title">购买时间</view>
  20. </view>
  21. </view>
  22. <view class="cell-box flex" v-for="(ls,index) in list" :key='index'>
  23. <view class="cell-tit flex_item">
  24. <image :src="ls._user.avatar"></image>
  25. <view class="tit-box">
  26. <view class="tit-tpl clamp">{{ls.nickname}}</view>
  27. <view class="tit-tip">{{ls.phone}}</view>
  28. </view>
  29. </view>
  30. <view class="flex num-box">
  31. <view class="num clamp">{{ls.status == 0 ? '准备中' : ls.status == 1 ? '挖矿中' : '已到期'}}</view>
  32. <view class="num clamp">{{ls.num}}T</view>
  33. <view class="date">
  34. <view class="year">
  35. {{ ls.year }}
  36. </view>
  37. <view class="">
  38. {{ ls.month }}-{{ ls.day }}
  39. </view>
  40. <view class="">
  41. {{ ls.today }}
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="nav flex" v-show="page != 1 || isLast">
  47. <view class="next" @click="last" >
  48. 上一页
  49. </view>
  50. <view class="next" @click="next">
  51. 下一页
  52. </view>
  53. </view>
  54. </view>
  55. <view class="empty-box" v-show="list.length === 0"><empty></empty></view>
  56. </view>
  57. </template>
  58. <script>
  59. import { newMining,miner } from '@/api/finance.js';
  60. import empty from '@/components/empty';
  61. export default {
  62. components: {
  63. empty
  64. },
  65. data() {
  66. return {
  67. page: 1,
  68. limit: 5,
  69. data:'',
  70. list:'',
  71. isLast: true,
  72. people_num: '',
  73. count: '',
  74. };
  75. },
  76. onLoad(option){
  77. this.people_num = option.num
  78. this.loadData();
  79. this.loadDataNext();
  80. this.getCount();
  81. },
  82. onShow() {
  83. },
  84. methods: {
  85. async getCount() {
  86. let obj = this;
  87. miner({new: 1}).then(e => {
  88. obj.count = e.data.count;
  89. })
  90. },
  91. // 请求载入数据
  92. async loadData() {
  93. let obj = this;
  94. newMining({
  95. page: obj.page,
  96. limit: obj.limit,
  97. }).then(({ data }) => {
  98. obj.data = data;
  99. obj.list = data.data;
  100. obj.list.forEach(e => {
  101. let date = e._pay_time.split(' ');
  102. e.today = date[1];
  103. let all = date[0].split('-');
  104. e.year = all[0];
  105. e.month = all[1];
  106. e.day = all[2];
  107. })
  108. console.log(obj.list);
  109. });
  110. },
  111. async loadDataNext() {
  112. let obj = this;
  113. console.log(obj.page)
  114. newMining({
  115. page: obj.page + 1,
  116. limit: obj.limit,
  117. }).then(({ data }) => {
  118. if(data.data.length === 0){
  119. obj.isLast = false;
  120. }else{
  121. obj.isLast = true;
  122. }
  123. });
  124. },
  125. nav(url){
  126. uni.navigateTo({
  127. url:url
  128. })
  129. },
  130. next(){
  131. let that = this;
  132. this.page = this.page + 1;
  133. this.loadDataNext();
  134. if(this.isLast){
  135. this.loadData();
  136. }else{
  137. this.page = this.page - 1;
  138. that.$api.msg('已经是最后一页了')
  139. }
  140. },
  141. last(){
  142. let that = this;
  143. if(this.page != 1){
  144. this.page = this.page - 1;
  145. this.loadData();
  146. this.loadDataNext();
  147. }else{
  148. that.$api.msg('已经是第一页了')
  149. }
  150. }
  151. }
  152. };
  153. </script>
  154. <style lang="scss">
  155. page {
  156. min-height: 100%;
  157. background-color: #ffffff;
  158. .container {
  159. width: 100%;
  160. }
  161. }
  162. .list-box{
  163. width: 100%;
  164. padding: 50rpx 41rpx;
  165. padding-top: 80rpx !important;
  166. background-color: #5771DF;
  167. position: relative;
  168. .list-title{
  169. position: absolute;
  170. top: 80rpx;
  171. color: #FFFFFF;
  172. left: 40%;
  173. font-size: 36rpx;
  174. }
  175. .list-tpl{
  176. background-color: #FFFFFF;
  177. width: 314rpx;
  178. height: 168rpx;
  179. text-align: center;
  180. padding-top:40rpx;
  181. border-radius: 15rpx;
  182. .num{
  183. font-size: 36rpx;
  184. font-weight: bold;
  185. color: #333333;
  186. padding-bottom: 15rpx;
  187. }
  188. .name{
  189. font-size: 26rpx;
  190. font-weight: 500;
  191. color: #999999;
  192. }
  193. }
  194. }
  195. .list-cell{
  196. padding: 40rpx 30rpx;
  197. .cell-name{
  198. padding: 40rpx 0;
  199. .title {
  200. text-align: center;
  201. width: 40%;
  202. font-size: 30rpx;
  203. font-family: PingFang SC;
  204. font-weight: bold;
  205. color: #333333;
  206. }
  207. .title-box{
  208. width: 60%;
  209. .title {
  210. text-align: center;
  211. width: 33%;
  212. font-size: 30rpx;
  213. font-family: PingFang SC;
  214. font-weight: bold;
  215. color: #333333;
  216. }
  217. }
  218. }
  219. .cell-box{
  220. margin-bottom: 94rpx;
  221. .cell-tit{
  222. width: 40%;
  223. image{
  224. width: 80rpx;
  225. height: 80rpx;
  226. border-radius: 100%;
  227. }
  228. .tit-box{
  229. padding-left: 15rpx;
  230. width: 70%;
  231. .tit-tpl{
  232. font-size: 30rpx;
  233. font-weight: 500;
  234. color: #333333;
  235. }
  236. .tit-tip{
  237. font-size: 24rpx;
  238. font-weight: 500;
  239. color: #999999;
  240. padding-top: 20rpx;
  241. }
  242. }
  243. }
  244. .num-box{
  245. width: 60%;
  246. .num{
  247. width: 33%;
  248. text-align: center;
  249. font-size: 30rpx;
  250. font-family: PingFang SC;
  251. font-weight: bold;
  252. color: #333333;
  253. }
  254. .date{
  255. width: 33%;
  256. padding-left: 10rpx;
  257. text-align: left;
  258. font-size: 26rpx;
  259. font-family: PingFang SC;
  260. font-weight: 500;
  261. color: #999999;
  262. }
  263. }
  264. }
  265. }
  266. .empty-box{
  267. margin-top: 60rpx;
  268. width: 100%;
  269. height: 500rpx;
  270. }
  271. .nav{
  272. .next{
  273. margin: 40rpx;
  274. width: 50%;
  275. background-color: #5771DF;
  276. color: #FFFFFF;
  277. text-align: center;
  278. padding:10rpx 0rpx;
  279. border-radius: 50rpx;
  280. }
  281. }
  282. </style>