filter.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <uni-popup ref="filterPopup" 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. <!-- 报证机构 -->
  11. <view class="filter-body-name">报证机构</view>
  12. <view class="phone-radio-group filter-radio-group">
  13. <view class="phone-radio-item" v-for="(item,index) in bzJigouList" :class="{radioActive: bzData.jigouId===index}" @click="radioSelect('jg',index)">{{item.name}}</view>
  14. </view>
  15. <!-- 职业 -->
  16. <view class="filter-body-name">职业</view>
  17. <view class="phone-radio-group filter-radio-group">
  18. <view class="phone-radio-item" v-for="(item,index) in zhiyeList" :class="{radioActive: bzData.zhiyeId===index}" @click="radioSelect('zy',index)">{{item.name}}</view>
  19. </view>
  20. <!-- 等级 -->
  21. <view class="filter-body-name">等级</view>
  22. <view class="phone-radio-group filter-radio-group">
  23. <view class="phone-radio-item" v-for="(item,index) in LevelList" :class="{radioActive: bzData.levelId===index}" @click="radioSelect('dj',index)">{{item.name}}</view>
  24. </view>
  25. <!-- 办证状态 -->
  26. <view class="filter-body-name">办证状态</view>
  27. <view class="phone-radio-group filter-radio-group">
  28. <view class="phone-radio-item" v-for="(item,index) in banzhengList" :class="{radioActive: bzData.banzhengId===index}" @click="radioSelect('bzStatus',index)">{{item.name}}</view>
  29. </view>
  30. <!-- 考试状态 -->
  31. <view class="filter-body-name">考试状态</view>
  32. <view class="phone-radio-group filter-radio-group">
  33. <view class="phone-radio-item" v-for="(item,index) in kaoshiList" :class="{radioActive: bzData.kaoshiId===index}" @click="radioSelect('ksStatus',index)">{{item.name}}</view>
  34. </view>
  35. </view>
  36. <view class="filter-btn-box">
  37. <button type="default" class="phone-white-btn filter-btn" @click="handleReset">重置</button>
  38. <button type="default" class="phone-green-btn filter-btn" @click="confirmBtn">筛选</button>
  39. </view>
  40. </view>
  41. </uni-popup>
  42. </template>
  43. <script setup>
  44. import {onLoad,onShow} from '@dcloudio/uni-app';
  45. import {ref,reactive} from "vue"
  46. import * as banzhengApi from "@/api/banzheng.js"
  47. const filterPopup = ref(null); // 索引
  48. const $emit = defineEmits(['confirm-btn'])
  49. const bzData = reactive({
  50. jigouId: '',
  51. zhiyeId: '',
  52. levelId: '',
  53. banzhengId: '',
  54. kaoshiId: '',
  55. })
  56. const bzJigouList = ref([]);
  57. const zhiyeList = ref([]);
  58. const LevelList = ref([]);
  59. const banzhengList = ref([]);
  60. const kaoshiList = ref([]);
  61. // 打开弹窗
  62. function handleShow() {
  63. filterPopup.value.open();
  64. }
  65. // 取消
  66. function handleClose() {
  67. filterPopup.value.close();
  68. }
  69. // 确认
  70. function confirmBtn(){
  71. $emit('confirm-btn',bzData);
  72. filterPopup.value.close();
  73. }
  74. function initPage(){
  75. getKaozhengJigouList();
  76. getKaozhengZhiyeList();
  77. getKaozhengLevelList();
  78. getKaozhengBanzhengList();
  79. getKaozhengKaoshiList();
  80. }
  81. function getKaozhengJigouList(){
  82. banzhengApi.getKaozhengJigou().then(res => {
  83. bzJigouList.value = res.data;
  84. })
  85. }
  86. function getKaozhengZhiyeList(){
  87. banzhengApi.getKaozhengZhiye().then(res => {
  88. zhiyeList.value = res.data;
  89. })
  90. }
  91. function getKaozhengLevelList(){
  92. banzhengApi.getKaozhengLevel().then(res => {
  93. LevelList.value = res.data;
  94. })
  95. }
  96. function getKaozhengBanzhengList(){
  97. banzhengApi.getKaozhengBanzheng().then(res => {
  98. banzhengList.value = res.data;
  99. })
  100. }
  101. function getKaozhengKaoshiList(){
  102. banzhengApi.getKaozhengKaoshi().then(res => {
  103. kaoshiList.value = res.data;
  104. })
  105. }
  106. function radioSelect(name,index){
  107. console.log(name,index,'name,index');
  108. switch (name) {
  109. case 'jg':
  110. bzData.jigouId = index
  111. break;
  112. case 'zy':
  113. bzData.zhiyeId = index
  114. break;
  115. case 'dj':
  116. bzData.levelId = index
  117. break;
  118. case 'bzStatus':
  119. bzData.banzhengId = index
  120. break;
  121. case 'ksStatus':
  122. bzData.kaoshiId = index
  123. break;
  124. }
  125. }
  126. function goUpPage(){
  127. filterPopup.value.close();
  128. }
  129. function handleReset(){
  130. bzData.jigouId = '';
  131. bzData.zhiyeId = '';
  132. bzData.levelId = '';
  133. bzData.banzhengId = '';
  134. bzData.kaoshiId = '';
  135. }
  136. defineExpose({
  137. handleShow,
  138. initPage,
  139. handleClose
  140. })
  141. </script>
  142. <style>
  143. </style>