|
|
<template> <view class="pageBgImg"> <topNavbar title="投诉咨询记录"></topNavbar> <view class="pad"> <view class="tabs"> <view class="tab" v-for="(item,index) in tabList" :key="index" :class="{active: params.type==item.id}" @click="changeTab(item)">{{ item.text }}</view> </view> <view class="navs"> <view class="nav" v-for="(item,index) in navList" :key="index" :class="{active: params.dealStatus==item.id}" @click="changeNav(item)">{{ item.text }}</view> </view> <view class="recordTotal" v-if="total">{{ total }}条记录</view> <view class="tabCon" v-if="params.type==1"> <view class="card" v-for="(item,index) in list" :key="index"> <consultItem :item="item" @closeFn="initList"></consultItem> </view> </view> <view class="tabCon" v-if="params.type==2"> <view class="card" v-for="(item,index) in list" :key="index"> <complaintItem :item="item" @closeFn="initList"></complaintItem> </view> </view> </view> <view style="padding-bottom: 20rpx;" v-if="list.length"> <u-loadmore :status="status" /> </view> <nodata v-if="!list.length&&status=='nomore'"></nodata> </view> </template>
<script> import consultItem from './comp/consultItem' import complaintItem from './comp/complaintItem' import { studentComplain } from '@/config/api.js' export default { components: { consultItem, complaintItem }, data() { return { tabList: [ {text: '我的咨询',id: 1}, {text: '我的投诉',id: 2}, ], navList: [ {text: '全部', id: 0}, {text: '待处理', id: 1}, {text: '已处理', id: 2}, {text: '已关闭', id: 3}, ], status: 'loading', total: 0, params: { type: 1, dealStatus: 0, pageNo: 1, pageSize: 20 }, list: [] } }, onLoad(options) { if(options.tab) this.params.type = options.tab this.params.studentPhone = this.vuex_userInfo.phone this.studentComplainFn() }, methods: { changeTab(item) { this.params.type = item.id this.initList() }, changeNav(item) { this.params.dealStatus = item.id this.initList() }, initList() { this.params.pageNo = 1 this.list = [] this.status = 'loading' this.studentComplainFn() }, // 列表
async studentComplainFn() { const {data: res} = await studentComplain(this.params) this.list.push(...res.list) this.total = res.total if(this.list.length>=this.total) this.status = 'nomore' console.log(res) } } } </script>
<style lang="scss" scoped> .card { padding: 0 24rpx; margin-bottom: 20rpx; } .tabs { display: flex; width: 100%; height: 72rpx; background: #FFFFFF; border-radius: 16rpx; .tab { flex: 1; text-align: center; line-height: 72rpx; color: #ADADAD; &.active { background: rgba(25,137,250,0.1); border-radius: 16rpx; border: 2rpx solid #1989FA; color: $themC; font-weight: 600; } } } .navs { display: flex; justify-content: space-between; color: #fff; font-size: 28rpx; padding: 24rpx 24rpx 40rpx 24rpx; color: #fff; .nav { &.active { font-weight: 500; position: relative; &::before { position: absolute; left: 50%; transform: translateX(-50%); bottom: -20rpx; content: ''; width: 56rpx; height: 6rpx; background: #FFFFFF; border-radius: 3rpx; } } } } .recordTotal { font-size: 24rpx; padding: 28rpx 0 28rpx 0; text-align: right; } </style>
|