integral-detail.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <app-layout>
  3. <app-tab-nav :tabList="tabList" :activeItem="activeTab" @click="tabStatus" :theme="theme"></app-tab-nav>
  4. <view class='item' v-for="item in list" :key="item.id">
  5. <view class='name'>{{item.desc}}</view>
  6. <view class='num'>{{item.integral}}积分</view>
  7. <view class="info">
  8. <text>时间: {{item.created_at}}</text>
  9. </view>
  10. </view>
  11. </app-layout>
  12. </template>
  13. <script>
  14. import appTabNav from "../../../components/basic-component/app-tab-nav/app-tab-nav.vue";
  15. import { mapState } from "vuex";
  16. export default {
  17. data() {
  18. return {
  19. tabList: [
  20. {id:1, name: '收入'},
  21. {id:2, name: '支出'}
  22. ],
  23. loading: null,
  24. activeTab: 1,
  25. page: 2,
  26. list: []
  27. }
  28. },
  29. components: {
  30. "app-tab-nav": appTabNav,
  31. },
  32. computed: {
  33. ...mapState({
  34. theme: state => state.mallConfig.theme,
  35. userInfo: state => state.user.info,
  36. })
  37. },
  38. methods: {
  39. tabStatus(e) {
  40. this.list = [];
  41. this.page = 2;
  42. this.activeTab = e.currentTarget.dataset.id;
  43. this.getList();
  44. },
  45. getList() {
  46. let that = this;
  47. that.$showLoading({
  48. text: '加载中...'
  49. });
  50. that.$request({
  51. url: that.$api.integral_mall.log,
  52. data: {
  53. type: that.activeTab
  54. }
  55. }).then(response=>{
  56. that.$hideLoading();
  57. if(response.code == 0) {
  58. that.list = response.data.list;
  59. }else {
  60. uni.showToast({
  61. title: response.msg,
  62. icon: 'none',
  63. duration: 1000
  64. });
  65. }
  66. }).catch(response => {
  67. that.$hideLoading();
  68. that.$event.on(that.$const.EVENT_USER_LOGIN).then(()=>{
  69. that.getList();
  70. });
  71. });
  72. },
  73. getMore() {
  74. let that = this;
  75. that.$showLoading({
  76. text: '加载中...'
  77. });
  78. that.$request({
  79. url: that.$api.integral_mall.log,
  80. data: {
  81. type: that.activeTab,
  82. page: that.page
  83. }
  84. }).then(response=>{
  85. that.$hideLoading();
  86. if(response.code == 0) {
  87. if(response.data.list.length > 0) {
  88. that.loading = null;
  89. that.list = that.list.concat(response.data.list);
  90. that.page++;
  91. }
  92. }else {
  93. uni.showToast({
  94. title: response.msg,
  95. icon: 'none',
  96. duration: 1000
  97. });
  98. }
  99. }).catch(e => {
  100. that.$hideLoading();
  101. });
  102. },
  103. },
  104. onLoad() {
  105. this.getList();
  106. },
  107. onReachBottom() {
  108. this.getMore();
  109. }
  110. }
  111. </script>
  112. <style scoped lang="scss">
  113. .item {
  114. padding: #{36rpx} #{24rpx};
  115. color: #ff6f28;
  116. font-size: 15px;
  117. border-bottom: #{1rpx} solid #e2e2e2;
  118. background-color: #fff;
  119. }
  120. .name {
  121. color: #353535;
  122. margin-bottom: #{6rpx};
  123. }
  124. .num {
  125. width: 25%;
  126. display: inline-block;
  127. }
  128. .info {
  129. font-size: 12px;
  130. float: right;
  131. color: #999;
  132. }
  133. </style>