| | |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm">新增登记</el-button> |
| | | <el-button @click="handleOut">导出</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | |
| | | <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="taxInclusiveUnitPrice" /> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" /> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" /> |
| | | <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" :formatter="formattedNumber" /> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="开票数" prop="invoiceNum" /> |
| | | <el-table-column label="开票金额(元)" prop="invoiceAmount" /> |
| | | <el-table-column label="开票金额(元)" prop="invoiceAmount" :formatter="formattedNumber" /> |
| | | <el-table-column label="未开票数" prop="noInvoiceNum" /> |
| | | <el-table-column label="未开票金额(元)" prop="noInvoiceAmount"/> |
| | | <el-table-column label="未开票金额(元)" prop="noInvoiceAmount" :formatter="formattedNumber"/> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <el-table-column label="客户名称" prop="customerName" show-overflow-tooltip/> |
| | | <el-table-column label="业务员" prop="salesman" show-overflow-tooltip/> |
| | | <el-table-column label="项目名称" prop="projectName" show-overflow-tooltip/> |
| | | <el-table-column label="合同金额(元)" prop="contractAmount" show-overflow-tooltip/> |
| | | <el-table-column label="未开票金额(元)" prop="noInvoiceAmountTotal" show-overflow-tooltip/> |
| | | <el-table-column label="合同金额(元)" prop="contractAmount" show-overflow-tooltip :formatter="formattedNumber"/> |
| | | <el-table-column label="未开票金额(元)" prop="noInvoiceAmountTotal" show-overflow-tooltip :formatter="formattedNumber"/> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" :page="page.current" |
| | | :limit="page.size" @pagination="paginationChange" /> |
| | |
| | | <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="taxInclusiveUnitPrice" /> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" /> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" /> |
| | | <el-table-column label="数量" prop="quantity" width="70" /> |
| | | <el-table-column label="税率" prop="taxRate" width="70" /> |
| | | <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" 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> |
| | | <el-input type="number" min="0" disabled v-model="scope.row.noInvoiceAmount" :precision="2" :step="0.01"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | // import {userListNoPage} from "@/api/system/user.js"; |
| | | import { |
| | | getSalesLedgerWithProducts, |
| | | ledgerList, |
| | | ledgerListPage, |
| | | productList, |
| | | } from "@/api/salesManagement/salesLedger.js"; |
| | | import { |
| | |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | | |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | if (cellValue) { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | } else { |
| | | return cellValue; |
| | | } |
| | | }; |
| | | // 查询列表 |
| | | /** 搜索按钮操作 */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | const paginationChange = ({ current, limit }) => { |
| | | page.current = current; |
| | | page.size = limit; |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | ledgerList({...searchForm.value, ...page}).then(res => { |
| | | ledgerListPage({...searchForm.value, ...page}).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.rows; |
| | | tableData.value = res.records; |
| | | total.value = res.total |
| | | expandedRowKeys.value = [] |
| | | }) |
| | |
| | | // 表格选择数据 |
| | | const handleSelectionChange = (selection) => { |
| | | console.log('selection', selection) |
| | | selectedRows.value = selection |
| | | selectedRows.value = selection.filter(item => item.salesContractNo !== undefined); |
| | | } |
| | | const expandedRowKeys = ref([]) |
| | | // 展开行 |
| | |
| | | } |
| | | // 主表合计方法 |
| | | 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','noInvoiceAmountTotal']); |
| | | }; |
| | | // 子表合计方法 |
| | | 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() |