添加一键入库

This commit is contained in:
lewis 2025-01-04 15:20:14 +08:00
parent f1c191d1a8
commit 60e2bcec78
4 changed files with 212 additions and 1 deletions

View File

@ -1,5 +1,13 @@
import request from '@/utils/request'
// 门店入库单列表
export function apiWarehouseOrderLists(params: any) {
return request.get({ url: '/system_store_storage/warehouseorder/lists', params })
}
export function apiWarehouseOrderEdit(params: any) {
return request.post({ url: '/system_store_storage/warehouseorder/edit', params })
}
// 门店入库操作列表
export function apiSystemStoreStorageLists(params: any) {
return request.get({ url: '/system_store_storage/systemstorestorage/lists', params })
@ -33,4 +41,9 @@ export function apiSystemStoreStorageInfoLists(params: any) {
// 门店入库操作详情
export function apiSystemStoreStorageInfoEdit(params: any) {
return request.post({ url: '/system_store_storage/systemstorestorage/edit', params })
}
// 门店一键确认入库
export function apiSystemStoreStorageInfoEditAll() {
return request.post({ url: '/system_store_storage/systemstorestorage/editAll' })
}

View File

@ -1,6 +1,9 @@
<template>
<div>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<div class="ml-4">
<el-button type="primary" @click="handleEditAll"> 一键确认 </el-button>
</div>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column label="门店" prop="system_store_name" show-overflow-tooltip />
@ -41,7 +44,7 @@
<script lang="ts" setup name="systemStoreStorageLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiSystemStoreStorageLists, apiSystemStoreStorageDelete, apiSystemStoreStorageInfoLists, apiSystemStoreStorageInfoEdit } from '@/api/system_store_storage'
import { apiSystemStoreStorageLists, apiSystemStoreStorageDelete, apiSystemStoreStorageInfoLists, apiSystemStoreStorageInfoEdit, apiSystemStoreStorageInfoEditAll } from '@/api/system_store_storage'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
@ -92,6 +95,13 @@ const handleEdit = async (data: any) => {
getLists()
})
}
const handleEditAll = async () => {
await feedback.confirm('确定要全部入库吗?')
apiSystemStoreStorageInfoEditAll().then(res => {
getLists()
})
}
getLists()
</script>

View File

@ -0,0 +1,90 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="1000px" @close="handleClose" @confirm="handleClose">
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<div class="mt-4">
<el-table :data="pager.lists">
<el-table-column label="导入人员" prop="admin_name" show-overflow-tooltip />
<el-table-column label="门店确认人员" prop="staff_name" show-overflow-tooltip />
<el-table-column label="商品图" prop="image" show-overflow-tooltip>
<template #default="{ row }">
<el-image class="w-[40px] h-[40px]" :src="row.image" />
</template>
</el-table-column>
<el-table-column label="商品" prop="store_name" show-overflow-tooltip />
<el-table-column label="数量" prop="nums" show-overflow-tooltip />
<el-table-column label="状态" prop="status" show-overflow-tooltip>
<template #default="{ row }">
<el-tag type="success" v-if="row.status === 1">已入库</el-tag>
<el-tag type="warning" v-else-if="row.status === 0">待确认</el-tag>
<el-tag type="danger" v-else-if="row.status === -1">库存不足</el-tag>
</template>
</el-table-column>
<el-table-column label="备注" prop="mark" show-overflow-tooltip />
<!-- <el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button v-if="row.status == 0"
v-perms="['system_store_storage.system_store_storage/edit']" type="success" link
@click="handleEdit(row)">
确认入库
</el-button>
</template>
</el-table-column> -->
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
</popup>
</div>
</template>
<script lang="ts" setup name="systemStoreStorageEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiSystemStoreStorageAdd, apiSystemStoreStorageEdit, apiSystemStoreStorageInfoLists } from '@/api/system_store_storage'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
import { usePaging } from '@/hooks/usePaging'
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
const props = defineProps({
oid: Number
});
const queryParams = reactive({
store_id: '',
oid: '',
})
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiSystemStoreStorageInfoLists,
params: queryParams
})
//
const popupTitle = computed(() => {
return mode.value == 'edit' ? '商品列表' : '商品列表'
})
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
queryParams.oid = props.oid
getLists()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open
})
</script>

View File

@ -0,0 +1,98 @@
<template>
<div>
<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 label="ID" prop="id" show-overflow-tooltip />
<el-table-column label="仓库" prop="warehouse_name" show-overflow-tooltip />
<el-table-column label="单号" prop="code" show-overflow-tooltip />
<el-table-column label="填写人员" prop="admin_name" show-overflow-tooltip />
<el-table-column label="状态" prop="status" show-overflow-tooltip>
<template #default="{ row }">
<el-tag type="success" v-if="row.status === 1">已入库</el-tag>
<el-tag type="warning" v-else-if="row.status === 0">待确认</el-tag>
</template>
</el-table-column>
<el-table-column label="操作时间" prop="create_time" show-overflow-tooltip />
<el-table-column label="备注" prop="mark" show-overflow-tooltip />
<el-table-column label="操作" width="200" fixed="right">
<template #default="{ row }">
<el-button type="success" link @click="showProductModal(row)">
商品列表
</el-button>
<el-button v-if="row.status == 0" type="success" link @click="handleEdit(row)">
确认入库
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<productList v-if="showProduct" :oid="oid" ref="productRef" @success="getLists" @close="showProduct = false" />
</div>
</template>
<script lang="ts" setup name="systemStoreStorageLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiWarehouseOrderLists, apiWarehouseOrderEdit } from '@/api/system_store_storage'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import productList from './productList.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({
store_id: '',
admin_id: '',
operating_id: '',
status: '',
type: 1
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val : any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiWarehouseOrderLists,
params: queryParams
})
const showProduct = ref(false)
const productRef = shallowRef<InstanceType<typeof productList>>()
const oid = ref('')
//
const showProductModal = async(row) => {
oid.value = row.id
showProduct.value = true
await nextTick()
productRef.value?.open()
}
//
const handleEdit = async (data : any) => {
await feedback.confirm('确定要入库吗?')
apiWarehouseOrderEdit({
id: data.id
}).then(res => {
getLists()
})
}
getLists()
</script>