库存商品字段调整;入库格局商品性质填写数量;入库时商品搜索后页码重置为1

This commit is contained in:
weiwei committed 2025-08-04 16:26:25 +08:00
1 parent bf54733b34
commit 0d824b0b24
4 files changed
+74 -39

No files matched your search

@@ -1,7 +1,7 @@
<template>
<el-dialog v-model="dialogVisible" title="选择商品" width="80%" :close-on-click-modal="false" draggable @close="dialogVisible = false">
<el-row>
<el-form :model="queryForm" ref="queryRef" :inline="true" @keyup.enter="getDataList">
<el-form :model="queryForm" ref="queryRef" :inline="true" @keyup.enter="getDataList(true)">
<el-form-item label="商品名称" prop="productName">
<el-input placeholder="请输入商品名称" v-model="queryForm.productName" />
</el-form-item>
@@ -12,7 +12,7 @@
<el-input placeholder="请输入条码" v-model="queryForm.barcode" />
</el-form-item>
<el-form-item>
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
<el-button icon="search" type="primary" @click="getDataList(true)">查询</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
@@ -49,6 +49,11 @@
<div v-else class="text-gray-400">无包装单位</div>
</template>
</el-table-column>
<el-table-column prop="productNature" label="商品性质" show-overflow-tooltip align="center" width="150">
<template #default="scope">
<dict-tag :options="supermarket_nature" :value="scope.row.productNature" />
</template>
</el-table-column>
<el-table-column prop="status" label="状态" min-width="100px" align="center" show-overflow-tooltip>
<template #default="scope">
<dict-tag :options="status" :value="scope.row.status" />
@@ -79,7 +84,7 @@ import { displayPrice } from "/@/utils/formatMoney"
const emit = defineEmits(["getSelectedRows"])
const { status } = useDict("status")
const { supermarket_nature, status } = useDict("supermarket_nature", "status")
const queryRef = ref()
const tableRef = ref() // 对话框多选表格ref
const loading = ref(false) // 对话框多选表格loading
@@ -88,6 +93,8 @@ const queryForm = reactive<any>({
productCode: "",
barcode: "",
productName: "",
current: 1,
size: 10,
})
const total = ref<number>(0)
const dataList = ref<any[]>([]) // 对话框多选表格数据
@@ -97,11 +104,14 @@ const dataList = ref<any[]>([]) // 对话框多选表格数据
// 打开弹窗
const openDialog = async () => {
dialogVisible.value = true
getDataList()
getDataList(false)
}
// 获取商品数据并且勾选
const getDataList = async () => {
const getDataList = async (isSearch = false) => {
if (isSearch) {
queryForm.current = 1
}
loading.value = true
try {
const { code, data } = await getErpSpuPage(queryForm)
@@ -133,7 +143,7 @@ const currentChangeHandle = (val: number) => {
const resetQuery = () => {
queryRef.value?.resetFields()
getDataList()
getDataList(true)
}
// 商品选择对话框确认
@@ -114,6 +114,11 @@
<span v-else>{{ row.erpSpuId && erpSpuSimpleAll.find((item: any) => item.id === row.erpSpuId)?.productName }}</span>
</template>
</vxe-column>
<vxe-column field="productNature" title="商品性质">
<template #default="{ row }">
{{ supermarket_nature.find((item: any) => item.value == row.productNature)?.label || "" }}
</template>
</vxe-column>
<vxe-column field="selectedUnitObj" title="包装单位" :edit-render="{}">
<template #edit="{ row, $rowIndex }">
<el-select
@@ -139,7 +144,14 @@
</vxe-column>
<vxe-column field="quantity" title="数量" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
<template #edit="{ row, $rowIndex }">
<el-input v-model.number="row.quantity" @change="reComputeTotalAmount(row, $rowIndex)" />
<el-input-number
v-if="row.productNature == '1'"
v-model="row.quantity"
:min="0"
:precision="0"
@change="reComputeTotalAmount(row, $rowIndex)"
/>
<el-input-number v-else v-model="row.quantity" :min="0" :precision="2" @change="reComputeTotalAmount(row, $rowIndex)" />
</template>
</vxe-column>
<vxe-column field="purchasePrice" title="原进价">
@@ -223,8 +235,10 @@ import { formatDate } from "/@/utils/formatTime"
import { displayPrice, storePrice } from "/@/utils/formatMoney"
import { tablePrint } from "../../supermarketUtils"
import { useSmProcessFormAction } from "/@/hooks/smProcessFormAction"
import { useDict } from "/@/hooks/dict"
const SelectDialog = defineAsyncComponent(() => import("/@/views/supermarketerp/components/select-dialog.vue"))
const { supermarket_nature } = useDict("supermarket_nature")
const props = withDefaults(
defineProps<{
@@ -383,7 +397,7 @@ const removeRow = () => {
const selectRecords = $table.getCheckboxRecords()
if (selectRecords.length > 0) {
vxeTableData.value = vxeTableData.value.filter((item: any) => !selectRecords.some((row) => row.erpSpuId === item.erpSpuId))
updateFootEvent()
updateFootCount(vxeTableData.value)
}
}
}
@@ -125,7 +125,7 @@
ref="excelUploadRef"
:title="$t('supermarket.importSupplierTip')"
url="/supermarket/smErpSupplier/import"
@refreshDataList="getDataList"
@refreshDataList="refreshDataList"
/>
</div>
</template>
@@ -158,14 +158,19 @@ const state: BasicTableProps = reactive<BasicTableProps>({
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
// 获取货商类别
onMounted(async () => {
onMounted(() => {
getSupplierType()
})
// 获取货商类别
const getSupplierType = async () => {
try {
const res = await getSupplierTypeSimpleAll()
supplierType.value = res.data.filter((item: any) => item.id)
} catch (error) {
supplierType.value = []
}
})
}
// 清空搜索条件
const resetQuery = () => {
@@ -181,6 +186,12 @@ const exportExcel = () => {
downBlobFile("/supermarketerp/smErpSupplier/export", Object.assign(state.queryForm, { ids: selectObjs }), "货商管理.xlsx")
}
// 导入成功刷新数据
const refreshDataList = () => {
getDataList()
getSupplierType()
}
// 多选事件
const selectionChangHandle = (objs: { supplierId: string }[]) => {
selectObjs.value = objs.map(({ supplierId }) => supplierId)
@@ -19,8 +19,8 @@
<el-form-item label="货号" prop="productCode">
<el-input placeholder="请输入货号" v-model="state.queryForm.productCode" />
</el-form-item>
<el-form-item label="条码" prop="barcode">
<el-input placeholder="条码" v-model="state.queryForm.barcode" />
<el-form-item label="条码" prop="barCode">
<el-input placeholder="条码" v-model="state.queryForm.barCode" />
</el-form-item>
<el-form-item>
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
@@ -82,7 +82,7 @@
<el-table-column type="selection" width="40" fixed="left" />
<el-table-column type="index" label="#" width="50" fixed="left" />
<el-table-column prop="productCode" label="货号" show-overflow-tooltip min-width="160" />
<!-- <el-table-column prop="barcode" label="自编码/条码" show-overflow-tooltip width="100" /> -->
<!-- <el-table-column prop="barCode" label="自编码/条码" show-overflow-tooltip width="100" /> -->
<el-table-column prop="productName" label="商品名称" show-overflow-tooltip min-width="160" />
<el-table-column prop="unit" label="单位" show-overflow-tooltip />
<el-table-column prop="categoryId" label="商品分类" show-overflow-tooltip width="100">
@@ -90,14 +90,9 @@
<el-tag>{{ supermarketCategory?.find((item: any) => item.id === scope.row.categoryId)?.name }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="supplierId" label="货商" show-overflow-tooltip>
<el-table-column prop="productNature" label="商品性质" show-overflow-tooltip width="150">
<template #default="scope">
{{ supermarketSupplier?.find((item: any) => item.supplierId == scope.row.supplierId)?.supplierName }}
</template>
</el-table-column>
<el-table-column prop="brandId" label="品牌" show-overflow-tooltip>
<template #default="scope">
{{ supermarketBrand?.find((item: any) => item.id === scope.row.brandId)?.name }}
<dict-tag :options="supermarket_nature" :value="scope.row.productNature" />
</template>
</el-table-column>
<el-table-column prop="picUrl" label="封面图" width="100">
@@ -105,11 +100,16 @@
<preview-image :src="scope.row.picUrl" />
</template>
</el-table-column>
<el-table-column prop="status" label="商品状态" width="100">
<el-table-column prop="supplierId" label="货商" show-overflow-tooltip>
<template #default="scope">
<dict-tag :options="status" :value="scope.row.status" />
{{ supermarketSupplier?.find((item: any) => item.supplierId == scope.row.supplierId)?.supplierName }}
</template>
</el-table-column>
<!-- <el-table-column prop="brandId" label="品牌" show-overflow-tooltip>
<template #default="scope">
{{ supermarketBrand?.find((item: any) => item.id === scope.row.brandId)?.name }}
</template>
</el-table-column> -->
<el-table-column prop="costPrice" label="成本单价(元)" show-overflow-tooltip width="120">
<template #default="{ row }">{{ displayPrice(row.costPrice, "") }}</template>
</el-table-column>
@@ -117,6 +117,11 @@
<template #default="{ row }">{{ displayPrice(row.retailPrice, "") }}</template>
</el-table-column>
<el-table-column prop="stock" label="剩余总库存" show-overflow-tooltip />
<el-table-column prop="status" label="商品状态" width="100">
<template #default="scope">
<dict-tag :options="status" :value="scope.row.status" />
</template>
</el-table-column>
<!-- <el-table-column prop="giveIntegral" label="赠送积分" show-overflow-tooltip /> -->
<!-- <el-table-column prop="merchantId" label="商户编号" show-overflow-tooltip /> -->
<!-- <el-table-column prop="specification" label="规格" show-overflow-tooltip /> -->
@@ -124,18 +129,13 @@
<!-- <el-table-column prop="purchasePrice" label="进价)" show-overflow-tooltip /> -->
<!-- <el-table-column prop="retailPrice" label="零售价" show-overflow-tooltip /> -->
<!-- <el-table-column prop="promotionPrice" label="促销价" show-overflow-tooltip /> -->
<el-table-column prop="productNature" label="商品性质" show-overflow-tooltip width="150">
<template #default="scope">
<dict-tag :options="supermarket_nature" :value="scope.row.productNature" />
</template>
</el-table-column>
<!-- <el-table-column prop="inventoryUpperLimit" label="库存上限" show-overflow-tooltip /> -->
<!-- <el-table-column prop="inventoryLowerLimit" label="库存下限" show-overflow-tooltip /> -->
<el-table-column prop="salesCount" label="售卖数量" show-overflow-tooltip min-width="100" />
<el-table-column prop="grossMargin" label="毛利率" show-overflow-tooltip>
<!-- <el-table-column prop="salesCount" label="售卖数量" show-overflow-tooltip min-width="100" /> -->
<!-- <el-table-column prop="grossMargin" label="毛利率" show-overflow-tooltip>
<template #default="{ row }">{{ displayPrice(row.grossMargin, "") }}</template>
</el-table-column>
<el-table-column prop="origin" label="产地" show-overflow-tooltip />
</el-table-column> -->
<!-- <el-table-column prop="origin" label="产地" show-overflow-tooltip /> -->
<el-table-column label="操作" width="150" fixed="right">
<template #default="scope">
<el-button
@@ -187,7 +187,7 @@ const showSearch = ref(true)
const selectObjs = ref([]) as any // 表格行选中的数据
const multiple = ref(true) // 是否已经多选
const supermarketCategory = ref<any>([]) // 商品分类
const supermarketBrand = ref<any>([]) // 商品品牌
// const supermarketBrand = ref<any>([]) // 商品品牌
const supermarketSupplier = ref<any>([]) // 货商
const state: BasicTableProps = reactive<BasicTableProps>({
@@ -243,12 +243,12 @@ onMounted(async () => {
supermarketCategory.value = []
}
// 获取商品品牌
try {
const res = await getSupermarketBrand()
supermarketBrand.value = res.data
} catch (error) {
supermarketBrand.value = []
}
// try {
// const res = await getSupermarketBrand()
// supermarketBrand.value = res.data
// } catch (error) {
// supermarketBrand.value = []
// }
// 获取货商
try {
const res = await getSupplierSimpleAll()