teaBaby.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="container">
  3. <!-- 顶部导航 -->
  4. <view class="Tab_con flex_r flex_ac flex_jb">
  5. <view
  6. class="tab_list flex_r flex_ac"
  7. :class="current == index ? 'active' : ''"
  8. v-for="(item, index) in TabList"
  9. :key="index"
  10. @tap="SetStatus(index)"
  11. >{{ item.title }}</view>
  12. </view>
  13. <!-- 顶部导航-end -->
  14. <!-- 积分列表 -->
  15. <view class="con">
  16. <view class="list" v-for="(item, index) in list" :key="index">
  17. <view class="list_head flex_r flex_ac flex_jb">
  18. <view class="head_name" v-if="item.type == 0">收货后送茶宝</view>
  19. <view class="head_name" v-else-if="item.type == 1">签到送茶宝</view>
  20. <view class="head_name" v-else-if="item.type == 2">批发扣除茶宝</view>
  21. <view class="head_name" v-else-if="item.type == 3">退款到茶宝</view>
  22. <view class="head_name" v-else-if="item.type == 4">提现转茶宝</view>
  23. <view class="head_name" v-else-if="item.type == 5">赠送茶宝</view>
  24. <view class="head_name" v-else-if="item.type == 6">消费茶宝</view>
  25. <view class="head_name" v-else-if="item.type == 8">核销后送茶宝</view>
  26. <view :class="['head_price',item.act == '+' ? 'g_color' : '']">{{item.act}}{{ item.num }}</view>
  27. </view>
  28. <view class="list_con flex_r flex_ac flex_jb">
  29. <!-- <view class="list_time">{{ item.integerType }}333</view> -->
  30. <view class="list_balance">{{ item.create_time }}</view>
  31. </view>
  32. </view>
  33. <not-goods v-if="haveGoods" textStr="暂无积分信息"></not-goods>
  34. </view>
  35. <!-- 积分列表 -->
  36. </view>
  37. </template>
  38. <script>
  39. let page = 1;
  40. let app = getApp();
  41. var appEv = app.$vm.$options;
  42. import { get, post } from "@/request/api.js";
  43. import notGoods from "@/components/not-goods/index.vue";
  44. export default {
  45. components: {
  46. notGoods
  47. },
  48. data() {
  49. return {
  50. haveGoods: false, // 是否有商品
  51. current: 0,
  52. TabList: [
  53. { title: "全部", sauts: "" },
  54. { title: "收益", sauts: 1 },
  55. { title: "支出", sauts: 2 }
  56. ],
  57. list: [],
  58. page: 1
  59. };
  60. },
  61. onShow: function() {
  62. this.page = 1;
  63. this.list = [];
  64. this.loadData();
  65. },
  66. methods: {
  67. loadData: function() {
  68. let that = this;
  69. let data = {
  70. type: this.current == 0 ? "" : this.current,
  71. page: page,
  72. limit: 10
  73. };
  74. uni.showLoading({ mask: true });
  75. post("/my/chabao", data).then(res => {
  76. uni.hideLoading();
  77. if (res.code === 0) {
  78. if (res.data.data.data.length > 0) {
  79. this.list = this.list.concat(res.data.data.data);
  80. } else {
  81. if (this.page == 1) {
  82. this.haveGoods = true;
  83. this.page = -1;
  84. } else {
  85. this.page = -1;
  86. appEv.errTips("暂无更多");
  87. }
  88. }
  89. } else {
  90. if (page == 1) {
  91. this.haveGoods = true;
  92. this.page = -1;
  93. } else {
  94. this.page = -1;
  95. appEv.errTips("暂无更多");
  96. }
  97. }
  98. });
  99. },
  100. SetStatus: function(i) {
  101. this.current = i;
  102. page = 1;
  103. this.list = [];
  104. this.haveGoods = false;
  105. this.loadData();
  106. }
  107. },
  108. /**
  109. * 页面上拉触底事件的处理函数
  110. */
  111. onReachBottom: function() {
  112. if (page != -1) {
  113. var that = this;
  114. setTimeout(function() {
  115. ++page;
  116. that.loadData();
  117. }, 800);
  118. }
  119. }
  120. };
  121. </script>
  122. <style lang="scss">
  123. // 页面配置
  124. // 页面配置-end
  125. // 顶部列表
  126. .tab_list {
  127. height: 100%;
  128. box-sizing: border-box;
  129. font-size: 30rpx;
  130. color: #808080;
  131. }
  132. .Tab_con {
  133. width: 100%;
  134. height: 92rpx;
  135. background: #fff;
  136. padding: 0 30rpx;
  137. box-sizing: border-box;
  138. }
  139. .active {
  140. color: #1bbd89;
  141. border-bottom: 6rpx solid #1bbd89;
  142. }
  143. // 顶部列表-end
  144. // 资金列表
  145. .con {
  146. border-top: 16rpx solid #f4f4f4;
  147. }
  148. .list_con {
  149. width: 100%;
  150. overflow: hidden;
  151. }
  152. .list_head {
  153. width: 100%;
  154. overflow: hidden;
  155. }
  156. .list_time {
  157. font-size: 24rpx;
  158. color: #a1a1a1;
  159. }
  160. .list_balance {
  161. font-size: 24rpx;
  162. color: #a1a1a1;
  163. }
  164. .head_price {
  165. font-size: 32rpx;
  166. font-family: "SourceHanSansCN-Medium";
  167. }
  168. .head_name {
  169. font-size: 30rpx;
  170. color: #212121;
  171. font-family: "SourceHanSansCN-Medium";
  172. }
  173. .list {
  174. width: 100%;
  175. overflow: hidden;
  176. padding: 30rpx;
  177. box-sizing: border-box;
  178. border-bottom: 3rpx solid #f4f4f4;
  179. }
  180. // 资金列表-end
  181. // 状态颜色
  182. .g_color {
  183. color: #1bbd89;
  184. }
  185. .y_color {
  186. color: #f15b21;
  187. }
  188. // 状态颜色-end
  189. </style>