Browse Source

上传票据

apply
song 4 years ago
parent
commit
6a05e2f8b5
  1. 8
      apis/ocr.js
  2. 29
      components/FinanceExamine.vue
  3. 21
      components/HistoricalApplication.vue
  4. 169
      pages/Initiate-application.vue
  5. 13
      pages/application-details.vue
  6. 278
      pages/financial-approval-details.vue
  7. 4
      plugins/vant.js

8
apis/ocr.js

@ -0,0 +1,8 @@
import http from 'apis/axios';
const apiUrl = import.meta.env.VITE_API_URL;
const ptccsens = `${apiUrl}/ptccsens/v1.0`;
const ocr = `${ptccsens}/ocr`;
// 发起申请
export const bill = `${ocr}/bill`;

29
components/FinanceExamine.vue

@ -1,19 +1,19 @@
<template> <template>
<div v-if="data.info.list && data.info.list.length"> <div v-if="data.info.list && data.info.list.length">
<div class="w-full overflow-x-scroll"> <div class="w-full overflow-x-scroll">
<table class="text-gray-500 mt-4 text-xs"> <table class="text-gray-500 mt-4">
<tr class="bg-gray-100"> <tr class="bg-gray-100">
<td width="15%">申请人</td> <td width="20%">申请人</td>
<td width="16%">金额()</td> <td width="25%">金额()</td>
<td width="20%">时间</td> <td width="30%">时间</td>
<td width="10%">操作</td> <td width="25%">操作</td>
</tr> </tr>
<tr v-for="item in data.info.list"> <tr v-for="item in data.info.list">
<td>{{item.submitName}}</td> <td @click="openDetails(item.applyId)">{{item.submitName}}</td>
<td>{{item.money}}</td> <td @click="openDetails(item.applyId)">{{item.money}}</td>
<td>{{dayjs(item.submitTime - 0).format('YYYY-MM-DD')}}</td> <td @click="openDetails(item.applyId)">{{dayjs(item.submitTime - 0).format('YYYY-MM-DD')}}</td>
<td> <td>
<div v-if="!item.applyType" class="flex flex-row justify-between"> <div v-if="!item.applyType" class="flex flex-row justify-around">
<van-button type="success" size="mini" class="rounded" @click="showRemark(item.financeCheckId, 1)">通过</van-button> <van-button type="success" size="mini" class="rounded" @click="showRemark(item.financeCheckId, 1)">通过</van-button>
<van-button type="danger" size="mini" class="rounded" @click="showRemark(item.financeCheckId, 2)">驳回</van-button> <van-button type="danger" size="mini" class="rounded" @click="showRemark(item.financeCheckId, 2)">驳回</van-button>
@ -40,6 +40,9 @@ import {ref, reactive, onMounted, nextTick} from'vue';
import { audit } from 'apis/finance'; import { audit } from 'apis/finance';
import { queryNeedCheckByMe } from 'apis/projectFinance'; import { queryNeedCheckByMe } from 'apis/projectFinance';
import { Toast } from 'vant'; import { Toast } from 'vant';
import { useRouter } from 'vue-router';
const router = useRouter()
const data = reactive({ const data = reactive({
info: {}, info: {},
@ -116,6 +119,14 @@ async function handleAudit(financeCheckId, checkStatus){
console.error('error: ', error); console.error('error: ', error);
} }
} }
//
function openDetails(applyId){
const routeValue = router.currentRoute.value;
const query = routeValue.query;
query.applyId = applyId;
router.push({ path: '/financial-approval-details', query });
}
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

21
components/HistoricalApplication.vue

@ -12,8 +12,8 @@
<td class="status">状态</td> <td class="status">状态</td>
</tr> </tr>
<tr v-for="item in data.info.list" class="text-gray-500"> <tr v-for="item in data.info.list" class="text-gray-500">
<td>{{ item.submitName }}</td> <td @click="openDetails(item.applyId)">{{ item.submitName }}</td>
<td> <td @click="openDetails(item.applyId)">
<!-- v-if="!item.showBudgetEdit" --> <!-- v-if="!item.showBudgetEdit" -->
{{ (+item.money / 100).toFixed(2) }} {{ (+item.money / 100).toFixed(2) }}
<!-- <van-field <!-- <van-field
@ -25,8 +25,8 @@
@blur="item.showBudgetEdit = false" @blur="item.showBudgetEdit = false"
/> --> /> -->
</td> </td>
<td> <td @click="openDetails(item.applyId)">
{{ dayjs(item.submitTime - 0).format('YYYY/MM/DD HH:mm') }} {{ dayjs(item.submitTime - 0).format('YYYY/MM/DD') }}
</td> </td>
<td> <td>
<!-- <div v-if="!item.showBonusEdit" @click="item.showBonusEdit = true"> --> <!-- <div v-if="!item.showBonusEdit" @click="item.showBonusEdit = true"> -->
@ -74,6 +74,9 @@
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { personalHistory } from 'apis/finance'; import { personalHistory } from 'apis/finance';
import { ref, reactive, onMounted, nextTick } from 'vue'; import { ref, reactive, onMounted, nextTick } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const data = reactive({ const data = reactive({
info: {}, info: {},
@ -124,6 +127,14 @@ onMounted(() => {
handlePersonalHistory(); handlePersonalHistory();
}); });
}); });
//
function openDetails(applyId){
const routeValue = router.currentRoute.value;
const query = routeValue.query;
query.applyId = applyId;
router.push({ path: '/application-details', query });
}
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
@ -141,7 +152,7 @@ table {
width: 100px; width: 100px;
} }
.time { .time {
width: 170px; width: 120px;
} }
.status { .status {
width: 120px; width: 120px;

169
pages/Initiate-application.vue

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<!-- 导航返回上一页 --> <!-- 导航返回上一页 -->
<van-nav-bar title="发起申请" left-arrow @click-left="onClickLeft" /> <van-nav-bar title="发起申请" left-arrow />
<!-- 申请发票需要输入的数据 --> <!-- 申请发票需要输入的数据 -->
<div class="bg-white pb-3"> <div class="bg-white pb-3">
<div class="text-gray-500 px-4 py-3 font-semibold">发票信息</div> <div class="text-gray-500 px-4 py-3 font-semibold">发票信息</div>
@ -22,20 +22,26 @@
>手动输入</van-button >手动输入</van-button
> >
</div> </div>
<!-- <van-overlay :show="data.showUploading"> -->
<div <div
class="text-center border-b w-52 h-24 bg-gray-100 border-dashed border-2" class="text-center border-b w-52 h-24 border-dashed border-2 upload-box"
@click="uploadBill"
v-show="!data.isSuccess" v-show="!data.isSuccess"
> >
<van-uploader v-model="data.fileList" multiple :max-count="1" :after-read="afterRead" class="z-50 opacity-0" />
<div class="upload-txt">
<p class="text-gray-400 text-xl pt-3">+</p> <p class="text-gray-400 text-xl pt-3">+</p>
<p class="text-gray-400 text-xs">上传并识别凭证</p> <p class="text-gray-400 text-xs">上传并识别凭证</p>
</div> </div>
<!-- <van-loading type="spinner" v-if="data.showUploading" class="upload-txt z-50" /> -->
</div>
<!-- </van-overlay> -->
<!-- 上传票据成功后显示发票信息 --> <!-- 上传票据成功后显示发票信息 -->
<div v-show="data.isSuccess"> <div v-show="data.isSuccess">
<van-field <van-field
v-for="item in data.invoiceInfo" v-for="item in data.invoiceInfo"
required required
v-model="item.values" v-model="item.value"
:label="item.name" :label="item.name"
@change="cahngeInvoiceList($event, item)" @change="cahngeInvoiceList($event, item)"
input-align="right" input-align="right"
@ -47,7 +53,7 @@
<div v-show="!data.isInvoice"> <div v-show="!data.isInvoice">
<van-field <van-field
required required
v-model="data.applyMoney" v-model="data.money"
label="申请金额" label="申请金额"
placeholder="输入申请金额" placeholder="输入申请金额"
input-align="right" input-align="right"
@ -80,13 +86,13 @@
class="button" class="button"
size="mini" size="mini"
v-for="item in data.reviewerList" v-for="item in data.reviewerList"
:key="item.userId" :key="item.memberId"
:type=" :type="
data.checkerList.find(checker => checker === item.userId) data.checkerList.find(checker => checker === item.memberId)
? 'primary' ? 'primary'
: 'default' : 'default'
" "
@click="handleSelectChecker(item.userId)" @click="handleSelectChecker(item.memberId)"
> >
{{ item.name }} {{ item.name }}
</van-button> </van-button>
@ -98,7 +104,7 @@
<div class="text-gray-500 p-4 font-semibold">其他信息</div> <div class="text-gray-500 p-4 font-semibold">其他信息</div>
<!-- 申请类型 --> <!-- 申请类型 -->
<!-- 普通票据申请 --> <!-- 普通票据申请 -->
<div v-show="data.isInvoice"> <div>
<van-field <van-field
v-model="data.applyType" v-model="data.applyType"
is-link is-link
@ -112,9 +118,11 @@
<van-popup v-model:show="data.showType" round position="bottom"> <van-popup v-model:show="data.showType" round position="bottom">
<van-picker <van-picker
title="申请类型" title="申请类型"
v-if="data.applyTypeOptions && data.applyTypeOptions.length"
:columns="data.applyTypeOptions" :columns="data.applyTypeOptions"
@confirm="finishApplyType" @confirm="finishApplyType"
/> />
<van-loading v-else class="my-20 text-center" />
</van-popup> </van-popup>
<!-- 所属项目 --> <!-- 所属项目 -->
<van-field <van-field
@ -133,6 +141,7 @@
<!-- 所属任务的 --> <!-- 所属任务的 -->
<van-field <van-field
v-model="data.taskName" v-model="data.taskName"
v-show="data.isInvoice"
is-link is-link
readonly readonly
label="所属任务" label="所属任务"
@ -157,13 +166,16 @@
<van-popup v-model:show="data.showCategory" round position="bottom"> <van-popup v-model:show="data.showCategory" round position="bottom">
<van-picker <van-picker
title="请选择类目" title="请选择类目"
v-if="data.applyCategoryOptions && data.applyCategoryOptions.length"
:columns="data.applyCategoryOptions" :columns="data.applyCategoryOptions"
@confirm="finishApplyCategory" @confirm="finishApplyCategory"
/> />
<van-loading v-else class="my-20 text-center" />
</van-popup> </van-popup>
<!-- 名目选择 --> <!-- 名目选择 -->
<van-field <van-field
v-model="data.applyName" v-model="data.applyName"
v-show="data.isInvoice"
is-link is-link
readonly readonly
label="名目" label="名目"
@ -174,28 +186,13 @@
<van-popup v-model:show="data.showName" round position="bottom"> <van-popup v-model:show="data.showName" round position="bottom">
<van-picker <van-picker
title="请选择名目" title="请选择名目"
v-if="data.applyNameOptions && data.applyNameOptions.length"
:columns="data.applyNameOptions" :columns="data.applyNameOptions"
@confirm="finishApplyName" @confirm="finishApplyName"
/> />
<van-loading v-else class="my-20 text-center" />
</van-popup> </van-popup>
</div> </div>
<!-- 个人手动申请 -->
<div v-show="!data.isInvoice">
<div class="pl-2">
<van-cell
title="单元格"
is-link
:value="data.personalType"
required
/>
<van-cell
title="单元格"
is-link
:value="data.personalCategory"
required
/>
</div>
</div>
</div> </div>
<!-- 提交人信息 --> <!-- 提交人信息 -->
<div class="bg-white mt-3"> <div class="bg-white mt-3">
@ -221,58 +218,62 @@
<div class="text-gray-500 font-semibold">历史申请</div> <div class="text-gray-500 font-semibold">历史申请</div>
<div> <div>
<Search /> <Search />
<FinanceExamine /> <HistoricalApplication />
</div> </div>
</div> </div>
<!-- 底部立即提交按钮 --> <!-- 底部立即提交按钮 -->
<div class="mx-6 mt-10"> <div class="mx-6 mt-10">
<van-button type="primary" size="small" block>立即提交</van-button> <van-button @click="submit" type="primary" size="small" block>立即提交</van-button>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import axios from 'axios';
import { ref, reactive } from 'vue'; import { ref, reactive } from 'vue';
// import useApplication from 'hooks/useApplication';
import { queryChecker } from 'apis/member'; import { queryChecker } from 'apis/member';
import { queryType } from 'apis/finance'; import { queryType, apply } from 'apis/finance';
import { bill } from 'apis/ocr';
// const getApplication = useApplication(); import { Toast } from 'vant';
const token = useToken()
const projectName = useProjectName(); const projectName = useProjectName();
const taskName = useTaskName(); const taskName = useTaskName();
const projectId = useProjectId(); const projectId = useProjectId();
const taskDetailId = useTaskId();
const data = reactive({ const data = reactive({
isInvoice: true, isInvoice: true,
fileList: [],
showUploading: false,
remark: '', remark: '',
invoiceList: [], invoiceList: [],
invoiceInfo: [ invoiceInfo: [
{ {
name: '发票代码', name: '发票代码',
values: 0, value: 0,
label: 'invoiceCode', label: 'invoiceCode',
}, },
{ {
name: '发票号码', name: '发票号码',
values: 1, value: 0,
label: 'invoiceNumber', label: 'invoiceNumber',
}, },
{ {
name: '合计金额(元)', name: '合计金额(元)',
values: 2, value: 0,
label: 'money', label: 'money',
}, },
{ {
name: '税额(元)', name: '税额(元)',
values: 3, value: 0,
label: 'taxMoney', label: 'taxMoney',
}, },
{ {
name: '开票日期', name: '开票日期',
values: 4, value: 0,
label: 'invoiceTime', label: 'invoiceTime',
}, },
{ {
name: '发票备注信息', name: '备注信息',
values: 5, value: '无',
label: 'remark', label: 'remark',
}, },
], ],
@ -286,6 +287,7 @@ const data = reactive({
currentPage: 0, // currentPage: 0, //
personalType: '个人申请', // personalType: '个人申请', //
personalCategory: '用款', personalCategory: '用款',
money: '',
// //
showType: false, // showType: false, //
applyTypes: [], applyTypes: [],
@ -304,9 +306,64 @@ const data = reactive({
rowId: '', rowId: '',
}); });
//
function upLoaderImg(file, url) { //file
//new FormData
let params = new FormData()
params.append('part', file)
let config = {
headers: { //
'Content-Type': 'multipart/form-data',
Authorization: 'Bearer ' + token.value
}
}
return new Promise((resolve, reject) => {
// uploadUrl
axios.post(`${bill}`, params, config).then(res => {
resolve(res)
}).catch(err => {
reject(err)
});
})
}
//
async function afterRead(file){
data.showUploading = true
//
upLoaderImg(file.file, 'upload').then(res => {
data.showUploading = false
if (res.data.code == 200) {
for(let key in res.data.data){
data.invoiceInfo.forEach(item => {
if(item.label === key){
if(item.label === 'money' || item.label === 'taxMoney'){
item.value = (+res.data.data[key] / 100).toFixed(2)
}
item.value = res.data.data[key]
console.log('item: ', item);
}
})
}
console.log('data.invoiceInfo: ', data.invoiceInfo);
data.invoiceList.push(res.data.data)
data.titleHidden = false;
data.isSuccess = true;
} else {
Toast.fail(res.data.msg || '上传失败')
}
})
}
// //
function cahngeInvoiceList(e, item) { function cahngeInvoiceList(e, item) {
console.log('e: ', e.target.value, item); console.log('e: ', e.target.value, item);
data.invoiceList.forEach(invoice => {
for(let key in data.invoiceList){
if(item.label === key){
invoice[key] = item.value
}
}
})
} }
// //
@ -347,15 +404,6 @@ function handleSelectChecker(id) {
} }
} }
//
function uploadBill() {
//TODO:
setTimeout(() => {
data.titleHidden = false;
data.isSuccess = true;
}, 1000);
}
/** /**
* 查询所有成员 * 查询所有成员
* @param { String } projectId * @param { String } projectId
@ -380,7 +428,6 @@ async function handleQueryChecker() {
* @param { Number } type 类型0申请类型 1类目 2名目 * @param { Number } type 类型0申请类型 1类目 2名目
*/ */
async function handleQueryType(parentId, type) { async function handleQueryType(parentId, type) {
console.log('parentId: ', parentId);
try { try {
const params = { const params = {
param: { param: {
@ -423,7 +470,7 @@ onMounted(() => {
* 发起申请 * 发起申请
* @param { Object } params * @param { Object } params
*/ */
async function submit(params) { async function submit() {
try { try {
if(!verification()) return if(!verification()) return
const params = {} const params = {}
@ -437,7 +484,8 @@ async function submit(params) {
} }
// //
function verification(){ function verification(){
const { isSuccess, categoryId, checkerList, department, money, rowId, submitName, typeId, isInvoice } = data const { isSuccess, invoiceInfo, categoryId, checkerList, department, money, rowId, submitName, typeId, isInvoice } = data
//
if(!isSuccess && isInvoice){ if(!isSuccess && isInvoice){
Toast.fail('请上传票据凭证'); Toast.fail('请上传票据凭证');
return return
@ -475,18 +523,14 @@ function verification(){
// //
function setParams(){ function setParams(){
const { remark, money, categoryId, checkerList, department, rowId, submitName, typeId, invoiceInfo, isInvoice } = data const { remark, money, categoryId, checkerList, department, rowId, submitName, typeId, invoiceInfo, isInvoice, invoiceList } = data
let param = {} let param = {}
let invoiceList = []
let list = {url: 'https://cdn.nlark.com/yuque/0/2022/png/413990/1642482454748-931b2e93-8964-492b-b06b-b8db42733c02.png'}
let totleMoney = 0 let totleMoney = 0
invoiceInfo.forEach(item => { invoiceInfo.forEach(item => {
list[item.label] = item.value
if(item.label === 'money'){ if(item.label === 'money'){
totleMoney += item.value - 0 totleMoney += ((item.value - 0)/100).toFixed(2)
} }
}) })
invoiceList.push(list)
if(isInvoice){ if(isInvoice){
param = { param = {
money: totleMoney * 100,invoiceList, remark, checkerList, typeId, projectId: projectId.value, money: totleMoney * 100,invoiceList, remark, checkerList, typeId, projectId: projectId.value,
@ -522,4 +566,15 @@ function setParams(){
padding: 0 0.75rem; padding: 0 0.75rem;
margin: 0.5rem; margin: 0.5rem;
} }
.upload-box{
background: #f7f8fa;
position: relative;
}
.upload-txt{
position: absolute;
width: 100%;
bottom: 22px;
}
</style> </style>

13
pages/application-details.vue

@ -50,11 +50,11 @@
</div> </div>
<div class="flex py-2 px-4 text-gray-400 text-base justify-between"> <div class="flex py-2 px-4 text-gray-400 text-base justify-between">
<div>合计金额()</div> <div>合计金额()</div>
<div>{{item.money}}</div> <div>{{ (+item.money / 100).toFixed(2) }}</div>
</div> </div>
<div class="flex py-2 px-4 text-gray-400 text-base justify-between"> <div class="flex py-2 px-4 text-gray-400 text-base justify-between">
<div>税额()</div> <div>税额()</div>
<div>{{item.taxMoney}}</div> <div>{{ (+item.taxMoney / 100).toFixed(2) }}</div>
</div> </div>
<div class="flex py-2 px-4 text-gray-400 text-base justify-between"> <div class="flex py-2 px-4 text-gray-400 text-base justify-between">
<div>开票日期</div> <div>开票日期</div>
@ -96,7 +96,10 @@
<script setup> <script setup>
import dayjs from "dayjs"; import dayjs from "dayjs";
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { getApplyDetail } from 'apis/finance' import { getApplyDetail } from 'apis/finance';
import { useRouter } from 'vue-router';
const router = useRouter();
// //
const currentRate = ref(0); const currentRate = ref(0);
const text = computed(() => currentRate.value.toFixed(0)); const text = computed(() => currentRate.value.toFixed(0));
@ -174,7 +177,9 @@ function onClickLeft(){
*/ */
async function handleApplyDetail(){ async function handleApplyDetail(){
try { try {
const params = {param : { applyId: '1485797754654695424' }} const routeValue = router.currentRoute.value;
const applyId = routeValue.query.applyId;
const params = {param : { applyId }}
const res = await getApplyDetail(params) const res = await getApplyDetail(params)
// //
checkerList.value = res.checkerList checkerList.value = res.checkerList

278
pages/financial-approval-details.vue

@ -7,9 +7,39 @@
/> />
<!-- 发票信息 --> <!-- 发票信息 -->
<div class="bg-white px-3"> <div class="bg-white px-3" v-if="isInvoice">
<div class="text-gray-500 font-semibold px-1 py-3 mt-5">发票信息</div> <div class="text-gray-500 font-semibold px-1 py-3">发票信息</div>
<div v-for="item in billList" class="flex p-2 text-gray-400 text-base justify-between"> <div v-for="(item,invoiceIndex) in invoiceList" :key="invoiceIndex">
<div class="flex py-2 px-4 text-gray-400 text-base justify-between">
<div>发票代码</div>
<div>{{item.invoiceCode}}</div>
</div>
<div class="flex py-2 px-4 text-gray-400 text-base justify-between">
<div>发票号码</div>
<div>{{item.invoiceNumber}}</div>
</div>
<div class="flex py-2 px-4 text-gray-400 text-base justify-between">
<div>合计金额()</div>
<div>{{ (+item.money / 100).toFixed(2) }}</div>
</div>
<div class="flex py-2 px-4 text-gray-400 text-base justify-between">
<div>税额()</div>
<div>{{ (+item.taxMoney / 100).toFixed(2) }}</div>
</div>
<div class="flex py-2 px-4 text-gray-400 text-base justify-between">
<div>开票日期</div>
<div>{{dayjs(item.invoiceTime - 0).format('YYYY年MM月DD日')}}</div>
</div>
<div class="flex py-2 px-4 text-gray-400 text-base justify-between">
<div>备注</div>
<div>{{item.remark}}</div>
</div>
</div>
</div>
<!-- 金额信息 -->
<div class="bg-white px-3" v-else>
<div class="text-gray-500 font-semibold px-1 py-3">发票信息</div>
<div v-for="(item,moneyIndex) in moneyInfo" :key="moneyIndex" class="flex py-2 px-4 text-gray-400 text-base justify-between">
<div>{{item.name}}</div> <div>{{item.name}}</div>
<div>{{item.value}}</div> <div>{{item.value}}</div>
</div> </div>
@ -17,167 +47,221 @@
<!-- 其他信息 --> <!-- 其他信息 -->
<div class="bg-white px-3"> <div class="bg-white px-3">
<div class="text-gray-500 font-semibold px-1 py-3 mt-5">其他信息</div> <div class="text-gray-500 font-semibold px-1 py-3 mt-5">其他信息</div>
<div v-for="item in otherData" class="flex p-2 text-gray-400 text-base justify-between"> <div v-for="(item,otherIndex) in otherData" :key="otherIndex" class="flex py-2 px-4 text-gray-400 text-base justify-between">
<div>{{item.name}}</div> <div>{{item.name}}</div>
<div>{{item.value}}</div> <div>{{item.value}}</div>
</div> </div>
</div> </div>
<!-- 提交人信息 --> <!-- 提交人信息 -->
<div class="bg-white px-3"> <div class="bg-white px-3 mb-5">
<div class="text-gray-500 font-semibold px-1 py-3 mt-5">提交人信息</div> <div class="text-gray-500 font-semibold px-1 py-3 mt-5">提交人信息</div>
<div v-for="item in submitter" class="flex p-2 text-gray-400 text-base justify-between"> <div v-for="(item, index) in submitter" :key="index" class="flex py-2 px-4 text-gray-400 text-base justify-between">
<div>{{item.name}}</div> <div>{{item.name}}</div>
<div>{{item.value}}</div> <div>{{item.value}}</div>
</div> </div>
</div> </div>
<!-- 审核人信息 --> <!-- 审核人信息 -->
<div class="bg-white px-3"> <div class="bg-white px-3 mb-5">
<div class="text-gray-500 font-semibold px-1 py-3 mt-5">审核结果</div> <div class="text-gray-500 font-semibold px-1 py-3">审核结果</div>
<div v-for="item in checkerList" class="flex p-3 text-gray-400 text-base justify-between"> <div v-for="(item, checkerIndex) in checkerList" :key="checkerIndex" class="flex py-3 px-4 text-gray-400 text-base justify-between">
<!-- 遍历的审核人的姓名建议和时间 -->
<div> <div>
<div>{{item.name}}</div> <div>{{item.checkerName}}</div>
<div class="text-sm pt-1">{{item.advice}}</div> <div class="text-sm pt-1">{{item.remark}}</div>
<div class="text-sm pt-1">{{item.checkedTime}}</div> <div class="text-sm pt-1">{{item.time}}</div>
</div> </div>
<!--其他审核人 --> <div class="text-center">
<div class="text-center" v-show="!item.isMine"> <div v-if="item.checkStatus == '1' || item.checkStatus == '2'" :class="item.checkStatus == '1' ? 'text-green-500' : item.checkStatus == '2' ? 'text-red-500' : ''">
<div :class="item.status === '1' ? 'text-green-500' : item.status === '2' ? 'text-red-500' : ''"> {{item.checkStatus == '1' ? '已通过' : item.checkStatus == '2' ? '已驳回' : '待审批'}}
{{item.status === '1' ? '已通过' : item.status === '2' ? '已驳回' : '待审批'}}
</div> </div>
<div v-if="item.score>0" class="mt-1 text-yellow-500"> <div class="text-center" v-else>
<van-circle <van-button type="success" round size="mini" class="button ml-5" @click="showRemark(item.financeCheckId, 1)">通过</van-button>
v-model:current-rate="item.score" <van-button type="danger" round size="mini" class="button" @click="showRemark(item.financeCheckId, 2)">驳回</van-button>
:rate="item.score"
:speed="100"
:text="item.score"
color="#ff6700"
:stroke-width="100"
/>
</div>
</div>
<!-- 当前审核人已审核完毕 -->
<div class="text-center" v-show="item.isMine && item.status !== '0'">
<div :class="item.status === '1' ? 'text-green-500' : item.status === '2' ? 'text-red-500' : ''">
{{item.status === '1' ? '已通过' : item.status === '2' ? '已驳回' : '待审批'}}
</div> </div>
<div v-if="item.score>0" class="mt-1 text-yellow-500"> <div v-if="item.checkStatus == '1' || item.checkStatus == '2'" class="mt-1">
<van-circle <van-circle
v-model:current-rate="item.score" v-model:current-rate="currentRate"
:rate="item.score" :rate="100"
:speed="100" :speed="100"
:text="item.score" :text="100"
class="w-12"
color="#ff6700" color="#ff6700"
:stroke-width="100" :stroke-width="100"
/> />
</div> </div>
</div> </div>
<!-- 当前审核人未审批状态 -->
<div class="text-center" v-show="item.isMine && item.status === '0'">
<van-button type="success" round size="mini" class="button ml-5">通过</van-button>
<van-button type="danger" round size="mini" class="button">驳回</van-button>
</div>
</div> </div>
</div> </div>
<van-dialog v-model:show="data.show" title="备注" show-cancel-button @confirm="handleAudit">
<van-field :border="data.border" v-model="data.remark" type="textarea" class="remark" placeholder="请输入备注" />
</van-dialog>
</div> </div>
</template> </template>
<script setup> <script setup>
import {ref} from 'vue' import dayjs from "dayjs";
// import { ref, computed } from 'vue';
const billList = ref([ import { getApplyDetail, audit } from 'apis/finance';
{ import { useRouter } from 'vue-router';
name: "发票代码", import { Toast } from 'vant';
value: "4154153125646",
}, const router = useRouter();
{
name: "发票号码", const data = reactive({
value: "545648789", show: false,
}, remark: '',
{ auditInfo: {},
name: "合计金额(元)", border: true
value: "40", })
}, //
{ const currentRate = ref(0);
name: "税额(元)", const text = computed(() => currentRate.value.toFixed(0));
value: "2", const isInvoice = ref(false)
}, const checkerList = ref([])
//
const invoiceList = ref([])
//
const moneyInfo = ref([
{ {
name: "开票日期", name: "申请金额",
value: "2022年1月2日", value: "",
label: "money",
}, },
{ {
name: "备注", name: "备注",
value: "业务支出", value: "",
label: "remark",
}, },
]) ])
// //
const otherData = ref([ const otherData = ref([
{ {
name: "申请类型", name: "申请类型",
value: "项目申请" value: "",
label: "typeName",
}, },
{ {
name: "所属项目", name: "所属项目",
value: "PT项目" value: "",
label: "projectName",
}, },
{ {
name: "所属任务", name: "所属任务",
value: "财务条界面设计" value: "",
label: "taskDetailName",
}, },
{ {
name: "类目", name: "类目",
value: "报销" value: "",
label: "categoryName",
}, },
{ {
name: "名目", name: "名目",
value: "业务招待费" value: "",
label: "rowName",
}, },
]) ])
// //
const submitter = ref([ const submitter = ref([
{ {
name:'姓名', name:'姓名',
value:'黛西' value:'',
label: "submitName",
}, },
{ {
name:'部门', name:'部门',
value:'软件部' value:'软件部',
label: "department",
}, },
{ {
name:'提交时间', name:'提交时间',
value:'2021/12/29 13:22' value:'',
}, label: "applyTime",
]);
//
const checkerList = ref([
{
name: "冯教授",
advice: "",
checkedTime: "",
status: "0",
isMine: "1",
},
{
name: "薇薇安",
advice: "很棒!",
checkedTime: "12/18 14:55",
status: "0",
score:''
}, },
{ ])
name: "小明",
advice: "很棒!",
checkedTime: "12/18 14:55",
status: "1",
score:'80'
}
]);
function onClickLeft(){ function onClickLeft(){
console.log('返回') console.log("上一页")
} }
/**
* 查询申请详情
* @param { Number } applyId 申请记录id
*/
async function handleApplyDetail(){
try {
const routeValue = router.currentRoute.value;
const applyId = routeValue.query.applyId;
const params = {param : { applyId }}
const res = await getApplyDetail(params)
//
checkerList.value = res.checkerList
//
isInvoice.value = res.invoiceList && res.invoiceList.length ? true : false;
invoiceList.value = res.invoiceList
for(let key in res){
moneyInfo.value.forEach(item => {
if(item.label === key){
item.value = res[key]
}
})
}
//
for(let key in res){
otherData.value.forEach(item => {
if(item.label === key){
item.value = res[key]
}
})
}
//
for(let key in res){
submitter.value.forEach(item => {
if(item.label === key){
item.value = res[key]
}
})
}
} catch (error) {
console.error('error: ', error);
}
}
handleApplyDetail()
//
function showRemark(financeCheckId, checkStatus){
data.show = true
data.auditInfo = { financeCheckId, checkStatus }
}
/**
* 审批
* @param { Number } checkStatus 审核状态 1已通过 2驳回
* @param { String } financeCheckId 审核id
* @param { String } remark 备注
*/
async function handleAudit(financeCheckId, checkStatus){
try {
const { auditInfo, remark } = data
const { financeCheckId, checkStatus } = data.auditInfo
const params = {
param:{
financeCheckId,
checkStatus,
remark: data.remark
}
}
await audit(params)
Toast('审批成功');
handleFinanceOfProject()
data.remark = ''
} catch (error) {
console.error('error: ', error);
}
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.van-circle{ .van-circle{
width: 2.5rem !important; width: 2.5rem !important;

4
plugins/vant.js

@ -25,6 +25,7 @@ import {
Dialog, Dialog,
Picker, Picker,
Loading, Loading,
Overlay
} from 'vant'; } from 'vant';
import { defineNuxtPlugin } from '#app'; import { defineNuxtPlugin } from '#app';
@ -53,5 +54,6 @@ export default defineNuxtPlugin(nuxtApp => {
.use(Popover) .use(Popover)
.use(Dialog) .use(Dialog)
.use(Picker) .use(Picker)
.use(Loading); .use(Loading)
.use(Overlay)
}); });

Loading…
Cancel
Save