调整商品溯源

This commit is contained in:
lewis 2025-03-12 17:53:20 +08:00
parent 6f487dc55f
commit 6f076f6e9c
3 changed files with 240 additions and 246 deletions

View 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>

View File

@ -1,148 +1,111 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<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">
<el-button
v-perms="['product_source_link.product_source_link/add']"
type="primary"
@click="handleAdd"
>
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button
v-perms="['product_source_link.product_source_link/delete']"
:disabled="!selectData.length"
@click="handleDelete(selectData)"
>
删除
</el-button>
<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="purchase_nickname"
show-overflow-tooltip
/>
<el-table-column label="商品图片" prop="image" show-overflow-tooltip>
<template #default="{ row }">
<el-image :src="row.image" style="width: 50px; height: 50px" />
</template>
</el-table-column>
<el-table-column label="商品名称" prop="product_name" show-overflow-tooltip />
<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>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<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">
<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="purchase_nickname" show-overflow-tooltip />
<el-table-column label="商品ID" prop="product_id" show-overflow-tooltip />
<el-table-column label="商品名称" prop="product_name" show-overflow-tooltip />
<el-table-column label="商品图片" prop="image" show-overflow-tooltip>
<template #default="{ row }">
<el-image :src="row.image" style="width: 50px; height: 50px" :preview-teleported="true"
:preview-src-list="[row.image]" />
</template>
</el-table-column>
<el-table-column label="采购数量" prop="total_nums" show-overflow-tooltip />
<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">
<template #default="{ row }">
<el-button v-perms="['product_source_link.product_source_link/edit']" type="primary" link
@click="handleStockDetai(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>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
<DetailsStock ref="StockDetailsRef"></DetailsStock>
</div>
</template>
<script lang="ts" setup name="productSourceLinkLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiProductSourceLinkLists, apiProductSourceLinkDelete } from '@/api/product_source_link'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiProductSourceLinkLists, apiProductSourceLinkDelete } from '@/api/product_source_link'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import DetailsStock from './details_stock.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
const showStockDetails = ref(false)
const StockDetailsRef = ref(null)
//
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[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const handleSelectionChange = (val : any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiProductSourceLinkLists,
params: queryParams
})
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiProductSourceLinkLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
//
const handleEdit = async (data : any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiProductSourceLinkDelete({ id })
getLists()
}
//
const handleDelete = async (id : number | any[]) => {
await feedback.confirm('确定要删除?')
await apiProductSourceLinkDelete({ id })
getLists()
}
getLists()
</script>
getLists()
</script>

View File

@ -1,128 +1,96 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form
class="mb-[-16px]"
:model="queryParams"
inline
>
<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">
<el-button v-perms="['product_source_link_info.product_source_link_info/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button
v-perms="['product_source_link_info.product_source_link_info/delete']"
:disabled="!selectData.length"
@click="handleDelete(selectData)"
>
删除
</el-button>
<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="oid" show-overflow-tooltip />
<el-table-column label="商品" prop="product_id" show-overflow-tooltip />
<el-table-column label="数量" prop="nums" show-overflow-tooltip />
<el-table-column label="1入库2出库3门店4订单" prop="types" show-overflow-tooltip />
<el-table-column label="溯源id" prop="link_id" show-overflow-tooltip />
<el-table-column label="总价" prop="total_price" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<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>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<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">
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column label="商品ID" prop="product_id" show-overflow-tooltip />
<el-table-column label="商品名称" prop="product_name" show-overflow-tooltip />
<el-table-column label="商品图片" prop="image" show-overflow-tooltip>
<template #default="{ row }">
<el-image :src="row.image" style="width: 50px; height: 50px" :preview-teleported="true"
:preview-src-list="[row.image]" />
</template>
</el-table-column>
<el-table-column label="数量" prop="nums" show-overflow-tooltip />
<el-table-column label="类型" prop="type_name" show-overflow-tooltip />
<el-table-column label="溯源id" prop="link_id" show-overflow-tooltip />
<el-table-column label="单价" prop="price" show-overflow-tooltip />
<el-table-column label="总价" prop="total_price" show-overflow-tooltip />
</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>
<script lang="ts" setup name="productSourceLinkInfoLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiProductSourceLinkInfoLists, apiProductSourceLinkInfoDelete } from '@/api/product_source_link_info'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiProductSourceLinkInfoLists, apiProductSourceLinkInfoDelete } from '@/api/product_source_link_info'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({
})
//
const queryParams = reactive({
//
const selectData = ref<any[]>([])
})
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const selectData = ref<any[]>([])
//
const { dictData } = useDictData('')
//
const handleSelectionChange = (val : any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiProductSourceLinkInfoLists,
params: queryParams
})
//
const { dictData } = useDictData('')
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiProductSourceLinkInfoLists,
params: queryParams
})
//
const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiProductSourceLinkInfoDelete({ id })
getLists()
}
//
const handleEdit = async (data : any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
getLists()
</script>
//
const handleDelete = async (id : number | any[]) => {
await feedback.confirm('确定要删除?')
await apiProductSourceLinkInfoDelete({ id })
getLists()
}
getLists()
</script>