修复了商品仓储信息的一些问题,并添加了新的功能,如生产日期和保质期的选择。同时,优化了查询条件和表格显示。

This commit is contained in:
mkm 2024-08-01 14:00:20 +08:00
parent eb4a2b6eda
commit e5634e4d19
9 changed files with 773 additions and 51 deletions

View File

@ -24,3 +24,7 @@ export function apiWarehouseProductDelete(params: any) {
export function apiWarehouseProductDetail(params: any) { export function apiWarehouseProductDetail(params: any) {
return request.get({ url: '/warehouse_product/warehouseproduct/detail', params }) return request.get({ url: '/warehouse_product/warehouseproduct/detail', params })
} }
// 商品仓储信息确认
export function apiWarehouseProductEnter(params: any) {
return request.post({ url: '/warehouse_product/warehouseproduct/enter', params })
}

View File

@ -0,0 +1,29 @@
import request from '@/utils/request'
// 仓库商品存储列表
export function apiWarehouseProductStoregeLists(params: any) {
return request.get({ url: '/warehouse_product_storege/warehouseproductstorege/lists', params })
}
// 添加仓库商品存储
export function apiWarehouseProductStoregeAdd(params: any) {
return request.post({ url: '/warehouse_product_storege/warehouseproductstorege/add', params })
}
// 编辑仓库商品存储
export function apiWarehouseProductStoregeEdit(params: any) {
return request.post({ url: '/warehouse_product_storege/warehouseproductstorege/edit', params })
}
// 删除仓库商品存储
export function apiWarehouseProductStoregeDelete(params: any) {
return request.post({
url: '/warehouse_product_storege/warehouseproductstorege/delete',
params
})
}
// 仓库商品存储详情
export function apiWarehouseProductStoregeDetail(params: any) {
return request.get({ url: '/warehouse_product_storege/warehouseproductstorege/detail', params })
}

View File

@ -2,7 +2,13 @@
<div> <div>
<el-form class="mb-[-16px]" :model="queryParams" inline> <el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="商品名称" prop="store_name"> <el-form-item label="商品名称" prop="store_name">
<el-input class="w-[200px]" v-model="queryParams.store_name" @keydown.enter="resetPage" clearable placeholder="请输入商品名称" /> <el-input
class="w-[200px]"
v-model="queryParams.store_name"
@keydown.enter="resetPage"
clearable
placeholder="请输入商品名称"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button> <el-button type="primary" @click="resetPage">查询</el-button>
@ -15,18 +21,64 @@
<el-table-column label="商品ID" prop="id" show-overflow-tooltip /> <el-table-column label="商品ID" prop="id" show-overflow-tooltip />
<el-table-column label="商品图片" prop="image" min-width="80"> <el-table-column label="商品图片" prop="image" min-width="80">
<template #default="{ row }"> <template #default="{ row }">
<el-image style="width: 50px; height: 50px" :src="row.image" :preview-teleported="true"/> <el-image
style="width: 50px; height: 50px"
:src="row.image"
:preview-teleported="true"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="商品名称" prop="store_name" min-width="200" show-overflow-tooltip /> <el-table-column
<el-table-column label="分类" prop="cate_name" min-width="120" show-overflow-tooltip /> label="商品名称"
<el-table-column label="单位" prop="unit_name" min-width="80" show-overflow-tooltip /> prop="store_name"
<el-table-column label="商品价格" prop="price" min-width="100" show-overflow-tooltip /> min-width="200"
show-overflow-tooltip
/>
<el-table-column
label="分类"
prop="cate_name"
min-width="120"
show-overflow-tooltip
/>
<el-table-column
label="单位"
prop="unit_name"
min-width="80"
show-overflow-tooltip
/>
<el-table-column
label="商品价格"
prop="price"
min-width="100"
show-overflow-tooltip
/>
<el-table-column label="成本价" prop="cost" min-width="100" show-overflow-tooltip /> <el-table-column label="成本价" prop="cost" min-width="100" show-overflow-tooltip />
<el-table-column label="供货价" prop="purchase" min-width="100" show-overflow-tooltip /> <el-table-column
<el-table-column label="售卖库存" prop="stock" min-width="100" show-overflow-tooltip /> label="供货价"
<el-table-column label="兑换库存" prop="swap" min-width="100" show-overflow-tooltip /> prop="purchase"
<el-table-column label="销量" prop="sales" min-width="100" show-overflow-tooltip /> min-width="100"
show-overflow-tooltip
/>
<el-table-column
label="售卖库存"
prop="stock"
min-width="100"
show-overflow-tooltip
/>
<el-table-column
label="兑换库存"
prop="swap"
min-width="100"
show-overflow-tooltip
v-if="props.is_warehouse != 1"
/>
<el-table-column
label="销量"
prop="sales"
min-width="100"
show-overflow-tooltip
v-if="props.is_warehouse != 1"
/>
</el-table> </el-table>
</div> </div>
<div class="flex mt-4 justify-end"> <div class="flex mt-4 justify-end">
@ -40,18 +92,23 @@
import { usePaging } from '@/hooks/usePaging' import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions' import { useDictData } from '@/hooks/useDictOptions'
import { apiStoreProductLists } from '@/api/store_product' import { apiStoreProductLists } from '@/api/store_product'
import { apiWarehouseProductStoregeLists } from '@/api/warehouse_product_storege'
import { timeFormat } from '@/utils/util' import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback' import feedback from '@/utils/feedback'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
const props = defineProps<{
is_warehouse: number
code: any[]
}>()
// //
const queryParams = reactive({ const queryParams = reactive({
store_name: '', store_name: ''
}) })
// //
const selectData = ref<any[]>([]) const selectData = ref<any[]>([])
const datas = ref()
// //
const handleSelectionChange = (val: any[]) => { const handleSelectionChange = (val: any[]) => {
@ -62,18 +119,26 @@ const handleSelectionChange = (val: any[]) => {
const { dictData } = useDictData('') const { dictData } = useDictData('')
// //
const { pager, getLists, resetParams, resetPage } = usePaging({ if (props.is_warehouse == 1) {
datas.value = {
fetchFun: apiWarehouseProductStoregeLists,
params: queryParams
}
} else {
datas.value = {
fetchFun: apiStoreProductLists, fetchFun: apiStoreProductLists,
params: queryParams params: queryParams
}) }
}
const { pager, getLists, resetParams, resetPage } = usePaging(datas.value)
getLists(); getLists()
const emits = defineEmits(["onBindStore"]); const emits = defineEmits(['onBindStore'])
// //
const bindStore = () => { const bindStore = () => {
let list = pager.lists.filter(item => selectData.value.includes(item.id)); const list = pager.lists.filter((item) => selectData.value.includes(item.id))
if (!list.length) return ElMessage.error('请先选择门店'); if (!list.length) return ElMessage.error('请先选择门店')
emits('onBindStore', list) emits('onBindStore', list)
}; }
</script> </script>

View File

@ -0,0 +1,73 @@
<template>
<div>
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="仓库名称" prop="name">
<el-input
class="w-[200px]"
v-model="queryParams.name"
clearable
placeholder="请输入门店名称"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
<div class="mt-4" v-loading="pager.loading">
<el-table :data="pager.lists" @selection-change="handleSelectionChange" :height="300">
<el-table-column type="selection" width="55" />
<el-table-column label="ID" prop="id" show-overflow-tooltip />
<el-table-column label="仓库名称" prop="name" show-overflow-tooltip />
<el-table-column label="联系人员" prop="contacts" show-overflow-tooltip />
<el-table-column label="手机号码" prop="tel" show-overflow-tooltip />
<el-table-column label="详细地址" prop="address" show-overflow-tooltip />
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
<el-button class="w-full mt-4" type="primary" @click="bindStore">添加仓库</el-button>
</div>
</template>
<script lang="ts" setup name="systemStoreLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiWarehouseLists } from '@/api/warehouse'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import { ElMessage } from 'element-plus'
//
const queryParams = reactive({
name: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiWarehouseLists,
params: queryParams
})
getLists()
const emits = defineEmits(['onBindWarehouse'])
//
const bindStore = () => {
const list = pager.lists.filter((item) => selectData.value.includes(item.id))
if (!list.length) return ElMessage.error('请先选择仓库')
emits('onBindWarehouse', list[0])
}
</script>

View File

@ -0,0 +1,229 @@
<template>
<el-card>
<div class="mb-4 text-lg font-bold">导入商品到门店</div>
<div>
<el-form ref="formRef" :model="formData" label-width="90px">
<el-form-item label="门店" prop="store_id">
<div class="flex-1 w-full">
<div class="mb-2">
<el-button type="primary" @click="showStore = true">添加门店</el-button>
</div>
<el-table :data="storeList">
<el-table-column label="ID" prop="id" show-overflow-tooltip />
<el-table-column label="门店名称" prop="name" show-overflow-tooltip />
<el-table-column label="手机号码" prop="phone" show-overflow-tooltip />
<el-table-column
label="详细地址"
prop="detailed_address"
show-overflow-tooltip
/>
<el-table-column label="门店logo" prop="image" show-overflow-tooltip>
<template #default="{ row }">
<el-image
:src="row.image"
class="w-[40px] h-[40px]"
:preview-teleported="true"
/>
</template>
</el-table-column>
<el-table-column label="营业状态" prop="is_show" show-overflow-tooltip>
<template #default="{ row }">
{{ row.is_show ? '营业' : '打烊' }}
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['system_store.system_store/delete']"
type="danger"
link
@click="handleDelete(row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-form-item>
<el-form-item label="商品" prop="store_id">
<div class="flex-1 w-full">
<div class="mb-2">
<el-button type="primary" @click="showProduct = true"
>添加商品</el-button
>
</div>
<el-table :data="productList">
<el-table-column label="商品ID" prop="id" show-overflow-tooltip />
<el-table-column label="商品图片" prop="image" min-width="80">
<template #default="{ row }">
<el-image
style="width: 50px; height: 50px"
:src="row.image"
:preview-teleported="true"
/>
</template>
</el-table-column>
<el-table-column
label="商品名称"
prop="store_name"
min-width="200"
show-overflow-tooltip
/>
<el-table-column
label="分类"
prop="cate_name"
min-width="120"
show-overflow-tooltip
/>
<el-table-column
label="单位"
prop="unit_name"
min-width="80"
show-overflow-tooltip
/>
<el-table-column
label="商品价格"
prop="price"
min-width="100"
show-overflow-tooltip
/>
<el-table-column label="分配库存" min-width="150">
<template #default="{ row }">
<el-input-number v-model="row.new_stock" :min="1" />
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['system_store.system_store/delete']"
type="danger"
link
@click="handleDeleteProdut(row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-form-item>
<el-form-item label="库存类型" prop="stock_type">
<el-radio-group v-model="stock_type" class="ml-6">
<el-radio :value="1" :label="1">分配售卖库存</el-radio>
<el-radio :value="2" :label="2">分配兑换库存</el-radio>
</el-radio-group>
<span class="text-info text-xs ml-6"
>默认为分配售卖库存, 如需分配兑换库存请选择分配兑换库存</span
>
</el-form-item>
<el-form-item label="">
<el-button @click="handleSubmit" type="primary" class="w-40">提交</el-button>
</el-form-item>
</el-form>
</div>
<el-dialog v-model="showStore" title="选择门店" width="70%">
<store-pop @onBindStore="onBindStore"></store-pop>
</el-dialog>
<el-dialog v-model="showProduct" title="选择商品" width="70%">
<product-pop @onBindStore="onBindProduct" is_warehouse="1"></product-pop>
</el-dialog>
</el-card>
</template>
<script lang="ts" setup name="storeProductEdit">
import { ElMessage, type FormInstance } from 'element-plus'
import useMultipleTabs from '@/hooks/useMultipleTabs'
import { apiStoreProductImport } from '@/api/store_product'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
import { onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { apiStoreCategoryLists } from '@/api/store_category'
import { apiStoreProductUnitLists } from '@/api/store_product_unit'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const { removeTab } = useMultipleTabs()
const mode = ref('add')
//
const formData = reactive({
store_id: ''
})
const showStore = ref(false) //
//
const storeList = ref([])
//
const handleDelete = (id: number) => {
storeList.value = storeList.value.filter((item: any) => item.id !== id)
}
//
const onBindStore = (e: any[]) => {
e.forEach((item: any) => {
if (!storeList.value.find((t: any) => t.id == item.id)) {
storeList.value.push(item)
}
})
showStore.value = false
}
const showProduct = ref(false) //
//
const productList = ref([])
//
const handleDeleteProdut = (id: number) => {
productList.value = productList.value.filter((item: any) => item.id !== id)
}
//
const onBindProduct = (e: any[]) => {
e.forEach((item: any) => {
if (!productList.value.find((t: any) => t.id == item.id)) {
productList.value.push(item)
}
})
showProduct.value = false
}
const unitList = ref([])
const getUnitList = () => {
apiStoreProductUnitLists({}).then((res) => {
unitList.value = res.lists
})
}
getUnitList()
const stock_type = ref(1)
const router = useRouter()
//
const handleSubmit = async () => {
const product_arr = productList.value.map((item: any) => {
return {
id: item.id,
stock: item.new_stock || 0
}
})
const store_arr = storeList.value.map((item: any) => item.id)
console.log(product_arr)
console.log(store_arr)
console.log(stock_type.value)
return false
apiStoreProductImport({
product_arr,
store_arr,
stock_type: stock_type.value
}).then((res) => {
removeTab()
router.push({
path: '/store/store_product'
})
})
}
</script>

View File

@ -1,19 +1,30 @@
<template> <template>
<div> <div>
<el-card class="!border-none mb-4" shadow="never"> <el-card class="!border-none mb-4" shadow="never">
<el-form <el-form class="mb-[-16px]" :model="queryParams" inline>
class="mb-[-16px]"
:model="queryParams"
inline
>
<el-form-item label="仓库名称" prop="name"> <el-form-item label="仓库名称" prop="name">
<el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入仓库名称" /> <el-input
class="w-[280px]"
v-model="queryParams.name"
clearable
placeholder="请输入仓库名称"
/>
</el-form-item> </el-form-item>
<el-form-item label="联系人员" prop="contacts"> <el-form-item label="联系人员" prop="contacts">
<el-input class="w-[280px]" v-model="queryParams.contacts" clearable placeholder="请输入联系人员" /> <el-input
class="w-[280px]"
v-model="queryParams.contacts"
clearable
placeholder="请输入联系人员"
/>
</el-form-item> </el-form-item>
<el-form-item label="联系电话" prop="tel"> <el-form-item label="联系电话" prop="tel">
<el-input class="w-[280px]" v-model="queryParams.tel" clearable placeholder="请输入联系电话" /> <el-input
class="w-[280px]"
v-model="queryParams.tel"
clearable
placeholder="请输入联系电话"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button> <el-button type="primary" @click="resetPage">查询</el-button>
@ -39,7 +50,19 @@
<el-table :data="pager.lists" @selection-change="handleSelectionChange"> <el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column label="" prop="id" show-overflow-tooltip /> <el-table-column label="" prop="id" show-overflow-tooltip />
<el-table-column label="仓库名称" prop="name" show-overflow-tooltip /> <el-table-column label="仓库名称" show-overflow-tooltip>
<template #default="{ row }">
<router-link
:to="{
path: 'product_import',
query: { id: row.id }
}"
class="ml-4"
>
{{ row.name }}
</router-link>
</template>
</el-table-column>
<el-table-column label="仓库编号" prop="code" show-overflow-tooltip /> <el-table-column label="仓库编号" prop="code" show-overflow-tooltip />
<el-table-column label="联系人员" prop="contacts" show-overflow-tooltip /> <el-table-column label="联系人员" prop="contacts" show-overflow-tooltip />
<el-table-column label="联系电话" prop="tel" show-overflow-tooltip /> <el-table-column label="联系电话" prop="tel" show-overflow-tooltip />
@ -72,7 +95,13 @@
<pagination v-model="pager" @change="getLists" /> <pagination v-model="pager" @change="getLists" />
</div> </div>
</el-card> </el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" /> <edit-popup
v-if="showEdit"
ref="editRef"
:dict-data="dictData"
@success="getLists"
@close="showEdit = false"
/>
</div> </div>
</template> </template>
@ -88,7 +117,6 @@ const editRef = shallowRef<InstanceType<typeof EditPopup>>()
// //
const showEdit = ref(false) const showEdit = ref(false)
// //
const queryParams = reactive({ const queryParams = reactive({
name: '', name: '',
@ -137,4 +165,3 @@ const handleDelete = async (id: number | any[]) => {
getLists() getLists()
</script> </script>

View File

@ -0,0 +1,223 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="商品名称" prop="store_name">
<el-input
class="w-[280px]"
@keydown.enter="resetPage"
v-model="queryParams.store_name"
clearable
placeholder="请输入商品名称"
/>
</el-form-item>
<el-form-item label="商品分类" prop="store_name">
<el-cascader
class="w-[280px]"
v-model="queryParams.class_all"
filterable
clearable
:before-filter="beforeFilter"
:props="props"
placeholder="请选择商品分类"
@change="resetPage"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<router-link
:to="{
path: 'import'
}"
class="ml-4"
>
<el-button type="primary"> 出库 </el-button>
</router-link>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="商品ID" prop="id" show-overflow-tooltip />
<el-table-column label="商品图片" prop="image" min-width="80">
<template #default="{ row }">
<el-image
style="width: 50px; height: 50px"
:src="row.image"
:preview-teleported="true"
/>
</template>
</el-table-column>
<el-table-column
label="商品名称"
prop="store_name"
min-width="200"
show-overflow-tooltip
/>
<el-table-column
label="分类"
prop="cate_name"
min-width="120"
show-overflow-tooltip
/>
<el-table-column
label="单位"
prop="unit_name"
min-width="80"
show-overflow-tooltip
/>
<el-table-column
label="供货价"
prop="purchase"
min-width="100"
show-overflow-tooltip
/>
<el-table-column
label="商户价"
prop="cost"
min-width="120"
show-overflow-tooltip
/>
<el-table-column
label="终端零售价"
prop="price"
min-width="120"
show-overflow-tooltip
/>
<el-table-column
label="规格"
prop="store_info"
min-width="100"
show-overflow-tooltip
/>
<el-table-column
label="毛利率"
prop="rose"
min-width="100"
show-overflow-tooltip
/>
<el-table-column
label="库存"
prop="nums"
min-width="100"
show-overflow-tooltip
/>
<el-table-column
label="条码"
prop="bar_code"
min-width="200"
show-overflow-tooltip
/>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<!-- <Details ref="detailsRef"></Details> -->
</div>
</template>
<script lang="ts" setup name="storeProductLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiWarehouseProductStoregeLists } from '@/api/warehouse_product_storege'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
// import Details from './details.vue'
import { apiStoreCategoryLists } from '@/api/store_category'
import { useRoute } from 'vue-router'
const route = useRoute()
const detailsRef = ref(null)
//
const queryParams = reactive({
store_name: '',
class_all: '',
warehouse_id: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
let page_no = 1
if (route.query.page_no) {
page_no = parseInt(route.query.page_no)
}
if (route.query.id) {
queryParams.warehouse_id = parseInt(route.query.id)
}
console.log(route.query.id)
const { pager, getLists, resetParams, resetPage } = usePaging({
page: page_no,
fetchFun: apiWarehouseProductStoregeLists,
params: queryParams
})
//
const handleAdd = async () => {}
//
const handleEdit = async (data: any) => {}
let resolves
let nodes
const flag = ref(false)
let name
const beforeFilter = (value) => {
name = value
flag.value = true
props.lazyLoad(nodes, resolves)
return false
}
const props = {
value: 'id',
label: 'name',
emitPath: false,
lazy: true,
lazyLoad(node, resolve) {
if (!resolves) resolves = resolve
if (!nodes) nodes = node
const pid = node.value || 0
let data = {}
if (flag.value) {
data = { name: name }
if (!name) {
data = {
pid: pid,
page_size: 10000
}
}
} else {
data = {
pid: pid,
page_size: 10000
}
}
apiStoreCategoryLists({
...data
}).then((res) => {
resolve(
res.lists.map((item: any) => {
// item.leaf = item.is_children == 0;
item.leaf = true
flag.value = false
return item
})
)
})
}
}
getLists()
</script>

View File

@ -13,17 +13,18 @@
<el-input <el-input
v-model="formData.warehouse_name" v-model="formData.warehouse_name"
clearable clearable
placeholder="请输入仓库ID" placeholder="请选择仓库"
:readonly="false" :readonly="false"
@click="showWarehouse = true" @click="showWarehouse = true"
/> />
</el-form-item> </el-form-item>
<el-form-item label="商品ID" prop="product_id"> <el-form-item label="商品" prop="product_id">
<el-input <el-input
v-model="formData.product_id" v-model="formData.product_name"
clearable clearable
placeholder="请输入商品ID" placeholder="请选择商品"
:readonly="false" :readonly="false"
@click="showProduct = true"
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="financial_pm"> <el-form-item label="状态" prop="financial_pm">
@ -45,6 +46,39 @@
:readonly="false" :readonly="false"
/> />
</el-form-item> </el-form-item>
<el-form-item label="单号" prop="code">
<el-input
v-model="formData.code"
clearable
placeholder="请输入单号"
:readonly="false"
/>
</el-form-item>
<el-form-item label="生产日期" prop="manufacture">
<el-date-picker
:readonly="false"
class="flex-1 !flex"
v-model="formData.manufacture"
clearable
type="datetime"
value-format="YYYY-MM-DD"
placeholder="选择生产日期"
>
</el-date-picker>
</el-form-item>
<el-form-item label="保质期" prop="expiration_date">
<el-date-picker
:readonly="false"
class="flex-1 !flex"
v-model="formData.expiration_date"
clearable
type="datetime"
value-format="YYYY-MM-DD"
placeholder="选择保质期"
>
</el-date-picker>
</el-form-item>
<el-form-item label="数量" prop="nums"> <el-form-item label="数量" prop="nums">
<el-input <el-input
v-model="formData.nums" v-model="formData.nums"
@ -72,7 +106,10 @@
</el-form> </el-form>
</popup> </popup>
<el-dialog v-model="showWarehouse" title="选择仓库" width="70%"> <el-dialog v-model="showWarehouse" title="选择仓库" width="70%">
<warehouse-pop @onBindStore="onBindProduct"></warehouse-pop> <warehouse-pop @onBindWarehouse="onBindWarehouse"></warehouse-pop>
</el-dialog>
<el-dialog v-model="showProduct" title="选择商品" width="70%">
<product-pop @onBindStore="onBindStore"></product-pop>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -98,16 +135,24 @@ const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>() const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add') const mode = ref('add')
const showWarehouse = ref(false) // const showWarehouse = ref(false) //
const productList = ref([]) const showProduct = ref(false) //
// const productList = ref([])
const onBindProduct = (e: any[]) => { const onBindWarehouse = (e: any[]) => {
e.forEach((item: any) => { formData.warehouse_name = e.name
if (!productList.value.find((t: any) => t.id == item.id)) { formData.warehouse_id = e.id
productList.value.push(item) // e.forEach((item: any) => {
} // if (!productList.value.find((t: any) => t.id == item.id)) {
}) // productList.value.push(item)
// }
// })
showWarehouse.value = false showWarehouse.value = false
} }
const onBindStore = (e: any[]) => {
formData.product_name = e[0].store_name
formData.product_id = e[0].id
showProduct.value = false
}
// //
const popupTitle = computed(() => { const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑商品仓储信息' : '新增商品仓储信息' return mode.value == 'edit' ? '编辑商品仓储信息' : '新增商品仓储信息'
@ -124,7 +169,11 @@ const formData = reactive({
price: '', price: '',
total_price: '', total_price: '',
status: '', status: '',
warehouse_name: '' warehouse_name: '',
product_name: '',
manufacture: '',
expiration_date: '',
code: ''
}) })
// //

View File

@ -62,8 +62,9 @@
<el-table :data="pager.lists" @selection-change="handleSelectionChange"> <el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column label="" prop="id" show-overflow-tooltip /> <el-table-column label="" prop="id" show-overflow-tooltip />
<el-table-column label="操作人员" prop="admin_name" show-overflow-tooltip />
<el-table-column label="仓库" prop="warehouse_id" show-overflow-tooltip /> <el-table-column label="仓库" prop="warehouse_id" show-overflow-tooltip />
<el-table-column label="商品" prop="product_id" show-overflow-tooltip /> <el-table-column label="商品" prop="store_name" show-overflow-tooltip />
<el-table-column <el-table-column
label="出入库" label="出入库"
prop="financial_pm_name" prop="financial_pm_name"
@ -71,9 +72,11 @@
/> />
<el-table-column label="批次" prop="batch" show-overflow-tooltip /> <el-table-column label="批次" prop="batch" show-overflow-tooltip />
<el-table-column label="数量" prop="nums" show-overflow-tooltip /> <el-table-column label="数量" prop="nums" show-overflow-tooltip />
<el-table-column label="生产期" prop="manufacture" show-overflow-tooltip />
<el-table-column label="保质期" prop="expiration_date" show-overflow-tooltip />
<el-table-column label="价格" prop="price" show-overflow-tooltip /> <el-table-column label="价格" prop="price" show-overflow-tooltip />
<el-table-column label="总价" prop="total_price" show-overflow-tooltip /> <el-table-column label="总价" prop="total_price" show-overflow-tooltip />
<el-table-column label="状态" prop="status" show-overflow-tooltip /> <el-table-column label="状态" prop="status_name" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right"> <el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button <el-button
@ -81,6 +84,7 @@
type="primary" type="primary"
link link
@click="handleEdit(row)" @click="handleEdit(row)"
v-if="row.status == 0"
> >
编辑 编辑
</el-button> </el-button>
@ -89,9 +93,19 @@
type="danger" type="danger"
link link
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
v-if="row.status == 0"
> >
删除 删除
</el-button> </el-button>
<el-button
v-perms="['warehouse_product.warehouse_product/enter']"
type="primary"
link
@click="handleEnter(row.id)"
v-if="row.status == 0"
>
确认
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -113,7 +127,11 @@
<script lang="ts" setup name="warehouseProductLists"> <script lang="ts" setup name="warehouseProductLists">
import { usePaging } from '@/hooks/usePaging' import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions' import { useDictData } from '@/hooks/useDictOptions'
import { apiWarehouseProductLists, apiWarehouseProductDelete } from '@/api/warehouse_product' import {
apiWarehouseProductLists,
apiWarehouseProductDelete,
apiWarehouseProductEnter
} from '@/api/warehouse_product'
import { timeFormat } from '@/utils/util' import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback' import feedback from '@/utils/feedback'
import EditPopup from './edit.vue' import EditPopup from './edit.vue'
@ -160,6 +178,11 @@ const handleEdit = async (data: any) => {
editRef.value?.open('edit') editRef.value?.open('edit')
editRef.value?.setFormData(data) editRef.value?.setFormData(data)
} }
const handleEnter = async (id: number | any[]) => {
// await feedback.confirm('')
await apiWarehouseProductEnter({ id })
getLists()
}
// //
const handleDelete = async (id: number | any[]) => { const handleDelete = async (id: number | any[]) => {