kechengLeixing.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <uni-popup ref="popupKechengLeixingRef" type="top" :animation="false" :is-mask-click="false"
  3. mask-background-color="rgba(0, 0, 0, 0.4)">
  4. <view class="phone-filter-page">
  5. <view class="icon-title-navBar-box">
  6. <view @click="goUpPage" class="nav-bar-icon"></view>
  7. <text class="nav-bar-title">筛选</text>
  8. </view>
  9. <view class="filter-body-box">
  10. <radio-group @change="handleChange">
  11. <!-- 报证机构 -->
  12. <view class="filter-body-radio" v-for="item in data.list">
  13. <label class="radio-name-box"
  14. :class="{radioActive: activeSelect && activeSelect.id==item.id}">
  15. <radio :value="`${item.id}`" :checked="item.checked" activeBackgroundColor="#3fd2a1" style="transform:scale(0.8)"/>
  16. {{item.lable}}
  17. </label>
  18. <view class="phone-radio-group filter-radio-group">
  19. <view class="phone-radio-item" v-for="citem in item.children"
  20. :class="{radioActive: activeSelect && activeSelect.id == citem.id}"
  21. @click.stop="handleSelect(citem,item)">
  22. {{citem.lable}}
  23. </view>
  24. </view>
  25. </view>
  26. </radio-group>
  27. </view>
  28. <view class="filter-btn-box">
  29. <button type="default" class="phone-white-btn filter-btn" @click="handleReset">重置</button>
  30. <button type="default" class="phone-green-btn filter-btn" @click="handleConfirm">筛选</button>
  31. </view>
  32. </view>
  33. </uni-popup>
  34. </template>
  35. <script setup>
  36. import {
  37. reactive,
  38. ref
  39. } from "vue";
  40. const emits = defineEmits(['select', 'reset']);
  41. const data = reactive({
  42. list: []
  43. })
  44. const activeSelect = ref(null);
  45. const popupKechengLeixingRef = ref(null);
  46. function goUpPage() {
  47. popupKechengLeixingRef.value.close();
  48. }
  49. function handleConfirm() {
  50. emits('select', activeSelect.value)
  51. popupKechengLeixingRef.value.close();
  52. }
  53. function handleReset() {
  54. activeSelect.value = null;
  55. emits('reset')
  56. }
  57. function handleChange(myData) {
  58. const activeD = myData.detail.value;
  59. data.list.forEach(item => {
  60. if (item.id != activeD) {
  61. item.checked = false
  62. } else {
  63. item.checked = true;
  64. activeSelect.value = item;
  65. }
  66. })
  67. }
  68. function handleSelect(myData) {
  69. data.list.forEach(item => {
  70. item.checked = false
  71. })
  72. activeSelect.value = myData;
  73. }
  74. function showPopup({
  75. data: myData
  76. }) {
  77. data.list = myData;
  78. popupKechengLeixingRef.value.open('top')
  79. }
  80. defineExpose({
  81. showPopup
  82. })
  83. </script>
  84. <style lang="scss">
  85. .active {
  86. color: red
  87. }
  88. </style>