feat(smart-cabinet): 添加belongType参数支持商品分类筛选

在ShopConfigModal和CabinetGoodsConfigModal组件中新增belongType参数,用于根据商品所属类型进行筛选。同时移除商品配置模态框中多余的belongType选择器,直接从父组件传递参数。
This commit is contained in:
dzq 2025-06-11 17:22:40 +08:00
parent 1d2cd48a7f
commit 5dcdca0397
3 changed files with 18 additions and 6 deletions

View File

@ -403,7 +403,7 @@ onMounted(() => {
</div>
</el-card>
<GatewayConfigModal v-model="gatewayConfigVisible" :cabinet-id="cabinetId" @refresh="fetchCabinetDetail" />
<ShopConfigModal v-model="shopConfigVisible" :cabinet-id="cabinetId" @refresh="fetchCabinetDetail" />
<ShopConfigModal v-model="shopConfigVisible" :cabinet-id="cabinetId" :belong-type="cabinetInfo.belongType" @refresh="fetchCabinetDetail" />
<MainCabinetConfigModal v-model="mainCabinetConfigVisible" :cabinet-id="cabinetId"
@refresh="fetchCabinetDetail" />
<el-drawer v-model="editCabinetDrawerVisible" title="编辑柜体" size="30%" direction="rtl">
@ -411,7 +411,7 @@ onMounted(() => {
@refresh="fetchCabinetDetail" />
</el-drawer>
<el-drawer v-model="goodsConfigVisible" title="配置商品" size="50%" direction="rtl">
<CabinetGoodsConfigModal v-model="goodsConfigVisible" :cell-id="currentCellId" @refresh="fetchCellList" />
<CabinetGoodsConfigModal v-model="goodsConfigVisible" :cell-id="currentCellId" :belong-type="cabinetInfo.belongType" @refresh="fetchCellList" />
</el-drawer>
<el-drawer v-model="configuredGoodsVisible" title="管理商品" size="30%" direction="rtl">
<ConfiguredGoodsModal v-model="configuredGoodsVisible" :cell-id="currentCell?.cellId"

View File

@ -25,6 +25,7 @@ import { updateSmartCabinet } from '@/api/cabinet/smart-cabinet';
const props = defineProps<{
modelValue: boolean;
cabinetId: number;
belongType?: number;
}>();
const emit = defineEmits(['update:modelValue', 'refresh']);
@ -47,7 +48,8 @@ const loadShops = async () => {
loading.value = true;
const { data } = await getShopList({
pageSize: pagination.value.pageSize,
pageNum: pagination.value.currentPage
pageNum: pagination.value.currentPage,
belongType: props.belongType
});
shopList.value = data.rows;
pagination.value.total = data.total;

View File

@ -6,11 +6,16 @@ import { configureGoodsCellsStock } from "@/api/cabinet/cabinet-cell";
import Search from "@iconify-icons/ep/search";
import Refresh from "@iconify-icons/ep/refresh";
import { ElMessage, ElMessageBox } from "element-plus";
import { useWxStore } from "@/store/modules/wx";
const props = defineProps({
cellId: {
type: Number,
required: true
},
belongType: {
type: Number,
required: false
}
});
@ -19,10 +24,13 @@ const closeModal = () => {
emit('update:modelValue', false);
};
const wxStore = useWxStore();
const searchFormParams = ref({
corpid: wxStore.corpid,
goodsName: "",
status: null,
belongType: null
belongType: props.belongType
});
const pagination = ref({
@ -37,6 +45,8 @@ const dataList = ref<GoodsDTO[]>([]);
const getList = async () => {
try {
loading.value = true;
searchFormParams.value.corpid = wxStore.corpid;
searchFormParams.value.belongType = props.belongType;
const { data } = await getGoodsListApi({
...searchFormParams.value,
pageSize: pagination.value.pageSize,
@ -104,13 +114,13 @@ defineExpose({ getList });
<el-option label="已下架" :value="2" />
</el-select>
</el-form-item> -->
<el-form-item prop="belongType">
<!-- <el-form-item prop="belongType">
<el-select v-model="searchFormParams.belongType" placeholder="请选择商品所属" clearable @change="getList"
class="!w-[180px]">
<el-option label="智柜通" :value="0" />
<el-option label="固资通" :value="1" />
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item>
<el-button type="primary" :icon="useRenderIcon(Search)" @click="getList">
搜索