付费结算汇率转换

szh-new
lijingjia 2 months ago
parent 88fbfc313b
commit 664eb99100

@ -66,11 +66,11 @@ export const feeColumns = [
export const feeApplyColumns = [
{
title: '客户名称',
width: 150,
width: 100,
dataIndex: 'customerName'
}, {
title: '收付',
width: 80,
width: 50,
dataIndex: 'feeType',
customRender: ({ record }) => {
if (record.feeType == 1) {
@ -83,23 +83,23 @@ export const feeApplyColumns = [
}
}, {
title: '费用名称',
width: 150,
width: 90,
dataIndex: 'feeName'
}, {
title: '金额',
width: 100,
width: 80,
dataIndex: 'amount'
}, {
title: '币别',
width: 100,
width: 60,
dataIndex: 'currency'
}, {
title: '未结金额',
width: 100,
width: 80,
dataIndex: 'restAmount'
}, {
title: '本次申请金额',
width: 130,
width: 100,
dataIndex: 'applyAmount'
}, {
title: '原始汇率',

@ -21,7 +21,7 @@
v-model:value="record.applyAmount"
:min="0"
:max="record.restAmount"
:step="0.000001"
:step="0.01"
string-mode
@change="amountChange($event, record)"
@click.native.stop="handleInputClick"

@ -12,7 +12,8 @@ enum Api {
info = '/feeApi/PaymentSettlement/Get',
delete = '/feeApi/PaymentSettlement/Delete',
GetApplicationList = '/feeApi/PaymentSettlement/GetApplicationList',
GetApplicationDetailsById = '/feeApi/PaymentSettlement/GetApplicationDetailsById'
GetApplicationDetailsById = '/feeApi/PaymentSettlement/GetApplicationDetailsById',
GetExchanges = '/feeApi/PaymentSettlement/GetExchanges'
}
// 列表 (Auth)
export function GetList(data: PageRequest) {
@ -64,3 +65,12 @@ export function GetApplicationDetailsById(params) {
params
})
}
// 根据申请单获取费用币别
export function GetExchanges(data: PageRequest) {
return request<DataResult>({
url: Api.GetExchanges,
method: 'post',
data
})
}

@ -49,14 +49,6 @@
></feeTable>
</template>
</BasicTable>
<!-- <div class="info">
<div>
<a-button @click="save" type="link">增加申请费用明细</a-button>
</div>
<feeTable
ref="feeTabel"
></feeTable>
</div> -->
</a-spin>
<!-- 汇率换算组件 -->
<ExchangeRate
@ -68,7 +60,7 @@
<script lang="ts" setup>
import { onMounted, ref, reactive, watch, defineExpose, defineProps, defineEmits, h } from 'vue'
import { BasicTable, useTable } from '/@/components/Table'
import { GetApplicationList, Save } from '../../api'
import { GetApplicationList, Save, GetExchanges } from '../../api'
import { businessColumns, searchFormSchema, currencyFormSchema } from '../columns'
import feeTable from './feeTable.vue'
import { BasicForm, useForm } from '/@/components/Form'
@ -140,10 +132,8 @@
const allFeeData = {}
const feeTabel = ref(null)
const historyChange = async (v) => {
console.log(v)
if (v.length > 1) {
console.log(getDataSource())
const a = getDataSource().filter(item => {
const a = getDataSource().filter((item) => {
return item.id == v[0]
})[0]
const b = getDataSource().filter(item => {
@ -222,51 +212,54 @@
// }
}
//
const saveExchangeRate = (list) => {
feeTableData.value.forEach(row => {
list.forEach(item => {
if (row.currency == item.currency) {
row.exchangeRate = item.value
}
const saveExchangeRate = (data) => {
//
const currencyConf = {}
data.list.forEach(item => {
currencyConf[item.currency] = item.value
})
bPostData.value.documents.forEach(item => {
item.exchangeRates.forEach(row => {
row.exchangeRate = currencyConf[row.currency]
})
})
emit('save', feeTableData.value)
loading.value = true
Save(bPostData.value).then(res => {
loading.value = false
if (res.succeeded) {
createMessage.success('添加成功!')
if (res?.data?.id) {
emit('refresh', res.data.id)
}
}
}).catch(() => {
loading.value = false
})
}
//
const bPostData = ref({})
//
const addInfos = () => {
const addInfos = async () => {
const selectRows = getSelectRows()
if (props.formData.customerId) {
let flag = false
selectRows.forEach(item => {
if (item.customerId == props.formData.customerId) {
flag = true
}
})
if (!flag) {
return createMessage.warning('没有选择要添加的业务!')
}
} else {
if (state.historyRowKeys.length == 0 ) {
return createMessage.warning('没有选择要添加的业务!')
}
//
const currency = getFieldsValue().currency
if (selectRows.length == 0) {
return createMessage.warning('没有选择要添加的业务!')
}
if (!props.formData.currency) {
//
const postData = {
description: '按申请单增加添加费用明细',
settlement: props.formData,
documents: getSelectRows()
}
//
const postData = {
description: '按申请单增加添加费用明细',
settlement: props.formData,
documents: getSelectRows()
}
if (!currency) {
loading.value = true
Save(postData).then(async (res) => {
loading.value = false
if (res.succeeded) {
createMessage.success('添加成功!')
if (res?.data?.id) {
await props.setFieldsValue({
...res.data
})
emit('refresh')
emit('refresh', res.data.id)
}
}
}).catch(() => {
@ -274,32 +267,46 @@
})
} else {
//
props.setFieldsValue({
currency
})
//
let feeList = []
for(var key in allFeeData) {
feeList = [...feeList, ...allFeeData[key]]
}
//
let currencyList = []
//
feeList.forEach((item, index) => {
if (item.currency != props.formData.currency) {
currencyList.push({
currency: item.currency,
feeType: item.feeType,
//
value: null,
//
value1: null
//
const postCurrency = selectRows.map(item => {
return {
id: item.id,
customerId: item.customerId
}
})
const items = await GetExchanges(postCurrency).then(res => {
return res.data
})
items.forEach(item => {
if (item.exchangeRates) {
item.exchangeRates.forEach(c => {
if(c.currency != currency) {
currencyList.push({
currency: c.currency
})
}
})
}
selectRows.forEach(row => {
if (item.id == row.id) {
item.settlementOther = row.settlementOther
item.settlementRMB = row.settlementRMB
item.settlementUSD = row.settlementUSD
}
})
})
//
currencyList = Array.from(new Set(currencyList.map(item => item.currency))).map(currency => {
return currencyList.find(item => item.currency === currency)
})
//
feeTableData.value = feeList
exchangeRate.value.init(props.formData.currency, currencyList)
postData.documents = items
bPostData.value = postData
exchangeRate.value.init(currency, currencyList)
}
}

@ -7,7 +7,7 @@
<a-spin :spinning="loading">
<BasicTable
style="width: 440px;"
class="ds-table-detail"
class="ds-table-detail ds-payment-settle-fee-table"
:scroll="{ x: '100%', y: 400 }"
@register="registerTable"
>
@ -15,17 +15,15 @@
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, watch, defineProps } from 'vue'
import { ref, defineExpose } from 'vue'
//
import { feeColumns } from '../columns'
// id
import { GetApplicationDetailsById } from '../../api'
// id
import { GetFeeTemplateDetailList } from '/@/views/fee/template/api'
import { BasicTable, useTable } from '/@/components/Table'
// id, id
const aid = ref('')
const [registerTable, { reload, getForm, getSelectRowKeys, getPaginationRef, getSelectRows, setSelectedRows, getDataSource }] = useTable({
const [registerTable, { reload }] = useTable({
api: async (p) => {
const res = await GetApplicationDetailsById(p)
return new Promise((resolve) => {
@ -43,7 +41,8 @@
bordered: true,
showIndexColumn: false,
canResize: false,
immediate: false
immediate: false,
id: '2'
})
const init = (id) => {
aid.value = id
@ -56,7 +55,13 @@
</script>
<style lang="scss">
.ds-fee-table {
.ds-payment-settle-fee-table {
.vben-basic-table-header__toolbar {
justify-content: flex-end!important;
}
.table-settings button:first-child{
display: none;
}
padding: 0;
.ant-table-cell {
padding: 5px 12px;

@ -71,7 +71,6 @@
v-if="visible"
ref="busTable"
:formData="getFieldsValue()"
:setFieldsValue="setFieldsValue"
@save="save"
@refresh="refresh"
></BusinessTable>
@ -123,13 +122,21 @@
}
//
const refresh = (id) => {
const refresh = async (id) => {
await setFieldsValue({
id
})
visible.value = false
init()
}
//
const save = () => {
const postData = validate()
const settlement = validate()
const postData = {
description: '按申请单增加添加费用明细',
settlement,
documents: getSelectRows()
}
Save(postData).then(async (res) => {
if (res.succeeded) {
createMessage.success('保存成功!')

@ -18,7 +18,8 @@ enum Api {
Delete = '/feeApi/PaymentApplication/Delete',
DeleteDetail = '/feeApi/PaymentApplication/DeleteDetail',
ApplyAudit = '/feeApi/PaymentApplication/ApplyAudit',
Withdraw = '/feeApi/PaymentApplication/Withdraw'
Withdraw = '/feeApi/PaymentApplication/Withdraw',
GetCurrencies = '/feeApi/PaymentApplication/GetCurrencies'
}
// 列表 (Auth)
export function GetList(data: PageRequest) {
@ -115,4 +116,12 @@ export function Withdraw(data: PageRequest) {
method: 'post',
data
})
}
}
// 获取票下的币别
export function GetCurrencies(data: PageRequest) {
return request<DataResult>({
url: Api.GetCurrencies,
method: 'post',
data
})
}

@ -28,9 +28,9 @@
删除
</a-button>
</a-popconfirm>
<a-button style="margin-left: 100px;" type="link" @click="exportExcel">
<a-button type="link" @click="exportExcel">
<span class="iconfont icon-fujian" :style="{ fontSize: '12px' }"></span>
导出
附件
</a-button>
</div>
</div>

@ -97,7 +97,7 @@
<script lang="ts" setup>
import { onMounted, ref, reactive, watch, defineExpose, defineProps, defineEmits, h } from 'vue'
import { BasicTable, useTable } from '/@/components/Table'
import { GetBizList, BizSave } from '../../api'
import { GetBizList, GetCurrencies, BizSave } from '../../api'
import { businessColumns, searchFormSchema, currencyFormSchema } from '../columns'
import feeTable from '/@/components/CostEntry/components/feeTable.vue'
import { BasicForm, useForm } from '/@/components/Form'
@ -184,13 +184,13 @@
const allFeeData = {}
const feeTabel = ref(null)
const historyChange = async (v) => {
console.log(v)
if (v.length > 1) {
const a = getDataSource().filter(item => {
return item.id == v[0]
console.log(getDataSource())
const a = getDataSource().filter((item, index) => {
return item.id + index == v[0]
})[0]
const b = getDataSource().filter(item => {
return item.id == v[v.length - 1]
const b = getDataSource().filter((item, index) => {
return item.id + index == v[v.length - 1]
})[0]
if (a.customerId != b.customerId) {
return createMessage.warning('请选择结算对象一致的数据!')
@ -237,6 +237,9 @@
return createMessage.warning('结算对象与付费申请客户不一致,不能添加此费用明细!')
}
if (currency) {
props.setFieldsValue({
currency
})
//
let currencyList = []
//
@ -256,92 +259,173 @@
return currencyList.find(item => item.currency === currency)
})
//
exchangeRate.value.init(currency, currencyList)
exchangeRate.value.init(currency, currencyList, '1')
} else {
//
emit('save', feeTableData.value)
}
}
//
const saveExchangeRate = (list) => {
feeTableData.value.forEach(row => {
list.forEach(item => {
if (row.currency == item.currency) {
row.exchangeRate = item.value
}
})
})
emit('save', feeTableData.value)
}
//
const addInfos = () => {
const selectRows = getSelectRows()
if (props.formData.customerId) {
let flag = false
selectRows.forEach(item => {
if (item.customerId == props.formData.customerId) {
flag = true
}
const saveExchangeRate = (data) => {
if (data.type == '1') {
//
feeTableData.value.forEach(row => {
data.list.forEach(item => {
if (row.currency == item.currency) {
row.exchangeRate = item.value
}
})
})
if (!flag) {
return createMessage.warning('没有选择要添加的业务!')
}
emit('save', feeTableData.value)
} else {
if (state.historyRowKeys.length == 0 ) {
return createMessage.warning('没有选择要添加的业务!')
}
}
if (!props.formData.currency) {
//
const postData = {
description: '按业务增加添加费用明细',
application: {
id: 0,
customerId: selectRows[0]?.customerId
},
items: [{
id: selectRows[0]?.id,
businessType: selectRows[0]?.businessType,
customerId: selectRows[0]?.customerId
}]
}
//
const currencyConf = {}
data.list.forEach(item => {
currencyConf[item.currency] = item.value
})
bPostData.value.items.forEach(item => {
item.exchangeRates.forEach(row => {
row.exchangeRate = currencyConf[row.currency]
})
})
loading.value = true
BizSave(postData).then(res => {
BizSave(bPostData.value).then(res => {
loading.value = false
if (res.succeeded) {
createMessage.success('加成功!')
emit('refresh')
createMessage.success('添加成功!')
emit('refresh', res.data.id)
}
}).catch(() => {
loading.value = false
})
} else {
//
//
let feeList = []
for(var key in allFeeData) {
feeList = [...feeList, ...allFeeData[key]]
}
}
//
const bPostData = ref(null)
//
const addInfos = async () => {
const selectRows = getSelectRows()
//
const currency = getFieldsValue().currency
if (selectRows.length == 0) {
return createMessage.warning('没有选择要添加的业务!')
}
const postData = {
description: '按业务提交申请单',
application: getFieldsValue(),
items: []
}
const postCurrency = selectRows.map(item => {
return {
id: item.id,
businessType: item.businessType,
customerId: item.customerId
}
//
})
const items = await GetCurrencies(postCurrency).then(res => {
return res.data
})
postData.items = items
//
if (currency) {
//
props.setFieldsValue({
currency
})
//
let currencyList = []
//
feeList.forEach((item, index) => {
if (item.currency != props.formData.currency) {
currencyList.push({
currency: item.currency,
feeType: item.feeType,
//
value: null,
//
value1: null
items.forEach(item => {
if (item.exchangeRates) {
item.exchangeRates.forEach(c => {
if(c.currency != currency) {
currencyList.push({
currency: c.currency
})
}
})
}
})
currencyList = Array.from(new Set(currencyList.map(item => item.currency))).map(currency => {
return currencyList.find(item => item.currency === currency)
})
//
feeTableData.value = feeList
exchangeRate.value.init(props.formData.currency, currencyList)
bPostData.value = postData
console.log(currencyList)
if (currencyList.length == 0) {
//
BizSave(postData).then(res => {
loading.value = false
if (res.succeeded) {
createMessage.success('添加成功!')
emit('refresh', res.data.id)
}
}).catch(() => {
loading.value = false
})
} else {
exchangeRate.value.init(currency, currencyList, '2')
}
} else {
//
BizSave(postData).then(res => {
loading.value = false
if (res.succeeded) {
createMessage.success('添加成功!')
emit('refresh', res.data.id)
}
}).catch(() => {
loading.value = false
})
}
// if (!props.formData.currency) {
// //
// const postData = {
// description: '',
// application: {
// id: 0,
// customerId: selectRows[0]?.customerId
// },
// items: [{
// id: selectRows[0]?.id,
// businessType: selectRows[0]?.businessType,
// customerId: selectRows[0]?.customerId
// }]
// }
// loading.value = true
// BizSave(postData).then(res => {
// loading.value = false
// if (res.succeeded) {
// createMessage.success('')
// emit('refresh', res.data.id)
// }
// })
// } else {
// //
// let feeList = []
// for(var key in allFeeData) {
// feeList = [...feeList, ...allFeeData[key]]
// }
// //
// let currencyList = []
// //
// feeList.forEach((item, index) => {
// if (item.currency != props.formData.currency) {
// currencyList.push({
// currency: item.currency,
// feeType: item.feeType,
// //
// value: null,
// //
// value1: null
// })
// }
// })
// currencyList = Array.from(new Set(currencyList.map(item => item.currency))).map(currency => {
// return currencyList.find(item => item.currency === currency)
// })
// //
// feeTableData.value = feeList
// exchangeRate.value.init(props.formData.currency, currencyList)
// }
}
watch(
() => state.historyRowKeys, (v, old) => {

@ -6,33 +6,35 @@
<template>
<div>
<a-modal class="ds-exchange-rate" v-model:visible="visible" title="币别汇率折算" cancelText="关闭" @ok="handleOk">
<div v-for="(item, index) in c2" :key="'cur' + index">
<p class="flex">
<span class="unit">1{{ c1 }} =</span>
<a-input-number
v-model:value="item.value"
:min="0.000001"
:max="99999999"
:step="0.000001"
string-mode
:precision="6"
@change="calc1($event, item)"
/>
{{ item.currency }}
</p>
<p class="flex">
<span class="unit">1{{ item.currency }} =</span>
<a-input-number
v-model:value="item.value1"
:min="0.000001"
:max="99999999"
:step="0.000001"
:precision="6"
string-mode
@change="calc2($event, item)"
/>
{{ c1 }}
</p>
<div class="mt15">
<div v-for="(item, index) in c2" :key="'cur' + index">
<p class="flex">
<span class="unit">1{{ c1 }} =</span>
<a-input-number
v-model:value="item.value"
:min="0.000001"
:max="99999999"
:step="0.000001"
string-mode
:precision="6"
@change="calc1($event, item)"
/>
{{ item.currency }}
</p>
<p class="flex">
<span class="unit">1{{ item.currency }} =</span>
<a-input-number
v-model:value="item.value1"
:min="0.000001"
:max="99999999"
:step="0.000001"
:precision="6"
string-mode
@change="calc2($event, item)"
/>
{{ c1 }}
</p>
</div>
</div>
</a-modal>
</div>
@ -44,18 +46,20 @@
const visible = ref(false)
const value = ref(0)
const value1 = ref(0)
const ctype = ref()
const handleOk = () => {
visible.value = false
emit('submit', c2.value)
emit('submit', { list: c2.value, type: ctype.value })
}
//
const c1 = ref()
//
const c2 = ref([])
const init = (currency, list) => {
const init = (currency, list, type) => {
visible.value = true
c1.value = currency
c2.value = list
ctype.value = type
c2.value.forEach(item => {
GetExchangeRate({ currencyFrom: currency, currencyTo: item.currency, feeType: item.feeType }).then(res => {
item.value = res.data.rate

@ -115,7 +115,8 @@
}
const applyInfo = ref(null)
//
const refresh = () => {
const refresh = (id) => {
bid.value = id
visible.value = false
init()
}
@ -126,7 +127,6 @@
//
const save = async (feeInfo) => {
const postData = await validate()
console.log(postData)
if (feeInfo && feeInfo.length) {
postData['details'] = [...feeData.value, ...feeInfo]
} else {
@ -182,7 +182,6 @@
dloading.value = true
Get({ id }).then(res => {
dloading.value = false
console.log(res.data)
setFieldsValue(res.data)
status.value = res.data.status
bid.value = res.data.id

@ -193,6 +193,10 @@ export const temFormSchema: FormSchema[] = [
componentProps: ({ formModel }) => {
return {
api: GetPrintModuleList,
params: {
queryCondition: '[]',
pageCondition: { pageIndex: 1, pageSize: 999, sortConditions: [] }
},
allowClear: true,
showSearch: true,
labelField: 'moduleName',

Loading…
Cancel
Save