| | |
| | | width="100px" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-tag |
| | | v-if="scope.row.approveStatus === 1 " |
| | | <el-tag v-if="scope.row.approveStatus === 1 " |
| | | type="success">充足 |
| | | </el-tag> |
| | | <el-tag |
| | | v-else-if="scope.row.approveStatus === 0 && scope.row.noQuantity === 0" |
| | | <el-tag v-else-if="scope.row.approveStatus === 0 && scope.row.noQuantity === 0" |
| | | type="success">已出库 |
| | | </el-tag> |
| | | <el-tag v-else |
| | |
| | | placeholder="请选择" |
| | | clearable |
| | | @change="calculateFromTaxRate"> |
| | | <el-option |
| | | v-for="dict in tax_rate" |
| | | <el-option v-for="dict in tax_rate" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </FormDialog> |
| | | <!-- // todo 附件预览相关 --> |
| | | <!-- 附件列表弹窗 --> |
| | | <FileList v-if="fileDialogVisible" v-model:visible="fileDialogVisible" record-type="sales_ledger" |
| | | <FileList v-if="fileDialogVisible" |
| | | v-model:visible="fileDialogVisible" |
| | | record-type="sales_ledger" |
| | | :record-id="recordId"/> |
| | | <!-- 打印预览弹窗 --> |
| | | <el-dialog v-model="printPreviewVisible" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="待发货数量:"> |
| | | <el-input :model-value="currentDeliveryRow?.noQuantity" |
| | | disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | import {listCustomer} from "@/api/basicData/customer.js"; |
| | | |
| | | const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue")); |
| | | const FileList = defineAsyncComponent(() => |
| | | import("@/components/Dialog/FileList.vue") |
| | | ); |
| | | |
| | | const router = useRouter(); |
| | | const route = useRoute(); |
| | |
| | | const deliveryFormVisible = ref(false); |
| | | const currentDeliveryRow = ref(null); |
| | | const getDeliveryBatchQuantity = item => { |
| | | const quantity = item?.qualitity |
| | | ?? item?.quantity |
| | | ?? item?.unLockedQuantity |
| | | ?? item?.qualifiedUnLockedQuantity |
| | | ?? item?.qualifiedQuantity |
| | | ?? item?.stockQuantity; |
| | | const quantity = |
| | | item?.qualitity ?? |
| | | item?.quantity ?? |
| | | item?.unLockedQuantity ?? |
| | | item?.qualifiedUnLockedQuantity ?? |
| | | item?.qualifiedQuantity ?? |
| | | item?.stockQuantity; |
| | | return quantity ?? 0; |
| | | }; |
| | | const getCurrentDeliveryRowQuantity = () => { |
| | |
| | | return Math.max(0, Math.min(batchQuantity, remainingProductQuantity)); |
| | | }; |
| | | const handleDeliveryBatchQuantityChange = row => { |
| | | const max = getDeliveryBatchDeliveryMax(row); |
| | | const productQuantity = getCurrentDeliveryRowQuantity(); |
| | | const batchQuantity = Number(getDeliveryBatchQuantity(row) || 0); |
| | | const otherBatchTotal = (deliveryForm.value.batchNoList || []).reduce( |
| | | (sum, item) => { |
| | | if (item?.id === row?.id) return sum; |
| | | return sum + Number(item?.deliveryQuantity || 0); |
| | | }, |
| | | 0 |
| | | ); |
| | | const remainingProductQuantity = Math.max( |
| | | 0, |
| | | productQuantity - otherBatchTotal |
| | | ); |
| | | const currentValue = Number(row?.deliveryQuantity || 0); |
| | | if (currentValue > max) { |
| | | row.deliveryQuantity = max; |
| | | proxy.$modal.msgWarning("发货数量不能超过这个产品的数量"); |
| | | |
| | | if (currentValue > batchQuantity) { |
| | | row.deliveryQuantity = batchQuantity; |
| | | proxy.$modal.msgWarning("发货数量不能大于库存数量"); |
| | | } else if (currentValue > remainingProductQuantity) { |
| | | row.deliveryQuantity = remainingProductQuantity; |
| | | proxy.$modal.msgWarning("所有批次发货数量之和不能大于待发货数量"); |
| | | } |
| | | }; |
| | | const getSelectedDeliveryBatchRows = () => { |
| | |
| | | ? res.data |
| | | : res?.data?.records || res?.data?.rows || []; |
| | | const seenIds = new Set(); |
| | | return rawList.filter(item => { |
| | | return rawList |
| | | .filter(item => { |
| | | if (!item?.id || !item?.batchNo || seenIds.has(item.id)) { |
| | | return false; |
| | | } |
| | | seenIds.add(item.id); |
| | | return true; |
| | | }).map(item => ({ |
| | | }) |
| | | .map(item => ({ |
| | | ...item, |
| | | deliveryQuantity: 0, |
| | | })); |
| | |
| | | <tbody> |
| | | ${ |
| | | item.products && |
| | | item.products |
| | | .length > 0 |
| | | item |
| | | .products |
| | | .length > |
| | | 0 |
| | | ? item.products |
| | | .map( |
| | | product => ` |
| | |
| | | </tr> |
| | | ` |
| | | ) |
| | | .join("") |
| | | .join( |
| | | "" |
| | | ) |
| | | : '<tr><td colspan="6" style="text-align: center; color: #999;">暂无产品数据</td></tr>' |
| | | } |
| | | </tbody> |
| | |
| | | }; |
| | | |
| | | // 打开附件弹窗 |
| | | const recordId = ref(0) |
| | | const fileDialogVisible = ref(false) |
| | | const recordId = ref(0); |
| | | const fileDialogVisible = ref(false); |
| | | |
| | | // 打开附件弹框 |
| | | const openFileDialog = async (row) => { |
| | | recordId.value = row.id |
| | | fileDialogVisible.value = true |
| | | } |
| | | const openFileDialog = async row => { |
| | | recordId.value = row.id; |
| | | fileDialogVisible.value = true; |
| | | }; |
| | | |
| | | // 打开发货弹框 |
| | | const openDeliveryForm = async row => { |
| | |
| | | (sum, item) => sum + Number(item.deliveryQuantity || 0), |
| | | 0 |
| | | ); |
| | | const currentRowQuantity = Number(currentDeliveryRow.value?.quantity || 0); |
| | | if (currentRowQuantity > 0 && totalDeliveryQuantity > currentRowQuantity) { |
| | | proxy.$modal.msgWarning("批号发货总数不能超过当前产品数量"); |
| | | const currentRowNoQuantity = Number( |
| | | currentDeliveryRow.value?.noQuantity || 0 |
| | | ); |
| | | if ( |
| | | currentRowNoQuantity > 0 && |
| | | totalDeliveryQuantity > currentRowNoQuantity |
| | | ) { |
| | | proxy.$modal.msgWarning("批号发货总数不能超过待发货数量"); |
| | | return; |
| | | } |
| | | // 保存当前展开的行ID,以便发货后重新加载子表格数据 |
| | | const currentExpandedKeys = [...expandedRowKeys.value]; |
| | | const salesLedgerId = currentDeliveryRow.value.salesLedgerId; |
| | | deliveryForm.value.batchNo = selectedBatchRows.map(item => item.id); |
| | | const productModelId = currentDeliveryRow.value.productModelId || currentDeliveryRow.value.modelId; |
| | | const productModelId = |
| | | currentDeliveryRow.value.productModelId || |
| | | currentDeliveryRow.value.modelId; |
| | | addShippingInfo({ |
| | | salesLedgerId: salesLedgerId, |
| | | salesLedgerProductId: currentDeliveryRow.value.id, |