applyList.vue 6.4 KB

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