@@ -18,7 +18,7 @@ import (
|
||||
// **商品级一行**(不是 SKU 级),数据来自 shopee_products 和 shopee_skus
|
||||
// 聚合联查。列定义见 docs/admin/05-ui-specification.md §4.2、工单 #41。
|
||||
func (h *Handler) ShopeeList(c *gin.Context) {
|
||||
h.renderShopeeList(c, c.Query("goods_id"), c.Query("shop_name"), c.Query("status"), c.Query("shop"), c.Query("image"), c.Query("deleted"), c.Query("page"), c.Query("msg"))
|
||||
h.renderShopeeList(c, c.Query("goods_id"), c.Query("shop_name"), c.Query("status"), c.Query("shop"), c.Query("image"), c.Query("store"), c.Query("deleted"), c.Query("page"), c.Query("msg"))
|
||||
}
|
||||
|
||||
// ShopeeDetail 渲染双击行弹出的那个弹窗的**内容**(不是整页)。
|
||||
@@ -49,6 +49,7 @@ func (h *Handler) ShopeeDetail(c *gin.Context) {
|
||||
"ShopNameKeyword": strings.TrimSpace(c.Query("shop_name")),
|
||||
"ShopFilter": service.ParseShopeePresence(c.Query("shop")),
|
||||
"ImageFilter": service.ParseShopeePresence(c.Query("image")),
|
||||
"StoreFilter": strings.TrimSpace(c.Query("store")),
|
||||
"CurrentPage": service.ParsePage(c.Query("page")),
|
||||
})
|
||||
}
|
||||
@@ -57,13 +58,14 @@ func (h *Handler) ShopeeDetail(c *gin.Context) {
|
||||
//
|
||||
// `[必须]` 分页控件用 <a href> 纯 GET 导航,翻页要保留关键词和三个下拉筛选,
|
||||
// 所以这里把归一后的有效值透传回模板去拼下一页的链接(工单 #43、#150)。
|
||||
func (h *Handler) renderShopeeList(c *gin.Context, keyword, shopName, statusRaw, shopRaw, imageRaw, deletedRaw, pageRaw, msg string) {
|
||||
func (h *Handler) renderShopeeList(c *gin.Context, keyword, shopName, statusRaw, shopRaw, imageRaw, storeRaw, deletedRaw, pageRaw, msg string) {
|
||||
filter := repository.ShopeeFilter{
|
||||
Keyword: keyword,
|
||||
ShopName: strings.TrimSpace(shopName),
|
||||
Status: service.ParseShopeeStatus(statusRaw),
|
||||
Shop: service.ParseShopeePresence(shopRaw),
|
||||
Image: service.ParseShopeePresence(imageRaw),
|
||||
StoreID: strings.TrimSpace(storeRaw),
|
||||
}
|
||||
if currentUser(c).IsAdmin() && deletedRaw == "1" {
|
||||
filter.Deleted = true
|
||||
@@ -84,6 +86,11 @@ func (h *Handler) renderShopeeList(c *gin.Context, keyword, shopName, statusRaw,
|
||||
"读取可选客户端失败,数据没有被改动。刷新页面重试。")
|
||||
return
|
||||
}
|
||||
shopOptions, err := service.ShopOptions(h.db)
|
||||
if err != nil {
|
||||
fail(c, http.StatusInternalServerError, "读取业务店铺失败,数据没有被改动。")
|
||||
return
|
||||
}
|
||||
|
||||
status := msg
|
||||
if status == "" {
|
||||
@@ -106,6 +113,9 @@ func (h *Handler) renderShopeeList(c *gin.Context, keyword, shopName, statusRaw,
|
||||
if filter.Image != "" {
|
||||
values.Set("image", filter.Image)
|
||||
}
|
||||
if filter.StoreID != "" {
|
||||
values.Set("store", filter.StoreID)
|
||||
}
|
||||
if filter.Deleted {
|
||||
values.Set("deleted", "1")
|
||||
}
|
||||
@@ -119,6 +129,8 @@ func (h *Handler) renderShopeeList(c *gin.Context, keyword, shopName, statusRaw,
|
||||
"ShopOptions": service.ShopeePresenceOptions("有店铺", "无店铺"),
|
||||
"ImageFilter": filter.Image,
|
||||
"ImageOptions": service.ShopeePresenceOptions("有图片", "无图片"),
|
||||
"StoreFilter": filter.StoreID,
|
||||
"StoreOptions": shopOptions,
|
||||
"DeletedFilter": filter.Deleted,
|
||||
"Rows": result.Rows,
|
||||
"Status": status,
|
||||
@@ -253,6 +265,9 @@ func (h *Handler) shopeeRedirect(c *gin.Context, msg string) {
|
||||
if value := service.ParseShopeePresence(c.PostForm("image")); value != "" {
|
||||
params.Set("image", value)
|
||||
}
|
||||
if value := strings.TrimSpace(c.PostForm("store")); value != "" {
|
||||
params.Set("store", value)
|
||||
}
|
||||
if currentUser(c).IsAdmin() && c.PostForm("deleted") == "1" {
|
||||
params.Set("deleted", "1")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user