feat(shop-product): 关键词搜索纳入平台规格(spec)

- 列表关键词新增匹配 spec(模糊),与已有 标题/商家编码/平台商品ID/规格ID 同一口径
- 店铺商品导出的关键词筛选同步加入 spec,占位文案一并更新
- 前端关键词输入框提示补充「规格」

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
liufumingren 2026-11-14 16:20:08 +08:00
parent 75680d9451
commit f219902cda
3 changed files with 7 additions and 6 deletions

View File

@ -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}%` } },
];
}

View File

@ -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));

View File

@ -533,7 +533,7 @@ onBeforeUnmount(() => {
<el-form-item label="关键词">
<el-input
v-model="query.keyword"
placeholder="标题 / 商家编码 / 商品ID / 规格ID"
placeholder="标题 / 商家编码 / 商品ID / 规格ID / 规格"
clearable
@keyup.enter="search"
/>