修复结账金额和后台类型

This commit is contained in:
yml
2026-05-27 10:28:05 +08:00
parent 6fb5de204c
commit c54e3936ab
7 changed files with 311 additions and 48 deletions
+2 -1
View File
@@ -3,6 +3,7 @@ import { ref, type Ref } from 'vue'
interface AdminQueryOptions<T> {
fetchFn: () => Promise<T>
immediate?: boolean
initialData?: T
}
interface AdminQueryResult<T> {
@@ -15,7 +16,7 @@ interface AdminQueryResult<T> {
export function useAdminQuery<T>(options: AdminQueryOptions<T>): AdminQueryResult<T> {
const loading = ref(false)
const error = ref<string | null>(null)
const data = ref<T>() as Ref<T>
const data = ref<T>(options.initialData as T) as Ref<T>
async function load() {
loading.value = true
@@ -550,7 +550,7 @@ function linesToList(value: string) {
<div class="checkout-resource-panel panel-action">
<div class="checkout-resource-head">
<strong>额外消耗品</strong>
<span>金额合计¥{{ money(resourceChargeAmount) }}</span>
<span>已用金额¥{{ money(resourceChargeAmount) }}</span>
</div>
<el-empty v-if="checkoutResources.length === 0" description="订单快照中暂无额外消耗品" />
<div v-for="item in checkoutResources" v-else :key="item.key" class="checkout-resource-row">
@@ -573,7 +573,7 @@ function linesToList(value: string) {
<el-input-number v-model="checkoutForm.coin_consumed_m" class="full-control" :min="0" :max="snapshotHafCoinM" :precision="2" controls-position="right" />
<span class="field-hint">订单快照 {{ quantity(snapshotHafCoinM) }}M预计剩余 {{ quantity(remainingHafCoinM) }}M</span>
</el-form-item>
<el-form-item label="其他扣款(元)">
<el-form-item label="其他押金扣款(元)">
<el-input-number v-model="checkoutForm.other_amount" class="full-control" :min="0" :precision="0" controls-position="right" />
</el-form-item>
</el-form>
@@ -589,10 +589,10 @@ function linesToList(value: string) {
<div v-if="order && order.checkout && ['pending_checkout_confirm', 'pending_checkout_accept'].includes(order.status)" class="order-panel">
<h2>结账明细</h2>
<p>{{ orderAmountLabel }}¥{{ money(order.checkout.display_amount) }}押金¥{{ money(order.checkout.deposit_amount) }}</p>
<p>额外消耗品金额¥{{ money(order.checkout.consumable_amount) }}押金扣除¥{{ money(order.checkout.deposit_deduct_amount) }}</p>
<p v-if="isRenter">退还租客¥{{ money(order.checkout.renter_refund_amount) }}</p>
<p v-if="isOwner">号主收入¥{{ money(order.checkout.owner_income_amount) }}</p>
<p>实际结算租金¥{{ money(order.checkout.display_amount) }}预收押金¥{{ money(order.checkout.deposit_amount) }}</p>
<p>额外消耗品已用¥{{ money(order.checkout.consumable_amount) }}押金赔付扣除¥{{ money(order.checkout.deposit_deduct_amount) }}</p>
<p v-if="isRenter">退还租客未使用租金 + 剩余押金¥{{ money(order.checkout.renter_refund_amount) }}</p>
<p v-if="isOwner">号主最终收入租金 + 押金赔付¥{{ money(order.checkout.owner_income_amount) }}</p>
<p v-if="order.checkout.content">说明{{ order.checkout.content }}</p>
<p v-if="order.checkout.owner_adjustment_reason">修正原因{{ order.checkout.owner_adjustment_reason }}</p>
</div>
@@ -604,13 +604,13 @@ function linesToList(value: string) {
<h2 class="panel-action">修改结账</h2>
<el-form class="form-grid" label-position="top">
<el-form-item label="额外消耗品金额(已含租金)">
<el-form-item label="额外消耗品已用金额">
<el-input-number v-model="counterForm.consumable_amount" class="full-control" :min="0" :precision="0" controls-position="right" />
</el-form-item>
<el-form-item label="消耗哈夫币(M">
<el-input-number v-model="counterForm.coin_consumed_m" class="full-control" :min="0" :precision="2" controls-position="right" />
</el-form-item>
<el-form-item label="其他扣款(元)">
<el-form-item label="其他押金扣款(元)">
<el-input-number v-model="counterForm.other_amount" class="full-control" :min="0" :precision="0" controls-position="right" />
</el-form-item>
<el-form-item label="押金扣除(元)">
@@ -17,8 +17,9 @@ const filters = reactive<AdminListingQuery>({
limit: 200,
})
const { loading, data: listings, load: loadListings } = useAdminTable<Listing>({
const { loading, data: listings, load: loadListings } = useAdminTable<Listing[]>({
fetchFn: () => fetchAdminListings(filters),
initialData: [],
})
const publishedCount = computed(() => listings.value.filter((item) => item.status === 'published').length)
+2 -1
View File
@@ -8,8 +8,9 @@ import { formatDateTime } from '@/utils/time'
const status = ref('')
const { loading, data: orders, load: loadOrders } = useAdminTable<Order>({
const { loading, data: orders, load: loadOrders } = useAdminTable<Order[]>({
fetchFn: fetchAdminOrders,
initialData: [],
})
const filteredOrders = computed(() => {
@@ -792,12 +792,12 @@ function getStatusTagType(status: string) {
<section v-if="order.checkout && ['pending_checkout_confirm', 'pending_checkout_accept'].includes(order.status)" class="card-section">
<h3 class="section-title">结账结算账单</h3>
<van-cell-group inset :border="false">
<van-cell :title="orderAmountLabel" :value="`¥${money(order.checkout.display_amount)}`" />
<van-cell title="实际结算租金" :value="`¥${money(order.checkout.display_amount)}`" />
<van-cell title="押金总额" :value="`¥${money(order.checkout.deposit_amount)}`" />
<van-cell title="额外消耗品金额" :value="`¥${money(order.checkout.consumable_amount)}`" />
<van-cell title="押金扣除" :value="`¥${money(order.checkout.deposit_deduct_amount)}`" value-class="red-text" />
<van-cell v-if="isRenter" title="退还租客押金" :value="`¥${money(order.checkout.renter_refund_amount)}`" value-class="green-text" />
<van-cell v-if="isOwner" title="号主最终收" :value="`¥${money(order.checkout.owner_income_amount)}`" value-class="green-text" />
<van-cell title="额外消耗品已用" :value="`¥${money(order.checkout.consumable_amount)}`" />
<van-cell title="押金赔付扣除" :value="`¥${money(order.checkout.deposit_deduct_amount)}`" value-class="red-text" />
<van-cell v-if="isRenter" title="退还租客" :value="`¥${money(order.checkout.renter_refund_amount)}`" value-class="green-text" />
<van-cell v-if="isOwner" title="号主最终收" :value="`¥${money(order.checkout.owner_income_amount)}`" value-class="green-text" />
<van-cell v-if="order.checkout.content" title="结账备注" :label="order.checkout.content" />
<van-cell v-if="order.checkout.owner_adjustment_reason" title="号主修正原因" :label="order.checkout.owner_adjustment_reason" />
</van-cell-group>
@@ -911,9 +911,9 @@ function getStatusTagType(status: string) {
<button class="popup-close" @click="showCounterPopup = false"></button>
</header>
<div class="popup-body">
<p class="form-hint-info">在此调整扣减租客押金或各项损耗的金额提案将交由租客二次确认</p>
<p class="form-hint-info">在此调整实际使用的租金项目和押金赔付金额提案将交由租客二次确认</p>
<van-cell-group :border="false">
<van-field label="消耗损耗款">
<van-field label="额外消耗品已用">
<template #input>
<input v-model.number="counterForm.consumable_amount" type="number" class="custom-inline-input" />
</template>
@@ -923,12 +923,12 @@ function getStatusTagType(status: string) {
<input v-model.number="counterForm.coin_consumed_m" type="number" class="custom-inline-input" />
</template>
</van-field>
<van-field label="其他损失扣款">
<van-field label="其他押金扣款">
<template #input>
<input v-model.number="counterForm.other_amount" type="number" class="custom-inline-input" />
</template>
</van-field>
<van-field label="扣除押金总额" required>
<van-field label="押金赔付扣除" required>
<template #input>
<input v-model.number="counterForm.deposit_deduct_amount" type="number" class="custom-inline-input" />
</template>