| | |
| | | >导入 |
| | | </el-button> |
| | | <el-button @click="handleOut">导出</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">删除 </el-button> |
| | | <el-button type="danger" plain @click="handleDelete" v-hasPermi="['salesManagement:salesLedger:remove']">删除 </el-button> |
| | | <el-button type="primary" plain @click="handlePrint">打印 </el-button> |
| | | </div> |
| | | </div> |
| | |
| | | width="200" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="退货状态" |
| | | prop="returnStatus" |
| | | align="center" |
| | | width="100" |
| | | > |
| | | <template #default="scope"> |
| | | <el-tag |
| | | :type="getReturnStatusType(scope.row.returnStatus)" |
| | | size="small" |
| | | > |
| | | {{ scope.row.returnStatus || '无退货' }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" label="操作" width="220" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="openForm('view', scope.row)" |
| | |
| | | link |
| | | type="primary" |
| | | @click="openForm('edit', scope.row)" |
| | | :disabled=" |
| | | !scope.row.isEdit || |
| | | scope.row.hasProductionRecord || |
| | | !canEditLedger(scope.row) |
| | | " |
| | | :disabled="!canEditLedger(scope.row)" |
| | | >编辑 |
| | | </el-button> |
| | | <el-button link type="primary" @click="openFileDialog(scope.row)" |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="付款方式"> |
| | | <el-input |
| | | <el-select |
| | | v-model="form.paymentMethod" |
| | | placeholder="请输入" |
| | | placeholder="请选择" |
| | | clearable |
| | | :disabled="operationType === 'view'" |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="现金" value="现金" /> |
| | | <el-option label="电汇" value="电汇" /> |
| | | <el-option label="微信" value="微信" /> |
| | | <el-option label="支付宝" value="支付宝" /> |
| | | <el-option label="支票" value="支票" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="采购合同号:" prop="purchaseContractNumber"> |
| | | <el-select |
| | | v-model="form.purchaseContractNumber" |
| | | placeholder="请选择采购合同号" |
| | | clearable |
| | | filterable |
| | | style="width: 100%" |
| | | :disabled="operationType === 'view'" |
| | | > |
| | | <el-option |
| | | v-for="item in purchaseContractOptions" |
| | | :key="item.purchaseContractNumber" |
| | | :label="item.purchaseContractNumber + ' - ' + item.supplierName" |
| | | :value="item.purchaseContractNumber" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="交货日期:" prop="entryDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.deliveryDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable |
| | | :disabled="operationType === 'view'" |
| | | /> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="交货日期:" prop="entryDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.deliveryDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable |
| | | :disabled="operationType === 'view'" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-form-item label="产品信息:" prop="entryDate"> |
| | | <el-button |
| | |
| | | v-if="operationType !== 'view'" |
| | | plain |
| | | type="danger" |
| | | @click="deleteProduct" |
| | | >删除 |
| | | @click="deleteProduct">删除 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-row> |
| | |
| | | <el-table-column |
| | | label="含税单价(元)" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | :formatter="sensitiveAmountFormatter" |
| | | /> |
| | | <el-table-column |
| | | label="含税总价(元)" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | :formatter="sensitiveAmountFormatter" |
| | | /> |
| | | <el-table-column |
| | | label="不含税总价(元)" |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | :formatter="sensitiveAmountFormatter" |
| | | /> |
| | | <el-table-column label="是否生产" prop="isProduction" width="150"> |
| | | <!-- 是否生产列已隐藏,默认值为 false --> |
| | | <!-- <el-table-column label="是否生产" prop="isProduction" width="150"> |
| | | <template #default="scope"> |
| | | <el-tag :type="scope.row.isProduction ? 'success' : 'info'"> |
| | | {{ scope.row.isProduction ? "是" : "否" }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> --> |
| | | <el-table-column |
| | | fixed="right" |
| | | label="操作" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <!-- 是否生产字段已隐藏,默认值为 false --> |
| | | <!-- <el-col :span="12"> |
| | | <el-form-item label="是否生产:" prop="isProduction"> |
| | | <el-radio-group v-model="productForm.isProduction"> |
| | | <el-radio label="是" :value="true" /> |
| | | <el-radio label="否" :value="false" /> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-col> --> |
| | | </el-row> |
| | | </el-form> |
| | | </FormDialog> |
| | |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24" v-if="deliveryForm.type === '货车'"> |
| | | <el-form-item label="出库批号:" prop="outboundBatches"> |
| | | <el-input |
| | | v-model="deliveryForm.outboundBatches" |
| | | placeholder="请输入出库批号" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24" v-else> |
| | | <el-form-item label="快递公司:" prop="expressCompany"> |
| | | <el-input |
| | |
| | | } from "@/api/salesManagement/salesLedger.js"; |
| | | import { getStockInventoryByModelId } from "@/api/inventoryManagement/stockInventory.js"; |
| | | import { modelList, productTreeList } from "@/api/basicData/product.js"; |
| | | import { purchaseList } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import useFormData from "@/hooks/useFormData.js"; |
| | | import dayjs from "dayjs"; |
| | | import FileUpload from "@/components/AttachmentUpload/file/index.vue"; |
| | |
| | | const customerOption = ref([]); |
| | | const productOptions = ref([]); |
| | | const modelOptions = ref([]); |
| | | const purchaseContractOptions = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | |
| | | executionDate: "", |
| | | hasProductionRecord: false, |
| | | createTime: "", |
| | | purchaseContractNumber: "", |
| | | }, |
| | | rules: { |
| | | salesman: [{ required: true, message: "请选择", trigger: "change" }], |
| | |
| | | taxInclusiveTotalPrice: "", |
| | | taxExclusiveTotalPrice: "", |
| | | invoiceType: "", |
| | | isProduction: false, |
| | | isProduction: false, // 默认值为 false(否) |
| | | }, |
| | | productRules: { |
| | | productCategory: [{ required: true, message: "请选择", trigger: "change" }], |
| | |
| | | const getDeliveryBatchNoList = async (productModelId) => { |
| | | if (!productModelId) return []; |
| | | const res = await getStockInventoryByModelId(productModelId); |
| | | const rawList = Array.isArray(res?.data) |
| | | ? res.data |
| | | : res?.data?.records || res?.data?.rows || []; |
| | | const rawList = res.data || []; |
| | | const seenIds = new Set(); |
| | | return rawList |
| | | .filter((item) => { |
| | | if (!item?.id || !item?.batchNo || seenIds.has(item.id)) { |
| | | return false; |
| | | } |
| | | seenIds.add(item.id); |
| | | return true; |
| | | }) |
| | | .map((item) => ({ |
| | | ...item, |
| | | deliveryQuantity: 0, |
| | | })); |
| | | }; |
| | | const validateDeliveryShippingCarNumber = (_rule, value, callback) => { |
| | | if (deliveryForm.value.type === "货车" && !value) { |
| | |
| | | expressCompany: "", |
| | | expressNumber: "", |
| | | type: "货车", // 货车, 快递 |
| | | outboundBatches: "", |
| | | }, |
| | | deliveryRules: { |
| | | shippingCarNumber: [ |
| | |
| | | listCustomer({ current: -1, size: -1, type: 0 }).then((res) => { |
| | | customerOption.value = res.data.records; |
| | | }); |
| | | // 获取采购合同列表 |
| | | await getPurchaseContractList(); |
| | | form.value.entryPerson = userStore.id; |
| | | if (type === "add") { |
| | | // 新增时设置录入日期为当天 |
| | |
| | | // 签订日期默认为当天 |
| | | form.value.executionDate = getCurrentDate(); |
| | | // 创建时间默认为当天 |
| | | form.value.createTime = getCurrentDate(); |
| | | form.value.createTime = dayjs().format("YYYY-MM-DD HH:mm:ss"); |
| | | // 默认自动生成销售合同号 |
| | | form.value.autoGenerateContractNo = true; |
| | | } else { |
| | |
| | | taxInclusiveTotalPrice: taxInclusiveTotalPrice, |
| | | taxExclusiveTotalPrice: taxExclusiveTotalPrice, |
| | | invoiceType: "增普票", |
| | | isProduction: true, |
| | | isProduction: false, // 默认值为 false(否) |
| | | productId: p.productId, |
| | | productModelId: p.productModelId, |
| | | }; |
| | |
| | | productOperationType.value = type; |
| | | productForm.value = {}; |
| | | if (type === "add") { |
| | | productForm.value.isProduction = true; |
| | | productForm.value.isProduction = false; // 默认值为 false(否) |
| | | } |
| | | proxy.resetForm("productFormRef"); |
| | | if (type === "edit") { |
| | |
| | | getProductOptions(); |
| | | } |
| | | productFormVisible.value = true; |
| | | }; |
| | | |
| | | // 获取采购合同列表 |
| | | const getPurchaseContractList = async () => { |
| | | try { |
| | | const res = await purchaseList({ current: -1, size: -1 }); |
| | | purchaseContractOptions.value = res.rows; |
| | | } catch (error) { |
| | | console.error("获取采购合同列表失败", error); |
| | | purchaseContractOptions.value = []; |
| | | } |
| | | }; |
| | | // 提交产品表单 |
| | | const submitProduct = () => { |
| | |
| | | }; |
| | | |
| | | // 打印功能 |
| | | const handlePrint = async () => { |
| | | const handlePrint = async () => { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("请选择要打印的数据"); |
| | | return; |
| | |
| | | // 格式化日期 |
| | | const formatDate = (dateString) => { |
| | | if (!dateString) return getCurrentDate(); |
| | | const date = new Date(dateString); |
| | | const year = date.getFullYear(); |
| | | const month = String(date.getMonth() + 1).padStart(2, "0"); |
| | | const day = String(date.getDate()).padStart(2, "0"); |
| | | return `${year}/${month}/${day}`; |
| | | return dayjs(dateString).format("YYYY/MM/DD HH:mm:ss"); |
| | | }; |
| | | // 格式化日期时间 |
| | | const formatDateTime = (date) => { |
| | |
| | | type: "货车", |
| | | batchNo: [], |
| | | batchNoList, |
| | | outboundBatches: "", |
| | | }; |
| | | deliveryFileList.value = []; |
| | | deliveryFormVisible.value = true; |
| | |
| | | shippingCarNumber: |
| | | deliveryForm.value.type === "货车" |
| | | ? deliveryForm.value.shippingCarNumber |
| | | : "", |
| | | outboundBatches: |
| | | deliveryForm.value.type === "货车" |
| | | ? deliveryForm.value.outboundBatches |
| | | : "", |
| | | expressCompany: |
| | | deliveryForm.value.type === "快递" |
| | |
| | | let res = await userStore.getInfo(); |
| | | currentFactoryName.value = res.user.currentFactoryName; |
| | | }; |
| | | |
| | | // 获取退货状态标签类型 |
| | | const getReturnStatusType = (returnStatus) => { |
| | | const statusMap = { |
| | | '无退货': 'success', |
| | | '部分退货': 'warning', |
| | | '全部退货': 'danger', |
| | | }; |
| | | return statusMap[returnStatus] || 'info'; |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | searchForm.salesContractNo = route.query.salesContractNo; |
| | | getList(); |
| | |
| | | page-break-after: avoid; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |