|
|
@ -556,7 +556,8 @@ const detailData = ref() |
|
|
|
const detailOpenForm = (type, row) => { |
|
|
|
detailData.value = row |
|
|
|
} |
|
|
|
const detailBasicFormOnChange = (field, cur) => { |
|
|
|
const detailBasicFormOnChange = (field, cur, detailFormRef) => { |
|
|
|
|
|
|
|
console.log('detailBasicFormOnChange', field, cur) |
|
|
|
if (field == 'invoicableQuantity') { |
|
|
|
// 负数:默认默认开票数~0 |
|
|
@ -572,8 +573,27 @@ const detailBasicFormOnChange = (field, cur) => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
detailData.value['invoicableQuantity'] = cur |
|
|
|
handleDetailAllocationPrice(detailFormRef) |
|
|
|
} else if (field == 'singlePrice') { |
|
|
|
detailData.value['singlePrice'] = cur |
|
|
|
handleDetailAllocationPrice(detailFormRef) |
|
|
|
} |
|
|
|
} |
|
|
|
const handleDetailAllocationPrice = async (detailFormRef) => { |
|
|
|
console.log(777,detailFormRef.value.formModel) |
|
|
|
//含模具费单价=发票价格(合同价格) + 模具分摊单价(保留5位小数) |
|
|
|
detailFormRef.value.formModel['singleAndAllocatePrice'] = Number((Number(detailFormRef.value.formModel['singlePrice']) + Number(detailFormRef.value.formModel['allocationPrice'])).toFixed(5)) |
|
|
|
//金额(模具费)=模具分摊单价*开票数量(保留2位小数) |
|
|
|
detailFormRef.value.formModel['allocationAmount'] = Number((Number(detailFormRef.value.formModel['allocationPrice']) * Number(detailFormRef.value.formModel['invoicableQuantity'])).toFixed(2)) |
|
|
|
//金额(含模具费)=含模具费单价*开票数量(保留2位小数) |
|
|
|
detailFormRef.value.formModel['singleAndAllocateAmount'] = Number((Number(detailFormRef.value.formModel['singleAndAllocatePrice']) * Number(detailFormRef.value.formModel['invoicableQuantity'])).toFixed(2)) |
|
|
|
//金额(税额) = 金额(含模具费)*税率保留两位小数 |
|
|
|
detailFormRef.value.formModel['singleAndAllocateTaxAmount'] = Number((Number(detailFormRef.value.formModel['singleAndAllocateAmount']) * Number(detailFormRef.value.formModel.taxRate) * 0.01).toFixed(5)) |
|
|
|
//金额(合计金额) = 金额(税额) + 金额(含模具费) 保留两位小数 |
|
|
|
detailFormRef.value.formModel['singleAndAllocateTotal'] =Number((Number(detailFormRef.value.formModel['singleAndAllocateTaxAmount'])+Number(detailFormRef.value.formModel['singleAndAllocateAmount'])).toFixed(2)) |
|
|
|
|
|
|
|
} |
|
|
|
const handleDetailSubmitForm = async (formType, data) => { |
|
|
|
if (formType === 'update') { |
|
|
|
console.log('handleDetailSubmitForm', data) |
|
|
@ -611,12 +631,19 @@ const inputNumberChange = (field, index, row, val) => { |
|
|
|
} |
|
|
|
} |
|
|
|
handleAllocationPrice() |
|
|
|
}else if (field == 'singlePrice') { |
|
|
|
handleAllocationPrice() |
|
|
|
} |
|
|
|
} |
|
|
|
const onChange = (field, cur) => { |
|
|
|
console.log('onChange', field) |
|
|
|
if (field == 'orderType') { |
|
|
|
tableData.value = [] |
|
|
|
} else if (field == 'taxRate') { |
|
|
|
if (tableData.value.length > 0) { |
|
|
|
tableData.value.forEach(item=>item.taxRate =cur) |
|
|
|
handleAllocationPrice() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -658,6 +685,9 @@ const searchTableSuccess = (formField, searchField, val, searchFormRef, type, ro |
|
|
|
newRow['id'] = item['id'] |
|
|
|
newRow['backNumber'] = item['backNumber'] |
|
|
|
newRow['currency'] = item['currency'] |
|
|
|
newRow['receivedNumber'] = item['receivedNumber'] |
|
|
|
newRow['project'] = item['project'] |
|
|
|
newRow['taxRate'] = formRef.value.formRef.formModel.taxRate |
|
|
|
} |
|
|
|
tableData.value.push(newRow) |
|
|
|
}) |
|
|
@ -691,7 +721,18 @@ const handleAllocationPrice = async () => { |
|
|
|
tableData.value.forEach((item) => { |
|
|
|
let findItem = res.find((item1) => item1.id == item?.id) |
|
|
|
if (findItem) { |
|
|
|
// 模具分摊单价 |
|
|
|
item['allocationPrice'] = findItem['allocationPrice'] |
|
|
|
//含模具费单价=发票价格(合同价格) + 模具分摊单价(保留5位小数) |
|
|
|
item['singleAndAllocatePrice'] = Number((Number(item['singlePrice']) + Number(item['allocationPrice'])).toFixed(5)) |
|
|
|
//金额(模具费)=模具分摊单价*开票数量(保留2位小数) |
|
|
|
item['allocationAmount'] = Number((Number(item['allocationPrice']) * Number(item['invoicableQuantity'])).toFixed(2)) |
|
|
|
//金额(含模具费)=含模具费单价*开票数量(保留2位小数) |
|
|
|
item['singleAndAllocateAmount'] = Number((Number(item['singleAndAllocatePrice']) * Number(item['invoicableQuantity'])).toFixed(2)) |
|
|
|
//金额(税额) = 金额(含模具费)*税率保留两位小数 |
|
|
|
item['singleAndAllocateTaxAmount'] = Number((Number(item['singleAndAllocateAmount']) * Number(formRef.value.formRef.formModel.taxRate) * 0.01).toFixed(5)) |
|
|
|
//金额(合计金额) = 金额(税额) + 金额(含模具费) 保留两位小数 |
|
|
|
item['singleAndAllocateTotal'] =Number((Number(item['singleAndAllocateTaxAmount'])+Number(item['singleAndAllocateAmount'])).toFixed(2)) |
|
|
|
} |
|
|
|
}) |
|
|
|
console.log('模具分摊单价', res) |
|
|
|