From 56395c49ce6f62d4745932b4a28a0375f42bfcab Mon Sep 17 00:00:00 2001 From: yufei_wang <2267742828@qq.com> Date: Thu, 21 Nov 2024 15:38:16 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../customerSaleInvoiceRecordMain/index.vue | 4 +- .../CustomerSaleInvoiceBasicForm.vue | 44 +++++++++++++++++++ .../customerSaleInvoiceRequestMain.data.ts | 15 ++++++- .../customerSaleInvoiceRequestMain/index.vue | 21 +++++++-- 4 files changed, 77 insertions(+), 7 deletions(-) diff --git a/src/views/wms/deliversettlementManage/customerSaleInvoiceRecordMain/index.vue b/src/views/wms/deliversettlementManage/customerSaleInvoiceRecordMain/index.vue index e5e9c8d30..0114187d5 100644 --- a/src/views/wms/deliversettlementManage/customerSaleInvoiceRecordMain/index.vue +++ b/src/views/wms/deliversettlementManage/customerSaleInvoiceRecordMain/index.vue @@ -99,7 +99,7 @@ const detailButtonBaseClick = async (val, item,tableObject) => { loadStart() const excelTitle = ref(route.meta.title) const data = await CustomerSaleInvoiceDetailApi.exportCustomerSaleInvoiceRecordDetail(tableObject.params) - download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) + download.excel(data, `【${excelTitle.value}】子表明细【${formatDate(new Date())}】.xlsx`) } catch { } finally { @@ -174,7 +174,7 @@ const handleExport = async () => { loadStart() const excelTitle = ref(route.meta.title) const data = await CustomerSaleInvoiceMainApi.exportCustomerSaleInvoiceRecordMain(tableObject.params) - download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) + download.excel(data, `【${excelTitle.value}】主表【${formatDate(new Date())}】.xlsx`) } catch { } finally { loadDone() diff --git a/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/CustomerSaleInvoiceBasicForm.vue b/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/CustomerSaleInvoiceBasicForm.vue index e80d16e30..37b382c1d 100644 --- a/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/CustomerSaleInvoiceBasicForm.vue +++ b/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/CustomerSaleInvoiceBasicForm.vue @@ -20,6 +20,50 @@ @submitForm="submitForm" @inputNumberChange="inputNumberChange" @onChange="onChange" + :sumFormDataByForm=" + ( + formRef, + formModel, + tableData, + formType, + originFormModel, + updateOriginFormModel, + sumFormDataHandle1 + ) => { + const { + taxRate = 0, + amount = 0, + taxAmount = 0, + beforeTaxAmount = 0, + totalTaxAmount = 0, + discountAmount1 = 0, + beforeTaxDiffAmount = 0, + taxAmountDiff = 0, + rebateTax=0, + } = formModel + // 2、系统税额:每条数据的合同价格X可开票数量,计算结果取两位小数之后*税率的计算结果,再保留2位。所有子表数据再求和 + if (formType == 'update') { + // 编辑 + console.log('taxRate', taxRate) + console.log('originFormModel', originFormModel.taxRate) + console.log('taxAmount', taxAmount) + if (taxRate != originFormModel.taxRate) { + if (originFormModel) { + sumFormDataHandle1() + } + updateOriginFormModel(formModel) + } + // 2.主数据税额 mainTaxAmount = 未税金额*税率/100 保留两位小数 + let mainTaxAmount = Number(Number(beforeTaxAmount*taxRate*0.01).toFixed(2)) + formRef.value.setValues({ + // 主数据税额 + taxAmount:mainTaxAmount, + // 主数据价税合计金额:mainAdTaxAmount =未税金额+税额 + adTaxAmount:beforeTaxAmount+taxAmount + }) + } + } + " :sumFormDataByTableCustom=" (formRef, formModel, tableData) => { const { taxRate = 0 } = formModel diff --git a/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/customerSaleInvoiceRequestMain.data.ts b/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/customerSaleInvoiceRequestMain.data.ts index bd8cfc7f2..4d3d7ceab 100644 --- a/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/customerSaleInvoiceRequestMain.data.ts +++ b/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/customerSaleInvoiceRequestMain.data.ts @@ -409,8 +409,10 @@ export const CustomerSaleInvoiceDetail = useCrudSchemas(reactive([ field: 'allocationPrice', sort: 'custom', form: { + component: 'InputNumber', componentProps: { - disabled: true + disabled: true, + precision: 2 } }, tableForm: { @@ -424,6 +426,7 @@ export const CustomerSaleInvoiceDetail = useCrudSchemas(reactive([ field: 'sumPrice', sort: 'custom', form: { + component: 'InputNumber', componentProps: { disabled: true } @@ -437,6 +440,12 @@ export const CustomerSaleInvoiceDetail = useCrudSchemas(reactive([ label: '未税金额', field: 'beforeTaxAmount', sort: 'custom', + form: { + component: 'InputNumber', + componentProps: { + precision: 2 + } + }, tableForm: { type: 'InputNumber', precision: 2, @@ -447,8 +456,8 @@ export const CustomerSaleInvoiceDetail = useCrudSchemas(reactive([ field: 'taxAmount', sort: 'custom', form: { + component: 'InputNumber', componentProps: { - type: 'InputNumber', precision: 2, disabled: true } @@ -464,6 +473,7 @@ export const CustomerSaleInvoiceDetail = useCrudSchemas(reactive([ field: 'afterTaxAmount', sort: 'custom', form: { + component: 'InputNumber', componentProps: { disabled: true, precision: 2, @@ -472,6 +482,7 @@ export const CustomerSaleInvoiceDetail = useCrudSchemas(reactive([ tableForm: { disabled: true, type: 'InputNumber', + precision: 2, } }, { diff --git a/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/index.vue b/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/index.vue index 7d9f55eaf..fd63549de 100644 --- a/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/index.vue +++ b/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/index.vue @@ -57,6 +57,21 @@ :detailButtonIsShowDelete="false" :detailButtonIsShowAdd="false" :otherHeadButttonData = "[defaultButtons.defaultExportBtn({hasPermi:`wms:customer-sale-invoice-request-main:export` })]" + :sumFormDataByForm=" + (formRef, formModel) => {console.log('formModel====',formModel) + const { beforeTaxAmount = 0, taxAmount = 0 , qty=0,price,allocationPrice,taxRate=1} = formModel + formRef.value.setValues({ + // 含税金额 = 未税价格+税额,四舍五入保留2位小数 + afterTaxAmount: Number((Number(beforeTaxAmount) + Number(taxAmount)).toFixed(2)), + // 模具分摊单价 默认从模具分摊对账单带出,未税金额修改后重新计算,等于未税金额/数量-销售单价 + allocationPrice: Number(Number(Number(beforeTaxAmount)/Number(qty)) - Number(price)), + // 合计单价 = 销售单价 + 模具分摊单价 + sumPrice:Number(Number(price)+Number(allocationPrice)), + // 税额:taxAmount 未税价格*税率/100,四舍五入保留2位小数 + taxAmount: Number((Number(beforeTaxAmount) * Number(taxRate)))/100 //含税金额 + }) + } + " @buttonBaseClick="detailButtonBaseClick" @searchTableSuccessDetail="searchTableSuccessDetail" /> @@ -117,7 +132,7 @@ const detailButtonBaseClick = async (val, item,tableObject) => { loadStart() const excelTitle = ref(route.meta.title) const data = await CustomerSaleInvoiceDetailApi.exportCustomerSaleInvoiceRequestDetail(tableObject.params) - download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) + download.excel(data, `【${excelTitle.value}】子表明细【${formatDate(new Date())}】.xlsx`) } catch { } finally { @@ -217,7 +232,7 @@ const buttonTableClick = async (val, row) => { await message.confirm('确认要发布吗?') tableObject.loading = true CustomerSaleInvoiceMainApi.publish(row.id).then(() => { - message.success(t('common.updateSuccess')) + message.success('发布成功') tableObject.loading = false buttonBaseClick('refresh',null) }).catch(err => { @@ -265,7 +280,7 @@ const handleExport = async () => { loadStart() const excelTitle = ref(route.meta.title) const data = await CustomerSaleInvoiceMainApi.exportCustomerSaleInvoiceMain(tableObject.params) - download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) + download.excel(data, `【${excelTitle.value}】主表【${formatDate(new Date())}】.xlsx`) } catch { } finally { loadDone()