[Snow Team] frontend-fixer-2: auto-commit work

This commit is contained in:
yml
2026-06-09 17:04:40 +08:00
parent f5b38ff772
commit 42a54b474a
16 changed files with 376 additions and 130 deletions
@@ -6,7 +6,7 @@ import { showToast, showDialog } from 'vant'
import { fetchOrderChat } from '@/features/chats/api/chats'
import { createDispute } from '@/features/disputes/api/disputes'
import { uploadFile } from '@/shared/api/files'
import { formatMoney } from '@/shared/utils/money'
import { centToYuan, formatMoney } from '@/shared/utils/money'
import {
acceptCheckout,
cancelOrder,
@@ -506,7 +506,9 @@ function checkoutContentWithSummary() {
}
if (Number(checkoutForm.value.coin_consumed_m || 0) > 0) {
lines.push(
`哈夫币消耗:${quantity(Number(checkoutForm.value.coin_consumed_m))}M,预计剩余${quantity(remainingHafCoinM.value)}M`
`哈夫币消耗:${quantity(Number(checkoutForm.value.coin_consumed_m))}M,预计剩余${quantity(
remainingHafCoinM.value
)}M`
)
}
if (lines.length === 0) {
@@ -553,17 +555,26 @@ function formatHandoffRecordType(type: string) {
return typeMap[type] || type
}
function amountYuan(cent: unknown, legacyYuan?: unknown) {
if (cent !== undefined && cent !== null) return centToYuan(readNumber(cent))
return readNumber(legacyYuan)
}
function orderRentAmount(item: Order) {
if (item.owner_id === session.userId)
return Number(item.owner_rent_amount ?? item.display_amount ?? 0)
if (item.renter_id === session.userId) return Number(item.rent_amount ?? item.display_amount ?? 0)
return Number(item.display_amount ?? 0)
return amountYuan(item.owner_rent_amount_cent, item.owner_rent_amount ?? item.display_amount)
if (item.renter_id === session.userId)
return amountYuan(item.rent_amount_cent, item.rent_amount ?? item.display_amount)
return amountYuan(item.display_amount_cent, item.display_amount)
}
function ownerActualIncome(item: Order) {
if (item.owner_id !== session.userId) return null
const value = item.checkout?.owner_income_amount
return typeof value === 'number' ? value : null
const value = item.checkout?.owner_income_amount_cent
if (typeof value === 'number') return centToYuan(value)
return typeof item.checkout?.owner_income_amount === 'number'
? item.checkout.owner_income_amount
: null
}
function quantity(value: unknown) {
@@ -583,10 +594,16 @@ function isRecord(value: unknown): value is Record<string, unknown> {
function hydrateCounterForm() {
if (!order.value?.checkout) return
const checkout = order.value.checkout
counterForm.value.consumable_amount = checkout.consumable_amount
counterForm.value.consumable_amount = amountYuan(
checkout.consumable_amount_cent,
checkout.consumable_amount
)
counterForm.value.coin_consumed_m = checkout.coin_consumed_m
counterForm.value.other_amount = checkout.other_amount
counterForm.value.deposit_deduct_amount = checkout.deposit_deduct_amount
counterForm.value.other_amount = amountYuan(checkout.other_amount_cent, checkout.other_amount)
counterForm.value.deposit_deduct_amount = amountYuan(
checkout.deposit_deduct_amount_cent,
checkout.deposit_deduct_amount
)
}
function linesToList(value: string) {
@@ -676,9 +693,15 @@ async function copyListingCode() {
</div>
<div class="meta-item">
<span class="meta-label">押金</span>
<strong class="meta-value">¥{{ money(order.deposit_amount) }}</strong>
<span v-if="order.deposit_waived_amount > 0" class="meta-note"
>已免押 ¥{{ money(order.deposit_waived_amount) }}</span
<strong class="meta-value"
>¥{{ money(amountYuan(order.deposit_amount_cent, order.deposit_amount)) }}</strong
>
<span
v-if="amountYuan(order.deposit_waived_amount_cent, order.deposit_waived_amount) > 0"
class="meta-note"
>已免押 ¥{{
money(amountYuan(order.deposit_waived_amount_cent, order.deposit_waived_amount))
}}</span
>
</div>
<div class="meta-item">
@@ -929,30 +952,58 @@ async function copyListingCode() {
>
<h3 class="section-title">结账结算账单</h3>
<van-cell-group inset :border="false">
<van-cell title="实际结算租金" :value="`¥${money(order.checkout.display_amount)}`" />
<van-cell
title="实际结算租金"
:value="`¥${money(
amountYuan(order.checkout.display_amount_cent, order.checkout.display_amount)
)}`"
/>
<van-cell
title="押金总额"
:label="
order.deposit_waived_amount > 0 ? `已免押 ¥${money(order.deposit_waived_amount)}` : ''
amountYuan(order.deposit_waived_amount_cent, order.deposit_waived_amount) > 0
? `已免押 ¥${money(
amountYuan(order.deposit_waived_amount_cent, order.deposit_waived_amount)
)}`
: ''
"
:value="`¥${money(order.checkout.deposit_amount)}`"
:value="`¥${money(
amountYuan(order.checkout.deposit_amount_cent, order.checkout.deposit_amount)
)}`"
/>
<van-cell
title="额外消耗品已用"
:value="`¥${money(
amountYuan(order.checkout.consumable_amount_cent, order.checkout.consumable_amount)
)}`"
/>
<van-cell title="额外消耗品已用" :value="`¥${money(order.checkout.consumable_amount)}`" />
<van-cell
title="押金赔付扣除"
:value="`¥${money(order.checkout.deposit_deduct_amount)}`"
:value="`¥${money(
amountYuan(order.checkout.deposit_deduct_amount_cent, order.checkout.deposit_deduct_amount)
)}`"
value-class="red-text"
/>
<van-cell
v-if="isRenter"
title="退还租客"
:value="`¥${money(order.checkout.renter_refund_amount)}`"
:value="`¥${money(
amountYuan(
order.checkout.renter_refund_amount_cent,
order.checkout.renter_refund_amount
)
)}`"
value-class="green-text"
/>
<van-cell
v-if="isOwner"
title="号主最终收入"
:value="`¥${money(order.checkout.owner_income_amount)}`"
:value="`¥${money(
amountYuan(
order.checkout.owner_income_amount_cent,
order.checkout.owner_income_amount
)
)}`"
value-class="green-text"
/>
<van-cell