feat(quality-owner): 增加优质号主、极品专区与无忧租号保险

- 支持保证金余额支付、在线支付开通及后台手动设置审计
- 新增极品专区发布权限、赔付方案与保险结算费率快照
- 优化首页、商品卡和个人中心的优质号主身份展示
This commit is contained in:
yml2213
2026-11-04 15:04:35 +08:00
parent 812e95e7d1
commit 98174c0e33
90 changed files with 3478 additions and 64 deletions
@@ -25,6 +25,8 @@ export function defaultPublishForm(): PublishForm {
ban_record: '',
common_regions: [],
depositAmountYuan: '',
is_premium: false,
compensation_plan: 'normal',
remark: '',
}
}
@@ -101,6 +103,8 @@ function normalizeDraftForm(value: unknown): PublishForm {
if (next.haf_coin_amount === 0) next.haf_coin_amount = ''
if (String(next.secret_kd).trim() === '0') next.secret_kd = ''
if (next.fire_level === 0) next.fire_level = ''
next.is_premium = next.is_premium === true
if (next.compensation_plan !== 'insurance') next.compensation_plan = 'normal'
return next
}
@@ -22,6 +22,10 @@ import {
updateListing,
type Listing,
} from '@/features/listings/api/listings'
import {
fetchQualityOwnerStatus,
type QualityOwnerStatus,
} from '@/features/quality-owner/api/qualityOwner'
import { usePricingCalculator } from '@/shared/composables/usePricingCalculator'
import {
buildPublishDraft,
@@ -66,6 +70,7 @@ export function usePublishForm(options: UsePublishFormOptions) {
const publishOptions = ref<ListingPublishOptions>(emptyListingPublishOptions)
const salePriceConfig = ref<PublishSalePriceConfig>(emptyListingSalePriceConfig)
const publishAgreements = ref<ListingPublishAgreements>(emptyListingPublishAgreements)
const qualityOwnerStatus = ref<QualityOwnerStatus | null>(null)
const virtualAssetSaleAgreementChecked = ref(false)
const sellerAgreementChecked = ref(false)
const passwordAndDeviceConfirmed = ref(false)
@@ -86,6 +91,13 @@ export function usePublishForm(options: UsePublishFormOptions) {
const showBanRecordRiskHint = false
const unlockDemulanEnabled = computed(() => publishOptions.value.unlock_demulan_enabled)
const nextSeasonPassEnabled = computed(() => publishOptions.value.next_season_pass_enabled)
const isQualityOwner = computed(() => qualityOwnerStatus.value?.active === true)
const insuranceFeeBps = computed(() =>
form.is_premium && isQualityOwner.value
? Number(qualityOwnerStatus.value?.premium_insurance_fee_bps || 400)
: Number(qualityOwnerStatus.value?.insurance_fee_bps || 800)
)
const insuranceFeePercent = computed(() => insuranceFeeBps.value / 100)
const pricing = usePricingCalculator({
form,
@@ -184,14 +196,17 @@ export function usePublishForm(options: UsePublishFormOptions) {
async function loadPublishOptions() {
try {
const [nextPublishOptions, nextSalePriceConfig, nextPublishAgreements] = await Promise.all([
fetchListingPublishOptions(),
fetchListingSalePriceConfig(),
fetchListingPublishAgreements(),
])
const [nextPublishOptions, nextSalePriceConfig, nextPublishAgreements, nextQualityOwner] =
await Promise.all([
fetchListingPublishOptions(),
fetchListingSalePriceConfig(),
fetchListingPublishAgreements(),
fetchQualityOwnerStatus().catch(() => null),
])
publishOptions.value = nextPublishOptions
salePriceConfig.value = nextSalePriceConfig
publishAgreements.value = nextPublishAgreements
qualityOwnerStatus.value = nextQualityOwner
// 默认数字都是0
for (const item of nextPublishOptions.quantity_items) {
@@ -203,6 +218,7 @@ export function usePublishForm(options: UsePublishFormOptions) {
publishOptions.value = emptyListingPublishOptions
salePriceConfig.value = emptyListingSalePriceConfig
publishAgreements.value = emptyListingPublishAgreements
qualityOwnerStatus.value = null
}
}
@@ -326,6 +342,8 @@ export function usePublishForm(options: UsePublishFormOptions) {
ban_record: stringValue(summary.ban_record),
common_regions: stringArray(summary.common_regions),
depositAmountYuan: listing.deposit_amount_cent > 0 ? listing.deposit_amount_cent / 100 : '',
is_premium: listing.is_premium === true,
compensation_plan: listing.compensation_plan === 'insurance' ? 'insurance' : 'normal',
remark: listing.description || stringValue(summary.remark),
})
@@ -662,6 +680,8 @@ export function usePublishForm(options: UsePublishFormOptions) {
screenshot_urls: pricing.screenshotUrls.value,
price_cent: yuanToCent(pricing.calculatedFinalPrice.value),
deposit_amount_cent: yuanToCent(Number(form.depositAmountYuan)),
is_premium: form.is_premium,
compensation_plan: form.compensation_plan,
agreed_virtual_asset_sale: virtualAssetSaleAgreementChecked.value,
agreed_seller_agreement: sellerAgreementChecked.value,
}
@@ -758,6 +778,7 @@ export function usePublishForm(options: UsePublishFormOptions) {
if (!pricing.calculatedFinalPrice.value) return '请完善币数、保险、体力和负重后再发布'
if (!Number.isFinite(pricing.calculatedFinalPrice.value))
return '发布价格计算异常,请检查填写内容'
if (form.is_premium && !isQualityOwner.value) return '仅优质号主可以发布到极品专区'
if (!virtualAssetSaleAgreementChecked.value || !sellerAgreementChecked.value) {
return '请先阅读并勾选两份发布协议'
}
@@ -932,6 +953,10 @@ export function usePublishForm(options: UsePublishFormOptions) {
loading,
uploading,
publishAgreements,
qualityOwnerStatus,
isQualityOwner,
insuranceFeeBps,
insuranceFeePercent,
virtualAssetSaleAgreementChecked,
sellerAgreementChecked,
passwordAndDeviceConfirmed,
@@ -870,6 +870,100 @@
line-height: 1.5;
}
.premium-coverage-card {
display: grid;
gap: 12px;
margin: 4px 0 12px;
padding: 14px;
border: 1px solid #e5e7eb;
border-radius: 8px;
background: #f8fafc;
}
.premium-zone-row,
.coverage-heading {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.premium-zone-row strong,
.coverage-heading strong {
display: block;
color: #20242a;
font-size: 14px;
font-weight: 800;
}
.premium-zone-row span,
.coverage-heading span {
display: block;
margin-top: 3px;
color: #858c96;
font-size: 11px;
line-height: 1.45;
}
.quality-owner-link {
justify-self: start;
padding: 0;
border: none;
background: transparent;
color: #7c3aed;
font-size: 12px;
font-weight: 800;
}
.coverage-option-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px;
}
.coverage-option {
display: grid;
align-content: start;
gap: 5px;
min-height: 82px;
padding: 11px;
border: 1px solid #e5e7eb;
border-radius: 8px;
background: #fff;
color: #20242a;
text-align: left;
}
.coverage-option strong {
font-size: 13px;
font-weight: 800;
}
.coverage-option span {
color: #858c96;
font-size: 10px;
line-height: 1.45;
}
.coverage-option em {
color: #7c3aed;
font-size: 10px;
font-style: normal;
font-weight: 800;
}
.coverage-option.active {
border-color: #7c3aed;
background: #faf5ff;
}
.coverage-note {
margin: 0;
color: #858c96;
font-size: 10px;
line-height: 1.55;
}
.publish-agreement-card {
display: grid;
gap: 10px;
@@ -26,6 +26,9 @@ const {
sellerAgreementChecked,
passwordAndDeviceConfirmed,
canPublishAfterAgreements,
isQualityOwner,
qualityOwnerStatus,
insuranceFeePercent,
showBanRecordRiskHint,
unlockDemulanEnabled,
nextSeasonPassEnabled,
@@ -821,6 +824,61 @@ const screenshotGuides: Record<string, string> = {
</div>
<p class="price-breakdown-hint">卖家价格 = 纯币基础价 + 额外消耗品。</p>
<div class="premium-coverage-card">
<div class="premium-zone-row">
<div>
<strong>极品专区</strong>
<span>
{{
isQualityOwner
? '优质号主专享曝光专区'
: `保证金 ¥${formatMoney(
(qualityOwnerStatus?.required_deposit_cent || 20000) / 100
)}`
}}
</span>
</div>
<van-switch v-model="form.is_premium" :disabled="!isQualityOwner" size="22px" />
</div>
<button
v-if="!isQualityOwner"
type="button"
class="quality-owner-link"
@click="router.push('/m/profile')"
>
前往个人中心开通优质号主
</button>
<div class="coverage-heading">
<strong>选择赔付方案</strong>
<span>服务费按实际到手租金结算扣除</span>
</div>
<div class="coverage-option-grid">
<button
type="button"
class="coverage-option"
:class="{ active: form.compensation_plan === 'normal' }"
@click="form.compensation_plan = 'normal'"
>
<strong>普通赔付</strong>
<span>租金 + 押金规则赔付</span>
</button>
<button
type="button"
class="coverage-option"
:class="{ active: form.compensation_plan === 'insurance' }"
@click="form.compensation_plan = 'insurance'"
>
<strong>无忧租号保险</strong>
<span>服务费 {{ insuranceFeePercent.toFixed(1) }}%</span>
<em v-if="isQualityOwner && form.is_premium">极品专享费率</em>
</button>
</div>
<p class="coverage-note">
无忧租号保险在普通赔付基础上额外保障账号市场价值;选择后按号主实际到手租金扣除服务费。
</p>
</div>
<van-field
v-model="form.remark"
label="备注"
@@ -1012,6 +1012,108 @@
background-color: var(--color-orange-dark);
}
.premium-coverage-panel {
display: grid;
gap: 14px;
margin-top: 18px;
padding: 18px;
border: 1px solid #e5e7eb;
border-radius: 10px;
background: #f8fafc;
}
.premium-zone-row,
.coverage-heading {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.premium-zone-row > div,
.coverage-heading {
min-width: 0;
}
.premium-zone-row strong,
.coverage-heading strong {
display: block;
color: #1f2937;
font-size: 15px;
font-weight: 900;
}
.premium-zone-row span,
.coverage-heading span {
color: #7b8492;
font-size: 12px;
font-weight: 600;
line-height: 1.5;
}
.quality-owner-link {
justify-self: start;
padding: 0;
border: none;
background: transparent;
color: #7c3aed;
font-size: 12px;
font-weight: 800;
cursor: pointer;
}
.coverage-option-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
}
.coverage-option {
display: grid;
gap: 6px;
min-height: 92px;
padding: 16px 18px;
border: 1px solid #e5e7eb;
border-radius: 9px;
background: #fff;
color: #1f2937;
text-align: left;
cursor: pointer;
}
.coverage-option strong {
font-size: 16px;
font-weight: 900;
}
.coverage-option span {
color: #6b7280;
font-size: 12px;
font-weight: 600;
line-height: 1.5;
}
.coverage-option em {
color: #7c3aed;
font-size: 11px;
font-style: normal;
font-weight: 800;
}
.coverage-option.active {
border-color: #7c3aed;
background: #faf5ff;
box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.08);
}
.coverage-note {
margin: 0;
color: #7b8492;
font-size: 12px;
font-weight: 600;
line-height: 1.7;
}
@media (max-width: 1120px) {
.publish-layout {
grid-template-columns: 1fr;
@@ -1094,4 +1196,8 @@
.region-grid {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.coverage-option-grid {
grid-template-columns: 1fr;
}
}
@@ -22,7 +22,11 @@ const {
formatNumber,
loading,
uploading,
router,
publishAgreements,
isQualityOwner,
qualityOwnerStatus,
insuranceFeePercent,
virtualAssetSaleAgreementChecked,
sellerAgreementChecked,
passwordAndDeviceConfirmed,
@@ -653,6 +657,65 @@ function selectDailyLoss(value: string | number) {
</div>
</div>
<div class="premium-coverage-panel">
<div class="premium-zone-row">
<div>
<strong>极品专区</strong>
<span>
{{
isQualityOwner
? '优质号主专享曝光专区'
: `缴纳 ¥${formatMoney(
(qualityOwnerStatus?.required_deposit_cent || 20000) / 100
)} 保证金后可开通优质号主`
}}
</span>
</div>
<el-switch
v-model="form.is_premium"
:disabled="!isQualityOwner"
active-text="发布到极品专区"
/>
</div>
<button
v-if="!isQualityOwner"
type="button"
class="quality-owner-link"
@click="router.push('/profile')"
>
前往个人中心开通优质号主
</button>
<div class="coverage-heading">
<strong>选择赔付方案</strong>
<span>服务费按号主实际到手租金计算,结算时自动扣除</span>
</div>
<div class="coverage-option-grid">
<button
type="button"
class="coverage-option"
:class="{ active: form.compensation_plan === 'normal' }"
@click="form.compensation_plan = 'normal'"
>
<strong>普通赔付</strong>
<span>按平台规则赔付租金与押金</span>
</button>
<button
type="button"
class="coverage-option"
:class="{ active: form.compensation_plan === 'insurance' }"
@click="form.compensation_plan = 'insurance'"
>
<strong>无忧租号保险</strong>
<span> 服务费 {{ insuranceFeePercent.toFixed(1) }}%,额外保障账号市场价值 </span>
<em v-if="isQualityOwner && form.is_premium">极品专区专享费率</em>
</button>
</div>
<p class="coverage-note">
普通赔付:账号封禁、追回、洗号等情况最高赔付全额租金与押金。无忧租号保险:在普通赔付基础上,额外按账号市场价值赔付;选择后按实际到手租金扣除服务费。
</p>
</div>
<label class="input-block remark">
<span>备注</span>
<el-input