| | |
| | | |
| | | <div style="padding-top: 20px"> |
| | | <span class="descriptions">产品列表</span> |
| | | <PIMTable :isShowPagination="false" rowKey="id" :column="tableColumn" :tableData="tableData" /> |
| | | <PIMTable :isShowPagination="false" rowKey="id" :column="tableColumn" :tableData="tableData"> |
| | | <template #unQuantity="{ row }"> |
| | | {{ calcAlreadyReturned(row) }} |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | </div> |
| | | <template #footer> |
| | |
| | | const tableData = ref([]); |
| | | const availableProducts = ref([]); |
| | | |
| | | const calcAlreadyReturned = (row) => { |
| | | const total = Number(row?.shippingNum ?? row?.totalQuantity ?? 0); |
| | | const returned = Number(row?.returnQuantity ?? row?.num ?? 0); |
| | | if (!Number.isFinite(total) || !Number.isFinite(returned)) return 0; |
| | | return total - returned; |
| | | }; |
| | | |
| | | const tableColumn = [ |
| | | {align: "center", label: "产品大类", prop: "productCategory"}, |
| | | {align: "center", label: "规格型号", prop: "specificationModel"}, |
| | | {align: "center", label: "图纸编号", prop: "specificationModel"}, |
| | | {align: "center", label: "单位", prop: "unit", width: 80}, |
| | | {align: "center", label: "总数量", prop: "quantity", width: 120}, |
| | | {align: "center", label: "已退货数量", prop: "totalReturnNum", width: 120}, |
| | | {align: "center", label: "未退货数量", prop: "unQuantity", width: 120}, |
| | | {align: "center", label: "总数量", prop: "shippingNum", width: 120}, |
| | | {align: "center", label: "未退货数量", prop: "unQuantity", width: 120, dataType: "slot", slot: "unQuantity"}, |
| | | {align: "center", label: "退货数量", prop: "returnQuantity", width: 120}, |
| | | {align: "center", label: "退货产品单价", prop: "price", width: 120}, |
| | | {align: "center", label: "退货产品金额", prop: "amount", width: 120}, |
| | |
| | | ]; |
| | | |
| | | const getStatusType = (status) => { |
| | | const statusMap = { |
| | | 0: "warning", |
| | | 1: "success" |
| | | }; |
| | | return statusMap[status] || "info"; |
| | | const statusMap = { |
| | | 0: "warning", |
| | | 1: "success", |
| | | 2: "warning" |
| | | }; |
| | | return statusMap[status] || "info"; |
| | | }; |
| | | |
| | | const getStatusText = (status) => { |
| | | const statusMap = { |
| | | 0: "待处理", |
| | | 1: "已处理" |
| | | }; |
| | | return statusMap[status] || "未知"; |
| | | const statusMap = { |
| | | 0: "待处理", |
| | | 1: "已处理", |
| | | 2: "已撤销" |
| | | }; |
| | | return statusMap[status] || "未知"; |
| | | }; |
| | | |
| | | const openDialog = async (row) => { |
| | |
| | | isQuality: raw?.isQuality ?? 2, |
| | | remark: raw?.remark ?? "", |
| | | }; |
| | | return product ? { ...product, ...normalized } : normalized; |
| | | return product ? { ...product, ...normalized, returnQuantity: normalized.returnQuantity } : normalized; |
| | | }) : []; |
| | | } catch (e) { |
| | | console.error("Failed to load detail", e); |