applyList.vue 9.2 KB

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