| | |
| | | <el-table-column label="供应商名称" prop="supplierName" show-overflow-tooltip /> |
| | | <el-table-column label="项目名称" prop="projectName" show-overflow-tooltip /> |
| | | <el-table-column label="合同金额(元)" prop="contractAmount" show-overflow-tooltip :formatter="formattedNumber" /> |
| | | <el-table-column fixed="right" label="操作" min-width="60" align="center"> |
| | | <!-- <el-table-column fixed="right" label="操作" min-width="60" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">编辑</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> --> |
| | | </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-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="开票日期:" prop="issueDate"> |
| | | <el-date-picker disabled style="width: 100%" v-model="form.issueDate" value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" type="date" placeholder="请选择" clearable /> |
| | | <el-date-picker disabled style="width: 100%" v-model="form.issueDate" type="date" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-form-item label="产品信息:" prop="entryDate"> |
| | | </el-form-item> |
| | | </el-row> |
| | | <el-table :data="productData" border @selection-change="productSelected" show-summary |
| | | :summary-method="summarizeChildrenTable"> |
| | | <el-table :data="productData" border @selection-change="productSelected" show-summary style="width: 100%" :summary-method="summarizeChildrenTable"> |
| | | <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" :formatter="formattedNumber" /> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="单位" prop="unit" width="70" /> |
| | | <el-table-column label="数量" prop="quantity" width="70"/> |
| | | <el-table-column label="税率(%)" prop="taxRate" width="80" /> |
| | | <el-table-column label="含税单价(元)" width="150" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="含税总价(元)" width="150" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="不含税总价(元)" width="150" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="本次来票数" prop="ticketsNum" width="170"> |
| | | <template #default="scope"> |
| | | <el-input-number v-model="scope.row.ticketsNum" :precision="0" :step="1" clearable style="width: 100%" |
| | | @blur="invoiceNumBlur(scope.row)" /> |
| | | <el-input-number v-model="scope.row.ticketsNum" placeholder="请选择" :min="0" :step="0.1" clearable style="width: 100%" |
| | | @change="invoiceNumBlur(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="本次来票金额(元)" prop="ticketsAmount" :formatter="formattedNumber"></el-table-column> |
| | | <el-table-column label="本次来票金额(元)" prop="ticketsAmount" :min="0" :step="0.1" :formatter="formattedNumber" @change="invoiceAmountBlur" width="170"> |
| | | <template #default="scope"> |
| | | <el-input-number v-model="scope.row.ticketsAmount" placeholder="请选择" :min="0" :step="0.1" clearable style="width: 100%" |
| | | @change="invoiceAmountBlur(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="未来票数" prop="futureTickets" |
| | | :formatter="(row) => row.futureTickets == null || row.futureTickets === '' ? row.quantity : row.futureTickets"> |
| | | : ="(row) => row.futureTickets == null || row.futureTickets === '' ? row.quantity : row.futureTickets"> |
| | | </el-table-column> |
| | | <el-table-column label="未来票金额(元)" prop="futureTicketsAmount" |
| | | :formatter="(row) => (row.futureTicketsAmount !== undefined && row.futureTicketsAmount !== null && row.futureTicketsAmount !== '' ? row.futureTicketsAmount : row.taxExclusiveTotalPrice)"> |
| | |
| | | import { |
| | | addOrUpdateRegistration, |
| | | delRegistration, |
| | | gePurchaseList, |
| | | gePurchaseListPage, |
| | | getInfo, |
| | | getProduct, |
| | | getPurchaseNoById, |
| | |
| | | purchaseContractNumber: '', |
| | | }, |
| | | form: { |
| | | issueDate:"",// 开票日期 |
| | | purchaseLedgerId: '', |
| | | purchaseLedgerNo: '', |
| | | issUerId: '', // 开票人id |
| | | issUer: '' ,// 开票人姓名 |
| | | invoiceNumber:"", // 发票号 |
| | | invoiceAmount:"", // 发票金额 |
| | | }, |
| | | rules: { |
| | | purchaseLedgerId: [{ required: true, message: "请选择", trigger: "change" }], |
| | | invoiceNumber: [{ required: true, message: '请输入发票号' , trigger: 'blur' },{type:"string"}], |
| | | invoiceAmount: [{ required: true, message: '请输入发票金额' , trigger: 'blur'}], |
| | | |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | |
| | | 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 |
| | | gePurchaseList({ ...searchForm.value, ...page }).then(res => { |
| | | gePurchaseListPage({ ...searchForm.value, ...page }).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.rows |
| | | tableData.value = res.records; |
| | | tableData.value.map(item => { |
| | | item.children = [] |
| | | }) |
| | |
| | | }; |
| | | // 表格选择数据 |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection |
| | | selectedRows.value = selection.filter(item => item.purchaseContractNumber !== undefined); |
| | | } |
| | | const productSelected = (selectedRows) => { |
| | | productSelectedRows.value = selectedRows |
| | |
| | | if (expandedRows.length > 0) { |
| | | expandedRowKeys.value = [] |
| | | try { |
| | | productList({ salesLedgerId: row.purchaseLedgerId, type: 2 }).then(res => { |
| | | productList({ salesLedgerId: row.id, type: 2 }).then(res => { |
| | | const index = tableData.value.findIndex(item => item.id === row.id); |
| | | if (index > -1) { |
| | | tableData.value[index].children = res.rows; |
| | | tableData.value[index].children = res; |
| | | } |
| | | expandedRowKeys.value.push(row.id) |
| | | }) |
| | |
| | | |
| | | // 打开弹框 |
| | | const openForm = (type, row) => { |
| | | invoiceNumBlur(row) |
| | | operationType.value = type |
| | | form.value = {} |
| | | productData.value = [] |
| | | fileList.value = [] |
| | | form.value.issUerId = userStore.id |
| | | form.value.issUer = userStore.name |
| | | form.value.issueDate = getNowFormatDate() |
| | | userListNoPage().then(res => { |
| | | userList.value = res.data |
| | | }) |
| | |
| | | if (type === 'add' && row && row.id) { |
| | | form.value.purchaseLedgerId = row.id |
| | | getPurchaseNoById({ id: row.id }).then(res => { |
| | | purchaseLedgerList.value = res, |
| | | form.value.purchaseLedgerNo = res.purchaseContractNumber; |
| | | form.value.invoiceAmount = res.invoiceAmount; |
| | | form.value.invoiceNumber = res.invoiceNumber; |
| | | setInfo(res.id) |
| | | let result = res.data |
| | | purchaseLedgerList.value = result, |
| | | form.value.purchaseLedgerNo = result.purchaseContractNumber; |
| | | form.value.invoiceAmount = result.invoiceAmount; |
| | | form.value.invoiceNumber = result.invoiceNumber; |
| | | setInfo(result.id) |
| | | }) |
| | | } else { |
| | | getProduct().then(res => { |
| | |
| | | // 选择采购合同号赋值 |
| | | const setInfo = (value) => { |
| | | getInfo({ id: value }).then(res => { |
| | | form.value.salesContractNo = res.salesContractNo |
| | | form.value.projectName = res.projectName |
| | | productData.value = res.productData |
| | | form.value.supplierName = res.supplierName |
| | | let result = res.data |
| | | form.value.salesContractNo = result.salesContractNo |
| | | form.value.projectName = result.projectName |
| | | productData.value = result.productData |
| | | form.value.supplierName = result.supplierName |
| | | }) |
| | | } |
| | | // 提交表单 |
| | |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef") |
| | | dialogFormVisible.value = false |
| | | } |
| | | // 填写数据 |
| | | const openProductEdit = (row) => { |
| | | const index = productData.value.findIndex(item => item.id === row.id); |
| | | if (index > -1) { |
| | | productData.value[index].editFlag = !productData.value[index].editFlag |
| | | } |
| | | } |
| | | // 导出 |
| | | const handleOut = () => { |
| | |
| | | proxy.$modal.msg("已取消") |
| | | }) |
| | | } |
| | | //本次开票失焦操作 |
| | | //本次来票数失焦操作 |
| | | const invoiceNumBlur = (row) => { |
| | | if (!row.ticketsNum) { |
| | | row.ticketsNum = 0 |
| | | if (!row.ticketsNum || row.ticketsNum === '') { |
| | | row.ticketsNum = 0 |
| | | } |
| | | if (Number(row.ticketsNum) > Number(row.futureTickets)) { |
| | | if (Number(row.ticketsNum) > Number(row.tempFutureTickets)) { |
| | | proxy.$modal.msgWarning('本次开票数不得大于未开票数') |
| | | row.ticketsNum = 0 |
| | | return |
| | | } |
| | | // 计算本次开票金额 |
| | | // 计算本次来票金额 |
| | | row.ticketsAmount = row.ticketsNum * row.taxInclusiveUnitPrice |
| | | // 计算未开票数 |
| | | row.futureTickets = row.futureTickets - row.ticketsNum |
| | | // 计算未开票金额 |
| | | row.futureTicketsAmount = row.futureTickets * row.taxInclusiveUnitPrice |
| | | // 计算未来票数 |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum |
| | | // 计算未来票金额 |
| | | row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount |
| | | calculateinvoiceAmount() |
| | | } |
| | | // 本次来票金额失焦操作 |
| | | const invoiceAmountBlur = (row) => { |
| | | if(!row.ticketsAmount){ |
| | | row.ticketsAmount = 0 |
| | | } |
| | | // 计算是否超过来票总金额 |
| | | if(row.ticketsAmount > row.tempFutureTicketsAmount){ |
| | | proxy.$modal.msgWarning('本次来票金额不得大于未来票金额') |
| | | row.ticketsAmount = 0 |
| | | } |
| | | // 计算本次来票数 |
| | | row.ticketsNum = (row.ticketsAmount / row.taxInclusiveUnitPrice).toFixed(2) |
| | | // 计算未来票数 |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum |
| | | // 计算未来票金额 |
| | | row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount |
| | | calculateinvoiceAmount() |
| | | } |
| | | |
| | | // 获取当前日期函数 |
| | | function getNowFormatDate() { |
| | | let date = new Date(), |
| | | year = date.getFullYear(), //获取完整的年份(4位) |
| | | month = date.getMonth() + 1, //获取当前月份(0-11,0代表1月) |
| | | strDate = date.getDate() // 获取当前日(1-31) |
| | | if (month < 10) month = `0${month}` // 如果月份是个位数,在前面补0 |
| | | if (strDate < 10) strDate = `0${strDate}` // 如果日是个位数,在前面补0 |
| | | return `${year}-${month}-${strDate}` |
| | | } |
| | | |
| | | |
| | | function calculateinvoiceAmount() { |
| | | console.log('productData',productData.value) |
| | | var invoiceAmountTotal = 0 |
| | | productData.value.forEach(item => { |
| | | if(item.ticketsAmount){ |
| | | invoiceAmountTotal += item.ticketsAmount |
| | | } |
| | | }) |
| | | form.value.invoiceAmount = invoiceAmountTotal.toFixed(2) |
| | | |
| | | } |
| | | |
| | | getList() |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| | | <style scoped lang="scss"></style> |