diff --git a/src/views/operation/invoiceApply/detail/InvoiceDetails.vue b/src/views/operation/invoiceApply/detail/InvoiceDetails.vue index 1d6d838f..8cf44bcb 100644 --- a/src/views/operation/invoiceApply/detail/InvoiceDetails.vue +++ b/src/views/operation/invoiceApply/detail/InvoiceDetails.vue @@ -41,7 +41,7 @@
申请开票明细
- + 原币申请 {{ item.applyAmount }} @@ -50,7 +50,7 @@
- 折算人民币申请 {{ totalRmb }} RMB @@ -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 @@ -281,7 +284,7 @@ function handleChangeApply1(e) { totalRmb.value = total } } - + } @@ -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 + } + if (arrRight.length == 0) { + createMessage.error('请选择一条数据') + return false } - const arrRight = getSelectRows() + 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; +} \ No newline at end of file diff --git a/src/views/operation/invoiceApply/detail/feeTable.vue b/src/views/operation/invoiceApply/detail/feeTable.vue index 6eee45e3..409ad420 100644 --- a/src/views/operation/invoiceApply/detail/feeTable.vue +++ b/src/views/operation/invoiceApply/detail/feeTable.vue @@ -188,8 +188,8 @@ import { emit } from 'process' function updateList(val, type) { emits('updateListSave', val, type) } -function addLeft(val,data) { - emits('addLeftSave', val,data) +function addLeft(val,data,exchang,type) { + emits('addLeftSave', val,data,exchang,type) } const dsFile = ref('') const route = useRoute() @@ -535,10 +535,12 @@ watchEffect(() => { }) } }) +const resData = ref({}) function init(data) { list.value = data.invoiceDetails ? data.invoiceDetails : [] hotTb.value.hotInstance.loadData(data.invoiceDetails ? data.invoiceDetails : []) dataSource.value = data.details ? data.details : [] + resData.value = data } const taxUnitPriceTotal = ref(0) as any @@ -590,7 +592,7 @@ watch( ) const InvoiceDetailsRef = ref(null) as any function open() { - InvoiceDetailsRef.value.init() + InvoiceDetailsRef.value.init(resData.value) } const selectedRowKeysDetial = ref([]) as any const dataSource = ref([]) diff --git a/src/views/operation/invoiceApply/detail/index.vue b/src/views/operation/invoiceApply/detail/index.vue index e9757482..9dcb90ce 100644 --- a/src/views/operation/invoiceApply/detail/index.vue +++ b/src/views/operation/invoiceApply/detail/index.vue @@ -3,11 +3,11 @@
- + - + @@ -39,7 +39,7 @@ - + @@ -97,7 +97,7 @@
折算人民币申请 - {{ totalRmb }} RMB + {{ totalRmb }} RMB
@@ -159,7 +159,7 @@ {{ item.name - }} + }}
@@ -181,10 +181,12 @@ import { GetClientBankList, GetOrgList, InvoiceApplicationBizSave, - GetClientInfo + GetClientInfo, + ApplyAudit, + Withdraw } from '../api' import { useMessage } from '/@/hooks/web/useMessage' -import { useRoute } from 'vue-router' +import { useRoute, useRouter } from 'vue-router' import { GetControllerClientList, GetCustomerServiceList, @@ -196,6 +198,9 @@ import { useUserStore } from '/@/store/modules/user' import { set } from 'nprogress' import { isNamedTupleMember } from 'typescript' import { detailColumns } from '../columns' +import { get } from 'sortablejs' +import { useMultipleTabStore } from '/@/store/modules/multipleTab' +const tabStore = useMultipleTabStore() const userStore = useUserStore() const go = useGo() const CategoryData = [ @@ -673,6 +678,7 @@ const linkageFormBottom = (e) => { const feeTableRef = ref(null) as any const open = ref(false) const nameFlag = ref(false) +const router = useRouter() // 保存 invoiceDetails是手动添加发票的数据 目前不允许手动添加 只能编辑 async function handleSave() { // const values = await validate() @@ -688,7 +694,11 @@ async function handleSave() { .then((res) => { if (res.succeeded) { createMessage.success('保存成功') - go(`/invoiceapplyDetail?id=${res.data.id}`) + const { fullPath } = route //获取当前路径 + tabStore.closeTabByKey(fullPath, router) + setTimeout(() => { + go(`/invoiceapplyDetail?id=${res.data.id}`) + }, 50) } else { createMessage.error(res.message) } @@ -745,12 +755,18 @@ function openTemp() { }) }) } -function handleChangeApply(e) { - form.value.isRMB = !e.target.checked +function handleApply() { + ApplyAudit({ ids: [route.query.id] }).then(res => { + if (res.succeeded) { + createMessage.success('操作成功') + getDetail() + } + }) } -function handleChangeApply1(e) { - form.value.isYB = !e.target.checked +function handleNew() { + go(`/invoiceapplyDetail?type=add`) } + function init() { if (id.value) { getDetail() @@ -780,11 +796,20 @@ function init() { } }) } +function handleWithdraw() { + Withdraw({ ids: [route.query.id] }).then(res => { + if (res.succeeded) { + createMessage.success('操作成功') + getDetail() + } + }) +} function handleAddLabel(val) { tempContent.value += '[' + val.displayName + ']' } const details = ref([]) +// 获取详情 处理总量 function getDetail() { InvoiceApplicationGet({ id: id.value }).then((res) => { if (res.succeeded) { @@ -797,14 +822,19 @@ function getDetail() { form.value.statusText = res.data.statusText form.value.applicationNO = res.data.applicationNO details.value = res.data.details - feeTableRef.value.init(res.data) + feeTableRef.value.changeCust(res.data.customerId) + amountArr.value = [] if (res.data.currency == 'RMB') { form.value.isRMB = true + res.data.isRMB = true + res.data.isYB = false res.data.summaryItems.forEach(item => { totalRmb.value += Number(item.amount) }) } else { form.value.isYB = true + res.data.isRMB = false + res.data.isYB = true res.data.summaryItems.forEach(item => { amountArr.value.push({ currency: item.currency, @@ -812,6 +842,7 @@ function getDetail() { }) }) } + feeTableRef.value.init(res.data) } }) } @@ -933,7 +964,11 @@ function updateListSave(arr, type) { .then((res) => { if (res.succeeded) { createMessage.success('保存成功') - go(`/invoiceapplyDetail?id=${res.data.id}`) + const { fullPath } = route //获取当前路径 + tabStore.closeTabByKey(fullPath, router) + setTimeout(() => { + go(`/invoiceapplyDetail?id=${res.data.id}`) + }, 50) } else { createMessage.error(res.message) } @@ -947,7 +982,7 @@ function updateListSave(arr, type) { } // 左侧的添加过来 整个业务 -function addLeftSave(arr,query) { +function addLeftSave(arr, query, exchang, type) { loading.value = true changeCust(arr[0].customerId, arr[0].customerName).then(res => { const itemList = [] as any @@ -965,14 +1000,25 @@ function addLeftSave(arr,query) { ...form.value, invoiceDetails: feeTableRef.value.list, }, + exchanges: exchang, items: itemList, - queryString: JSON.stringify(query) + queryString: Object.keys(query).length != 0 ? JSON.stringify(query) : '' + } + if (type == 'isRMB') { + data.application.currency = 'RMB' + } + if (type == 'isYB') { + data.application.currency = '' } InvoiceApplicationBizSave(data) .then((res) => { if (res.succeeded) { createMessage.success('保存成功') - go(`/invoiceapplyDetail?id=${res.data.id}`) + const { fullPath } = route //获取当前路径 + tabStore.closeTabByKey(fullPath, router) + setTimeout(() => { + go(`/invoiceapplyDetail?id=${res.data.id}`) + }, 50) } else { createMessage.error(res.message) } @@ -995,7 +1041,14 @@ function handleRender() { id: id.value, template: temp, } - RenderTemplate(data).then((res) => { }) + RenderTemplate(data).then((res) => { + if (res.succeeded) { + marksetFieldsValue({ + note: res.data + }) + nameFlag.value = false + } + }) } const tempName = ref('') const tempId = ref('')