线下提号增加搜索手机号
This commit is contained in:
@@ -435,7 +435,13 @@ func (r *Repository) ListAdmin(ctx context.Context, query AdminPickupQuery) (*Pa
|
|||||||
}
|
}
|
||||||
if kw := strings.TrimSpace(query.Keyword); kw != "" {
|
if kw := strings.TrimSpace(query.Keyword); kw != "" {
|
||||||
like := "%" + kw + "%"
|
like := "%" + kw + "%"
|
||||||
db = db.Where("p.pickup_no LIKE ? OR l.listing_no LIKE ? OR a.title LIKE ?", like, like, like)
|
db = db.Where(
|
||||||
|
"p.pickup_no LIKE ? OR l.listing_no LIKE ? OR a.title LIKE ? OR owner.phone LIKE ?",
|
||||||
|
like,
|
||||||
|
like,
|
||||||
|
like,
|
||||||
|
like,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return r.paginatePickups(db, query.Page, query.PageSize, false)
|
return r.paginatePickups(db, query.Page, query.PageSize, false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,6 +154,27 @@ func TestRepositoryListAdminFiltersShopName(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRepositoryListAdminFiltersOwnerPhone(t *testing.T) {
|
||||||
|
repo, db := newPickupTestRepo(t)
|
||||||
|
pickup := seedPickup(t, db, StatusPickingUp)
|
||||||
|
|
||||||
|
result, err := repo.ListAdmin(t.Context(), AdminPickupQuery{Keyword: "000000"})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("ListAdmin() error = %v", err)
|
||||||
|
}
|
||||||
|
if result.Total != 1 || len(result.Items) != 1 {
|
||||||
|
t.Fatalf("手机号搜索结果 = total %d, items %d, want 1", result.Total, len(result.Items))
|
||||||
|
}
|
||||||
|
if result.Items[0].ID != pickup.ID || result.Items[0].OwnerPhone != "18800000000" {
|
||||||
|
t.Fatalf(
|
||||||
|
"手机号搜索结果 = id %d, phone %q, want id %d, phone 18800000000",
|
||||||
|
result.Items[0].ID,
|
||||||
|
result.Items[0].OwnerPhone,
|
||||||
|
pickup.ID,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestRepositoryListShopNamesReturnsDistinctPlatformOptions(t *testing.T) {
|
func TestRepositoryListShopNamesReturnsDistinctPlatformOptions(t *testing.T) {
|
||||||
repo, db := newPickupTestRepo(t)
|
repo, db := newPickupTestRepo(t)
|
||||||
first := seedPickup(t, db, StatusPickingUp)
|
first := seedPickup(t, db, StatusPickingUp)
|
||||||
|
|||||||
@@ -336,9 +336,9 @@ function listingOptionLabel(item: AvailableListing) {
|
|||||||
<div class="filter-bar">
|
<div class="filter-bar">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="filters.keyword"
|
v-model="filters.keyword"
|
||||||
placeholder="提号编号 / 上架编号 / 账号标题"
|
placeholder="提号编号 / 上架编号 / 账号标题 / 手机号"
|
||||||
clearable
|
clearable
|
||||||
style="width: 240px"
|
style="width: 300px"
|
||||||
@keyup.enter="handleSearch"
|
@keyup.enter="handleSearch"
|
||||||
/>
|
/>
|
||||||
<el-select v-model="filters.status" placeholder="状态" clearable style="width: 130px">
|
<el-select v-model="filters.status" placeholder="状态" clearable style="width: 130px">
|
||||||
|
|||||||
Reference in New Issue
Block a user