applyList.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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="item.user_info.avatar" mode="" class="user-img"></image>
  17. <view class="user-info">
  18. <view class="user-name clamp">
  19. {{item.user_info.nickname}}
  20. </view>
  21. <view class="user-phone">
  22. {{item.user_info.mobile}}
  23. </view>
  24. </view>
  25. </view>
  26. <view class="apply-info flex">
  27. <view class="img-wrap">
  28. <image :src="imgitem" mode="" class="upimg" v-for="imgitem in item.voucherimages"></image>
  29. </view>
  30. <view class="btn-wrap flex" v-if="tabCurrentIndex == 0">
  31. <view class="btn btn-reject" @click="cancelApply(item)">拒绝</view>
  32. <view class="btn btn-pass" @click="passApply(item)">通过</view>
  33. </view>
  34. <view class="btn-wrap" v-if="tabCurrentIndex == 1">
  35. {{item.status == 1 ? "已通过": "未通过"}}
  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;
  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. let arr = item.voucherimages.split(',')
  126. console.log(arr,'ddddddddddddddddddddddd')
  127. item.voucherimages = arr
  128. return item
  129. })
  130. navItem.orderList = navItem.orderList.concat(arr)
  131. if(data.list.length == navItem.limit) {
  132. navItem.page++
  133. navItem.loadingType = 'more'
  134. }else {
  135. navItem.loadingType = 'noMore'
  136. }
  137. this.$set(navItem,'loaded',true)
  138. })
  139. },
  140. cancelApply(item) {
  141. console.log(item,'cancelApply')
  142. cancelApply({},item.id).then( res => {
  143. console.log(res)
  144. let s = obj.navList[obj.tabCurrentIndex].orderList.indexOf(item);
  145. obj.navList[obj.tabCurrentIndex].orderList.splice(s, 1);
  146. }).catch( err => {
  147. console.log(err)
  148. })
  149. },
  150. passApply(item) {
  151. let obj = this
  152. console.log('passApply')
  153. passApply({},item.id).then( res => {
  154. console.log(res)
  155. let s = obj.navList[obj.tabCurrentIndex].orderList.indexOf(item);
  156. obj.navList[obj.tabCurrentIndex].orderList.splice(s, 1);
  157. }).catch(err => {
  158. console.log(err)
  159. })
  160. }
  161. }
  162. }
  163. </script>
  164. <style scoped lang="scss">
  165. .navbar {
  166. display: flex;
  167. height: 40px;
  168. padding: 0 5px;
  169. background: #000;
  170. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  171. position: relative;
  172. z-index: 10;
  173. .nav-item {
  174. flex: 1;
  175. display: flex;
  176. justify-content: center;
  177. align-items: center;
  178. height: 100%;
  179. font-size: 15px;
  180. color: #999999;
  181. position: relative;
  182. &.current {
  183. color: $base-color;
  184. &:after {
  185. content: '';
  186. position: absolute;
  187. left: 50%;
  188. bottom: 0;
  189. transform: translateX(-50%);
  190. width: 44px;
  191. height: 0;
  192. border-bottom: 2px solid $base-color;
  193. }
  194. }
  195. }
  196. }
  197. .swiper-box {
  198. background-color: #15130f;
  199. .apply-box {
  200. height: 317rpx;
  201. width: 702rpx;
  202. // background-color: red;
  203. margin: 0 auto;
  204. border-bottom: 1px solid #6c6a68;
  205. padding-top: 30rpx;
  206. .box-top {
  207. height: 80rpx;
  208. // background-color: #bfa;
  209. display: flex;
  210. justify-content: flex-start;
  211. .user-img {
  212. width: 80rpx;
  213. height: 80rpx;
  214. background-color: #eee;
  215. margin-right: 20rpx;
  216. flex-shrink: 0;
  217. border-radius: 50%;
  218. }
  219. .user-name {
  220. max-width: 500rpx;
  221. font-size: 30rpx;
  222. font-family: PingFang SC;
  223. font-weight: 500;
  224. color: #FFFFFF;
  225. }
  226. .user-phone {
  227. padding-top: 10rpx;
  228. font-size: 22rpx;
  229. font-family: PingFang SC;
  230. font-weight: 400;
  231. color: #FFFFFF;
  232. }
  233. }
  234. .apply-info {
  235. padding: 25rpx 0 0 100rpx;
  236. justify-content: space-between;
  237. .img-wrap {
  238. .upimg {
  239. width: 153rpx;
  240. height: 152rpx;
  241. border-radius: 10rpx;
  242. background-color: #999;
  243. margin-left: 10rpx;
  244. }
  245. }
  246. .btn-wrap {
  247. align-self: flex-end;
  248. color: #FAD6B0;
  249. font-size: 24rpx;
  250. font-family: PingFang SC;
  251. font-weight: 500;
  252. color: #FAD6B0;
  253. .btn {
  254. width: 98rpx;
  255. line-height: 47rpx;
  256. text-align: center;
  257. }
  258. .btn-reject {
  259. border: 1px solid #FAD6B0;
  260. border-radius: 5rpx;
  261. color: #FAD6B0;
  262. }
  263. .btn-pass {
  264. background: linear-gradient(-74deg, #CE9C6D, #FFECD6);
  265. border-image: linear-gradient(115deg, #FEEBD5, #FFFFFF, #E1AD7D) 1 1;
  266. box-shadow: 3rpx 4rpx 5rpx 0rpx rgba(151, 118, 74, 0.5);
  267. border-radius: 5rpx;
  268. color: #874B19;
  269. margin-left: 10rpx;
  270. }
  271. }
  272. }
  273. }
  274. }
  275. </style>