收敛前端金额表单命名

This commit is contained in:
yml
2026-06-09 20:59:50 +08:00
parent 60324765c5
commit 9cc959afc4
19 changed files with 103 additions and 232 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
import { apiClient } from '@/shared/api/client' import { apiClient } from '@/shared/api/client'
import type { ApiResponse } from '@/shared/types/types' import type { ApiResponse } from '@/shared/types/types'
import type { RealnameStatusValue, RiskStatus, UserStatus } from '@/types/status' import type { RealnameStatusValue, RiskStatus, UserStatus } from '@/shared/types/status'
export interface AuthUser { export interface AuthUser {
id: number id: number
+1 -1
View File
@@ -1,6 +1,6 @@
import { apiClient } from '@/shared/api/client' import { apiClient } from '@/shared/api/client'
import type { ApiResponse } from '@/shared/types/types' import type { ApiResponse } from '@/shared/types/types'
import type { RealnameStatusValue } from '@/types/status' import type { RealnameStatusValue } from '@/shared/types/status'
export interface RealnameStatus { export interface RealnameStatus {
status: RealnameStatusValue status: RealnameStatusValue
@@ -1,7 +1,7 @@
import { apiClient } from '@/shared/api/client' import { apiClient } from '@/shared/api/client'
import type { ApiResponse, PaginatedResult } from '@/shared/types/types' import type { ApiResponse, PaginatedResult } from '@/shared/types/types'
import type { DisputeStatus } from '@/types/status' import type { DisputeStatus } from '@/shared/types/status'
export interface Dispute { export interface Dispute {
id: number id: number
+6 -6
View File
@@ -111,10 +111,10 @@ export interface PostRentalNotice {
export interface SubmitCheckoutPayload { export interface SubmitCheckoutPayload {
content: string content: string
consumable_amount?: number consumableAmountYuan?: number
coin_consumed_m: number coin_consumed_m: number
other_amount?: number otherAmountYuan?: number
deposit_deduct_amount?: number depositDeductAmountYuan?: number
evidence_urls: string[] evidence_urls: string[]
reason?: string reason?: string
} }
@@ -145,10 +145,10 @@ export interface RefundStatus {
function toCheckoutRequest(payload: SubmitCheckoutPayload): SubmitCheckoutRequest { function toCheckoutRequest(payload: SubmitCheckoutPayload): SubmitCheckoutRequest {
return { return {
content: payload.content, content: payload.content,
consumable_amount_cent: yuanToCent(payload.consumable_amount), consumable_amount_cent: yuanToCent(payload.consumableAmountYuan),
coin_consumed_m: payload.coin_consumed_m, coin_consumed_m: payload.coin_consumed_m,
other_amount_cent: yuanToCent(payload.other_amount), other_amount_cent: yuanToCent(payload.otherAmountYuan),
deposit_deduct_amount_cent: yuanToCent(payload.deposit_deduct_amount), deposit_deduct_amount_cent: yuanToCent(payload.depositDeductAmountYuan),
evidence_urls: payload.evidence_urls, evidence_urls: payload.evidence_urls,
reason: payload.reason, reason: payload.reason,
} }
@@ -78,16 +78,16 @@ export function calculateCheckoutTotal(
} }
export function calculateCounterTotal(counterForm: { export function calculateCounterTotal(counterForm: {
consumable_amount: number consumableAmountYuan: number
coin_consumed_m: number coin_consumed_m: number
other_amount: number otherAmountYuan: number
deposit_deduct_amount: number depositDeductAmountYuan: number
}): number { }): number {
return roundMoney( return roundMoney(
counterForm.consumable_amount + counterForm.consumableAmountYuan +
counterForm.coin_consumed_m + counterForm.coin_consumed_m +
counterForm.other_amount + counterForm.otherAmountYuan +
counterForm.deposit_deduct_amount counterForm.depositDeductAmountYuan
) )
} }
@@ -127,10 +127,10 @@ export function hydrateCounterFormFromOrder(order: Order | null) {
try { try {
const info = JSON.parse(order.counter_info) as Record<string, any> const info = JSON.parse(order.counter_info) as Record<string, any>
return { return {
consumable_amount: readNumber(info.consumable_amount), consumableAmountYuan: readNumber(info.consumableAmountYuan),
coin_consumed_m: readNumber(info.coin_consumed_m), coin_consumed_m: readNumber(info.coin_consumed_m),
other_amount: readNumber(info.other_amount), otherAmountYuan: readNumber(info.otherAmountYuan),
deposit_deduct_amount: readNumber(info.deposit_deduct_amount), depositDeductAmountYuan: readNumber(info.depositDeductAmountYuan),
reason: String(info.reason || ''), reason: String(info.reason || ''),
evidenceText: String(info.evidence || ''), evidenceText: String(info.evidence || ''),
} }
@@ -4,17 +4,17 @@ import type { Order } from '../api/orders'
export interface CheckoutForm { export interface CheckoutForm {
content: string content: string
consumable_amount: number consumableAmountYuan: number
coin_consumed_m: number coin_consumed_m: number
other_amount: number otherAmountYuan: number
evidenceText: string evidenceText: string
} }
export interface CounterForm { export interface CounterForm {
consumable_amount: number consumableAmountYuan: number
coin_consumed_m: number coin_consumed_m: number
other_amount: number otherAmountYuan: number
deposit_deduct_amount: number depositDeductAmountYuan: number
reason: string reason: string
evidenceText: string evidenceText: string
} }
@@ -32,17 +32,17 @@ export function useSettlement(order: Ref<Order | null>) {
const checkoutForm = ref<CheckoutForm>({ const checkoutForm = ref<CheckoutForm>({
content: '', content: '',
consumable_amount: 0, consumableAmountYuan: 0,
coin_consumed_m: 0, coin_consumed_m: 0,
other_amount: 0, otherAmountYuan: 0,
evidenceText: '', evidenceText: '',
}) })
const counterForm = ref<CounterForm>({ const counterForm = ref<CounterForm>({
consumable_amount: 0, consumableAmountYuan: 0,
coin_consumed_m: 0, coin_consumed_m: 0,
other_amount: 0, otherAmountYuan: 0,
deposit_deduct_amount: 0, depositDeductAmountYuan: 0,
reason: '', reason: '',
evidenceText: '', evidenceText: '',
}) })
@@ -58,9 +58,9 @@ export function useSettlement(order: Ref<Order | null>) {
try { try {
await submitCheckout(order.value.id, { await submitCheckout(order.value.id, {
content: checkoutForm.value.content.trim(), content: checkoutForm.value.content.trim(),
consumable_amount: checkoutForm.value.consumable_amount, consumableAmountYuan: checkoutForm.value.consumableAmountYuan,
coin_consumed_m: checkoutForm.value.coin_consumed_m, coin_consumed_m: checkoutForm.value.coin_consumed_m,
other_amount: checkoutForm.value.other_amount, otherAmountYuan: checkoutForm.value.otherAmountYuan,
evidence_urls: linesToList(checkoutForm.value.evidenceText), evidence_urls: linesToList(checkoutForm.value.evidenceText),
}) })
onSuccess?.() onSuccess?.()
@@ -95,10 +95,10 @@ export function useSettlement(order: Ref<Order | null>) {
const reasonText = counterForm.value.reason.trim() const reasonText = counterForm.value.reason.trim()
await counterCheckout(order.value.id, { await counterCheckout(order.value.id, {
content: reasonText, content: reasonText,
consumable_amount: counterForm.value.consumable_amount, consumableAmountYuan: counterForm.value.consumableAmountYuan,
coin_consumed_m: counterForm.value.coin_consumed_m, coin_consumed_m: counterForm.value.coin_consumed_m,
other_amount: counterForm.value.other_amount, otherAmountYuan: counterForm.value.otherAmountYuan,
deposit_deduct_amount: counterForm.value.deposit_deduct_amount, depositDeductAmountYuan: counterForm.value.depositDeductAmountYuan,
reason: reasonText, reason: reasonText,
evidence_urls: linesToList(counterForm.value.evidenceText), evidence_urls: linesToList(counterForm.value.evidenceText),
}) })
@@ -119,10 +119,10 @@ export function useSettlement(order: Ref<Order | null>) {
const reasonText = reason.trim() const reasonText = reason.trim()
await counterCheckout(order.value.id, { await counterCheckout(order.value.id, {
content: reasonText, content: reasonText,
consumable_amount: 0, consumableAmountYuan: 0,
coin_consumed_m: 0, coin_consumed_m: 0,
other_amount: 0, otherAmountYuan: 0,
deposit_deduct_amount: 0, depositDeductAmountYuan: 0,
reason: reasonText, reason: reasonText,
evidence_urls: [], evidence_urls: [],
}) })
@@ -51,17 +51,17 @@ const listingCode = computed(() =>
const handoffContent = ref('') const handoffContent = ref('')
const checkoutForm = ref({ const checkoutForm = ref({
content: '', content: '',
consumable_amount: 0, consumableAmountYuan: 0,
coin_consumed_m: 0, coin_consumed_m: 0,
other_amount: 0, otherAmountYuan: 0,
evidenceText: '', evidenceText: '',
}) })
const resourceUsage = ref<Record<string, number>>({}) const resourceUsage = ref<Record<string, number>>({})
const counterForm = ref({ const counterForm = ref({
consumable_amount: 0, consumableAmountYuan: 0,
coin_consumed_m: 0, coin_consumed_m: 0,
other_amount: 0, otherAmountYuan: 0,
deposit_deduct_amount: 0, depositDeductAmountYuan: 0,
reason: '', reason: '',
evidenceText: '', evidenceText: '',
}) })
@@ -231,19 +231,19 @@ async function handleSubmitCheckout() {
returning.value = true returning.value = true
try { try {
const consumableAmount = resourceChargeAmount.value const consumableAmount = resourceChargeAmount.value
checkoutForm.value.consumable_amount = consumableAmount checkoutForm.value.consumableAmountYuan = consumableAmount
await submitCheckout(order.value.id, { await submitCheckout(order.value.id, {
content: checkoutContentWithSummary(), content: checkoutContentWithSummary(),
consumable_amount: consumableAmount, consumableAmountYuan: consumableAmount,
coin_consumed_m: checkoutForm.value.coin_consumed_m, coin_consumed_m: checkoutForm.value.coin_consumed_m,
other_amount: checkoutForm.value.other_amount, otherAmountYuan: checkoutForm.value.otherAmountYuan,
evidence_urls: linesToList(checkoutForm.value.evidenceText), evidence_urls: linesToList(checkoutForm.value.evidenceText),
}) })
checkoutForm.value = { checkoutForm.value = {
content: '', content: '',
consumable_amount: 0, consumableAmountYuan: 0,
coin_consumed_m: 0, coin_consumed_m: 0,
other_amount: 0, otherAmountYuan: 0,
evidenceText: '', evidenceText: '',
} }
resourceUsage.value = {} resourceUsage.value = {}
@@ -283,10 +283,10 @@ async function handleCounterCheckout() {
const reasonText = counterForm.value.reason.trim() const reasonText = counterForm.value.reason.trim()
await counterCheckout(order.value.id, { await counterCheckout(order.value.id, {
content: reasonText, content: reasonText,
consumable_amount: counterForm.value.consumable_amount, consumableAmountYuan: counterForm.value.consumableAmountYuan,
coin_consumed_m: counterForm.value.coin_consumed_m, coin_consumed_m: counterForm.value.coin_consumed_m,
other_amount: counterForm.value.other_amount, otherAmountYuan: counterForm.value.otherAmountYuan,
deposit_deduct_amount: counterForm.value.deposit_deduct_amount, depositDeductAmountYuan: counterForm.value.depositDeductAmountYuan,
reason: reasonText, reason: reasonText,
evidence_urls: linesToList(counterForm.value.evidenceText), evidence_urls: linesToList(counterForm.value.evidenceText),
}) })
@@ -592,10 +592,10 @@ function isRecord(value: unknown): value is Record<string, unknown> {
function hydrateCounterForm() { function hydrateCounterForm() {
if (!order.value?.checkout) return if (!order.value?.checkout) return
const checkout = order.value.checkout const checkout = order.value.checkout
counterForm.value.consumable_amount = amountYuan(checkout.consumable_amount_cent) counterForm.value.consumableAmountYuan = amountYuan(checkout.consumable_amount_cent)
counterForm.value.coin_consumed_m = checkout.coin_consumed_m counterForm.value.coin_consumed_m = checkout.coin_consumed_m
counterForm.value.other_amount = amountYuan(checkout.other_amount_cent) counterForm.value.otherAmountYuan = amountYuan(checkout.other_amount_cent)
counterForm.value.deposit_deduct_amount = amountYuan(checkout.deposit_deduct_amount_cent) counterForm.value.depositDeductAmountYuan = amountYuan(checkout.deposit_deduct_amount_cent)
} }
function linesToList(value: string) { function linesToList(value: string) {
@@ -882,7 +882,7 @@ async function copyListingCode() {
<template #input> <template #input>
<div class="coin-input-wrap"> <div class="coin-input-wrap">
<input <input
v-model.number="checkoutForm.other_amount" v-model.number="checkoutForm.otherAmountYuan"
type="number" type="number"
placeholder="不含上方额外物资" placeholder="不含上方额外物资"
class="custom-inline-input" class="custom-inline-input"
@@ -901,7 +901,7 @@ async function copyListingCode() {
</div> </div>
<div> <div>
<span>其他押金赔付</span> <span>其他押金赔付</span>
<strong>¥{{ money(checkoutForm.other_amount) }}</strong> <strong>¥{{ money(checkoutForm.otherAmountYuan) }}</strong>
<em>从押金赔付扣除</em> <em>从押金赔付扣除</em>
</div> </div>
</div> </div>
@@ -1090,7 +1090,7 @@ async function copyListingCode() {
<van-field label="额外消耗品已用"> <van-field label="额外消耗品已用">
<template #input> <template #input>
<input <input
v-model.number="counterForm.consumable_amount" v-model.number="counterForm.consumableAmountYuan"
type="number" type="number"
class="custom-inline-input" class="custom-inline-input"
/> />
@@ -1108,7 +1108,7 @@ async function copyListingCode() {
<van-field label="其他押金扣款"> <van-field label="其他押金扣款">
<template #input> <template #input>
<input <input
v-model.number="counterForm.other_amount" v-model.number="counterForm.otherAmountYuan"
type="number" type="number"
class="custom-inline-input" class="custom-inline-input"
/> />
@@ -1117,7 +1117,7 @@ async function copyListingCode() {
<van-field label="押金赔付扣除" required> <van-field label="押金赔付扣除" required>
<template #input> <template #input>
<input <input
v-model.number="counterForm.deposit_deduct_amount" v-model.number="counterForm.depositDeductAmountYuan"
type="number" type="number"
class="custom-inline-input" class="custom-inline-input"
/> />
@@ -60,17 +60,17 @@ const checkingPayment = ref(false)
let paymentPollingTimer: number | undefined let paymentPollingTimer: number | undefined
const checkoutForm = ref({ const checkoutForm = ref({
content: '', content: '',
consumable_amount: 0, consumableAmountYuan: 0,
coin_consumed_m: 0, coin_consumed_m: 0,
other_amount: 0, otherAmountYuan: 0,
evidenceText: '', evidenceText: '',
}) })
const resourceUsage = ref<Record<string, number>>({}) const resourceUsage = ref<Record<string, number>>({})
const counterForm = ref({ const counterForm = ref({
consumable_amount: 0, consumableAmountYuan: 0,
coin_consumed_m: 0, coin_consumed_m: 0,
other_amount: 0, otherAmountYuan: 0,
deposit_deduct_amount: 0, depositDeductAmountYuan: 0,
reason: '', reason: '',
evidenceText: '', evidenceText: '',
}) })
@@ -321,19 +321,19 @@ async function handleSubmitCheckout() {
returning.value = true returning.value = true
try { try {
const consumableAmount = resourceChargeAmount.value const consumableAmount = resourceChargeAmount.value
checkoutForm.value.consumable_amount = consumableAmount checkoutForm.value.consumableAmountYuan = consumableAmount
await submitCheckout(order.value.id, { await submitCheckout(order.value.id, {
content: checkoutContentWithSummary(), content: checkoutContentWithSummary(),
consumable_amount: consumableAmount, consumableAmountYuan: consumableAmount,
coin_consumed_m: checkoutForm.value.coin_consumed_m, coin_consumed_m: checkoutForm.value.coin_consumed_m,
other_amount: checkoutForm.value.other_amount, otherAmountYuan: checkoutForm.value.otherAmountYuan,
evidence_urls: linesToList(checkoutForm.value.evidenceText), evidence_urls: linesToList(checkoutForm.value.evidenceText),
}) })
checkoutForm.value = { checkoutForm.value = {
content: '', content: '',
consumable_amount: 0, consumableAmountYuan: 0,
coin_consumed_m: 0, coin_consumed_m: 0,
other_amount: 0, otherAmountYuan: 0,
evidenceText: '', evidenceText: '',
} }
resourceUsage.value = {} resourceUsage.value = {}
@@ -367,10 +367,10 @@ async function handleCounterCheckout() {
const reasonText = counterForm.value.reason.trim() const reasonText = counterForm.value.reason.trim()
await counterCheckout(order.value.id, { await counterCheckout(order.value.id, {
content: reasonText, content: reasonText,
consumable_amount: counterForm.value.consumable_amount, consumableAmountYuan: counterForm.value.consumableAmountYuan,
coin_consumed_m: counterForm.value.coin_consumed_m, coin_consumed_m: counterForm.value.coin_consumed_m,
other_amount: counterForm.value.other_amount, otherAmountYuan: counterForm.value.otherAmountYuan,
deposit_deduct_amount: counterForm.value.deposit_deduct_amount, depositDeductAmountYuan: counterForm.value.depositDeductAmountYuan,
reason: reasonText, reason: reasonText,
evidence_urls: linesToList(counterForm.value.evidenceText), evidence_urls: linesToList(counterForm.value.evidenceText),
}) })
@@ -641,10 +641,10 @@ function isRecord(value: unknown): value is Record<string, unknown> {
function hydrateCounterForm() { function hydrateCounterForm() {
if (!order.value?.checkout) return if (!order.value?.checkout) return
const checkout = order.value.checkout const checkout = order.value.checkout
counterForm.value.consumable_amount = amountYuan(checkout.consumable_amount_cent) counterForm.value.consumableAmountYuan = amountYuan(checkout.consumable_amount_cent)
counterForm.value.coin_consumed_m = checkout.coin_consumed_m counterForm.value.coin_consumed_m = checkout.coin_consumed_m
counterForm.value.other_amount = amountYuan(checkout.other_amount_cent) counterForm.value.otherAmountYuan = amountYuan(checkout.other_amount_cent)
counterForm.value.deposit_deduct_amount = amountYuan(checkout.deposit_deduct_amount_cent) counterForm.value.depositDeductAmountYuan = amountYuan(checkout.deposit_deduct_amount_cent)
} }
function linesToList(value: string) { function linesToList(value: string) {
@@ -911,7 +911,7 @@ async function copyListingCode() {
</el-form-item> </el-form-item>
<el-form-item label="其他押金赔付(元)"> <el-form-item label="其他押金赔付(元)">
<el-input-number <el-input-number
v-model="checkoutForm.other_amount" v-model="checkoutForm.otherAmountYuan"
class="full-control" class="full-control"
:min="0" :min="0"
:precision="0" :precision="0"
@@ -930,7 +930,7 @@ async function copyListingCode() {
</div> </div>
<div> <div>
<span>其他押金赔付</span> <span>其他押金赔付</span>
<strong>¥{{ money(checkoutForm.other_amount) }}</strong> <strong>¥{{ money(checkoutForm.otherAmountYuan) }}</strong>
<em>作为押金赔付扣除和额外消耗品分开展示</em> <em>作为押金赔付扣除和额外消耗品分开展示</em>
</div> </div>
</div> </div>
@@ -1022,7 +1022,7 @@ async function copyListingCode() {
<el-form class="form-grid" label-position="top"> <el-form class="form-grid" label-position="top">
<el-form-item label="额外消耗品已用金额"> <el-form-item label="额外消耗品已用金额">
<el-input-number <el-input-number
v-model="counterForm.consumable_amount" v-model="counterForm.consumableAmountYuan"
class="full-control" class="full-control"
:min="0" :min="0"
:precision="0" :precision="0"
@@ -1040,7 +1040,7 @@ async function copyListingCode() {
</el-form-item> </el-form-item>
<el-form-item label="其他押金扣款(元)"> <el-form-item label="其他押金扣款(元)">
<el-input-number <el-input-number
v-model="counterForm.other_amount" v-model="counterForm.otherAmountYuan"
class="full-control" class="full-control"
:min="0" :min="0"
:precision="0" :precision="0"
@@ -1049,7 +1049,7 @@ async function copyListingCode() {
</el-form-item> </el-form-item>
<el-form-item label="押金扣除(元)"> <el-form-item label="押金扣除(元)">
<el-input-number <el-input-number
v-model="counterForm.deposit_deduct_amount" v-model="counterForm.depositDeductAmountYuan"
class="full-control" class="full-control"
:min="0" :min="0"
:max="amountYuan(order.deposit_amount_cent)" :max="amountYuan(order.deposit_amount_cent)"
@@ -1,5 +1,5 @@
import type { ChargeMode, QuantityKey, ScreenshotKey } from '@/features/listings/api/listingOptions' import type { ChargeMode, QuantityKey, ScreenshotKey } from '@/features/listings/api/listingOptions'
import type { PublishDraft, PublishForm } from '@/types/publish' import type { PublishDraft, PublishForm } from '@/shared/types/publish'
export function defaultPublishForm(): PublishForm { export function defaultPublishForm(): PublishForm {
return { return {
@@ -19,7 +19,7 @@ export function defaultPublishForm(): PublishForm {
online_end: '', online_end: '',
ban_record: '', ban_record: '',
common_regions: [], common_regions: [],
deposit_amount: '', depositAmountYuan: '',
remark: '', remark: '',
} }
} }
@@ -25,7 +25,7 @@ import {
removePublishDraft, removePublishDraft,
writePublishDraft, writePublishDraft,
} from '@/features/seller/composables/usePublishDraft' } from '@/features/seller/composables/usePublishDraft'
import type { PublishForm } from '@/types/publish' import type { PublishForm } from '@/shared/types/publish'
import { yuanToCent } from '@/shared/utils/money' import { yuanToCent } from '@/shared/utils/money'
import { import {
commonOnlineTimes, commonOnlineTimes,
@@ -505,15 +505,15 @@ export function usePublishForm(options: UsePublishFormOptions) {
function syncRecommendedDeposit() { function syncRecommendedDeposit() {
const recommended = pricing.recommendedDepositAmount.value const recommended = pricing.recommendedDepositAmount.value
if (recommended <= 0) return if (recommended <= 0) return
const current = Number(form.deposit_amount) const current = Number(form.depositAmountYuan)
if (form.deposit_amount === '' || !Number.isFinite(current) || current < recommended) { if (form.depositAmountYuan === '' || !Number.isFinite(current) || current < recommended) {
form.deposit_amount = recommended form.depositAmountYuan = recommended
} }
} }
function useRecommendedDeposit() { function useRecommendedDeposit() {
if (pricing.recommendedDepositAmount.value > 0) { if (pricing.recommendedDepositAmount.value > 0) {
form.deposit_amount = pricing.recommendedDepositAmount.value form.depositAmountYuan = pricing.recommendedDepositAmount.value
} }
} }
@@ -574,7 +574,7 @@ export function usePublishForm(options: UsePublishFormOptions) {
asset_summary: buildAssetSummary(), asset_summary: buildAssetSummary(),
screenshot_urls: pricing.screenshotUrls.value, screenshot_urls: pricing.screenshotUrls.value,
price_cent: yuanToCent(pricing.calculatedFinalPrice.value), price_cent: yuanToCent(pricing.calculatedFinalPrice.value),
deposit_amount_cent: yuanToCent(Number(form.deposit_amount)), deposit_amount_cent: yuanToCent(Number(form.depositAmountYuan)),
agreed_virtual_asset_sale: virtualAssetSaleAgreementChecked.value, agreed_virtual_asset_sale: virtualAssetSaleAgreementChecked.value,
agreed_seller_agreement: sellerAgreementChecked.value, agreed_seller_agreement: sellerAgreementChecked.value,
}) })
@@ -624,17 +624,17 @@ export function usePublishForm(options: UsePublishFormOptions) {
} }
} }
if (pricing.banRecordOptions.value.length && !form.ban_record) return '请选择封禁记录' if (pricing.banRecordOptions.value.length && !form.ban_record) return '请选择封禁记录'
if (form.deposit_amount === '' || Number(form.deposit_amount) < 0) return '请填写押金' if (form.depositAmountYuan === '' || Number(form.depositAmountYuan) < 0) return '请填写押金'
if (!Number.isFinite(Number(form.deposit_amount))) return '押金格式不正确' if (!Number.isFinite(Number(form.depositAmountYuan))) return '押金格式不正确'
if ( if (
pricing.recommendedDepositAmount.value > 0 && pricing.recommendedDepositAmount.value > 0 &&
Number(form.deposit_amount) < pricing.recommendedDepositAmount.value Number(form.depositAmountYuan) < pricing.recommendedDepositAmount.value
) { ) {
return `押金不能低于智能推荐 ¥${pricing.recommendedDepositAmount.value}` return `押金不能低于智能推荐 ¥${pricing.recommendedDepositAmount.value}`
} }
if ( if (
pricing.calculatedConsumablePrice.value > 0 && pricing.calculatedConsumablePrice.value > 0 &&
Number(form.deposit_amount) <= pricing.calculatedConsumablePrice.value Number(form.depositAmountYuan) <= pricing.calculatedConsumablePrice.value
) { ) {
return `押金必须大于额外消耗品总价值 ¥${pricing.calculatedConsumablePrice.value}` return `押金必须大于额外消耗品总价值 ¥${pricing.calculatedConsumablePrice.value}`
} }
@@ -531,7 +531,7 @@ function selectRadio<T extends string>(value: T, setter: (value: T) => void) {
<div class="form-section"> <div class="form-section">
<h2 class="section-title">押金与价格</h2> <h2 class="section-title">押金与价格</h2>
<van-field <van-field
v-model="form.deposit_amount" v-model="form.depositAmountYuan"
label="押金" label="押金"
type="number" type="number"
required required
@@ -484,7 +484,7 @@ function selectDailyLoss(value: string | number) {
> >
<div class="deposit-control"> <div class="deposit-control">
<el-input-number <el-input-number
v-model="form.deposit_amount" v-model="form.depositAmountYuan"
:min="0" :min="0"
:controls="false" :controls="false"
:placeholder="priceConfig.deposit_placeholder" :placeholder="priceConfig.deposit_placeholder"
@@ -631,7 +631,9 @@ function selectDailyLoss(value: string | number) {
<div> <div>
<span>押金价格</span> <span>押金价格</span>
<strong>{{ <strong>{{
form.deposit_amount === '' ? '--' : `¥${formatMoney(Number(form.deposit_amount))}` form.depositAmountYuan === ''
? '--'
: `¥${formatMoney(Number(form.depositAmountYuan))}`
}}</strong> }}</strong>
</div> </div>
</div> </div>
@@ -7,7 +7,7 @@ import type {
QuantityKey, QuantityKey,
ScreenshotKey, ScreenshotKey,
} from '@/features/listings/api/listingOptions' } from '@/features/listings/api/listingOptions'
import type { PublishForm } from '@/types/publish' import type { PublishForm } from '@/shared/types/publish'
import { import {
buildDepositBreakdownItems, buildDepositBreakdownItems,
calculateConsumablePrice, calculateConsumablePrice,
+1 -1
View File
@@ -17,7 +17,7 @@ export type PublishForm = {
online_end: string online_end: string
ban_record: string ban_record: string
common_regions: string[] common_regions: string[]
deposit_amount: number | '' depositAmountYuan: number | ''
remark: string remark: string
} }
-7
View File
@@ -48,13 +48,6 @@ export function centToDisplayYuan(cent: number | undefined | null): number {
return roundMoney(centToYuan(cent)) return roundMoney(centToYuan(cent))
} }
/**
* @deprecated 使用 centToDisplayYuan。保留导出避免旧导入立刻失效。
*/
export function centToJiao(cent: number | undefined | null): number {
return centToDisplayYuan(cent)
}
/** /**
* 格式化分为角字符串(保留1位小数) * 格式化分为角字符串(保留1位小数)
* @example formatCent(12345) -> "123.5" * @example formatCent(12345) -> "123.5"
+5 -1
View File
@@ -7,7 +7,11 @@ import type {
PublishRatioConfig, PublishRatioConfig,
PublishSalePriceConfig, PublishSalePriceConfig,
} from '@/features/listings/api/listingOptions' } from '@/features/listings/api/listingOptions'
import type { DepositBreakdownItem, PublishForm, PublishPlatformPricing } from '@/types/publish' import type {
DepositBreakdownItem,
PublishForm,
PublishPlatformPricing,
} from '@/shared/types/publish'
export const dailyLossOptions = [10, 20, 30, 40, 50] export const dailyLossOptions = [10, 20, 30, 40, 50]
export const commonOnlineTimes = [ export const commonOnlineTimes = [
+1 -1
View File
@@ -11,7 +11,7 @@ import type {
SettlementStatus, SettlementStatus,
UserStatus, UserStatus,
WalletStatus, WalletStatus,
} from '@/types/status' } from '@/shared/types/status'
const listingStatusMap: Record<ListingStatus, string> = { const listingStatusMap: Record<ListingStatus, string> = {
draft: '草稿', draft: '草稿',
-44
View File
@@ -1,44 +0,0 @@
import type { ChargeMode, QuantityKey, ScreenshotKey } from '@/features/listings/api/listingOptions'
export type PublishForm = {
server_region: string
face_owner: string
haf_coin_amount: number | ''
rank_level: string
secret_kd: string
fire_level: number | ''
daily_loss_m: number | ''
accelerated_sale_ratio: number | ''
season_insurance: string
stamina_level: string
load_level: string
login_method: string
online_start: string
online_end: string
ban_record: string
common_regions: string[]
deposit_amount: number | ''
remark: string
}
export interface PublishDraft {
form: PublishForm
quantityValues: Record<QuantityKey, number>
quantityModes: Record<QuantityKey, ChargeMode>
screenshotFiles: Record<ScreenshotKey, string[]>
selectedSkins: string[]
}
export interface DepositBreakdownItem {
label: string
amount: number
count: number
}
export interface PublishPlatformPricing {
buyerCoinBasePrice: number
buyerTotalPrice: number
buyerRatio: number
platformMarkupAmount: number
ruleType: 'fixed_markup' | 'ratio_subtract' | 'none' | string
}
-84
View File
@@ -1,84 +0,0 @@
export const listingStatuses = ['draft', 'published', 'rented', 'offline', 'abnormal'] as const
export type ListingStatus = (typeof listingStatuses)[number]
export const listingReviewStatuses = ['none', 'pending', 'approved', 'rejected'] as const
export type ListingReviewStatus = (typeof listingReviewStatuses)[number]
export const orderStatuses = [
'pending_confirm',
'pending_payment',
'pending_handoff',
'renting',
'overdue',
'pending_return_confirm',
'pending_checkout_confirm',
'pending_checkout_accept',
'checkout_disputing',
'completed',
'cancelled',
'closed',
'disputing',
'abnormal',
] as const
export type OrderStatus = (typeof orderStatuses)[number]
export const handoffStatuses = [
'pending_owner',
'pending_renter_confirm',
'received',
'pending_owner_return_confirm',
'pending_owner_checkout',
'pending_renter_checkout',
'checkout_disputed',
'returned',
'cancelled',
'owner_timeout',
'renter_confirm_timeout',
'return_overdue',
'owner_return_confirm_timeout',
'owner_checkout_confirm_timeout',
'admin_closed',
'admin_abnormal',
'arbitrated',
] as const
export type HandoffStatus = (typeof handoffStatuses)[number]
export const settlementStatuses = [
'unsettled',
'pending',
'frozen',
'settled',
'refunded',
'cancelled',
'closed',
'disputed',
'arbitrated',
] as const
export type SettlementStatus = (typeof settlementStatuses)[number]
export const realnameStatuses = [
'unknown',
'unverified',
'pending',
'verified',
'rejected',
] as const
export type RealnameStatusValue = (typeof realnameStatuses)[number]
export const userStatuses = ['active', 'frozen', 'disabled'] as const
export type UserStatus = (typeof userStatuses)[number]
export const riskStatuses = ['normal', 'watch', 'restricted', 'blocked'] as const
export type RiskStatus = (typeof riskStatuses)[number]
export const disputeStatuses = ['open', 'processing', 'resolved', 'closed'] as const
export type DisputeStatus = (typeof disputeStatuses)[number]
export const walletStatuses = ['active', 'frozen', 'disabled'] as const
export type WalletStatus = (typeof walletStatuses)[number]
export const ledgerDirections = ['in', 'out', 'freeze', 'unfreeze'] as const
export type LedgerDirection = (typeof ledgerDirections)[number]
export const balanceTypes = ['available', 'frozen'] as const
export type BalanceType = (typeof balanceTypes)[number]