| | |
| | | <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" width="160" /> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" width="180" /> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" width="180" /> |
| | | <el-table-column fixed="right" label="操作" width="150" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openDeliveryForm(props.row, scope.row)">发货</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column fixed="right" label="操作" width="150" align="center">--> |
| | | <!-- <template #default="scope">--> |
| | | <!-- <el-button link type="primary" size="small" @click="openDeliveryForm(props.row, scope.row)">发货</el-button>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <el-button link type="primary" size="small" @click="openForm('edit', scope.row)">编辑</el-button> |
| | | <!-- <el-button link type="primary" size="small" @click="openForm('view', scope.row)">详情</el-button>--> |
| | | <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">附件</el-button> |
| | | <el-button link type="primary" size="small" @click="openDeliveryForm(scope.row)">发货</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import {onMounted, ref} from "vue"; |
| | | import { addShippingInfo } from "@/api/salesManagement/deliveryLedger.js"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import {ElMessage, ElMessageBox} from "element-plus"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import FileList from "./fileList.vue"; |
| | |
| | | delLedger, |
| | | addOrUpdateSalesLedgerProduct, |
| | | delProduct, |
| | | delLedgerFile, |
| | | delLedgerFile, getProductInventory, |
| | | } from "@/api/salesManagement/salesLedger.js"; |
| | | import { modelList, productTreeList } from "@/api/basicData/product.js"; |
| | | import useFormData from "@/hooks/useFormData.js"; |
| | |
| | | } |
| | | |
| | | // 打开发货弹框 |
| | | const openDeliveryForm = async (parentRow, productRow) => { |
| | | // productRow的minStock和quantity |
| | | console.log('22222', productRow) |
| | | |
| | | // 检查产品库存是否足够 |
| | | const requiredQuantity = productRow.quantity || 0; // 需要发货的数量 |
| | | |
| | | try { |
| | | // 等待获取库存信息 |
| | | const res = await getStockInPage({ |
| | | current: 1, |
| | | size: 100 |
| | | }); |
| | | // console.log('res33333', res.data.records) |
| | | // 通过 productRow.id 过滤出对应的库存记录 |
| | | const matchingStockRecords = res.data?.records?.filter(record => |
| | | record.salesLedgerProductId === productRow.id |
| | | ) || []; |
| | | |
| | | // 计算匹配记录的总库存数量 |
| | | const currentStock = matchingStockRecords.reduce((total, record) => { |
| | | return total + (record.inboundNum0 || 0); |
| | | }, 0); |
| | | // 检查库存是否充足 |
| | | if (currentStock < requiredQuantity) { |
| | | // 库存不足提示 |
| | | proxy.$modal.msgWarning(`产品库存不足`); |
| | | return; |
| | | } |
| | | |
| | | // 库存充足,继续打开发货弹框 |
| | | currentDeliveryContext.value = { parentRow, productRow }; |
| | | const openDeliveryForm = (row) => { |
| | | getProductInventory({ salesLedgerId: row.id, type:1 }).then((res) => { |
| | | currentDeliveryRow.value = row; |
| | | deliveryForm.value = { |
| | | shippingDate: getCurrentDate(), |
| | | shippingCarNumber: "", |
| | | }; |
| | | deliveryFormVisible.value = true; |
| | | |
| | | } catch (error) { |
| | | console.error('获取库存信息失败:', error); |
| | | proxy.$modal.msgError("获取库存信息失败,请重试"); |
| | | } |
| | | }).catch(err => { |
| | | ElMessage.error(err.msg); |
| | | }); |
| | | }; |
| | | |
| | | // 提交发货表单 |