diff --git a/backend/app/controller/shopProduct.js b/backend/app/controller/shopProduct.js index dada0d1..8faf6e7 100644 --- a/backend/app/controller/shopProduct.js +++ b/backend/app/controller/shopProduct.js @@ -38,7 +38,7 @@ class ShopProductController extends Controller { /** * @summary 店铺商品列表 * @description 分页查询店铺商品,支持按店铺(多选)、平台类型(多选)、商家编码(多个精确匹配)、 - * 平台商品ID / 平台规格ID(多个精确匹配)、绑定状态、关键词(标题/商家编码/平台商品ID)过滤; + * 平台商品ID / 平台规格ID(多个精确匹配)、绑定状态、关键词(标题/商家编码/平台商品ID/规格ID/规格)过滤; * has_unbound_order=1 时只返回「有订单但未绑定系统商品」的店铺商品 * @router get /api/shop-products * @apikey @@ -53,7 +53,7 @@ class ShopProductController extends Controller { * @request query string outer_sku_ids 平台规格ID,多个用英文逗号分隔(精确匹配) * @request query integer bind_type 绑定类型:0未绑定 1系统商品 2组合商品 * @request query integer status 状态:1在售 0下架 - * @request query string keyword 关键词,匹配标题、商家编码或平台商品ID + * @request query string keyword 关键词,匹配标题、商家编码、平台商品ID、平台规格ID 或规格 * @request query integer has_unbound_order 传 1 时只返回有订单且未绑定的商品(待处理订单的商品) * @response 200 shopProductListResponse success */ @@ -106,8 +106,9 @@ class ShopProductController extends Controller { { title: { [Op.like]: `%${keyword}%` } }, { outer_code: { [Op.like]: `%${keyword}%` } }, { outer_item_id: { [Op.like]: `%${keyword}%` } }, - // 与导出/关键词口径一致:规格ID 也能模糊搜 + // 与导出/关键词口径一致:规格ID、平台规格文字 也能模糊搜 { outer_sku_id: { [Op.like]: `%${keyword}%` } }, + { spec: { [Op.like]: `%${keyword}%` } }, ]; } diff --git a/backend/app/utils/exportDefs.js b/backend/app/utils/exportDefs.js index 67b62e6..ff6169e 100644 --- a/backend/app/utils/exportDefs.js +++ b/backend/app/utils/exportDefs.js @@ -1224,7 +1224,7 @@ const EXPORT_TYPES = { { key: 'bind_type', label: '绑定类型', type: 'select', options: BIND_TYPE_OPTIONS }, { key: 'status', label: '状态', type: 'select', options: ENABLE_OPTIONS }, { key: 'has_unbound_order', label: '只看有订单未绑定', type: 'select', options: [{ value: '1', label: '是' }] }, - { key: 'keyword', label: '关键词', type: 'text', placeholder: '标题 / 平台商品ID / 规格ID / 商家编码' }, + { key: 'keyword', label: '关键词', type: 'text', placeholder: '标题 / 平台商品ID / 规格ID / 商家编码 / 规格' }, ], build: (f, ctx) => { const wh = makeWhere(); @@ -1232,7 +1232,7 @@ const EXPORT_TYPES = { .eq('t.shop_id', f.shop_id) .eq('t.bind_type', f.bind_type) .eq('t.status', f.status) - .kw([ 't.title', 't.outer_item_id', 't.outer_sku_id', 't.outer_code' ], f.keyword); + .kw([ 't.title', 't.outer_item_id', 't.outer_sku_id', 't.outer_code', 't.spec' ], f.keyword); // 多值筛选:店铺 / 平台类型 / 商家编码(与列表接口同口径) whereIn(wh, 't.shop_id', csvValues(f.shop_ids).map(Number).filter(id => Number.isInteger(id) && id > 0)); whereIn(wh, 't.platform_type', csvValues(f.platform_types)); diff --git a/frontend/src/views/ShopProduct/Index.vue b/frontend/src/views/ShopProduct/Index.vue index 0aa3f1a..8dd74c3 100644 --- a/frontend/src/views/ShopProduct/Index.vue +++ b/frontend/src/views/ShopProduct/Index.vue @@ -533,7 +533,7 @@ onBeforeUnmount(() => {