scoreAccumulate.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <view class="content">
  3. <!-- <view class="navbar">
  4. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  5. </view> -->
  6. <view class="top-wrapper">{{score||0.00}}</view>
  7. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
  8. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  9. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  10. <!-- 空白页 -->
  11. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  12. <!-- 订单列表 -->
  13. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
  14. <view class="title-box">
  15. <view class="title">
  16. <text>{{ item.mark }}</text>
  17. </view>
  18. <view class="time">
  19. <text>{{ item.add_time }}</text>
  20. </view>
  21. </view>
  22. <view class="money">
  23. <text>{{ (item.pm == 0 ? '-' : '+') + item.number }}</text>
  24. </view>
  25. </view>
  26. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  27. </scroll-view>
  28. </swiper-item>
  29. </swiper>
  30. </view>
  31. </template>
  32. <script>
  33. import { integrallist } from '@/api/functionalUnit.js';
  34. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  35. import empty from '@/components/empty';
  36. export default {
  37. components: {
  38. empty,
  39. uniLoadMore
  40. },
  41. onReady() {
  42. },
  43. data() {
  44. return {
  45. tabCurrentIndex: 0,
  46. navList: [
  47. {
  48. state: 0,
  49. text: '全部',
  50. loadingType: 'more',
  51. orderList: [],
  52. page: 1, //当前页数
  53. limit: 10 //每次信息条数
  54. },
  55. ],
  56. score: 0 //积分
  57. };
  58. },
  59. onShow() {
  60. // 载入积分数据
  61. this.loadData();
  62. },
  63. methods: {
  64. // 页面跳转
  65. navto(e) {
  66. uni.navigateTo({
  67. url: e
  68. });
  69. },
  70. //获取收入支出信息
  71. async loadData(source) {
  72. //这里是将订单挂载到tab列表下
  73. let index = this.tabCurrentIndex;
  74. let navItem = this.navList[index];
  75. let state = navItem.state;
  76. if (source === 'tabChange' && navItem.loaded === true) {
  77. //tab切换只有第一次需要加载数据
  78. return;
  79. }
  80. if (navItem.loadingType === 'loading') {
  81. //防止重复加载
  82. return;
  83. }
  84. // 修改当前对象状态为加载中
  85. navItem.loadingType = 'loading';
  86. integrallist(
  87. {
  88. page: navItem.page,
  89. limit: navItem.limit
  90. },
  91. state
  92. )
  93. .then(({ data }) => {
  94. if (data.length > 0) {
  95. navItem.orderList = navItem.orderList.concat(data);
  96. navItem.page++;
  97. }
  98. if (navItem.limit == data.length) {
  99. //判断是否还有数据, 有改为 more, 没有改为noMore
  100. navItem.loadingType = 'more';
  101. return;
  102. } else {
  103. //判断是否还有数据, 有改为 more, 没有改为noMore
  104. navItem.loadingType = 'noMore';
  105. }
  106. uni.hideLoading();
  107. this.$set(navItem, 'loaded', true);
  108. })
  109. .catch(e => {
  110. console.log(e);
  111. });
  112. },
  113. //swiper 切换
  114. changeTab(e) {
  115. this.tabCurrentIndex = e.target.current;
  116. this.loadData('tabChange');
  117. },
  118. //顶部tab点击
  119. tabClick(index) {
  120. this.tabCurrentIndex = index;
  121. }
  122. }
  123. };
  124. </script>
  125. <style lang="scss">
  126. page {
  127. background: #ffffff;
  128. height: 100%;
  129. }
  130. .navbar {
  131. display: flex;
  132. height: 40px;
  133. padding: 0 5px;
  134. background: #fff;
  135. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  136. position: relative;
  137. z-index: 10;
  138. .nav-item {
  139. flex: 1;
  140. display: flex;
  141. justify-content: center;
  142. align-items: center;
  143. height: 100%;
  144. font-size: 15px;
  145. color: $font-color-dark;
  146. position: relative;
  147. &.current {
  148. color: $base-color;
  149. &:after {
  150. content: '';
  151. position: absolute;
  152. left: 50%;
  153. bottom: 0;
  154. transform: translateX(-50%);
  155. width: 44px;
  156. height: 0;
  157. border-bottom: 2px solid $base-color;
  158. }
  159. }
  160. }
  161. }
  162. // 列表
  163. .swiper-box {
  164. height: calc(100% - 44px);
  165. padding-top: 10rpx;
  166. .order-item {
  167. padding: 20rpx 30rpx;
  168. line-height: 1.5;
  169. .title-box {
  170. .title {
  171. font-size: $font-lg;
  172. color: $font-color-base;
  173. }
  174. .time {
  175. font-size: $font-base;
  176. color: $font-color-light;
  177. }
  178. }
  179. .money {
  180. color: #fd5b23;
  181. font-size: $font-lg;
  182. }
  183. }
  184. }
  185. .list-scroll-content {
  186. height: 100%;
  187. }
  188. .content {
  189. height: 100%;
  190. .empty-content {
  191. background-color: #ffffff;
  192. }
  193. }
  194. .top-wrapper {
  195. width: 750rpx;
  196. height: 265rpx;
  197. background-image: url(../../static/img/wallertbg.png);
  198. background-size: 100%;
  199. background-position: bottom;
  200. // font-size: ;
  201. color: #FFFFFF;
  202. font-size: 72rpx;
  203. font-family: PingFang SC;
  204. font-weight: bold;
  205. color: #FFFFFF;
  206. line-height: 265rpx;
  207. text-align: center;
  208. }
  209. </style>