filter.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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: showData.jigouId===index}" @click="radioSelect('jg',item,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: showData.zhiyeId===index}" @click="radioSelect('zy',item,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: showData.levelId===index}" @click="radioSelect('dj',item,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: showData.banzhengId===index}" @click="radioSelect('bzStatus',item,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: showData.kaoshiId===index}" @click="radioSelect('ksStatus',item,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. // 页面显示active
  50. const showData = reactive({
  51. jigouId: '',
  52. zhiyeId: '',
  53. levelId: '',
  54. banzhengId: '',
  55. kaoshiId: '',
  56. })
  57. // 传到父组件
  58. const bzData = reactive({
  59. jigouId: '',
  60. zhiyeId: '',
  61. levelId: '',
  62. banzhengId: '',
  63. kaoshiId: '',
  64. })
  65. const bzJigouList = ref([]);
  66. const zhiyeList = ref([]);
  67. const LevelList = ref([]);
  68. const banzhengList = ref([]);
  69. const kaoshiList = ref([]);
  70. // 打开弹窗
  71. function handleShow() {
  72. filterPopup.value.open();
  73. }
  74. // 取消
  75. function handleClose() {
  76. filterPopup.value.close();
  77. }
  78. // 确认
  79. function confirmBtn(){
  80. $emit('confirm-btn',bzData);
  81. filterPopup.value.close();
  82. }
  83. function initPage(){
  84. getKaozhengJigouList();
  85. getKaozhengZhiyeList();
  86. getKaozhengLevelList();
  87. getKaozhengBanzhengList();
  88. getKaozhengKaoshiList();
  89. }
  90. function getKaozhengJigouList(){
  91. banzhengApi.getKaozhengJigou().then(res => {
  92. bzJigouList.value = res.data;
  93. })
  94. }
  95. function getKaozhengZhiyeList(){
  96. banzhengApi.getKaozhengZhiye().then(res => {
  97. zhiyeList.value = res.data;
  98. })
  99. }
  100. function getKaozhengLevelList(){
  101. banzhengApi.getKaozhengLevel().then(res => {
  102. LevelList.value = res.data;
  103. })
  104. }
  105. function getKaozhengBanzhengList(){
  106. banzhengApi.getKaozhengBanzheng().then(res => {
  107. banzhengList.value = res.data;
  108. })
  109. }
  110. function getKaozhengKaoshiList(){
  111. banzhengApi.getKaozhengKaoshi().then(res => {
  112. kaoshiList.value = res.data;
  113. })
  114. }
  115. function radioSelect(name,item,index){
  116. switch (name) {
  117. case 'jg':
  118. showData.jigouId = index;
  119. bzData.jigouId = item.jgId;
  120. break;
  121. case 'zy':
  122. showData.zhiyeId = index;
  123. bzData.zhiyeId = item.id;
  124. break;
  125. case 'dj':
  126. showData.levelId = index;
  127. bzData.levelId = item.id;
  128. break;
  129. case 'bzStatus':
  130. showData.banzhengId = index;
  131. bzData.banzhengId = item.id;
  132. break;
  133. case 'ksStatus':
  134. showData.kaoshiId = index;
  135. bzData.kaoshiId = item.id;
  136. break;
  137. }
  138. }
  139. function goUpPage(){
  140. filterPopup.value.close();
  141. }
  142. function handleReset(){
  143. bzData.jigouId = '';
  144. bzData.zhiyeId = '';
  145. bzData.levelId = '';
  146. bzData.banzhengId = '';
  147. bzData.kaoshiId = '';
  148. showData.jigouId = '';
  149. showData.zhiyeId = '';
  150. showData.levelId = '';
  151. showData.banzhengId = '';
  152. showData.kaoshiId = '';
  153. }
  154. defineExpose({
  155. handleShow,
  156. initPage,
  157. handleClose
  158. })
  159. </script>
  160. <style>
  161. </style>