| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template>
- <MeScroll :up="up" :down="down" @up="upFn" :fixed="false" @down="downFn" @init="initMeScroll">
- <card @pass="pass" @fail="fail" :list="list"></card>
- </MeScroll>
- </template>
- <script>
- import MeScroll from '@/comps/mescroll-body/mescroll-uni.vue'
- import card from './card.vue'
- var app = getApp()
- export default {
- components: {
- MeScroll,
- card
- },
- props: {
- params: Object,
- type: Number,
- i: Number,
- item: Object
- },
- data() {
- return {
- //审核不通过时展示
- modelShow: false,
- //审核不通过的原因
- opinion: '',
- dataDetail: {},
- memberId: '',
- isInit: false, // 是否初始化
- list: [], // 列表数据
- mescroll: null, // mescroll 对象
- // 上拉配置参数
- up: {
- noMoreSize: 3,
- auto: false,
- page: {
- page: 0,
- size: 10
- }
- },
- // 下拉配置参数
- down: {
- use: true,
- auto: false
- }
- }
- },
- created() {
- this.memberId = getApp().globalData.member.id
- },
- watch: {
- type(val) {
- if (!this.isInit && val === this.i) {
- this.mescroll.resetUpScroll()
- }
- }
- },
- mounted() {
- if (!this.isInit && this.i === 0) {
- this.mescroll.resetUpScroll()
- }
- },
- methods: {
- /**
- * 通过审核
- */
- pass(item) {
- let params = {
- id: item.id,
- auditStatus: 1
- }
- this.$dialog.showModal('确定审核通过该记录?').then(() => {
- this.$http.guestRecordsSubmit(params).then(res => {
- this.fetchAuthRecordNum()
- this.mescroll.resetUpScroll()
- })
- })
- },
- fetchAuthRecordNum() {
- },
- /**
- * 审核不通过
- * @param {Object} item
- */
- fail(item) {
- let params = {
- id: item.id,
- auditStatus: 2
- }
- this.$dialog.showModal('确定审核不通过该记录?').then(() => {
- this.$http.guestRecordsSubmit(params).then(res => {
- this.fetchAuthRecordNum()
- this.mescroll.resetUpScroll()
- })
- })
- },
- fetchAuthRecordNum() {
- let memberId = this.vuex_member.id
- let residentialId = uni.getStorageSync("residentialId");
- if (!this.$isEmpty(memberId)) {
- let params = {
- userId: memberId,
- residentialId: uni.getStorageSync("residentialId"),
- size: 99,
- auditStatus: 0
- }
- this.$http.guestRecordsCount(params).then(res => {
- this.$u.vuex('vuex_auth_audit_count', res.data.data)
- })
- }
- },
- /**
- * @param {Object} mescroll 初始化组件
- */
- initMeScroll(mescroll) {
- this.mescroll = mescroll
- },
- /**
- * @param {Object} mescroll 上拉回调
- */
- upFn(mescroll) {
- try {
- let params = {
- userId: this.memberId,
- residentialId: uni.getStorageSync("residentialId"),
- query: {
- current: mescroll.num,
- size: mescroll.size,
- }
- }
- if (this.item.value != -1) {
- params.auditStatus = this.item.value
- }
- if (!this.$isEmpty(this.params.id)) {
- params.id = this.params.id
- }
- if (!this.$isEmpty(this.params.guestName)) {
- params.guestName = this.params.guestName
- }
- if (!this.$isEmpty(this.params.guestTel)) {
- params.guestTel = this.params.guestTel
- }
- this.$http.guestRecordsPage(params).then(res => {
- let data = res.data.data
- let records = data.records
- let total = data.total
- mescroll.endBySize(records.length, total)
- if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
- this.list = this.list.concat(records); //追加新数据
- })
- } catch (e) {
- mescroll.endErr();
- }
- },
- /**
- * 下拉回调
- * */
- downFn(mescroll) {
- setTimeout(() => {
- this.mescroll.resetUpScroll()
- uni.showToast({
- title: "刷新成功",
- icon: "none",
- position: "top"
- })
- }, 1500)
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- view {
- box-sizing: border-box;
- }
- </style>
|