cation.vue 6.4 KB

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