|
|
@ -36,10 +36,10 @@ |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12" :offset="0"> |
|
|
|
<el-col :span="12" :offset="0"> |
|
|
|
<el-form-item label="采购数量" prop="purchaseNum"> |
|
|
|
<el-form-item label="采购数量" prop="num"> |
|
|
|
<el-input-number |
|
|
|
<el-input-number |
|
|
|
:min="form.sendTotalNum" |
|
|
|
:min="form.sendTotalNum" |
|
|
|
v-model="form.purchaseNum" |
|
|
|
v-model="form.num" |
|
|
|
:controls="false" |
|
|
|
:controls="false" |
|
|
|
placeholder="请输入" |
|
|
|
placeholder="请输入" |
|
|
|
style="width: 100%" |
|
|
|
style="width: 100%" |
|
|
@ -81,17 +81,17 @@ |
|
|
|
<template v-else> |
|
|
|
<template v-else> |
|
|
|
<el-table :data="inventoryList" @selection-change="handleSelectionChange"> |
|
|
|
<el-table :data="inventoryList" @selection-change="handleSelectionChange"> |
|
|
|
<el-table-column type="selection" width="55" /> |
|
|
|
<el-table-column type="selection" width="55" /> |
|
|
|
<el-table-column prop="id" label="入库批次号" width="150px" /> |
|
|
|
<el-table-column prop="batchNo" label="入库批次号" width="150px" /> |
|
|
|
<el-table-column prop="warehouseName" label="存放仓库" width="120px" /> |
|
|
|
<el-table-column prop="warehouseName" label="存放仓库" width="120px" /> |
|
|
|
<el-table-column prop="unitPrice" label="采购价" width="90px" /> |
|
|
|
<el-table-column prop="price" label="采购价" width="90px" /> |
|
|
|
<el-table-column prop="remainNum" label="剩余库存" width="90px" /> |
|
|
|
<el-table-column prop="num" label="剩余库存" width="90px" /> |
|
|
|
<el-table-column label="发货数量"> |
|
|
|
<el-table-column label="发货数量"> |
|
|
|
<template #default="{ row }"> |
|
|
|
<template #default="{ row }"> |
|
|
|
<el-input-number |
|
|
|
<el-input-number |
|
|
|
v-model="row.sendNum" |
|
|
|
v-model="row.sendNum" |
|
|
|
size="small" |
|
|
|
size="small" |
|
|
|
:min="1" |
|
|
|
:min="1" |
|
|
|
:max="row.remainNum" |
|
|
|
:max="row.num" |
|
|
|
:controls="false" |
|
|
|
:controls="false" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</template> |
|
|
@ -112,7 +112,7 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script setup name="DialogDelivery"> |
|
|
|
<script setup name="DialogDelivery"> |
|
|
|
import { getSimpleWarehouseList } from '@/api/mall/warehouse' |
|
|
|
import { getSimpleWarehouseList, getRemainInventoryList } from '@/api/mall/warehouse' |
|
|
|
import { createDelivery } from '@/api/clue/delivery' |
|
|
|
import { createDelivery } from '@/api/clue/delivery' |
|
|
|
import { getConfigList } from '@/api/system/set' |
|
|
|
import { getConfigList } from '@/api/system/set' |
|
|
|
import { getDictOptions } from '@/utils/dict' |
|
|
|
import { getDictOptions } from '@/utils/dict' |
|
|
@ -127,10 +127,17 @@ function getOptions() { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getRemainInventory(signProductId) { |
|
|
|
|
|
|
|
getRemainInventoryList({ signProductId }).then((data) => { |
|
|
|
|
|
|
|
inventoryList.value = data |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const show = ref(false) |
|
|
|
const show = ref(false) |
|
|
|
function open(id, signNum) { |
|
|
|
function open(row) { |
|
|
|
show.value = true |
|
|
|
show.value = true |
|
|
|
resetForm(id, signNum) |
|
|
|
resetForm(row) |
|
|
|
|
|
|
|
getRemainInventory(row.id) |
|
|
|
} |
|
|
|
} |
|
|
|
defineExpose({ |
|
|
|
defineExpose({ |
|
|
|
open |
|
|
|
open |
|
|
@ -140,18 +147,20 @@ const form = ref({}) |
|
|
|
const rules = ref({ |
|
|
|
const rules = ref({ |
|
|
|
supplier: { required: true, message: '供应商不可为空', trigger: 'change' }, |
|
|
|
supplier: { required: true, message: '供应商不可为空', trigger: 'change' }, |
|
|
|
warehouseId: { required: true, message: '仓库不可为空', trigger: 'change' }, |
|
|
|
warehouseId: { required: true, message: '仓库不可为空', trigger: 'change' }, |
|
|
|
purchaseNum: { required: true, message: '采购数量不可为空', trigger: 'change,blur' }, |
|
|
|
num: { required: true, message: '采购数量不可为空', trigger: 'change,blur' }, |
|
|
|
unitPrice: { required: true, message: '采购单价不可为空', trigger: 'change,blur' }, |
|
|
|
unitPrice: { required: true, message: '采购单价不可为空', trigger: 'change,blur' }, |
|
|
|
warehouseId: { required: true, message: '仓库不可为空', trigger: 'change' } |
|
|
|
warehouseId: { required: true, message: '仓库不可为空', trigger: 'change' } |
|
|
|
}) |
|
|
|
}) |
|
|
|
function resetForm(id, num) { |
|
|
|
function resetForm(row) { |
|
|
|
form.value = { |
|
|
|
form.value = { |
|
|
|
sendType: 2, |
|
|
|
sendType: 2, |
|
|
|
sendTotalNum: num, |
|
|
|
sendTotalNum: row.signNum, |
|
|
|
signProductId: id, |
|
|
|
signProductId: row.id, |
|
|
|
|
|
|
|
productId: row.productId, |
|
|
|
|
|
|
|
specsId: row.specsId, |
|
|
|
warehouseId: undefined, |
|
|
|
warehouseId: undefined, |
|
|
|
supplier: undefined, |
|
|
|
supplier: undefined, |
|
|
|
purchaseNum: num, |
|
|
|
num: row.signNum, |
|
|
|
unitPrice: undefined, |
|
|
|
unitPrice: undefined, |
|
|
|
remark: undefined |
|
|
|
remark: undefined |
|
|
|
} |
|
|
|
} |
|
|
@ -186,7 +195,25 @@ async function onSubmit() { |
|
|
|
// 提交请求 |
|
|
|
// 提交请求 |
|
|
|
formLoading.value = true |
|
|
|
formLoading.value = true |
|
|
|
try { |
|
|
|
try { |
|
|
|
await createDelivery(form.value) |
|
|
|
let params = { |
|
|
|
|
|
|
|
signProductId: form.value.signProductId, |
|
|
|
|
|
|
|
sendType: form.value.sendType, |
|
|
|
|
|
|
|
remark: form.value.remark |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (params.sendType == 1) { |
|
|
|
|
|
|
|
params.purchaseOrder = { |
|
|
|
|
|
|
|
productId: form.value.productId, |
|
|
|
|
|
|
|
specsId: form.value.specsId, |
|
|
|
|
|
|
|
supplier: form.value.supplier, |
|
|
|
|
|
|
|
num: form.value.num, |
|
|
|
|
|
|
|
unitPrice: form.value.unitPrice, |
|
|
|
|
|
|
|
warehouseId: form.value.warehouseId |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
params.detailList = inventoryList.value |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await createDelivery(params) |
|
|
|
message.success('发货成功!') |
|
|
|
message.success('发货成功!') |
|
|
|
show.value = false |
|
|
|
show.value = false |
|
|
|
emit('success') |
|
|
|
emit('success') |
|
|
@ -195,11 +222,7 @@ async function onSubmit() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const inventoryList = ref([ |
|
|
|
const inventoryList = ref([]) |
|
|
|
{ id: 123, warehouseName: '自营仓', unitPrice: 120, remainNum: 5 }, |
|
|
|
|
|
|
|
{ id: 234, warehouseName: '自营仓', unitPrice: 100, remainNum: 5 }, |
|
|
|
|
|
|
|
{ id: 345, warehouseName: '供应商仓', unitPrice: 110, remainNum: 999 } |
|
|
|
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const deliveryArr = ref([]) |
|
|
|
const deliveryArr = ref([]) |
|
|
|
function handleSelectionChange(val) { |
|
|
|
function handleSelectionChange(val) { |
|
|
|