applyList.vue 7.8 KB

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