user-auth.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <view>
  3. <!-- 筛选标签条 -->
  4. <view class="cu-bar bg-white flex" style="padding: 0 10rpx;z-index: 100;width: 100%;position: fixed;top: -2rpx;">
  5. <view class="u-line-1" @click="showDown(index)" v-for="(item,index) in filterMenu" :key="index" style="width: 25%;text-align: center;height: 100%;">
  6. <text v-text="data[index]==''?item:data[index]" :class="data[index]==''?'':'text-red'"></text>
  7. <u-icon v-if="index!=4" name="arrow-down-fill" size="20" style="padding-left: 10rpx;"></u-icon>
  8. <text class="cuIcon-filter padding-left-10" v-else></text>
  9. <u-badge :offset="[10, 8]" v-if="index==4" size="mini" type="error" :count="filterCount"></u-badge>
  10. </view>
  11. </view>
  12. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  13. <view style="margin-top: 110rpx;">
  14. <card @pass="pass" @fail="fail" @delItem="delItem" :list="list"></card>
  15. </view>
  16. </mescroll-body>
  17. <!-- 小区 -->
  18. <u-popup border-radius="60" height="60%" mode="bottom" v-model="residentailShow">
  19. <view class="fixed cu-bar search bg-white">
  20. <view class="search-form round">
  21. <text class="cuIcon-search"></text>
  22. <u-input style="width: 90%;" v-model="residentailKeyWord" type="text" :adjust-position="false" placeholder="请输入关键字搜索" confirm-type="search"/>
  23. </view>
  24. </view>
  25. <scroll-view v-if="!$isEmpty(residentailList)" style="padding-top: 110rpx;height: 100%;" :scroll-y="true" >
  26. <view @click="residentailConfirm(item)" hover-class="hoverClass" class="text-center padding-30 solid-bottom" v-for="(item,index) in residentailList" :key="index">
  27. <text>{{item.label}}</text>
  28. </view>
  29. <u-divider v-if="residentailList.length>=10" height="80">只显示十条数据</u-divider>
  30. </scroll-view>
  31. <u-empty v-else name="search"></u-empty>
  32. </u-popup>
  33. <!-- 楼栋 -->
  34. <u-popup border-radius="60" height="60%" mode="bottom" v-model="buildingShow">
  35. <view class="fixed cu-bar search bg-white">
  36. <view class="search-form round">
  37. <text class="cuIcon-search"></text>
  38. <u-input style="width: 90%;" v-model="buildingKeyWord" type="text" :adjust-position="false" placeholder="请输入关键字搜索" confirm-type="search"/>
  39. </view>
  40. </view>
  41. <scroll-view v-if="!$isEmpty(buildingList)" style="padding-top: 110rpx;height: 100%;" :scroll-y="true" >
  42. <view @click="buildingConfirm(item)" hover-class="hoverClass" class="text-center padding-30 solid-bottom" v-for="(item,index) in buildingList" :key="index">
  43. <text>{{item.name}}</text>
  44. </view>
  45. <u-divider v-if="buildingList.length>=10" height="80">只显示十条数据</u-divider>
  46. </scroll-view>
  47. <u-empty v-else name="search"></u-empty>
  48. </u-popup>
  49. <!-- 单元选择器 -->
  50. <u-picker @confirm="unitConfirm" range-key="name" :range="unitList" v-model="unitShow" mode="selector"></u-picker>
  51. <!-- 人脸状态 -->
  52. <u-picker @confirm="checkStatusConfirm" range-key="name" :range="checkStatusList" v-model="checkStatusShow" mode="selector"></u-picker>
  53. <!-- 筛选 -->
  54. <u-modal :show-cancel-button="true" cancel-text="重置" @cancel="reset" @confirm="mescroll.resetUpScroll()" title="筛选" :mask-close-able="true" v-model="filterShow" >
  55. <view class="slot-content" style="margin: 20rpx;">
  56. <u-form label-width="150" :model="params" ref="uForm">
  57. <u-form-item label="姓名"><u-input v-model="params.name" /></u-form-item>
  58. <u-form-item :border-bottom="false" label="联系方式"><u-input type="number" v-model="params.tel" /></u-form-item>
  59. </u-form>
  60. </view>
  61. </u-modal>
  62. <u-modal :show-cancel-button="true" @confirm="submitAudit" title="审核意见" :mask-close-able="true" v-model="auditShow" >
  63. <view class="slot-content" style="margin: 20rpx;">
  64. <u-form label-width="150" ref="uForm">
  65. <u-form-item :border-bottom="false"><u-input height="150" placeholder="请输入审核意见" v-model="auditParams.checkOpinion" /></u-form-item>
  66. </u-form>
  67. </view>
  68. </u-modal>
  69. <!-- 通知alert -->
  70. <u-toast ref="uToast" />
  71. </view>
  72. </template>
  73. <script>
  74. import card from "./comps/card.vue"
  75. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  76. let that;
  77. export default {
  78. components:{
  79. card
  80. },
  81. mixins:[MescrollMixin],
  82. data() {
  83. return {
  84. //顶部菜单栏
  85. filterMenu: ["小区","楼栋","单元","审核状态","筛选"],
  86. data:['','','','',''],
  87. //小区
  88. residentailShow:false,
  89. residentailList:[],
  90. residentailKeyWord:'',
  91. //楼栋
  92. buildingShow:false,
  93. buildingList:[],
  94. buildingKeyWord:'',
  95. //单元
  96. unitShow:false,
  97. unitList:[],
  98. //人脸状态
  99. checkStatusShow:false,
  100. checkStatusList:[
  101. {
  102. 'name':'待审核',
  103. 'value':'0'
  104. },
  105. {
  106. 'name':'审核通过',
  107. 'value':'1'
  108. },
  109. {
  110. 'name':'审核未通过',
  111. 'value':'2'
  112. },
  113. {
  114. 'name':'待上传',
  115. 'value':'-1'
  116. },
  117. ],
  118. //筛选框
  119. filterShow:false,
  120. filterCount:0,
  121. //审核不通过的意见
  122. auditShow:false,
  123. auditParams:{},
  124. params:{},
  125. list: [],
  126. downOption: {
  127. use: true,
  128. auto: false
  129. },
  130. upOption: {
  131. page: {
  132. page: 0,
  133. size: 10
  134. },
  135. noMoreSize: 5,
  136. empty: {
  137. tip: '暂无相关数据'
  138. }
  139. },
  140. }
  141. },
  142. onLoad(){
  143. that=this
  144. this.getResidentailList()
  145. },
  146. onShow() {
  147. if (this.canReset) {
  148. this.mescroll.resetUpScroll()
  149. }
  150. this.canReset=true
  151. },
  152. watch:{
  153. residentailKeyWord(){
  154. let that=this
  155. //节流函数
  156. if (this.timer){
  157. clearTimeout(this.timer)//阻止setTimeout函数的执行
  158. }
  159. this.timer = setTimeout(() => {
  160. that.residentailList=[]
  161. this.getResidentailList()
  162. }, 500)
  163. },
  164. buildingKeyWord(){
  165. let that=this
  166. //节流函数
  167. if (this.timer){
  168. clearTimeout(this.timer)//阻止setTimeout函数的执行
  169. }
  170. this.timer = setTimeout(() => {
  171. that.buildingList=[]
  172. that.fetchBuildingList()
  173. }, 500)
  174. },
  175. },
  176. methods: {
  177. //审核通过
  178. pass(params){
  179. this.$dialog.showModal('确定审核通过该住户?').then(res=>{
  180. this.$api.userAuth.updateCheckState(params).then(res=>{
  181. if (res.code==200) {
  182. this.$u.toast('操作成功')
  183. this.mescroll.resetUpScroll()
  184. }else{
  185. this.$u.toast('操作失败')
  186. }
  187. })
  188. })
  189. },
  190. //审核不通过,显示审核意见框
  191. fail(params){
  192. this.auditParams=params
  193. this.auditShow=true
  194. },
  195. //执行审核不通过
  196. submitAudit(){
  197. if (this.$isEmpty(this.auditParams.checkOpinion)) {
  198. this.$u.toast('请输入审核意见')
  199. return
  200. }
  201. this.$api.userAuth.updateCheckState(this.auditParams).then(res=>{
  202. if (res.code==200) {
  203. this.$u.toast('操作成功')
  204. this.mescroll.resetUpScroll()
  205. }else{
  206. this.$u.toast('操作失败')
  207. }
  208. })
  209. },
  210. /* 小区 */
  211. //获取小区列表
  212. getResidentailList(){
  213. let params={
  214. // isSelect:true,
  215. name: that.residentailKeyWord,
  216. }
  217. let list = [];
  218. this.$api.residential.page(params).then(res=>{
  219. let list=[]
  220. res.data.records.forEach(item=>{
  221. let obj={
  222. label:item.name,
  223. value:item.id
  224. }
  225. list.push(obj)
  226. })
  227. this.residentailList = list;
  228. })
  229. },
  230. //点击选择小区,获取楼栋列表
  231. residentailConfirm(res){
  232. this.params.residentialId =res.value
  233. this.data[0] = res.label
  234. this.residentailShow = false
  235. //获取楼栋列表
  236. this.fetchBuildingList()
  237. this.mescroll.resetUpScroll()
  238. },
  239. /* 楼栋 */
  240. //获取楼栋列表
  241. fetchBuildingList(){
  242. let params={
  243. residentialId:this.params.residentialId,
  244. name:that.buildingKeyWord
  245. }
  246. this.$api.building.page(params).then(res=>{
  247. this.buildingList=res.data.records
  248. })
  249. },
  250. //点击选择楼栋,获取单元列表
  251. buildingConfirm(res){
  252. console.log(res);
  253. this.params.buildingId=res.id
  254. this.data[1] = res.name
  255. this.buildingShow = false
  256. this.getUnitByResidentialId()
  257. this.mescroll.resetUpScroll()
  258. },
  259. /* 单元 */
  260. //获取单元列表
  261. getUnitByResidentialId(){
  262. let params={
  263. residentialId:this.params.residentialId,
  264. buildingId:this.params.buildingId
  265. }
  266. this.$api.unit.page(params).then(res=>{
  267. this.unitList=res.data.records
  268. })
  269. },
  270. //点击选择单元
  271. unitConfirm(index){
  272. this.data[2]=this.unitList[index].name
  273. this.params.unitId=this.unitList[index].id
  274. this.mescroll.resetUpScroll()
  275. },
  276. /* 审核状态 */
  277. checkStatusConfirm(e){
  278. this.data[3]=this.checkStatusList[e].name
  279. this.params.checkState=this.checkStatusList[e].value
  280. this.mescroll.resetUpScroll()
  281. },
  282. /* 筛选 */
  283. //重置
  284. reset(){
  285. this.params={}
  286. this.data=['','','','','']
  287. this.residentailList=[]
  288. this.buildingList=[]
  289. this.unitList=[]
  290. this.residentailKeyWord=''
  291. this.buildingKeyWord='',
  292. this.list=[],
  293. this.getResidentailList()
  294. this.mescroll.resetUpScroll()
  295. },
  296. //获取筛选的条件数
  297. getFilterCount(){
  298. let n=0
  299. if (!this.$isEmpty(this.params.residentialId)) {
  300. //小区
  301. n++
  302. }
  303. if (!this.$isEmpty(this.params.buildingId)) {
  304. //楼栋
  305. n++
  306. }
  307. if (!this.$isEmpty(this.params.unitId)) {
  308. //单元
  309. n++
  310. }
  311. if (!this.$isEmpty(this.params.checkState)) {
  312. //审核状态
  313. n++
  314. }
  315. if (!this.$isEmpty(this.params.name)) {
  316. //姓名
  317. n++
  318. }
  319. if (!this.$isEmpty(this.params.tel)) {
  320. //手机号
  321. n++
  322. }
  323. this.filterCount=n
  324. },
  325. /**
  326. * 下拉回调
  327. */
  328. downCallback(){
  329. setTimeout(()=>{
  330. this.mescroll.resetUpScroll()
  331. },1500)
  332. },
  333. /**
  334. * 上拉回调
  335. * @param {Object} mescroll
  336. */
  337. upCallback(mescroll) {
  338. let params=this.params
  339. params.current=mescroll.num
  340. params.size=mescroll.size
  341. this.getFilterCount()
  342. try{
  343. this.$api.userAuth.page(params).then(res=>{
  344. let data=res.data.records
  345. let length=data.length
  346. let total=res.data.total
  347. mescroll.endBySize(length, total);
  348. if(mescroll.num == 1) this.list = [];
  349. this.list=this.list.concat(data);
  350. })
  351. }catch(e){
  352. mescroll.endErr();
  353. }
  354. },
  355. /**
  356. * 顶部菜单选择
  357. * @param {Object} index 菜单下标
  358. */
  359. showDown(index){
  360. if (index==0) {
  361. //小区
  362. this.residentailShow=true
  363. }else if (index==1) {
  364. //楼栋
  365. if (this.$isEmpty(this.params.residentialId)) {
  366. this.$u.toast('请选择小区')
  367. }else{
  368. this.buildingShow=true
  369. }
  370. return
  371. }else if (index==2) {
  372. //单元
  373. if (this.$isEmpty(this.params.buildingId)) {
  374. this.$u.toast('请选择楼栋')
  375. }else{
  376. this.unitShow=true
  377. }
  378. return
  379. }else if (index==3) {
  380. //审核状态
  381. this.checkStatusShow=true
  382. }else if (index==4) {
  383. //筛选
  384. this.filterShow=true
  385. }
  386. },
  387. delItem(item){
  388. this.$dialog.showModal('确定要删除此项吗?').then(res=>{
  389. this.$api,room.del({id:item.id}).then(res=>{
  390. if (res.data) {
  391. this.$showToast('删除成功')
  392. that.mescroll.resetUpScroll()
  393. }
  394. })
  395. })
  396. }
  397. }
  398. }
  399. </script>
  400. <style>
  401. </style>