| | |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (!valid) return; |
| | | if (!tableData.value || tableData.value.length === 0) { |
| | | proxy.$modal.msgWarning("请至少添加一个退货产品"); |
| | | return; |
| | | } |
| | | for (let i = 0; i < tableData.value.length; i++) { |
| | | const row = tableData.value[i]; |
| | | const qty = Number(row.num ?? row.returnQuantity ?? 0); |
| | | if (!qty || qty <= 0) { |
| | | proxy.$modal.msgWarning(`第${i + 1}行退货数量必须大于0`); |
| | | return; |
| | | } |
| | | if (row.price === "" || row.price === null || row.price === undefined || Number(row.price) < 0) { |
| | | proxy.$modal.msgWarning(`第${i + 1}行退货单价不能为负数`); |
| | | return; |
| | | } |
| | | } |
| | | const returnSaleProducts = (tableData.value || []).map(el => ({ |
| | | stockOutRecordId: el.returnSaleLedgerProductId ?? el.id, |
| | | productModelId: el.productModelId, |