myFu.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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" class="swiper-box" duration="300" @change="changeTab">
  7. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  8. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  9. <!-- 空白页 -->
  10. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  11. <!-- 订单列表 -->
  12. <view class="fu-box" v-for="(item, index) in tabItem.orderList" :key='index' @click="toDetail(item)" v-if="item.info.title">
  13. <image class="fu-img" :src="baseURL + item.info.userimage" mode="aspectFill"></image>
  14. <view class="fu-right">
  15. <view>
  16. <view class="fu-tit">{{ item.info.title }}</view>
  17. <view class="fu-text">{{ item.info.info }}</view>
  18. </view>
  19. <view class="fu-bottom" v-if="tabCurrentIndex == 2 && item.info && item.info.title">
  20. <text class="fu-jifen">+{{ item.info.integral }}积分</text>
  21. <view class="fu-sczl" v-if="!item.remark" @click.stop="upInfo(item.hid)">上传资料</view>
  22. <view class="fu-shenqing" v-if="item.status == 3">公示中</view>
  23. </view>
  24. <view class="fu-bottom" v-if="tabCurrentIndex == 3 && item.info && item.info.title">
  25. <text class="fu-jifen">+{{ item.info.integral }}积分</text>
  26. <view class="fu-sczl" @click.stop="upInfo(item.hid, 1)">修改资料</view>
  27. </view>
  28. <view class="fu-bottom" v-if="tabCurrentIndex !== 2 && tabCurrentIndex !== 3 && tabCurrentIndex !== 4 && item.info && item.info.title ">
  29. <view class="fu-shenqing">已有{{ item.info.apply_sum }}人申请</view>
  30. <text class="fu-jifen">+{{ item.info.integral }}积分</text>
  31. </view>
  32. <view class="fu-bottom" v-if="tabCurrentIndex == 4 && item.info && item.info.title ">
  33. <view class="fu-shenqing"></view>
  34. <text class="fu-yjs">已结束</text>
  35. </view>
  36. <view class="fu-bottom" v-if="item.info && !item.info.title ">
  37. <view class="fu-shenqing"></view>
  38. <text class="fu-yjs">该项目已删除</text>
  39. </view>
  40. </view>
  41. </view>
  42. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  43. </scroll-view>
  44. </swiper-item>
  45. </swiper>
  46. </view>
  47. </template>
  48. <script>
  49. import { my_enroll } from '@/api/applyHelp.js';
  50. import { userapplylst } from '@/api/help.js'
  51. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  52. import empty from '@/components/empty';
  53. import {
  54. mapState,
  55. mapMutations
  56. } from 'vuex';
  57. export default {
  58. components: {
  59. uniLoadMore,
  60. empty
  61. },
  62. computed: {
  63. ...mapState(['baseURL'])
  64. },
  65. data() {
  66. return {
  67. tabCurrentIndex: 0,
  68. navList: [
  69. {
  70. state: 0,
  71. text: '审核中',
  72. loadingType: 'more',
  73. orderList: [],
  74. page: 1, //当前页数
  75. limit: 10 //每次信息条数
  76. },
  77. {
  78. state: -1,
  79. text: '已拒绝',
  80. loadingType: 'more',
  81. orderList: [],
  82. page: 1, //当前页数
  83. limit: 10 //每次信息条数
  84. },
  85. {
  86. state: 1,
  87. text: '已通过',
  88. loadingType: 'more',
  89. orderList: [],
  90. page: 1, //当前页数
  91. limit: 10 //每次信息条数
  92. },
  93. // {
  94. // state: 5,
  95. // text: '公示中',
  96. // loadingType: 'more',
  97. // orderList: [],
  98. // page: 1, //当前页数
  99. // limit: 10 //每次信息条数
  100. // },
  101. // {
  102. // state: 4,
  103. // text: '已结束',
  104. // loadingType: 'more',
  105. // orderList: [],
  106. // page: 1, //当前页数
  107. // limit: 10 //每次信息条数
  108. // },
  109. ],
  110. }
  111. },
  112. onLoad() {
  113. },
  114. onShow() {
  115. if (this.tabCurrentIndex == 0) {
  116. let index = this.tabCurrentIndex;
  117. this.navList[index].page = 1;
  118. this.navList[index].orderList = [];
  119. this.navList[index].loadingType = 'more';
  120. this.loadData();
  121. }
  122. },
  123. methods: {
  124. //swiper 切换
  125. changeTab(e) {
  126. this.tabCurrentIndex = e.target.current;
  127. this.loadData('tabChange');
  128. },
  129. //顶部tab点击
  130. tabClick(index) {
  131. this.tabCurrentIndex = index;
  132. },
  133. loadData(source) {
  134. console.log(getApp(),'getapp')
  135. let index = this.tabCurrentIndex;
  136. let navItem = this.navList[index];
  137. let state = navItem.state;
  138. if (source === 'tabChange' && navItem.loaded === true) {
  139. //tab切换只有第一次需要加载数据
  140. return;
  141. }
  142. if (navItem.loadingType === 'noMore') {
  143. //防止重复加载
  144. return;
  145. }
  146. // 修改当前对象状态为加载中
  147. navItem.loadingType = 'loading';
  148. userapplylst({
  149. page: navItem.page,
  150. limit:navItem.limit,
  151. status: state,
  152. }).then(res => {
  153. navItem.orderList = navItem.orderList.concat(res.data.filter(word => !!word.info.title));
  154. navItem.page++;
  155. if (navItem.limit == res.data.length) {
  156. //判断是否还有数据, 有改为 more, 没有改为noMore
  157. navItem.loadingType = 'more';
  158. return;
  159. } else {
  160. //判断是否还有数据, 有改为 more, 没有改为noMore
  161. navItem.loadingType = 'noMore';
  162. }
  163. this.$set(navItem, 'loaded', true);
  164. }).catch(err => {
  165. console.log(err);
  166. });
  167. },
  168. // 上传资料
  169. upInfo(id, type) {
  170. let url = '/pages/fu/upLoadInfo?id=' + id;
  171. if (type) {
  172. url += '&type=' + type
  173. }
  174. uni.navigateTo({
  175. url: url
  176. })
  177. },
  178. // 跳转详情
  179. toDetail(item) {
  180. uni.navigateTo({
  181. url: '/pages/fu/fuInfo?id=' + item.id
  182. })
  183. // if (item.remark) {
  184. // uni.navigateTo({
  185. // url: '/pages/fu/helpDetail?id=' + item.id
  186. // })
  187. // } else {
  188. // uni.navigateTo({
  189. // url: '/pages/fu/fuInfo?id=' + item.id
  190. // })
  191. // }
  192. }
  193. }
  194. }
  195. </script>
  196. <style lang="scss">
  197. page {
  198. height: 100%;
  199. background: #F4F5F4;
  200. }
  201. .content {
  202. height: 100%;
  203. .navbar {
  204. display: flex;
  205. height: 40px;
  206. padding: 0 5px;
  207. background: #fff;
  208. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  209. position: relative;
  210. z-index: 10;
  211. .nav-item {
  212. flex: 1;
  213. display: flex;
  214. justify-content: center;
  215. align-items: center;
  216. height: 100%;
  217. font-size: 15px;
  218. color: $font-color-dark;
  219. position: relative;
  220. &.current {
  221. color: $motif-color;
  222. &:after {
  223. content: '';
  224. position: absolute;
  225. left: 50%;
  226. bottom: 0;
  227. transform: translateX(-50%);
  228. width: 44px;
  229. height: 0;
  230. border-bottom: 2px solid $motif-color;
  231. }
  232. }
  233. }
  234. }
  235. .swiper-box {
  236. height: calc(100% - 40px);
  237. padding: 20rpx 30rpx;
  238. }
  239. .list-scroll-content {
  240. height: 100%;
  241. }
  242. .fu-box {
  243. padding: 14rpx 20rpx 28rpx 20rpx;
  244. background: #FFFFFF;
  245. box-shadow: 0px 0px 40rpx 0px rgba(0, 0, 0, 0.06);
  246. border-radius: 12rpx;
  247. display: flex;
  248. align-items: center;
  249. margin-bottom: 20rpx;
  250. .fu-img {
  251. width: 220rpx;
  252. height: 182rpx;
  253. border-radius: 8rpx;
  254. }
  255. .fu-right {
  256. margin-left: 20rpx;
  257. width: 62%;
  258. .fu-tit {
  259. overflow: hidden;
  260. text-overflow: ellipsis;
  261. white-space: nowrap;
  262. font-size: 36rpx;
  263. font-family: PingFang SC;
  264. font-weight: 500;
  265. color: #222222;
  266. }
  267. .fu-text {
  268. margin-top: 17rpx;
  269. overflow : hidden;
  270. text-overflow: ellipsis;
  271. display: -webkit-box;
  272. -webkit-line-clamp: 2;
  273. -webkit-box-orient: vertical;
  274. font-size: $font-sm;
  275. font-family: PingFang SC;
  276. font-weight: 500;
  277. color: #666666;
  278. }
  279. .fu-bottom {
  280. margin-top: 20rpx;
  281. display: flex;
  282. align-items: center;
  283. justify-content: space-between;
  284. .fu-shenqing {
  285. font-size: 21rpx;
  286. font-family: PingFang;
  287. font-weight: 500;
  288. color: #FF727E;
  289. }
  290. .fu-jifen {
  291. padding: 0 5rpx;
  292. border: 1px solid #FF0000;
  293. border-radius: 5rpx;
  294. font-size: 21rpx;
  295. font-family: PingFang SC;
  296. font-weight: 500;
  297. color: #FF0000;
  298. }
  299. .fu-yjs {
  300. font-size: 21rpx;
  301. font-family: PingFang;
  302. font-weight: 500;
  303. color: #999999;
  304. }
  305. .fu-sczl {
  306. padding: 5rpx 17rpx;
  307. font-size: 21rpx;
  308. font-family: PingFang SC;
  309. font-weight: 500;
  310. color: #FFFFFF;
  311. background: #FF727E;
  312. border-radius: 23rpx;
  313. }
  314. }
  315. }
  316. }
  317. }
  318. </style>