cation.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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. <!-- <scroll-view class="scroll-list" scroll-x>
  7. <view class="scoll-box" v-for="ls in cationList" :class="{ active: ls.id === currentId }" @click="tabtap(ls.id)">
  8. <view class="scoll-name">{{ ls.cate_name }}</view>
  9. </view>
  10. </scroll-view> -->
  11. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
  12. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  13. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  14. <!-- 空白页 -->
  15. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  16. <!-- 订单列表 -->
  17. <view class="list">
  18. <view class="list-item" v-for="ls in tabItem.orderList"> <!-- @click="ToIndex(ls)" -->
  19. <view class="item-top">
  20. <view class="tip-info flex-shrink-false" v-if="ls.category">{{ls.category}}</view>
  21. <view class="name clamp flex-grow-true">{{ls.title}}</view>
  22. </view>
  23. <view class="title">申请人:{{ls.full_name}}</view>
  24. <view class="title">状态:{{ls.status == 0 ? '正在审核' : ls.status == 1 ? '审核通过' :'审核驳回' }} {{ ls.status == 2 ? ls.fail_msg : ''}}</view>
  25. </view>
  26. </view>
  27. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  28. </scroll-view>
  29. </swiper-item>
  30. </swiper>
  31. <view class="tip" @click="ToHelp"><text>申请帮扶</text></view>
  32. </view>
  33. </template>
  34. <script>
  35. import { getList,gethelp } from '@/api/applyHelp.js';
  36. import { getMyHelpApplyList } from '@/api/help.js'
  37. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  38. import empty from '@/components/empty';
  39. export default {
  40. components: {
  41. empty
  42. },
  43. data() {
  44. return {
  45. tabCurrentIndex: 0,
  46. navList: [
  47. {
  48. state: 0,
  49. text: '审核中',
  50. loadingType: 'more',
  51. orderList: [],
  52. page: 1, //当前页数
  53. limit: 10 //每次信息条数
  54. },
  55. {
  56. state: 1,
  57. text: '已通过',
  58. loadingType: 'more',
  59. orderList: [],
  60. page: 1, //当前页数
  61. limit: 10 //每次信息条数
  62. },
  63. {
  64. state: -1,
  65. text: '已拒绝',
  66. loadingType: 'more',
  67. orderList: [],
  68. page: 1, //当前页数
  69. limit: 10 //每次信息条数
  70. },
  71. ],
  72. cationList:[],
  73. currentId:0,
  74. hpleList:''
  75. };
  76. },
  77. onLoad() {
  78. this.loadData()
  79. },
  80. methods: {
  81. //swiper 切换
  82. changeTab(e) {
  83. this.tabCurrentIndex = e.target.current;
  84. this.loadData('tabChange');
  85. },
  86. //顶部tab点击
  87. tabClick(index) {
  88. this.tabCurrentIndex = index;
  89. },
  90. // 载入数据
  91. loadData(source){
  92. let obj = this;
  93. let index = this.tabCurrentIndex;
  94. let navItem = this.navList[index];
  95. let state = navItem.state;
  96. if (source === 'tabChange' && navItem.loaded === true) {
  97. //tab切换只有第一次需要加载数据
  98. return;
  99. }
  100. if (navItem.loadingType === 'noMore') {
  101. //防止重复加载
  102. return;
  103. }
  104. // 修改当前对象状态为加载中
  105. navItem.loadingType = 'loading';
  106. getMyHelpApplyList({
  107. page: navItem.page,
  108. limit:navItem.limit,
  109. status: state,
  110. })
  111. .then(({ data }) => {
  112. navItem.orderList = navItem.orderList.concat(data);
  113. console.log(navItem.orderList);
  114. navItem.page++;
  115. if (navItem.limit == data.length) {
  116. //判断是否还有数据, 有改为 more, 没有改为noMore
  117. navItem.loadingType = 'more';
  118. return;
  119. } else {
  120. //判断是否还有数据, 有改为 more, 没有改为noMore
  121. navItem.loadingType = 'noMore';
  122. }
  123. this.$set(navItem, 'loaded', true);
  124. })
  125. .catch(err => {
  126. console.log(err);
  127. });
  128. },
  129. ToIndex(ls){
  130. let id = ls.id;
  131. if(ls.status == 0 || ls.status == 2){
  132. uni.navigateTo({
  133. url:'/pages/applyHelp/index?id='+id
  134. })
  135. }
  136. if(ls.status == 1){
  137. uni.navigateTo({
  138. url:'/pages/applyHelp/index?id='+id+'&status=2'
  139. })
  140. }
  141. },
  142. ToHelp(){
  143. uni.navigateTo({
  144. url:'/pages/applyHelp/index'
  145. })
  146. },
  147. //一级分类点击
  148. tabtap(item) {
  149. let obj = this;
  150. obj.currentId = item;
  151. this.GetHple()
  152. },
  153. }
  154. };
  155. </script>
  156. <style lang="scss">
  157. page {
  158. background: $page-color-base;
  159. height: 100%;
  160. padding-bottom: 200rpx;
  161. .content{
  162. height: 100%;
  163. }
  164. }
  165. .navbar {
  166. display: flex;
  167. height: 40px;
  168. padding: 0 5px;
  169. background: #fff;
  170. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  171. position: relative;
  172. z-index: 10;
  173. .nav-item {
  174. flex: 1;
  175. display: flex;
  176. justify-content: center;
  177. align-items: center;
  178. height: 100%;
  179. font-size: 15px;
  180. color: $font-color-dark;
  181. position: relative;
  182. &.current {
  183. color: $motif-color;
  184. &:after {
  185. content: '';
  186. position: absolute;
  187. left: 50%;
  188. bottom: 0;
  189. transform: translateX(-50%);
  190. width: 44px;
  191. height: 0;
  192. border-bottom: 2px solid $motif-color;
  193. }
  194. }
  195. }
  196. }
  197. .swiper-box {
  198. height: calc(100% - 40px);
  199. padding: 0 20rpx;
  200. }
  201. .list-scroll-content {
  202. height: 100%;
  203. }
  204. .tip{
  205. width: 100%;
  206. color: #FFFFFF;
  207. padding: 30rpx 25rpx;
  208. position: fixed;
  209. background-color: #FF727E;
  210. bottom: 5%;
  211. width: 80%;
  212. left: 10%;
  213. text-align: center;
  214. border-radius:100rpx;
  215. box-shadow:0px 5px 16px 0px rgba(230,33,41,0.22);
  216. }
  217. .scroll-list {
  218. width: 100%;
  219. overflow: hidden;
  220. white-space: nowrap;
  221. background-color: #FFFFFF;
  222. font-size: 32rpx;
  223. .scoll-box {
  224. text-align: center;
  225. display: inline-block;
  226. margin: 0rpx 38rpx;
  227. padding: 15rpx 0rpx;
  228. .scoll-img {
  229. width: 130rpx;
  230. height: 85rpx;
  231. border-radius: 100%;
  232. image {
  233. width: 85rpx;
  234. height: 100%;
  235. border-radius: 100%;
  236. }
  237. }
  238. .scoll-name {
  239. padding-top: 15rpx;
  240. }
  241. &.active {
  242. color: #FF727E;
  243. border-bottom:6rpx solid #FF727E;
  244. }
  245. }
  246. }
  247. .list{
  248. width: 100%;
  249. padding: 25rpx 25rpx;
  250. .list-item{
  251. width: 100%;
  252. padding: 30rpx 28rpx;
  253. background-color: #FFFFFF;
  254. border-radius: 25rpx;
  255. margin-bottom: 25rpx;
  256. .item-top{
  257. display: flex;
  258. align-items: center;
  259. .tip-info{
  260. background-color: #FF727E;
  261. color: #FFFFFF;
  262. border-radius: 10rpx;
  263. font-size: 28rpx;
  264. padding: 8rpx 15rpx;
  265. margin-right: 15rpx;
  266. }
  267. .name{
  268. font-size:36rpx;
  269. font-weight:500;
  270. color:rgba(34,34,34,1);
  271. overflow: hidden;
  272. text-overflow: ellipsis;
  273. white-space: nowrap;
  274. }
  275. }
  276. .title{
  277. font-weight:400;
  278. padding-top: 25rpx;
  279. font-size:28rpx;
  280. color:rgba(34,34,34,1);
  281. }
  282. }
  283. }
  284. </style>