consume.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view>
  3. <view class="integral-log-main">
  4. <view class="pd16_15 bd-bottom flex alcenter">
  5. <text class="iconfont iconicon_integral_des ft20 cl-main"></text>
  6. <text class="ml10 ft16 ftw600 cl-main">消费明细</text>
  7. </view>
  8. <view class="pd16_15" v-if="listData.length>0">
  9. <block v-for="(item,index) in listData" :key="index">
  10. <view class="pb16 mb16 bd-bottom flex alcenter space">
  11. <view>
  12. <view class="ft14 cl-main">{{item.memo}}</view>
  13. <view class="mt8 ft12 cl-notice">{{item.createtime}}</view>
  14. </view>
  15. <view class="ft18 ftw600 cl-main">{{item.jzt}}{{item.score}}</view>
  16. </view>
  17. </block>
  18. <uni-load-more :status="status" :content-text="contentText" />
  19. </view>
  20. <com-empty v-else title="暂无积分记录"></com-empty>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. getUserConsumeRecord
  27. } from '@/common/apis/my.js'
  28. export default {
  29. data() {
  30. return {
  31. userinfo: [],
  32. listData: [],
  33. last_id: 0,
  34. reload: true,
  35. status: 'more',
  36. userinfo: [],
  37. contentText: {
  38. contentdown: '上拉加载更多',
  39. contentrefresh: '加载中',
  40. contentnomore: '没有数据了'
  41. }
  42. }
  43. },
  44. onReachBottom() {
  45. this.status = 'more';
  46. this.getList();
  47. },
  48. onLoad() {
  49. this.ongrzlTap()
  50. this.getList();
  51. },
  52. methods: {
  53. async ongrzlTap() {
  54. let data = {};
  55. data.token = uni.getStorageSync("userinfo").token;
  56. data.uid = uni.getStorageSync("userinfo").id;
  57. uni.request({
  58. url: this.configs.webUrl + '/api/user/index',
  59. data: data,
  60. success: res => {
  61. if (res.data.code == 1) {
  62. let ionfo = res.data.data
  63. this.userinfo = ionfo
  64. } else {
  65. uni.showToast({
  66. title: res.data.msg,
  67. icon: "none"
  68. });
  69. }
  70. },
  71. fail: (data, code) => {
  72. //console.log('fail' + JSON.stringify(data));
  73. }
  74. });
  75. },
  76. getList() {
  77. getUserConsumeRecord().then(res => {
  78. console.log(res,'getUserConsumeRecordgetUserConsumeRecordgetUserConsumeRecord')
  79. })
  80. let data = {
  81. //column: 'id,post_id,title,author_name,cover,published_at' //需要的字段名
  82. };
  83. var limit = 10;
  84. if (this.last_id > 0) {
  85. //说明已有数据,目前处于上拉加载
  86. this.status = 'loading';
  87. data.offset = this.last_id * limit;
  88. data._ = new Date().getTime() + '';
  89. }
  90. data.limit = limit
  91. // data.token = uni.getStorageSync("userinfo").token;
  92. // uni.request({
  93. // url: this.configs.webUrl + '/api/user/userscoreinfo',
  94. // data: data,
  95. // success: data => {
  96. // console.log(data.data)
  97. // if (data.data.total > 0) {
  98. // let list = data.data.rows;
  99. // this.listData = this.reload ? list : this.listData.concat(list);
  100. // this.reload = false;
  101. // this.last_id = this.last_id + 1;
  102. // if (data.data.total < this.last_id * limit) {
  103. // this.status = '';
  104. // }
  105. // } else {
  106. // this.contentText.contentdown = '没有数据'
  107. // }
  108. // },
  109. // fail: (data, code) => {
  110. // //console.log('fail' + JSON.stringify(data));
  111. // }
  112. // });
  113. },
  114. }
  115. }
  116. </script>
  117. <style>
  118. .integral-log-header {
  119. position: relative;
  120. height: 252rpx;
  121. }
  122. .integral-log-header .bg {
  123. width: 100%;
  124. height: 252rpx;
  125. }
  126. .integral-log-header .main {
  127. height: 252rpx;
  128. width: 100%;
  129. position: absolute;
  130. left: 0;
  131. top: 0;
  132. }
  133. .btn-integral {
  134. width: 192rpx;
  135. height: 80rpx;
  136. background: #FFFFFF;
  137. box-shadow: 0rpx 8rpx 32rpx 0rpx rgba(0, 0, 0, 0.04);
  138. border-radius: 40rpx;
  139. text-align: center;
  140. line-height: 80rpx;
  141. color: #6687EF;
  142. font-size: 28rpx;
  143. font-weight: 500;
  144. }
  145. .integral-log-main {
  146. background: #FFFFFF;
  147. min-height: 1400rpx;
  148. position: relative;
  149. margin-top: -32rpx;
  150. border-radius: 32rpx 32rpx 0rpx 0rpx;
  151. }
  152. </style>