fix(order): complete checkout details and deposit warning
This commit is contained in:
@@ -367,11 +367,17 @@ export function useOrderActions(options: UseOrderActionsOptions) {
|
||||
|
||||
async function handleSubmitCheckout() {
|
||||
if (!order.value) return
|
||||
const depositDeductAmountYuan = Number(checkoutForm.value.otherAmountYuan || 0)
|
||||
if (needsConfirm('submitCheckout')) {
|
||||
const depositWarning =
|
||||
depositDeductAmountYuan > 0
|
||||
? `\n\n注意:押金赔付扣除 ¥${depositDeductAmountYuan.toFixed(2)} 将直接从预收押金中扣除,并计入号主赔付。`
|
||||
: ''
|
||||
const ok = await options.confirm({
|
||||
title: '确认提交结账',
|
||||
message:
|
||||
'结账数据会影响租金、押金赔付和双方结算金额。请确认哈夫币消耗、额外消耗品、押金赔付和证据链接已认真核对,提交后将发送给号主确认。',
|
||||
'结账数据会影响租金、押金赔付和双方结算金额。请确认哈夫币消耗、额外消耗品、押金赔付和证据链接已认真核对,提交后将发送给号主确认。' +
|
||||
depositWarning,
|
||||
})
|
||||
if (!ok) return
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { Checkout, Order } from '../api/orders'
|
||||
export interface CheckoutFormSnapshot {
|
||||
content: string
|
||||
coin_consumed_m: number
|
||||
otherAmountYuan?: number
|
||||
}
|
||||
|
||||
export interface CounterFormSnapshot {
|
||||
@@ -37,9 +38,7 @@ export function useOrderCheckoutSnapshot(options: {
|
||||
const snapshotHafCoinM = computed(() => getSnapshotHafCoinM(options.order.value))
|
||||
// 允许为负:表示打超(实际消耗 > 发布量)
|
||||
const remainingHafCoinM = computed(() =>
|
||||
roundQuantity(
|
||||
snapshotHafCoinM.value - Number(options.checkoutForm.value.coin_consumed_m || 0)
|
||||
)
|
||||
roundQuantity(snapshotHafCoinM.value - Number(options.checkoutForm.value.coin_consumed_m || 0))
|
||||
)
|
||||
|
||||
function hydrateResourceUsage() {
|
||||
@@ -61,6 +60,7 @@ export function useOrderCheckoutSnapshot(options: {
|
||||
return buildCheckoutContentWithSummary({
|
||||
content: options.checkoutForm.value.content,
|
||||
coinConsumedM: options.checkoutForm.value.coin_consumed_m,
|
||||
depositDeductAmountYuan: options.checkoutForm.value.otherAmountYuan,
|
||||
checkoutResources: checkoutResources.value,
|
||||
resourceUsage: options.resourceUsage.value,
|
||||
remainingHafCoinM: remainingHafCoinM.value,
|
||||
@@ -146,6 +146,7 @@ export function calculateResourceChargeAmount(
|
||||
export function buildCheckoutContentWithSummary(options: {
|
||||
content: string
|
||||
coinConsumedM: number
|
||||
depositDeductAmountYuan?: number
|
||||
checkoutResources: CheckoutResource[]
|
||||
resourceUsage: Record<string, number>
|
||||
remainingHafCoinM: number
|
||||
@@ -170,13 +171,19 @@ export function buildCheckoutContentWithSummary(options: {
|
||||
if (Number(options.coinConsumedM || 0) > 0) {
|
||||
const remain = Number(options.remainingHafCoinM || 0)
|
||||
if (remain >= 0) {
|
||||
lines.push(`哈夫币实际消耗:${quantity(options.coinConsumedM)}M,预计剩余${quantity(remain)}M`)
|
||||
lines.push(
|
||||
`哈夫币实际消耗:${quantity(options.coinConsumedM)}M,预计剩余${quantity(remain)}M`
|
||||
)
|
||||
} else {
|
||||
lines.push(
|
||||
`哈夫币实际消耗:${quantity(options.coinConsumedM)}M,打超${quantity(-remain)}M(超额按比例从押金结算)`
|
||||
)
|
||||
}
|
||||
}
|
||||
const depositDeductAmountYuan = Number(options.depositDeductAmountYuan || 0)
|
||||
if (depositDeductAmountYuan > 0) {
|
||||
lines.push(`押金赔付扣除:¥${depositDeductAmountYuan.toFixed(2)}(将直接从预收押金中扣除)`)
|
||||
}
|
||||
if (lines.length === 0) {
|
||||
lines.push('租客发起结账。')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user