integral-detail.vue 2.9 KB

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