applyList.vue 9.5 KB

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