|
|
|
@ -41,7 +41,7 @@
|
|
|
|
|
<div class="bold">申请开票明细</div>
|
|
|
|
|
<div style="display: flex;">
|
|
|
|
|
<div class="apply" :class="{ active: form.isYB }">
|
|
|
|
|
<a-checkbox v-model:checked="form.isYB" @change="handleChangeApply">
|
|
|
|
|
<a-checkbox :disabled="route.query.id ? true : false" v-model:checked="form.isYB" @change="handleChangeApply">
|
|
|
|
|
原币申请
|
|
|
|
|
<span :class="{ rmb: item.currency == 'RMB', yb: item.currency != 'RMB' }"
|
|
|
|
|
v-for="(item, index) in amountArr" :key="index">{{ item.applyAmount }}
|
|
|
|
@ -50,7 +50,7 @@
|
|
|
|
|
</a-checkbox>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="apply" :class="{ active: form.isRMB }">
|
|
|
|
|
<a-checkbox v-model:checked="form.isRMB"
|
|
|
|
|
<a-checkbox :disabled="route.query.id ? true : false" v-model:checked="form.isRMB"
|
|
|
|
|
@change="handleChangeApply1">折算人民币申请</a-checkbox>
|
|
|
|
|
<span class="rmb" v-if="totalRmb != 0">{{ totalRmb }} RMB</span>
|
|
|
|
|
<span></span>
|
|
|
|
@ -121,6 +121,8 @@ import { detailColumns, detailSearchFormSchema, businessTypeList } from '../colu
|
|
|
|
|
import { GetBizList, InvoiceApplicationGetFees, GetExchangeRate } 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 columns = [
|
|
|
|
|
{
|
|
|
|
@ -183,7 +185,7 @@ const columns = [
|
|
|
|
|
]
|
|
|
|
|
const queryData = ref({}) as any
|
|
|
|
|
const dataSource = ref([]) as any
|
|
|
|
|
const [registerTable, { getForm, setSelectedRowKeys, getSelectRows, setProps, getRawDataSource }] = useTable({
|
|
|
|
|
const [registerTable, { getForm, setSelectedRowKeys, getSelectRows, setProps, getRawDataSource, setLoading }] = useTable({
|
|
|
|
|
api: async (p) => {
|
|
|
|
|
const res: API.DataResult = await GetBizList(p)
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
@ -234,7 +236,8 @@ const exchangeFlag = ref(false)
|
|
|
|
|
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
const form = ref({
|
|
|
|
|
isYB: true
|
|
|
|
|
isYB: true,
|
|
|
|
|
isRMB:false
|
|
|
|
|
}) as any
|
|
|
|
|
function handleChangeApply(e) {
|
|
|
|
|
form.value.isRMB = !e.target.checked
|
|
|
|
@ -326,7 +329,7 @@ function handleClick(record, index) {
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
function init() {
|
|
|
|
|
function init(data) {
|
|
|
|
|
open.value = true
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
setProps({
|
|
|
|
@ -344,6 +347,14 @@ function init() {
|
|
|
|
|
customerId: customerIdP.value
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if(data.isRMB){
|
|
|
|
|
form.value.isRMB = true
|
|
|
|
|
form.value.isYB = false
|
|
|
|
|
}
|
|
|
|
|
if(data.isYB){
|
|
|
|
|
form.value.isYB = true
|
|
|
|
|
form.value.isRMB = false
|
|
|
|
|
}
|
|
|
|
|
}, 500)
|
|
|
|
|
}
|
|
|
|
|
const rmbTotal = ref(0)
|
|
|
|
@ -426,9 +437,18 @@ function mergeByCurrency(arr) {
|
|
|
|
|
}
|
|
|
|
|
// 添加右边整体业务 需要将费用的查询参数传过去
|
|
|
|
|
function addDetailed() {
|
|
|
|
|
const arr = getSelectRows() ? getSelectRows() : []
|
|
|
|
|
const arrRight = getSelectRows() ? getSelectRows() : []
|
|
|
|
|
const arr1 = []
|
|
|
|
|
arr.forEach(item => {
|
|
|
|
|
const firstCustomerId = arrRight[0].customerId;
|
|
|
|
|
const exchangarr = [] as any
|
|
|
|
|
setLoading(true)
|
|
|
|
|
for (let i = 1; i < arrRight.length; i++) {
|
|
|
|
|
if (arrRight[i].customerId !== firstCustomerId) {
|
|
|
|
|
createMessage.error('请选择同一客户')
|
|
|
|
|
throw new Error('customerId值不一致');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
arrRight.forEach(item => {
|
|
|
|
|
if (item.customerId != customerIdP.value) {
|
|
|
|
|
arr1.push(1)
|
|
|
|
|
}
|
|
|
|
@ -437,20 +457,24 @@ function addDetailed() {
|
|
|
|
|
createMessage.error('请选择同一客户')
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
const data = {} as any
|
|
|
|
|
const queryDataStr = {} as any
|
|
|
|
|
if (queryData.value.feeType) {
|
|
|
|
|
data.feeType = queryData.value.feeType
|
|
|
|
|
queryDataStr.feeType = queryData.value.feeType
|
|
|
|
|
}
|
|
|
|
|
if (queryData.value.currency) {
|
|
|
|
|
data.currency = queryData.value.currency
|
|
|
|
|
queryDataStr.currency = queryData.value.currency
|
|
|
|
|
}
|
|
|
|
|
if (queryData.value.feeName) {
|
|
|
|
|
data.feeName = queryData.value.feeName
|
|
|
|
|
queryDataStr.feeName = queryData.value.feeName
|
|
|
|
|
}
|
|
|
|
|
if (queryData.value.FeeRange) {
|
|
|
|
|
data.FeeRange = queryData.value.FeeRange
|
|
|
|
|
queryDataStr.FeeRange = queryData.value.FeeRange
|
|
|
|
|
}
|
|
|
|
|
const arrRight = getSelectRows()
|
|
|
|
|
if (arrRight.length == 0) {
|
|
|
|
|
createMessage.error('请选择一条数据')
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (arrRight.length > 0 && form.value.isRMB) {
|
|
|
|
|
const data = [] as any
|
|
|
|
|
arrRight.forEach(item => {
|
|
|
|
@ -459,14 +483,48 @@ function addDetailed() {
|
|
|
|
|
businessType: item.businessType
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
InvoiceApplicationGetFees([data]).then(res => {
|
|
|
|
|
InvoiceApplicationGetFees(data).then(res => {
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
|
|
|
|
|
const arrByex = [] as any
|
|
|
|
|
res.data.items.forEach(item => {
|
|
|
|
|
if (item.currency != 'RMB' && item.currency != 'CNY') {
|
|
|
|
|
arrByex.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (arrByex.length > 0) {
|
|
|
|
|
const promises = arrByex.map(item => {
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
const data = {
|
|
|
|
|
currencyFrom: 'RMB',
|
|
|
|
|
currencyTo: item.currency,
|
|
|
|
|
feeType: item.feeType
|
|
|
|
|
}
|
|
|
|
|
GetExchangeRate(data).then(res => {
|
|
|
|
|
exchangarr.push(res.data)
|
|
|
|
|
resolve(true);
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return Promise.all(promises).then(() => {
|
|
|
|
|
emits('addLeft', arrRight, queryDataStr, exchangarr,'isRMB')
|
|
|
|
|
open.value = false
|
|
|
|
|
setLoading(false)
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
emits('addLeft', arrRight, queryDataStr, [],'isRMB')
|
|
|
|
|
open.value = false
|
|
|
|
|
setLoading(false)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// emits('addLeft', arr, data)
|
|
|
|
|
// open.value = false
|
|
|
|
|
|
|
|
|
|
if (arrRight.length > 0 && form.value.isYB) {
|
|
|
|
|
emits('addLeft', arrRight, queryDataStr, [],'isYB')
|
|
|
|
|
open.value = false
|
|
|
|
|
setLoading(false)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
const customerIdP = ref('')
|
|
|
|
|
function changeCustIn(id) {
|
|
|
|
@ -538,4 +596,16 @@ defineExpose({ init, changeCustIn })
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
margin: 0 10px;
|
|
|
|
|
}
|
|
|
|
|
/deep/ .ant-checkbox-wrapper-checked .ant-checkbox-inner {
|
|
|
|
|
background-color: #257afa;
|
|
|
|
|
border-color: #257afa;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/deep/ .ant-checkbox-disabled.ant-checkbox-checked .ant-checkbox-inner::after {
|
|
|
|
|
border-color: #f5f5f5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/deep/ .ant-checkbox-wrapper-checked .ant-checkbox-disabled+span {
|
|
|
|
|
color: #257afa;
|
|
|
|
|
}
|
|
|
|
|
</style>
|