applyList.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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 scroll-y="true" class="list-scroll-content" :style="{'height':height}">
  11. <!-- 申请列表 -->
  12. <view class="apply-box" v-for="item in 20">
  13. <view class="box-top">
  14. <image src="" mode="" class="user-img"></image>
  15. <view class="user-info">
  16. <view class="user-name clamp">
  17. 假猪套 假猪套假猪套假
  18. </view>
  19. <view class="user-phone">
  20. 13245678911
  21. </view>
  22. </view>
  23. </view>
  24. <view class="apply-info flex">
  25. <view class="img-wrap">
  26. <image src="" mode="" class="upimg" v-for="item in 2"></image>
  27. </view>
  28. <view class="btn-wrap flex" v-if="tabCurrentIndex == 0">
  29. <view class="btn btn-reject">拒绝</view>
  30. <view class="btn btn-pass">通过</view>
  31. </view>
  32. <view class="btn-wrap" v-if="tabCurrentIndex == 1">
  33. 已通过
  34. </view>
  35. </view>
  36. </view>
  37. </scroll-view>
  38. </swiper-item>
  39. </swiper>
  40. </view>
  41. </template>
  42. <script>
  43. import {
  44. getApplyList
  45. } from '../../api/apply.js'
  46. export default {
  47. data() {
  48. return {
  49. height: '',
  50. tabCurrentIndex: 0,
  51. navList: [{
  52. state: 0,
  53. text: '未审核',
  54. loadingType: 'more',
  55. orderList: [],
  56. page: 1,
  57. limit: 10,
  58. },
  59. {
  60. state: 1,
  61. text: '已审核',
  62. loadingType: 'more',
  63. orderList: [],
  64. page: 1,
  65. limit: 10,
  66. }
  67. ]
  68. }
  69. },
  70. onReady(res) {
  71. var obj = this;
  72. uni.getSystemInfo({
  73. success: resu => {
  74. const query = uni.createSelectorQuery();
  75. query.select('.swiper-box').boundingClientRect();
  76. query.exec(function(res) {
  77. console.log(res, 'ddddddddddddd');
  78. obj.height = resu.windowHeight - res[0].top + 'px';
  79. console.log('打印页面的剩余高度', obj.height);
  80. });
  81. },
  82. fail: res => {}
  83. });
  84. },
  85. onLoad() {
  86. this.loadData()
  87. },
  88. methods: {
  89. //顶部tab点击
  90. tabClick(index) {
  91. this.tabCurrentIndex = index;
  92. },
  93. changeTab(e) {
  94. this.tabCurrentIndex = e.target.current;
  95. this.loadData('tabChange');
  96. },
  97. loadData(source) {
  98. console.log('swiper')
  99. let index = this.tabCurrentIndex;
  100. let navItem = this.navList[index];
  101. let state = navItem.state + 1;
  102. if (source === 'tabChange' && navItem.loaded === true) {
  103. //tab切换只有第一次需要加载数据
  104. return;
  105. }
  106. if (navItem.loadingType === 'loading') {
  107. //防止重复加载
  108. return;
  109. }
  110. //修改当前对象状态为加载中
  111. navItem.loadingType = 'loading';
  112. getApplyList({
  113. page: navItem.page,
  114. limit: navItem.limit,
  115. status: state
  116. }).then( res => {
  117. console.log(res)
  118. })
  119. }
  120. }
  121. }
  122. </script>
  123. <style scoped lang="scss">
  124. .navbar {
  125. display: flex;
  126. height: 40px;
  127. padding: 0 5px;
  128. background: #000;
  129. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  130. position: relative;
  131. z-index: 10;
  132. .nav-item {
  133. flex: 1;
  134. display: flex;
  135. justify-content: center;
  136. align-items: center;
  137. height: 100%;
  138. font-size: 15px;
  139. color: #999999;
  140. position: relative;
  141. &.current {
  142. color: $base-color;
  143. &:after {
  144. content: '';
  145. position: absolute;
  146. left: 50%;
  147. bottom: 0;
  148. transform: translateX(-50%);
  149. width: 44px;
  150. height: 0;
  151. border-bottom: 2px solid $base-color;
  152. }
  153. }
  154. }
  155. }
  156. .swiper-box {
  157. background-color: #15130f;
  158. .apply-box {
  159. height: 317rpx;
  160. width: 702rpx;
  161. // background-color: red;
  162. margin: 0 auto;
  163. border-bottom: 1px solid #6c6a68;
  164. padding-top: 30rpx;
  165. .box-top {
  166. height: 80rpx;
  167. // background-color: #bfa;
  168. display: flex;
  169. justify-content: flex-start;
  170. .user-img {
  171. width: 80rpx;
  172. height: 80rpx;
  173. background-color: #eee;
  174. margin-right: 20rpx;
  175. flex-shrink: 0;
  176. border-radius: 50%;
  177. }
  178. .user-name {
  179. max-width: 500rpx;
  180. font-size: 30rpx;
  181. font-family: PingFang SC;
  182. font-weight: 500;
  183. color: #FFFFFF;
  184. }
  185. .user-phone {
  186. padding-top: 10rpx;
  187. font-size: 22rpx;
  188. font-family: PingFang SC;
  189. font-weight: 400;
  190. color: #FFFFFF;
  191. }
  192. }
  193. .apply-info {
  194. padding: 25rpx 0 0 100rpx;
  195. justify-content: space-between;
  196. .img-wrap {
  197. .upimg {
  198. width: 153rpx;
  199. height: 152rpx;
  200. border-radius: 10rpx;
  201. background-color: #999;
  202. margin-left: 10rpx;
  203. }
  204. }
  205. .btn-wrap {
  206. align-self: flex-end;
  207. color: #FAD6B0;
  208. font-size: 24rpx;
  209. font-family: PingFang SC;
  210. font-weight: 500;
  211. color: #FAD6B0;
  212. .btn {
  213. width: 98rpx;
  214. line-height: 47rpx;
  215. text-align: center;
  216. }
  217. .btn-reject {
  218. border: 1px solid #FAD6B0;
  219. border-radius: 5rpx;
  220. color: #FAD6B0;
  221. }
  222. .btn-pass {
  223. background: linear-gradient(-74deg, #CE9C6D, #FFECD6);
  224. border-image: linear-gradient(115deg, #FEEBD5, #FFFFFF, #E1AD7D) 1 1;
  225. box-shadow: 3rpx 4rpx 5rpx 0rpx rgba(151, 118, 74, 0.5);
  226. border-radius: 5rpx;
  227. color: #874B19;
  228. margin-left: 10rpx;
  229. }
  230. }
  231. }
  232. }
  233. }
  234. </style>