index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <z-paging ref="paging" v-model="list" bgColor="#fff" @query="query" :auto="false" safe-area-inset-bottom>
  3. <template #top>
  4. <view class="">
  5. <up-navbar title="选择动植物名称" @leftClick="navigateBackOrHome()" :fixed="false"></up-navbar>
  6. <view class="pd-24">
  7. <ut-search ref="searchRef" v-model="form.keyword" @search="changeSeach" @change="changeSeach" margin="0" :border="false" placeholder="可输入药材名称或动植物基原名称搜索" bgColor="#f7f7f7" height="86rpx" borderRadius="16rpx"></ut-search>
  8. </view>
  9. </view>
  10. </template>
  11. <view class="pd-24" v-if="!showSearch">
  12. <template>
  13. <view class="f-s-32 c-#333 f-w-5 mb-20">主营品种</view>
  14. <view class="d-flex a-c f-w-w">
  15. <spe-lable class="mr-20 mb-20" v-for="(item, index) in speArray" :key="index" :text="item?.medicineName" size="30rpx" :id="item?.id" @click="changeSpe(item?.medicineName)" />
  16. </view>
  17. </template>
  18. <template>
  19. <ut-empty></ut-empty>
  20. <view class="d-flex flex-cln j-c a-c">
  21. <view class="c-#ccc f-s-28">可请前往<text class="c-primary">基地-主营品种配置</text>页面进行</view>
  22. <view class="c-#ccc f-s-28">主营品种配置,配置后即可快捷选择</view>
  23. </view>
  24. </template>
  25. </view>
  26. <view class="pd-24" v-if="showSearch">
  27. <view class="f-s-32 c-#333 f-w-5 mb-20">搜索结果</view>
  28. <view class="pd-30 d-flex bg-#FBFDFB border-#37A954 b-radius mb-20" v-for="(item, index) in list" :key="index">
  29. <up-radio-group v-model="radiovalue1">
  30. <view class="">
  31. <view class="mb-20">
  32. <text class="c-#333 f-s-34 f-w-5 mr-5">{{ item?.varietyName }}</text>
  33. <text class="c-#666 f-s-24">{{ item?.latinName }}</text>
  34. </view>
  35. <view class="mb-20">
  36. <text class="c-#333 f-s-28 f-w-5 mr-5">{{ item?.genusName }}</text>
  37. <text class="c-#666 f-s-24">{{ item?.genusLatinName }}</text>
  38. </view>
  39. <view class="">
  40. <text class="c-#666 f-s-24">产出:</text>
  41. <text class="c-#666 f-s-24">{{ item?.medicineName }}</text>
  42. </view>
  43. </view>
  44. <view class="flex1"></view>
  45. <view class="d-flex j-c a-c">
  46. <up-radio activeColor="#37A954" label="" :name="item?.id"></up-radio>
  47. </view>
  48. </up-radio-group>
  49. </view>
  50. </view>
  51. <template #bottom v-if="showSearch">
  52. <view class="pd-24 d-flex j-c gap-20 base-bottom-wrap">
  53. <up-button type="primary" @click="navigateBackOrHome()">取消</up-button>
  54. <up-button type="primary" @click="save()">完成</up-button>
  55. </view>
  56. </template>
  57. </z-paging>
  58. </template>
  59. <script setup lang="ts">
  60. import { useClientRequest } from '@/utils/request';
  61. import SpeLable from './models/speLable.vue';
  62. const paging = ref();
  63. const list = ref<any[]>([]);
  64. const form = ref({
  65. keyword: '',
  66. });
  67. const speArray = ref<any[]>([]);
  68. const showSearch = ref(false);
  69. const query = async (pageNo: number, pageSize: number) => {
  70. const params = {
  71. pageNo,
  72. pageSize,
  73. ...form.value,
  74. };
  75. const res = await useClientRequest.get('/plt-api/app/cpyVariety/pageList', params);
  76. const { rows } = res;
  77. paging.value.complete(rows);
  78. };
  79. const changeSeach = () => {
  80. if (!form.value?.keyword) {
  81. showSearch.value = false;
  82. } else {
  83. showSearch.value = true;
  84. }
  85. paging.value.reload();
  86. };
  87. const changeSpe = (data: string) => {
  88. form.value.keyword = data;
  89. changeSeach();
  90. };
  91. const getSpecies = async () => {
  92. const res = await useClientRequest.get('/plt-api/app/cpyVariety/list');
  93. if (res.code === 200) {
  94. speArray.value = res.data;
  95. }
  96. };
  97. const radiovalue1 = ref('苹果');
  98. const save = () => {
  99. const res = list.value.find((item) => item.id === radiovalue1.value);
  100. console.log(res);
  101. uni.$emit('updateBiologicalname', { msg: res });
  102. uni.navigateBack({ delta: 1 });
  103. };
  104. onMounted(() => {
  105. getSpecies();
  106. });
  107. </script>