Browse Source

我的历史申请

apply
aBin 4 years ago
parent
commit
3869ff242e
  1. 18
      apis/projectFinance.js
  2. 122
      components/BonusCollection.vue
  3. 155
      components/HistoricalApplication.vue
  4. 161
      pages/Initiate-application.vue
  5. 54
      pages/applicant.vue
  6. 4
      plugins/vant.js

18
apis/projectFinance.js

@ -5,19 +5,25 @@ const ptccsens = `${apiUrl}/ptccsens/v1.0`;
const projectFinance = `${ptccsens}/projectFinance`;
// 追加预算
export const addBudget = params => http.post(`${projectFinance}/addBudget`, params);
export const addBudget = params =>
http.post(`${projectFinance}/addBudget`, params);
// 查看所有的费用申请
export const queryAllMoneyApply = params => http.post(`${projectFinance}/queryAllMoneyApply`, params);
export const queryAllMoneyApply = params =>
http.post(`${projectFinance}/queryAllMoneyApply`, params);
// 查看项目下的财务信息
export const queryFinanceOfProject = params => http.post(`${projectFinance}/queryFinanceOfProject`, params);
export const queryFinanceOfProject = params =>
http.post(`${projectFinance}/queryFinanceOfProject`, params);
// 查看自己需要审批的申请
export const queryNeedCheckByMe = params => http.post(`${projectFinance}/queryNeedCheckByMe`, params);
export const queryNeedCheckByMe = params =>
http.post(`${projectFinance}/queryNeedCheckByMe`, params);
// 查看项目下的所有任务对应的财务信息
export const queryProjectFinance = params => http.post(`${projectFinance}/queryProjectFinance`, params);
export const queryProjectFinance = params =>
http.post(`${projectFinance}/queryProjectFinance`, params);
// 修改任务或项目的预算和奖金信息
export const updateFinance = params => http.post(`${projectFinance}/updateFinance`, params);
export const updateFinance = params =>
http.post(`${projectFinance}/updateFinance`, params);

122
components/BonusCollection.vue

@ -0,0 +1,122 @@
<template>
<div>
<div
v-if="data.info.list && data.info.list.length"
class="w-full overflow-x-scroll"
>
<table class="text-gray-500 mt-4 text-ms">
<tr class="bg-gray-100 text-gray-400">
<td class="name">申请人</td>
<td class="money">金额()</td>
<td class="time">时间</td>
<td class="remark">备注</td>
</tr>
<tr v-for="item in data.info.list" class="text-gray-500">
<td>{{ item.submitName }}</td>
<td>
{{ (+item.money / 100).toFixed(2) }}
</td>
<td>
{{ dayjs(item.submitTime - 0).format('YYYY/MM/DD HH:mm') }}
</td>
<td>
{{ item.remark }}
</td>
</tr>
</table>
<div class="w-1/2 mt-4 ml-48">
<van-pagination
v-model="data.pageNum"
:items-per-page="data.pageSize"
:page-count="data.pages"
mode="simple"
/>
</div>
</div>
<van-empty v-else description="暂无数据" />
</div>
</template>
<script setup>
import dayjs from 'dayjs';
import { personalHistory } from 'apis/finance';
import { ref, reactive, onMounted, nextTick } from 'vue';
const data = reactive({
info: {},
pageNum: 1,
pageSize: 10,
pages: 0,
});
const projectId = useProjectId();
const taskDetailId = useTaskId();
const taskName = useTaskName();
/**
* 查看当前用户的费用申请历史信息奖金
* @param { Number } pageNum
* @param { Number } pageSize
* @param { String } projectId
* @param { String } name
*/
async function handlePersonalHistory() {
try {
const params = {
param: {
pageNum: data.pageNum,
pageSize: data.pageSize,
projectId: projectId.value,
taskDetailId: taskDetailId.value,
taskName: taskName.value,
type: 1,
},
};
const res = await personalHistory(params);
data.info = res;
data.pageNum = res.pageNum ? +res.pageNum : 1;
data.pageSize = res.pageSize ? +res.pageSize : 10;
data.pages = res.pages ? +res.pages : 0;
} catch (error) {
console.error('error: ', error);
}
}
function confirm() {
alert('确认放款');
}
onMounted(() => {
nextTick(() => {
handlePersonalHistory();
});
});
</script>
<style scoped lang="less">
table {
width: 500px;
td {
border: 0.5px solid #ccc;
padding: 0.85rem;
width: 5.9375rem;
}
.name {
width: 100px;
}
.money {
width: 100px;
}
.time {
width: 170px;
}
.remark {
width: 120px;
}
}
.input-box {
padding: 0 !important;
border-bottom: 1px solid #ccc;
}
</style>

