From fec4a79cc48541c5481d068e5b7532bca78e5967 Mon Sep 17 00:00:00 2001 From: zhang_li Date: Tue, 6 May 2025 14:41:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=80=E5=94=AE=E5=BC=80=E7=A5=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/wms/customerSaleInvoiceMain/index.ts | 4 +- src/components/BasicForm/src/BasicForm.vue | 1 + .../CustomerSaleInvoiceBasicForm.vue | 82 +++++++++++++++---- 3 files changed, 70 insertions(+), 17 deletions(-) diff --git a/src/api/wms/customerSaleInvoiceMain/index.ts b/src/api/wms/customerSaleInvoiceMain/index.ts index abb58ebf0..eb4789d4d 100644 --- a/src/api/wms/customerSaleInvoiceMain/index.ts +++ b/src/api/wms/customerSaleInvoiceMain/index.ts @@ -101,6 +101,6 @@ export const getRecordCustomerList = async () => { } // 选择税率获取模具税额和模具含税金额 -export const getAllocationAmount = async (customerNumber: string, rate: any) => { - return await request.get({ url: `/wms/customer-tool-apport-statement-detail/getAllocationAmount?customerNumber=` + customerNumber + '&rate=' + rate }) +export const getAllocationAmount = async (number: string, customerNumber: string, rate: any) => { + return await request.get({ url: `/wms/customer-tool-apport-statement-detail/getAllocationAmount?number=${number}&customerNumber=${customerNumber}&rate=${rate}` }) } diff --git a/src/components/BasicForm/src/BasicForm.vue b/src/components/BasicForm/src/BasicForm.vue index ed8a6188b..ac097cae2 100644 --- a/src/components/BasicForm/src/BasicForm.vue +++ b/src/components/BasicForm/src/BasicForm.vue @@ -721,6 +721,7 @@ const sumFormDataHandle1 = () => { watch( () => unref(formRef)?.formModel, async () => { + console.log(877,unref(formRef)?.formModel) if (props?.sumFormDataByForm && unref(formRef)?.formModel) { props?.sumFormDataByForm( formRef, diff --git a/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/CustomerSaleInvoiceBasicForm.vue b/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/CustomerSaleInvoiceBasicForm.vue index 087020744..4e5f63d32 100644 --- a/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/CustomerSaleInvoiceBasicForm.vue +++ b/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/CustomerSaleInvoiceBasicForm.vue @@ -22,7 +22,7 @@ @inputNumberChange="inputNumberChange" @onChange="onChange" :sumFormDataByForm=" - ( + async ( formRef, formModel, tableData, @@ -54,14 +54,6 @@ } updateOriginFormModel(formModel) } - // 2.主数据税额 mainTaxAmount = 未税金额*税率/100 保留两位小数 - let mainTaxAmount = Number(beforeTaxAmount*taxRate*0.01).toFixed(2) - formRef.value.setValues({ - // 主数据税额 - taxAmount:mainTaxAmount, - // 主数据价税合计金额:mainAdTaxAmount =未税金额+税额 - adTaxAmount: (beforeTaxAmount + parseFloat(taxAmount)).toFixed(2), - }) } } " @@ -129,6 +121,8 @@ const { t } = useI18n() // 国际化 /** 添加/修改操作 */ const formRef = ref() +const curNumber = ref('') +const openType = ref('') const openForm =async (type: string, row?: any) => { CustomerSaleInvoiceMain.allSchemas.formSchema.forEach((item) => { if(item.field == 'customerStatementNumber'){ @@ -139,6 +133,8 @@ const openForm =async (type: string, row?: any) => { } }) tableData.value = [] // 重置明细数据 + curNumber.value = type == 'update' ? row.number : '' + openType.value = type formRef.value.open(type, row) } @@ -159,7 +155,7 @@ const openFormTable =async (type: string, row?: any, list?:any) => { }) } const showTypeList = ref([]) -const onChange =async (field, cur, formRef)=>{ +const onChange =async (field, cur, formRefParams)=>{ if(field == 'taxRate'){ // 税额:taxAmount 未税价格*税率/100,四舍五入保留2位小数 tableData.value.forEach(item=>{ @@ -167,6 +163,39 @@ const onChange =async (field, cur, formRef)=>{ // 含税金额 = 未税价格+税额,四舍五入保留2位小数 item['afterTaxAmount'] = item['beforeTaxAmount'] + item['taxAmount'] }) + if (openType.value == 'update') { + const allAmountNum = await getAllocationAmount(formRef.value.formRef.formModel.customerStatementNumber) + console.log(99,allAmountNum) + // // 2.主数据税额 mainTaxAmount = 未税金额*税率/100 保留两位小数 + // let mainTaxAmount = Number(beforeTaxAmount*taxRate*0.01).toFixed(2) + formRef.value.formRef.setValues({ + beforeTaxAmount: allAmountNum.beforeTaxAmount, + // 主数据税额 + taxAmount:allAmountNum.taxAmount, + // 主数据价税合计金额:mainAdTaxAmount =未税金额+税额 + adTaxAmount: allAmountNum.adTaxAmount, + // 主数据模具未税金额 + moldUntaxedAmount:allAmountNum.moldUntaxedAmount, + // 主数据模具税额 + moldTaxAmount:allAmountNum.moldTaxAmount, + // 主数据模具含税金额 + moldTaxTotal:allAmountNum.moldTaxTotal, + // 主数据-材料未税金额 + materialsUntaxedAmount: allAmountNum.materialsUntaxedAmount, + // 主数据-材料金额 + materialsTaxAmount: allAmountNum.materialsTaxAmount, + // 主数据-材料含税金额= 材料未税金额+材料税额 + materialsTaxTotal:allAmountNum.materialsTaxTotal, + // 主数据已分摊模具未税金额 + alreadyMoldUntaxedAmount: allAmountNum.alreadyMoldUntaxedAmount, + // 主数据已分摊模具税额 + alreadyMoldTaxAmount: allAmountNum.alreadyMoldTaxAmount, + // 主数据模具未税差异=已分摊模具未税金额-模具未税金额 + moldTaxAmountDiff: allAmountNum.moldTaxAmountDiff, + // 主数据已分摊价税合计=已分摊模具未税金额+已分摊模具税额 + alreadyMoldTaxTotal: allAmountNum.alreadyMoldTaxTotal, + }) + } } else if (field == 'invoiceType') { showTypeList.value = cur // if (cur == '补给品') { @@ -352,12 +381,35 @@ const tableSelectionDelete = (selection) => { tableData.value = tableData.value.filter(item => !selection.includes(item)) } // 选择税率获取模具未税金额,模具税额和模具含税金额 -const getAllocationAmount = async (number) => { - const res = await CustomerSaleInvoiceMainApi.getAllocationAmount(number, formRef.value.formRef.formModel.taxRate) +const getAllocationAmount = async (customerStatementNumber) => { + const res = await CustomerSaleInvoiceMainApi.getAllocationAmount(curNumber.value,customerStatementNumber, formRef.value.formRef.formModel.taxRate) return { - moldUntaxedAmount:res.moldUntaxedAmount.toFixed(2),//模具未税金额(模具分摊对账单中各明细行的模具费用之和,先保留两位小数后再相加) - moldTaxAmount:res.moldTaxAmount.toFixed(2),//模具税额(所关联的模具分摊对账单中所有明细行的(模具未税金额 * 税率),先保留两位小数再求和) - moldTaxTotal:res.moldTaxTotal.toFixed(2),//模具含税金额(模具未税金额+模具税额) + // 主数据未税金额 + beforeTaxAmount:res?.mainBeforeTaxAmount?.toFixed(2) || '', + // 主数据税额 + taxAmount:res?.mainTaxAmount?.toFixed(2) || '', + // 主数据价税合计金额:mainAdTaxAmount =未税金额+税额 + adTaxAmount: res?.mainAdTaxAmount?.toFixed(2) || '', + // 主数据模具未税金额 + moldUntaxedAmount:res?.moldUntaxedAmount?.toFixed(2) || '', + // 主数据模具税额 + moldTaxAmount:res?.moldTaxAmount?.toFixed(2) || '', + // 主数据模具含税金额 + moldTaxTotal:res?.moldTaxTotal?.toFixed(2) || '', + // 主数据-材料未税金额 + materialsUntaxedAmount: res?.materialsUntaxedAmount?.toFixed(2) || '', + // 主数据-材料金额 + materialsTaxAmount: res?.materialsTaxAmount?.toFixed(2) || '', + // 主数据-材料含税金额= 材料未税金额+材料税额 + materialsTaxTotal:res?.materialsTaxTotal?.toFixed(2) || '', + // 主数据已分摊模具未税金额 + alreadyMoldUntaxedAmount: res?.alreadyMoldUntaxedAmount?.toFixed(2) || '', + // 主数据已分摊模具税额 + alreadyMoldTaxAmount: res?.alreadyMoldTaxAmount?.toFixed(2) || '', + // 主数据模具未税差异=已分摊模具未税金额-模具未税金额 + moldTaxAmountDiff: res?.moldTaxAmountDiff?.toFixed(2) || '', + // 主数据已分摊价税合计=已分摊模具未税金额+已分摊模具税额 + alreadyMoldTaxTotal: res?.alreadyMoldTaxTotal?.toFixed(2) || '', } } defineExpose({openForm,openFormTable})