| | |
| | | <el-button type="primary" @click="openProductSelection" :disabled="!form.shippingId">添加产品</el-button> |
| | | </div> |
| | | <PIMTable :isShowPagination="false" rowKey="id" :column="tableColumn" :tableData="tableData"> |
| | | <template #totalReturnNum="{ row }"> |
| | | {{ calcAlreadyReturned(row) }} |
| | | </template> |
| | | <template #returnQuantity="{ row }"> |
| | | <el-input |
| | | v-model="row.returnQuantity" |
| | | style="width:100px" |
| | | placeholder="请输入" |
| | | <el-input |
| | | v-model="row.returnQuantity" |
| | | style="width:100px" |
| | | placeholder="请输入" |
| | | type="number" |
| | | @input="(val) => handleReturnQuantityChange(val, row)" |
| | | /> |
| | | </template> |
| | | <template #price="{ row }"> |
| | | <el-input |
| | | v-model="row.price" |
| | | style="width:100px" |
| | | placeholder="请输入" |
| | | <el-input |
| | | v-model="row.price" |
| | | style="width:100px" |
| | | placeholder="请输入" |
| | | type="number" |
| | | @input="(val) => handlePriceChange(val, row)" |
| | | /> |
| | | </template> |
| | | <template #amount="{ row }"> |
| | | <el-input |
| | | v-model="row.amount" |
| | | style="width:100px" |
| | | placeholder="自动计算" |
| | | <el-input |
| | | v-model="row.amount" |
| | | style="width:100px" |
| | | placeholder="自动计算" |
| | | type="number" |
| | | disabled |
| | | /> |
| | |
| | | </el-select> |
| | | </template> |
| | | <template #remark="{ row }"> |
| | | <el-input |
| | | v-model="row.remark" |
| | | style="width:130px" |
| | | placeholder="请输入" |
| | | <el-input |
| | | v-model="row.remark" |
| | | style="width:130px" |
| | | placeholder="请输入" |
| | | /> |
| | | </template> |
| | | <template #action="{ index }"> |
| | |
| | | </el-dialog> |
| | | |
| | | <el-dialog v-model="productSelectionVisible" title="选择产品" width="70%" append-to-body> |
| | | <el-table |
| | | :data="availableProducts" |
| | | style="width: 100%" |
| | | <el-table |
| | | :data="availableProducts" |
| | | style="width: 100%" |
| | | @selection-change="handleSelectionChange" |
| | | ref="productTableRef" |
| | | row-key="id" |
| | |
| | | <el-table-column align="center" prop="specificationModel" label="规格型号" /> |
| | | <el-table-column align="center" prop="unit" label="单位" /> |
| | | <el-table-column align="center" prop="stockOutNum" label="总数量" /> |
| | | <el-table-column align="center" label="已退货数量" prop="totalReturnNum"></el-table-column> |
| | | <el-table-column align="center" prop="unQuantity" label="未退货数量" /> |
| | | <el-table-column align="center" label="已退货数量"> |
| | | <template #default="{ row }">{{ calcAlreadyReturned(row) }}</template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column align="center" prop="pendingReturnNum" label="待处理退货数量" /> |
| | | </el-table> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | |
| | | {align: "center", label: "规格型号", prop: "specificationModel" }, |
| | | {align: "center", label: "单位", prop: "unit", width: 80 }, |
| | | {align: "center", label: "总数量", prop: "stockOutNum", width: 120 }, |
| | | {align: "center", label: "已退货数量", prop: "totalReturnNum", width: 120, dataType: "slot", slot: "totalReturnNum" }, |
| | | {align: "center", label: "已退货数量", prop: "totalReturnNum", width: 120 }, |
| | | {align: "center", label: "待处理退货数量", prop: "pendingReturnNum", width: 120 }, |
| | | {align: "center", label: "未退货数量", prop: "unQuantity", width: 120 }, |
| | | {align: "center", label: "退货数量", prop: "returnQuantity", dataType: "slot", slot: "returnQuantity", width: 120 }, |
| | | {align: "center", label: "退货产品单价", prop: "price", dataType: "slot", slot: "price", width: 120 }, |
| | |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | emit('close'); |
| | | data.form = { |
| | | returnNoCheckbox: true, |
| | | returnNo: "", |
| | | customerId: "", |
| | | shippingId: "", |
| | | projectId: "", |
| | | maker: "", |
| | | makeTime: "", |
| | | status: 0, |
| | | returnReason: "", |
| | | refundAmount: "", |
| | | } |
| | | }; |
| | | |
| | | const initCustomers = async () => { |
| | |
| | | form.value.shippingId = ""; |
| | | outboundOptions.value = []; |
| | | } |
| | | |
| | | |
| | | // Find customer name for getSalesLedger if it requires name |
| | | const customer = customerNameOptions.value.find(c => c.id === val); |
| | | if (!customer) return; |
| | |
| | | // Assuming getSalesLedger takes customerName. If it takes ID, adjust accordingly. |
| | | // Previous code used customerName. Let's try passing customerName. |
| | | getSalesLedger({ |
| | | customerName: customer.label, |
| | | customerName: customer.label, |
| | | }).then(res => { |
| | | if(res.code === 200){ |
| | | outboundOptions.value = res.data.map(item => ({ |
| | |
| | | if(res.code === 200){ |
| | | // If backend returns project info, set it |
| | | if (res.data.projectId) form.value.projectId = res.data.projectId; |
| | | |
| | | |
| | | availableProducts.value = mergeShippingProductLists(res.data); |
| | | if (clearTable) tableData.value = []; |
| | | } |
| | |
| | | |
| | | const handleReturnQuantityChange = (val, row) => { |
| | | if (val === "" || val === null) return; |
| | | const max = row.unQuantity === undefined || row.unQuantity === null ? Infinity : Number(row.unQuantity || 0); |
| | | const unQuantity = row.unQuantity === undefined || row.unQuantity === null ? Infinity : Number(row.unQuantity || 0);//未退货数量 |
| | | const pendingReturnNum = row.pendingReturnNum === undefined || row.pendingReturnNum === null ? Infinity : Number(row.pendingReturnNum || 0);//待处理退货数量 |
| | | //最大退货数量,如果为编辑状态加上待处理退货数量 |
| | | const max = operationType.value === 'edit' ? unQuantity + pendingReturnNum : unQuantity |
| | | const current = Number(val); |
| | | |
| | | |
| | | if (current > max) { |
| | | proxy.$nextTick(() => { |
| | | row.returnQuantity = max; |
| | |
| | | // Removed checkSelectable to allow toggling existing items |
| | | const confirmProductSelection = () => { |
| | | const newTableData = []; |
| | | |
| | | |
| | | selectedProducts.value.forEach(product => { |
| | | const existing = tableData.value.find(item => item.id === product.id); |
| | | if (existing) { |
| | |
| | | } else { |
| | | newTableData.push({ |
| | | ...product, |
| | | returnSaleLedgerProductId: product.id, |
| | | returnSaleLedgerProductId: product.id, |
| | | productModelId: product.productModelId, |
| | | returnQuantity: 0, |
| | | num: 0, |
| | |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | |
| | | tableData.value = newTableData; |
| | | productSelectionVisible.value = false; |
| | | }; |