bonus-Certificate-app/pages/certificateExamCenter/certificateExam/index.vue

277 lines
8.6 KiB
Vue

<template>
<page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
<view class="certificate-list">
<Navbar2 title="审批中心" :showRightText="true" :backGround="false" :isBack="true" :text="'新增申请'" @clickIcon="addInfo"/>
<view class="tag-view">
<view class="tag-view-item" @click="changeTag(1)" :class="tagIndex==1?'active tag-view-item':'tag-view-item'">待我处理</view>
<view class="tag-view-item" @click="changeTag(2)" :class="tagIndex==2?'active tag-view-item':'tag-view-item'">我已处理</view>
<view class="tag-view-item" @click="changeTag(3)" :class="tagIndex==3?'active tag-view-item':'tag-view-item'">我的申请</view>
</view>
<view style="width: 92%;height: 80rpx;margin: 20rpx auto;background: #FFF;">
<u-search shape="round" placeholder="搜索" v-model="keyword" :showAction="true" actionText="搜索" :animation="false" @custom="searchList"></u-search>
</view>
<scroll-view v-if="tagIndex==1||tagIndex==2" style="width: 100%;height: 84vh;background: #F5F5F5;" @scrolltolower="onScrollTolower1" scroll-y="true">
<view class="scroll-item" v-for="(item, index) in infoList1" :key="index" @click="handleEdit(item)">
<view style="width: 100%;display: flex;margin-bottom: 10rpx;">
<view style="color: #2A2B2F;font-size: 32rpx;margin-right: 20rpx;font-weight: 600;">{{item.name}}的申请</view>
<view class="status-view" v-if="item.applyType==1">存证</view>
<view class="status-view" v-if="item.applyType==2">取证</view>
</view>
<view class="info-text">证件类型:{{item.certificateTypeName}}</view>
<view class="info-text">证件用途:{{item.applyReasonName}}</view>
<view class="info-text">证件编号:{{item.certificateNo}}</view>
<view class="info-text">申请时间:{{item.createTime}}</view>
<image v-if="item.applyState==0||item.applyState==1" style="width: 120rpx;height: 120rpx;position: absolute;top:30%;right: 5%;" src="/static/images/system/examIcon1.png"></image>
<image v-if="item.applyState==2||item.applyState==4" style="width: 120rpx;height: 120rpx;position: absolute;top:30%;right: 5%;" src="/static/images/system/examIcon2.png"></image>
<image v-if="item.applyState==3" style="width: 120rpx;height: 120rpx;position: absolute;top:30%;right: 5%;" src="/static/images/system/examIcon3.png"></image>
</view>
<view style="margin: 20px 0" v-if="infoList1.length > 0">
<u-loadmore :status="status1" nomoreText="没有更多数据了" />
</view>
<view v-else class="flex justify-center align-center" style="height: 50vh">
<u-empty icon="../../static/images/not_order.png" text="暂无数据" textColor="#000" />
</view>
</scroll-view>
<scroll-view v-if="tagIndex==3" style="width: 100%;height: 84vh;background: #F5F5F5;" @scrolltolower="onScrollTolower2" scroll-y="true">
<view class="scroll-item" v-for="(item, index) in infoList2" :key="index" @click="handleEdit(item)">
<view style="width: 100%;display: flex;margin-bottom: 10rpx;">
<view style="color: #2A2B2F;font-size: 32rpx;margin-right: 20rpx;font-weight: 600;">{{item.name}}的申请</view>
<view class="status-view" v-if="item.applyType==1">存证</view>
<view class="status-view" v-if="item.applyType==2">取证</view>
</view>
<view class="info-text">证件类型:{{item.certificateTypeName}}</view>
<view class="info-text">证件用途:{{item.applyReasonName}}</view>
<view class="info-text">证件编号:{{item.certificateNo}}</view>
<view class="info-text">申请时间:{{item.createTime}}</view>
<image v-if="item.applyState==0||item.applyState==1" style="width: 120rpx;height: 120rpx;position: absolute;top:30%;right: 5%;" src="/static/images/system/examIcon1.png"></image>
<image v-if="item.applyState==2||item.applyState==4" style="width: 120rpx;height: 120rpx;position: absolute;top:30%;right: 5%;" src="/static/images/system/examIcon2.png"></image>
<image v-if="item.applyState==3" style="width: 120rpx;height: 120rpx;position: absolute;top:30%;right: 5%;" src="/static/images/system/examIcon3.png"></image>
</view>
<view style="margin: 20px 0" v-if="infoList2.length > 0">
<u-loadmore :status="status2" nomoreText="没有更多数据了" />
</view>
<view v-else class="flex justify-center align-center" style="height: 50vh">
<u-empty icon="../../static/images/not_order.png" text="暂无数据" textColor="#000" />
</view>
</scroll-view>
</view>
</template>
<script>
import { certificatelistByTypePageApi,certificateApplyListPageApi } from '@/api/certificateExamCenter/index.js';
export default {
data() {
return {
fontValue:uni.getStorageSync('fontSize') || 8,
tagIndex:1,
keyword:"",
pageNum1: 1,
pageSize1: 10,
total1: 0,
infoList1: [],
status1: 'loadmore',
pageNum2: 1,
pageSize2: 10,
total2: 0,
infoList2: [],
status2: 'loadmore',
}
},
onLoad() {
},
onShow(){
if(this.tagIndex==1||this.tagIndex==2){
this.pageNum1=1
this.infoList1=[]
this.getList1()
}
if(this.tagIndex==3){
this.pageNum2=1
this.infoList2=[]
this.getList2()
}
},
methods: {
//搜索
searchList(value){
if(this.tagIndex==1||this.tagIndex==2){
this.pageNum1=1
this.infoList1=[]
this.getList1()
}
if(this.tagIndex==3){
this.pageNum2=1
this.infoList2=[]
this.getList2()
}
},
changeTag(index){
this.tagIndex=index;
if(this.tagIndex==1||this.tagIndex==2){
this.pageNum1==1
this.getList1()
}
if(this.tagIndex==3){
this.pageNum2==1
this.getList2()
}
},
// 翻页
onScrollTolower1(){
if(this.total1>this.infoList1.length){
this.pageNum1++
this.getList1()
}
},
//获取列表
async getList1() {
console.log('获取列表')
const params = {
pageNum: this.pageNum1,
pageSize: this.pageSize1,
keyword: this.keyword,
type:this.tagIndex
}
try {
const res = await certificatelistByTypePageApi(params)
console.log('?? ~ getList1 ~ res:', res)
this.total1 = res.total;
if(this.pageNum1==1){
this.infoList1 = res.rows
}else{
this.infoList1.push(...res.rows)
}
this.status1 = this.total1 == this.infoList1.length ? 'nomore' : 'loadmore'
} catch (error) {
console.log(error)
}
},
// 翻页
onScrollTolower2(){
if(this.total2>this.infoList2.length){
this.pageNum2++
this.getList2()
}
},
//获取列表
async getList2() {
console.log('获取列表')
const params = {
pageNum: this.pageNum2,
pageSize: this.pageSize2,
userId:uni.getStorageSync("userId"),
keyword: this.keyword
}
try {
const res = await certificateApplyListPageApi(params)
console.log('?? ~ getList1 ~ res:', res)
this.total2 = res.total;
if(this.pageNum2==1){
this.infoList2 = res.rows
}else{
this.infoList2.push(...res.rows)
}
this.status2 = this.total2 == this.infoList2.length ? 'nomore' : 'loadmore'
} catch (error) {
console.log(error)
}
},
handleEdit(apply) {
if(this.tagIndex==1){
uni.navigateTo({
url: `/pages/certificateExamCenter/certificateExam/examDetail?apply=${JSON.stringify(apply)}`
})
}else if(this.tagIndex==2||this.tagIndex==3){
uni.navigateTo({
url: `/pages/certificateExamCenter/certificateExam/examView?apply=${JSON.stringify(apply)}`
})
}
},
addInfo() {
uni.navigateTo({
url: `/pages/certificateExamCenter/certificateApply/applyAdd`
})
},
}
}
</script>
<style lang="scss" scoped>
.certificate-list {
height: 100vh;
// background-image: url('@/static/images/system/pageBg.png');
// background-size: 100% 100%;
background-color: #FFF;
// padding: 40rpx;
}
.info-item{
width: 100%;
height: auto;
display: flex;
align-items: center;
margin: 10rpx auto;
border-bottom: 1px solid #ccc;
}
.label-box{
width: 100%;
height: auto;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2px;
}
.label-view{
width: 100%;
display: flex;
align-items: center;
}
.label{
font-weight: 600;
}
.tag-view{
width: 92%;
height: 3vh;
margin: 20rpx auto;
display: flex;
align-items: self-end;
background: #FFF;
}
.tag-view-item{
width: auto;
height: auto;
color: #64686E;
font-size: 28rpx;
font-weight: 600;
margin-right: 60rpx;
}
.active{
border-bottom: 4px solid #3888FF;
font-size: 32rpx;
color: #2A2B2F;
}
.scroll-item{
width: 100%;
height: auto;
margin:20rpx 0;
background: #fff;
padding: 20rpx 40rpx;
position: relative;
}
.info-text{
font-size: 28rpx;
color: #64686E;
margin-bottom: 16rpx;
}
.status-view{
padding: 5rpx 10rpx;
background: #BEDAFF;
color: #1F72EA;
font-size: 24rpx;
border-radius: 8rpx;
}
</style>