Files
supplier-dispatch-h5/src/views/caseList/caseList.vue

274 lines
6.7 KiB
Vue

<template>
<div class="wrap">
<div class="navBar">
<van-nav-bar
title="报销批次"
left-arrow
left-arrow-color="#FFFFFF"
:border="false"
:fixed="true"
:safe-area-inset-top="true"
@click-left="goBack"
/>
</div>
<div class="tab_wrap">
<div v-for="(item, index) in tabArr" :key="index"
@click="changeTab(index)">
<span :class="{'active' : activeIndex == index , 'alpha' :true}"> {{ item.name }}</span>
<span class="numTip" style="opacity: 1 !important;">{{item.num}}</span>
</div>
</div>
<van-pull-refresh class="refresh" v-model="isLoading" @refresh="onRefresh" v-show="!show">
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
>
<div class="listWrap">
<div class="listItem" v-for="(item,index) in pageList" :key="index" @click="noMultipleClicks(goPageDetail,item.batchCode)">
<div class="line1">
<div><span>审核批次:</span><span>{{item.batchCode}}</span></div>
<div class="viewBtn">查看</div>
</div>
<div><span>报销金额:</span><span class="redColor">{{item.totalAmount}}</span><span class="greColor">/{{item.auditSuccessAmount}}</span></div>
<div><span>案件数量:</span><span>{{item.orderCount}}</span><span class="greColor">/{{item.auditSuccessCount}}</span></div>
<div><span>提交人员:</span><span>{{ item.createUser }}</span></div>
<div><span>提交时间:</span><span>{{ item.createTime }}</span></div>
</div>
</div>
</van-list>
</van-pull-refresh>
<div class="bgEmptyImg" v-show="show" >
<img src="@/assets/empty.png" />
</div>
</div>
</template>
<script>
import {myMixins} from "@/utils/myMixins";
import {reimburseBatchCount, reimburseBatchList} from "@/api/reimbursementBatch"
export default {
name: "caseList",
mixins: [myMixins],
data(){
return{
tabArr: [ {name: '待审核', status: 1,num:0},{name: '已审核', status: 2,num:0},],
activeIndex: 0,
pageList:[],
pageNum:1,
pageSize:10,
total:'',
isLoading:"",
loading: false,
finished: false,
noClick:true
}
},
async mounted() {
await this.getCount();
await this.getList()
},
computed:{
show() {
return (this.pageList.length < 0 || this.pageList.length == 0); // 判断数组长度是否大于 0
},
},
methods:{
async onLoad(){
console.log('00000000000000000000')
this.pageNum++;
await this.getList()
// 加载状态结束
this.loading = false;
// 数据全部加载完成
if (this.pageList.length >= this.total) {
this.finished = true;
}
},
async changeTab(index) {
this.activeIndex = index
this.pageNum = 1
this.pageList = [];
this.total=0
this.loading=false
this.finished=false
await this.getList()
// await this.onLoad()
},
onRefresh() {
this.pageNum=1
// this.getList()
setTimeout(() => {
this.$toast('刷新成功');
this.isLoading = false;
}, 1000);
},
async getList(){
let res=await reimburseBatchList({
pageNum:this.pageNum,
pageSize:this.pageSize,
type: this.activeIndex+1
})
this.total=res.total
if(this.pageNum == 1){// 第一页直接赋值
this.pageList=res.data
}else{// 第二页数据拼接
console.log("第二页数据拼接")
let preList = this.pageList;
console.log("preList",preList)
let arr = res.data;
console.log("arr",arr)
this.pageList = preList.concat(arr)
console.log("this.pageList",this.pageList)
}
},
async getCount(){
let res=await reimburseBatchCount()
this.tabArr.forEach(tab => {
if (tab.name === '待审核') {
tab.num = res.data.waitAuditCount;
} else if (tab.name === '已审核') {
tab.num = res.data.auditSuccessCount;
}
});
},
goPageDetail(id){
this.$router.push({
name: 'caseAuditList', // 目标路由的名称
params: {
id: id, // 参数对象的属性
type: this.activeIndex+1
}
});
},
}
}
</script>
<style scoped lang="scss">
@import "@/styles/mixin.scss";
@import "@/styles/common.scss";
.wrap{
@include wh(100%,100%);
box-sizing: border-box;
overflow-y: auto;
}
.navBar{
margin-bottom: 46px;
}
.bgEmptyImg{
@include flexTwoCenter;
height: 90% ;
background-color: #FAFAFA;
img{
width: 100%;
}
}
::v-deep .van-list__finished-text{
background-color: #F4F5F7 !important;
padding-bottom: 10px;
}
/*::v-deep .van-nav-bar__content{
background-color: #354683 !important;
}*/
//::v-deep .van-pull-refresh{
// height: calc(100% - 86px) ;
//}
.tab_wrap {
@include fontWeightSize(500, 14px);
@include flexColAround();
padding: 2px 0 10px 0;
background: #2C395F;
position: fixed;
z-index: 11;
width: 100%;
div {
padding-top: 8px;
color: #FFFFFF;
}
.alpha{
opacity: 0.5;
}
//为一个数时,宽为
.numTip{
display: inline-block;
min-width: 15px;
//height: 15px;
@include all-height(15px);
//box-sizing: border-box;
//padding: 0px 2px;
//@include wh(15px,15px);
@include bgcolorOpa(#F95B45,0.9);
border-radius: 4px;
text-align: center;
//line-height: 15px;
margin-left: 5px;
opacity: 1; /* 保持透明度为1 */
}
.active {
position: relative;
opacity: 1;
}
.active:after {
content: '';
display: block;
@include wh(18px,2px);
opacity: .8;
background: #FFFFFF;
position: absolute;
border-radius: 2px;
margin-top: 3px;
left: 50%;
opacity: 1;
transform: translateX(-50%);
}
}
.listWrap{
width: 100%;
//height: calc(100% - 86px);
height: 100%;
overflow-y: auto;
background-color: #F4F5F7;
.listItem{
width: 100%;
box-sizing: border-box;
padding: 14px 25px 13px 29px;
background-color: #FFFFFF;
margin-bottom: 10px;
.line1{
@include flexColBet();
.viewBtn{
@include wh(48px,18px);
text-align: center;
line-height: 18px;
background: #354D93;
border-radius: 3px;
color: #FFFFFF;
}
}
div{
line-height: 27px;
span:first-child{
display: inline-block;
width: 60px;
opacity: 0.5;
}
}
}
}
.greColor{
color:#38AD00 ;
font-weight: bold;
}
.redColor{
color:#FF5D2E ;
font-weight: bold;
}
</style>