pointsDetail.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view>
  3. <view class="bg-img flex justify-center align-center" style="background-image: url('https://upload-file-data.obs.cn-south-1.myhuaweicloud.com/5f263a5a6e7c4f2493e0325f28ab659a-bgimg.png');height: 310upx;">
  4. <view class="text-center" style="margin-top: 80upx;">
  5. <view style="font-size: 24upx;font-family: PingFang SC;font-weight: 400;color: #cfc8f9;">可用积分</view>
  6. <view style="font-size: 54upx;font-family: PingFang SC;font-weight: 800;color: #ffffff;">{{+usablePoints}}</view>
  7. </view>
  8. </view>
  9. <block v-for="(item, index) in pointsList" :key="index">
  10. <view class="flex justify-between align-center container">
  11. <view class="padding">
  12. <view class="type">{{item.note}}</view>
  13. <view class="time">{{item.createTime}}</view>
  14. </view>
  15. <view class="padding">
  16. <view class="points">{{item.pointsValue}} 积分</view>
  17. </view>
  18. </view>
  19. </block>
  20. <view style="height: 80rpx;" v-if="status">
  21. <u-divider bgColor="#f1f1f1;" height="80">到底了</u-divider>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. userId: '',
  30. usablePoints: '',
  31. pointsList: [],
  32. current: 1,
  33. size: 30,
  34. status: false,
  35. }
  36. },
  37. onLoad(options) {
  38. this.userId = uni.getStorageSync("userId");
  39. this.getPointsDetail();
  40. this.getTotalPoints();
  41. },
  42. onReachBottom() {
  43. if (this.pointsList.length < this.current * this.size) {
  44. this.status = true;
  45. } else {
  46. this.current += 1;
  47. this.getPointsDetail();
  48. }
  49. },
  50. methods: {
  51. getTotalPoints() {
  52. this.$u.api.user.detail({id: this.userId}).then(res => {
  53. this.usablePoints = res.usablePoints;
  54. })
  55. },
  56. getPointsDetail() {
  57. this.$u.api.points.list({userId: this.userId, current: this.current, size: this.size}).then(res => {
  58. this.pointsList = [...this.pointsList,...res.records];
  59. })
  60. }
  61. }
  62. }
  63. </script>
  64. <style>
  65. .container {
  66. background-color: #FFFFFF;
  67. border-radius: 10upx;
  68. margin: 20upx;
  69. }
  70. .type {
  71. font-size: 32upx;
  72. font-family: PingFang SC;
  73. font-weight: bold;
  74. margin-bottom: 20upx;
  75. color: #111111;
  76. }
  77. .time {
  78. font-size: 24upx;
  79. font-family: PingFang SC;
  80. font-weight: bold;
  81. color: #9E9E9E;
  82. }
  83. .points {
  84. font-size: 28upx;
  85. font-family: PingFang SC;
  86. font-weight: bold;
  87. color: #111111;
  88. }
  89. </style>