diff --git a/backend/app/api/controller/v1/product/CenterProductController.php b/backend/app/api/controller/v1/product/CenterProductController.php index 50cbd92b3..2473e4e8a 100644 --- a/backend/app/api/controller/v1/product/CenterProductController.php +++ b/backend/app/api/controller/v1/product/CenterProductController.php @@ -36,11 +36,25 @@ class CenterProductController ['salesOrder', ''], ['cate_id', ''], ['limit', 30], + ['ids', ''], + ['store_label_id', ''], ]); [$page, $limit] = $services->getPageValue(); if (!empty($where['limit'])) { $limit = (int)$where['limit']; } + // DIY 商品列表/商品选项卡「指定商品」「商品标签」:ids/store_label_id 逗号串转数组(DAO 按数组 whereIn/FIND_IN_SET 处理,ids 需按顺序排序) + foreach (['ids', 'store_label_id'] as $idKey) { + $idValue = is_array($where[$idKey]) ? $where[$idKey] : explode(',', (string)$where[$idKey]); + $where[$idKey] = array_values(array_filter(array_map('intval', $idValue))); + if (empty($where[$idKey])) { + unset($where[$idKey]); + } + } + if (!empty($where['ids'])) { + // 指定商品按已选数量返回,不受默认分页条数限制 + $limit = max($limit, count($where['ids'])); + } if ($where['cate_id'] !== '') { $where['cate_id'] = explode(',', $where['cate_id']); foreach ($where['cate_id'] as $keys => &$items) { diff --git a/frontend/uni-app/src/subpackage/diyComponents/goodList.vue b/frontend/uni-app/src/subpackage/diyComponents/goodList.vue index e55c3fabb..0b1142e74 100644 --- a/frontend/uni-app/src/subpackage/diyComponents/goodList.vue +++ b/frontend/uni-app/src/subpackage/diyComponents/goodList.vue @@ -1243,9 +1243,12 @@ function productslist() { let limit = LIMIT; let data = {}; if (typeConfig.value == 1) { - const goodsList = props.dataConfig.goodsList.list || []; - const ids = goodsList - .map((item) => item.id) + // 指定商品:保存后的配置只保留 goodsList.ids(ID 数组),goodsList.list 仅预览/旧数据存在,两者兼容 + const selectGoods = props.dataConfig.goodsList || {}; + const ids = (selectGoods.ids && selectGoods.ids.length + ? selectGoods.ids + : (selectGoods.list || []).map((item) => item.id) + ) .filter(Boolean) .join(","); if (ids) {