myFu.vue 7.7 KB

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