feat(distribution): 分站可下调收号比例且不超过主站上限
让分销站能按自身能力下调收号比例扩大利润,同时把主站回收比例作为硬边界,避免分站把比例加得比主站更高。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -34,6 +34,7 @@ import {
|
||||
import type { PublishForm } from '@/shared/types/publish'
|
||||
import { yuanToCent } from '@/shared/utils/money'
|
||||
import { dailyLossOptions, formatNumber, roundRatio } from '@/shared/utils/pricing'
|
||||
import { useDistributionSiteStore } from '@/stores/distributionSite'
|
||||
|
||||
const draftSaveDelay = 400
|
||||
const multiScreenshotLimit = 3
|
||||
@@ -54,6 +55,9 @@ interface UsePublishFormOptions {
|
||||
export function usePublishForm(options: UsePublishFormOptions) {
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const siteStore = useDistributionSiteStore()
|
||||
const isDistribution = computed(() => siteStore.isDistribution)
|
||||
const receiveRatioDelta = computed(() => Number(siteStore.receiveRatioDelta || 0))
|
||||
const loading = ref(false)
|
||||
const uploading = ref(false)
|
||||
const suppressDraftSave = ref(false)
|
||||
@@ -89,6 +93,8 @@ export function usePublishForm(options: UsePublishFormOptions) {
|
||||
quantityModes,
|
||||
screenshotFiles,
|
||||
selectedSkins,
|
||||
isDistribution,
|
||||
receiveRatioDelta,
|
||||
})
|
||||
|
||||
// ========== 上号方式互斥 ==========
|
||||
@@ -911,6 +917,7 @@ export function usePublishForm(options: UsePublishFormOptions) {
|
||||
|
||||
return {
|
||||
...pricing,
|
||||
isDistribution,
|
||||
dailyLossOptions,
|
||||
formatNumber,
|
||||
router,
|
||||
|
||||
@@ -692,6 +692,14 @@
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.ratio-inherit-hint {
|
||||
margin: 0;
|
||||
color: #1677ff;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.ratio-mode-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
|
||||
@@ -49,6 +49,7 @@ const {
|
||||
priceConfig,
|
||||
fireLevelPlaceholder,
|
||||
dailyLossMAmount,
|
||||
isDistribution,
|
||||
calculatedDefaultSaleRatio,
|
||||
maxAcceleratedSaleRatio,
|
||||
calculatedCoinBasePrice,
|
||||
@@ -694,11 +695,16 @@ const screenshotGuides: Record<string, string> = {
|
||||
</p>
|
||||
<div class="ratio-panel">
|
||||
<div class="ratio-reference">
|
||||
<span>参考比例</span>
|
||||
<span>{{ isDistribution ? '主站收号上限' : '参考比例' }}</span>
|
||||
<strong>{{ calculatedDefaultSaleRatioText }}</strong>
|
||||
</div>
|
||||
<p class="ratio-range">{{ saleRatioRangeText }},比例越高出租速度越快,自行选择。</p>
|
||||
<div class="ratio-mode-grid">
|
||||
<p v-if="isDistribution" class="ratio-inherit-hint">
|
||||
本站可下调收号比例换取更高利润,但不能高于主站比例。当前按站点配置计算。
|
||||
</p>
|
||||
<p class="ratio-range">
|
||||
{{ saleRatioRangeText }}{{ isDistribution ? '。' : ',比例越高出租速度越快,自行选择。' }}
|
||||
</p>
|
||||
<div v-if="!isDistribution" class="ratio-mode-grid">
|
||||
<button
|
||||
type="button"
|
||||
class="ratio-mode-btn"
|
||||
|
||||
@@ -675,6 +675,12 @@
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.ratio-inherit-hint {
|
||||
margin: 8px 0 0 !important;
|
||||
color: #1677ff !important;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.ratio-reference {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -67,6 +67,7 @@ const {
|
||||
recommendedDepositAmount,
|
||||
depositBreakdownItems,
|
||||
publishTitle,
|
||||
isDistribution,
|
||||
hasAcceleratedSaleRatioInput,
|
||||
isQuantityItemDisabled,
|
||||
handleSaveDraft,
|
||||
@@ -557,11 +558,14 @@ function selectDailyLoss(value: string | number) {
|
||||
|
||||
<div class="ratio-panel">
|
||||
<div class="ratio-reference">
|
||||
<span>参考比例</span>
|
||||
<span>{{ isDistribution ? '主站收号上限' : '参考比例' }}</span>
|
||||
<strong>{{ calculatedDefaultSaleRatioText }}</strong>
|
||||
</div>
|
||||
<p>{{ saleRatioRangeText }},比例越高出租速度越快。</p>
|
||||
<div class="ratio-mode-grid">
|
||||
<p v-if="isDistribution" class="ratio-inherit-hint">
|
||||
本站可下调收号比例换取更高利润,但不能高于主站比例。当前按站点配置计算。
|
||||
</p>
|
||||
<p>{{ saleRatioRangeText }}{{ isDistribution ? '。' : ',比例越高出租速度越快。' }}</p>
|
||||
<div v-if="!isDistribution" class="ratio-mode-grid">
|
||||
<button
|
||||
type="button"
|
||||
class="ratio-mode-btn"
|
||||
|
||||
Reference in New Issue
Block a user