feat(psi): 添加商品仓储信息管理功能

- 新增商品仓储信息列表页面和相关 API 接口
- 实现商品仓储信息的查询、添加、编辑、删除等功能
- 添加供应商和门店的远程搜索功能
- 集成字典数据和分页组件
This commit is contained in:
mkm 2025-02-28 16:45:24 +08:00
parent b4ac918ded
commit 6e9fb3f33c
2 changed files with 280 additions and 0 deletions

View File

@ -0,0 +1,43 @@
import request from '@/utils/request'
// 商品仓储信息列表
export function apiWarehouseProductLists(params: any) {
return request.get({ url: '/psi_product/psiproduct/lists', params }, { urlPrefix: 'psi' })
}
// 添加商品仓储信息
export function apiWarehouseProductAdd(params: any) {
return request.post({ url: '/psi_product/psiproduct/add', params }, { urlPrefix: 'psi' })
}
// 编辑商品仓储信息
export function apiWarehouseProductEdit(params: any) {
return request.post({ url: '/psi_product/psiproduct/edit', params }, { urlPrefix: 'psi' })
}
// 删除商品仓储信息
export function apiWarehouseProductDelete(params: any) {
return request.post({ url: '/psi_product/psiproduct/delete', params }, { urlPrefix: 'psi' })
}
// 商品仓储信息详情
export function apiWarehouseProductDetail(params: any) {
return request.get({ url: '/psi_product/psiproduct/detail', params }, { urlPrefix: 'psi' })
}
// 商品仓储信息确认
export function apiWarehouseProductEnter(params: any) {
return request.post({ url: '/psi_product/psiproduct/enter', params }, { urlPrefix: 'psi' })
}
//商品结算
export function apiWarehouseProductSettlement(params: any) {
return request.post({ url: '/psi_product/psiproduct/settlement', params }, { urlPrefix: 'psi' })
}
/**
*
* @param params
* @returns
*/
export function apiWarehouseProductSetNums(params: any) {
return request.post({ url: '/psi_product/psiproduct/set_nums', params }, { urlPrefix: 'psi' })
}

View File

@ -0,0 +1,237 @@
<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_id">
<div class="flex items-center mr-4">
<el-select
v-model="queryParams.store_id"
filterable
remote
reserve-keyword
placeholder="输入门店名称搜索"
remote-show-suffix
:remote-method="remoteMethod"
:loading="storeloading"
style="width: 240px"
@change="resetPage"
>
<el-option
v-for="item in storeList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</div>
</el-form-item>
<el-form-item label="仓库ID" prop="warehouse_id">
<el-input
class="w-[280px]"
v-model="queryParams.warehouse_id"
clearable
placeholder="请输入仓库"
/>
</el-form-item>
<el-form-item label="供应商" prop="supplier_id">
<el-select
v-model="queryParams.supplier_id"
filterable
remote
reserve-keyword
placeholder="输入供应商名称搜索"
remote-show-suffix
:remote-method="remoteMethodUser"
:loading="userloading"
style="width: 240px"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.mer_name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="商品" prop="product_name">
<el-input
class="w-[280px]"
v-model="queryParams.product_name"
clearable
placeholder="请输入商品"
/>
</el-form-item>
<el-form-item label="商品条码" prop="bar_code">
<el-input
class="w-[280px]"
v-model="queryParams.bar_code"
clearable
placeholder="请输入商品条码"
/>
</el-form-item>
<el-form-item label="日期" prop="create_time">
<el-date-picker
v-model="startEndTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
unlink-panels
@change="changeStartEndTime"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
<export-data
class="ml-2.5"
:fetch-fun="apiWarehouseProductLists"
:params="queryParams"
:page-size="pager.size"
/>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<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="code" width="180" show-overflow-tooltip />
<el-table-column label="操作人员" prop="admin_name" show-overflow-tooltip />
<el-table-column label="供应商" prop="supplier_name" show-overflow-tooltip />
<el-table-column label="仓库" prop="warehouse_name" show-overflow-tooltip />
<el-table-column label="商品" prop="store_name" 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="financial_pm_name"
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="purchase" show-overflow-tooltip />
<el-table-column label="总价" prop="total_price" show-overflow-tooltip />
<el-table-column label="操作时间" prop="create_time" 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="备注" show-overflow-tooltip>
<template #default="{ row }">
<span style="color: red">{{ row.mark }}</span>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
</div>
</template>
<script lang="ts" setup name="warehouseProductLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import {
apiWarehouseProductLists,
apiWarehouseProductDelete,
apiWarehouseProductEnter
} from '@/api/psi/psi_product'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
// import EditPopup from './edit.vue'
import { apiSystemStoreLists } from '@/api/system_store'
import moment from 'moment'
import { apiSupplierLists } from '@/api/supplier'
//
const queryParams = reactive({
warehouse_id: '',
product_name: '',
financial_pm: 1,
store_id: '',
bar_code: '',
start_time: '',
end_time: '',
supplier_id: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('warehouse_produc_pm')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiWarehouseProductLists,
params: queryParams
})
const startEndTime = ref([])
const changeStartEndTime = () => {
if (startEndTime.value[0] && startEndTime.value[1]) {
queryParams.start_time = moment(startEndTime.value[0]).format('YYYY-MM-DD') + ' 00:00:00'
queryParams.end_time = moment(startEndTime.value[1]).format('YYYY-MM-DD') + ' 23:59:59'
} else {
queryParams.start_time = ''
queryParams.end_time = ''
}
getLists()
}
const storeloading = ref(false)
const storeList = ref([])
const remoteMethod = (e = '') => {
storeloading.value = true
apiSystemStoreLists({
name: e,
page_size: 50
})
.then((res) => {
storeList.value = res.lists
setTimeout(() => {
storeloading.value = false
}, 300)
})
.catch((err) => {
setTimeout(() => {
storeloading.value = false
}, 300)
})
}
const userloading = ref(false)
const userList = ref([])
const remoteMethodUser = (e = '') => {
userloading.value = true
apiSupplierLists({ mer_name: e })
.then((res) => {
userList.value = res.lists
setTimeout(() => {
userloading.value = false
}, 300)
})
.catch((err) => {
setTimeout(() => {
userloading.value = false
}, 300)
})
}
onMounted(() => {
getLists()
})
</script>