applyList.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  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"><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.loadData();
  129. },
  130. methods: {
  131. //顶部tab点击
  132. tabClick(index) {
  133. this.tabCurrentIndex = index;
  134. },
  135. changeTab(e) {
  136. this.tabCurrentIndex = e.target.current;
  137. this.loadData('tabChange');
  138. },
  139. loadData(source) {
  140. console.log('swiper');
  141. let index = this.tabCurrentIndex;
  142. let navItem = this.navList[index];
  143. let state = navItem.state;
  144. if (source === 'tabChange' && navItem.loaded === true) {
  145. //tab切换只有第一次需要加载数据
  146. return;
  147. }
  148. if (navItem.loadingType === 'loading') {
  149. //防止重复加载
  150. return;
  151. }
  152. //修改当前对象状态为加载中
  153. navItem.loadingType = 'loading';
  154. getApplyList({
  155. page: navItem.page,
  156. limit: navItem.limit,
  157. status: state
  158. }).then(({ data }) => {
  159. let arr = data.list.map(item => {
  160. if (item.voucherimages) {
  161. let arr = item.voucherimages.split(',');
  162. console.log(arr, 'ddddddddddddddddddddddd');
  163. item.voucherimages = arr;
  164. }
  165. return item;
  166. });
  167. navItem.orderList = navItem.orderList.concat(arr);
  168. if (data.list.length == navItem.limit) {
  169. navItem.page++;
  170. navItem.loadingType = 'more';
  171. } else {
  172. navItem.loadingType = 'noMore';
  173. }
  174. this.$set(navItem, 'loaded', true);
  175. });
  176. },
  177. cancelApply(item) {
  178. const obj = this;
  179. console.log(item, 'cancelApply');
  180. cancelApply({}, item.id)
  181. .then(res => {
  182. console.log(res);
  183. let s = obj.navList[obj.tabCurrentIndex].orderList.indexOf(item);
  184. obj.navList[obj.tabCurrentIndex].orderList.splice(s, 1);
  185. uni.showToast({
  186. title: '审核成功',
  187. duration: 2000
  188. });
  189. })
  190. .catch(err => {
  191. console.log(err);
  192. });
  193. },
  194. passApply(item) {
  195. let obj = this;
  196. console.log('passApply');
  197. passApply({}, item.id)
  198. .then(res => {
  199. console.log(res);
  200. let s = obj.navList[obj.tabCurrentIndex].orderList.indexOf(item);
  201. obj.navList[obj.tabCurrentIndex].orderList.splice(s, 1);
  202. uni.showToast({
  203. title: '审核成功',
  204. duration: 2000
  205. });
  206. })
  207. .catch(err => {
  208. console.log(err);
  209. });
  210. },
  211. open(option) {
  212. this.img = option;
  213. console.log('点击出现弹窗');
  214. this.$refs.popup.open();
  215. }
  216. }
  217. };
  218. </script>
  219. <style scoped lang="scss">
  220. .navbar {
  221. display: flex;
  222. height: 40px;
  223. padding: 0 5px;
  224. background: #000;
  225. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  226. position: relative;
  227. z-index: 10;
  228. .nav-item {
  229. flex: 1;
  230. display: flex;
  231. justify-content: center;
  232. align-items: center;
  233. height: 100%;
  234. font-size: 15px;
  235. color: #999999;
  236. position: relative;
  237. &.current {
  238. color: $base-color;
  239. &:after {
  240. content: '';
  241. position: absolute;
  242. left: 50%;
  243. bottom: 0;
  244. transform: translateX(-50%);
  245. width: 44px;
  246. height: 0;
  247. border-bottom: 2px solid $base-color;
  248. }
  249. }
  250. }
  251. }
  252. .swiper-box {
  253. background-color: #15130f;
  254. .apply-box {
  255. height: 317rpx;
  256. width: 702rpx;
  257. // background-color: red;
  258. margin: 0 auto;
  259. border-bottom: 1px solid #6c6a68;
  260. padding-top: 30rpx;
  261. .box-top {
  262. height: 80rpx;
  263. // background-color: #bfa;
  264. display: flex;
  265. justify-content: flex-start;
  266. .user-img {
  267. width: 80rpx;
  268. height: 80rpx;
  269. background-color: #eee;
  270. margin-right: 20rpx;
  271. flex-shrink: 0;
  272. border-radius: 50%;
  273. }
  274. .user-name {
  275. max-width: 500rpx;
  276. font-size: 30rpx;
  277. font-family: PingFang SC;
  278. font-weight: 500;
  279. color: #ffffff;
  280. }
  281. .user-phone {
  282. padding-top: 10rpx;
  283. font-size: 22rpx;
  284. font-family: PingFang SC;
  285. font-weight: 400;
  286. color: #ffffff;
  287. }
  288. }
  289. .apply-info {
  290. padding: 25rpx 0 0 100rpx;
  291. justify-content: space-between;
  292. .img-wrap {
  293. .upimg {
  294. width: 153rpx;
  295. height: 152rpx;
  296. border-radius: 10rpx;
  297. background-color: #999;
  298. margin-left: 10rpx;
  299. }
  300. }
  301. .btn-wrap {
  302. align-self: flex-end;
  303. color: #fad6b0;
  304. font-size: 24rpx;
  305. font-family: PingFang SC;
  306. font-weight: 500;
  307. color: #fad6b0;
  308. .btn {
  309. width: 98rpx;
  310. line-height: 47rpx;
  311. text-align: center;
  312. }
  313. .btn-reject {
  314. border: 1px solid #fad6b0;
  315. border-radius: 5rpx;
  316. color: #fad6b0;
  317. }
  318. .btn-pass {
  319. background: linear-gradient(-74deg, #ce9c6d, #ffecd6);
  320. border-image: linear-gradient(115deg, #feebd5, #ffffff, #e1ad7d) 1 1;
  321. box-shadow: 3rpx 4rpx 5rpx 0rpx rgba(151, 118, 74, 0.5);
  322. border-radius: 5rpx;
  323. color: #874b19;
  324. margin-left: 10rpx;
  325. }
  326. }
  327. }
  328. }
  329. }
  330. .popup-box {
  331. width: 522rpx;
  332. height: 605rpx;
  333. border-radius: 20rpx;
  334. position: relative;
  335. .popup-item {
  336. width: 100%;
  337. height: 100%;
  338. image {
  339. width: 100%;
  340. height: 100%;
  341. }
  342. }
  343. }
  344. </style>