按实际纯币金额计算租客优惠与积分

This commit is contained in:
yml2213
2026-07-27 10:45:41 +08:00
parent 99e8eb28af
commit 8af7333969
30 changed files with 983 additions and 154 deletions
@@ -174,6 +174,13 @@ export function useOrderActions(options: UseOrderActionsOptions) {
const orderRentDisplayAmount = computed(() =>
order.value ? orderRentAmount(order.value, session.userId) : 0
)
const renterDiscountDisplayCent = computed(() => {
if (!order.value) return 0
if (order.value.status === 'completed') {
return Number(order.value.actual_pure_coin_discount_cent || 0)
}
return Number(order.value.rent_discount_amount_cent || 0)
})
const ownerIncomeDisplayAmount = computed(() =>
order.value ? ownerActualIncome(order.value, session.userId) : null
)
@@ -206,9 +213,7 @@ export function useOrderActions(options: UseOrderActionsOptions) {
(isRenter.value && order.value.status === 'pending_checkout_accept')
)
})
const checkoutShortfallCent = computed(() =>
Number(order.value?.checkout?.shortfall_cent || 0)
)
const checkoutShortfallCent = computed(() => Number(order.value?.checkout?.shortfall_cent || 0))
const checkoutOvershootCent = computed(() =>
Number(order.value?.checkout?.overshoot_amount_cent || 0)
)
@@ -410,6 +415,9 @@ export function useOrderActions(options: UseOrderActionsOptions) {
await confirmCheckout(order.value.id)
options.notifySuccess('结账已确认,订单完成')
await loadOrder()
if (isRenter.value) {
await session.loadMe().catch(() => undefined)
}
} catch (error) {
options.notifyError(readError(error, '确认结账失败'))
} finally {
@@ -469,6 +477,9 @@ export function useOrderActions(options: UseOrderActionsOptions) {
await acceptCheckout(order.value.id)
options.notifySuccess('已确认结账,订单完成')
await loadOrder()
if (isRenter.value) {
await session.loadMe().catch(() => undefined)
}
} catch (error) {
options.notifyError(readError(error, '确认结账失败'))
} finally {
@@ -676,6 +687,7 @@ export function useOrderActions(options: UseOrderActionsOptions) {
listingCode,
orderAmountLabel,
orderRentDisplayAmount,
renterDiscountDisplayCent,
ownerIncomeDisplayAmount,
ownerIncomeLabel,
canOpenDispute,