wechat_yxcl/pages/serviceAreaReimbursement/serviceAreaReimbursement.vue
2021-02-07 21:21:12 +08:00

213 lines
4.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="content">
<div class="screen-box">
<div class="uni-flex">
<text>报销类型</text>
<picker mode="selector" @change="bindPartChange" :value="selectList[selectTypeIndex].typeId" range-key="name" :range="selectList" class="screen-unit">
<view>{{selectList[selectTypeIndex].name}} <text class="uni-icon uni-icon-arrowdown"></text></view>
</picker>
</div>
</div>
<!-- <view style="flex: 1;overflow: hidden;" >
<scroll-view scroll-y="true" style="height: 100%;width: 100%;" @scrolltolower="loadMore"> -->
<view v-if="pageList.length>0">
<list-unit v-for="(item,index) in pageList" :key="index" :item="item" :i="index" @goDetail="goDetail"></list-unit>
</view>
<view v-else-if="!pageData.isLoading" style="height: 100%;">
<noFound :nodata="pageList.length>0 ? false : true"/>
</view>
<view class="load-more" v-if="pageList.length>0">
<text>{{!pageData.isEnd ? '正在加载,请稍后...':'——— 我是有底线的 ———'}}</text>
</view>
<!-- </scroll-view>
</view> -->
</view>
</template>
<script>
import { mapGetters,mapMutations } from 'vuex'
import ListUnit from './components/serviceAreaReimUnit.vue'
export default {
data() {
return {
pageData: {
pageIndex:1,
pageSize:10,
isEnd: false,
isLoading: true
},
pageList:[],
selectTypeIndex: 0,
selectList: [
{
name: '全部',
typeId: ''
},
{
name: '差旅费报销',
typeId: 1000
},{
name:'费用报销审批',
typeId: 3000
}
,{
name:'付款审批',
typeId:2000
}
,{
name:'资金拨付',
typeId:4000
}
]
}
},
components:{
ListUnit
},
computed: {
...mapGetters({isReloading:'shouldReLoadingList'}),
},
methods:{
...mapMutations(['shouldReLoadingList']),
bindPartChange(e){
if(this.selectTypeIndex!=e.detail.value){
this.selectTypeIndex = e.detail.value
this.pageData.pageIndex = 1
this.pageData.isEnd = false
uni.showLoading({
title:'正在加载'
})
this.getList()
this.$forceUpdate()
}
},
getList() {
let _this = this
_this.$request.$get("GetFinanceExpense",{
pageIndex: _this.pageData.pageIndex,
pageSize: _this.pageData.pageSize,
ExpenseBillType: this.selectList[this.selectTypeIndex].typeId
}).then(res => {
if(!res.ResultCode ||res.ResultCode!='100'){
_this.pageList = []
}else{
let list = res.Data.List
_this.pageList = this.pageData.pageIndex==1 ? list : _this.pageList.concat(list)
if (list.length < _this.pageData.pageSize) { // 返回条数小于每页条数
_this.pageData.isEnd = true
}
_this.$forceUpdate()
}
uni.hideLoading()
setTimeout(function(){
_this.pageData.isLoading = false
},500)
})
},
loadMore(){
if(!this.pageData.isEnd) {
this.pageData.pageIndex += 1
this.getList()
}
},
goDetail(item) {
let url = "/pages/serviceAreaReimbursement/detail?type="+item.EXPENSEBILL_TYPE+"&id=" + item.HIGHWAYPROINST_ID
// switch (item.EXPENSEBILL_TYPE) {
// case 1000: // 差旅费报销
// url = "/pages/serviceAreaReimbursement/travelExpense?id=" + item.HIGHWAYPROINST_ID
// break
// case 3000: // 费用报销审批
// url = "/pages/serviceAreaReimbursement/reimbursement?id=" + item.HIGHWAYPROINST_ID
// break
// case 2000: // 付款报销
// url = "/pages/serviceAreaReimbursement/paymentApproval?id=" + item.HIGHWAYPROINST_ID
// break
// case 4000: // 资金拨付
// url = "/pages/serviceAreaReimbursement/fundAppropriation?id=" + item.HIGHWAYPROINST_ID
// break
// }
this.$util.toNextRoute('navigateTo', url)
},
},
onPullDownRefresh() {
this.pageData.pageIndex = 1
this.pageData.isEnd = false
uni.showLoading({
title:'正在加载'
})
this.getList()
setTimeout(function() {
uni.stopPullDownRefresh()
}, 1000)
},
onReachBottom(){
this.loadMore()
},
onShow() {
if(this.isReloading) {
uni.showLoading({
title:'正在加载'
})
this.pageData.pageIndex = 1
this.pageData.isEnd = false
this.getList()
this.shouldReLoadingList(false)
}
},
onLoad() {
this.pageData.isLoading= true
uni.showLoading({
title:'正在加载'
})
this.getList()
},
onUnload() {
this.$util.addUserBehavior()
}
}
</script>
<style scoped>
.content {
display: flex;
flex-direction: column;
justify-content: center;
padding-top: 90rpx;
/* height: 100%; */
}
.screen-box {
background-color: #fff;
padding: 15upx 24upx;
display: flex;
position: fixed;
width: 100%;
top: 0;
z-index: 1;
border-bottom: 2rpx solid #f8f9fb;
}
.uni-icon-arrowdown {
font-size: 24rpx;
margin-left: 8rpx;
}
</style>