| | |
| | | <el-descriptions-item label="快递公司">{{ detailRow.expressCompany || '--' }}</el-descriptions-item> |
| | | <el-descriptions-item label="快递单号" :span="2">{{ detailRow.expressNumber || '--' }}</el-descriptions-item> |
| | | </el-descriptions> |
| | | <el-table :data="getDeliveryProductInfoList()" |
| | | border |
| | | size="small" |
| | | class="delivery-product-table" |
| | | style="width: 100%; margin-top: 16px;"> |
| | | <el-table-column label="批号" |
| | | prop="batchNo" |
| | | min-width="160" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="产品名称" |
| | | prop="productName" |
| | | min-width="160" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="规格型号" |
| | | prop="specificationModel" |
| | | min-width="160" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="发货数量" |
| | | prop="deliveryQuantity" |
| | | min-width="120" |
| | | align="center"/> |
| | | </el-table> |
| | | <ImagePreview :file-list="detailRow.storageBlobVOs || []" /> |
| | | </div> |
| | | <template #footer> |
| | |
| | | import {getCurrentDate} from "@/utils/index.js"; |
| | | import { |
| | | deliveryLedgerListPage, |
| | | delDeliveryLedger, deductStock, |
| | | delDeliveryLedger, |
| | | deductStock, |
| | | getDeliveryDetail, |
| | | } from "@/api/salesManagement/deliveryLedger.js"; |
| | | import {delLedgerFile} from "@/api/salesManagement/salesLedger.js"; |
| | | import ImageUpload from "@/components/AttachmentUpload/image/index.vue"; |
| | |
| | | // 详情弹框 |
| | | const detailDialogVisible = ref(false); |
| | | const detailRow = ref(null); |
| | | const detailProductList = ref([]); |
| | | |
| | | // 用户信息表单弹框数据 |
| | | const operationType = ref(""); |
| | |
| | | }; |
| | | |
| | | // 打开详情弹框 |
| | | const openDetail = (row) => { |
| | | const openDetail = async (row) => { |
| | | detailRow.value = row || null; |
| | | const list = Array.isArray(row?.commonFileList) ? row.commonFileList : []; |
| | | detailProductList.value = []; |
| | | detailDialogVisible.value = true; |
| | | if (!row?.id) return; |
| | | try { |
| | | const res = await getDeliveryDetail(row.id); |
| | | const detailData = res?.data; |
| | | detailRow.value = { |
| | | ...row, |
| | | ...(Array.isArray(detailData) ? {} : detailData || {}), |
| | | }; |
| | | detailProductList.value = resolveDeliveryDetailList(detailData); |
| | | } catch (error) { |
| | | proxy.$modal.msgError("加载发货台账详情失败"); |
| | | } |
| | | }; |
| | | const resolveDeliveryDetailList = data => { |
| | | if (Array.isArray(data)) return data; |
| | | if (!data || typeof data !== "object") return []; |
| | | return [ |
| | | data.batchNoDetailList, |
| | | data.batchNoList, |
| | | data.shippingBatchList, |
| | | data.shippingInfoDetailList, |
| | | data.detailList, |
| | | data.batchDetailList, |
| | | data.rows, |
| | | data.records, |
| | | data.list, |
| | | data.data, |
| | | ].find(value => Array.isArray(value) && value.length) || []; |
| | | }; |
| | | const getDeliveryProductInfoList = () => { |
| | | const row = detailRow.value; |
| | | if (!row) return []; |
| | | const normalizeBatchNoList = value => { |
| | | if (Array.isArray(value)) return value; |
| | | if (typeof value === "string" && value.includes(",")) { |
| | | return value.split(",").map(item => item.trim()).filter(Boolean); |
| | | } |
| | | return value ? [value] : []; |
| | | }; |
| | | const detailList = detailProductList.value.length ? detailProductList.value : [ |
| | | row.batchNoDetailList, |
| | | row.batchNoList, |
| | | row.shippingBatchList, |
| | | row.shippingInfoDetailList, |
| | | row.detailList, |
| | | row.batchDetailList, |
| | | ].find(value => Array.isArray(value) && value.length); |
| | | const batchNoList = normalizeBatchNoList(row.batchNo); |
| | | const toTableRow = (item = {}) => ({ |
| | | batchNo: |
| | | typeof item === "string" || typeof item === "number" |
| | | ? item |
| | | : item.batchNo ?? item.batchNumber ?? row.batchNo ?? "--", |
| | | productName: item.productName ?? row.productName ?? "--", |
| | | specificationModel: |
| | | item.specificationModel ?? item.model ?? row.specificationModel ?? "--", |
| | | deliveryQuantity: |
| | | item.deliveryQuantity ?? |
| | | item.quantity ?? |
| | | item.shippingQuantity ?? |
| | | row.deliveryQuantity ?? |
| | | row.quantity ?? |
| | | "--", |
| | | }); |
| | | if (detailList?.length) { |
| | | return detailList.map(toTableRow); |
| | | } |
| | | if (batchNoList.length) { |
| | | return batchNoList.map(batchNo => toTableRow({batchNo})); |
| | | } |
| | | return [toTableRow()]; |
| | | }; |
| | | const closeDetail = () => { |
| | | detailDialogVisible.value = false; |
| | | detailRow.value = null; |
| | | detailProductList.value = []; |
| | | }; |
| | | |
| | | // 提交表单 |