调整商品溯源
This commit is contained in:
parent
6f487dc55f
commit
6f076f6e9c
63
src/views/product_source_link/details_stock.vue
Normal file
63
src/views/product_source_link/details_stock.vue
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<template>
|
||||||
|
<div class="edit-popup">
|
||||||
|
<el-drawer title="详情" :size="900" v-model="isOpen">
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<el-table :data="pager.lists">
|
||||||
|
<el-table-column label="类型" prop="type_name" show-overflow-tooltip width="100" />
|
||||||
|
<el-table-column label="关联ID" prop="link_id" show-overflow-tooltip width="80" />
|
||||||
|
<el-table-column label="数量" prop="nums" show-overflow-tooltip width="80" />
|
||||||
|
<el-table-column label="单价" prop="price" show-overflow-tooltip width="80" />
|
||||||
|
<el-table-column label="供货价" prop="purchase" show-overflow-tooltip width="80" />
|
||||||
|
<el-table-column label="商户价" prop="cost" show-overflow-tooltip width="80" />
|
||||||
|
<el-table-column label="会员价" prop="vip_price" show-overflow-tooltip width="80" />
|
||||||
|
<el-table-column label="总价" prop="total_price" show-overflow-tooltip width="80" />
|
||||||
|
<el-table-column label="创建时间" prop="create_time" show-overflow-tooltip />
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<div class="flex mt-4 justify-end" v-if="pager.lists.length < pager.count">
|
||||||
|
<pagination v-model="pager" @change="getLists" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup name="storeProductDETAILS">
|
||||||
|
import { usePaging } from '@/hooks/usePaging'
|
||||||
|
import { apiProductSourceLinkInfoLists } from '@/api/product_source_link_info'
|
||||||
|
import type { PropType } from 'vue'
|
||||||
|
defineProps({
|
||||||
|
dictData: {
|
||||||
|
type: Object as PropType<Record<string, any[]>>,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['success', 'close'])
|
||||||
|
const isOpen = ref(false)
|
||||||
|
|
||||||
|
const getDetail = async (row : Record<string, any>) => {
|
||||||
|
queryParams.oid = row.store_id
|
||||||
|
getLists()
|
||||||
|
}
|
||||||
|
|
||||||
|
//打开弹窗
|
||||||
|
const open = () => {
|
||||||
|
isOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询条件
|
||||||
|
const queryParams = reactive({
|
||||||
|
oid: '',
|
||||||
|
})
|
||||||
|
// 分页相关
|
||||||
|
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||||
|
fetchFun: apiProductSourceLinkInfoLists,
|
||||||
|
params: queryParams
|
||||||
|
})
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open,
|
||||||
|
getDetail
|
||||||
|
})
|
||||||
|
</script>
|
@ -1,148 +1,111 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-card class="!border-none mb-4" shadow="never">
|
<el-card class="!border-none mb-4" shadow="never">
|
||||||
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||||
<el-button @click="resetParams">重置</el-button>
|
<el-button @click="resetParams">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
||||||
<el-button
|
<div class="mt-4">
|
||||||
v-perms="['product_source_link.product_source_link/add']"
|
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||||
type="primary"
|
<el-table-column label="id" prop="id" show-overflow-tooltip />
|
||||||
@click="handleAdd"
|
<el-table-column label="采购人" prop="purchase_nickname" show-overflow-tooltip />
|
||||||
>
|
<el-table-column label="商品ID" prop="product_id" show-overflow-tooltip />
|
||||||
<template #icon>
|
<el-table-column label="商品名称" prop="product_name" show-overflow-tooltip />
|
||||||
<icon name="el-icon-Plus" />
|
<el-table-column label="商品图片" prop="image" show-overflow-tooltip>
|
||||||
</template>
|
<template #default="{ row }">
|
||||||
新增
|
<el-image :src="row.image" style="width: 50px; height: 50px" :preview-teleported="true"
|
||||||
</el-button>
|
:preview-src-list="[row.image]" />
|
||||||
<el-button
|
</template>
|
||||||
v-perms="['product_source_link.product_source_link/delete']"
|
</el-table-column>
|
||||||
:disabled="!selectData.length"
|
<el-table-column label="采购数量" prop="total_nums" show-overflow-tooltip />
|
||||||
@click="handleDelete(selectData)"
|
<el-table-column label="仓库" prop="warehouse_name" show-overflow-tooltip />
|
||||||
>
|
<el-table-column label="出库数量" prop="warehouse_outbound_nums" show-overflow-tooltip />
|
||||||
删除
|
<el-table-column label="操作" width="120" fixed="right">
|
||||||
</el-button>
|
<template #default="{ row }">
|
||||||
<div class="mt-4">
|
<el-button v-perms="['product_source_link.product_source_link/edit']" type="primary" link
|
||||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
@click="handleStockDetai(row)">
|
||||||
<el-table-column type="selection" width="55" />
|
编辑
|
||||||
<el-table-column label="id" prop="id" show-overflow-tooltip />
|
</el-button>
|
||||||
<el-table-column
|
</template>
|
||||||
label="采购人"
|
</el-table-column>
|
||||||
prop="purchase_nickname"
|
</el-table>
|
||||||
show-overflow-tooltip
|
</div>
|
||||||
/>
|
<div class="flex mt-4 justify-end">
|
||||||
<el-table-column label="商品图片" prop="image" show-overflow-tooltip>
|
<pagination v-model="pager" @change="getLists" />
|
||||||
<template #default="{ row }">
|
</div>
|
||||||
<el-image :src="row.image" style="width: 50px; height: 50px" />
|
</el-card>
|
||||||
</template>
|
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
|
||||||
</el-table-column>
|
<DetailsStock ref="StockDetailsRef"></DetailsStock>
|
||||||
<el-table-column label="商品名称" prop="product_name" show-overflow-tooltip />
|
</div>
|
||||||
<el-table-column label="总采购数" prop="total_nums" show-overflow-tooltip />
|
|
||||||
<el-table-column label="当前数量" prop="nums" show-overflow-tooltip />
|
|
||||||
<el-table-column label="仓库" prop="warehouse_name" show-overflow-tooltip />
|
|
||||||
<el-table-column
|
|
||||||
label="仓库累计总数"
|
|
||||||
prop="warehouse_total_nums"
|
|
||||||
show-overflow-tooltip
|
|
||||||
/>
|
|
||||||
<el-table-column
|
|
||||||
label="仓库实际数量"
|
|
||||||
prop="warehouse_nums"
|
|
||||||
show-overflow-tooltip
|
|
||||||
/>
|
|
||||||
<el-table-column label="操作" width="120" fixed="right">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-button
|
|
||||||
v-perms="['product_source_link.product_source_link/edit']"
|
|
||||||
type="primary"
|
|
||||||
link
|
|
||||||
@click="handleEdit(row)"
|
|
||||||
>
|
|
||||||
编辑
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
v-perms="['product_source_link.product_source_link/delete']"
|
|
||||||
type="danger"
|
|
||||||
link
|
|
||||||
@click="handleDelete(row.id)"
|
|
||||||
>
|
|
||||||
删除
|
|
||||||
</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>
|
|
||||||
<edit-popup
|
|
||||||
v-if="showEdit"
|
|
||||||
ref="editRef"
|
|
||||||
:dict-data="dictData"
|
|
||||||
@success="getLists"
|
|
||||||
@close="showEdit = false"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="productSourceLinkLists">
|
<script lang="ts" setup name="productSourceLinkLists">
|
||||||
import { usePaging } from '@/hooks/usePaging'
|
import { usePaging } from '@/hooks/usePaging'
|
||||||
import { useDictData } from '@/hooks/useDictOptions'
|
import { useDictData } from '@/hooks/useDictOptions'
|
||||||
import { apiProductSourceLinkLists, apiProductSourceLinkDelete } from '@/api/product_source_link'
|
import { apiProductSourceLinkLists, apiProductSourceLinkDelete } from '@/api/product_source_link'
|
||||||
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'
|
||||||
|
import DetailsStock from './details_stock.vue'
|
||||||
|
|
||||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
const showStockDetails = ref(false)
|
||||||
// 是否显示编辑框
|
const StockDetailsRef = ref(null)
|
||||||
const showEdit = ref(false)
|
// 库存详情
|
||||||
|
const handleStockDetai = async (data : any) => {
|
||||||
|
showStockDetails.value = true
|
||||||
|
await nextTick()
|
||||||
|
StockDetailsRef.value?.open()
|
||||||
|
StockDetailsRef.value?.getDetail(data)
|
||||||
|
}
|
||||||
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||||
|
// 是否显示编辑框
|
||||||
|
const showEdit = ref(false)
|
||||||
|
|
||||||
// 查询条件
|
// 查询条件
|
||||||
const queryParams = reactive({})
|
const queryParams = reactive({})
|
||||||
|
|
||||||
// 选中数据
|
// 选中数据
|
||||||
const selectData = ref<any[]>([])
|
const selectData = ref<any[]>([])
|
||||||
|
|
||||||
// 表格选择后回调事件
|
// 表格选择后回调事件
|
||||||
const handleSelectionChange = (val: any[]) => {
|
const handleSelectionChange = (val : any[]) => {
|
||||||
selectData.value = val.map(({ id }) => id)
|
selectData.value = val.map(({ id }) => id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取字典数据
|
// 获取字典数据
|
||||||
const { dictData } = useDictData('')
|
const { dictData } = useDictData('')
|
||||||
|
|
||||||
// 分页相关
|
// 分页相关
|
||||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||||
fetchFun: apiProductSourceLinkLists,
|
fetchFun: apiProductSourceLinkLists,
|
||||||
params: queryParams
|
params: queryParams
|
||||||
})
|
})
|
||||||
|
|
||||||
// 添加
|
// 添加
|
||||||
const handleAdd = async () => {
|
const handleAdd = async () => {
|
||||||
showEdit.value = true
|
showEdit.value = true
|
||||||
await nextTick()
|
await nextTick()
|
||||||
editRef.value?.open('add')
|
editRef.value?.open('add')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑
|
// 编辑
|
||||||
const handleEdit = async (data: any) => {
|
const handleEdit = async (data : any) => {
|
||||||
showEdit.value = true
|
showEdit.value = true
|
||||||
await nextTick()
|
await nextTick()
|
||||||
editRef.value?.open('edit')
|
editRef.value?.open('edit')
|
||||||
editRef.value?.setFormData(data)
|
editRef.value?.setFormData(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
const handleDelete = async (id: number | any[]) => {
|
const handleDelete = async (id : number | any[]) => {
|
||||||
await feedback.confirm('确定要删除?')
|
await feedback.confirm('确定要删除?')
|
||||||
await apiProductSourceLinkDelete({ id })
|
await apiProductSourceLinkDelete({ id })
|
||||||
getLists()
|
getLists()
|
||||||
}
|
}
|
||||||
|
|
||||||
getLists()
|
getLists()
|
||||||
</script>
|
</script>
|
@ -1,128 +1,96 @@
|
|||||||
<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>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||||
<el-button @click="resetParams">重置</el-button>
|
<el-button @click="resetParams">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
||||||
<el-button v-perms="['product_source_link_info.product_source_link_info/add']" type="primary" @click="handleAdd">
|
<div class="mt-4">
|
||||||
<template #icon>
|
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||||
<icon name="el-icon-Plus" />
|
<el-table-column label="商品ID" prop="product_id" show-overflow-tooltip />
|
||||||
</template>
|
<el-table-column label="商品名称" prop="product_name" show-overflow-tooltip />
|
||||||
新增
|
<el-table-column label="商品图片" prop="image" show-overflow-tooltip>
|
||||||
</el-button>
|
<template #default="{ row }">
|
||||||
<el-button
|
<el-image :src="row.image" style="width: 50px; height: 50px" :preview-teleported="true"
|
||||||
v-perms="['product_source_link_info.product_source_link_info/delete']"
|
:preview-src-list="[row.image]" />
|
||||||
:disabled="!selectData.length"
|
</template>
|
||||||
@click="handleDelete(selectData)"
|
</el-table-column>
|
||||||
>
|
<el-table-column label="数量" prop="nums" show-overflow-tooltip />
|
||||||
删除
|
<el-table-column label="类型" prop="type_name" show-overflow-tooltip />
|
||||||
</el-button>
|
<el-table-column label="溯源id" prop="link_id" show-overflow-tooltip />
|
||||||
<div class="mt-4">
|
<el-table-column label="单价" prop="price" show-overflow-tooltip />
|
||||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
<el-table-column label="总价" prop="total_price" show-overflow-tooltip />
|
||||||
<el-table-column type="selection" width="55" />
|
</el-table>
|
||||||
<el-table-column label="上级关联id" prop="oid" show-overflow-tooltip />
|
</div>
|
||||||
<el-table-column label="商品" prop="product_id" show-overflow-tooltip />
|
<div class="flex mt-4 justify-end">
|
||||||
<el-table-column label="数量" prop="nums" show-overflow-tooltip />
|
<pagination v-model="pager" @change="getLists" />
|
||||||
<el-table-column label="1入库2出库3门店4订单" prop="types" show-overflow-tooltip />
|
</div>
|
||||||
<el-table-column label="溯源id" prop="link_id" show-overflow-tooltip />
|
</el-card>
|
||||||
<el-table-column label="总价" prop="total_price" show-overflow-tooltip />
|
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
|
||||||
<el-table-column label="操作" width="120" fixed="right">
|
</div>
|
||||||
<template #default="{ row }">
|
|
||||||
<el-button
|
|
||||||
v-perms="['product_source_link_info.product_source_link_info/edit']"
|
|
||||||
type="primary"
|
|
||||||
link
|
|
||||||
@click="handleEdit(row)"
|
|
||||||
>
|
|
||||||
编辑
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
v-perms="['product_source_link_info.product_source_link_info/delete']"
|
|
||||||
type="danger"
|
|
||||||
link
|
|
||||||
@click="handleDelete(row.id)"
|
|
||||||
>
|
|
||||||
删除
|
|
||||||
</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>
|
|
||||||
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="productSourceLinkInfoLists">
|
<script lang="ts" setup name="productSourceLinkInfoLists">
|
||||||
import { usePaging } from '@/hooks/usePaging'
|
import { usePaging } from '@/hooks/usePaging'
|
||||||
import { useDictData } from '@/hooks/useDictOptions'
|
import { useDictData } from '@/hooks/useDictOptions'
|
||||||
import { apiProductSourceLinkInfoLists, apiProductSourceLinkInfoDelete } from '@/api/product_source_link_info'
|
import { apiProductSourceLinkInfoLists, apiProductSourceLinkInfoDelete } from '@/api/product_source_link_info'
|
||||||
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'
|
||||||
|
|
||||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||||
// 是否显示编辑框
|
// 是否显示编辑框
|
||||||
const showEdit = ref(false)
|
const showEdit = ref(false)
|
||||||
|
|
||||||
|
|
||||||
// 查询条件
|
// 查询条件
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// 选中数据
|
// 选中数据
|
||||||
const selectData = ref<any[]>([])
|
const selectData = ref<any[]>([])
|
||||||
|
|
||||||
// 表格选择后回调事件
|
// 表格选择后回调事件
|
||||||
const handleSelectionChange = (val: any[]) => {
|
const handleSelectionChange = (val : any[]) => {
|
||||||
selectData.value = val.map(({ id }) => id)
|
selectData.value = val.map(({ id }) => id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取字典数据
|
// 获取字典数据
|
||||||
const { dictData } = useDictData('')
|
const { dictData } = useDictData('')
|
||||||
|
|
||||||
// 分页相关
|
// 分页相关
|
||||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||||
fetchFun: apiProductSourceLinkInfoLists,
|
fetchFun: apiProductSourceLinkInfoLists,
|
||||||
params: queryParams
|
params: queryParams
|
||||||
})
|
})
|
||||||
|
|
||||||
// 添加
|
// 添加
|
||||||
const handleAdd = async () => {
|
const handleAdd = async () => {
|
||||||
showEdit.value = true
|
showEdit.value = true
|
||||||
await nextTick()
|
await nextTick()
|
||||||
editRef.value?.open('add')
|
editRef.value?.open('add')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑
|
// 编辑
|
||||||
const handleEdit = async (data: any) => {
|
const handleEdit = async (data : any) => {
|
||||||
showEdit.value = true
|
showEdit.value = true
|
||||||
await nextTick()
|
await nextTick()
|
||||||
editRef.value?.open('edit')
|
editRef.value?.open('edit')
|
||||||
editRef.value?.setFormData(data)
|
editRef.value?.setFormData(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
const handleDelete = async (id: number | any[]) => {
|
const handleDelete = async (id : number | any[]) => {
|
||||||
await feedback.confirm('确定要删除?')
|
await feedback.confirm('确定要删除?')
|
||||||
await apiProductSourceLinkInfoDelete({ id })
|
await apiProductSourceLinkInfoDelete({ id })
|
||||||
getLists()
|
getLists()
|
||||||
}
|
}
|
||||||
|
|
||||||
getLists()
|
getLists()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user