diff --git a/src/views/wms/deliversettlementManage/customerSaleInvoiceMain/index.vue b/src/views/wms/deliversettlementManage/customerSaleInvoiceMain/index.vue index 83859f047..f6fc5f425 100644 --- a/src/views/wms/deliversettlementManage/customerSaleInvoiceMain/index.vue +++ b/src/views/wms/deliversettlementManage/customerSaleInvoiceMain/index.vue @@ -58,6 +58,7 @@ @searchTableSuccess="searchTableSuccess" @submitForm="submitForm" @inputNumberChange="inputNumberChange" + @onChange="onChange" :sumFormDataByTableCustom=" (formRef, formModel, tableData) => { tableData.forEach(item=>{ @@ -168,6 +169,14 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => tableData.value = res.list && res.list.length > 0 ?res.list : [] tableData.value.forEach(item=>{ item['sumPrice'] = item['price'] + item['allocationPrice'] + // 未税金额 默认等于数量*合计单价,可修改,必填,最多可输入2位小数 + item['beforeTaxAmount'] = item['sumPrice']*item['qty'] + item['afterTaxAmount'] = item['beforeTaxAmount'] + item['taxAmount'] //含税金额 + + // 税额:taxAmount 未税价格*税率/100,四舍五入保留2位小数 + item['taxAmount'] = (item['beforeTaxAmount'] * formRef.formModel['taxRate'])/100 //含税金额 + + }) }) @@ -420,9 +429,30 @@ const tableSelectionDelete = (selection) => { tableData.value = tableData.value.filter(item => !selection.includes(item)) } +const onChange = (field, cur, formRef)=>{ + + console.log('onChange',field, cur, formRef) + + if(field == 'taxRate'){ + // 税额:taxAmount 未税价格*税率/100,四舍五入保留2位小数 + tableData.value.forEach(item=>{ + item['taxAmount'] = (item['beforeTaxAmount'] * cur)/100 //含税金额 + }) + } +} + const inputNumberChange = (field, index, row, val) => { console.log('inputNumberChange',field, index, row, val) + // 合计单价 = 销售单价 + 模具分摊单价 row['sumPrice'] = row['price'] + row['allocationPrice'] + + // 含税金额 = 未税价格+税额,四舍五入保留2位小数 + row['afterTaxAmount'] = row['beforeTaxAmount'] + row['taxAmount'] + + // 模具分摊单价 默认从模具分摊对账单带出,未税金额修改后重新计算,等于未税金额/数量-销售单价 + row['allocationPrice'] = row['beforeTaxAmount']/row['qty'] - row['price'] + + } //为true表示子表数据中存在数量为0的数据 const flag = ref(false)