applyList.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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. <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300" @change="changeTab">
  7. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  8. <scroll-view scroll-y="true" class="list-scroll-content" :style="{ height: height }">
  9. <!-- 申请列表 -->
  10. <!-- 空白页 -->
  11. <!-- <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty> -->
  12. <view class="apply-box" v-for="item in tabItem.orderList">
  13. <view class="box-top">
  14. <image :src="item.user_info.avatar" mode="" class="user-img"></image>
  15. <view class="user-info">
  16. <view class="user-name clamp">{{ item.user_info.nickname }}</view>
  17. <view class="user-phone">{{ item.user_info.mobile }}</view>
  18. </view>
  19. </view>
  20. <view class="apply-info flex">
  21. <view class="img-wrap"><image :src="imgitem" mode="" class="upimg" v-for="imgitem in item.voucherimages" @click="open(imgitem)"></image></view>
  22. <view class="btn-wrap flex" v-if="tabCurrentIndex == 0">
  23. <view class="btn btn-reject" @click="cancelApply(item)">{{$t('hea.jj')}}</view>
  24. <view class="btn btn-pass" @click="passApply(item)">{{$t('hea.ty')}}</view>
  25. </view>
  26. <view class="btn-wrap" v-if="tabCurrentIndex == 1">{{ item.status == 1 ? $t('hea.ytg') : $t('hea.wtg') }}</view>
  27. </view>
  28. </view>
  29. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  30. </scroll-view>
  31. </swiper-item>
  32. </swiper>
  33. <uni-popup ref="popup" type="center">
  34. <movable-area class="popup-box">
  35. <movable-view class="popup-item" :scale='true' direction='all' >
  36. <image :src="img" mode=""></image>
  37. </movable-view>
  38. </movable-area>
  39. </uni-popup>
  40. <u-tabbar :list="tabbar" bg-color='#000' active-color='#FAD6B0' inactive-color='#71614f' change='change'></u-tabbar>
  41. </view>
  42. </template>
  43. <script>
  44. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  45. import { getApplyList, passApply, cancelApply } from '../../api/apply.js';
  46. import empty from '@/components/empty';
  47. import { tabbar } from '@/components/tabbar/tabbar.js'
  48. export default {
  49. components: {
  50. empty,
  51. uniPopup
  52. },
  53. data() {
  54. return {
  55. img: '', //图片
  56. height: '',
  57. tabCurrentIndex: 0,
  58. tabbar: tabbar,
  59. navList: [
  60. {
  61. state: 0,
  62. text: '未审核',
  63. loadingType: 'more',
  64. orderList: [],
  65. page: 1,
  66. limit: 10
  67. },
  68. {
  69. state: 1,
  70. text: '已审核',
  71. loadingType: 'more',
  72. orderList: [],
  73. page: 1,
  74. limit: 10
  75. }
  76. ]
  77. };
  78. },
  79. onReady(res) {
  80. var obj = this;
  81. uni.getSystemInfo({
  82. success: resu => {
  83. const query = uni.createSelectorQuery();
  84. query.select('.swiper-box').boundingClientRect();
  85. query.exec(function(res) {
  86. console.log(res, 'ddddddddddddd');
  87. obj.height = resu.windowHeight - res[0].top + 'px';
  88. console.log('打印页面的剩余高度', obj.height);
  89. });
  90. },
  91. fail: res => {}
  92. });
  93. },
  94. onLoad() {
  95. this.loadData();
  96. },
  97. methods: {
  98. //顶部tab点击
  99. tabClick(index) {
  100. this.tabCurrentIndex = index;
  101. },
  102. changeTab(e) {
  103. this.tabCurrentIndex = e.target.current;
  104. this.loadData('tabChange');
  105. },
  106. loadData(source) {
  107. console.log('swiper');
  108. let index = this.tabCurrentIndex;
  109. let navItem = this.navList[index];
  110. let state = navItem.state;
  111. if (source === 'tabChange' && navItem.loaded === true) {
  112. //tab切换只有第一次需要加载数据
  113. return;
  114. }
  115. if (navItem.loadingType === 'loading') {
  116. //防止重复加载
  117. return;
  118. }
  119. //修改当前对象状态为加载中
  120. navItem.loadingType = 'loading';
  121. getApplyList({
  122. page: navItem.page,
  123. limit: navItem.limit,
  124. status: state
  125. }).then(({ data }) => {
  126. let arr = data.list.map(item => {
  127. if (item.voucherimages) {
  128. let arr = item.voucherimages.split(',');
  129. console.log(arr, 'ddddddddddddddddddddddd');
  130. item.voucherimages = arr;
  131. }
  132. return item;
  133. });
  134. navItem.orderList = navItem.orderList.concat(arr);
  135. if (data.list.length == navItem.limit) {
  136. navItem.page++;
  137. navItem.loadingType = 'more';
  138. } else {
  139. navItem.loadingType = 'noMore';
  140. }
  141. this.$set(navItem, 'loaded', true);
  142. });
  143. },
  144. cancelApply(item) {
  145. console.log(item, 'cancelApply');
  146. cancelApply({}, item.id)
  147. .then(res => {
  148. console.log(res);
  149. let s = obj.navList[obj.tabCurrentIndex].orderList.indexOf(item);
  150. obj.navList[obj.tabCurrentIndex].orderList.splice(s, 1);
  151. uni.showToast({
  152. title: '审核成功',
  153. duration: 2000
  154. });
  155. })
  156. .catch(err => {
  157. console.log(err);
  158. });
  159. },
  160. passApply(item) {
  161. let obj = this;
  162. console.log('passApply');
  163. passApply({}, item.id)
  164. .then(res => {
  165. console.log(res);
  166. let s = obj.navList[obj.tabCurrentIndex].orderList.indexOf(item);
  167. obj.navList[obj.tabCurrentIndex].orderList.splice(s, 1);
  168. uni.showToast({
  169. title: '审核成功',
  170. duration: 2000
  171. });
  172. })
  173. .catch(err => {
  174. console.log(err);
  175. });
  176. },
  177. open(option) {
  178. this.img = option;
  179. console.log('点击出现弹窗');
  180. this.$refs.popup.open();
  181. }
  182. }
  183. };
  184. </script>
  185. <style scoped lang="scss">
  186. .navbar {
  187. display: flex;
  188. height: 40px;
  189. padding: 0 5px;
  190. background: #000;
  191. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  192. position: relative;
  193. z-index: 10;
  194. .nav-item {
  195. flex: 1;
  196. display: flex;
  197. justify-content: center;
  198. align-items: center;
  199. height: 100%;
  200. font-size: 15px;
  201. color: #999999;
  202. position: relative;
  203. &.current {
  204. color: $base-color;
  205. &:after {
  206. content: '';
  207. position: absolute;
  208. left: 50%;
  209. bottom: 0;
  210. transform: translateX(-50%);
  211. width: 44px;
  212. height: 0;
  213. border-bottom: 2px solid $base-color;
  214. }
  215. }
  216. }
  217. }
  218. .swiper-box {
  219. background-color: #15130f;
  220. .apply-box {
  221. height: 317rpx;
  222. width: 702rpx;
  223. // background-color: red;
  224. margin: 0 auto;
  225. border-bottom: 1px solid #6c6a68;
  226. padding-top: 30rpx;
  227. .box-top {
  228. height: 80rpx;
  229. // background-color: #bfa;
  230. display: flex;
  231. justify-content: flex-start;
  232. .user-img {
  233. width: 80rpx;
  234. height: 80rpx;
  235. background-color: #eee;
  236. margin-right: 20rpx;
  237. flex-shrink: 0;
  238. border-radius: 50%;
  239. }
  240. .user-name {
  241. max-width: 500rpx;
  242. font-size: 30rpx;
  243. font-family: PingFang SC;
  244. font-weight: 500;
  245. color: #ffffff;
  246. }
  247. .user-phone {
  248. padding-top: 10rpx;
  249. font-size: 22rpx;
  250. font-family: PingFang SC;
  251. font-weight: 400;
  252. color: #ffffff;
  253. }
  254. }
  255. .apply-info {
  256. padding: 25rpx 0 0 100rpx;
  257. justify-content: space-between;
  258. .img-wrap {
  259. .upimg {
  260. width: 153rpx;
  261. height: 152rpx;
  262. border-radius: 10rpx;
  263. background-color: #999;
  264. margin-left: 10rpx;
  265. }
  266. }
  267. .btn-wrap {
  268. align-self: flex-end;
  269. color: #fad6b0;
  270. font-size: 24rpx;
  271. font-family: PingFang SC;
  272. font-weight: 500;
  273. color: #fad6b0;
  274. .btn {
  275. width: 98rpx;
  276. line-height: 47rpx;
  277. text-align: center;
  278. }
  279. .btn-reject {
  280. border: 1px solid #fad6b0;
  281. border-radius: 5rpx;
  282. color: #fad6b0;
  283. }
  284. .btn-pass {
  285. background: linear-gradient(-74deg, #ce9c6d, #ffecd6);
  286. border-image: linear-gradient(115deg, #feebd5, #ffffff, #e1ad7d) 1 1;
  287. box-shadow: 3rpx 4rpx 5rpx 0rpx rgba(151, 118, 74, 0.5);
  288. border-radius: 5rpx;
  289. color: #874b19;
  290. margin-left: 10rpx;
  291. }
  292. }
  293. }
  294. }
  295. }
  296. .popup-box {
  297. width: 522rpx;
  298. height: 605rpx;
  299. border-radius: 20rpx;
  300. position: relative;
  301. .popup-item {
  302. width: 100%;
  303. height: 100%;
  304. image {
  305. width: 100%;
  306. height: 100%;
  307. }
  308. }
  309. }
  310. </style>