支持号主与租客查看自己的发布/订单详情

新增卖家商品详情页;订单详情底部增加可折叠账号快照,已完成订单展示结账明细。
This commit is contained in:
yml2213
2026-07-16 20:47:33 +08:00
parent b44b3354b9
commit e241607535
12 changed files with 1870 additions and 95 deletions
+37 -4
View File
@@ -231,10 +231,43 @@ func sanitizeOrderSnapshot(snapshot *datatypes.JSON, role string) {
return
}
}
breakdown, _ := summary["price_breakdown"].(map[string]any)
if role == "owner" && breakdown != nil {
if sellerRatio := readJSONNumber(breakdown["seller_ratio"]); sellerRatio > 0 {
summary["publish_ratio"] = sellerRatio
// price_breakdown 含双方比例与加价明细,仅把当前角色可见的价格字段摊平到 summary,再删除原对象。
if breakdown, ok := summary["price_breakdown"].(map[string]any); ok && breakdown != nil {
switch role {
case "owner":
if v := readJSONNumber(breakdown["seller_ratio"]); v > 0 {
summary["publish_ratio"] = v
summary["display_ratio"] = v
}
if v := readJSONNumber(breakdown["seller_reference_ratio"]); v > 0 {
summary["reference_ratio"] = v
}
if v := readJSONNumber(breakdown["seller_total_price"]); v > 0 {
summary["display_total_price"] = v
}
if v := readJSONNumber(breakdown["seller_coin_base_price"]); v > 0 {
summary["display_coin_base_price"] = v
}
if v := readJSONNumber(breakdown["accelerated_sale_ratio"]); v > 0 {
summary["accelerated_sale_ratio"] = v
}
case "renter":
if v := readJSONNumber(breakdown["buyer_ratio"]); v > 0 {
summary["publish_ratio"] = v
summary["display_ratio"] = v
}
if v := readJSONNumber(breakdown["buyer_total_price"]); v > 0 {
summary["display_total_price"] = v
}
if v := readJSONNumber(breakdown["buyer_coin_base_price"]); v > 0 {
summary["display_coin_base_price"] = v
}
}
if v := readJSONNumber(breakdown["consumable_price"]); v > 0 {
summary["consumable_price"] = v
}
if v := readJSONNumber(breakdown["daily_loss_ratio_adjustment"]); v != 0 {
summary["daily_loss_ratio_adjustment"] = v
}
}
delete(summary, "price_breakdown")