index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <!-- 总发包方 -->
  2. <template>
  3. <!-- 页面容器 -->
  4. <view class="page-container">
  5. <!-- 总计数据行 -->
  6. <view class="total-row">
  7. <text class="total-text">共计 {{ totalCount }} 条</text>
  8. </view>
  9. <!-- 村民小组列表 -->
  10. <view class="group-list">
  11. <view class="group-item" v-for="(item, index) in groupList" :key="index" @click="pageClick(item)">
  12. <!-- 小组名称 + 状态标签 -->
  13. <view class="group-header">
  14. <text class="group-name">{{ item.fbfmc }}</text>
  15. <text class="status-tag" :class="getStatusClass(item.status)">
  16. {{ item.status }}
  17. </text>
  18. </view>
  19. <!-- 数据统计行 -->
  20. <view class="data-row">
  21. <!-- 总户数 -->
  22. <view class="data-item">
  23. <text class="data-value">{{ item.total }}</text>
  24. <text class="data-label">总户数</text>
  25. </view>
  26. <!-- 未上报(红色高亮) -->
  27. <view class="data-item unreported">
  28. <text class="data-value">{{ item.unreported }}</text>
  29. <text class="data-label">未上报</text>
  30. </view>
  31. <!-- 已上报 -->
  32. <view class="data-item">
  33. <text class="data-value">{{ item.reported }}</text>
  34. <text class="data-label">已上报</text>
  35. </view>
  36. <!-- 已完成 -->
  37. <view class="data-item">
  38. <text class="data-value">{{ item.completed }}</text>
  39. <text class="data-label">已完成</text>
  40. </view>
  41. <!-- 箭头图标 -->
  42. <view class="arrow-icon">
  43. <uni-icons type="right" size="16"></uni-icons>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script setup>
  51. import {
  52. ref,
  53. computed
  54. } from 'vue';
  55. // 从 uni-app 中导入页面生命周期钩子
  56. import { onLoad } from '@dcloudio/uni-app';
  57. import { getTotalLauncher } from '@/api/employer.js';
  58. const groupInfo = ref({});
  59. // 导入后即可正常使用 onLoad
  60. onLoad((options) => {
  61. // 解码 + 解析JSON
  62. groupInfo.value = JSON.parse(decodeURIComponent(options.groupInfo));
  63. uni.setNavigationBarTitle({
  64. title: groupInfo.value.name
  65. });
  66. });
  67. // 模拟数据(与截图一致)
  68. const groupList = ref([]);
  69. // 计算总计数量(列表长度)
  70. const totalCount = computed(() => groupList.value.length);
  71. //暂时获取所有发包方统计数
  72. //暂时获取所有发包方的total
  73. async function getTotal() {
  74. try {
  75. // 传入参数
  76. const res = await getTotalLauncher({
  77. fbfbm:'',
  78. fbfmc:'',
  79. pageNum: '1',
  80. pageSize:'10'
  81. });
  82. console.log(res)
  83. groupList.value = res.data.records;
  84. } catch (err) {
  85. console.error('获取失败:', err);
  86. }
  87. }
  88. // 状态对应的样式类
  89. const getStatusClass = computed(() => (status) => {
  90. switch (status) {
  91. case '摸底中':
  92. return 'status-blue';
  93. case '未开始':
  94. return 'status-gray';
  95. default:
  96. return 'status-blue';
  97. }
  98. });
  99. // 图标点击处理
  100. const pageClick = (value) => {
  101. uni.navigateTo({
  102. url: `/pages/investigator/employerModule/twoRoundExtension?groupInfo=${encodeURIComponent(JSON.stringify(value))}`
  103. })
  104. }
  105. getTotal()
  106. </script>
  107. <style scoped lang="scss">
  108. .page-container {
  109. background-color: #f5f5f5;
  110. min-height: 100vh;
  111. // 导航栏
  112. .nav-bar {
  113. height: 88rpx;
  114. line-height: 88rpx;
  115. background-color: #fff;
  116. text-align: center;
  117. border-bottom: 1rpx solid #eee;
  118. padding: 0 24rpx;
  119. font-size: 32rpx;
  120. font-weight: 500;
  121. }
  122. // 总计行
  123. .total-row {
  124. background-color: #fff;
  125. padding: 16rpx 24rpx;
  126. font-size: 28rpx;
  127. color: #666;
  128. border-bottom: 1rpx solid #f5f5f5;
  129. }
  130. // 列表容器
  131. .group-list {
  132. padding: 20rpx 24rpx 0;
  133. }
  134. // 列表项
  135. .group-item {
  136. background-color: #fff;
  137. border-radius: 16rpx;
  138. padding: 24rpx;
  139. margin-bottom: 20rpx;
  140. // 小组名称+状态
  141. .group-header {
  142. display: flex;
  143. justify-content: space-between;
  144. align-items: center;
  145. margin-bottom: 24rpx;
  146. .group-name {
  147. font-size: 30rpx;
  148. font-weight: 500;
  149. color: #333;
  150. line-height: 40rpx;
  151. }
  152. // 状态标签基础样式
  153. .status-tag {
  154. font-size: 24rpx;
  155. padding: 4rpx 16rpx;
  156. border-radius: 12rpx;
  157. font-weight: 400;
  158. }
  159. // 摸底中(蓝色)
  160. .status-blue {
  161. color: #409eff;
  162. background-color: #ecf5ff;
  163. }
  164. // 未开始(灰色)
  165. .status-gray {
  166. color: #909399;
  167. background-color: #f5f5f5;
  168. }
  169. }
  170. // 数据行
  171. .data-row {
  172. display: flex;
  173. justify-content: space-between;
  174. align-items: center;
  175. // 数据项
  176. .data-item {
  177. text-align: center;
  178. flex: 1;
  179. .data-value {
  180. font-size: 32rpx;
  181. font-weight: 500;
  182. color: #333;
  183. display: block;
  184. }
  185. .data-label {
  186. font-size: 24rpx;
  187. color: #999;
  188. margin-top: 8rpx;
  189. }
  190. // 未上报(红色高亮)
  191. &.unreported {
  192. .data-value {
  193. color: #f56c6c;
  194. }
  195. .data-label {
  196. color: #f56c6c;
  197. }
  198. background-color: #fff2f2;
  199. border-radius: 8rpx;
  200. padding: 8rpx 0;
  201. margin: 0 4rpx;
  202. }
  203. }
  204. // 箭头图标
  205. .arrow-icon {
  206. color: #999;
  207. margin-left: 12rpx;
  208. }
  209. }
  210. }
  211. }
  212. </style>