feat(quality-owner): 增加优质号主、极品专区与无忧租号保险
- 支持保证金余额支付、在线支付开通及后台手动设置审计 - 新增极品专区发布权限、赔付方案与保险结算费率快照 - 优化首页、商品卡和个人中心的优质号主身份展示
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user