| | |
| | | <span class="title-text">产品列表</span> |
| | | </div> |
| | | <el-button type="primary" size="small" style="margin-bottom: 20px" @click="isShowProductsModal = true" :disabled="!formState.purchaseLedgerId">添加产品</el-button> |
| | | <el-table :data="formState.purchaseReturnOrderProductsDtos" |
| | | <div class="product-table-scroll"> |
| | | <el-table class="product-table-inner" |
| | | :data="formState.purchaseReturnOrderProductsDtos" |
| | | border |
| | | max-height="400" |
| | | :scroll-y="true" |
| | | show-summary |
| | | :summary-method="summarizeChildrenTable"> |
| | | <el-table-column align="center" |
| | |
| | | label="序号" |
| | | type="index" |
| | | width="60" /> |
| | | <el-table-column label="入库单号" |
| | | prop="inboundBatches" |
| | | width="150" /> |
| | | <el-table-column label="批次号" |
| | | prop="batchNo" |
| | | width="150" /> |
| | | <el-table-column label="产品大类" |
| | | prop="productCategory" /> |
| | | <el-table-column label="规格型号" |
| | |
| | | prop="unit" |
| | | width="70" /> |
| | | <el-table-column label="数量" |
| | | prop="quantity" |
| | | prop="stockInNum" |
| | | width="100" /> |
| | | <el-table-column label="可退货数量" |
| | | prop="availableQuality" |
| | | prop="unQuantity" |
| | | width="130" /> |
| | | <el-table-column label="已退货数量" |
| | | prop="totalReturnNum" |
| | | width="130" /> |
| | | <el-table-column label="退货数量" |
| | | prop="returnQuantity" |
| | |
| | | placeholder="请输入退货数量" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="库存预警数量" |
| | | <!-- <el-table-column label="库存预警数量" |
| | | prop="warnNum" |
| | | width="120" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="税率(%)" |
| | | prop="taxRate" |
| | | width="80" /> |
| | | width="80" /> --> |
| | | <el-table-column label="含税单价(元)" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" /> |
| | | width="120" /> |
| | | <el-table-column label="退货总价(元)" |
| | | prop="taxInclusiveTotalPrice" |
| | | width="180"> |
| | | width="120"> |
| | | <template #default="scope"> |
| | | {{ formatAmount(getReturnTotal(scope.row)) || '--' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="是否质检" |
| | | prop="isChecked" |
| | | width="150"> |
| | | width="100"> |
| | | <template #default="scope"> |
| | | <el-tag :type="scope.row.isChecked ? 'success' : 'info'"> |
| | | {{ scope.row.isChecked ? '是' : '否' }} |
| | |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="section-title"> |
| | |
| | | import {getOptions, purchaseList} from "@/api/procurementManagement/procurementLedger.js"; |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | const ProductList = defineAsyncComponent(() => import("@/views/procurementManagement/purchaseReturnOrder/ProductList.vue")); |
| | | import { |
| | | productList, |
| | | } from "@/api/procurementManagement/procurementLedger.js"; |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | |
| | | } |
| | | |
| | | const getReturnQtyMax = (row) => { |
| | | const max = Number(row?.availableQuality) |
| | | const max = Number(row?.unQuantity) |
| | | if (Number.isNaN(max) || max < 0) { |
| | | return 0 |
| | | } |
| | |
| | | return proxy.summarizeTable( |
| | | param, |
| | | [ |
| | | "quantity", |
| | | "availableQuality", |
| | | "stockInNum", |
| | | "unQuantity", |
| | | "returnQuantity", |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | ], |
| | | { |
| | | quantity: { noDecimal: true }, // 不保留小数 |
| | | stockInNum: { noDecimal: true }, // 不保留小数 |
| | | returnQuantity: { noDecimal: true }, // 不保留小数 |
| | | availableQuality: { noDecimal: true }, // 不保留小数 |
| | | unQuantity: { noDecimal: true }, // 不保留小数 |
| | | } |
| | | ); |
| | | }; |
| | |
| | | } |
| | | } |
| | | |
| | | // 处理改变采购台账数据 |
| | | const handleChangePurchaseLedgerId = async () => { |
| | | // 处理改变采购台账数据(不请求接口回显产品,产品仅在「添加产品」弹窗勾选后写入) |
| | | const handleChangePurchaseLedgerId = () => { |
| | | resetFeeInfo() |
| | | if (!formState.value.purchaseLedgerId) { |
| | | formState.value.purchaseReturnOrderProductsDtos = [] |
| | | return |
| | | } |
| | | const res = await productList({ salesLedgerId: formState.value.purchaseLedgerId, type: 2 }); |
| | | formState.value.purchaseReturnOrderProductsDtos = res.data.map(item => ({ |
| | | ...item, |
| | | returnQuantity: undefined, |
| | | taxInclusiveTotalPrice: 0, |
| | | salesLedgerProductId: item.id, |
| | | })) |
| | | formState.value.purchaseReturnOrderProductsDtos = [] |
| | | syncTotalAmount() |
| | | } |
| | | |
| | |
| | | ...item, |
| | | returnQuantity: undefined, |
| | | taxInclusiveTotalPrice: 0, |
| | | salesLedgerProductId: item.id, |
| | | salesLedgerProductId: item.salesLedgerProductId ?? item.id, |
| | | })); |
| | | formState.value.purchaseReturnOrderProductsDtos.push(...newProducts); |
| | | syncTotalAmount() |
| | |
| | | // 逐行校验退货数量:任意一行未填/非法/超限都不允许提交 |
| | | const invalidRowIndex = productList.findIndex((item) => { |
| | | const qty = Number(item.returnQuantity) |
| | | const maxQty = Number(item.availableQuality) |
| | | const maxQty = Number(item.unQuantity) |
| | | |
| | | if (item.returnQuantity === null || item.returnQuantity === undefined || item.returnQuantity === "") { |
| | | return true |
| | |
| | | |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid) { |
| | | createPurchaseReturnOrder(formState.value).then(res => { |
| | | console.log(productList) |
| | | const submitPayload = { |
| | | ...formState.value, |
| | | purchaseReturnOrderProductsDtos: productList.map((row) => ({ |
| | | ...row, |
| | | stockInRecordId: row.id, |
| | | })), |
| | | } |
| | | createPurchaseReturnOrder(submitPayload).then(res => { |
| | | // 关闭模态框 |
| | | isShow.value = false; |
| | | // 告知父组件已完成 |
| | |
| | | border-radius: 50%; |
| | | margin-right: 8px; |
| | | } |
| | | |
| | | .product-table-scroll { |
| | | width: 100%; |
| | | overflow-x: auto; |
| | | } |
| | | |
| | | .product-table-inner { |
| | | min-width: 1280px; |
| | | } |
| | | </style> |