integral-detail.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="list">
  3. <view class="list_con flexB" v-for="item in inteList" :key="item.id">
  4. <view>
  5. <view class="inte_title">
  6. <text>{{ item.remark }}</text>
  7. <text style="color:#999;margin-left:10rpx;" v-if="item.type==1||item.type==2">({{item.num}}套)</text>
  8. </view>
  9. <view class="inte_time">{{ item.created_at }}</view>
  10. </view>
  11. <view>
  12. <text class="inte_num" v-if="item.type == 1||item.type==4">+{{ item.integral_double || 0 }}</text>
  13. <text class="inte_num" v-else style="color:#FB231F">{{ item.integral_double || 0 }}</text>
  14. <image src="../../static/money_icon.png" class="icon"></image>
  15. </view>
  16. </view>
  17. <view class="noData" v-if="inteList.length == 0">
  18. <image src="../../../static/imgs/default/no_card.png" mode=""></image>
  19. <view>--暂无积分记录--</view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. getIntegralRecord
  26. } from '@/apis/shop.js';
  27. export default {
  28. data() {
  29. return {
  30. inteList: [],
  31. params: {
  32. page_index: 1,
  33. page_size: 15
  34. },
  35. totalPage: 0
  36. };
  37. },
  38. onShow() {
  39. this.getIntegral();
  40. },
  41. onReachBottom() {
  42. this.getMore();
  43. },
  44. methods: {
  45. //获取积分明细
  46. getIntegral(isMore) {
  47. uni.showLoading({
  48. title: '加载中....'
  49. });
  50. let params = this.params;
  51. getIntegralRecord(params)
  52. .then(res => {
  53. if (res.code == 200) {
  54. this.inteList = isMore ? this.inteList.concat(res.data.list) : res.data.list;
  55. this.totalPage = Math.ceil(res.data.total / this.params.page_size);
  56. } else {
  57. uni.showModal({
  58. content: res.data || '获取积分明细失败',
  59. showCancel: false
  60. });
  61. }
  62. uni.hideLoading();
  63. })
  64. .catch(err => {
  65. uni.hideLoading();
  66. });
  67. },
  68. getMore() {
  69. if (this.params.page_index >= this.totalPage) {
  70. uni.showToast({
  71. title: '没有更多啦~',
  72. icon: 'none'
  73. });
  74. return false;
  75. }
  76. this.params.page_index++;
  77. this.getIntegral(true);
  78. }
  79. }
  80. };
  81. </script>
  82. <style lang="scss" scoped>
  83. .list {
  84. width: 100%;
  85. min-height: 100%;
  86. background: #fff;
  87. padding: 30rpx 0 100rpx;
  88. .list_con {
  89. width: 690rpx;
  90. margin: 0 auto 30rpx;
  91. .inte_title {
  92. font-size: 32rpx;
  93. font-weight: bold;
  94. }
  95. .inte_time {
  96. font-size: 28rpx;
  97. color: #999;
  98. margin-top: 20rpx;
  99. }
  100. .icon {
  101. width: 40rpx;
  102. height: 40rpx;
  103. vertical-align: -2rpx;
  104. }
  105. .inte_num {
  106. font-size: 40rpx;
  107. font-weight: bold;
  108. margin-right: 10rpx;
  109. }
  110. }
  111. }
  112. </style>