| | |
| | | prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="发货状态:"> |
| | | <el-select v-model="searchForm.shippingStatus" |
| | | placeholder="请选择" |
| | | clearable |
| | | style="width: 160px" |
| | | @change="handleQuery"> |
| | | <el-option label="未发货" |
| | | value="未发货" /> |
| | | <el-option label="已发货" |
| | | value="已发货" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="录入日期:"> |
| | | <el-date-picker v-model="searchForm.entryDate" |
| | | value-format="YYYY-MM-DD" |
| | |
| | | value="快递" /> |
| | | <el-option label="货车" |
| | | value="货车" /> |
| | | <el-option label="自提" |
| | | value="自提" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </el-row> |
| | | <el-row :gutter="30" |
| | | > |
| | | <el-col :span="24"> |
| | | <el-col :span="24" |
| | | v-if="deliveryForm.type !== '自提'"> |
| | | <el-form-item label="快递单号:" |
| | | prop="expressNumber"> |
| | | <el-input v-model="deliveryForm.expressNumber" |
| | |
| | | <el-input-number v-model="scope.row.deliveryQuantity" |
| | | :min="0" |
| | | :max="getDeliveryBatchDeliveryMax(scope.row)" |
| | | :precision="2" |
| | | :step="0.01" |
| | | controls-position="right" |
| | | @change="handleDeliveryBatchQuantityChange(scope.row)" |
| | | style="width: 100%;" /> |
| | |
| | | tableAmountFormatter, |
| | | formatDecimal, |
| | | buildAmountSummaryFormat, |
| | | roundAmount, |
| | | } from "@/utils/numberFormat"; |
| | | import ImageUpload from "@/components/AttachmentUpload/image/index.vue"; |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | |
| | | searchForm: { |
| | | customerName: "", // 客户名称 |
| | | salesContractNo: "", // 销售合同编号 |
| | | projectName: "", // 项目名称 |
| | | shippingStatus: "", // 发货状态(未发货/已发货) |
| | | entryDate: null, // 录入日期 |
| | | entryDateStart: undefined, |
| | | entryDateEnd: undefined, |
| | |
| | | item?.qualifiedUnLockedQuantity ?? |
| | | item?.qualifiedQuantity ?? |
| | | item?.stockQuantity; |
| | | return quantity ?? 0; |
| | | return roundAmount(quantity ?? 0); |
| | | }; |
| | | const formatDeliveryBatchSalesOrderNo = item => |
| | | item?.salesContractNo || item?.sourceOrderNo || item?.salesOrderNo || "--"; |
| | | item?.salesContractNo || "--"; |
| | | const currentStock = ref(null); |
| | | const fetchCurrentStock = async (productModelId) => { |
| | | if (!productModelId) { |
| | |
| | | return; |
| | | } |
| | | try { |
| | | const res = await getStockInventoryByModelId(productModelId); |
| | | const res = await getStockInventoryByModelId(productModelId, currentId.value); |
| | | const rawList = Array.isArray(res?.data) |
| | | ? res.data |
| | | : res?.data?.records || res?.data?.rows || []; |
| | |
| | | rawList.forEach(item => { |
| | | total += Number(getDeliveryBatchQuantity(item) || 0); |
| | | }); |
| | | currentStock.value = total; |
| | | currentStock.value = roundAmount(total); |
| | | } catch (e) { |
| | | console.error(e); |
| | | currentStock.value = 0; |
| | | } |
| | | }; |
| | | const getCurrentDeliveryRowQuantity = () => { |
| | | return Number(currentDeliveryRow.value?.noQuantity || 0); |
| | | return roundAmount(Number(currentDeliveryRow.value?.noQuantity || 0)); |
| | | }; |
| | | const getDeliveryBatchDeliveryMax = row => { |
| | | const productQuantity = getCurrentDeliveryRowQuantity(); |
| | |
| | | }, |
| | | 0 |
| | | ); |
| | | const remainingProductQuantity = Math.max( |
| | | 0, |
| | | productQuantity - otherBatchTotal |
| | | const remainingProductQuantity = roundAmount( |
| | | Math.max(0, productQuantity - otherBatchTotal) |
| | | ); |
| | | return Math.max(0, Math.min(batchQuantity, remainingProductQuantity)); |
| | | }; |
| | |
| | | }, |
| | | 0 |
| | | ); |
| | | const remainingProductQuantity = Math.max( |
| | | 0, |
| | | productQuantity - otherBatchTotal |
| | | const remainingProductQuantity = roundAmount( |
| | | Math.max(0, productQuantity - otherBatchTotal) |
| | | ); |
| | | const currentValue = Number(row?.deliveryQuantity || 0); |
| | | |
| | |
| | | item => Number(item?.deliveryQuantity || 0) > 0 |
| | | ); |
| | | }; |
| | | const getDeliveryBatchNoList = async productModelId => { |
| | | const getDeliveryBatchNoList = async (productModelId, salesLedgerId) => { |
| | | if (!productModelId) return []; |
| | | const res = await getStockInventoryByModelId(productModelId); |
| | | const res = await getStockInventoryByModelId(productModelId, salesLedgerId); |
| | | const rawList = Array.isArray(res?.data) |
| | | ? res.data |
| | | : res?.data?.records || res?.data?.rows || []; |
| | |
| | | |
| | | currentDeliveryRow.value = row; |
| | | const batchNoList = await getDeliveryBatchNoList( |
| | | row.productModelId || row.modelId |
| | | row.productModelId || row.modelId, |
| | | row.salesLedgerId |
| | | ); |
| | | deliveryForm.value = { |
| | | shippingCarNumber: "", |
| | |
| | | proxy.$modal.msgWarning("请至少填写一个批号的发货数量"); |
| | | return; |
| | | } |
| | | const totalDeliveryQuantity = selectedBatchRows.reduce( |
| | | (sum, item) => sum + Number(item.deliveryQuantity || 0), |
| | | 0 |
| | | const totalDeliveryQuantity = roundAmount( |
| | | selectedBatchRows.reduce( |
| | | (sum, item) => sum + Number(item.deliveryQuantity || 0), |
| | | 0 |
| | | ) |
| | | ); |
| | | const currentRowNoQuantity = Number( |
| | | currentDeliveryRow.value?.noQuantity || 0 |
| | | ); |
| | | if ( |
| | | currentRowNoQuantity > 0 && |
| | | totalDeliveryQuantity > currentRowNoQuantity |
| | | totalDeliveryQuantity > roundAmount(currentRowNoQuantity) |
| | | ) { |
| | | proxy.$modal.msgWarning("批号发货总数不能超过待发货数量"); |
| | | return; |
| | |
| | | if (val === "货车") { |
| | | deliveryForm.value.expressCompany = ""; |
| | | deliveryForm.value.expressNumber = ""; |
| | | } else if (val === "自提") { |
| | | deliveryForm.value.shippingCarNumber = ""; |
| | | deliveryForm.value.expressCompany = ""; |
| | | deliveryForm.value.expressNumber = ""; |
| | | } else { |
| | | deliveryForm.value.shippingCarNumber = ""; |
| | | } |