优化订单结算金额展示和钱包流水号
This commit is contained in:
@@ -73,7 +73,10 @@ const showRejectPopup = ref(false);
|
||||
|
||||
const isOwner = computed(() => order.value?.owner_id === session.userId);
|
||||
const isRenter = computed(() => order.value?.renter_id === session.userId);
|
||||
const orderAmountLabel = computed(() => (isOwner.value ? "我的租金" : "订单金额"));
|
||||
const orderAmountLabel = computed(() => (isOwner.value ? "预计租金" : "支付租金"));
|
||||
const orderRentDisplayAmount = computed(() => (order.value ? orderRentAmount(order.value) : 0));
|
||||
const ownerIncomeDisplayAmount = computed(() => (order.value ? ownerActualIncome(order.value) : null));
|
||||
const ownerIncomeLabel = computed(() => (order.value?.status === "completed" ? "实际到手" : "结账预计到手"));
|
||||
const canOpenDispute = computed(() => {
|
||||
if (!order.value || (!isOwner.value && !isRenter.value)) return false;
|
||||
return !["completed", "cancelled", "closed", "disputing", "checkout_disputing", "abnormal"].includes(order.value.status);
|
||||
@@ -510,6 +513,18 @@ function money(value: unknown) {
|
||||
return `${roundMoney(readNumber(value))}`;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
function quantity(value: unknown) {
|
||||
const rounded = roundQuantity(readNumber(value));
|
||||
return Number.isInteger(rounded) ? `${rounded}` : rounded.toFixed(2);
|
||||
@@ -593,7 +608,11 @@ function getStatusTagType(status: string) {
|
||||
<div class="order-meta-grid">
|
||||
<div class="meta-item">
|
||||
<span class="meta-label">{{ orderAmountLabel }}</span>
|
||||
<strong class="meta-value accent">¥{{ money(order.display_amount) }}</strong>
|
||||
<strong class="meta-value accent">¥{{ money(orderRentDisplayAmount) }}</strong>
|
||||
</div>
|
||||
<div v-if="isOwner && ownerIncomeDisplayAmount !== null" class="meta-item">
|
||||
<span class="meta-label">{{ ownerIncomeLabel }}</span>
|
||||
<strong class="meta-value income">¥{{ money(ownerIncomeDisplayAmount) }}</strong>
|
||||
</div>
|
||||
<div class="meta-item">
|
||||
<span class="meta-label">押金</span>
|
||||
@@ -1224,6 +1243,11 @@ function getStatusTagType(status: string) {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.meta-value.income {
|
||||
color: #16a34a;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.action-card {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user