applyList.vue 8.3 KB

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