feat(listing): 增加赔付方案说明配置
This commit is contained in:
@@ -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"`
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ func DefaultPublishOptions() PublishOptionsDTO {
|
||||
4. 额外保障选项
|
||||
|
||||
若您在设置足额押金后仍感不放心,可选择购买平台提供的《全额包赔服务》。一旦发生封号损失,将获得账号市场价值的全额赔付,让您的出租过程后顾无忧。`,
|
||||
CompensationNote: "普通赔付方案如下:账号在租期内或祖期外出现封禁,追回、洗号等情况,最高可获赔全款相金+押金\n\n无忧保险赔付方案:按账号市场价值进行赔付(可参照螃蟹,盼之等主流交易平台)。注:选择此方案,需额外抽取订单佣金的8.0%作为服务费:押金须达到推荐押金方可购买。",
|
||||
PricePlaceholder: "填写币数、保险、体力和负重后自动计算;发布总价=纯币基础价+额外消耗品",
|
||||
RatioDescription: "1:xx 表示 1 元人民币(RMB)等价兑换 xx 万哈夫币",
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -344,6 +344,14 @@ async function handleSave() {
|
||||
placeholder="支持换行,发布页点击或悬停押金旁的说明图标时展示"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="赔付方案说明">
|
||||
<el-input
|
||||
v-model="publishOptionsDraft.price_config.compensation_note"
|
||||
type="textarea"
|
||||
:rows="6"
|
||||
placeholder="支持换行,发布页选择赔付方案后展示"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="价格提示">
|
||||
<el-input
|
||||
v-model="publishOptionsDraft.price_config.price_placeholder"
|
||||
|
||||
@@ -24,4 +24,19 @@ describe('mergeListingPublishOptions', () => {
|
||||
|
||||
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('自定义赔付方案说明')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -1180,6 +1180,7 @@
|
||||
color: #858c96;
|
||||
font-size: 10px;
|
||||
line-height: 1.55;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
.publish-agreement-card {
|
||||
|
||||
@@ -987,7 +987,7 @@ const screenshotGuides: Record<string, string> = {
|
||||
</div>
|
||||
</div>
|
||||
<p class="coverage-note">
|
||||
无忧租号保险在普通赔付基础上增加账号市场价值保障,服务费按实际到手租金扣除。
|
||||
{{ priceConfig.compensation_note }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1354,6 +1354,7 @@
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
line-height: 1.7;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
@media (max-width: 1120px) {
|
||||
|
||||
@@ -812,7 +812,7 @@ function selectDailyLoss(value: string | number) {
|
||||
</div>
|
||||
</div>
|
||||
<p class="coverage-note">
|
||||
普通赔付覆盖封禁、追回、洗号等情况;无忧租号保险在此基础上增加账号市场价值保障。
|
||||
{{ priceConfig.compensation_note }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user