OA/pages/reimbursement/index.vue

435 lines
10 KiB
Vue
Raw Permalink Normal View History

2023-11-05 00:11:08 +08:00
<template>
<view class="content">
<view class="content-banner">
<view class="" v-for="(item,i ) in list" :key="i" @click="apparent(i)">
<view class="banner-name" :style="{'color':i==num?'#3274F9':''}">{{item.name}}</view>
<view class="banner-xian" v-if='i==num'></view>
</view>
</view>
<view class="content-middle">
<view class="content-middle-one">
<view class="middle-one" v-for="(item,k) in list2" @click="tian(item)">
2023-11-20 18:23:46 +08:00
<liu-swipe-action :index="k" @clickItem="clickItem" :btnList='btnList1' v-if='item.check_status==2&&num!=2&&num!=0'>
2023-11-05 00:11:08 +08:00
<view class="middle-one-title">
<view class="one-titlea">
<view class="name">
2023-11-20 18:23:46 +08:00
{{item.admin_name}}
2023-11-05 00:11:08 +08:00
</view>
<view class="parment">
{{item.code}}
</view>
</view>
<view class="one-titleb"
2023-11-09 09:44:44 +08:00
:style="{'color':item.check_status==0?'#000':item.check_status==1?'#dddddd':item.check_status==2?'#34A853':item.check_status==3?'#F9AA32':'#F02828'}">
<text v-if='item.check_status==0'>待审核</text>
<text v-if='item.check_status==1'>审核中</text>
<text v-if='item.check_status==2'>审核通过</text>
<text v-if='item.check_status==3'>审核不通过</text>
<text v-if='item.check_status==4'>撤销审核</text>
2023-11-20 18:23:46 +08:00
<text v-if='item.check_status==5'>已打款</text>
2023-11-05 00:11:08 +08:00
</view>
</view>
<view class="middle-one-time">报销部门{{item.department}}</view>
<view class="middle-one-time">入账月份{{item.income_month}}</view>
2023-11-20 18:23:46 +08:00
<view class="middle-one-time">报销人审核人{{item.check_user}}</view>
</liu-swipe-action>
<liu-swipe-action :index="k" @clickItem="clickItem" :btnList='btnList' v-else>
<view class="middle-one-title">
<view class="one-titlea">
<view class="name">
{{item.admin_name}}
</view>
<view class="parment">
{{item.code}}
</view>
</view>
<view class="one-titleb"
:style="{'color':item.check_status==0?'#000':item.check_status==1?'#dddddd':item.check_status==2?'#34A853':item.check_status==3?'#F9AA32':'#F02828'}">
<text v-if='item.check_status==0'>待审核</text>
<text v-if='item.check_status==1'>审核中</text>
<text v-if='item.check_status==2'>审核通过</text>
<text v-if='item.check_status==3'>审核不通过</text>
<text v-if='item.check_status==4'>撤销审核</text>
<text v-if='item.check_status==5'>已打款</text>
</view>
</view>
<view class="middle-one-time">报销部门{{item.department}}</view>
<view class="middle-one-time">入账月份{{item.income_month}}</view>
<view class="middle-one-time">报销人审核人{{item.check_user}}</view>
2023-11-05 00:11:08 +08:00
</liu-swipe-action>
</view>
</view>
</view>
2023-11-09 09:44:44 +08:00
<u-empty v-if="loadConfig.status=='nomore'&& list2.length==0" text="没有信息"
icon="/static/empty/data.png"></u-empty>
<u-loadmore v-else :status="loadConfig.status" :loading-text="loadConfig.loadingText"
:loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" />
2023-11-05 00:11:08 +08:00
</view>
</template>
<script>
import {
Toast
} from '@/libs/uniApi.js'
import {
2023-11-20 18:23:46 +08:00
expenstopay,
2023-11-05 00:11:08 +08:00
appexpenseindex,
apexpenselist,
appexpensecopy
} from '@/api/oa.js'
2023-11-20 18:23:46 +08:00
import liuswipeaction from '@/uni_modules/liu-swipe-action/components/liu-swipe-action/liu-swipe-action.vue'
2023-11-05 00:11:08 +08:00
export default {
2023-11-20 18:23:46 +08:00
components: {
'liu-swipe-action': liuswipeaction
},
2023-11-05 00:11:08 +08:00
data() {
return {
title: 'Hello',
statusBarHeight: 0,
list: [{
name: '我发起的',
value: 8
}, {
name: '我处理的',
value: 8
},
{
name: '抄送给我的',
value: 8
}
],
list2: [],
num: 0,
2023-11-09 09:44:44 +08:00
btnList: [],
2023-11-20 18:23:46 +08:00
btnList1: [{
id: '2',
name: '开票',
width: '100rpx',
bgColor: '#ed656d',
color: '#FFFFFF',
fontSize: '28rpx'
}],
2023-11-05 00:11:08 +08:00
loadConfig: {
page: 1,
limit: 5,
loadingText: '努力加载中',
loadmoreText: '轻轻上拉',
nomoreText: '我也是有底线的~~',
status: 'loadmore'
},
}
},
onLoad() {
},
onShow() {
if (this.num == 0) {
this.initList()
} else if (this.num == 1) {
this.initList1()
} else {
this.initList2()
}
},
onReachBottom() {
if (this.num == 0) {
this.getlist()
} else if (this.num == 1) {
this.getlist1()
} else {
this.getlist2()
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
},
methods: {
apparent(index) {
this.num = index
if (index == 0) {
this.initList()
} else if (index == 1) {
this.initList1()
} else {
this.initList2()
}
},
async initList() {
this.loadConfig.page = 1;
this.loadConfig.status = "loadmore";
this.list2 = [];
await this.getlist()
},
async initList1() {
this.loadConfig.page = 1;
this.loadConfig.status = "loadmore";
this.list2 = [];
await this.getlist1()
},
async initList2() {
this.loadConfig.page = 1;
this.loadConfig.status = "loadmore";
2023-11-09 09:44:44 +08:00
this.list2 = [];
2023-11-05 00:11:08 +08:00
await this.getlist2()
},
async getlist() {
if (this.loadConfig.status == "nomore") return;
this.loadConfig.status = "loading"
let res = await appexpenseindex({
page: this.loadConfig.page,
limit: this.loadConfig.limit,
// keyword: this.keyword
})
this.loadConfig.status = "loadmore"
if (res.data.data.length < this.loadConfig.limit) {
this.loadConfig.status = "nomore"
} else {
this.loadConfig.page++;
}
this.list2 = [...this.list2, ...res.data?.data]
},
async getlist1() {
if (this.loadConfig.status == "nomore") return;
this.loadConfig.status = "loading"
let res = await apexpenselist({
page: this.loadConfig.page,
limit: this.loadConfig.limit,
// keyword: this.keyword
})
this.loadConfig.status = "loadmore"
if (res.data.data.length < this.loadConfig.limit) {
this.loadConfig.status = "nomore"
} else {
this.loadConfig.page++;
}
this.list2 = [...this.list2, ...res.data?.data]
},
async getlist2() {
if (this.loadConfig.status == "nomore") return;
this.loadConfig.status = "loading"
let res = await appexpensecopy({
page: this.loadConfig.page,
limit: this.loadConfig.limit,
// keyword: this.keyword
})
this.loadConfig.status = "loadmore"
if (res.data.data.length < this.loadConfig.limit) {
this.loadConfig.status = "nomore"
} else {
this.loadConfig.page++;
}
this.list2 = [...this.list2, ...res.data?.data]
},
//添加项目
adddepart() {
uni.navigateTo({
url: '/pages/addquest/index?type=' + 0
})
},
//删除弹窗
clickItem(data) {
2023-11-20 18:23:46 +08:00
// //console.log(e)
2023-11-05 00:11:08 +08:00
if (data.id == 2) {
uni.showModal({
2023-11-20 18:23:46 +08:00
content: '是否设置为已打款状态',
2023-11-05 00:11:08 +08:00
success: (e) => {
if (e.confirm) {
2023-11-20 18:23:46 +08:00
this.deleteDepartment(this.list2[data.index].id)
2023-11-05 00:11:08 +08:00
}
}
})
} else {
this.editpart(this.list2[data.index])
}
},
//删除
async deleteDepartment(id) {
2023-11-20 18:23:46 +08:00
const res = await expenstopay({
2023-11-05 00:11:08 +08:00
id: id
})
2023-11-20 18:23:46 +08:00
//console.log(res,id)
2023-11-05 00:11:08 +08:00
if (res.code == 0) {
2023-11-20 18:23:46 +08:00
2023-11-09 09:44:44 +08:00
if (this.num == 0) {
this.initList()
} else if (this.num == 1) {
this.initList1()
} else {
this.initList2()
}
2023-11-05 00:11:08 +08:00
}
Toast(res.msg);
},
//编辑项目
editpart(item) {
uni.navigateTo({
2023-11-09 09:44:44 +08:00
url: '/pages/reimbursementapplication/index??type=' + item.type
2023-11-05 00:11:08 +08:00
})
},
tian(item) {
if (this.num == 1) {
uni.navigateTo({
url: '/pages/reimbursementapplication/handle?type=' + item.id
})
2023-11-09 09:44:44 +08:00
} else if (this.num == 2) {
2023-11-05 00:11:08 +08:00
uni.navigateTo({
2023-11-09 09:44:44 +08:00
url: '/pages/reimbursementapplication/detail?type=' + item.id + '&num=0'
2023-11-05 00:11:08 +08:00
})
2023-11-09 09:44:44 +08:00
} else {
2023-11-05 00:11:08 +08:00
uni.navigateTo({
2023-11-09 09:44:44 +08:00
url: '/pages/reimbursementapplication/detail?type=' + item.id
2023-11-05 00:11:08 +08:00
})
}
2023-11-09 09:44:44 +08:00
2023-11-05 00:11:08 +08:00
}
}
}
</script>
<style lang='scss'>
.content-banner {
display: flex;
justify-content: space-between;
padding: 20rpx 40rpx;
.banner-name {
font-size: 32rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
}
.banner-xian {
width: 70rpx;
height: 5rpx;
margin: 10rpx auto;
background-color: #3274F9;
}
}
.content-middle {
.content-middle-one {
.middle-one {
width: 694rpx;
margin: 0 auto;
margin-bottom: 21rpx;
background: #FFFFFF;
padding: 0 25rpx;
padding-bottom: 25rpx;
.middle-edit {
width: 645rpx;
height: 63rpx;
line-height: 63rpx;
background: #e6e5d9;
text-align: center;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #000;
margin-bottom: 20rpx;
}
.middle-delete {
width: 645rpx;
height: 63rpx;
line-height: 63rpx;
background: #F02828;
text-align: center;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
}
.middle-one-title {
border-bottom: 1px solid #CCCCCC;
margin-bottom: 10rpx;
display: flex;
line-height: 82rpx;
justify-content: space-between;
.one-titlea {
display: flex;
.name {
font-size: 32rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
}
.parment {
font-size: 25rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #3274F9;
margin-top: 5rpx;
margin-left: 10rpx;
}
}
.one-titleb {
font-size: 32rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
}
}
.middle-one-detail {
height: 90rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
}
.middle-one-time {
font-size: 25rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
margin-top: 20rpx;
margin-bottom: 20rpx;
}
}
}
}
</style>