index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" safe-area-inset-bottom>
  3. <template #top>
  4. <ut-navbar title="GAP基地信息" :fixed="false" border></ut-navbar>
  5. <view class="d-flex a-c pd-25">
  6. <view class="min-w-200 flex1">
  7. <ut-action-sheet v-model="form.res" :tabs="tabs" @change="onRefresh" title="选择审核状态">
  8. <view class="d-flex search-select-item a-c">
  9. <view class="flex1 ov-hd f-s-28 c-333 text-center f-w-5 w-s-no">{{ selectDictLabel(tabs, form.res) || '全部' }}</view>
  10. <up-icon size="24rpx" color="#333" name="arrow-down-fill" class="mr-5"></up-icon>
  11. </view>
  12. </ut-action-sheet>
  13. </view>
  14. <view class="h-86 pl-20 w-100%">
  15. <ut-search ref="searchRef" v-model="form.keyword" @search="onRefresh" margin="0" :border="false" :placeholder="placeholder" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
  16. </view>
  17. </view>
  18. </template>
  19. <template>
  20. <template>
  21. <view class="pl-25 pr-25">
  22. <up-swipe-action>
  23. <up-swipe-action-item v-for="item in list" :name="item?.id" :key="item?.id" :disabled="item?.res !== '2'" :options="optionsAction" @click="clickSwipe" class="mb-20 b-radius">
  24. <view @click.stop="clickItem(item)" class="b-radius bg-#fff pd-20 p-rtv">
  25. <view class="mb-10">
  26. <view class="c-#333 f-s-34 f-w-5 pb-5">{{ item?.gapBaseName }}</view>
  27. <view class="c-#999 f-s-24">{{ item?.ratedDate }}获评</view>
  28. </view>
  29. <view class="d-flex pb-5">
  30. <view class="w-50%">
  31. <text class="c-#666 f-s-28">获评品种:</text>
  32. <text class="c-#333 f-s-28 f-w-5">{{ item?.medicineName || '-' }}</text>
  33. </view>
  34. <view class="w-50%">
  35. <text class="c-#666 f-s-28">基地面积:</text>
  36. <text class="c-#333 f-s-28 f-w-5">{{ item?.area }}{{ item?.areaUnit || '亩' }}</text>
  37. </view>
  38. </view>
  39. <view class="pb-20">
  40. <text class="c-#666 f-s-28">基地地址:</text>
  41. <text class="c-#333 f-s-28 f-w-5">{{ item?.adcodeName }}{{ item?.address }}</text>
  42. </view>
  43. <template v-if="+item?.res == 2">
  44. <view class="h-1 bg-#F7F7F7"></view>
  45. <view class="c-#FC333F pt-20">
  46. <text class="f-s-28">审核不通过原因:</text>
  47. <text class="f-s-28">{{ item?.msg }}</text>
  48. </view>
  49. </template>
  50. <view class="status-tag" :class="{ [`bg-res-${item?.res}`]: true }">{{ selectDictLabel(tabs, item?.res) }}</view>
  51. </view>
  52. </up-swipe-action-item>
  53. </up-swipe-action>
  54. </view>
  55. </template>
  56. <!-- 空数据处理 -->
  57. <template #empty v-if="address">
  58. <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>
  59. <view class="d-flex j-c f-s-28 c-#ccc">如需认定GAP基地,可前往数字云药官网进行申报</view>
  60. <view class="d-flex j-c f-s-28 c-primary pd-15">https://www.shuziyunyao.com/</view>
  61. <up-button type="primary" class="b-radius" style="width: 340rpx" @click="copyText('https://www.shuziyunyao.com/')">复制网址</up-button>
  62. </template>
  63. </template>
  64. <template #empty v-if="!address">
  65. <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>
  66. <view class="d-flex j-c f-s-28 c-#ccc">可点击底部按钮上传佐证材料添加获评信息</view>
  67. </template>
  68. <template #bottom v-if="!address">
  69. <view class="base-bottom-wrap pd-20 pb-0">
  70. <up-button type="primary" @click="$u.route({ url: '/plant/base/gap-base-info-edit/index' })">
  71. <img class="w-38 h-36 mr-10" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/chooseGAP.png" alt="" mode="widthFix" />
  72. <text>添加GAP基地信息</text>
  73. </up-button>
  74. </view>
  75. </template>
  76. </z-paging>
  77. </template>
  78. <script setup lang="ts">
  79. import { copyText } from '@/utils/public';
  80. import { useClientRequest } from '@/utils/request';
  81. import { useInfoStore } from '@/store';
  82. const paging = ref();
  83. const list = ref<any[]>([]);
  84. const placeholder = ref('搜基地名称、品种、基地地址');
  85. const tabs = ref([
  86. { label: '全部', value: '' },
  87. { label: '有效', value: '1' },
  88. { label: '审核未通过', value: '2' },
  89. { label: '待审核', value: '0' },
  90. ]);
  91. // 判断是否是云南的企业
  92. const isYunnanCompany = (): boolean => {
  93. const adcdCode = useInfoStore().companyInfo?.adcdCode;
  94. return adcdCode?.startsWith('53') || false;
  95. };
  96. const address = computed(() => isYunnanCompany());
  97. const form = ref({
  98. keyword: '',
  99. res: '',
  100. });
  101. const query = async (pageNum: number, pageSize: number) => {
  102. const params = {
  103. pageNum,
  104. pageSize,
  105. ...form.value,
  106. };
  107. const res = await useClientRequest.get<any>('/plt-api/app/gapCertificationInfo/pageList', params);
  108. if (!res || res.code !== 200) return;
  109. const { rows } = res;
  110. paging.value.complete(rows);
  111. };
  112. const onRefresh = () => {
  113. paging.value.reload();
  114. };
  115. const optionsAction = reactive([
  116. {
  117. text: '删除',
  118. style: {
  119. backgroundColor: '#f56c6c',
  120. },
  121. },
  122. ]);
  123. const clickSwipe = async (event: object) => {
  124. const { name, index } = event as any;
  125. if (index === 0) {
  126. // 删除
  127. const res = await uni.showModal({
  128. title: '提示',
  129. content: '确定删除该GAP基地信息吗?',
  130. });
  131. console.log(res);
  132. if (res.confirm) {
  133. const delRes = await useClientRequest.get(`/plt-api/app/gapCertificationInfo/delById/${name}`);
  134. if (delRes && delRes.code === 200) {
  135. uni.showToast({ title: '删除成功', icon: 'none' });
  136. onRefresh();
  137. }
  138. }
  139. }
  140. };
  141. const clickItem = (item: any) => {
  142. uni.$u.route({
  143. type: 'navigateTo',
  144. url: '/plant/base/gap-base-info-detail/index',
  145. params: {
  146. id: item?.id,
  147. },
  148. });
  149. };
  150. onMounted(() => {
  151. uni.$on('gapBaseInfoUpdated', () => {
  152. onRefresh();
  153. });
  154. });
  155. </script>
  156. <style lang="scss" scoped>
  157. // @import '@/assets/styles/theme.scss';
  158. .search-select-item {
  159. height: 86rpx;
  160. background-color: #fff;
  161. border-radius: 10rpx;
  162. box-sizing: border-box;
  163. padding: 12rpx;
  164. }
  165. .status-tag {
  166. position: absolute;
  167. top: 0;
  168. right: 0;
  169. padding: 4rpx 24rpx;
  170. font-size: 20rpx;
  171. color: #fff;
  172. border-radius: 0 16rpx 0 20rpx;
  173. }
  174. .u-page {
  175. padding: 0;
  176. }
  177. .u-demo-block__title {
  178. padding: 10px 0 2px 15px;
  179. }
  180. .swipe-action {
  181. &__content {
  182. padding: 25rpx 0;
  183. &__text {
  184. font-size: 15px;
  185. color: $u-main-color;
  186. padding-left: 30rpx;
  187. }
  188. }
  189. }
  190. </style>