index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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: 0
  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. res.data.list.forEach(item => {
  76. if (Number(item.overDays) && Number(item.overDays) < 0) {
  77. item.overDays = Math.abs(item.overDays)
  78. }
  79. })
  80. itemList.value = itemList.value.concat(res.data.list)
  81. listTotal.value = res.data.total
  82. if (res.data.total == searchInfo.value.pageNo*searchInfo.value.pageSize-(10 - res.data.list.length)) moreListFlag = false;
  83. }).catch(() => {
  84. loading.value = false
  85. })
  86. }
  87. let itemList = ref([])
  88. let listTotal = ref(0)
  89. function gotoDetail(id, subName) {
  90. uni.navigateTo({
  91. url: `/pages/projectInfo/detail/index?id=${id}&subName=${subName}`
  92. })
  93. }
  94. // 触底加载flag
  95. let moreListFlag = true
  96. onLoad(() => {
  97. getList()
  98. })
  99. onPageScroll((e) => {
  100. scrollTop.value = e.scrollTop
  101. })
  102. onPullDownRefresh(() => {
  103. searchInfo.value.pageNo = 1;
  104. itemList.value = [];
  105. moreListFlag = true;
  106. try {
  107. getList();
  108. } finally {
  109. uni.stopPullDownRefresh()
  110. }
  111. })
  112. onReachBottom(() => {
  113. if (!moreListFlag) {
  114. return uni.showToast({
  115. title: "已经到底了。",
  116. icon: "none",
  117. duration: 2000
  118. })
  119. }
  120. searchInfo.value.pageNo++;
  121. getList();
  122. })
  123. </script>
  124. <style lang="scss" scoped>
  125. .card-status {
  126. display: flex;
  127. justify-content: space-between;
  128. width: 100%;
  129. height: 128rpx;
  130. margin-top: 40rpx;
  131. .card-status-item {
  132. display: flex;
  133. flex-direction: column;
  134. justify-content: space-between;
  135. width: 190rpx;
  136. height: 128rpx;
  137. padding: 16rpx 0 30rpx;
  138. border-radius: 20rpx;
  139. text-align: center;
  140. font-size: 24rpx;
  141. font-weight: 400;
  142. color: #626266;
  143. .status-item-text {
  144. font-size: 28rpx;
  145. font-weight: 400;
  146. color: #343437;
  147. }
  148. .status-item-highlight {
  149. font-size: 36rpx;
  150. font-weight: 400;
  151. color: #FF530F;
  152. margin-right: 12rpx;
  153. }
  154. }
  155. .status-now {
  156. background-color: #C3E6FF;
  157. }
  158. .status-date {
  159. background-color: #C2CAFF;
  160. }
  161. .status-day {
  162. background-color: #FFD2C0;
  163. }
  164. }
  165. </style>