155
components/HistoricalApplication.vue

@ -0,0 +1,155 @@
<template>
<div>
<div
v-if="data.info.list && data.info.list.length"
class="w-full overflow-x-scroll"
>
<table class="text-gray-500 mt-4 text-ms">
<tr class="bg-gray-100 text-gray-400">
<td class="name">申请人</td>
<td class="money">金额()</td>
<td class="time">时间</td>
<td class="status">状态</td>
</tr>
<tr v-for="item in data.info.list" class="text-gray-500">
<td>{{ item.submitName }}</td>
<td>
<!-- v-if="!item.showBudgetEdit" -->
{{ (+item.money / 100).toFixed(2) }}
<!-- <van-field
v-else
v-model="item.budget"
type="number"
class="input-box"
@change="handleUpdateFinance(item)"
@blur="item.showBudgetEdit = false"
/> -->
</td>
<td>
{{ dayjs(item.submitTime - 0).format('YYYY/MM/DD HH:mm') }}
</td>
<td>
<!-- <div v-if="!item.showBonusEdit" @click="item.showBonusEdit = true"> -->
<span v-if="item.applyType - 0 === 0" class="text-gray-500">
待审核
</span>
<span v-else-if="item.applyType - 0 === 1" class="text-gray-500">
已通过
</span>
<span v-else-if="item.applyType - 0 === 2" class="text-red-500">
已驳回
</span>
<span v-else-if="item.applyType - 0 === 3" class="text-gray-500">
待放款
</span>
<van-button
v-else-if="item.applyType - 0 === 4"
type="success"
size="mini"
class="rounded"
@click="confirm"
>
确认
</van-button>
<span v-else-if="item.applyType - 0 === 5" class="text-green-500">
已确认
</span>
</td>
</tr>
</table>
<div class="w-1/2 mt-4 ml-48">
<van-pagination
v-model="data.pageNum"
:items-per-page="data.pageSize"
:page-count="data.pages"
mode="simple"
/>
</div>
</div>
<van-empty v-else description="暂无数据" />
</div>
</template>
<script setup>
import dayjs from 'dayjs';
import { personalHistory } from 'apis/finance';
import { ref, reactive, onMounted, nextTick } from 'vue';
const data = reactive({
info: {},
pageNum: 1,
pageSize: 10,
pages: 0,
});
const projectId = useProjectId();
const taskDetailId = useTaskId();
const taskName = useTaskName();
/**
* 查看当前用户的费用申请历史信息奖金
* @param { Number } pageNum
* @param { Number } pageSize
* @param { String } projectId
* @param { String } name
*/
async function handlePersonalHistory() {
try {
const params = {
param: {
pageNum: data.pageNum,
pageSize: data.pageSize,
projectId: projectId.value,
taskDetailId: taskDetailId.value,
taskName: taskName.value,
type: 0,
},
};
const res = await personalHistory(params);
data.info = res;
data.pageNum = res.pageNum ? +res.pageNum : 1;
data.pageSize = res.pageSize ? +res.pageSize : 10;
data.pages = res.pages ? +res.pages : 0;
} catch (error) {
console.error('error: ', error);
}
}
function confirm() {
alert('确认放款');
}
onMounted(() => {
nextTick(() => {
handlePersonalHistory();
});
});
</script>
<style scoped lang="less">
table {
width: 500px;
td {
border: 0.5px solid #ccc;
padding: 0.85rem;
width: 5.9375rem;
}
.name {
width: 100px;
}
.money {
width: 100px;
}
.time {
width: 170px;
}
.status {
width: 120px;
}
}
.input-box {
padding: 0 !important;
border-bottom: 1px solid #ccc;
}
</style>

161
pages/Initiate-application.vue

