From 88beae4c96c0c25f365615b6b87b0cc8dc2f04b2 Mon Sep 17 00:00:00 2001 From: yml2213 Date: Thu, 5 Nov 2026 12:14:25 +0800 Subject: [PATCH] =?UTF-8?q?feat(listing):=20=E5=A2=9E=E5=8A=A0=E8=B5=94?= =?UTF-8?q?=E4=BB=98=E6=96=B9=E6=A1=88=E8=AF=B4=E6=98=8E=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/internal/modules/systemconfig/dto.go | 1 + .../internal/modules/systemconfig/normalize.go | 3 +++ .../modules/systemconfig/publish_options.go | 1 + .../modules/systemconfig/publish_options_test.go | 14 ++++++++++++++ .../admin/components/PublishOptionsDialog.vue | 8 ++++++++ .../features/listings/api/listingOptions.spec.ts | 15 +++++++++++++++ .../src/features/listings/api/listingOptions.ts | 7 +++++++ .../views/MobileSellerListingCreateView.css | 1 + .../views/MobileSellerListingCreateView.vue | 2 +- .../seller/views/SellerListingCreateView.css | 1 + .../seller/views/SellerListingCreateView.vue | 2 +- 11 files changed, 53 insertions(+), 2 deletions(-) diff --git a/backend/internal/modules/systemconfig/dto.go b/backend/internal/modules/systemconfig/dto.go index 7107569c..e46d5b05 100644 --- a/backend/internal/modules/systemconfig/dto.go +++ b/backend/internal/modules/systemconfig/dto.go @@ -167,6 +167,7 @@ type PublishPriceConfig struct { DepositPlaceholder string `json:"deposit_placeholder"` DepositHint string `json:"deposit_hint"` DepositTooltip string `json:"deposit_tooltip"` + CompensationNote string `json:"compensation_note"` PricePlaceholder string `json:"price_placeholder"` RatioDescription string `json:"ratio_description"` } diff --git a/backend/internal/modules/systemconfig/normalize.go b/backend/internal/modules/systemconfig/normalize.go index 5d88fb83..babd2872 100644 --- a/backend/internal/modules/systemconfig/normalize.go +++ b/backend/internal/modules/systemconfig/normalize.go @@ -234,6 +234,9 @@ func normalizePublishOptions(options *PublishOptionsDTO) { if options.PriceConfig.DepositTooltip == "" { options.PriceConfig.DepositTooltip = defaults.PriceConfig.DepositTooltip } + if options.PriceConfig.CompensationNote == "" { + options.PriceConfig.CompensationNote = defaults.PriceConfig.CompensationNote + } if options.PriceConfig.PricePlaceholder == "" { options.PriceConfig.PricePlaceholder = defaults.PriceConfig.PricePlaceholder } diff --git a/backend/internal/modules/systemconfig/publish_options.go b/backend/internal/modules/systemconfig/publish_options.go index cf4a635c..bca97dd6 100644 --- a/backend/internal/modules/systemconfig/publish_options.go +++ b/backend/internal/modules/systemconfig/publish_options.go @@ -115,6 +115,7 @@ func DefaultPublishOptions() PublishOptionsDTO { 4. 额外保障选项 若您在设置足额押金后仍感不放心,可选择购买平台提供的《全额包赔服务》。一旦发生封号损失,将获得账号市场价值的全额赔付,让您的出租过程后顾无忧。`, + CompensationNote: "普通赔付方案如下:账号在租期内或祖期外出现封禁,追回、洗号等情况,最高可获赔全款相金+押金\n\n无忧保险赔付方案:按账号市场价值进行赔付(可参照螃蟹,盼之等主流交易平台)。注:选择此方案,需额外抽取订单佣金的8.0%作为服务费:押金须达到推荐押金方可购买。", PricePlaceholder: "填写币数、保险、体力和负重后自动计算;发布总价=纯币基础价+额外消耗品", RatioDescription: "1:xx 表示 1 元人民币(RMB)等价兑换 xx 万哈夫币", }, diff --git a/backend/internal/modules/systemconfig/publish_options_test.go b/backend/internal/modules/systemconfig/publish_options_test.go index 61484cd5..128387a6 100644 --- a/backend/internal/modules/systemconfig/publish_options_test.go +++ b/backend/internal/modules/systemconfig/publish_options_test.go @@ -150,6 +150,20 @@ func TestNormalizePublishOptionsValueDefaultsDepositTooltip(t *testing.T) { } } +func TestNormalizePublishOptionsValueDefaultsCompensationNote(t *testing.T) { + normalized, err := normalizePublishOptionsValue(`{"schema_version":2}`) + if err != nil { + t.Fatalf("规范化失败: %v", err) + } + var options PublishOptionsDTO + if err := json.Unmarshal([]byte(normalized), &options); err != nil { + t.Fatalf("解析规范化结果失败: %v", err) + } + if !strings.Contains(options.PriceConfig.CompensationNote, "普通赔付方案如下") { + t.Fatalf("赔付方案说明默认文案缺失: %q", options.PriceConfig.CompensationNote) + } +} + func TestNormalizePublishOptionsValuePreservesExplicitZeroPremiumReviewRatioMarkup(t *testing.T) { options := DefaultPublishOptions() options.RatioConfig.PremiumReviewRatioMarkup = 0 diff --git a/frontend/src/features/admin/components/PublishOptionsDialog.vue b/frontend/src/features/admin/components/PublishOptionsDialog.vue index c808dd44..360ba2eb 100644 --- a/frontend/src/features/admin/components/PublishOptionsDialog.vue +++ b/frontend/src/features/admin/components/PublishOptionsDialog.vue @@ -344,6 +344,14 @@ async function handleSave() { placeholder="支持换行,发布页点击或悬停押金旁的说明图标时展示" /> + + + { expect(options.price_config.deposit_tooltip).toBe('自定义押金说明') }) + + it('读取后台配置的赔付方案说明', () => { + const options = mergeListingPublishOptions({ + price_config: { + deposit_placeholder: '', + deposit_hint: '', + deposit_tooltip: '', + compensation_note: '自定义赔付方案说明', + price_placeholder: '', + ratio_description: '', + }, + }) + + expect(options.price_config.compensation_note).toBe('自定义赔付方案说明') + }) }) diff --git a/frontend/src/features/listings/api/listingOptions.ts b/frontend/src/features/listings/api/listingOptions.ts index e5d9cd1a..eb8b4cd2 100644 --- a/frontend/src/features/listings/api/listingOptions.ts +++ b/frontend/src/features/listings/api/listingOptions.ts @@ -33,6 +33,7 @@ export interface PublishPriceConfig { deposit_placeholder: string deposit_hint: string deposit_tooltip: string + compensation_note: string price_placeholder: string ratio_description: string } @@ -168,6 +169,8 @@ export const emptyListingPublishOptions: ListingPublishOptions = { deposit_placeholder: '', deposit_hint: '租客缴纳,封号必赔付', deposit_tooltip: defaultDepositTooltip, + compensation_note: + '普通赔付方案如下:账号在租期内或祖期外出现封禁,追回、洗号等情况,最高可获赔全款相金+押金\n\n无忧保险赔付方案:按账号市场价值进行赔付(可参照螃蟹,盼之等主流交易平台)。注:选择此方案,需额外抽取订单佣金的8.0%作为服务费:押金须达到推荐押金方可购买。', price_placeholder: '', ratio_description: '', }, @@ -357,6 +360,10 @@ function normalizePriceConfig(value?: unknown): PublishPriceConfig { typeof row.deposit_tooltip === 'string' && row.deposit_tooltip.trim() ? row.deposit_tooltip.trim() : emptyListingPublishOptions.price_config.deposit_tooltip, + compensation_note: + typeof row.compensation_note === 'string' && row.compensation_note.trim() + ? row.compensation_note.trim() + : emptyListingPublishOptions.price_config.compensation_note, price_placeholder: typeof row.price_placeholder === 'string' ? row.price_placeholder.trim() : '', ratio_description: diff --git a/frontend/src/features/seller/views/MobileSellerListingCreateView.css b/frontend/src/features/seller/views/MobileSellerListingCreateView.css index f5aea167..32d901ac 100644 --- a/frontend/src/features/seller/views/MobileSellerListingCreateView.css +++ b/frontend/src/features/seller/views/MobileSellerListingCreateView.css @@ -1180,6 +1180,7 @@ color: #858c96; font-size: 10px; line-height: 1.55; + white-space: pre-line; } .publish-agreement-card { diff --git a/frontend/src/features/seller/views/MobileSellerListingCreateView.vue b/frontend/src/features/seller/views/MobileSellerListingCreateView.vue index 0b19d18c..cbf38ecf 100644 --- a/frontend/src/features/seller/views/MobileSellerListingCreateView.vue +++ b/frontend/src/features/seller/views/MobileSellerListingCreateView.vue @@ -987,7 +987,7 @@ const screenshotGuides: Record = {

- 无忧租号保险在普通赔付基础上增加账号市场价值保障,服务费按实际到手租金扣除。 + {{ priceConfig.compensation_note }}

diff --git a/frontend/src/features/seller/views/SellerListingCreateView.css b/frontend/src/features/seller/views/SellerListingCreateView.css index 14c329b3..606f8f6a 100644 --- a/frontend/src/features/seller/views/SellerListingCreateView.css +++ b/frontend/src/features/seller/views/SellerListingCreateView.css @@ -1354,6 +1354,7 @@ font-size: 12px; font-weight: 600; line-height: 1.7; + white-space: pre-line; } @media (max-width: 1120px) { diff --git a/frontend/src/features/seller/views/SellerListingCreateView.vue b/frontend/src/features/seller/views/SellerListingCreateView.vue index 03cf99c9..db20b9b3 100644 --- a/frontend/src/features/seller/views/SellerListingCreateView.vue +++ b/frontend/src/features/seller/views/SellerListingCreateView.vue @@ -812,7 +812,7 @@ function selectDailyLoss(value: string | number) {

- 普通赔付覆盖封禁、追回、洗号等情况;无忧租号保险在此基础上增加账号市场价值保障。 + {{ priceConfig.compensation_note }}