|
|
|
@ -3,7 +3,7 @@
|
|
|
|
|
<a-modal width="1600px" @cancel="open = false" :visible="open" title="添加发票申请明细" :footer="null">
|
|
|
|
|
<div style="padding-bottom:5px ;">
|
|
|
|
|
<div>
|
|
|
|
|
<BasicTable class="ds-table" @row-click="handleClick" @register="registerTable" >
|
|
|
|
|
<BasicTable class="ds-table" @row-click="handleClick" @register="registerTable">
|
|
|
|
|
<template #right>
|
|
|
|
|
<div style="width: 40%;margin-left: 10px;margin-top:10px;">
|
|
|
|
|
<div>
|
|
|
|
@ -14,11 +14,6 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:bodyCell="{ column, record }">
|
|
|
|
|
<template v-if="column.dataIndex == 'applyAmount'">
|
|
|
|
|
<a-input-number @change="onSelectAmount" :precision="2" size="small"
|
|
|
|
|
:controls="false" :max="record.restAmount"
|
|
|
|
|
v-model:value="record.applyAmount" />
|
|
|
|
|
</template>
|
|
|
|
|
<template v-if="column.dataIndex == 'feeType'">
|
|
|
|
|
<span v-if="record.feeType == 1">应收</span>
|
|
|
|
|
<span v-if="record.feeType == 2">应付</span>
|
|
|
|
@ -62,20 +57,23 @@
|
|
|
|
|
v-model:value="item.reverseRate" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</a-modal>
|
|
|
|
|
<a-modal width="1600px" @cancel="freeFlag = false" :visible="freeFlag" title="添加发票申请明细" :footer="null">
|
|
|
|
|
<div style="padding-bottom:5px ;">
|
|
|
|
|
<div>
|
|
|
|
|
<BasicTable class="ds-table" @row-click="handleClickFree" @register="registerTableFree">
|
|
|
|
|
<template #right>
|
|
|
|
|
<div style="width: 40%;margin-left: 10px;margin-top:10px;">
|
|
|
|
|
<div style="width: 40%;margin-left: 10px;">
|
|
|
|
|
<div>
|
|
|
|
|
<BasicTable class="ds-table" @register="registerTable1">
|
|
|
|
|
<BasicTable class="ds-table" @register="registerTableFreeDetail">
|
|
|
|
|
<template #tableTitle>
|
|
|
|
|
<div>
|
|
|
|
|
<span class="bold">发票申请明细</span>
|
|
|
|
|
</div>
|
|
|
|
|
<a-button type="link" @click="handleAddDetial">
|
|
|
|
|
<span class="iconfont icon-jia"></span>
|
|
|
|
|
添加到发票费用明细
|
|
|
|
|
</a-button>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:bodyCell="{ column, record }">
|
|
|
|
|
<template v-if="column.dataIndex == 'applyAmount'">
|
|
|
|
@ -97,14 +95,12 @@
|
|
|
|
|
<div>
|
|
|
|
|
<div>
|
|
|
|
|
<span class="bold">发票申请</span>
|
|
|
|
|
<a-button v-repeat type="link" @click="addDetailed()">
|
|
|
|
|
<a-button v-repeat type="link" @click="addDetailFree">
|
|
|
|
|
<span class="iconfont icon-jia"></span>
|
|
|
|
|
添加申请明细
|
|
|
|
|
</a-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:bodyCell="{ column, record }">
|
|
|
|
|
<template v-if="column.dataIndex == 'businessType'">
|
|
|
|
@ -112,6 +108,21 @@
|
|
|
|
|
</template>
|
|
|
|
|
</template>
|
|
|
|
|
</BasicTable>
|
|
|
|
|
<div class="total">
|
|
|
|
|
<span style="margin-right: 10px;">合计:</span>
|
|
|
|
|
<span class="total-item">
|
|
|
|
|
<span class="text">RMB未开:</span>
|
|
|
|
|
<span class="number">{{ rmbTotal }}</span>
|
|
|
|
|
</span>
|
|
|
|
|
<span class="total-item">
|
|
|
|
|
<span class="text">USD未开:</span>
|
|
|
|
|
<span class="number">{{ usdTotal }}</span>
|
|
|
|
|
</span>
|
|
|
|
|
<span class="total-item">
|
|
|
|
|
<span class="text">其他未开:</span>
|
|
|
|
|
<span class="number">{{ otherTotal }}</span>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</a-modal>
|
|
|
|
@ -123,15 +134,75 @@
|
|
|
|
|
import { formatParams } from '/@/hooks/web/common'
|
|
|
|
|
import { ref, defineExpose, watch } from 'vue'
|
|
|
|
|
import { BasicTable, useTable, TableAction } from '/@/components/Table'
|
|
|
|
|
import { applyColums, applySearch, applyColumsDetail,freeSearch,freeColums } from '../columns'
|
|
|
|
|
import { GetApplicationList, GetApplicationDetails, GetExchangeRate,FreeInvoiceGetBizList,FreeInvoiceGetFees } from '../api.js'
|
|
|
|
|
import { applyColums, applySearch, applyColumsDetail, freeSearch, freeColums } from '../columns'
|
|
|
|
|
import { GetApplicationList, GetApplicationDetails, GetExchangeRate, FreeInvoiceGetBizList, FreeInvoiceGetFees, GetCurrencies } from '../api.js'
|
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
|
const { createMessage } = useMessage()
|
|
|
|
|
import { useRoute } from 'vue-router'
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
const open = ref(false)
|
|
|
|
|
const columnsFreeDetail = [
|
|
|
|
|
{
|
|
|
|
|
title: '结费单位',
|
|
|
|
|
dataIndex: 'customerName',
|
|
|
|
|
width: 100,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '收付',
|
|
|
|
|
dataIndex: 'feeType',
|
|
|
|
|
width: 50,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '费用名称',
|
|
|
|
|
dataIndex: 'feeName',
|
|
|
|
|
width: 80,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '金额',
|
|
|
|
|
dataIndex: 'amount',
|
|
|
|
|
width: 60,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '币别',
|
|
|
|
|
dataIndex: 'currency',
|
|
|
|
|
width: 60,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '未开票金额',
|
|
|
|
|
dataIndex: 'restAmount',
|
|
|
|
|
width: 100,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '本次开票金额',
|
|
|
|
|
dataIndex: 'applyAmount',
|
|
|
|
|
width: 100,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '原始汇率',
|
|
|
|
|
dataIndex: 'exchangeRate',
|
|
|
|
|
width: 80,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '录入人',
|
|
|
|
|
dataIndex: 'createByName',
|
|
|
|
|
width: 80,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '销项/进项',
|
|
|
|
|
dataIndex: 'name',
|
|
|
|
|
width: 80,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '录入方式',
|
|
|
|
|
dataIndex: 'inputMethod',
|
|
|
|
|
width: 80,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
const queryDataFree = ref({})
|
|
|
|
|
const dataSource = ref([]) as any
|
|
|
|
|
const freeDetailList = ref([]) as any
|
|
|
|
|
const [registerTable, { getForm, setSelectedRowKeys, getSelectRows, setProps, getRawDataSource, setLoading }] = useTable({
|
|
|
|
|
api: async (p) => {
|
|
|
|
|
const res: API.DataResult = await GetApplicationList(p)
|
|
|
|
@ -176,7 +247,7 @@ const [registerTable1, { getSelectRows: getSelectRowsFee, setProps: setPropsFee,
|
|
|
|
|
canResize: true,
|
|
|
|
|
immediate: false,
|
|
|
|
|
})
|
|
|
|
|
const [registerTableFree, { getForm:getFormFree, setSelectedRowKeys:setSelectedRowKeysFree, getSelectRows:getSelectRowsFree }] = useTable({
|
|
|
|
|
const [registerTableFree, { getForm: getFormFree, setSelectedRowKeys: setSelectedRowKeysFree, getSelectRows: getSelectRowsFree, getRawDataSource: getRawDataSourceFree }] = useTable({
|
|
|
|
|
api: async (p) => {
|
|
|
|
|
const res: API.DataResult = await FreeInvoiceGetBizList(p)
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
@ -184,18 +255,23 @@ const [registerTableFree, { getForm:getFormFree, setSelectedRowKeys:setSelectedR
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
beforeFetch: (p) => {
|
|
|
|
|
return formatParams(p)
|
|
|
|
|
const data = formatParams(p)
|
|
|
|
|
data.otherQueryCondition = getFormFree().getFieldsValue().FeeRange
|
|
|
|
|
queryDataFree.value = JSON.parse(JSON.stringify(p))
|
|
|
|
|
return data
|
|
|
|
|
},
|
|
|
|
|
columns: freeColums,
|
|
|
|
|
formConfig: {
|
|
|
|
|
labelWidth: 120,
|
|
|
|
|
schemas: freeSearch,
|
|
|
|
|
},
|
|
|
|
|
rowSelection: {
|
|
|
|
|
onChange: onSelectChange
|
|
|
|
|
},
|
|
|
|
|
useSearchForm: true,
|
|
|
|
|
showIndexColumn: false,
|
|
|
|
|
maxHeight: '600',
|
|
|
|
|
pagination: true,
|
|
|
|
|
rowSelection: {},
|
|
|
|
|
striped: true,
|
|
|
|
|
bordered: true,
|
|
|
|
|
indexColumnProps: {
|
|
|
|
@ -207,14 +283,138 @@ const [registerTableFree, { getForm:getFormFree, setSelectedRowKeys:setSelectedR
|
|
|
|
|
const exchangeFlag = ref(false)
|
|
|
|
|
const freeFlag = ref(false)
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
const [registerTableFreeDetail, { getSelectRows: getSelectRowsFeeDetail, setProps: setPropsFeeDetail, setTableData: setTableDataDetail }] = useTable({
|
|
|
|
|
columns: columnsFreeDetail,
|
|
|
|
|
useSearchForm: false,
|
|
|
|
|
showIndexColumn: false,
|
|
|
|
|
maxHeight: '600',
|
|
|
|
|
pagination: false,
|
|
|
|
|
dataSource: freeDetailList.value,
|
|
|
|
|
striped: true,
|
|
|
|
|
rowKey: 'recordId',
|
|
|
|
|
rowSelection: {
|
|
|
|
|
// onChange: onSelectAmount
|
|
|
|
|
},
|
|
|
|
|
bordered: true,
|
|
|
|
|
indexColumnProps: {
|
|
|
|
|
width: 60,
|
|
|
|
|
},
|
|
|
|
|
canResize: true,
|
|
|
|
|
immediate: false,
|
|
|
|
|
})
|
|
|
|
|
const rmbTotal = ref(0)
|
|
|
|
|
const usdTotal = ref(0)
|
|
|
|
|
const otherTotal = ref(0)
|
|
|
|
|
function onSelectChange(selectedRowKeys) {
|
|
|
|
|
const list = getSelectRowsFree()
|
|
|
|
|
console.log(list, selectedRowKeys)
|
|
|
|
|
rmbTotal.value = 0
|
|
|
|
|
usdTotal.value = 0
|
|
|
|
|
otherTotal.value = 0
|
|
|
|
|
list.forEach(item => {
|
|
|
|
|
rmbTotal.value += Number(item.unBilledRMB)
|
|
|
|
|
usdTotal.value += Number(item.unBilledUSD)
|
|
|
|
|
otherTotal.value += Number(item.unBilledOther)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleAddDetial() {
|
|
|
|
|
let arr = getSelectRowsFeeDetail() ? getSelectRowsFeeDetail() : []
|
|
|
|
|
if (arr.length == 0) {
|
|
|
|
|
createMessage.error('请选择费用明细')
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
changeApply()
|
|
|
|
|
}
|
|
|
|
|
function changeApply() {
|
|
|
|
|
const arr = getSelectRowsFeeDetail()
|
|
|
|
|
const exchangeArr = [] as any
|
|
|
|
|
if (arr.length > 0) {
|
|
|
|
|
exchangarr.value = []
|
|
|
|
|
arr.forEach(item => {
|
|
|
|
|
if (item.currency != 'RMB') {
|
|
|
|
|
exchangeArr.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const filteredItems = exchangeArr.filter((item, index, self) =>
|
|
|
|
|
index === self.findIndex((t) => t.currency === item.currency)
|
|
|
|
|
);
|
|
|
|
|
if (filteredItems.length > 0) {
|
|
|
|
|
const promises = filteredItems.map(item => {
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
const data = {
|
|
|
|
|
currencyFrom: 'RMB',
|
|
|
|
|
currencyTo: item.currency,
|
|
|
|
|
feeType: item.feeType
|
|
|
|
|
}
|
|
|
|
|
GetExchangeRate(data).then(res => {
|
|
|
|
|
exchangarr.value.push(res.data)
|
|
|
|
|
resolve(true);
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return Promise.all(promises).then(() => {
|
|
|
|
|
freeType.value = 'right'
|
|
|
|
|
exchangeFlag.value = true
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (filteredItems.length == 0) {
|
|
|
|
|
open.value = false
|
|
|
|
|
emits('updateListFree', arr)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const freeType = ref('')
|
|
|
|
|
function addDetailFree() {
|
|
|
|
|
let arr = getSelectRowsFree() ? getSelectRowsFree() : []
|
|
|
|
|
if (arr.length == 0) {
|
|
|
|
|
createMessage.error('请选择发票')
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
let freeList = [] as any
|
|
|
|
|
arr.forEach(item => {
|
|
|
|
|
freeList.push({
|
|
|
|
|
id: item.id,
|
|
|
|
|
businessType: item.businessType,
|
|
|
|
|
customerId: item.customerId
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
GetCurrencies(freeList).then(res => {
|
|
|
|
|
const cuArr = []
|
|
|
|
|
res.data.forEach(item => {
|
|
|
|
|
if (item != 'RMB') {
|
|
|
|
|
cuArr.push(1)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (cuArr.length > 0) {
|
|
|
|
|
const promises = cuArr.map(item => {
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
const data = {
|
|
|
|
|
currencyFrom: 'RMB',
|
|
|
|
|
currencyTo: item,
|
|
|
|
|
}
|
|
|
|
|
GetExchangeRate(data).then(res => {
|
|
|
|
|
exchangarr.value.push(res.data)
|
|
|
|
|
resolve(true);
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return Promise.all(promises).then(() => {
|
|
|
|
|
freeType.value = 'left'
|
|
|
|
|
exchangeFlag.value = true
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (cuArr.length == 0) {
|
|
|
|
|
open.value = false
|
|
|
|
|
emits('updateListFreeLeft', arr)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const emits = defineEmits(['updateList', 'addLeft'])
|
|
|
|
|
const emits = defineEmits(['updateList', 'addLeft', 'updateListFree', 'updateListFreeLeft'])
|
|
|
|
|
// 确定汇率 转换外币成RMB
|
|
|
|
|
function handleSureExhange() {
|
|
|
|
|
if (route.query.type == 'apply') {
|
|
|
|
|
applications.value.forEach(item => {
|
|
|
|
|
if (item.currency != 'RMB') {
|
|
|
|
|
exchangarr.value.forEach(ite => {
|
|
|
|
@ -245,6 +445,29 @@ function handleSureExhange() {
|
|
|
|
|
emits('updateList', result)
|
|
|
|
|
open.value = false
|
|
|
|
|
exchangeFlag.value = false
|
|
|
|
|
}
|
|
|
|
|
if (route.query.type == 'free') {
|
|
|
|
|
let arr = [] as any
|
|
|
|
|
if (freeType.value == 'left') {
|
|
|
|
|
arr = getSelectRowsFree()
|
|
|
|
|
} else {
|
|
|
|
|
arr = getSelectRowsFeeDetail()
|
|
|
|
|
}
|
|
|
|
|
arr.forEach(item => {
|
|
|
|
|
exchangarr.value.forEach(ite => {
|
|
|
|
|
if (item.currency == item.currencyTo) {
|
|
|
|
|
item.exchangeRate = ite.reverseRate
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
open.value = false
|
|
|
|
|
exchangeFlag.value = false
|
|
|
|
|
if (freeType.value == 'left') {
|
|
|
|
|
emits('updateListFreeLeft', arr)
|
|
|
|
|
} else {
|
|
|
|
|
emits('updateListFree', arr)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function handleClick(record, index) {
|
|
|
|
|
setSelectedRowKeys([record.id])
|
|
|
|
@ -270,21 +493,26 @@ function handleClickFree(record, index) {
|
|
|
|
|
const data = {
|
|
|
|
|
id: record.id,
|
|
|
|
|
businessType: record.businessType,
|
|
|
|
|
// customerId: record.customerId
|
|
|
|
|
customerId: record.customerId
|
|
|
|
|
}
|
|
|
|
|
loading.value = true
|
|
|
|
|
FreeInvoiceGetFees(data).then(res => {
|
|
|
|
|
FreeInvoiceGetFees([data]).then(res => {
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
|
|
|
|
|
freeDetailList.value = res.data.items
|
|
|
|
|
freeDetailList.value.forEach(item => {
|
|
|
|
|
item.applyAmount = item.restAmount ? item.restAmount : 0
|
|
|
|
|
item.applyAmount = item.applyAmount.toFixed(2)
|
|
|
|
|
})
|
|
|
|
|
setTableDataDetail(freeDetailList.value)
|
|
|
|
|
}
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
function init(data) {
|
|
|
|
|
if(route.query.type=='apply'){
|
|
|
|
|
if (route.query.type == 'apply') {
|
|
|
|
|
open.value = true
|
|
|
|
|
}
|
|
|
|
|
if(route.query.type=='free'){
|
|
|
|
|
if (route.query.type == 'free') {
|
|
|
|
|
freeFlag.value = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -293,7 +521,7 @@ function init(data) {
|
|
|
|
|
const amountArr = ref([]) as any
|
|
|
|
|
// 计算总共的申请金额
|
|
|
|
|
function onSelectAmount() {
|
|
|
|
|
const arr = getSelectRowsFee()
|
|
|
|
|
const arr = getRawDataSourceFree()
|
|
|
|
|
amountArr.value = []
|
|
|
|
|
arr.forEach(item => {
|
|
|
|
|
amountArr.value.push({
|
|
|
|
|