ahyd_DIB/pages/serviceAreaReimbursement/serviceAreaReimbursement.vue
2024-10-14 19:31:16 +08:00

328 lines
8.3 KiB
Vue

<template>
<view class="content">
<view class="uni-flex ai-center jc-around menu-list">
<MenuItem
v-for="(item,index) in menuList"
:key="index"
:item="item"
round="true"
size="28"
:src="activeType==item.id? item.active: item.src"
:nameStyle="activeType==item.id ? 'color:#5B96E9' :'color:#808D97'"
:imageBoxStyle="(activeType==item.id ? 'background:#f0f7fe;' : 'background:#f6f7f8;')+'height:75rpx;width:75rpx;padding: 18rpx;'"
@handleClick="handleClick"
>
</MenuItem>
</view>
<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>
<UniPop :show="showPop" @hidePopup="closePop" type="bottom" @touchmove.prevent round="true">
<view class="pb24">
<view class="moduleTitle">日期</view>
<view class="uni-flex align-center">
<view v-for="(d,index) in dateList" :key="index" @click="selectDate(index)" class="tag-item" :class="{'actived':dateIndex==index}">{{d.name}}</view>
</view>
<view class="moduleTitle">财务流程</view>
<view class="uni-flex ai-center menu-list">
<MenuItem
v-for="(item,index) in selectList"
:key="index"
:item="item"
size="60"
:nameStyle="selectTypeIndex==item.typeId ? 'color:'+(colors[index]? colors[index]: colors[index-colors.length]) : 'color:#120E2B'"
:imageBoxStyle="'background:'+(colors[index]? colors[index]: colors[index-colors.length])+';height:74rpx;width:74rpx;border-radius:20rpx;line-height:74rpx;'"
@handleClick="bindPartChange"
>
</MenuItem>
</view>
<view class="popbtn" @click="reloadList">确定</view>
</view>
</UniPop>
</view>
</template>
<script>
import { mapGetters,mapMutations } from 'vuex'
import ListUnit from './components/serviceAreaReimUnit.vue'
import MenuItem from '@/components/menu/menuItem.vue'
import UniPop from '@/components/uni-popup.vue'
export default {
data() {
const today = new Date()
const day = this.$util.cutDate(today,'YYYY/MM/DD',0)
const month = this.$util.cutDate(today,'YYYY/MM/DD',-30)
const threeMonth = this.$util.cutDate(today,'YYYY/MM/DD',-90)
const halfYear = this.$util.cutDate(today,'YYYY/MM/DD',-182)
return {
pageData: {
pageIndex:1,
pageSize:10,
isEnd: false,
isLoading: true
},
pageList:[],
showPop: false,
selectList: [
{
name: '全部',
src: '../../../../../static/images/expense/type/qb.png',
typeId: ''
},
{
name: '差旅费报销',
src: 'https://eshangtech.com/ShopICO/ahyd-BID/expense/type/clfbx.png',
typeId: 1000
},{
name:'费用报销',
src: 'https://eshangtech.com/ShopICO/ahyd-BID/expense/type/fybx.png',
typeId: 3000
}
,{
name:'付款审批',
src: 'https://eshangtech.com/ShopICO/ahyd-BID/expense/type/jkdsp.png',
typeId:2000
}
,{
name:'资金拨付',
src: 'https://eshangtech.com/ShopICO/ahyd-BID/expense/type/bzjtf.png',
typeId:4000
}
],
popOldValue:[0,''],
activeType: 0, // 选中的筛选id
selectTypeIndex: '', //默认选中的流程类型
dateIndex: 0, //默认选中的日期
colors: ['#5B96E9','#F0A038','#5B96E9','#57BAAE','#D9675C','#5B96E9','#57BAAE'],
dateList:[
{
name: '近1月',
value: `${month},${day}`
},
{
name: '近3月',
value: `${threeMonth},${day}`
},
{
name: '近半年',
value: `${halfYear},${day}`
}
],
menuList: [
{
name: '待审批',
src: 'https://eshangtech.com/ShopICO/ahyd-BID/expense/type/shenp.png',
active: 'https://eshangtech.com/ShopICO/ahyd-BID/expense/type/shenpz.png',
id: 0
},{
name: '已处理',
src: 'https://eshangtech.com/ShopICO/ahyd-BID/expense/type/yichl.png',
active: 'https://eshangtech.com/ShopICO/ahyd-BID/expense/type/yichlz.png',
id: 1
},{
name: '已发起',
src: 'https://eshangtech.com/ShopICO/ahyd-BID/expense/type/yifq.png',
active: 'https://eshangtech.com/ShopICO/ahyd-BID/expense/type/yifqz.png',
id: 2
},{
name: '更多筛选',
src: 'https://eshangtech.com/ShopICO/ahyd-BID/expense/type/shaix.png',
active: 'https://eshangtech.com/ShopICO/ahyd-BID/expense/type/shaixz.png',
id: 4
},
],
}
},
components:{
ListUnit,
MenuItem,
UniPop
},
computed: {
...mapGetters({isReloading:'shouldReLoadingList'}),
},
methods:{
...mapMutations(['shouldReLoadingList']),
handleClick(item){
if(item.id==4){
this.showPop = true
}else{
this.activeType = item.id
this.reloadList()
}
},
selectDate(dayIndex){
this.popOldValue[0] = this.dateIndex
this.dateIndex = dayIndex
},
reloadList() {
this.showPop = false
this.pageData.pageIndex = 1
uni.showLoading({
title:'正在加载'
})
this.pageData.isEnd = false
this.getList()
this.$forceUpdate()
},
bindPartChange(item){
this.popOldValue[1] = this.selectTypeIndex
this.selectTypeIndex = item.typeId
},
closePop (){
let popOldValue = this.popOldValue
this.selectTypeIndex = popOldValue[1]
this.dateIndex = popOldValue[0]
this.showPop = false
},
getList() {
let _this = this
let DealState = _this.activeType!=-1&& _this.activeType!=4 ? _this.activeType : ''
_this.$request.$get("GetFinanceExpense",{
pageIndex: _this.pageData.pageIndex,
pageSize: _this.pageData.pageSize,
ExpenseBillType: this.selectTypeIndex,
DealState: DealState,
QueryDate: _this.dateList[_this.dateIndex].value
}).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,...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
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%; */
}
.tag-item {
width: 150rpx;
height: 66rpx;
background: #ffffff;
border: 1rpx solid #efefef;
border-radius: 8rpx;
color: #808D97;
font-size: 24rpx;
text-align: center;
line-height: 64rpx;
margin: 24rpx 0 24rpx 24rpx;
}
.tag-item.actived {
background: #e8f3fd;
border: 1rpx solid #e8f3fd;
color: #4D95F0;
}
.menu-list {
width: 100%;
background-color: #fff;
flex-wrap: wrap;
}
.moduleTitle {
text-align: left;
margin: 16rpx 0 0 24rpx;
font-weight: 700;
font-size: 30rpx;
padding: 24rpx 0 12rpx 0;
}
.pb24 {
padding-bottom: 24rpx;
}
.popbtn {
width: 639rpx;
height: 80rpx;
line-height: 80rpx;
color: #fff;
font-size: 28rpx;
background: #5b96e9;
border-radius: 8rpx;
/* margin-top: 48rpx; */
margin: 48rpx auto 24rpx auto;
}
</style>