| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- <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
- },
- provide() {
- return {
- reload: this.reload
- }
- },
- props: {
- //房间号
- roomId: String,
- i: Number,
- current: Number,
- item: Object,
- },
- data() {
- return {
- userList: [], //审核通过的数据列表
- applyList: [], //申请记录的数据列表
- auditList: [], //住户审核的数据列表
- isInit: false, // 是否初始化
- list: [], // 列表数据
- mescroll: null, // mescroll 对象
- // 上拉配置参数
- up: {
- noMoreSize: 3,
- 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: {
- reload() {
- this.mescroll.resetUpScroll()
- },
- /**
- * 删除用户
- */
- deleteUserById(id) {
- this.$dialog.showModal('确认删除该住户吗?').then(() => {
- let params = {
- user_id: id
- };
- this.$http.deleteUserById(params).then(res => {
- if (res.data.result_code == 1) {
- this.$u.toast(res.data.result_msg)
- this.mescroll.resetUpScroll()
- } else {
- app.globalData.oneFailHint(res.data.result_msg);
- }
- })
- })
- },
- /**
- * @param {Object} mescroll 初始化组件
- */
- initMeScroll(mescroll) {
- this.mescroll = mescroll
- },
- /**
- * @param {Object} mescroll 上拉回调
- */
- upFn(mescroll) {
- 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 params = {
- query: {
- current: mescroll.num,
- size: mescroll.size,
- },
- "residentialId": uni.getStorageSync('residentialId'),
- };
- if (!this.$isEmpty(this.roomId)) {
- params.roomId = this.roomId
- }
- // let operation = 'user/getAllUserByMemberId';
- try {
- this.$http.getAllUserByMemberId(params).then(res => {
- if (res.data.success) {
- let data = res.data.data.records
- let total = res.data.data.total
- mescroll.endBySize(data.length, total);
- if (mescroll.num == 1) this.userList = [];
- this.userList = this.userList.concat(data); //追加新数据
- } else {
- this.$u.toast(res.data.msg)
- mescroll.endErr();
- }
- });
- } catch (e) {
- mescroll.endErr();
- }
- },
- /**
- * 获取申请列表
- */
- getApplyListByMemberId(mescroll) {
- let params = {
- "current": mescroll.num,
- "size": mescroll.size,
- "memberId": getApp().globalData.member.id,
- }
- try {
- this.$http.getAllApplyUserByMemberId(params).then(res => {
- console.log(res);
- if (res.data.success) {
- let data = res.data.data.records
- let total = res.data.data.total
- mescroll.endBySize(data.length, total);
- if (mescroll.num == 1) this.applyList = [];
- this.applyList = this.applyList.concat(data); //追加新数据
- } else {
- this.$u.toast(res.data.msg)
- mescroll.endErr();
- }
- })
- } catch (e) {
- mescroll.endErr();
- }
- },
- /**
- * 获取 住户审核列表
- * @param {Object} mescroll
- */
- getAuditListByMemberId(mescroll) {
- let room_ids = []
- let params = {
- "current": mescroll.num,
- "size": mescroll.size,
- "memberId": getApp().globalData.member.id
- }
- try {
- this.$http.getAuditListByMemberId(params).then(res => {
- if (res.data.success) {
- let data = res.data.data.records
- let total = res.data.data.total
- mescroll.endBySize(data.length, total);
- if (mescroll.num == 1) this.auditList = [];
- this.auditList = this.auditList.concat(data); //追加新数据
- } else {
- this.$u.toast(res.data.msg)
- mescroll.endErr();
- }
- })
- } catch (e) {
- console.log(e);
- mescroll.endErr();
- }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- view {
- box-sizing: border-box;
- }
- </style>
|