| | |
| | | </div> |
| | | <div class="table_list"> |
| | | <div style="display: flex;justify-content: flex-end;margin-bottom: 20px;"> |
| | | <el-button type="success" |
| | | plain |
| | | @click="handleBatchGenerate">批量生成数据</el-button> |
| | | <el-button type="primary" |
| | | @click="openForm('add')">新增台账</el-button> |
| | | <el-button type="primary" |
| | |
| | | prop="availableQuality" /> |
| | | <el-table-column label="退货数量" |
| | | prop="returnQuality" /> |
| | | <el-table-column label="运费单价(元)" |
| | | prop="freightUnitPrice" |
| | | :formatter="formattedNumber" /> |
| | | <el-table-column label="总运费(元)" |
| | | prop="totalFreight" |
| | | :formatter="formattedNumber" /> |
| | | <el-table-column label="税率(%)" |
| | | prop="taxRate" /> |
| | | <el-table-column label="含税单价(元)" |
| | |
| | | width="100" |
| | | prop="paymentMethod" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="车牌号" |
| | | prop="carPlateNumber" |
| | | width="140" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="运输单位/个人" |
| | | prop="transportUnitOrPerson" |
| | | width="180" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="合同金额(元)" |
| | | prop="contractAmount" |
| | | width="200" |
| | |
| | | </el-button> |
| | | <el-button link |
| | | type="primary" |
| | | @click="handleStockIn(scope.row)" |
| | | :disabled="scope.row.approvalStatus !== 3 || scope.row.stockInStatus === '完全入库'">入库 |
| | | :disabled="scope.row.approvalStatus !== 3 || scope.row.stockInStatus === '完全入库'" |
| | | @click="handleStockIn(scope.row)">入库 |
| | | </el-button> |
| | | <el-button link |
| | | type="primary" |
| | |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="车牌号:" |
| | | prop="carPlateNumber"> |
| | | <el-input v-model="form.carPlateNumber" |
| | | placeholder="请输入" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="运输单位/个人:" |
| | | prop="transportUnitOrPerson"> |
| | | <el-input v-model="form.transportUnitOrPerson" |
| | | placeholder="请输入" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-table-column label="数量" |
| | | prop="quantity" |
| | | width="70" /> |
| | | <el-table-column label="运费单价(元)" |
| | | prop="freightUnitPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" /> |
| | | <el-table-column label="总运费(元)" |
| | | prop="totalFreight" |
| | | :formatter="formattedNumber" |
| | | width="150" /> |
| | | <el-table-column label="库存预警数量" |
| | | prop="warnNum" |
| | | width="120" |
| | |
| | | style="width: 100%" |
| | | v-model="productForm.quantity" |
| | | placeholder="请输入" |
| | | @change="mathNum" /> |
| | | @change="handleQuantityChange" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="运费单价(元):" |
| | | prop="freightUnitPrice"> |
| | | <el-input-number v-model="productForm.freightUnitPrice" |
| | | :precision="2" |
| | | :step="0.1" |
| | | :min="0" |
| | | clearable |
| | | style="width: 100%" |
| | | @change="handleFreightUnitPriceChange" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="总运费(元):" |
| | | prop="totalFreight"> |
| | | <el-input-number v-model="productForm.totalFreight" |
| | | :precision="2" |
| | | :step="0.1" |
| | | :min="0" |
| | | clearable |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | getOptions, |
| | | getPurchaseTemplateList, |
| | | delPurchaseTemplate, |
| | | batchGeneratePurchaseInboundSteps, |
| | | manualStockIn, |
| | | } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import { addSutockIn } from "@/api/inventoryManagement/stockIn.js"; |
| | | import useFormData from "@/hooks/useFormData.js"; |
| | | const FileList = defineAsyncComponent(() => |
| | | import("@/components/Dialog/FileList.vue") |
| | |
| | | }); |
| | | const total = ref(0); |
| | | const fileList = ref([]); |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { modelList, productTreeList } from "@/api/basicData/product.js"; |
| | | import dayjs from "dayjs"; |
| | | import FileUpload from "@/components/AttachmentUpload/file/index.vue"; |
| | | |
| | | const userStore = useUserStore(); |
| | | |
| | | // 订单审批状态显示文本 |
| | | const approvalStatusText = { |
| | |
| | | supplierName: "", |
| | | supplierId: "", |
| | | paymentMethod: "", |
| | | carPlateNumber: "", |
| | | transportUnitOrPerson: "", |
| | | executionDate: "", |
| | | isChecked: false, |
| | | }, |
| | |
| | | specificationModel: "", |
| | | unit: "", |
| | | quantity: "", |
| | | freightUnitPrice: "", |
| | | totalFreight: "", |
| | | taxInclusiveUnitPrice: "", |
| | | taxRate: "", |
| | | taxInclusiveTotalPrice: "", |
| | |
| | | }; |
| | | |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | if (cellValue === undefined || cellValue === null || cellValue === "") { |
| | | return "0.00"; |
| | | } |
| | | const num = Number(cellValue); |
| | | if (Number.isNaN(num)) return "0.00"; |
| | | return num.toFixed(2); |
| | | }; |
| | | // 查询列表 |
| | | /** 搜索按钮操作 */ |
| | |
| | | return proxy.summarizeTable( |
| | | param, |
| | | [ |
| | | "freightUnitPrice", |
| | | "totalFreight", |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | |
| | | stockInLoading.value = true; |
| | | const params = { |
| | | purchaseLedgerId: stockInForm.purchaseLedgerId, |
| | | purchaseContractNumber: stockInForm.purchaseContractNumber, |
| | | nickName: userStore.nickName, |
| | | details: stockInForm.details.map(item => ({ |
| | | id: item.id, |
| | | inboundQuantity: item.inboundQuantity, |
| | | isContainsWater: item.isContainsWater, |
| | | waterContent: item.isContainsWater ? item.waterContent : 0, |
| | | actualInboundQuantity: item.actualInboundQuantity, |
| | | inboundQuantity: Number(item.inboundQuantity), |
| | | isContainsWater: !!item.isContainsWater, |
| | | waterContent: item.isContainsWater ? Number(item.waterContent || 0) : 0, |
| | | actualInboundQuantity: Number(item.actualInboundQuantity), |
| | | })), |
| | | }; |
| | | |
| | | const res = await addSutockIn(params); |
| | | const res = await manualStockIn(params); |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess("入库成功"); |
| | | stockInDialogVisible.value = false; |
| | |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | "totalFreight", |
| | | ]); |
| | | }; |
| | | // 打开弹框 |
| | |
| | | if (type === "edit") { |
| | | // 复制行数据 |
| | | productForm.value = { ...row }; |
| | | if (productForm.value.freightUnitPrice === undefined) { |
| | | productForm.value.freightUnitPrice = ""; |
| | | } |
| | | if (productForm.value.totalFreight === undefined) { |
| | | productForm.value.totalFreight = ""; |
| | | } |
| | | |
| | | // 如果是从模板加载的数据,可能没有 productId 和 productModelId |
| | | // 需要根据 productCategory 和 specificationModel 来查找对应的 ID |
| | |
| | | // 最后再等待一次 DOM 更新,确保所有数据都已设置 |
| | | await nextTick(); |
| | | } |
| | | computeTotalFreight(); |
| | | }; |
| | | |
| | | const computeTotalFreight = () => { |
| | | const hasQuantity = |
| | | productForm.value.quantity !== "" && |
| | | productForm.value.quantity !== null && |
| | | productForm.value.quantity !== undefined; |
| | | const hasFreightUnitPrice = |
| | | productForm.value.freightUnitPrice !== "" && |
| | | productForm.value.freightUnitPrice !== null && |
| | | productForm.value.freightUnitPrice !== undefined; |
| | | if (!hasQuantity || !hasFreightUnitPrice) return; |
| | | |
| | | const quantity = Number(productForm.value.quantity); |
| | | const freightUnitPrice = Number(productForm.value.freightUnitPrice); |
| | | if (!Number.isFinite(quantity) || !Number.isFinite(freightUnitPrice)) return; |
| | | |
| | | productForm.value.totalFreight = (quantity * freightUnitPrice).toFixed(2); |
| | | }; |
| | | |
| | | const handleQuantityChange = () => { |
| | | mathNum(); |
| | | computeTotalFreight(); |
| | | }; |
| | | |
| | | const handleFreightUnitPriceChange = () => { |
| | | computeTotalFreight(); |
| | | }; |
| | | const getProductOptions = () => { |
| | | return productTreeList().then(res => { |
| | |
| | | }); |
| | | }; |
| | | |
| | | const handleBatchGenerate = async () => { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("请选择数据"); |
| | | return; |
| | | } |
| | | const ids = selectedRows.value.map(item => item.id); |
| | | |
| | | ElMessageBox.confirm("确认批量生成数据?", "批量生成", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "info", |
| | | }) |
| | | .then(() => { |
| | | proxy.$modal.loading("正在批量生成数据,请稍候..."); |
| | | batchGeneratePurchaseInboundSteps({ ids }) |
| | | .then(res => { |
| | | proxy.$modal.msgSuccess("批量生成成功"); |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msgError("批量生成失败"); |
| | | }) |
| | | .finally(() => { |
| | | proxy.$modal.closeLoading(); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | }; |
| | | |
| | | // 获取当前日期并格式化为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |