| | |
| | | <el-table-column align="center" label="序号" type="index" width="60" /> |
| | | <el-table-column label="产品大类" prop="productCategory" /> |
| | | <el-table-column label="规格型号" prop="specificationModel" /> |
| | | <el-table-column label="单位" prop="unit" /> |
| | | <el-table-column label="数量" prop="quantity" /> |
| | | <el-table-column label="税率" prop="taxRate" /> |
| | | <el-table-column label="单位" prop="unit" width="70"/> |
| | | <el-table-column label="数量" prop="quantity" width="70"/> |
| | | <el-table-column label="税率" prop="taxRate" width="70" /> |
| | | <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" /> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" /> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" /> |
| | |
| | | <el-table-column label="产品大类" prop="productCategory" /> |
| | | <el-table-column label="规格型号" prop="specificationModel" /> |
| | | <el-table-column label="单位" prop="unit" /> |
| | | <el-table-column label="数量" prop="quantity" /> |
| | | <el-table-column label="税率" prop="taxRate" /> |
| | | <el-table-column label="数量" prop="quantity" width="70" /> |
| | | <el-table-column label="税率" prop="taxRate" width="70" /> |
| | | <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" /> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" /> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" /> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" width="150" /> |
| | | <el-table-column label="本次开票数" prop="currentInvoiceNum"> |
| | | <template #default="scope"> |
| | | <el-input type="number" :step="1" min="0" v-model="scope.row.currentInvoiceNum" @blur="invoiceNumBlur(scope.row)"></el-input> |
| | | <el-input type="number" :step="0.1" min="0" v-model="scope.row.currentInvoiceNum" @blur="invoiceNumBlur(scope.row)"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="本次开票金额(元)" prop="currentInvoiceAmount" > |
| | | <el-table-column label="本次开票金额(元)" prop="currentInvoiceAmount" width="150"> |
| | | <template #default="scope"> |
| | | <el-input type="number" :step="0.01" min="0" v-model="scope.row.currentInvoiceAmount" disabled></el-input> |
| | | <el-input type="number" :step="0.01" min="0" v-model="scope.row.currentInvoiceAmount" @blur="invoiceAmountBlur(scope.row)" ></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="未开票数" prop="noInvoiceNum" > |
| | |
| | | <el-input type="number" min="0" disabled v-model="scope.row.noInvoiceNum"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="未开票金额(元)" prop="noInvoiceAmount" > |
| | | <el-table-column label="未开票金额(元)" prop="noInvoiceAmount" width="150" > |
| | | <template #default="scope"> |
| | | <el-input type="number" min="0" disabled v-model="scope.row.noInvoiceAmount"></el-input> |
| | | </template> |
| | |
| | | } |
| | | // 主表合计方法 |
| | | const summarizeMainTable = (param) => { |
| | | const { columns, data } = param; |
| | | const sums = []; |
| | | columns.forEach((column, index) => { |
| | | if (index === 0) { |
| | | sums[index] = '合计'; |
| | | return; |
| | | } |
| | | const prop = column.property; |
| | | if (['contractAmount'].includes(prop)) { |
| | | const values = data.map(item => Number(item[prop])); |
| | | if (!values.every(value => isNaN(value))) { |
| | | sums[index] = values.reduce((acc, val) => (!isNaN(val) ? acc + val : acc), 0); |
| | | } else { |
| | | sums[index] = ''; |
| | | } |
| | | } else { |
| | | sums[index] = ''; |
| | | } |
| | | }) |
| | | return sums; |
| | | return proxy.summarizeTable(param, ['contractAmount']); |
| | | }; |
| | | // 子表合计方法 |
| | | const summarizeChildrenTable = (param) => { |
| | | const { columns, data } = param; |
| | | const sums = []; |
| | | columns.forEach((column, index) => { |
| | | if (index === 0) { |
| | | sums[index] = '合计'; |
| | | return; |
| | | } |
| | | const prop = column.property; |
| | | if (['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice','invoiceNum','invoiceAmount','noInvoiceNum','noInvoiceAmount'].includes(prop)) { |
| | | const values = data.map(item => Number(item[prop])); |
| | | if (!values.every(value => isNaN(value))) { |
| | | sums[index] = values.reduce((acc, val) => (!isNaN(val) ? acc + val : acc), 0); |
| | | } else { |
| | | sums[index] = ''; |
| | | } |
| | | } else { |
| | | sums[index] = ''; |
| | | } |
| | | }); |
| | | return sums; |
| | | return proxy.summarizeTable(param, ['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice','invoiceNum','invoiceAmount','noInvoiceNum','noInvoiceAmount']); |
| | | } |
| | | // 打开弹框 |
| | | const openForm = () => { |
| | |
| | | if(!row.currentInvoiceNum){ |
| | | row.currentInvoiceNum = 0 |
| | | } |
| | | if(row.currentInvoiceNum > row.noInvoiceNum){ |
| | | if(row.currentInvoiceNum > row.tempNoInvoiceNum){ |
| | | proxy.$modal.msgWarning('本次开票数不得大于未开票数') |
| | | row.currentInvoiceNum = 0 |
| | | } |
| | | // 计算本次开票金额 |
| | | row.currentInvoiceAmount = row.currentInvoiceNum * row.taxInclusiveUnitPrice |
| | | row.currentInvoiceAmount = (row.currentInvoiceNum * row.taxInclusiveUnitPrice).toFixed(2) |
| | | // 计算未开票数 |
| | | row.noInvoiceNum = row.originalNoInvoiceNum - row.currentInvoiceNum |
| | | // 计算未开票金额 |
| | | row.noInvoiceAmount = row.noInvoiceNum * row.taxInclusiveUnitPrice |
| | | row.noInvoiceAmount = row.tempnoInvoiceAmount - row.currentInvoiceAmount |
| | | } |
| | | // 本次开票金额失焦操作 |
| | | const invoiceAmountBlur = (row) => { |
| | | if(!row.currentInvoiceAmount){ |
| | | row.currentInvoiceAmount = 0 |
| | | } |
| | | // 计算是否超过开票总金额 |
| | | if(row.currentInvoiceAmount > row.tempnoInvoiceAmount){ |
| | | proxy.$modal.msgWarning('本次开票金额不得大于未开票金额') |
| | | row.currentInvoiceAmount = 0 |
| | | } |
| | | // 计算本次开票数 |
| | | row.currentInvoiceNum = (row.currentInvoiceAmount / row.taxInclusiveUnitPrice).toFixed(2) |
| | | // 计算未开票数 |
| | | row.noInvoiceNum = row.originalNoInvoiceNum - row.currentInvoiceNum |
| | | // 计算未开票金额 |
| | | row.noInvoiceAmount = row.tempnoInvoiceAmount - row.currentInvoiceAmount |
| | | } |
| | | |
| | | getList() |