index_totalSHlist.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <!-- 页面容器 -->
  3. <view class="container">
  4. <!-- 有数据时显示列表 -->
  5. <view class="list-box" v-for="(item, index) in dataList" :key="index">
  6. <view class="list-item" @click="handleItemClick(item)">
  7. <view class="item-content">
  8. <text class="item-title">{{ item.cbfbm }}</text>
  9. </view>
  10. <view class="item-arrow">{{ item.cbfmc }}</view>
  11. </view>
  12. </view>
  13. <!-- 无数据时显示空状态 -->
  14. <view class="empty" v-if="dataList.length === 0">
  15. 暂无承包方需审核信息
  16. </view>
  17. </view>
  18. </template>
  19. <script setup>
  20. import {
  21. ref
  22. } from 'vue';
  23. import {
  24. getFbfquerCbflist
  25. } from '@/api/cgbList.js';
  26. import {
  27. onLoad
  28. } from '@dcloudio/uni-app';
  29. const typeData = ref(null)
  30. // 响应式数据
  31. const dataList = ref([]);
  32. // 存储上级传参
  33. let groupInfo = {};
  34. /**
  35. * @description 根据类型获取列表数据
  36. * @param {Object} params 请求参数
  37. */
  38. const getListData = async (params) => {
  39. try {
  40. const res = await getFbfquerCbflist(params);
  41. dataList.value = res.data || [];
  42. } catch (err) {
  43. console.error('获取列表失败:', err);
  44. dataList.value = [];
  45. }
  46. };
  47. /**
  48. * @description 列表项点击跳转
  49. */
  50. const handleItemClick = (item) => {
  51. uni.navigateTo({
  52. url: `/pages/investigator/Households/currentDetails?groupInfo=${encodeURIComponent(JSON.stringify(item))}&typedifference=${typeData.value}&type=Auditing`
  53. });
  54. };
  55. onLoad(async (options) => {
  56. typeData.value = options.type;
  57. let requestParams = {};
  58. // 根据类型配置请求参数
  59. if (options.type === 'investigator') {
  60. // 调查员:只传 status=2
  61. requestParams = {
  62. status: 2,
  63. fbfbm: ''
  64. };
  65. } else if (options.type === 'official') {
  66. // 官方:传 status=1 + fbfbm
  67. try {
  68. groupInfo = JSON.parse(decodeURIComponent(options.groupInfo));
  69. requestParams = {
  70. status: 1,
  71. fbfbm: groupInfo.fbfbm || ''
  72. };
  73. } catch (e) {
  74. console.error('参数解析失败:', e);
  75. requestParams = {
  76. status: 1
  77. };
  78. }
  79. }
  80. // 统一调用接口
  81. await getListData(requestParams);
  82. });
  83. </script>
  84. <style scoped lang="scss">
  85. .container {
  86. width: 100vw;
  87. min-height: 100vh;
  88. background-color: #f5f5f5;
  89. padding: 20rpx;
  90. box-sizing: border-box;
  91. }
  92. .list-box {
  93. background-color: #fff;
  94. border-radius: 16rpx;
  95. overflow: hidden;
  96. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
  97. margin-bottom: 20rpx;
  98. }
  99. .list-item {
  100. display: flex;
  101. align-items: center;
  102. padding: 30rpx;
  103. border-bottom: 1rpx solid #f0f0f0;
  104. &:last-child {
  105. border-bottom: none;
  106. }
  107. &:active {
  108. background-color: #f7f7f7;
  109. }
  110. }
  111. .item-content {
  112. flex: 1;
  113. }
  114. .item-title {
  115. font-size: 32rpx;
  116. color: #333;
  117. font-weight: 500;
  118. }
  119. .item-arrow {
  120. font-size: 32rpx;
  121. color: #999;
  122. }
  123. /* 空数据样式 */
  124. .empty {
  125. text-align: center;
  126. padding: 100rpx 0;
  127. font-size: 30rpx;
  128. color: #999;
  129. }
  130. </style>