index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <z-paging ref="paging" safe-area-inset-bottom v-model="list" @query="query">
  3. <template #top>
  4. <ut-navbar leftText="请选择GAP基地获评信息" :fixed="false" :breadcrumb="false"></ut-navbar>
  5. <view ref="baseRef" class="pd-24" id="base12345">
  6. <view class="startline-title mb-6">请选择GAP基地获评信息</view>
  7. <view class="f-s-26 c-#999">未通过审核及待审核的GAP获评信息将不会在此展示</view>
  8. </view>
  9. </template>
  10. <view class="base-content pd-20">
  11. <view :class="{ active: item.id === checkedId }" v-for="(item, index) in list" :key="item.id" @click="clickItem(item)" class="b-radius bg-#fff pd-20 p-rtv select-item-card mb-20">
  12. <view class="c-#333 f-s-34 f-w-5 pb-5">{{ item?.gapBaseName }}</view>
  13. <view class="c-#999 f-s-24 pb-20">{{ item?.ratedDate }}获评</view>
  14. <view class="d-flex pb-5">
  15. <view class="w-50%">
  16. <text class="c-#666 f-s-28">获评品种:</text>
  17. <text class="c-#333 f-s-28 f-w-5">{{ item?.medicineName || '-' }}</text>
  18. </view>
  19. <view class="w-50%">
  20. <text class="c-#666 f-s-28">基地面积:</text>
  21. <text class="c-#333 f-s-28 f-w-5">{{ item?.area }}{{ item?.areaUnit || '亩' }}</text>
  22. </view>
  23. </view>
  24. <view class="pb-20">
  25. <text class="c-#666 f-s-28">基地地址:</text>
  26. <text class="c-#333 f-s-28 f-w-5">{{ item?.adcdName || '' }}{{ item?.address || '' }}</text>
  27. </view>
  28. <view v-if="+item?.res == 2" class="pl-5 pr-5 pt-20 pb-20 border-top-#f7f7f7 c-#FC333F">
  29. <text class="f-s-28">审核不通过原因:</text>
  30. <text class="f-s-28">{{ item?.msg }}</text>
  31. </view>
  32. <image v-if="+item?.res == 2" class="w-145" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/resFailed.png" style="position: absolute; top: 0; right: 0" mode="widthFix" />
  33. <image v-if="+item?.res == 0" class="w-100" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/resPendingReview.png" style="position: absolute; top: 0; right: 0" mode="widthFix" />
  34. <image v-if="+item?.res == 1" class="w-90" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/resEffective.png" style="position: absolute; top: 0; right: 0" mode="widthFix" />
  35. <image v-if="item.id === checkedId" class="w-40 h-40 checked-icon" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-lm/price/checked1.png" mode="widthFix" />
  36. </view>
  37. </view>
  38. <template #empty>
  39. <ut-empty class="mg-at" size="28rpx" color="#999" padding="10rpx" image="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/noEmptyBase.png">暂无获评GAP基地信息~</ut-empty>
  40. <view class="f-s-28 c-#ccc w-600 text-center">如已获评GAP信息,请前往<span class="c-primary">基地-GAP基地获评信息</span>添加后再来选择若未获评GAP基地,可前往各地官方渠道进行GAP基地申报</view>
  41. </template>
  42. <template #bottom>
  43. <view class="pd-20 d-flex">
  44. <up-button type="primary" @click="confirmSelect">确认选择</up-button>
  45. </view>
  46. </template>
  47. </z-paging>
  48. </template>
  49. <script setup lang="ts">
  50. import { useClientRequest } from '@/utils/request';
  51. const paging = ref<any>(null);
  52. const list = ref<any[]>([]);
  53. const form = ref({
  54. keyword: '',
  55. res: '1',
  56. gapBaseType: '',
  57. });
  58. const query = async (pageNum: number, pageSize: number) => {
  59. const res = await useClientRequest.get('/plt-api/app/gapCertificationInfo/pageList', {
  60. ...form.value,
  61. pageNum: pageNum,
  62. pageSize,
  63. });
  64. if (res.code == 200) {
  65. paging.value.complete(res.rows || []);
  66. }
  67. };
  68. const checkedId = ref(null);
  69. const clickItem = (item: any) => {
  70. checkedId.value = item.id;
  71. };
  72. // 确认选择
  73. const confirmSelect = () => {
  74. const selectedItem = list.value.find((item) => item.id === checkedId.value);
  75. if (selectedItem) {
  76. uni.$emit('selectGapInfo', selectedItem);
  77. uni.navigateBack();
  78. } else {
  79. uni.showToast({
  80. title: '请选择一项GAP基地获评信息',
  81. icon: 'none',
  82. });
  83. }
  84. };
  85. const onRefresh = () => {
  86. try {
  87. paging.value?.reload();
  88. } catch (e) {
  89. console.error('Error refreshing address list:', e);
  90. }
  91. };
  92. onLoad((options: any) => {
  93. form.value.res = options?.res || '1';
  94. form.value.gapBaseType = options?.baseType || '';
  95. });
  96. onUnload(() => {
  97. uni.$off('selectGapInfo');
  98. });
  99. </script>
  100. <style lang="scss" scoped>
  101. .select-item-card {
  102. border: 1rpx solid #fff;
  103. border-radius: 16rpx;
  104. overflow: hidden;
  105. .checked-icon {
  106. position: absolute;
  107. right: 0;
  108. bottom: 0;
  109. }
  110. &.active {
  111. border-color: $u-primary;
  112. background-color: #ebf6ee;
  113. }
  114. }
  115. </style>