sfjl.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view class="content">
  3. <view class="navbar">
  4. <view v-for="(item, index) in navList" :key="index" class="nav-item"
  5. :class="{ current: tabCurrentIndex == index }" @click="tabClick(index)">{{ item.text }}</view>
  6. </view>
  7. <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300"
  8. @change="changeTab">
  9. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  10. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  11. <!-- 空白页 -->
  12. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  13. <!-- 订单列表 -->
  14. <view v-else v-for="(item, index) in 10" :key="index" class="order-item flex">
  15. <view class="main-left">
  16. <view class="main-title">
  17. 标题
  18. </view>
  19. <view class="main-time">
  20. 2019-06-09 13:00:00
  21. </view>
  22. </view>
  23. <view class="main-right">
  24. ¥200
  25. </view>
  26. </view>
  27. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  28. </scroll-view>
  29. </swiper-item>
  30. </swiper>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. tabCurrentIndex: 0,
  38. height: '',
  39. navList: [{
  40. state: 1,
  41. text: '奖励记录',
  42. loadingType: 'more',
  43. orderList: [],
  44. page: 1, //当前页数
  45. limit: 10 //每次信息条数
  46. },
  47. {
  48. state: 2,
  49. text: '处罚记录',
  50. loadingType: 'more',
  51. orderList: [],
  52. page: 1, //当前页数
  53. limit: 10 //每次信息条数
  54. }
  55. ],
  56. };
  57. },
  58. onLoad() {},
  59. onShow() {},
  60. onReachBottom() {},
  61. onReady(res) {
  62. var _this = this;
  63. uni.getSystemInfo({
  64. success: resu => {
  65. const query = uni.createSelectorQuery();
  66. query.select('.swiper-box').boundingClientRect();
  67. query.exec(function(res) {
  68. _this.height = resu.windowHeight - res[0].top + 'px';
  69. console.log('打印页面的剩余高度', _this.height);
  70. });
  71. },
  72. fail: res => {}
  73. });
  74. },
  75. methods: {
  76. //swiper 切换
  77. changeTab(e) {
  78. this.tabCurrentIndex = e.target.current;
  79. this.loadData('tabChange');
  80. },
  81. //顶部tab点击
  82. tabClick(index) {
  83. this.tabCurrentIndex = index;
  84. }
  85. }
  86. };
  87. </script>
  88. <style lang="scss">
  89. page,
  90. .content {
  91. min-height: 100%;
  92. height: auto;
  93. }
  94. .navbar {
  95. display: flex;
  96. height: 40px;
  97. padding: 0 5px;
  98. background: #fff;
  99. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  100. position: relative;
  101. z-index: 10;
  102. .nav-item {
  103. flex: 1;
  104. display: flex;
  105. justify-content: center;
  106. align-items: center;
  107. height: 100%;
  108. font-size: 15px;
  109. color: #999999;
  110. position: relative;
  111. &.current {
  112. color: #333333;
  113. &:after {
  114. content: '';
  115. position: absolute;
  116. left: 50%;
  117. bottom: 0;
  118. transform: translateX(-50%);
  119. width: 44px;
  120. height: 0;
  121. border-bottom: 2px solid #FF4C4C;
  122. }
  123. }
  124. }
  125. }
  126. .swiper-box {
  127. padding-top: 10rpx;
  128. .order-item {
  129. background: #ffffff;
  130. padding: 28rpx 24rpx 22rpx;
  131. border-bottom: 1px solid #F0F0F0;
  132. .main-left {
  133. line-height: 1;
  134. .main-title {
  135. font-size: 30rpx;
  136. font-family: PingFang SC;
  137. font-weight: bold;
  138. color: #333333;
  139. }
  140. .main-time {
  141. margin-top: 20rpx;
  142. font-size: 22rpx;
  143. font-family: PingFang SC;
  144. font-weight: 500;
  145. color: #999999;
  146. }
  147. }
  148. .main-right {
  149. font-size: 34rpx;
  150. font-family: PingFang SC;
  151. font-weight: bold;
  152. color: #FF0000;
  153. }
  154. }
  155. }
  156. .list-scroll-content {
  157. height: 100%;
  158. }
  159. </style>