index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <!-- 屏蔽企业 -->
  2. <template>
  3. <view>
  4. <!-- 搜索条 -->
  5. <view class="white-bgc stick ss-p-t-10">
  6. <view style="position: relative;">
  7. <uni-search-bar
  8. v-model="name"
  9. placeholder="请输入公司关键字"
  10. cancelButton="none"
  11. :focus="false"
  12. bgColor="#fff"
  13. @confirm="getEntList($event.value)"
  14. @clear="query.content = ''"
  15. >
  16. </uni-search-bar>
  17. <button class="search-btn" @click.stop="getEntList" :loading="loading">搜索</button>
  18. </view>
  19. </view>
  20. <uni-popup ref="popup" type="bottom" background-color="#fff">
  21. <uni-card v-for="item in entList" :key="item.id" :is-shadow="true" :border='false' shadow="0px 0px 3px 1px rgba(0,0,0,0.1)">
  22. <view class="d-flex align-center">
  23. 123
  24. </view>
  25. </uni-card>
  26. </uni-popup>
  27. </view>
  28. </template>
  29. <script setup>
  30. import { ref } from 'vue'
  31. import {
  32. getBlockEnterpriseList,
  33. // handleBlockEnterprise,
  34. // handleUnBlockEnterprise,
  35. } from '@/api/vip'
  36. const popup = ref()
  37. const loading = ref(false)
  38. const name = ref('')
  39. const entList = ref([])
  40. // 获取企业列表
  41. const getEntList = async (name) => {
  42. // if (name) name.value = name
  43. // if (!name) {
  44. // uni.showToast({
  45. // title: '请输入公司关键字',
  46. // icon: 'none'
  47. // })
  48. // return
  49. // }
  50. try {
  51. loading.value = true
  52. const res = await getBlockEnterpriseList()
  53. entList.value = res?.data?.list || []
  54. popup.value.open()
  55. } catch (error) {
  56. uni.showToast({
  57. title: '搜索失败',
  58. icon: 'none'
  59. })
  60. loading.value = false
  61. }
  62. }
  63. const dataList = ref([])
  64. const getData = async () => {
  65. try {
  66. const res = await getBlockEnterpriseList()
  67. dataList.value = res?.data?.list || []
  68. popup.value.open()
  69. } catch (error) {
  70. uni.showToast({
  71. title: '查询数据失败,请重试',
  72. icon: 'none'
  73. })
  74. }
  75. }
  76. getData()
  77. </script>
  78. <style lang="scss" scoped>
  79. .stick {
  80. z-index: 1;
  81. position: sticky;
  82. top: 0;
  83. }
  84. .search-btn {
  85. position: absolute;
  86. right: 11px;
  87. top: 10px;
  88. width: 110px;
  89. height: 40px;
  90. font-size: 16px;
  91. background-color: #00897B;
  92. color: #fff;
  93. border-radius: 0 5px 5px 0;
  94. z-index: 9;
  95. }
  96. :deep(.uni-searchbar__box) {
  97. width: calc(100% - 105px);
  98. height: 40px !important;
  99. border: 1px solid #00897B;
  100. padding-right: 20px;
  101. flex: none;
  102. }
  103. </style>