| | |
| | | <el-table-column align="center" type="selection" width="55" fixed="left"/> |
| | | <el-table-column type="expand" width="60" fixed="left"> |
| | | <template #default="props"> |
| | | <el-table :data="props.row.children" border show-summary :summary-method="summarizeChildrenTable"> |
| | | <el-table :data="props.row.children" border show-summary :summary-method="(param) => summarizeChildrenTable(param, props.row)"> |
| | | <el-table-column align="center" label="序号" type="index"/> |
| | | <el-table-column label="产品大类" prop="productCategory" /> |
| | | <el-table-column label="规格型号" prop="specificationModel" /> |
| | |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="数量" prop="quantity" :formatter="formattedNumber" /> |
| | | <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="taxInclusiveUnitPrice" :formatter="sensitiveAmountFormatter" /> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" :formatter="sensitiveAmountFormatter" /> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" :formatter="sensitiveAmountFormatter" /> |
| | | <!--操作--> |
| | | <el-table-column Width="60px" label="操作" align="center"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | type="primary" |
| | | size="small" |
| | | :disabled="!canShip(scope.row)" |
| | | @click="openDeliveryForm(scope.row)"> |
| | |
| | | <el-table-column label="其它说明事项" prop="remarks" width="200" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="操作" min-width="200" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm('edit', scope.row)" :disabled="!scope.row.isEdit">编辑</el-button> |
| | | <el-button link type="primary" size="small" @click="exportSalesContracts(scope.row)">导出销售合同</el-button> |
| | | <!-- <el-button link type="primary" size="small" @click="openForm('view', scope.row)">详情</el-button>--> |
| | | <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">附件</el-button> |
| | | <!-- <el-button link type="primary" size="small" @click="openDeliveryForm(scope.row)">发货</el-button>--> |
| | | <el-button link type="primary" @click="openForm('edit', scope.row)" :disabled="!scope.row.isEdit || scope.row.hasProductionRecord || !canEditLedger(scope.row)">编辑</el-button> |
| | | <el-button link type="primary" @click="downLoadFile(scope.row)">附件</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <el-form-item label="客户名称:" prop="customerId"> |
| | | <el-select v-model="form.customerId" placeholder="请选择" clearable :disabled="operationType === 'view'" filterable> |
| | | <el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" :value="item.id"> |
| | | {{ |
| | | item.customerName |
| | | {{ |
| | | item.customerName + "——" + item.taxpayerIdentificationNumber |
| | | }} |
| | | </el-option> |
| | | </el-select> |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="税率(%):" prop="taxRate"> |
| | | <el-select v-model="productForm.taxRate" placeholder="请选择" clearable @change="calculateFromTaxRate"> |
| | | <el-option label="1" value="1" /> |
| | | <el-option label="6" value="6" /> |
| | | <el-option label="13" value="13" /> |
| | | <el-option label="0" :value="0" /> |
| | | <el-option label="1" :value="1" /> |
| | | <el-option label="6" :value="6" /> |
| | | <el-option label="13" :value="13" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <div> |
| | | <el-button |
| | | type="danger" |
| | | size="small" |
| | | @click="removeApproverNode(index)" |
| | | v-if="approverNodes.length > 1" |
| | | >删除</el-button> |
| | |
| | | unit: "", |
| | | quantity: "", |
| | | taxInclusiveUnitPrice: "", |
| | | taxRate: "", |
| | | taxRate: 0, |
| | | taxInclusiveTotalPrice: "", |
| | | taxExclusiveTotalPrice: "", |
| | | invoiceType: "", |
| | |
| | | taxInclusiveUnitPrice: [ |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | ], |
| | | taxRate: [{ required: true, message: "请选择", trigger: "change" }], |
| | | // taxRate: [{ required: true, message: "请选择", trigger: "change" }], |
| | | taxInclusiveTotalPrice: [ |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | ], |
| | | taxExclusiveTotalPrice: [ |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | ], |
| | | invoiceType: [{ required: true, message: "请选择", trigger: "change" }], |
| | | // invoiceType: [{ required: true, message: "请选择", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { productForm, productRules } = toRefs(productFormData); |
| | |
| | | }); |
| | | }; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | if (cellValue === undefined || cellValue === null || cellValue === "") { |
| | | return "0.00"; |
| | | } |
| | | return parseFloat(cellValue).toFixed(3); |
| | | }; |
| | | const findLedgerRecordByRow = (row) => { |
| | | if (!row) return null; |
| | | if ( |
| | | row.maintainer !== undefined || |
| | | row.maintainerName !== undefined || |
| | | row.entryPerson !== undefined || |
| | | row.entryPersonName !== undefined |
| | | ) { |
| | | return row; |
| | | } |
| | | if (row.salesLedgerId !== undefined && row.salesLedgerId !== null) { |
| | | return tableData.value.find((item) => String(item.id) === String(row.salesLedgerId)) || null; |
| | | } |
| | | return null; |
| | | }; |
| | | const isCurrentUserMaintainer = (row) => { |
| | | const ledgerRecord = findLedgerRecordByRow(row); |
| | | if (!ledgerRecord) return true; |
| | | const currentUserId = String(userStore.id ?? ""); |
| | | const currentNickName = String(userStore.nickName ?? "").trim(); |
| | | const maintainerId = ledgerRecord.maintainerId ?? ledgerRecord.entryPerson; |
| | | const maintainerName = |
| | | ledgerRecord.maintainerName ?? ledgerRecord.maintainer ?? ledgerRecord.entryPersonName; |
| | | if (maintainerId !== undefined && maintainerId !== null && String(maintainerId) !== "") { |
| | | return String(maintainerId) === currentUserId; |
| | | } |
| | | if (maintainerName !== undefined && maintainerName !== null && String(maintainerName).trim() !== "") { |
| | | return String(maintainerName).trim() === currentNickName; |
| | | } |
| | | return true; |
| | | }; |
| | | const canEditLedger = (row) => isCurrentUserMaintainer(row); |
| | | const canDeleteLedger = (row) => isCurrentUserMaintainer(row); |
| | | const sensitiveAmountFormatter = (row, column, cellValue) => { |
| | | if (!isCurrentUserMaintainer(row)) { |
| | | return "*****"; |
| | | } |
| | | return formattedNumber(row, column, cellValue); |
| | | }; |
| | | // 获取tree子数据 |
| | | const getModels = (value) => { |
| | |
| | | }); |
| | | }; |
| | | // 子表合计方法 |
| | | const summarizeChildrenTable = (param) => { |
| | | const summarizeChildrenTable = (param, parentRow) => { |
| | | if (!isCurrentUserMaintainer(parentRow)) { |
| | | const { columns } = param; |
| | | return columns.map((column, index) => { |
| | | if (index === 0) { |
| | | return "合计"; |
| | | } |
| | | if (["taxInclusiveUnitPrice", "taxInclusiveTotalPrice", "taxExclusiveTotalPrice"].includes(column.property)) { |
| | | return "*****"; |
| | | } |
| | | return ""; |
| | | }); |
| | | } |
| | | return proxy.summarizeTable(param, [ |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | ], { |
| | | taxInclusiveUnitPrice: { decimalPlaces: 3 }, |
| | | taxInclusiveTotalPrice: { decimalPlaces: 3 }, |
| | | taxExclusiveTotalPrice: { decimalPlaces: 3 }, |
| | | }); |
| | | taxInclusiveUnitPrice: { decimalPlaces: 3 }, |
| | | taxInclusiveTotalPrice: { decimalPlaces: 3 }, |
| | | taxExclusiveTotalPrice: { decimalPlaces: 3 }, |
| | | }); |
| | | }; |
| | | // 判断是否能编辑 |
| | | const canEditLedger = (row) => { |
| | | // 如果是维护人,则可以编辑 |
| | | return Number(row.entryPerson) === Number(userStore.id); |
| | | }; |
| | | |
| | | // 判断是否能删除 |
| | | const canDeleteLedger = (row) => { |
| | | // 如果是维护人,则可以删除 |
| | | return Number(row.entryPerson) === Number(userStore.id); |
| | | }; |
| | | |
| | | // 判断是否是维护人(用于权限校验) |
| | | const isMaintainer = (row) => { |
| | | return row.entryPerson === userStore.id; |
| | | }; |
| | | |
| | | // 打开弹框 |
| | | const openForm = async (type, row) => { |
| | | if (type === "edit" && row && !canEditLedger(row)) { |
| | |
| | | productData.value = products.map((p) => { |
| | | const quantity = Number(p.quantity ?? 0) || 0; |
| | | const unitPrice = Number(p.unitPrice ?? 0) || 0; |
| | | const taxRate = "13"; // 默认 13%,便于直接提交(如需可在产品中自行修改) |
| | | const taxRate = Number(p.taxRate ?? 0) || 0; // 默认 13%,便于直接提交(如需可在产品中自行修改) |
| | | const taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(3); |
| | | const taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(taxInclusiveTotalPrice, taxRate, 3); |
| | | return { |
| | |
| | | } |
| | | |
| | | productOperationType.value = type; |
| | | productForm.value = {}; |
| | | productForm.value = { |
| | | taxRate: 0, |
| | | invoiceType: "增普票" |
| | | }; |
| | | proxy.resetForm("productFormRef"); |
| | | if (type === "edit") { |
| | | productForm.value = { ...row }; |
| | |
| | | const submitProduct = () => { |
| | | proxy.$refs["productFormRef"].validate((valid) => { |
| | | if (valid) { |
| | | productForm.value.taxRate = productForm.value.taxRate?productForm.value.taxRate:0; |
| | | if (operationType.value === "edit") { |
| | | submitProductEdit(); |
| | | } else { |
| | |
| | | /** 判断单个产品是否已发货(根据shippingStatus判断,已发货或审核通过不可编辑和删除) */ |
| | | const isProductShipped = (product) => { |
| | | if (!product) return false; |
| | | |
| | | const status = String(product.shippingStatus || "").trim(); |
| | | // 如果发货状态是"已发货"或"审核通过",则不可编辑和删除 |
| | | return status === "已发货" || status === "审核通过"; |
| | |
| | | <div class="print-page"> |
| | | <div class="delivery-note"> |
| | | <div class="header"> |
| | | <div class="company-name">阳光彩印有限责任公司</div> |
| | | <div class="document-title">零售发货单</div> |
| | | </div> |
| | | |
| | |
| | | </div> |
| | | <div> |
| | | <span class="label">客户名称:</span> |
| | | <span class="value">${item.customerName || '张爱有'}</span> |
| | | <span class="value">${item.customerName}</span> |
| | | </div> |
| | | </div> |
| | | <div class="info-row"> |
| | |
| | | |
| | | // 根据不含税总价计算含税单价和数量 |
| | | const calculateFromExclusiveTotalPrice = () => { |
| | | if (!productForm.value.taxRate) { |
| | | proxy.$modal.msgWarning("请先选择税率"); |
| | | return; |
| | | } |
| | | // if (!productForm.value.taxRate) { |
| | | // proxy.$modal.msgWarning("请先选择税率"); |
| | | // return; |
| | | // } |
| | | if (isCalculating.value) return; |
| | | |
| | | const exclusiveTotalPrice = parseFloat(productForm.value.taxExclusiveTotalPrice); |
| | |
| | | |
| | | // 根据数量变化计算总价 |
| | | const calculateFromQuantity = () => { |
| | | if (!productForm.value.taxRate) { |
| | | proxy.$modal.msgWarning("请先选择税率"); |
| | | return; |
| | | } |
| | | // if (!productForm.value.taxRate) { |
| | | // proxy.$modal.msgWarning("请先选择税率"); |
| | | // return; |
| | | // } |
| | | if (isCalculating.value) return; |
| | | |
| | | const quantity = parseFloat(productForm.value.quantity); |
| | |
| | | productForm.value.taxRate, |
| | | 3 |
| | | ); |
| | | } |
| | | }else{ |
| | | productForm.value.taxExclusiveTotalPrice = (unitPrice * quantity).toFixed(3); |
| | | } |
| | | |
| | | isCalculating.value = false; |
| | | }; |
| | | |
| | | // 根据含税单价变化计算总价 |
| | | const calculateFromUnitPrice = () => { |
| | | if (!productForm.value.taxRate) { |
| | | proxy.$modal.msgWarning("请先选择税率"); |
| | | return; |
| | | } |
| | | // if (!productForm.value.taxRate) { |
| | | // proxy.$modal.msgWarning("请先选择税率"); |
| | | // return; |
| | | // } |
| | | if (isCalculating.value) return; |
| | | |
| | | const quantity = parseFloat(productForm.value.quantity); |
| | |
| | | |
| | | // 根据税率变化计算不含税总价 |
| | | const calculateFromTaxRate = () => { |
| | | if (!productForm.value.taxRate) { |
| | | proxy.$modal.msgWarning("请先选择税率"); |
| | | return; |
| | | } |
| | | // if (!productForm.value.taxRate) { |
| | | // proxy.$modal.msgWarning("请先选择税率"); |
| | | // return; |
| | | // } |
| | | if (isCalculating.value) return; |
| | | |
| | | const inclusiveTotalPrice = parseFloat(productForm.value.taxInclusiveTotalPrice); |