@ -27,10 +27,11 @@
<!-- 上传票据成功后显示发票信息 -->
<div v-show="data.isSuccess">
<van-field
v-for="item in data.billList"
v-for="item in data.invoiceInfo"
required
v-model="item.values"
:label="item.name"
@change="cahngeInvoiceList($event, item)"
input-align="right"
/>
</div>
@ -50,7 +51,7 @@
<div class="text-gray-500 py-4 pl-5">备注</div>
<van-cell-group>
<van-field
v-model="data.message"
v-model="data.remark"
rows="2"
autosize
type="textarea"
@ -99,12 +100,10 @@
input-align="right"
/>
<van-popup v-model:show="data.showType" round position="bottom">
<van-cascader
:options="data.applyTypeOptions"
@close="data.showType = false"
@finish="finishApplyType"
active-color="#1989fa"
class="p-0"
<van-picker
title="申请类型"
:columns="data.applyTypeOptions"
@confirm="finishApplyType"
/>
</van-popup>
<!-- 所属项目 -->
@ -152,12 +151,10 @@
input-align="right"
/>
<van-popup v-model:show="data.showCategory" round position="bottom">
<van-cascader
:options="data.applyCategoryOptions"
@close="data.showCategory = false"
@finish="finishApplyCategory"
active-color="#1989fa"
class="p-0"
<van-picker
title="请选择类目"
:columns="data.applyCategoryOptions"
@confirm="finishApplyCategory"
/>
</van-popup>
<!-- 名目选择 -->
@ -171,12 +168,10 @@
input-align="right"
/>
<van-popup v-model:show="data.showName" round position="bottom">
<van-cascader
:options="data.applyNameOptions"
@close="data.showName = false"
@finish="finishApplyName"
active-color="#1989fa"
class="p-0"
<van-picker
title="请选择名目"
:columns="data.applyNameOptions"
@confirm="finishApplyName"
/>
</van-popup>
</div>
@ -194,31 +189,19 @@
<div class="text-gray-500 p-4 font-semibold">提交人信息</div>
<van-field
required
v-model="data.name"
v-model="data.submitName"
label="姓名"
placeholder="输入姓名"
placeholder="输入姓名"
input-align="right"
/>
<!-- 选择所属部门 -->
<van-field
v-model="data.applyDepartment"
is-link
readonly
label="所属部门"
placeholder="请选择所属部门"
@click="data.showDepartment = true"
required
v-model="data.department"
label="所属部门"
placeholder="请输入所属部门"
input-align="right"
/>
<van-popup v-model:show="data.showDepartment" round position="bottom">
<van-cascader
:options="data.applyDepartmentOptions"
@close="data.showDepartment = false"
@finish="finishApplyDepartment"
active-color="#1989fa"
class="p-0"
/>
</van-popup>
</div>
<!-- 历史申请 -->
<div class="bg-white mt-3 p-4">
@ -246,28 +229,39 @@ const taskName = useTaskName()
const projectId = useProjectId()
const data = reactive({
isInvoice: true,
message: '',
billList: [
remark: '',
invoiceList: [],
invoiceInfo: [
{
name: '发票代码',
values:0
values:0,
label: 'invoiceCode'
},
{
name: '发票号码',
values:1
values:1,
label: 'invoiceNumber'
},
{
name: '合计金额(元)',
values:2
values:2,
label: 'money'
},
{
name: '税额(元)',
values:3
values:3,
label: 'taxMoney'
},
{
name: '开票日期',
values:4
}
values:4,
label: 'invoiceTime'
},
{
name: '发票备注信息',
values:5,
label: 'remark'
},
],
reviewerList: [], //
checkerList: [], //
@ -286,7 +280,8 @@ const data = reactive({
},
], //
isSuccess: false, //
name: '', //
submitName: '', //
department: '', //
pplyMoney: '5000', //
titleHidden: true, //
currentPage: 0, //
@ -294,41 +289,53 @@ const data = reactive({
personalCategory: '用款',
//
showType: false, //
applyProject: '', //
applyTypes: [],
applyTypeOptions: [],
applyType: '', //
typeId: '',
showCategory: false, //
applyCategory: '', //
applyCategories: [],
applyCategoryOptions: [],
applyCategory: '', //
categoryId: '',
showName: false, //
applyName: '', //
applyNames: [],
applyNameOptions: [],
showDepartment: false, //
applyDepartment: '', //
applyDepartmentOptions: [],
applyName: '', //
rowId: '',
})
//
function cahngeInvoiceList(e,item){
console.log('e: ', e.target.value,item);
}
//
function finishApplyType({ selectedOptions }){
showType.value = false;
applyType.value = selectedOptions.map((option) => option.text);
function finishApplyType(e){
data.showType = false;
data.applyType = e;
const type = data.applyTypes.find((option) => option.name === e);
data.typeId = type.id;
//
handleQueryType(data.typeId, 1)
}
//
function finishApplyCategory({ selectedOptions }){
showCategory.value = false;
applyCategory.value = selectedOptions.map((option) => option.text);
function finishApplyCategory(e){
data.showCategory = false;
data.applyCategory = e;
const category = data.applyCategories.find((option) => option.name === e);
data.categoryId = category.id;
//
handleQueryType(data.categoryId, 2)
}
//
function finishApplyName({ selectedOptions }){
showName.value = false;
applyName.value = selectedOptions.map((option) => option.text);
}
//
function finishApplyDepartment({ selectedOptions }){
showDepartment.value = false;
applyDepartment.value = selectedOptions.map((option) => option.text);
function finishApplyName(e){
data.showName = false;
data.applyName = e;
const row = data.applyNames.find((option) => option.name === e);
data.rowId = row.id;
}
//
@ -345,8 +352,8 @@ function handleSelectChecker(id){
function uploadBill(){
//TODO:
setTimeout(() =>{
titleHidden.value = false
isSuccess.value = true
data.titleHidden = false
data.isSuccess = true
},1000)
}
@ -374,6 +381,7 @@ async function handleQueryChecker(){
* @param { Number } type 类型0申请类型 1类目 2名目
*/
async function handleQueryType(parentId, type){
console.log('parentId: ', parentId);
try {
const params = {
param:{
@ -382,9 +390,24 @@ async function handleQueryType(parentId, type){
}
}
const res = await queryType(params)
if(type === 0){
data.applyTypes = res
res.forEach((item) => {
data.applyTypeOptions.push(item.name)
})
}
if(type === 1){
data.applyCategories = res
res.forEach((item) => {
data.applyCategoryOptions.push(item.name)
})
}
if(type === 2){
data.applyNames = res
res.forEach((item) => {
data.applyNameOptions.push(item.name)
})
}
} catch (error) {
console.error('error: ', error);
}

54
pages/applicant.vue

@ -1,13 +1,18 @@
<template>
<div>
<!-- 搜索框与表格部分 -->
<van-tabs v-model:active="active" shrink line-width="60px" color="#59B4FF" title-active-color="#59B4FF">
<van-tabs
v-model:active="active"
shrink
line-width="60px"
color="#59B4FF"
title-active-color="#59B4FF"
>
<van-tab title="我的申请">
<div class="mt-8 bg-white flex flex-col">
<div class="p-4 pb-0 text-gray-500 font-semibold">历史申请</div>
<Search class="px-4 pt-0"/>
<FinanceManage class="px-4 mt-0"/>
<Search class="px-4 pt-0" />
<HistoricalApplication class="px-4 mt-0" />
</div>
<!-- <div class="mt-8 bg-white">
<span class="p-4 pb-0 text-gray-500 font-semibold">历史申请</span>
@ -28,51 +33,56 @@
<van-tab title="我的奖金">
<div class="mt-8 bg-white">
<div class="p-4 pb-0 text-gray-500 font-semibold">奖金领取记录</div>
<Search class="px-4 pt-0"/>
<FinanceManage class="px-4 mt-0"/>
<Search class="px-4 pt-0" />
<BonusCollection class="px-4 mt-0" />
</div>
<div class="my-4 bg-white">
<div class="text-gray-500 font-semibold m-4 py-3 border-b">待领取奖金</div>
<div class="text-gray-500 font-semibold m-4 py-3 border-b">
待领取奖金
</div>
<div class="text-ms text-gray-400 pl-4">可领取:</div>
<div class="w-full h-20 text-gray-400 font-semibold text-center leading-loose" v-if="!isBonus">
<div
class="w-full h-20 text-gray-400 font-semibold text-center leading-loose"
v-if="!isBonus"
>
暂无可领取的奖金
</div>
<div class="w-full h-20 text-blue-500 font-semibold text-center leading-loose text-2xl" v-if="isBonus">
<div
class="w-full h-20 text-blue-500 font-semibold text-center leading-loose text-2xl"
v-if="isBonus"
>
500
</div>
<div class="px-8">
<van-button type="primary" size="small" block :disabled="!isBonus" >立即领取</van-button>
<van-button type="primary" size="small" block :disabled="!isBonus"
>立即领取</van-button
>
</div>
</div>
</van-tab>
</van-tabs>
</div>
</template>
<script setup>
import {ref} from 'vue'
import { ref } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const active = ref(0);
const isShow = ref(true);
const isBonus =ref(true)
const isBonus = ref(true);
function onClickLeft(){
console.log('返回上一页')
function onClickLeft() {
console.log('返回上一页');
}
function toApplication() {
const routeValue = router.currentRoute.value;
const query = routeValue.query
router.push({path: '/Initiate-application', query})
const query = routeValue.query;
router.push({ path: '/Initiate-application', query });
}
</script>
<style lang="less" scoped>
</style>
<style lang="less" scoped></style>

4
plugins/vant.js

@ -22,7 +22,8 @@ import {
Circle,
Empty,
Popover,
Dialog
Dialog,
Picker,
} from 'vant';
import { defineNuxtPlugin } from '#app';
@ -50,4 +51,5 @@ export default defineNuxtPlugin(nuxtApp => {
.use(Empty)
.use(Popover)
.use(Dialog)
.use(Picker);
});

Loading…
Cancel
Save