| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- <template>
- <view class="">
- <u-toast ref="uToast"/>
- <MeScroll :up="up" :down="down" @up="upFn" :fixed="false" @down="downFn" @init="initMeScroll">
- <!-- 审核通过 -->
- <user-card @deleteUserById="deleteUserById" v-if="i==0" :list="userList" ></user-card>
- <apply-card v-if="i==1" :list="applyList" ></apply-card>
- <audit-card v-if="i==2" :list="auditList" ></audit-card>
- </MeScroll>
- </view>
- </template>
- <script>
- import MeScroll from '@/comps/mescroll-body/mescroll-uni.vue'
- import userCard from './user-card.vue'
- import applyCard from './apply-card.vue'
- import auditCard from './audit-card.vue'
- var app=getApp()
- export default {
- name:'item',
- components:{
- MeScroll,userCard,applyCard,auditCard
- },
- props: {
- //房间号
- roomId:String,
-
- i: Number,
- current:Number,
- item:Object,
-
- },
- data() {
- return {
- userList:[],//审核通过的数据列表
- applyList:[],//申请记录的数据列表
- auditList:[],//住户审核的数据列表
-
- isInit: false, // 是否初始化
- list: [], // 列表数据
- mescroll: null, // mescroll 对象
- // 上拉配置参数
- up: {
- noMoreSize: 2,
- auto: false,
- page: {
- page: 0,
- size: 10
- }
- },
- // 下拉配置参数
- down: {
- use: false,
- auto: false
- }
- }
- },
- watch:{
- current(val) {
- if(!this.isInit && val === this.i) {
- this.mescroll.resetUpScroll()
- }
- }
- },
- mounted() {
- if(!this.isInit && this.i === 0) {
- this.mescroll.resetUpScroll()
- }
- },
- created() {
-
- },
- methods: {
- /**
- * 删除用户
- */
- deleteUserById(id){
- let that = this;
- app.globalData.twoFailHint("确认删除该住户吗?", function () {
- let params = {
- member_id:app.globalData.member.id,
- user_id:id
- };
- let operation = 'user/deleteUserById';
- app.globalData.postRequest(params, operation, function (res) {
- if (res.data.result_code == 1) {
- that.$u.toast(res.data.result_msg)
- that.mescroll.resetUpScroll()
- } else {
- app.globalData.oneFailHint(res.data.result_msg);
- }
- });
- });
- },
- /**
- * @param {Object} mescroll 初始化组件
- */
- initMeScroll(mescroll) {
- this.mescroll = mescroll
- },
- /**
- * @param {Object} mescroll 上拉回调
- */
- upFn(mescroll) {
- let that=this
- if (this.i==0) {
- //审核通过的用户列表
- this.getUserListByMemberId(mescroll)
- }else if (this.i==1) {
- //申请记录列表
- this.getApplyListByMemberId(mescroll)
- }else if (this.i==2) {
- //审核通过列表
- this.getAuditListByMemberId(mescroll)
- }
- },
- /**
- * 下拉回调
- * */
- downFn(mescroll) {
- setTimeout(()=>{
- this.$u.toast('刷新成功')
- this.mescroll.resetUpScroll()
- },1500)
- },
- /**
- * 通过memberid获取审核通过标签页下的所有成员
- * @param {Object} mescroll
- */
- getUserListByMemberId(mescroll) {
- let that = this;
- let params = {
- "pageNum":mescroll.num,
- "pageSize":mescroll.size,
- "member_id":getApp().globalData.member.id
- };
- if (!this.$isEmpty(this.roomId)) {
- params.roomId=this.roomId
- }
- let operation = 'user/getAllUserByMemberId';
- try{
- getApp().globalData.postRequest(params, operation, function (res) {
- if (res.data.result_code == 1) {
- let data=res.data.list
- mescroll.endByPage(data.length, res.data.pages);
- if(mescroll.num == 1) that.userList = [];
- that.userList=that.userList.concat(data); //追加新数据
- }else{
- that.$u.toast(res.data.msg)
- mescroll.endErr();
- }
- });
- }catch(e){
- mescroll.endErr();
- }
- },
- /**
- * 获取申请列表
- */
- getApplyListByMemberId(mescroll) {
- let that = this;
- let params = {
- "pageNum":mescroll.num,
- "pageSize":mescroll.size,
- "member_id":getApp().globalData.member.id
- };
- if (!this.$isEmpty(this.roomId)) {
- params.roomId=this.roomId
- }
- let operation = 'applyUser/getAllApplyUserByMemberId';
- try{
- getApp().globalData.postRequest(params, operation, function (res) {
- if (res.data.result_code == 1) {
- let data=res.data.list
- mescroll.endByPage(data.length, res.data.pages);
- if(mescroll.num == 1) that.applyList = [];
- that.applyList=that.applyList.concat(data); //追加新数据
- }else{
- that.$u.toast(res.data.msg)
- mescroll.endErr();
- }
- })
- }catch(e){
- mescroll.endErr();
- }
- },
- /**
- * 获取 住户审核列表
- * @param {Object} mescroll
- */
- getAuditListByMemberId(mescroll) {
- let room_ids=[]
- this.vuex_own_room_list.forEach(item=>{
- room_ids.push(item.id)
- })
- let that = this;
- let params = {
- "pageNum":mescroll.num.toString(),
- "pageSize":mescroll.size.toString(),
- "check_states":0,//审核状态
- "room_ids":room_ids
- };
- let operation = 'applyUser/getAllApplyUserByRoomIds'
- try{
- getApp().globalData.postRequest(params, operation, function (res) {
- if (res.data.result_code == 1) {
- let data=res.data.list
- mescroll.endByPage(data.length, res.data.pages);
- if(mescroll.num == 1) that.auditList = [];
- that.auditList=that.auditList.concat(data); //追加新数据
- }else{
- that.$u.toast(res.data.msg)
- mescroll.endErr();
- }
- })
- }catch(e){
- mescroll.endErr();
- }
- },
-
- }
- }
- </script>
- <style lang="scss" scoped>
- view{
- box-sizing: border-box;
- }
- </style>
|