index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view class="container">
  3. <page-title>已逾期</page-title>
  4. <view class="cards-list">
  5. <view class="card" v-for="(item,index) in itemList" :key="index">
  6. <card-title :numerator="index+1" :denominator="listTotal"></card-title>
  7. <view class="card-name">
  8. <view class="card-name-title">
  9. <text class="card-name-description">项目名称</text>
  10. </view>
  11. <text class="card-name-text">{{item.subName}}</text>
  12. </view>
  13. <view class="card-item">
  14. <view class="card-item-name">申报单位</view>
  15. <view class="card-item-content">{{item.sbdw}}</view>
  16. </view>
  17. <view class="card-item">
  18. <view class="card-item-name">阶段说明</view>
  19. <view class="card-item-content">{{item.title}}</view>
  20. </view>
  21. <view class="card-status">
  22. <view class="card-status-item status-now">
  23. <view>逾期类型</view>
  24. <view class="status-item-text">{{item.kindName}}</view>
  25. </view>
  26. <view class="card-status-item status-date">
  27. <view>计划日期</view>
  28. <view class="status-item-text">{{item.endDate}}</view>
  29. </view>
  30. <view class="card-status-item status-day">
  31. <view>预警天数</view>
  32. <view class="status-item-text"><text class="status-item-highlight">{{item.overDays}}</text>天</view>
  33. </view>
  34. </view>
  35. <view class="card-item">
  36. <view class="card-btn fat-btn" @click="gotoDetail(item.subId,item.subName)">项目查看</view>
  37. </view>
  38. </view>
  39. <empty-show v-if="itemList.length===0"></empty-show>
  40. </view>
  41. <u-back-top :scroll-top="scrollTop"></u-back-top>
  42. <u-loading-page :loading="loading"></u-loading-page>
  43. </view>
  44. </template>
  45. <script setup>
  46. import {
  47. ref
  48. } from 'vue'
  49. import {
  50. onLoad,
  51. onPullDownRefresh,
  52. onReachBottom,
  53. onPageScroll
  54. } from "@dcloudio/uni-app"
  55. import {
  56. getOverdueList
  57. } from "@/api/work/overdue.js"
  58. function backToBefore() {
  59. uni.navigateBack({})
  60. };
  61. let scrollTop = ref(0)
  62. let loading = ref(true)
  63. // 参数
  64. let searchInfo = ref({
  65. pageNo: 1,
  66. pageSize: 10,
  67. overStatus: 1
  68. })
  69. function getList() {
  70. if(searchInfo.value.pageNo == 1){
  71. loading.value = true
  72. }
  73. getOverdueList(searchInfo.value).then(res => {
  74. loading.value = false
  75. itemList.value = itemList.value.concat(res.data.list)
  76. listTotal.value = res.data.total
  77. if (res.data.total == searchInfo.value.pageNo*searchInfo.value.pageSize-(10 - res.data.list.length)) moreListFlag = false;
  78. }).catch(() => {
  79. loading.value = false
  80. })
  81. }
  82. let itemList = ref([])
  83. let listTotal = ref(0)
  84. function gotoDetail(id, subName) {
  85. uni.navigateTo({
  86. url: `/pages/projectInfo/detail/index?id=${id}&subName=${subName}`
  87. })
  88. }
  89. // 触底加载flag
  90. let moreListFlag = true
  91. onLoad(() => {
  92. getList()
  93. })
  94. onPageScroll((e) => {
  95. scrollTop.value = e.scrollTop
  96. })
  97. onPullDownRefresh(() => {
  98. searchInfo.value.pageNo = 1;
  99. itemList.value = [];
  100. moreListFlag = true;
  101. try {
  102. getList();
  103. } finally {
  104. uni.stopPullDownRefresh()
  105. }
  106. })
  107. onReachBottom(() => {
  108. if (!moreListFlag) {
  109. return uni.showToast({
  110. title: "已经到底了。",
  111. icon: "none",
  112. duration: 2000
  113. })
  114. }
  115. searchInfo.value.pageNo++;
  116. getList();
  117. })
  118. </script>
  119. <style lang="scss" scoped>
  120. .card-status {
  121. display: flex;
  122. justify-content: space-between;
  123. width: 100%;
  124. height: 128rpx;
  125. margin-top: 40rpx;
  126. .card-status-item {
  127. display: flex;
  128. flex-direction: column;
  129. justify-content: space-between;
  130. width: 190rpx;
  131. height: 128rpx;
  132. padding: 16rpx 0 30rpx;
  133. border-radius: 20rpx;
  134. text-align: center;
  135. font-size: 24rpx;
  136. font-weight: 400;
  137. color: #626266;
  138. .status-item-text {
  139. font-size: 28rpx;
  140. font-weight: 400;
  141. color: #343437;
  142. }
  143. .status-item-highlight {
  144. font-size: 36rpx;
  145. font-weight: 400;
  146. color: #FF530F;
  147. margin-right: 12rpx;
  148. }
  149. }
  150. .status-now {
  151. background-color: #C3E6FF;
  152. }
  153. .status-date {
  154. background-color: #C2CAFF;
  155. }
  156. .status-day {
  157. background-color: #FFD2C0;
  158. }
  159. }
  160. </style>