上传
This commit is contained in:
@@ -36,10 +36,10 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="采购数量" prop="purchaseNum">
|
||||
<el-form-item label="采购数量" prop="num">
|
||||
<el-input-number
|
||||
:min="form.sendTotalNum"
|
||||
v-model="form.purchaseNum"
|
||||
v-model="form.num"
|
||||
:controls="false"
|
||||
placeholder="请输入"
|
||||
style="width: 100%"
|
||||
@@ -81,17 +81,17 @@
|
||||
<template v-else>
|
||||
<el-table :data="inventoryList" @selection-change="handleSelectionChange">
|
||||
<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="unitPrice" label="采购价" width="90px" />
|
||||
<el-table-column prop="remainNum" label="剩余库存" width="90px" />
|
||||
<el-table-column prop="price" label="采购价" width="90px" />
|
||||
<el-table-column prop="num" label="剩余库存" width="90px" />
|
||||
<el-table-column label="发货数量">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-model="row.sendNum"
|
||||
size="small"
|
||||
:min="1"
|
||||
:max="row.remainNum"
|
||||
:max="row.num"
|
||||
:controls="false"
|
||||
/>
|
||||
</template>
|
||||
@@ -112,7 +112,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="DialogDelivery">
|
||||
import { getSimpleWarehouseList } from '@/api/mall/warehouse'
|
||||
import { getSimpleWarehouseList, getRemainInventoryList } from '@/api/mall/warehouse'
|
||||
import { createDelivery } from '@/api/clue/delivery'
|
||||
import { getConfigList } from '@/api/system/set'
|
||||
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)
|
||||
function open(id, signNum) {
|
||||
function open(row) {
|
||||
show.value = true
|
||||
resetForm(id, signNum)
|
||||
resetForm(row)
|
||||
getRemainInventory(row.id)
|
||||
}
|
||||
defineExpose({
|
||||
open
|
||||
@@ -140,18 +147,20 @@ const form = ref({})
|
||||
const rules = ref({
|
||||
supplier: { 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' },
|
||||
warehouseId: { required: true, message: '仓库不可为空', trigger: 'change' }
|
||||
})
|
||||
function resetForm(id, num) {
|
||||
function resetForm(row) {
|
||||
form.value = {
|
||||
sendType: 2,
|
||||
sendTotalNum: num,
|
||||
signProductId: id,
|
||||
sendTotalNum: row.signNum,
|
||||
signProductId: row.id,
|
||||
productId: row.productId,
|
||||
specsId: row.specsId,
|
||||
warehouseId: undefined,
|
||||
supplier: undefined,
|
||||
purchaseNum: num,
|
||||
num: row.signNum,
|
||||
unitPrice: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
@@ -186,7 +195,25 @@ async function onSubmit() {
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
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('发货成功!')
|
||||
show.value = false
|
||||
emit('success')
|
||||
@@ -195,11 +222,7 @@ async function onSubmit() {
|
||||
}
|
||||
}
|
||||
|
||||
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 inventoryList = ref([])
|
||||
|
||||
const deliveryArr = ref([])
|
||||
function handleSelectionChange(val) {
|
||||
|
||||
Reference in New Issue
Block a user